Hello
I am quite new to nixos, I’ve been running it for ~ 3 months.
Almost every time I update my nixos with sudo nixos-rebuild switch --flake ".#default"
and afterwards use nix-shell
command in a directory that has a shell.nix I need to recompile Python which takes some time.
I’ve found another topic in discourse talking about it might have todo with overlays. (https://discourse.nixos.org/t/why-do-i-need-to-compile-python-and-packgages-every-time-there-is-an-update/23280/6). I have some overlays, but I don’t understand why this is happening. I want to use stable and unstable nixos repo, so I use it as an overlay, is that why I need to recompile Python every time?
The reason why I use unstable and stable is because stable has some ‘outdated’ packages like neovim, so for this I want to use unstable, and some packages are broken on unstable so that is why I want to use stable.
for example a shell.nix
file:
let
pkgs = import <nixpkgs> {};
in pkgs.mkShell {
packages = with pkgs; [
python311
(poetry.override { python3 = python311; })
(python311.withPackages (p: with p; [
pip
]))
];
LD_LIBRARY_PATH = "${pkgs.stdenv.cc.cc.lib}/lib";
}
my flake.nix with overlay:
Github: https://github.com/sevaho/dotFiles/blob/929238a28f9afd54768435017710896e966eabd9/flake.nix#L28
File:
{
description = "Nixos config flake";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
nixpkgs-stable.url = "github:nixos/nixpkgs/nixos-24.05";
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, nixpkgs, nixpkgs-stable, home-manager, ... }@inputs: {
nixosConfigurations.default = nixpkgs.lib.nixosSystem {
modules = [
# This is required so we can use both stable and unstable nixpkgs
{
nixpkgs.overlays = [
(final: prev: {
stable = nixpkgs-stable.legacyPackages.${prev.system};
})
];
}
./nixos/configuration.nix
home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.sevaho = import ./home-manager/home.nix;
}
];
};
};
}
Anyone could help me with this problem?