meconium: knut -> nox

This commit is contained in:
Peder Bergebakken Sundt 2023-12-10 06:03:49 +01:00
parent 75e59fb6e3
commit 68ff2536e3
7 changed files with 71 additions and 3 deletions

View File

@ -24,6 +24,7 @@
../../users/pbsds ../../users/pbsds
../../profiles/mounts/reidun-nfs.nix ../../profiles/mounts/reidun-nfs.nix
../../profiles/mounts/meconium-nfs.nix
../../profiles/shell/base.nix ../../profiles/shell/base.nix
../../profiles/shell/archives.nix ../../profiles/shell/archives.nix

View File

@ -16,6 +16,7 @@
../../users/jornane ../../users/jornane
../../profiles/mounts/reidun-nfs.nix ../../profiles/mounts/reidun-nfs.nix
../../profiles/mounts/meconium-zfs.nix
../../profiles/shell/base.nix ../../profiles/shell/base.nix
../../profiles/shell/archives.nix ../../profiles/shell/archives.nix
@ -91,6 +92,8 @@
"kuklef.se" "kuklef.se"
]; ];
networking.hostId = "e1ffd469"; # needed for zfs: head -c 8 /etc/machine-id
# TODO: remove? Move to where relevant? # TODO: remove? Move to where relevant?
nixpkgs.overlays = [ nixpkgs.overlays = [
/** / /** /

View File

@ -35,6 +35,7 @@
../../users/pbsds ../../users/pbsds
../../profiles/mounts/reidun-nfs.nix ../../profiles/mounts/reidun-nfs.nix
../../profiles/mounts/meconium-nfs.nix
../../profiles/shell/base.nix ../../profiles/shell/base.nix
../../profiles/shell/archives.nix ../../profiles/shell/archives.nix

View File

@ -0,0 +1,31 @@
{ config, pkgs, lib, ... }:
{
# https://openzfs.github.io/openzfs-docs/Getting%20Started/NixOS/index.html
# https://nixos.org/manual/nixos/stable/#sec-linux-zfs
# https://nixos.wiki/wiki/ZFS
# https://search.nixos.org/options?query=services.zfs
boot.kernelPackages = lib.mkForce pkgs.zfs.latestCompatibleLinuxPackages;
boot.supportedFilesystems = [ "zfs" ];
boot.zfs.forceImportRoot = false;
# must be set per host
# head -c4 /dev/urandom | od -A none -t x4
# consider the one automatically generated by systemd:
# head -c 8 /etc/machine-id
#networking.hostId = "12345678";
services.zfs.autoSnapshot.enable = true; # simply runs zfstools
# default args, can be overriden per-dataset
services.zfs.autoSnapshot.frequent = 2; # 15 min
services.zfs.autoSnapshot.hourly = 3;
services.zfs.autoSnapshot.daily = 4;
services.zfs.autoSnapshot.weekly = 3;
services.zfs.autoSnapshot.monthly = 5;
#services.zfs.autoReplication.enable
#services.zfs.autoScrub.enable = true;
#services.zfs.trim.enable = true;
# config.services.nfs.server.enable will automatically export NFS dataset tagged as such
}

View File

@ -0,0 +1,24 @@
{ config, pkgs, lib, ... }:
{
# TODO: wireguard
#boot.kernelParams = [ "nfs.nfs4_disable_idmapping=0" "nfsd.nfs4_disable_idmapping=0" ];
fileSystems = let
mkMount = mountpoint: server: subdir: {
"${mountpoint}${subdir}" = {
device = "${server}${subdir}";
fsType = "nfs";
#options = [ "nfsvers=4.2" ];
};
};
# TODO: combine nameValuePair and listToAttrs
joinSets = sets: builtins.foldl' (l: r: l // r) {} sets;
in joinSets (
# TODO: depend on nox.networking.interfaces.eno1.ipv4.addresses
(map (mkMount "/mnt/meconium" "192.168.1.9:/Meconium" ) [
""
"/beets_music"
])
);
}

View File

@ -0,0 +1,11 @@
{ config, pkgs, lib, ... }:
{
# https://search.nixos.org/options?query=services.zfs
imports = [ ./common-zfs.nix ];
# non legacy-mount
systemd.services.zfs-mount.enable = true; # default
boot.zfs.extraPools = [ "Meconium" ]; # import on boot
}

View File

@ -54,9 +54,6 @@
"/Work/Programming" "/Work/Programming"
"/Work/School" "/Work/School"
"/pub" "/pub"
]) ++ (map (mkMount "/mnt/meconium" "192.168.1.3:/Meconium" ) [
""
"/beets_music"
]) ])
); );