]> git.immae.eu Git - perso/Immae/Config/Nix.git/blob - modules/private/system/dilion.nix
Add dilion server
[perso/Immae/Config/Nix.git] / modules / private / system / dilion.nix
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
44 time.timeZone = "Europe/Paris";
45 nix = {
46 useSandbox = "relaxed";
47 extraOptions = ''
48 keep-outputs = true
49 keep-derivations = true
50 #Assumed in NUR
51 allow-import-from-derivation = true
52 '';
53 };
54
55 # This is equivalent to setting environment.sessionVariables.NIX_PATH
56 nix.nixPath = [
57 "home-manager=https://github.com/rycee/home-manager/archive/release-19.03.tar.gz"
58 "nixpkgs=https://nixos.org/channels/nixos-19.03/nixexprs.tar.xz"
59 ];
60
61 # This value determines the NixOS release with which your system is
62 # to be compatible, in order to avoid breaking some software such as
63 # database servers. You should change this only after NixOS release
64 # notes say you should.
65 # https://nixos.org/nixos/manual/release-notes.html
66 system.stateVersion = "19.03"; # Did you read the comment?
67 }
68