]> Git — Sourcephile - sourcephile-nix.git/blob - nixpkgs/patches/nixos-install.diff
nix: remove no longer used nixpkgs/patches
[sourcephile-nix.git] / nixpkgs / patches / nixos-install.diff
1 diff --git a/nixos/modules/installer/tools/nixos-install.sh b/nixos/modules/installer/tools/nixos-install.sh
2 index 0b62bca8367..b27edd22655 100644
3 --- a/nixos/modules/installer/tools/nixos-install.sh
4 +++ b/nixos/modules/installer/tools/nixos-install.sh
5 @@ -34,6 +34,22 @@ while [ "$#" -gt 0 ]; do
6 --system|--closure)
7 system="$1"; shift 1
8 ;;
9 + --flake)
10 + flake="$1"
11 + shift 1
12 + ;;
13 + --recreate-lock-file|--no-update-lock-file|--no-write-lock-file|--no-registries|--commit-lock-file)
14 + lockFlags+=("$i")
15 + ;;
16 + --update-input)
17 + j="$1"; shift 1
18 + lockFlags+=("$i" "$j")
19 + ;;
20 + --override-input)
21 + j="$1"; shift 1
22 + k="$1"; shift 1
23 + lockFlags+=("$i" "$j" "$k")
24 + ;;
25 --channel)
26 channelPath="$1"; shift 1
27 ;;
28 @@ -92,7 +108,20 @@ if [[ ${NIXOS_CONFIG:0:1} != / ]]; then
29 exit 1
30 fi
31
32 -if [[ ! -e $NIXOS_CONFIG && -z $system ]]; then
33 +if [[ -n $flake ]]; then
34 + if [[ $flake =~ ^(.*)\#([^\#\"]*)$ ]]; then
35 + flake="${BASH_REMATCH[1]}"
36 + flakeAttr="${BASH_REMATCH[2]}"
37 + fi
38 + flakeAttr="nixosConfigurations.\"$flakeAttr\""
39 +fi
40 +
41 +# Resolve the flake.
42 +if [[ -n $flake ]]; then
43 + flake=$(nix flake info --json "${extraBuildFlags[@]}" "${lockFlags[@]}" -- "$flake" | jq -r .url)
44 +fi
45 +
46 +if [[ ! -e $NIXOS_CONFIG && -z $system && -z $flake ]]; then
47 echo "configuration file $NIXOS_CONFIG doesn't exist"
48 exit 1
49 fi
50 @@ -108,11 +137,18 @@ sub="auto?trusted=1"
51
52 # Build the system configuration in the target filesystem.
53 if [[ -z $system ]]; then
54 - echo "building the configuration in $NIXOS_CONFIG..."
55 outLink="$tmpdir/system"
56 - nix-build --out-link "$outLink" --store "$mountPoint" "${extraBuildFlags[@]}" \
57 - --extra-substituters "$sub" \
58 - '<nixpkgs/nixos>' -A system -I "nixos-config=$NIXOS_CONFIG" ${verbosity[@]}
59 + if [[ -z $flake ]]; then
60 + echo "building the configuration in $NIXOS_CONFIG..."
61 + nix-build --out-link "$outLink" --store "$mountPoint" "${extraBuildFlags[@]}" \
62 + --extra-substituters "$sub" \
63 + '<nixpkgs/nixos>' -A system -I "nixos-config=$NIXOS_CONFIG" ${verbosity[@]}
64 + else
65 + echo "building the flake in $flake..."
66 + nix build "$flake#$flakeAttr.config.system.build.toplevel" \
67 + --extra-substituters "$sub" ${verbosity[@]} \
68 + "${extraBuildFlags[@]}" "${lockFlags[@]}" --out-link "$outLink"
69 + fi
70 system=$(readlink -f $outLink)
71 fi
72