summaryrefslogtreecommitdiff
path: root/packages/nixfiles.nix
diff options
context:
space:
mode:
authorAzat Bahawi <azat@bahawi.net>2022-08-28 21:14:14 +0300
committerAzat Bahawi <azat@bahawi.net>2022-08-28 21:14:14 +0300
commit2e2a7bb1f640def9d627af8cc194faf7d911d8bf (patch)
tree4252d60535ffed05bb5f304f6fb0b05226809d8a /packages/nixfiles.nix
parent6ec5f8344117e6277bd225e6a178839f5648f36a (diff)
2022-08-28
Diffstat (limited to 'packages/nixfiles.nix')
-rw-r--r--packages/nixfiles.nix25
1 files changed, 8 insertions, 17 deletions
diff --git a/packages/nixfiles.nix b/packages/nixfiles.nix
index 90a5865..47b2c49 100644
--- a/packages/nixfiles.nix
+++ b/packages/nixfiles.nix
@@ -1,9 +1,7 @@
{
git,
jq,
- lib,
nix,
- nixfilesSrc ? "$HOME/src/nixfiles",
openssh,
writeShellApplication,
}:
@@ -11,17 +9,16 @@ writeShellApplication {
name = "nixfiles";
runtimeInputs = [git jq nix openssh];
text = ''
- nixfiles=${lib.escapeShellArg nixfilesSrc}
cmd="$1"
shift
- case $cmd in
+ case "$cmd" in
update)
if (( $# )); then
args=()
for input do args+=(--update-input "$input"); done
- exec nix flake lock "$nixfiles" "''${args[@]}"
+ exec nix flake lock "." "''${args[@]}"
else
- exec nix flake update -v "$nixfiles"
+ exec nix flake update -v "."
fi
;;
rev)
@@ -35,7 +32,7 @@ writeShellApplication {
repl|eval|build)
args=()
for arg do case $arg in
- -w|--wip) args+=(--override-flake config "$nixfiles")
+ -w|--wip) args+=(--override-flake config ".")
;;
*) args+=("$arg")
esac done
@@ -53,29 +50,23 @@ writeShellApplication {
home)
attr="nixosConfigurations.$HOSTNAME.config.hm.home.activationPackage"
export VERBOSE=1
- exec nix shell --verbose "$nixfiles#$attr" "$@" --command home-manager-generation
+ exec nix shell --verbose ".#$attr" "$@" --command home-manager-generation
;;
specialise)
- name=$1
+ name="$1"
shift
exec sudo /run/current-system/specialisation/"$name"/bin/switch-to-configuration switch
;;
revert)
exec sudo /nix/var/nix/profiles/system/bin/switch-to-configuration switch
;;
- test-headless)
- exec nixos-rebuild build-vm --verbose --print-build-logs --flake "$nixfiles#test-headless" "$@"
- ;;
- test-headful)
- exec nixos-rebuild build-vm --verbose --print-build-logs --flake "$nixfiles#test-headful" "$@"
- ;;
@*)
host="''${cmd#@}"
hostname="$(ssh -q "$host" 'echo "$HOSTNAME"')"
- exec nixos-rebuild -v --flake "$nixfiles#$hostname" --target-host "$host" --use-remote-sudo "$@"
+ exec nixos-rebuild -v --flake ".#$hostname" --target-host "$host" --use-remote-sudo "$@"
;;
*)
- exec nixos-rebuild -v --flake "$nixfiles" --use-remote-sudo "$cmd" "$@"
+ exec nixos-rebuild -v --flake . --use-remote-sudo "$cmd" "$@"
;;
esac
'';