The minimal configurations + know where to search packages and how to specify them as flake output attribute.
If needed, you’ll also apply extra setups. I’ll keep it updated.
For advanced usage, you’ll need to read docstrings in the source and learn about nix shell. And maybe the Nix language as well if you aim for complex usage.
It means yon can install packages declaratively and don’t have to manage the state manually. You can also deploy these package (guix copy, guix pack, guix deploy etc.) to other machines that have Nix set up.
But would it be better to use than flatpak?
Too many nonguix options makes packages a chore to maintain.
I use flatpak mainly in order to have microsoft teams.
Nix has a large collection of commonly used desktop software. And this approach allows you to declare everything in your config file without manually managing the state.
That being said, I may upstream it since it’s more complete than my other stuff in terms of documentation. But there’s no guarantee on the time / maintenance if I stop using it.
Fascinating, nice work on this. I have my own rough solution for managing Nix packages via Guix, but it seems quite different from yours. While yours is built around Nix’s shell command, mine just generates a flake that uses flakey-profile to expose a profile you can install with the current user. Your system is admittedly much more sophisticated, and I might look at migrating my config to use it instead.
Out of curiosity, when does Nix actually build the packages installed through this? If everything that’s on your PATH is a Nix shell wrapper, does it just do it when you run that script for the first time? When do Nix packages update, and do you have any control over it? My approach has the advantage of using a normal flake.lock file, so you just have to update its inputs like any other flake. Maybe with-nix-profile gives you something like this; I’m not really sure.
Sorry if these are stupid questions, I only have a basic understanding of Nix profiles. I only know about flakes since I ran NixOS for a while before I switched over to Guix.
Out of curiosity, when does Nix actually build the packages installed through this?Out of curiosity, when does Nix actually build the packages installed through this?
When using with-nix-profile, it collects Nix expressions used by the wrappers and provides a build-nix-profile command. (nix-expressions->profile-build-wrapper)
Then the nix-search-paths service extends Shepherd to invoke the command on system reconfiguration (one-shot service) and boot (when nix-daemon and networking are ready). The service also extends shell profiles to update search paths.
Ah, I see. I saw the documentation about the build-nix-profile command, but the missing piece was that it was automatically ran as a Shepherd one-shot service.
Thanks for answering my question. Like I mentioned, I’ll definitely have to think about changing my configuration to use this instead. Being able to install Nix packages as if they were normal Guix ones is a very cool advantage which my system doesn’t really have.
This is really nice! I’m trying it out, but missing one thing – how do i allow non-free packages from nix? it doesn’t seem to have a way to specify it in the nix service options… i have been using a flake where i can configure nixpkgs, but i’d much rather have it all together like this.
it looks like for this to work the nix commands must have the --impure flag… but i don’t see how i can make sure that’s added via your nix integration. is there a way to add “–impure”?