shell#flk: consistent quoting

This commit is contained in:
Timothy DeHerrera 2021-02-01 20:10:26 -07:00
parent 4ae99af29d
commit 46a7e7d4ce
No known key found for this signature in database
GPG Key ID: 8985725DB5B0C122
1 changed files with 11 additions and 11 deletions

View File

@ -11,27 +11,27 @@ let
}).config.system.build;
flk = pkgs.writeShellScriptBin "flk" ''
system=$(nix eval --impure --expr "builtins.currentSystem")
system=${"\${system//\\\"/"}}
system="$(nix eval --impure --expr builtins.currentSystem)"
system="${"\${system//\\\"/"}}"
if [[ -z "$1" ]]; then
echo "Usage: $(basename "$0") [ up | iso {host} | install {host} | {host} [switch|boot|test] | home {host} {user} [switch] ]"
echo "Usage: $(basename $0) [ up | iso {host} | install {host} | {host} [switch|boot|test] | home {host} {user} [switch] ]"
elif [[ "$1" == "up" ]]; then
mkdir -p $DEVSHELL_ROOT/up
hostname=$(hostname)
nixos-generate-config --dir $DEVSHELL_ROOT/up/$hostname
mkdir -p "$DEVSHELL_ROOT/up"
hostname="$(hostname)"
nixos-generate-config --dir "$DEVSHELL_ROOT/up/$hostname"
echo \
"{
imports = [ ../up/$hostname/configuration.nix ];
}" > $DEVSHELL_ROOT/hosts/up-$hostname.nix
git add -f $DEVSHELL_ROOT/up/$hostname
git add -f $DEVSHELL_ROOT/hosts/up-$hostname.nix
}" > "$DEVSHELL_ROOT/hosts/up-$hostname.nix"
git add -f "$DEVSHELL_ROOT/up/$hostname"
git add -f "$DEVSHELL_ROOT/hosts/up-$hostname.nix"
elif [[ "$1" == "iso" ]]; then
nix build $DEVSHELL_ROOT#nixosConfigurations.$2.${build}.iso "${"\${@:3}"}"
nix build "$DEVSHELL_ROOT#nixosConfigurations.$2.${build}.iso" "${"\${@:3}"}"
elif [[ "$1" == "install" ]]; then
sudo nixos-install --flake "$DEVSHELL_ROOT#$2" "${"\${@:3}"}"
elif [[ "$1" == "home" ]]; then
nix build ./#hmActivationPackages."$system".$2.$3 "${"\${@:4}"}"
nix build "./#hmActivationPackages.$system.$2.$3" "${"\${@:4}"}"
if [[ "$4" == "switch" ]]; then
./result/activate && unlink result
fi