move common zfs settings to modules/base

This commit is contained in:
Motiejus Jakštys 2023-07-26 13:58:42 +03:00
parent d4527c24a6
commit cff18bfb8f
5 changed files with 48 additions and 33 deletions

View File

@ -17,25 +17,9 @@ in {
stateVersion = "22.11";
timeZone = "UTC";
services = {
postfix = {
enable = true;
saslPasswdPath = config.age.secrets.sasl-passwd.path;
};
zfsunlock = {
enable = true;
targets."vno1-oh2.servers.jakst" = {
sshEndpoint = myData.hosts."vno1-oh2.servers.jakst".publicIP;
pingEndpoint = "vno1-oh2.servers.jakst";
remotePubkey = myData.hosts."vno1-oh2.servers.jakst".initrdPubKey;
pwFile = config.age.secrets.zfs-passphrase-vno1-oh2.path;
startAt = "*-*-* *:00/5:00";
};
};
};
base = {
zfs.enable = true;
users.passwd = {
root.passwordFile = config.age.secrets.root-passwd-hash.path;
motiejus.passwordFile = config.age.secrets.motiejus-passwd-hash.path;
@ -81,7 +65,25 @@ in {
unitstatus = {
enable = true;
email = "motiejus+alerts@jakstys.lt";
units = ["zfs-scrub" "nixos-upgrade"];
units = ["nixos-upgrade"];
};
};
services = {
postfix = {
enable = true;
saslPasswdPath = config.age.secrets.sasl-passwd.path;
};
zfsunlock = {
enable = true;
targets."vno1-oh2.servers.jakst" = {
sshEndpoint = myData.hosts."vno1-oh2.servers.jakst".publicIP;
pingEndpoint = "vno1-oh2.servers.jakst";
remotePubkey = myData.hosts."vno1-oh2.servers.jakst".initrdPubKey;
pwFile = config.age.secrets.zfs-passphrase-vno1-oh2.path;
startAt = "*-*-* *:00/5:00";
};
};
};
};
@ -120,12 +122,6 @@ in {
};
};
zfs = {
autoScrub.enable = true;
trim.enable = true;
expandOnBoot = "all";
};
openssh = {
extraConfig = ''
AcceptEnv GIT_PROTOCOL

View File

@ -29,6 +29,7 @@
timeZone = "Europe/Vilnius";
base = {
zfs.enable = true;
users.passwd = {
root.passwordFile = config.age.secrets.root-passwd-hash.path;
motiejus.passwordFile = config.age.secrets.motiejus-passwd-hash.path;
@ -38,6 +39,12 @@
enable = true;
mountpoints = ["/home"];
};
unitstatus = {
enable = true;
email = "motiejus+alerts@jakstys.lt";
units = ["nixos-upgrade"];
};
};
services = {
@ -97,12 +104,6 @@
"jakstys.lt.".data = myData.jakstysLTZone;
};
};
zfs = {
autoScrub.enable = true;
trim.enable = true;
expandOnBoot = "all";
};
};
networking = {

View File

@ -12,6 +12,7 @@
./sshd
./unitstatus
./users
./zfs
./zfsborg
];

View File

@ -0,0 +1,19 @@
{
config,
lib,
...
}: {
options.mj.base.zfs = with lib.types; {
enable = lib.mkEnableOption "Enable common zfs options";
};
config = lib.mkIf config.mj.base.zfs.enable {
services.zfs = assert lib.assertMsg config.mj.base.unitstatus.enable "mj.base.unitstatus must be enabled"; {
autoScrub.enable = true;
trim.enable = true;
expandOnBoot = "all";
};
mj.base.unitstatus.units = ["zfs-scrub"];
};
}

View File

@ -11,7 +11,6 @@
};
config = lib.mkIf config.mj.services.postfix.enable {
environment.systemPackages = [pkgs.mailutils];
services.postfix = {
@ -38,6 +37,5 @@
header_size_limit = 4096000
'';
};
};
}