I want to do development and testing on a wayland compositor that is available in unstable, but I wish to work on bleeding edge git commits of the package.
Thus, I am looking for guidance on using nix develop within the context of an existing home-manager flake. I have a flake with some overrides for dwl that draw in git versions of wlroots and dwl and I want to start a nix develop environment to work on the git dwl code.
I have tried nix develop nixpkgs#dwl
and while this pulls into the $PATH the necessary build tools, it leaves me with the (non-git) versions of wlroots and dwl that are present in unstable instead of the git override versions I need to compile and work on.
I have tried nix develop /home/username/.config/home-manager#dwl
and nix develop /home/username/.config/home-manager#[various permutations of username or username@host or homeConfigurations.username@host]
but I am guessing that a home-manager flake.nix is not sufficient for nix develop because all of these yield
“flake … does not provide attribute …”
or
“flake output attribute … is not a derivation or path”.
If I must create a new flake from scratch to use nix develop, I’ll do so, but it seems like there is a way I am simply not aware of to work on the source of the package that I already have installed.
It is likely that I am overlooking something obvious. I have a thick skin. If I am being an idiot, just tell me so, but please point me toward what I should have read.
If your flake at ~/.config/home-manager provides the package dwl with some overridden dependencies, I’d expect nix develop ~/.config/home-manager#dwl to enter a shell with those dependencies. – Your packages.x86_64-linux.dwl should evaluate to this dwl with overridden dependencies.
Whereas: nix develop nixpkgs#dwl would be a devshell for dwl from the nixpkgs flake (and wouldn’t have anything to do with ~/.config/home-manager; invoking this command wouldn’t look there for anything), and nix develop ~/.config/home-manager#username@host is looking for the devShell or package named username@host in the flake at ~/.config/home-manager, so it’s erroring out with “that output attribute is not provided”.
@rgoulter: Thank you for taking the time to read and answer.
I did try that route as well, though I did not describe it in the original post. The specific error I received when I did led me to believe I was still taking the wrong approach.
The overrides for dwl are within files in the import = [] set in redacted_host?.nix
Running nix develop ~/.config/home-manager#dwl
yields error: flake 'path:/home/redacted_user/.config/home-manager' does not provide attribute 'devShells.x86_64-linux.dwl', 'packages.x86_64-linux.dwl', 'legacyPackages.x86_64-linux.dwl' or 'dwl'
At that point, nothing currently in my existing flake.nix file is really of any use and the modules/imports I have written have to be re-written within the flake anyway.
It would seem that the answer to the original question
is, “yes, one must rewrite the flake from scratch. The bits already generated for home-manager cannot be used directly in nix develop.”
I have started work on doing just that and I am running into a great deal of difficulty phrasing final: prev: ... within flake.nix in a way that nix will accept, but I’ll puzzle through that.
Your experience and willingness to lend a hand here were very much appreciated.
EDIT: The above sounds like complaint. It is not. Nix is a great experience. It is like linux from the beginning was for me decades ago … and sometimes there is frustration in learning and I get to feel really stupid … like years ago. : )