1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-03-31 04:04:32 +00:00
This commit is contained in:
Adam Dinwoodie 2025-03-30 11:02:17 -07:00 committed by GitHub
commit d1fee59dac
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 30 additions and 2 deletions

View file

@ -639,6 +639,28 @@ function doBuild() {
presentNews
}
function doRepl() {
setFlakeAttribute
if [[ -v FLAKE_CONFIG_URI ]]; then
_i 'home-manager repl does not (yet) support flakes' >&2
return 1
fi
setConfigFile
extraArgs=()
for p in "${EXTRA_NIX_PATH[@]}"; do
extraArgs+=(-I "$p")
done
exec nix repl \
--file '<home-manager/home-manager/home-manager.nix>' \
"${extraArgs[@]}" \
"${PASSTHROUGH_OPTS[@]}" \
--argstr confPath "$HOME_MANAGER_CONFIG" \
--argstr confAttr "$HOME_MANAGER_CONFIG_ATTRIBUTE"
}
function doSwitch() {
setWorkDir
@ -943,6 +965,9 @@ function doHelp() {
echo " Remove indicated generations. Use 'generations' command to"
echo " find suitable generation numbers."
echo
echo " repl"
echo " Opens the configuration in \`nix repl\`"
echo
echo " expire-generations TIMESTAMP"
echo " Remove generations older than TIMESTAMP where TIMESTAMP is"
echo " interpreted as in the -d argument of the date tool. For"
@ -966,7 +991,7 @@ while [[ $# -gt 0 ]]; do
opt="$1"
shift
case $opt in
build|init|instantiate|option|edit|expire-generations|generations|help|news|packages|remove-generations|switch|uninstall)
build|init|instantiate|option|edit|expire-generations|generations|help|news|packages|remove-generations|repl|switch|uninstall)
COMMAND="$opt"
;;
-A)
@ -1111,6 +1136,9 @@ case $COMMAND in
packages)
doListPackages
;;
repl)
doRepl
;;
news)
doShowNews --all
;;

View file

@ -15,4 +15,4 @@ let
check = check;
};
in { inherit (env) activationPackage config; }
in { inherit (env) activationPackage config pkgs options; }