zaneyos/config/scripts/themechange.nix
2024-04-04 18:03:34 -05:00

15 lines
406 B
Nix

{ pkgs, host, ... }:
let
inherit (import ../../hosts/${host}/options.nix) flakeDir hostname;
in
pkgs.writeShellScriptBin "themechange" ''
if [[ ! $@ ]];then
echo "No Theme Given"
else
replacement="$1"
sed -i "/^\s*theme[[:space:]]*=[[:space:]]*\"/s/\"\(.*\)\"/\"$replacement\"/" ${flakeDir}/hosts/${host}/options.nix
kitty -e pkexec nixos-rebuild switch --flake ${flakeDir}
fi
''