X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=nixops%2Feldiron.nix;h=37f901e5e39855b63d3da7167c04e3914b03604d;hb=9ade8f6eb774dc7d19d82a070199b5024786b819;hp=ecc65cc3f0082b3af970f4df7658910078b21d88;hpb=5f5efa6fa5a5b7d299998be410a278a7ff396504;p=perso%2FImmae%2FConfig%2FNix.git diff --git a/nixops/eldiron.nix b/nixops/eldiron.nix index ecc65cc..37f901e 100644 --- a/nixops/eldiron.nix +++ b/nixops/eldiron.nix @@ -1,4 +1,4 @@ -{ environment ? ./environment.nix }: +{ privateFiles ? ./. }: { network = { description = "Immae's network"; @@ -6,48 +6,64 @@ }; eldiron = { config, pkgs, mylibs, myconfig, ... }: - with mylibs; { + nixpkgs.overlays = builtins.attrValues (import ../overlays); _module.args = { - mylibs = import ../libs.nix; + pkgsNext = import {}; + pkgsPrevious = import {}; + mylibs = import ../libs.nix { inherit pkgs; }; myconfig = { - env = import environment; - ips = { - main = "176.9.151.89"; - production = "176.9.151.154"; - integration = "176.9.151.155"; - }; + inherit privateFiles; + env = import "${privateFiles}/environment.nix"; }; }; + boot.kernelPackages = pkgs.linuxPackages_latest; + + networking = { + firewall.enable = true; + # 176.9.151.89 declared in nixops -> infra / tools + interfaces."eth0".ipv4.addresses = pkgs.lib.attrsets.mapAttrsToList + (n: ips: { address = ips.ip4; prefixLength = 32; }) + (pkgs.lib.attrsets.filterAttrs (n: v: n != "main") myconfig.env.servers.eldiron.ips); + interfaces."eth0".ipv6.addresses = pkgs.lib.flatten (pkgs.lib.attrsets.mapAttrsToList + (n: ips: map (ip: { address = ip; prefixLength = (if n == "main" && ip == pkgs.lib.head ips.ip6 then 64 else 128); }) (ips.ip6 or [])) + myconfig.env.servers.eldiron.ips); + }; + imports = [ + ./modules/ssh ./modules/certificates.nix ./modules/gitolite - ./modules/databases + ./modules/mpd.nix ./modules/websites - ./modules/mail - ./modules/ftp - ]; + ./modules/mail.nix + ./modules/ftp.nix + ./modules/pub + ./modules/task + ./modules/irc.nix + ./modules/buildbot + ./modules/dns.nix + ] ++ (builtins.attrValues (import ../modules)); + myServices.databases.enable = true; services.myGitolite.enable = true; - services.myDatabases.enable = true; - services.myWebsites.production.enable = true; - services.myWebsites.integration.enable = true; - services.myWebsites.tools.enable = true; services.pure-ftpd.enable = true; + services.irc.enable = true; + services.pub.enable = true; + services.myTasks.enable = true; + services.buildbot.enable = true; - networking = { - firewall = { - enable = true; - allowedTCPPorts = [ 22 ]; - }; - }; + services.journald.extraConfig = '' + MaxLevelStore="warning" + MaxRetentionSec="1year" + ''; deployment = { targetEnv = "hetzner"; hetzner = { robotUser = myconfig.env.hetzner.user; robotPass = myconfig.env.hetzner.pass; - mainIPv4 = myconfig.ips.main; + mainIPv4 = myconfig.env.servers.eldiron.ips.main.ip4; partitions = '' clearpart --all --initlabel --drives=sda,sdb @@ -62,46 +78,30 @@ }; }; - environment.systemPackages = [ + users.users.root.packages = [ pkgs.telnet pkgs.htop - pkgs.vim + pkgs.iftop ]; - services.openssh.extraConfig = '' - AuthorizedKeysCommand /etc/ssh/ldap_authorized_keys - AuthorizedKeysCommandUser nobody - ''; - - environment.etc."ssh/ldap_authorized_keys" = let - ldap_authorized_keys = - wrap { - name = "ldap_authorized_keys"; - file = ./ldap_authorized_keys.sh; - vars = { - LDAP_PASS = myconfig.env.sshd.ldap.password; - GITOLITE_SHELL = "${pkgs.gitolite}/bin/gitolite-shell"; - ECHO = "${pkgs.coreutils}/bin/echo"; - }; - paths = [ pkgs.openldap pkgs.stdenv.shellPackage pkgs.gnugrep pkgs.gnused pkgs.coreutils ]; - }; - in { - enable = true; - mode = "0755"; - user = "root"; - source = ldap_authorized_keys; - }; + environment.systemPackages = [ + pkgs.vim + ]; services.cron = { enable = true; - # Doesn't work, need to be a user - mailto = "cron+eldiron@immae.eu"; systemCronJobs = [ '' # The star after /var/lib/* avoids deleting all folders in case of problem - 0 3,9,15,21 * * * root rsync -e "ssh -i /root/.ssh/id_charon_vpn" -aAXvz --delete --numeric-ids --super --rsync-path="sudo rsync" /var/lib/* immae@immae.eu: + 0 3,9,15,21 * * * root rsync -e "ssh -i /root/.ssh/id_charon_vpn" -aAXvz --delete --numeric-ids --super --rsync-path="sudo rsync" /var/lib/* immae@immae.eu: > /dev/null '' ]; }; + + # This value determines the NixOS release with which your system is + # to be compatible, in order to avoid breaking some software such as + # database servers. You should change this only after NixOS release + # notes say you should. + system.stateVersion = "18.09"; # Did you read the comment? }; }