base: Add shared zfs options to make links config live close to related config

This commit is contained in:
Charlotte Van Petegem 2024-07-18 17:21:47 +02:00
parent fe306085f4
commit 33dadf8e4c
10 changed files with 72 additions and 62 deletions

View file

@ -1,23 +1,20 @@
{ config, lib, pkgs, ... }:
{
config = {
chvp.base = {
emacs.extraConfig = [
''
;; Nix syntax support
(use-package nix-mode
:mode "\\.nix\\'"
)
''
] ++ lib.optional config.chvp.base.nix.enableDirenv ''
;; Direnv integration in emacs.
(use-package direnv
:config (direnv-mode)
chvp.base = {
emacs.extraConfig = [
''
;; Nix syntax support
(use-package nix-mode
:mode "\\.nix\\'"
)
'';
zfs.homeLinks = (lib.optional config.chvp.base.nix.enableDirenv { path = ".local/share/direnv"; type = "cache"; });
};
nix.gc.dates = if config.chvp.base.nix.slowGc then "daily" else "hourly";
programs.command-not-found.enable = false;
''
] ++ lib.optional config.chvp.base.nix.enableDirenv ''
;; Direnv integration in emacs.
(use-package direnv
:config (direnv-mode)
)
'';
};
nix.gc.dates = if config.chvp.base.nix.slowGc then "daily" else "hourly";
programs.command-not-found.enable = false;
}

View file

@ -1,48 +1,7 @@
{ config, lib, ... }:
{
options.chvp.base.zfs = {
encrypted = lib.mkOption {
default = false;
example = true;
};
systemLinks = lib.mkOption {
default = [ ];
example = [
{ path = "/var/lib/docker"; type = "cache"; }
{ path = "/var/lib/docker/volumes"; type = "data"; }
];
};
homeLinks = lib.mkOption {
default = [ ];
example = [
{ path = ".config/syncthing"; type = "data"; }
{ path = ".cache/nix-index"; type = "cache"; }
];
};
ensureSystemExists = lib.mkOption {
default = [ ];
example = [ "/data/etc/ssh" ];
};
ensureHomeExists = lib.mkOption {
default = [ ];
example = [ ".ssh" ];
};
backups = lib.mkOption {
default = [ ];
example = [{
path = "rpool/safe/data";
remotePath = "zdata/recv/<hostname>/safe/data";
fast = false;
location = "lasting-integrity.vanpetegem.me";
}];
};
rootDataset = lib.mkOption {
example = "rpool/local/root";
};
};
config = {
config = lib.mkIf config.chvp.base.zfs.enable {
chvp.dataPrefix = lib.mkDefault "/data";
chvp.cachePrefix = lib.mkDefault "/cache";

View file

@ -73,8 +73,6 @@ let
in
{
chvp.base.zsh.usersToConfigure = [ "charlotte" "root" ];
chvp.base.zfs.systemLinks = [{ path = "/root/.local/share/autojump"; type = "cache"; }];
chvp.base.zfs.homeLinks = [{ path = ".local/share/autojump"; type = "cache"; }];
} // {
home-manager.users = builtins.foldl' (a: b: a // b) { } (
builtins.map