|
27 | 27 | dump-path|eval|log|path-info|search|show-derivation|sign-paths|verify|why-depends)
|
28 | 28 | nix $cmd -f ${hixProject} ${args} "$@"
|
29 | 29 | ;;
|
30 |
| - flake|build|develop|run) |
| 30 | + flake|build|develop|run|profile) |
| 31 | + # Put the flake files for remote URLs in $HOME/.hix by default |
| 32 | + HIX_DIR="''${HIX_DIR:-$HOME/.hix}" |
31 | 33 | while(($#)); do
|
32 | 34 | arg=$1
|
33 | 35 | case $arg in
|
|
45 | 47 | ;;
|
46 | 48 | github:*#*)
|
47 | 49 | SRC="''${arg%%#*}"
|
48 |
| - args+=("path:${hixProject}#''${arg#*#}" --override-input src "$SRC") |
49 |
| - is_github=true |
| 50 | + FLAKE=$HIX_DIR/$SRC |
| 51 | + args+=("path:$FLAKE#''${arg#*#}" --override-input src "$SRC") |
| 52 | + has_input_src=true |
50 | 53 | ;;
|
51 | 54 | github:*)
|
52 | 55 | SRC="$arg"
|
53 |
| - args+=("path:${hixProject}" --override-input src "$SRC") |
54 |
| - is_github=true |
| 56 | + FLAKE=$HIX_DIR/$SRC |
| 57 | + args+=("path:$FLAKE" --override-input src "$SRC") |
| 58 | + has_input_src=true |
55 | 59 | ;;
|
56 | 60 | *#*)
|
57 | 61 | SRC="''${arg%%#*}"
|
58 |
| - args+=("path:$SRC/.hix-flake#''${arg#*#}" --override-input src "$SRC") |
| 62 | + FLAKE=$SRC/.hix-flake |
| 63 | + args+=("path:$FLAKE#''${arg#*#}" --override-input src "$SRC") |
59 | 64 | has_input_src=true
|
60 | 65 | ;;
|
61 | 66 | .*)
|
62 | 67 | SRC="$arg"
|
63 |
| - args+=("path:$SRC/.hix-flake" --override-input src "$SRC") |
| 68 | + FLAKE=$SRC/.hix-flake |
| 69 | + args+=("path:$FLAKE" --override-input src "$SRC") |
64 | 70 | has_input_src=true
|
65 | 71 | ;;
|
66 | 72 | *)
|
|
69 | 75 | esac
|
70 | 76 | shift
|
71 | 77 | done
|
72 |
| - if [ "$is_github" != true ]; then |
73 |
| - if [ "$has_input_src" != true ]; then |
74 |
| - SRC=. |
75 |
| - args+=("path:$SRC/.hix-flake" --override-input src "$SRC") |
76 |
| - fi |
77 |
| - # Make a temporary flake if we have not already |
78 |
| - if [ ! -d $SRC/.hix-flake ]; then |
79 |
| - mkdir $SRC/.hix-flake |
80 |
| - fi |
81 |
| - HIX_FLAKE="$(mktemp -d)/flake.nix" |
82 |
| - sed 's|EVAL_SYSTEM|${pkgs.stdenv.hostPlatform.system}|' < ${hixProject}/flake.nix > $HIX_FLAKE |
83 |
| - if ! cmp $HIX_FLAKE $SRC/.hix-flake/flake.nix &>/dev/null; then |
84 |
| - if [ -e $SRC/.hix-flake/flake.lock ]; then |
85 |
| - echo "Updating $SRC/.hix-flake/flake.nix and deleting old $SRC/.hix-flake/flake.lock" |
86 |
| - rm $SRC/.hix-flake/flake.lock |
87 |
| - else |
88 |
| - echo "Updating $SRC/.hix-flake/flake.nix" |
89 |
| - fi |
90 |
| - cp $HIX_FLAKE $SRC/.hix-flake/flake.nix |
91 |
| - chmod +w $SRC/.hix-flake/flake.nix |
| 78 | + if [ "$has_input_src" != true ]; then |
| 79 | + SRC=. |
| 80 | + FLAKE=$SRC/.hix-flake |
| 81 | + args+=("path:$FLAKE" --override-input src "$SRC") |
| 82 | + fi |
| 83 | + # Make a temporary flake if we have not already |
| 84 | + mkdir -p $FLAKE |
| 85 | + HIX_FLAKE="$(mktemp -d)/flake.nix" |
| 86 | + sed 's|EVAL_SYSTEM|${pkgs.stdenv.hostPlatform.system}|' < ${hixProject}/flake.nix > $HIX_FLAKE |
| 87 | + if ! cmp $HIX_FLAKE $FLAKE/flake.nix &>/dev/null; then |
| 88 | + if [ -e $FLAKE/flake.lock ]; then |
| 89 | + echo "Updating $FLAKE/flake.nix and deleting old $FLAKE/flake.lock" |
| 90 | + rm $FLAKE/flake.lock |
| 91 | + else |
| 92 | + echo "Updating $FLAKE/flake.nix" |
92 | 93 | fi
|
| 94 | + cp $HIX_FLAKE $FLAKE/flake.nix |
| 95 | + chmod +w $FLAKE/flake.nix |
93 | 96 | fi
|
94 | 97 | nix $cmd "''${args[@]}"
|
95 | 98 | ;;
|
|
0 commit comments