X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=modules%2Fprivate%2Fsystem%2Feldiron.nix;h=8b2784d0d315ce87d0b1fbfe546f6689854e55ce;hb=fa25ffd4583cc362075cd5e1b4130f33306103f0;hp=f11afb675e2d5f5fd27e70d9aa5332be038821f0;hpb=e43fdf341072e4a0150324196fc7af8f383860ec;p=perso%2FImmae%2FConfig%2FNix.git diff --git a/modules/private/system/eldiron.nix b/modules/private/system/eldiron.nix index f11afb6..8b2784d 100644 --- a/modules/private/system/eldiron.nix +++ b/modules/private/system/eldiron.nix @@ -1,4 +1,3 @@ -{ privateFiles }: { config, pkgs, lib, ... }: { deployment = { @@ -6,6 +5,8 @@ targetHost = config.hostEnv.ips.main.ip4; substituteOnDestination = true; }; + # ssh-keyscan eldiron | nix-shell -p ssh-to-age --run ssh-to-age + secrets.ageKeys = [ "age1dxr5lhvtnjssfaqpnf6qx80h8gfwkxg3tdf35m6n9wljmk7wadfs3kmahj" ]; boot = { kernelModules = [ "kvm-intel" ]; blacklistedKernelModules = [ "nvidiafb" ]; @@ -28,15 +29,37 @@ ''; nix.maxJobs = 8; powerManagement.cpuFreqGovernor = "powersave"; - myEnv = import "${privateFiles}/environment.nix" // { inherit privateFiles; }; + myEnv = import ../../../nixops/secrets/environment.nix; fileSystems = { + # pools: + # zpool: ashift=12 + # zfast: ashift=12 + # zfs: + # zpool/: acltype=posixacl ; xattr=sa ; atime=off ; mountpoint=legacy + # zpool/root: encryption=on ; keyformat=passphrase ; keylocation=file:///boot/pass.key + # zpool/root/var: atime=on + # zfast/: acltype=posixacl ; xattr=sa ; atime=off ; mountpoint=legacy + # zfast/root: encryption=on ; keyformat=passphrase ; keylocation=file:///boot/pass.key + # zfast/root/etc: ø + # zfast/root/nix: ø + # zfast/root/tmp: async=disabled + # zfast/root/var: atime=on + # zfast/root/var/lib: ø + # zfast/root/var/lib/mysql: logbias=throughput ; atime=off ; primarycache=metadata + # zfast/root/var/lib/postgresql: recordsize=8K ; atime=off ; logbias=throughput + # zfast/root/var/lib/postgresql/11.0: ø + # zfast/root/var/lib/postgresql/11.0/pg_wal: ø "/" = { fsType = "zfs"; device = "zpool/root"; }; "/boot" = { fsType = "ext4"; device = "/dev/disk/by-uuid/e6bb18fb-ff56-4b5f-ae9f-e60d40dc0622"; }; "/etc" = { fsType = "zfs"; device = "zpool/root/etc"; }; - "/nix" = { fsType = "zfs"; device = "zpool/root/nix"; }; - "/tmp" = { fsType = "zfs"; device = "zpool/root/tmp"; }; + "/nix" = { fsType = "zfs"; device = "zfast/root/nix"; }; + "/tmp" = { fsType = "zfs"; device = "zfast/root/tmp"; }; "/var" = { fsType = "zfs"; device = "zpool/root/var"; }; + "/var/lib/mysql" = { fsType = "zfs"; device = "zfast/root/var/lib/mysql"; }; + "/var/lib/postgresql" = { fsType = "zfs"; device = "zfast/root/var/lib/postgresql"; }; + "/var/lib/postgresql/11.0" = { fsType = "zfs"; device = "zfast/root/var/lib/postgresql/11.0"; }; + "/var/lib/postgresql/11.0/pg_wal" = { fsType = "zfs"; device = "zfast/root/var/lib/postgresql/11.0/pg_wal"; }; }; swapDevices = [ { label = "swap1"; } { label = "swap2"; } ]; hardware.enableRedistributableFirmware = true; @@ -89,32 +112,37 @@ myServices.dns.enable = true; myServices.certificates.enable = true; myServices.websites.enable = true; + myServices.gemini.enable = true; myServices.mail.enable = true; myServices.ejabberd.enable = true; myServices.vpn.enable = true; - services.pure-ftpd.enable = true; - services.duplyBackup.enable = false; - services.duplyBackup.profiles.oldies.rootDir = "/var/lib/oldies"; + myServices.ftp.enable = true; services.netdata.enable = true; services.netdata.config.global."memory mode" = "none"; services.netdata.config.health."enabled" = "no"; services.netdata.config.web.mode = "none"; - environment.etc."netdata/stream.conf".text = '' - [stream] - enabled = yes - destination = ${config.myEnv.monitoring.netdata_aggregator} - api key = ${config.myEnv.monitoring.netdata_keys.eldiron} - ''; - secrets.keys = [ - { - dest = "zrepl_backup/identity"; + users.users."${config.services.netdata.user}".extraGroups = [ "keys" ]; + environment.etc."netdata/stream.conf".source = config.secrets.fullPaths."netdata-stream.conf"; + secrets.keys = { + "netdata-stream.conf" = { + user = config.services.netdata.user; + group = config.services.netdata.group; + permissions = "0400"; + text = '' + [stream] + enabled = yes + destination = ${config.myEnv.monitoring.netdata_aggregator} + api key = ${config.myEnv.monitoring.netdata_keys.eldiron} + ''; + }; + "zrepl_backup/identity" = { user = "root"; group = "root"; permissions = "0400"; text = config.myEnv.zrepl_backup.ssh_key.private; - } - ]; + }; + }; programs.ssh.knownHosts.dilion = { hostNames = ["dilion.immae.eu"]; publicKey = let @@ -136,11 +164,6 @@ ]; }; - fileSystems."/var/lib/pub/immae/devtools" = { - device = "/run/current-system/sw/bin/bindfs#/var/lib/ftp/devtools.immae.eu/"; - fsType = "fuse"; - options = [ "force-user=pub" "create-for-user=wwwrun" "create-for-group=wwwrun" ]; - }; environment.systemPackages = [ pkgs.bindfs ]; services.zrepl = { @@ -168,32 +191,31 @@ snapshotting: type: periodic prefix: zrepl_ - interval: 15m - hooks: - - type: mysql-lock-tables - dsn: "${config.myEnv.zrepl_backup.mysql.user}:${config.myEnv.zrepl_backup.mysql.password}@tcp(localhost)/" - filesystems: - "zpool/root/var": true - - type: command - path: ${redis_dump} - err_is_fatal: false - filesystems: - "zpool/root/var": true + interval: 1h + #hooks: + # - type: mysql-lock-tables + # dsn: "${config.myEnv.zrepl_backup.mysql.user}:${config.myEnv.zrepl_backup.mysql.password}@tcp(localhost)/" + # filesystems: + # "zpool/root/var": true + # - type: command + # path: ${redis_dump} + # err_is_fatal: false + # filesystems: + # "zpool/root/var": true send: encrypted: true pruning: keep_sender: - - type: not_replicated - type: regex regex: "^manual_.*" - type: grid - grid: 1x1h(keep=all) | 24x1h | 7x1d | 4x7d | 6x30d + grid: 24x1h | 7x1d | 4x7d | 6x30d regex: "^zrepl_.*" keep_receiver: - type: regex regex: "^manual_.*" - type: grid - grid: 1x1h(keep=all) | 24x1h | 7x1d | 4x7d | 6x30d + grid: 6x4h | 7x1d | 4x7d | 6x30d regex: "^zrepl_.*" ''; };