feat: use nh to keep 2 gens and to deploy builds
This commit is contained in:
parent
791e33478f
commit
978dc11d37
4 changed files with 18 additions and 3 deletions
1
.envrc
Normal file
1
.envrc
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
use flake
|
||||||
|
|
@ -40,14 +40,14 @@ nix run github:nix-community/nixos-anywhere -- --store-paths \
|
||||||
```
|
```
|
||||||
|
|
||||||
### 3. Update Existing Server (No Wipe)
|
### 3. Update Existing Server (No Wipe)
|
||||||
Once the server is running NixOS, use `nixos-rebuild` to push updates. This is faster and doesn't wipe data.
|
Once the server is running NixOS, use `nh` to push updates. This repository provides `nh` via `direnv` (loaded from `flake.nix` devShell), so just run `direnv allow` first.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Update via IP
|
# Update via IP
|
||||||
nixos-rebuild switch --flake path:.#extremist-software --target-host root@<TARGET_IP> --impure
|
nh os switch --hostname extremist-software --target-host root@<TARGET_IP> --impure path:.
|
||||||
|
|
||||||
# Update via Tailscale (Once tailored up)
|
# Update via Tailscale (Once tailored up)
|
||||||
nixos-rebuild switch --flake path:.#extremist-software --target-host root@extremist-software --impure
|
nh os switch --hostname extremist-software --target-host root@extremist-software --impure path:.
|
||||||
```
|
```
|
||||||
|
|
||||||
repo uses `impure` build to load `secrets/secrets.nix` directly. no encrypted secrets in git.
|
repo uses `impure` build to load `secrets/secrets.nix` directly. no encrypted secrets in git.
|
||||||
|
|
|
||||||
|
|
@ -44,6 +44,14 @@
|
||||||
settings.PermitRootLogin = "prohibit-password";
|
settings.PermitRootLogin = "prohibit-password";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# nh (yet another nix helper)
|
||||||
|
programs.nh = {
|
||||||
|
enable = true;
|
||||||
|
clean.enable = true;
|
||||||
|
clean.extraArgs = "--keep 2";
|
||||||
|
flake = "/home/jet/Documents/extremist-software";
|
||||||
|
};
|
||||||
|
|
||||||
# System
|
# System
|
||||||
system.stateVersion = "24.05";
|
system.stateVersion = "24.05";
|
||||||
nix.settings.experimental-features = [ "nix-command" "flakes" ];
|
nix.settings.experimental-features = [ "nix-command" "flakes" ];
|
||||||
|
|
|
||||||
|
|
@ -21,5 +21,11 @@
|
||||||
./configuration.nix
|
./configuration.nix
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
devShells.x86_64-linux.default = let
|
||||||
|
pkgs = nixpkgs.legacyPackages.x86_64-linux;
|
||||||
|
in pkgs.mkShell {
|
||||||
|
packages = [ pkgs.nh ];
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue