-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nix profile
s are hard to reproduce
#7965
Comments
Re-labeling as |
This issue has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/flakes-as-a-unified-format-for-profiles/29476/1 |
As very much a newcomer to Nix, I also found this surprisingly difficult. I ended up installing Once I learn how, I would probably try moving from |
This is a regression compared to the old cli in which you can just use: nix-env --install --remove-all --file blah.nix where blah.nix returns an attrset with the packages you want to install. (also, if the manifest format prevents you writing Nix expressions to define what to install it really loses out on many benefits of Nix) |
@lf- declarative configs still works in the new CLI: You can run { pkgs ? import <nixpkgs> {} }:
with pkgs; [
direnv
asdf-vm
grc
autojump
] You can also put a declarative configuration into a {
outputs = { self, nixpkgs }:
let
system = "aarch64-darwin";
pkgs = nixpkgs.legacyPackages.${system};
in {
packages.${system}.default = pkgs.buildEnv {
name = "my-env";
paths = with pkgs; [ direnv asdf-vm grc autojump ];
};
};
} Which you can then install with If you then change anything in that See "Transitioning from imperative to declarative package management with nix alone" (Nix Discourse) where I posted more detailed info about this. However, this is not what this ticket is about. If you have the foresight and put in the effort, a declarative profile already allows you to get a declarative profile. But if you just used I think a potential and more generalized solution to this might be #8806 in conjunction with a PR that creates profile generations via a single derivation. Right now, a profile doesn't have a deriver (i.e. a derivation it was built from):
Both Hm, ok, maybe a dedicated mechanism that is |
The main selling point of Nix is reproducibility. However, since
nix profile
doesn't expose itsmanifest.json
it is far from trivial to reproduce the same profile on a different system.manifest.json
seems like a good candidate to be used innix shell
, home-manager and NixOS. This gives the best of both worlds: imperative CLI, declarative and shareable configuration. For example, something like this would be nice to have:This is similar to what Guix is already doing: https://guix.gnu.org/manual/devel/en/html_node/Writing-Manifests.html
The text was updated successfully, but these errors were encountered: