Compare commits
4 commits
fefc7bd20d
...
9760d4d3bc
Author | SHA1 | Date | |
---|---|---|---|
|
9760d4d3bc | ||
|
86f77d2564 | ||
|
d36c87220b | ||
|
373bd88e1b |
|
@ -114,6 +114,13 @@
|
||||||
source = "rpool_orm";
|
source = "rpool_orm";
|
||||||
target = "rpool_elucredassa/backup/orm";
|
target = "rpool_elucredassa/backup/orm";
|
||||||
};
|
};
|
||||||
|
"kalessin-state" = {
|
||||||
|
dataset = "state";
|
||||||
|
sourceHost = "kalessin";
|
||||||
|
targetHost = "elucredassa";
|
||||||
|
source = "rpool_kalessin";
|
||||||
|
target = "rpool_elucredassa/backup/kalessin";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
{ config, lib, pkgs, ... }:
|
{ config, lib, pkgs, ... }:
|
||||||
let
|
let
|
||||||
cfg = config.fountain.backup;
|
cfg = config.fountain.backup;
|
||||||
|
keys = import ../keys.nix;
|
||||||
|
|
||||||
syncOptions = {
|
syncOptions = {
|
||||||
dataset = lib.mkOption {
|
dataset = lib.mkOption {
|
||||||
|
@ -91,34 +92,45 @@ in
|
||||||
# TODO: add some assertions to verify the options
|
# TODO: add some assertions to verify the options
|
||||||
|
|
||||||
config.flake.colmena = lib.mkMerge (lib.mapAttrsToList
|
config.flake.colmena = lib.mkMerge (lib.mapAttrsToList
|
||||||
(name: sync: {
|
(name: sync:
|
||||||
${sync.sourceHost} = { pkgs, ... }: {
|
let
|
||||||
randomcat.services.zfs.datasets."${sync.source}/${sync.dataset}".zfsPermissions.users.backup = [ "hold" "send" ];
|
inherit (sync) dataset sourceHost targetHost source target;
|
||||||
|
# TODO: don't want to have to dig into the node config for the fqdn
|
||||||
|
sourceFqdn = config.flake.nixosConfigurations.${sourceHost}.config.networking.fqdn;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
${sourceHost} = { pkgs, ... }: {
|
||||||
|
randomcat.services.zfs.datasets."${source}/${dataset}".zfsPermissions.users.backup = [ "hold" "send" ];
|
||||||
|
|
||||||
users.users.backup = {
|
users.users.backup = {
|
||||||
group = "backup";
|
group = "backup";
|
||||||
isSystemUser = true;
|
isSystemUser = true;
|
||||||
useDefaultShell = true;
|
useDefaultShell = true;
|
||||||
openssh.authorizedKeys.keys = cfg.keys.${sync.targetHost};
|
openssh.authorizedKeys.keys = cfg.keys.${targetHost};
|
||||||
packages = with pkgs; [ mbuffer lzop ]; # syncoid uses these if available but doesn't pull them in automatically
|
packages = with pkgs; [ mbuffer lzop ]; # syncoid uses these if available but doesn't pull them in automatically
|
||||||
};
|
};
|
||||||
users.groups.backup = { };
|
users.groups.backup = { };
|
||||||
};
|
};
|
||||||
|
|
||||||
${sync.targetHost} = {
|
${targetHost} = {
|
||||||
randomcat.services.zfs.datasets."${sync.target}".zfsPermissions.users.syncoid = [ "mount" "create" "receive" "recordsize" ];
|
randomcat.services.zfs.datasets.${target}.zfsPermissions.users.syncoid = [ "mount" "create" "receive" "recordsize" ];
|
||||||
|
|
||||||
services.syncoid = {
|
services.syncoid = {
|
||||||
enable = true;
|
enable = true;
|
||||||
interval = "*-*-* *:15:00";
|
interval = "*-*-* *:15:00";
|
||||||
commonArgs = [ "--no-sync-snap" ];
|
commonArgs = [ "--no-sync-snap" ];
|
||||||
commands = {
|
commands = {
|
||||||
${name} = {
|
${name} = {
|
||||||
source = "backup@${config.flake.nixosConfigurations.${sync.sourceHost}.config.networking.fqdn}:${sync.source}/${sync.dataset}";
|
source = "backup@${sourceFqdn}:${source}/${dataset}";
|
||||||
target = "${sync.target}/${sync.dataset}";
|
target = "${target}/${dataset}";
|
||||||
recursive = true;
|
recursive = true;
|
||||||
recvOptions = "ux recordsize o compression=lz4";
|
recvOptions = "ux recordsize o compression=lz4";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# TODO: this should be handled by a networking module
|
||||||
|
programs.ssh.knownHosts.${sourceFqdn}.publicKey = keys.machines.${sourceHost};
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
cfg.sync
|
cfg.sync
|
||||||
|
|
|
@ -26,5 +26,15 @@ in
|
||||||
authorizedKeys.keys = [ ];
|
authorizedKeys.keys = [ ];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
randomcat.services.zfs.datasets = {
|
||||||
|
"rpool_kalessin/state" = { mountpoint = "none"; };
|
||||||
|
};
|
||||||
|
|
||||||
|
services.sanoid.datasets."rpool_kalessin/state" = {
|
||||||
|
useTemplate = [ "production" ];
|
||||||
|
recursive = "zfs";
|
||||||
|
process_children_only = true;
|
||||||
|
};
|
||||||
|
|
||||||
system.stateVersion = "23.11";
|
system.stateVersion = "23.11";
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,12 +30,10 @@
|
||||||
services.sanoid.datasets."rpool_orm/state" = {
|
services.sanoid.datasets."rpool_orm/state" = {
|
||||||
useTemplate = [ "production" ];
|
useTemplate = [ "production" ];
|
||||||
recursive = "zfs";
|
recursive = "zfs";
|
||||||
|
process_children_only = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
qenya.services.actual = {
|
qenya.services.actual.enable = true;
|
||||||
enable = true;
|
|
||||||
domain = "actual.qenya.tel";
|
|
||||||
};
|
|
||||||
|
|
||||||
system.stateVersion = "23.11";
|
system.stateVersion = "23.11";
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,20 +3,18 @@
|
||||||
with lib;
|
with lib;
|
||||||
let
|
let
|
||||||
cfg = config.qenya.services.actual;
|
cfg = config.qenya.services.actual;
|
||||||
|
domain = "actual.qenya.tel";
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.qenya.services.actual = {
|
options.qenya.services.actual = {
|
||||||
enable = mkEnableOption "Actual";
|
enable = mkEnableOption "Actual Budget";
|
||||||
domain = mkOption {
|
|
||||||
type = types.str;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
services.nginx = {
|
services.nginx = {
|
||||||
enable = true;
|
enable = true;
|
||||||
virtualHosts = {
|
virtualHosts = {
|
||||||
${cfg.domain} = {
|
${domain} = {
|
||||||
forceSSL = true;
|
forceSSL = true;
|
||||||
enableACME = true;
|
enableACME = true;
|
||||||
locations."/".proxyPass = "http://127.0.0.1:5006/";
|
locations."/".proxyPass = "http://127.0.0.1:5006/";
|
||||||
|
|
Loading…
Reference in a new issue