feat: big refactor

This commit is contained in:
Jacob Bachmann 2024-09-07 15:10:22 +02:00
parent 2c09c21833
commit ebedec9768
No known key found for this signature in database
GPG key ID: 7753026D577922A6
159 changed files with 1927 additions and 2222 deletions

View file

@ -1,38 +0,0 @@
{ pkgs, nixosConfig }:
pkgs.writeShellScriptBin "nuf" ''
reset="\e[0m"
red="\e[31m"
green="\e[32m"
yellow="\e[33m"
white_bold="\e[1;37m"
tmp=$(mktemp -d)
function error {
rm -rf tmp
echo ""
echo -e "''${red}>>> ''${bold}Error''${reset}''${red}: $1''${reset}"
exit 1
}
FLAKE=$(readlink -f /etc/nixos)
echo -e "''${green}>>> Updating flake $FLAKE ...''${reset}"
${nixosConfig.nix.package}/bin/nix flake update --flake "$FLAKE" || error "Updating failed"
cd $tmp
echo ""
echo -e "''${green}>>> Building configuration ...''${reset}"
nixos-rebuild build --flake "$FLAKE" || error "Building failed"
echo ""
echo -e "''${green}>>> Running diff ...''${reset}";
${pkgs.nvd}/bin/nvd diff /run/current-system result || error "Diff failed"
cd - > /dev/null
rm -rf $tmp
echo ""
echo -e "''${yellow}>>> The new configuration has not been activated.''${reset}"
echo -e "''${yellow}>>> Use ''${white_bold}nixos-rebuild switch''${reset}''${yellow} to activate.''${reset}"
''