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
home-manager: enable nix run for activationPackage #1828
home-manager: enable nix run for activationPackage #1828
Conversation
Symlink $out/activate to $out/bin/home-manager-generation in activationPackage, so you can use nix run to build a generation inside of a flake and then directly activate it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the contribution 👍
This will be quite useful to many users.
@@ -552,6 +552,9 @@ in | |||
|
|||
cp ${activationScript} $out/activate | |||
|
|||
mkdir $out/bin | |||
ln -s $out/activate $out/bin/home-manager-generation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ln -s $out/activate $out/bin/home-manager-generation | |
ln -s $out/activate $out/bin/activate |
To have a similar API to NixOS.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When I tested it, nix run only tries to run $out/bin/<package-name>
(that's why nix run nixpkgs#neovim
doesn't work). So if the symlink is moved to a different location you can't run it automatically anymore.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see NixOS/nix#4498
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, I forgot about this peculiarity of nix run
. It's good to know meta.mainProgram
exists now.
I usually always do nix shell nixpkgs#something -c some-program
Closed in favor of #1856 |
Description
Adds a symlink from
$out/activate
to$out/bin/home-manager-generation
in the home-manager-generation activationPackage.This makes it possible for people who put their home-manager configuration in a flake (not as a part of a NixOS configuration)
to update their home with:
nix run flake#homeMangerConfigurations.<name>.activationPackage
Instead of with
nix build <stuff> && ./result/activate
which is more cumbersome, and pollutes yourgcroots/auto
with stray symlinks to your current folder.Checklist
Change is backwards compatible.
Code formatted with
./format
.Code tested through
nix-shell --pure tests -A run.all
.[ ] Test cases updated/added. See example.
Commit messages are formatted like
See CONTRIBUTING for more information and recent commit messages for examples.
If this PR adds a new module
Added myself as module maintainer. See example.
Added myself and the module files to
.github/CODEOWNERS
.