From 213ce6601fc3e69d53d77621f8d945e27df03727 Mon Sep 17 00:00:00 2001 From: lightly-toasted Date: Sat, 17 Jan 2026 12:10:57 +0900 Subject: [PATCH 1/2] feat: add nh - Updated justfile to use nh for deploy commands - Added nh to flake devShell - Added nh and just to shell.nix - Enabled programs.nh in nixos --- flake.nix | 1 + hosts/nixos/modules/programs/default.nix | 1 + hosts/nixos/modules/programs/nh.nix | 8 ++++++++ justfile | 21 +++++++++++---------- shell.nix | 2 ++ 5 files changed, 23 insertions(+), 10 deletions(-) create mode 100644 hosts/nixos/modules/programs/nh.nix diff --git a/flake.nix b/flake.nix index 235b538..1c23e61 100644 --- a/flake.nix +++ b/flake.nix @@ -90,6 +90,7 @@ pkgs.git pkgs.git-crypt pkgs.just + pkgs.nh ]; }; } diff --git a/hosts/nixos/modules/programs/default.nix b/hosts/nixos/modules/programs/default.nix index f65c351..e9c8523 100644 --- a/hosts/nixos/modules/programs/default.nix +++ b/hosts/nixos/modules/programs/default.nix @@ -10,5 +10,6 @@ ./ydotool.nix ./steam.nix ./nix-ld.nix + ./nh.nix ]; } diff --git a/hosts/nixos/modules/programs/nh.nix b/hosts/nixos/modules/programs/nh.nix new file mode 100644 index 0000000..dd2f39d --- /dev/null +++ b/hosts/nixos/modules/programs/nh.nix @@ -0,0 +1,8 @@ +{ + programs.nh = { + enable = true; + clean.enable = true; + clean.extraArgs = "--keep-since 7d --keep 3"; + flake = "/home/toast/nix-config"; + }; +} diff --git a/justfile b/justfile index 10fa05a..fc13584 100644 --- a/justfile +++ b/justfile @@ -3,19 +3,20 @@ default: @just --list -deploy-nixos: - sudo nixos-rebuild switch --flake .#$(hostname) +_check-nh: + @command -v nh > /dev/null 2>&1 || echo "nh is not in PATH. Run 'nix develop' first." -deploy-vps: - nixos-rebuild switch --flake .#vps --target-host root@vps +deploy-nixos: _check-nh + nh os switch . -deploy-home: - home-manager switch --flake .#$USER@$(hostname) +deploy-vps: _check-nh + nh os switch . -H vps --target-host root@vps + +deploy-home: _check-nh + nh home switch . update: nix flake update --commit-lock-file -gc: - nix-collect-garbage -d - nix-collect-garbage --delete-older-than 7d - nix-store --gc +gc: _check-nh + nh clean all --keep-since 7d diff --git a/shell.nix b/shell.nix index 36dd381..9df72f3 100644 --- a/shell.nix +++ b/shell.nix @@ -7,5 +7,7 @@ pkgs.mkShell { git sops git-crypt + just + nh ]; } From 3c314ad5bd22b9d9e0e006d38a83db529282578c Mon Sep 17 00:00:00 2001 From: lightly-toasted Date: Sat, 17 Jan 2026 12:20:21 +0900 Subject: [PATCH 2/2] refactor(just): rename deploy commands to shorter aliases - Renamed justfile commands from deploy-* to concise names - Updated README examples --- README.md | 6 +++--- justfile | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 0578cbe..61656d9 100644 --- a/README.md +++ b/README.md @@ -11,8 +11,8 @@ My personal NixOS and home-manager configurations. ```sh nix develop -just deploy-nixos # Rebuild and switch the current NixOS system on this host -just deploy-home # Apply Home Manager configuration for the current user -just deploy-vps # Rebuild and switch NixOS on the remote VPS +just nixos # Rebuild and switch the current NixOS system on this host +just home # Apply Home Manager configuration for the current user +just vps # Rebuild and switch NixOS on the remote VPS ``` diff --git a/justfile b/justfile index fc13584..ff93cdf 100644 --- a/justfile +++ b/justfile @@ -6,13 +6,13 @@ default: _check-nh: @command -v nh > /dev/null 2>&1 || echo "nh is not in PATH. Run 'nix develop' first." -deploy-nixos: _check-nh +nixos: _check-nh nh os switch . -deploy-vps: _check-nh +vps: _check-nh nh os switch . -H vps --target-host root@vps -deploy-home: _check-nh +home: _check-nh nh home switch . update: