hoenn: take flake as argument

This commit is contained in:
Aly Raffauf 2024-05-02 20:52:08 -04:00
parent 3ecdcd5ff6
commit a516c23fb0

View file

@ -5,18 +5,16 @@
... ...
}: let }: let
hoenn = pkgs.writeShellScriptBin "hoenn" '' hoenn = pkgs.writeShellScriptBin "hoenn" ''
FLAKE=''${FLAKE:-"github:alyraffauf/nixcfg"} FLAKE=''${2:-"github:alyraffauf/nixcfg"}
HOST=''${HOST:-${config.networking.hostName}} HOST=''${HOST:-${config.networking.hostName}}
GIT=''${GIT:-"https://github.com/alyraffauf/nixcfg.git"} GIT=https://''${FLAKE//:/\.com\/}.git
if [ "$1" = "sync" ]; then if [ "$1" == "sync" ]; then
if [ "$2" == "" ] || [ "$2" == "now" ]; then sudo ${pkgs.nixos-rebuild}/bin/nixos-rebuild switch --flake $FLAKE#$HOST
sudo ${pkgs.nixos-rebuild}/bin/nixos-rebuild switch --flake $FLAKE#$HOST exit 0;
exit 0; elif [ "$1" == "boot" ]; then
elif [ "$2" == "boot" ]; then bin/sudo ${pkgs.nixos-rebuild}/bin/nixos-rebuild boot --flake $FLAKE#$HOST
bin/sudo ${pkgs.nixos-rebuild}/bin/nixos-rebuild boot --flake $FLAKE#$HOST exit 0;
exit 0;
fi
elif [ "$1" == "gc" ]; then elif [ "$1" == "gc" ]; then
sudo ${pkgs.nix}/bin/nix-collect-garbage -d sudo ${pkgs.nix}/bin/nix-collect-garbage -d
exit 0; exit 0;