Flakey-profile: declarative nix profiles as flakes

That is a very interesting approach!

Why does this work, exactly? What is the value of "$@" here and why?

A few things I’m noticing after looking at the readme (and not trying it out at all):

let
  pkgs = import nixpkgs {
    inherit system;
  };
in

You might want to replace that with pkgs = nixpkgs.legacyPackages.${system};, see 1000 instances of nixpkgs.

Update package versions

Would it be possible to make that a builtin script as well? nix run .#profile.upgrade would very nice in terms of UX.

Non-goals

For this as well, would it be possible to implement nix run .#profile.list? I know it’s not technically required, but when you have a few different profiles, especially when composing them from multiple lists of packages (CLI only, GUI tools, debugging utilities, etc.), it would be quite useful as a debugging tool.

We are in favour of the removal of nix profile from the Nix codebase in lieu of stabilization.

Would you say then that nix-env should stay forever? I feel like nix profile has to replace it at some point as the main interface for managing profiles, and for flakey-profile to work you need some interface like that. I guess you could re-implement it pretty easily, it’s just symlinks after all, but as that functionality is such a basic part of a lot of nix-related tooling, that doesn’t seem feasible.

  • Do similar things to home-manager for services or other things. This is just a replacement for nix-env and nix profile and nothing more.

Very reasonable, having a defined scope is a good idea.

To use it, see the template in templates/default, or included below, or run:

nix flake init -t github:lf-/flakey-profile#templates.default

nix flake init -t github:lf-/flakey-profile is sufficient here :slight_smile:


Overall, I think this is a cool approach and definitely has its merits. What I would be interested in is how much of the package-management/profiles docs could be removed/replaced with this?

Could we make nix profile just be a codification of the “numbered symlink” paradigm used to implement profile, and handle everything else within something like flakey-profile?

2 Likes