summaryrefslogtreecommitdiff
path: root/packages/nixfiles.nix
diff options
context:
space:
mode:
authorAzat Bahawi <azat@bahawi.net>2023-11-19 21:58:34 +0300
committerAzat Bahawi <azat@bahawi.net>2023-11-19 21:58:34 +0300
commitedf7cc355cb1f55a9301283ebec15e01dc4ffe62 (patch)
treebf7745040efadac618168b7a9a764acb482acb07 /packages/nixfiles.nix
parent576d4d672d37e490bd5f8dfb4397909600ed68db (diff)
2023-11-19
Diffstat (limited to 'packages/nixfiles.nix')
-rw-r--r--packages/nixfiles.nix9
1 files changed, 5 insertions, 4 deletions
diff --git a/packages/nixfiles.nix b/packages/nixfiles.nix
index 782a193..02e89f2 100644
--- a/packages/nixfiles.nix
+++ b/packages/nixfiles.nix
@@ -25,7 +25,7 @@
# Shamelessly appropriated from https://github.com/ncfavier/config.
# Hopefully Naïm will not sue me for copyright infrigment.
text = ''
- nixfiles="''${NIXFILES:-$HOME/src/nixfiles}"
+ nixfiles="''${NIXFILES:-.}"
cmd=$1
shift
case $cmd in
@@ -108,10 +108,10 @@
# Assumes that hosts are configured in the OpenSSH configuration.
host=''${cmd#@}
hostname=$(ssh -q "$host" 'echo "$HOSTNAME"')
- exec nixos-rebuild -v --flake ".#$hostname" --target-host "$host" --use-remote-sudo --show-trace "$@"
+ exec nixos-rebuild -v --flake "$nixfiles#$hostname" --target-host "$host" --use-remote-sudo --show-trace "$@"
;;
*)
- exec nixos-rebuild -v --fast --flake "." --use-remote-sudo --show-trace "$cmd" "$@"
+ exec nixos-rebuild -v --fast --flake "$nixfiles" --use-remote-sudo --show-trace "$cmd" "$@"
;;
esac
'';
@@ -134,7 +134,7 @@
}
_nixfiles() {
local cur prev words cword
- local nixfiles="''${NIXFILES:-$HOME/src/nixfiles}"
+ local nixfiles="''${NIXFILES:-.}"
_init_completion -n ':=&'
if [[ "$cword" == 1 ]] || [[ "$cword" == 2 && "$prev" == @* ]]; then
if [[ $cur == @* ]]; then
@@ -180,5 +180,6 @@ in
license = licenses.wtfpl;
platforms = platforms.unix;
maintainers = with maintainers; [azahi];
+ mainProgram = "nixfiles";
};
}