summaryrefslogtreecommitdiff
path: root/users/kassouni/palette/rebuild.nix
blob: edffa6b38154aab6474286b74838342679f7535f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
{ pkgs, ... }:
{
  kassouni.palette.commands = [
    {
      name = "rebuild";
      icon = "󱄅";
      # Rebuilds need a terminal: sudo prompts for a password and nixos-rebuild
      # streams a lot of output. Spawn ghostty with a login shell so it inherits
      # the system sudo (setuid) and the user's nix from PATH. Mirrors `make rebuild`.
      exe = pkgs.writers.writeBash "rebuild" ''
        set -eu
        exec ${pkgs.ghostty}/bin/ghostty -e bash -lc '
          set -eu
          cd /home/kassouni/Developer/nixos-config
          nix flake update xmonad-config
          sudo nixos-rebuild switch --flake .
          echo
          echo "Rebuild finished. Press enter to close."
          read -r _
        '
      '';
    }
  ];
}