-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Add home-manager instantiate subcommand #1099
Conversation
nix-bisect is really impressive, if this can support your tool, +1 from me |
home-manager/home-manager
Outdated
@@ -182,6 +190,21 @@ function doBuild() { | |||
return $exitCode | |||
} | |||
|
|||
function doInstantiate() { | |||
local exitCode |
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.
I would suggest not reusing doBuildAttr
and instead have something like
function doInstantiate() {
setConfigFile
setHomeManagerNixPath
local extraArgs=("$@")
for p in "${EXTRA_NIX_PATH[@]}"; do
extraArgs=("${extraArgs[@]}" "-I" "$p")
done
if [[ -v VERBOSE ]]; then
extraArgs=("${extraArgs[@]}" "--show-trace")
fi
nix-instantiate \
"<home-manager/home-manager/home-manager.nix>" \
"${extraArgs[@]}" \
"${PASSTHROUGH_OPTS[@]}" \
--argstr confPath "$HOME_MANAGER_CONFIG" \
--argstr confAttr "$HOME_MANAGER_CONFIG_ATTRIBUTE"
}
@@ -74,6 +74,7 @@ function setHomeManagerNixPath() { | |||
done | |||
} | |||
|
|||
|
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.
Can remove this line.
Yes, I think this is a good idea 👍 If you adjust the code per the comment I added then I'd be happy to merge. |
7b73f71
to
64c9f87
Compare
I applied the suggested changes, butfor some reason
Was that intentional? I don't quite understand why this happens (it didn't before). |
Nice, I think this looks cleaner. Yes, the two derivations are intentional. If you want just the generation derivation then add Also don't forget to update the |
It can be useful to simply instantiate a home-manager configuration without actually building it, for example for the purpose of pre-building it with some custom command.
64c9f87
to
e343713
Compare
Ah, I missed that bit. Intuitively I would expect the command to only instantiate the activation package, since that is the "interesting" part that one might want to pre-build or that might fail to build. But at worst the news derivation makes scripting slightly more cumbersome. I don't really mind. What do you prefer?
Thanks for the hints! Done. In the process I also noticed that bash completions were missing in the nixpkgs package, so I fixed that: NixOS/nixpkgs#83360. Note that I've never written a man page or bash completions, but I just adapted what was already there and it seems to work fine. |
It can be useful to simply instantiate a Home Manager configuration without actually building it, for example for the purpose of pre-building it with some custom command. PR #1099
Looks good! Rebased to master in 5969551. |
This makes better use of parallelization and hopefully will fail earlier if there is an issue. Possible since nix-community/home-manager#1099
It can be useful to simply instantiate a Home Manager configuration without actually building it, for example for the purpose of pre-building it with some custom command. PR nix-community#1099
It can be useful to simply instantiate a Home Manager configuration without actually building it, for example for the purpose of pre-building it with some custom command. PR nix-community#1099
It can be useful to simply instantiate a home-manager configuration
without actually building it, for example for the purpose of
pre-building it with some custom command.
One recent usage example: I was trying to build a home-manager configuration with a custom tool (
nix-bisect
) before switching to the configuration. That would be much simpler and less hacky ifhome-manager
provided a way to instantiate a configuration.