merge darwin and nixos rebuild function

This commit is contained in:
Noah Masur 2022-06-14 19:03:16 -04:00
parent 708672b2e3
commit 0229df9b97
3 changed files with 15 additions and 14 deletions

View File

@ -1,3 +0,0 @@
nix:
git add -A
doas nixos-rebuild switch --flake .

View File

@ -37,13 +37,6 @@
xdg.configFile.hammerspoon = { source = ./hammerspoon; };
programs.fish = {
shellAbbrs = {
nr =
"sudo darwin-rebuild switch --flake ${config.dotfilesPath}#macbook";
};
};
};
system.activationScripts.hammerspoon.text = ''

View File

@ -16,10 +16,21 @@
};
programs.fish = {
shellAbbrs = {
nr = lib.mkIf pkgs.stdenv.isLinux
"doas nixos-rebuild switch --flake ${config.dotfilesPath}";
programs.fish = let
system = if pkgs.stdenv.isDarwin then "darwin" else "nixos";
sudo = if pkgs.stdenv.isDarwin then "doas" else "sudo";
in {
shellAbbrs = { nr = lib.mkIf pkgs.stdenv.isLinux "rebuild-${system}"; };
functions = {
rebuild-nixos = {
body = ''
pushd ${config.dotfilesPath}
git add --all
popd
echo "${sudo} ${system}-rebuild switch --flake ${config.dotfilesPath}"
${sudo} ${system}-rebuild switch --flake ${config.dotfilesPath}
'';
};
};
};