initial commit

This commit is contained in:
eyjhb 2024-08-08 14:16:04 +02:00
commit 2ca4b5440a
Signed by: eyjhb
GPG key ID: 609F508E3239F920
13 changed files with 584 additions and 0 deletions

View file

@ -0,0 +1,6 @@
{
imports = [
./state.nix
./easy-zfs-mounts.nix
];
}

View file

@ -0,0 +1,18 @@
{ config, lib, ... }:
with lib;
let
cfg = config.mine.zfsMounts;
in {
options.mine.zfsMounts = mkOption {
type = types.attrsOf types.str;
default = {};
};
config = {
mine.zfsMounts = let
zfsFilesystems = lib.filterAttrs (_: v: v.fsType == "zfs") config.fileSystems;
in lib.mapAttrs' (_: v: lib.nameValuePair v.device v.mountPoint) zfsFilesystems;
};
}

33
shared/modules/state.nix Normal file
View file

@ -0,0 +1,33 @@
{ config, lib, ... }:
with lib;
let
sources = import ./../sources/sources.nix;
in {
options.mine.state.enable = mkOption {
type = types.bool;
default = false;
};
imports = [
(sources.impermanence + "/nixos.nix")
];
config = mkIf config.mine.state.enable {
environment.persistence = {
root = {
persistentStoragePath = "/state/root";
files = [
"/etc/machine-id"
];
directories = [
"/var/lib/nixos"
"/var/log"
];
};
};
};
}