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