]> Git — Sourcephile - sourcephile-nix.git/blob - servers/mermet.nix
nix: revamp directories to put nixpkgs-overlays in the store
[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 ../nixos/defaults.nix
12 ../nixos/base/install.nix
13 ../nixos/base/unbound.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/mlmmj.nix
21 mermet/networking.nix
22 mermet/nginx.nix
23 mermet/openldap.nix
24 mermet/postfix.nix
25 mermet/public-inbox.nix
26 mermet/redis.nix
27 mermet/rspamd.nix
28 mermet/sanoid.nix
29 mermet/shorewall.nix
30 mermet/system.nix
31 mermet/users.nix
32 ];
33 extraArgs = {
34 name = "mermet";
35 };
36 };
37 inherit (system.config) networking;
38 lib = system.pkgs.lib;
39 in with system; system // {
40 install =
41 let target = "root@${networking.hostName}.${networking.domain}";
42 profile = "/nix/var/nix/profiles/system";
43 generations = "+10";
44 nixos = config.system.build.toplevel;
45 in
46 pkgs.writeShellScriptBin "bash" ''
47 PATH="$PATH:${with pkgs; lib.makeBinPath [nix openssh pass]}"
48 set -eux
49 nix ''${TRACE:+-L} copy \
50 --to ssh://${target} --substitute-on-destination \
51 ${nixos}
52 target="${target}"
53 ${config.install.shellHook}
54 ssh ${target} nix-env --profile "${profile}" --set "${nixos}" \
55 '&&' nix-env --profile "${profile}" --delete-generations "${generations}" \
56 '&&' "${profile}"/bin/switch-to-configuration "''${switch:-switch}"
57 '';
58 }