From a516c23fb0136729ac2febd3ce447f3d2e2a9ccc Mon Sep 17 00:00:00 2001 From: Aly Raffauf Date: Thu, 2 May 2024 20:52:08 -0400 Subject: [PATCH] hoenn: take flake as argument --- nixosModules/scripts/hoenn/default.nix | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/nixosModules/scripts/hoenn/default.nix b/nixosModules/scripts/hoenn/default.nix index 9d019bdd..39161030 100644 --- a/nixosModules/scripts/hoenn/default.nix +++ b/nixosModules/scripts/hoenn/default.nix @@ -5,18 +5,16 @@ ... }: let hoenn = pkgs.writeShellScriptBin "hoenn" '' - FLAKE=''${FLAKE:-"github:alyraffauf/nixcfg"} + FLAKE=''${2:-"github:alyraffauf/nixcfg"} HOST=''${HOST:-${config.networking.hostName}} - GIT=''${GIT:-"https://github.com/alyraffauf/nixcfg.git"} + GIT=https://''${FLAKE//:/\.com\/}.git - if [ "$1" = "sync" ]; then - if [ "$2" == "" ] || [ "$2" == "now" ]; then - sudo ${pkgs.nixos-rebuild}/bin/nixos-rebuild switch --flake $FLAKE#$HOST - exit 0; - elif [ "$2" == "boot" ]; then - bin/sudo ${pkgs.nixos-rebuild}/bin/nixos-rebuild boot --flake $FLAKE#$HOST - exit 0; - fi + if [ "$1" == "sync" ]; then + sudo ${pkgs.nixos-rebuild}/bin/nixos-rebuild switch --flake $FLAKE#$HOST + exit 0; + elif [ "$1" == "boot" ]; then + bin/sudo ${pkgs.nixos-rebuild}/bin/nixos-rebuild boot --flake $FLAKE#$HOST + exit 0; elif [ "$1" == "gc" ]; then sudo ${pkgs.nix}/bin/nix-collect-garbage -d exit 0;