diff --git a/home-manager/home-manager b/home-manager/home-manager index 45fe0e1c..1874143a 100644 --- a/home-manager/home-manager +++ b/home-manager/home-manager @@ -49,27 +49,11 @@ function setHomeManagerModulesPath() { } function doBuild() { - if [[ -z "$1" ]]; then - echo "Need to provide generation output path." - exit 1 - fi - - if [[ -e "$1" ]]; then - echo "The output path $1 already exists." - exit 1 - fi - setConfigFile setHomeManagerModulesPath - output="$(realpath "$1")" - - if [[ $? -ne 0 ]]; then - exit 1 - fi - local extraArgs - extraArgs="" + extraArgs="$1" for p in "${EXTRA_NIX_PATH[@]}"; do extraArgs="$extraArgs -I $p" @@ -83,21 +67,15 @@ function doBuild() { "@HOME_MANAGER_EXPR_PATH@" \ --argstr confPath "$HOME_MANAGER_CONFIG" \ --argstr confAttr "$HOME_MANAGER_CONFIG_ATTRIBUTE" \ - -A activation-script \ - -o "$output" + -A activation-script } function doSwitch() { - local wrkdir - wrkdir="$(mktemp -d)" - local generation local exitCode=0 - generation=$(doBuild "$wrkdir/result") && $generation/activate || exitCode=1 - # Because the previous command never fails, the script keeps running and - # $wrkdir is always removed. - rm -r "$wrkdir" + generation=$(doBuild "--no-out-link") && $generation/activate || exitCode=1 + return $exitCode } @@ -179,7 +157,7 @@ cmd="$*" case "$cmd" in build) - doBuild "result" + doBuild "" ;; switch) doSwitch