dotfiles/apps/rebuild.nix

18 lines
415 B
Nix
Raw Normal View History

2024-04-20 13:42:06 +00:00
{ pkgs, ... }:
{
type = "app";
2024-04-20 13:42:06 +00:00
program = builtins.toString (
pkgs.writeShellScript "rebuild" ''
echo ${pkgs.system}
SYSTEM=${if pkgs.stdenv.isDarwin then "darwin" else "linux"}
if [ "$SYSTEM" == "darwin" ]; then
sudo darwin-rebuild switch --flake ${builtins.toString ../.}
else
doas nixos-rebuild switch --flake ${builtins.toString ../.}
fi
''
);
}