]> Git — Sourcephile - sourcephile-nix.git/blob - servers/losurdo.nix
public-inbox: rename inboxes
[sourcephile-nix.git] / servers / losurdo.nix
1 # NixOS configuration of losurdo.sourcephile.fr
2 #
3 # Show configuration options with, for example:
4 # nix-instantiate servers/losurdo.nix --eval -A config.networking.hostName
5 # Install/upgrade with:
6 # nix run install -f servers/losurdo.nix
7 let
8 system = import <nixpkgs/nixos/lib/eval-config.nix> {
9 system = "x86_64-linux";
10 modules = [
11 ../nixos/defaults.nix
12 ../nixos/base/install.nix
13 ../nixos/base/unbound.nix
14 losurdo/debug.nix
15 losurdo/fileSystems.nix
16 losurdo/hardware.nix
17 losurdo/networking.nix
18 losurdo/sanoid.nix
19 losurdo/shorewall.nix
20 losurdo/syncoid.nix
21 losurdo/system.nix
22 losurdo/transmission.nix
23 losurdo/users.nix
24 ];
25 extraArgs = {
26 name = "losurdo";
27 };
28 };
29 inherit (system.config) networking;
30 lib = system.pkgs.lib;
31 in with system; system // {
32 install =
33 let target = "root@${networking.hostName}.${networking.domain}";
34 profile = "/nix/var/nix/profiles/system";
35 generations = "+10";
36 nixos = config.system.build.toplevel;
37 in
38 pkgs.writeShellScriptBin "bash" ''
39 PATH="$PATH:${with pkgs; lib.makeBinPath [nix openssh pass]}"
40 set -eux
41 nix ''${TRACE:+-L} copy \
42 --to ssh://${target} --substitute-on-destination \
43 ${nixos}
44 target="${target}"
45 ${config.install.shellHook}
46 ssh ${target} nix-env --profile "${profile}" --set "${nixos}" \
47 '&&' nix-env --profile "${profile}" --delete-generations "${generations}" \
48 '&&' "${profile}"/bin/switch-to-configuration "''${switch:-switch}"
49 '';
50 }