Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I’m maybe missing something but non-flake nix also pull packages by just referencing them. Right?


Yes, in Nix code it is possible to refer to arbitrary Nix codebases from Nix code.

I'd point to the home-manager installation instructions for an example of Nix flakes having a nicer UX. Running flake-enabled codebases is just much nicer than non-flake codebases.

https://nix-community.github.io/home-manager/index.html#sec-...

https://nix-community.github.io/home-manager/index.html#sec-...

The former involves running `nix-channel --add <...> home-manager && nix-channel --update` in order for `<home-manager>` to mean anything. With the latter, it's simply `nix run home-manager/release-23.05 -- init --switch`. (Albeit, `home-manager` is already registered as an alias for `github:nix-community/home-manager`).

One key detail is that `nix-channel --add` modifies the 'system state', whereas running flakes essentially does not.

-- Regarding "you can pull in arbitrary Nix code by reference". With flakes, you have a standard entry point where you know the interface it has. Whereas, having a 'default.nix' is a convention, and there's no way to know how a `default.nix` is to be used without reading its source.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: