home-manager: remove unsupported -2 option

This option used to make the `home-manager` command use the `nix` tool
from Nix 2. Unfortunately the `nix` tool is a bit experimental and it
is best to await its stabilization before supporting it in Home
Manager.
This commit is contained in:
Robert Helgesson 2020-04-18 10:54:40 +02:00
parent e5325c2274
commit 687395ebda
No known key found for this signature in database
GPG key ID: 36BDAA14C2797E89

View file

@ -110,22 +110,12 @@ function doBuildAttr() {
extraArgs=("${extraArgs[@]}" "--show-trace") extraArgs=("${extraArgs[@]}" "--show-trace")
fi fi
# shellcheck disable=2086 nix-build \
if [[ -v USE_NIX2_COMMAND ]]; then "<home-manager/home-manager/home-manager.nix>" \
nix build \ "${extraArgs[@]}" \
-f "<home-manager/home-manager/home-manager.nix>" \ "${PASSTHROUGH_OPTS[@]}" \
"${extraArgs[@]}" \ --argstr confPath "$HOME_MANAGER_CONFIG" \
"${PASSTHROUGH_OPTS[@]}" \ --argstr confAttr "$HOME_MANAGER_CONFIG_ATTRIBUTE"
--argstr confPath "$HOME_MANAGER_CONFIG" \
--argstr confAttr "$HOME_MANAGER_CONFIG_ATTRIBUTE"
else
nix-build \
"<home-manager/home-manager/home-manager.nix>" \
"${extraArgs[@]}" \
"${PASSTHROUGH_OPTS[@]}" \
--argstr confPath "$HOME_MANAGER_CONFIG" \
--argstr confAttr "$HOME_MANAGER_CONFIG_ATTRIBUTE"
fi
} }
# Presents news to the user. Takes as argument the path to a "news # Presents news to the user. Takes as argument the path to a "news
@ -191,13 +181,8 @@ function doBuild() {
local exitCode local exitCode
if [[ -v USE_NIX2_COMMAND ]]; then doBuildAttr --attr activationPackage \
doBuildAttr activationPackage \ && exitCode=0 || exitCode=1
&& exitCode=0 || exitCode=1
else
doBuildAttr --attr activationPackage \
&& exitCode=0 || exitCode=1
fi
presentNews "$newsInfo" presentNews "$newsInfo"
@ -219,17 +204,10 @@ function doSwitch() {
# before activation completes. # before activation completes.
generation="$WORK_DIR/generation" generation="$WORK_DIR/generation"
if [[ -v USE_NIX2_COMMAND ]]; then doBuildAttr \
doBuildAttr \ --out-link "$generation" \
--out-link "$generation" \ --attr activationPackage \
activationPackage \ && "$generation/activate" || exitCode=1
&& "$generation/activate" || exitCode=1
else
doBuildAttr \
--out-link "$generation" \
--attr activationPackage \
&& "$generation/activate" || exitCode=1
fi
presentNews "$newsInfo" presentNews "$newsInfo"
@ -329,23 +307,14 @@ function buildNews() {
local output local output
output="$WORK_DIR/news-info.sh" output="$WORK_DIR/news-info.sh"
if [[ -v USE_NIX2_COMMAND ]]; then doBuildAttr \
doBuildAttr \ --out-link "$output" \
--out-link "$output" \ --no-build-output \
--quiet \ --quiet \
--arg check false \ --arg check false \
--argstr newsReadIdsFile "$(newsReadIdsFile)" \ --argstr newsReadIdsFile "$(newsReadIdsFile)" \
newsInfo --attr newsInfo \
else > /dev/null
doBuildAttr \
--out-link "$output" \
--no-build-output \
--quiet \
--arg check false \
--argstr newsReadIdsFile "$(newsReadIdsFile)" \
--attr newsInfo \
> /dev/null
fi
echo "$output" echo "$output"
} }
@ -498,9 +467,6 @@ while [[ $# -gt 0 ]]; do
build|instantiate|edit|expire-generations|generations|help|news|packages|remove-generations|switch|uninstall) build|instantiate|edit|expire-generations|generations|help|news|packages|remove-generations|switch|uninstall)
COMMAND="$opt" COMMAND="$opt"
;; ;;
-2)
USE_NIX2_COMMAND=1
;;
-A) -A)
HOME_MANAGER_CONFIG_ATTRIBUTE="$1" HOME_MANAGER_CONFIG_ATTRIBUTE="$1"
shift shift