3 ms·
As a Guix user who also dabbles in Nix, I am still confused by how to use flakes as a "package consumer". I have a flake (non-declaritively) added to my nix-pro
by xelxebar 4y ago
As a Guix user who also dabbles in Nix, I am still confused by how to use flakes as a "package consumer". I have a flake (non-declaritively) added to my nix-profile, along with some packages that came from my nixpkgs/config.nix. However, after adding the flake, I am unable to update my profile's packages: `nix profile update` becomes essentially a no-op, even after updating the channel.
* How does declarative management of user nix-profiles work now with flakes?
- JamesSwift 4y agoI use home-manager as my profile management layer so I might not understand your setup fully, but Flakes dont really mesh with channels. They instead use a flake.lock and so you would need to do a `nix flake update` to get the flake-managed packages updated. EDIT: you also might be able to inject your local channels "pkgs" definition into the flake so that they reference the same versions. e.g. for home-manager with flakes you would do it like this inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; home-manager = { inputs.nixpkgs.follows = "nixpkgs"; # <- deduped version of packages url = "github:nix-community/home-manager"; }; };
- grumbel 4y ago> I am still confused by how to use flakes as a "package consumer" A Flake is a git repository or another Flake compatible URL. If you want to run a flake, it's simply: nix run github:juser/hello or: nix shell github:juser/hello If you want to install it as a user: nix profile install github:juser/hello If you do: nix profile update '.*' It will go through the packages in your profile and check for updates to the Git repositories and update the packages. If you have the Flake URL pointing to a specific revision, it will stay with that and never update: nix run github:juser/hello?rev=53cd89289e44b269e28d2340f022e5f63525bcd3 As far as I understand it, the 'nix profile' command is imperative, not declarative. Only the packages installed system wide in /etc/nixos/ are declarative. If you want to use flakes there, create a /etc/nixos/flake.nix and declare your flakes as input. nix-channel is no longer necessary when you go fully with Flakes. For declarative management of your $HOME directory you need home-manager, which is still a separate community project, not part of the core NixOS.