Added diwan to thingvellir
This commit is contained in:
1 parent
b369ef8e1d
commit
f5ffea6d64
7 files changed
+99
-5
No files matched your search
Generated
+4
-4
@@ -43,11 +43,11 @@
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1794237634,
|
||||
"narHash": "sha256-JuKo2OLUhsgDJTeGm5SmJ3EZiyyxJViryh+W7UtsMYc=",
|
||||
"lastModified": 1794246188,
|
||||
"narHash": "sha256-Y9ABp5yvkeTjzj7s7gd3JxiL9nlUrB6+DhOA+BKdoAk=",
|
||||
"ref": "refs/heads/main",
|
||||
"rev": "c09f2a1a11fe32812306bc6524350e59b3ac232d",
|
||||
"revCount": 6,
|
||||
"rev": "43215d6e0a35f8b8594e2dec78e9535731444e6a",
|
||||
"revCount": 8,
|
||||
"type": "git",
|
||||
"url": "https://git.samfelag.xyz/marc/diwan"
|
||||
},
|
||||
|
||||
@@ -70,5 +70,19 @@ with lib;
|
||||
|
||||
dev.docker.enable = true;
|
||||
dev.docker.users = ["marc"];
|
||||
|
||||
ai.claude.enable = true;
|
||||
ai.diwan = {
|
||||
enable = true;
|
||||
notesDir = "/home/marc/org-agenda";
|
||||
};
|
||||
app.nextcloud.syncClient = {
|
||||
enable = true;
|
||||
user = "marc";
|
||||
localDir = "/home/marc/org-agenda";
|
||||
remoteUrl = "https://nextcloud.samfelag.xyz";
|
||||
remotePath = "/org-agenda";
|
||||
passwordFile = config.age.secrets."app.d/nextcloud-password".path;
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -20,5 +20,11 @@
|
||||
group = "consul";
|
||||
mode = "600";
|
||||
};
|
||||
|
||||
"app.d/nextcloud-password" = {
|
||||
file = ../../secrets/app.d/nextcloud-password.age;
|
||||
owner = "marc";
|
||||
mode = "400";
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -43,6 +43,9 @@ in
|
||||
description = "diwan tick";
|
||||
after = [ "network-online.target" ];
|
||||
wants = [ "network-online.target" ];
|
||||
# diwan shells out to `herdr`; systemd's default service PATH doesn't
|
||||
# include it, so add it explicitly rather than relying on the login PATH.
|
||||
path = [ inputs.herdr.packages.${system}.default ];
|
||||
environment = {
|
||||
DIWAN_NOTES_DIR = cfg.notesDir;
|
||||
};
|
||||
|
||||
@@ -6,8 +6,45 @@ in
|
||||
{
|
||||
options.samfelag.modules.app.nextcloud = {
|
||||
enable = lib.mkEnableOption "nextcloud";
|
||||
|
||||
syncClient = {
|
||||
enable = lib.mkEnableOption "headless nextcloud sync via nextcloudcmd on a timer";
|
||||
|
||||
user = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
description = "User to run the sync as, and Nextcloud login name";
|
||||
};
|
||||
config = lib.mkIf cfg.enable {
|
||||
|
||||
localDir = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
description = "Local directory to sync";
|
||||
};
|
||||
|
||||
remoteUrl = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
description = "Nextcloud server URL";
|
||||
};
|
||||
|
||||
remotePath = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "";
|
||||
description = "Remote path on the Nextcloud server to sync";
|
||||
};
|
||||
|
||||
passwordFile = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
description = "Path to an EnvironmentFile containing NC_PASSWORD=... (should be secret)";
|
||||
};
|
||||
|
||||
interval = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "1min";
|
||||
description = "How often to run the sync (systemd time span)";
|
||||
};
|
||||
};
|
||||
};
|
||||
config = lib.mkMerge [
|
||||
(lib.mkIf cfg.enable {
|
||||
environment.systemPackages = with pkgs; [
|
||||
nextcloud-client
|
||||
];
|
||||
@@ -16,6 +53,28 @@ in
|
||||
enable = true;
|
||||
startInBackground = true;
|
||||
};
|
||||
})
|
||||
|
||||
(lib.mkIf cfg.syncClient.enable {
|
||||
systemd.services.nextcloud-sync = {
|
||||
description = "Nextcloud headless sync (nextcloudcmd)";
|
||||
after = [ "network-online.target" ];
|
||||
wants = [ "network-online.target" ];
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
User = cfg.syncClient.user;
|
||||
EnvironmentFile = cfg.syncClient.passwordFile;
|
||||
ExecStart = "${pkgs.nextcloud-client}/bin/nextcloudcmd --non-interactive -u ${cfg.syncClient.user} --path ${cfg.syncClient.remotePath} ${cfg.syncClient.localDir} ${cfg.syncClient.remoteUrl}";
|
||||
};
|
||||
};
|
||||
|
||||
systemd.timers.nextcloud-sync = {
|
||||
wantedBy = [ "timers.target" ];
|
||||
timerConfig = {
|
||||
OnBootSec = cfg.syncClient.interval;
|
||||
OnUnitActiveSec = cfg.syncClient.interval;
|
||||
};
|
||||
};
|
||||
})
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
age-encryption.org/v1
|
||||
-> ssh-ed25519 GWuf0Q VbKtptk2zh0R7h9LxIxRsYXqaq3uHCIZQEdOn3/QvSM
|
||||
E9A0gRixWQfxmJSHeqxNv0W73jKNliQtP93CjzFXkJE
|
||||
-> ssh-ed25519 kNjiNQ 2eJ3bwzlT8Jjox0TUyUKzMQqCDsIJtjHljyfQYkHi2I
|
||||
KvtOT0oijhV8L07bW0dby8v4IWP/2n+XAlN4bmekihY
|
||||
--- Cv64ZC71bS45sWrEpwhV4hmLPv+96QmIR/qOR+D8bo0
|
||||
Íã2f}KÃÄäÞ˰–üÙ.
|
||||
4¼Z¢2ðסzY”
|
||||
…1§Ž–ëSŠ�’uÛ¹vm‘&еB] »KÑ‚?" Ð\œÈ¶ÍTq
|
||||
@@ -37,4 +37,7 @@ in
|
||||
# -- Nomad -------------------------------
|
||||
"nomad.d/consul-token-client.json.age".publicKeys = samfelag-hosts;
|
||||
"nomad.d/consul-token-server.json.age".publicKeys = thingvellir;
|
||||
|
||||
# -- Apps --------------------------------
|
||||
"app.d/nextcloud-password.age".publicKeys = thingvellir;
|
||||
}
|
||||
Reference in new issue
Block a user