Removing Home Manager
You can remove Home Manager by deleting or commenting out (by enclosing with /* and */ ) the relevant parts in your flake.nix
: your inputs
would then look something like this
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11";
/* home-manager = {
url = "github:nix-community/home-manager/release-23.11";
inputs.nixpkgs.follows = "nixpkgs";
}; */
};
and if you used Home Manager as a NixoS module (instead of standalone), then in the nixosConfigurations
section you comment out (or delete) the home-manager
module:
nixosConfigurations = {
"<hostname>" = nixpkgs.lib.nixosSystem {
inherit system;
specialArgs = { };
modules = [
./<path>/<to>/configuration.nix
/* home-manager.nixosModules.home-manager {
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
users.<username> = import ./<path>/<to>/home.nix;
extraSpecialArgs = { };
};
} */
];
};
};
After that, do a nix flake update
followed by nixos-rebuild boot
to apply the changes.
Imperatively installing packages and profiles as gcroots
There are actually two answers to this question:
- Yes, “declarative” means you “describe” how you want your whole system to be (e.g. in
configuration.nix
), including all the desired software, and Nix realizes/creates that system, whereas “imperative” means you instruct the system to do a specific task (like installing a specific package or executing a certain command). If, later, you want to do the same task again, you will have to remember the exact sequence of commands. That’s where the advantage of the declarative approach lies: it enables reproducibility because you can copy and transfer your declaration as is. Of course, imperatively installed software won’t be transferred this way. That’s why, in a sense, it is “not permanent”. - No, packages that you install with
nix profile install
ornix-env -iA
are permanently available on your system, because they are part of a user profile. That means, they won’t be garbage-collected until you delete them from your profile. Such profiles act as GC roots: put simply, everything in the Nix store which is referenced by a link from outside the store is protected from being garbage-collected. And everytime you install or remove a package this way, a new generation of that profile is generated. You can see your profiles in~/.local/state/nix/profiles
.
If you’re interested in how profiles, the Nix store and the linking system actually works, I highly recommend watching part of the video “Everyday Use of GNU Guix” (minutes 23 to 37) by Chris Marusich on YouTube. Nix works similar to Guix in this regard. (But the given commands differ.)
Old generations
That is weird. I currently don’t have any idea why that might be the case. But somewhat related, I’ve noticed in the screenshots you provided in your linked post that your system flake is still configured to use the old 23.05 stable branch. The stable releases usually receive bugfixes and security updates for seven months, so 23.05 is deprecated now. You probably want to change your configuration to 23.11. Maybe this in conjunction with the removal of Home Manager might eventually fix the issue with the generations as well?