base: Add shared zfs options to make links config live close to related config
This commit is contained in:
parent
fe306085f4
commit
33dadf8e4c
10 changed files with 72 additions and 62 deletions
|
@ -20,6 +20,7 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
zfs = {
|
zfs = {
|
||||||
|
enable = true;
|
||||||
encrypted = true;
|
encrypted = true;
|
||||||
backups = [
|
backups = [
|
||||||
{
|
{
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
};
|
};
|
||||||
nix.enableDirenv = false;
|
nix.enableDirenv = false;
|
||||||
zfs = {
|
zfs = {
|
||||||
|
enable = true;
|
||||||
backups = [
|
backups = [
|
||||||
{
|
{
|
||||||
path = "zroot/safe/data";
|
path = "zroot/safe/data";
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
internalIPV4 = "192.168.0.1";
|
internalIPV4 = "192.168.0.1";
|
||||||
};
|
};
|
||||||
zfs = {
|
zfs = {
|
||||||
|
enable = true;
|
||||||
backups = [
|
backups = [
|
||||||
{
|
{
|
||||||
path = "zroot/safe/data";
|
path = "zroot/safe/data";
|
||||||
|
|
|
@ -1,23 +1,20 @@
|
||||||
{ config, lib, pkgs, ... }:
|
{ config, lib, pkgs, ... }:
|
||||||
{
|
{
|
||||||
config = {
|
chvp.base = {
|
||||||
chvp.base = {
|
emacs.extraConfig = [
|
||||||
emacs.extraConfig = [
|
''
|
||||||
''
|
;; Nix syntax support
|
||||||
;; Nix syntax support
|
(use-package nix-mode
|
||||||
(use-package nix-mode
|
:mode "\\.nix\\'"
|
||||||
:mode "\\.nix\\'"
|
|
||||||
)
|
|
||||||
''
|
|
||||||
] ++ lib.optional config.chvp.base.nix.enableDirenv ''
|
|
||||||
;; Direnv integration in emacs.
|
|
||||||
(use-package direnv
|
|
||||||
:config (direnv-mode)
|
|
||||||
)
|
)
|
||||||
'';
|
''
|
||||||
zfs.homeLinks = (lib.optional config.chvp.base.nix.enableDirenv { path = ".local/share/direnv"; type = "cache"; });
|
] ++ lib.optional config.chvp.base.nix.enableDirenv ''
|
||||||
};
|
;; Direnv integration in emacs.
|
||||||
nix.gc.dates = if config.chvp.base.nix.slowGc then "daily" else "hourly";
|
(use-package direnv
|
||||||
programs.command-not-found.enable = false;
|
:config (direnv-mode)
|
||||||
|
)
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
|
nix.gc.dates = if config.chvp.base.nix.slowGc then "daily" else "hourly";
|
||||||
|
programs.command-not-found.enable = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,48 +1,7 @@
|
||||||
{ config, lib, ... }:
|
{ config, lib, ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
options.chvp.base.zfs = {
|
config = lib.mkIf config.chvp.base.zfs.enable {
|
||||||
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 = {
|
|
||||||
chvp.dataPrefix = lib.mkDefault "/data";
|
chvp.dataPrefix = lib.mkDefault "/data";
|
||||||
chvp.cachePrefix = lib.mkDefault "/cache";
|
chvp.cachePrefix = lib.mkDefault "/cache";
|
||||||
|
|
||||||
|
|
|
@ -73,8 +73,6 @@ let
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
chvp.base.zsh.usersToConfigure = [ "charlotte" "root" ];
|
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) { } (
|
home-manager.users = builtins.foldl' (a: b: a // b) { } (
|
||||||
builtins.map
|
builtins.map
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
./nix
|
./nix
|
||||||
|
./zfs
|
||||||
./zsh
|
./zsh
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
@ -36,6 +36,7 @@ in
|
||||||
};
|
};
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
|
chvp.base.zfs.homeLinks = (lib.optional config.chvp.base.nix.enableDirenv { path = ".local/share/direnv"; type = "cache"; });
|
||||||
nix = {
|
nix = {
|
||||||
gc = {
|
gc = {
|
||||||
automatic = true;
|
automatic = true;
|
||||||
|
|
49
modules/shared/base/zfs/default.nix
Normal file
49
modules/shared/base/zfs/default.nix
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
{ config, lib, ... }:
|
||||||
|
|
||||||
|
# Define shared options so that links configuration can live close to actual configuration
|
||||||
|
{
|
||||||
|
options.chvp.base.zfs = {
|
||||||
|
enable = lib.mkOption {
|
||||||
|
default = false;
|
||||||
|
example = true;
|
||||||
|
};
|
||||||
|
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";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
|
@ -65,6 +65,8 @@ in
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
programs.zsh.enable = true;
|
programs.zsh.enable = true;
|
||||||
|
chvp.base.zfs.homeLinks = lib.mkIf (builtins.elem username config.chvp.base.zsh.usersToConfigure) [{ path = ".local/share/autojump"; type = "cache"; }];
|
||||||
|
chvp.base.zfs.systemLinks = lib.mkIf (builtins.elem "root" config.chvp.base.zsh.usersToConfigure) [{ path = "/root/.local/share/autojump"; type = "cache"; }];
|
||||||
} // {
|
} // {
|
||||||
home-manager.users = builtins.foldl' (a: b: a // b) { } (
|
home-manager.users = builtins.foldl' (a: b: a // b) { } (
|
||||||
builtins.map
|
builtins.map
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue