From 4fa7edfa1fcb68b7ba350ef9e595f5cdc4fac38b Mon Sep 17 00:00:00 2001 From: kurogeek Date: Thu, 24 Jul 2025 11:39:06 +0700 Subject: [PATCH] vikunja implementation on b4l --- flake.lock | 16 ++++++++++++ flake.nix | 1 + inventories/default.nix | 7 ++++++ machines/b4l/configuration.nix | 4 +-- machines/b4l/services/vikunja.nix | 26 ++++++++++++++++++++ machines/default.nix | 2 +- vars/per-machine/b4l/vikunja/subdomain/value | 1 + 7 files changed, 54 insertions(+), 3 deletions(-) create mode 100644 machines/b4l/services/vikunja.nix create mode 100644 vars/per-machine/b4l/vikunja/subdomain/value diff --git a/flake.lock b/flake.lock index 5a6f282..a99f7b8 100644 --- a/flake.lock +++ b/flake.lock @@ -121,6 +121,21 @@ "type": "github" } }, + "import-tree": { + "locked": { + "lastModified": 1752730890, + "narHash": "sha256-GES8fapSLGz36MMPRVNkSUWXUTtqvGQNXHjRmRLfJUY=", + "owner": "vic", + "repo": "import-tree", + "rev": "6ebb8cb87987b20264c09296166543fd3761d274", + "type": "github" + }, + "original": { + "owner": "vic", + "repo": "import-tree", + "type": "github" + } + }, "nix-darwin": { "inputs": { "nixpkgs": [ @@ -191,6 +206,7 @@ "clan-core": "clan-core", "devshell": "devshell", "flake-parts": "flake-parts", + "import-tree": "import-tree", "nixpkgs": "nixpkgs", "treefmt-nix": "treefmt-nix" } diff --git a/flake.nix b/flake.nix index 61598fe..e475ff3 100644 --- a/flake.nix +++ b/flake.nix @@ -15,6 +15,7 @@ inputs.nixpkgs-lib.follows = "nixpkgs"; url = "github:hercules-ci/flake-parts"; }; + import-tree.url = "github:vic/import-tree"; nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; treefmt-nix = { url = "github:numtide/treefmt-nix"; diff --git a/inventories/default.nix b/inventories/default.nix index f963f1b..f1c0ddb 100644 --- a/inventories/default.nix +++ b/inventories/default.nix @@ -54,6 +54,13 @@ }; roles.default.machines.b4l = { }; }; + vikunja = { + module = { + name = "vikunja"; + input = "self"; + }; + roles.default.machines.b4l = { }; + }; }; services = { diff --git a/machines/b4l/configuration.nix b/machines/b4l/configuration.nix index 00cc3df..60b09ea 100644 --- a/machines/b4l/configuration.nix +++ b/machines/b4l/configuration.nix @@ -1,7 +1,7 @@ -{ config, ... }: +{ inputs, config, ... }: { imports = [ - + (inputs.import-tree ./services) ]; nixpkgs.hostPlatform = { system = "x86_64-linux"; diff --git a/machines/b4l/services/vikunja.nix b/machines/b4l/services/vikunja.nix new file mode 100644 index 0000000..f085929 --- /dev/null +++ b/machines/b4l/services/vikunja.nix @@ -0,0 +1,26 @@ +{ config, ... }: +{ + clan.core.vars.generators.vikunja = { + files.subdomain.secret = false; + + prompts = { + subdomain = { + persist = true; + type = "line"; + description = "Sub-domain for Vikunja todo app. Default:(todo)"; + }; + }; + + script = ''cat $prompts/subdomain | echo "todo" > $out/subdomain''; + }; + services.vikunja = { + frontendHostname = "${config.clan.core.vars.generators.vikunja.files.subdomain.value}.${config.networking.fqdn}"; + }; + services.nginx.virtualHosts."${config.services.vikunja.frontendHostname}" = { + useACMEHost = "${config.networking.fqdn}"; + forceSSL = true; + locations."/" = { + proxyPass = "${config.services.vikunja.frontendScheme}://${config.services.vikunja.frontendHostname}:${builtins.toString config.services.vikunja.port}"; + }; + }; +} diff --git a/machines/default.nix b/machines/default.nix index ab24724..a79019d 100644 --- a/machines/default.nix +++ b/machines/default.nix @@ -6,7 +6,7 @@ clan = { meta.name = "NewEdgeClan"; machines = { }; - specialArgs = { inherit self; }; + specialArgs = { inherit inputs self; }; inherit self; }; } diff --git a/vars/per-machine/b4l/vikunja/subdomain/value b/vars/per-machine/b4l/vikunja/subdomain/value new file mode 100644 index 0000000..258cd57 --- /dev/null +++ b/vars/per-machine/b4l/vikunja/subdomain/value @@ -0,0 +1 @@ +todo