]>
Commit | Line | Data |
---|---|---|
8a304ef4 IB |
1 | { privateFiles }: |
2 | { config, pkgs, ... }: | |
3 | { | |
4 | boot.kernelPackages = pkgs.linuxPackages_latest; | |
5 | myEnv = import "${privateFiles}/environment.nix" // { inherit privateFiles; }; | |
6 | ||
7 | networking = { | |
8 | firewall.enable = false; | |
9 | interfaces."eth0".ipv4.addresses = pkgs.lib.attrsets.mapAttrsToList | |
10 | (n: ips: { address = ips.ip4; prefixLength = 32; }) | |
11 | (pkgs.lib.attrsets.filterAttrs (n: v: n != "main") config.hostEnv.ips); | |
12 | interfaces."eth0".ipv6.addresses = pkgs.lib.flatten (pkgs.lib.attrsets.mapAttrsToList | |
13 | (n: ips: map (ip: { address = ip; prefixLength = (if n == "main" && ip == pkgs.lib.head ips.ip6 then 64 else 128); }) (ips.ip6 or [])) | |
14 | config.hostEnv.ips); | |
15 | }; | |
16 | ||
17 | myServices.ssh.modules = [ config.myServices.ssh.predefinedModules.regular ]; | |
18 | imports = builtins.attrValues (import ../..); | |
19 | ||
20 | deployment = { | |
21 | targetEnv = "hetzner"; | |
22 | hetzner = { | |
23 | robotUser = config.myEnv.hetzner.user; | |
24 | robotPass = config.myEnv.hetzner.pass; | |
25 | mainIPv4 = config.hostEnv.ips.main.ip4; | |
26 | partitions = '' | |
27 | clearpart --all --initlabel --drives=sda,sdb,sdc,sdd | |
28 | ||
29 | part swap --recommended --label=swap --fstype=swap --ondisk=sda | |
30 | ||
31 | part raid.1 --grow --ondisk=sdc | |
32 | part raid.2 --grow --ondisk=sdd | |
33 | ||
34 | raid / --level=1 --device=md0 --fstype=ext4 --label=root raid.1 raid.2 | |
35 | ||
36 | part /nix --grow --label=nix --ondisk=sda | |
37 | part /data --grow --label=data --ondisk=sdb | |
38 | ''; | |
39 | }; | |
40 | }; | |
41 | ||
42 | programs.zsh.enable = true; | |
43 | ||
8bf83d7a IB |
44 | users.users.backup = { |
45 | home = "/var/lib/backup"; | |
46 | createHome = true; | |
47 | hashedPassword = "!"; | |
48 | isSystemUser = true; | |
49 | shell = pkgs.bashInteractive; | |
50 | openssh.authorizedKeys.keys = let | |
51 | in | |
52 | ["command=\"${pkgs.rrsync_sudo}/bin/rrsync /var/lib/backup/eldiron/\" ${config.myEnv.rsync_backup.ssh_key.public}"]; | |
53 | }; | |
50c100ba | 54 | security.sudo.extraRules = pkgs.lib.mkAfter [ |
8bf83d7a IB |
55 | { |
56 | commands = [ | |
57 | { command = "${pkgs.rsync}/bin/rsync"; options = [ "NOPASSWD" ]; } | |
58 | ]; | |
59 | users = [ "backup" ]; | |
60 | runAs = "root"; | |
61 | } | |
50c100ba IB |
62 | { |
63 | commands = [ | |
64 | { command = "/home/immae/.nix-profile/root_scripts/*"; options = [ "NOPASSWD" ]; } | |
65 | ]; | |
66 | users = [ "immae" ]; | |
67 | runAs = "root"; | |
68 | } | |
8bf83d7a IB |
69 | ]; |
70 | ||
52549f2e | 71 | boot.kernel.sysctl."vm.nr_hugepages" = 256; # for xmr-stak |
8bf83d7a IB |
72 | system.activationScripts.backup_home = '' |
73 | chown root:root /var/lib/backup | |
74 | install -m 0750 -o backup -g root -d /var/lib/backup/eldiron | |
75 | ''; | |
76 | ||
f2bc9fcc | 77 | virtualisation.docker.enable = true; |
7067c25c | 78 | virtualisation.libvirtd.enable = true; |
f2bc9fcc | 79 | users.extraUsers.immae.extraGroups = [ "libvirtd" "docker" ]; |
7067c25c IB |
80 | systemd.services.libvirtd.postStart = '' |
81 | install -m 0770 -g libvirtd -d /var/lib/libvirt/images | |
82 | ''; | |
83 | ||
8a304ef4 IB |
84 | time.timeZone = "Europe/Paris"; |
85 | nix = { | |
86 | useSandbox = "relaxed"; | |
87 | extraOptions = '' | |
88 | keep-outputs = true | |
89 | keep-derivations = true | |
90 | #Assumed in NUR | |
91 | allow-import-from-derivation = true | |
92 | ''; | |
93 | }; | |
94 | ||
50c100ba IB |
95 | security.pki.certificateFiles = [ |
96 | (pkgs.fetchurl { | |
97 | url = "http://downloads.e.eriomem.net/eriomemca.pem"; | |
98 | sha256 = "1ixx4c6j3m26j8dp9a3dkvxc80v1nr5aqgmawwgs06bskasqkvvh"; | |
99 | }) | |
100 | ]; | |
101 | ||
8a304ef4 IB |
102 | # This is equivalent to setting environment.sessionVariables.NIX_PATH |
103 | nix.nixPath = [ | |
258dd18b IB |
104 | "home-manager=https://github.com/rycee/home-manager/archive/master.tar.gz" |
105 | "nixpkgs=https://nixos.org/channels/nixos-unstable/nixexprs.tar.xz" | |
8a304ef4 | 106 | ]; |
75d88eda | 107 | nix.binaryCaches = [ "https://hydra.iohk.io" "https://cache.nixos.org" ]; |
50c100ba | 108 | nix.binaryCachePublicKeys = [ "hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ=" ]; |
8a304ef4 IB |
109 | |
110 | # This value determines the NixOS release with which your system is | |
111 | # to be compatible, in order to avoid breaking some software such as | |
112 | # database servers. You should change this only after NixOS release | |
113 | # notes say you should. | |
114 | # https://nixos.org/nixos/manual/release-notes.html | |
d43e0c61 | 115 | system.stateVersion = "20.03"; # Did you read the comment? |
8a304ef4 IB |
116 | } |
117 |