aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Alexander Foremny <aforemny@posteo.de>2024-02-20 07:00:30 +0100
committerLibravatar Alexander Foremny <aforemny@posteo.de>2024-02-21 03:31:19 +0100
commit606d121ba0b5f36f9a6419c48e6986a27ac1f5b0 (patch)
tree20527011bd419f3685b060908145ace2429ddf99
parentb4655bed9ca84e44295a0c52e70b0a8483ed004b (diff)
add abuilder service
-rw-r--r--apps/static-website/integration.nix5
-rw-r--r--modules/abuilder/default.nix26
-rw-r--r--nix/sources.json6
-rw-r--r--pkgs/abuilder/default.nix1
-rw-r--r--pkgs/nomath-org/default.nix1
-rw-r--r--pkgs/static-nomath-org/default.nix1
-rw-r--r--systems/system1/configuration.nix16
7 files changed, 52 insertions, 4 deletions
diff --git a/apps/static-website/integration.nix b/apps/static-website/integration.nix
new file mode 100644
index 0000000..17e8af9
--- /dev/null
+++ b/apps/static-website/integration.nix
@@ -0,0 +1,5 @@
+{ appConfig, lib, ... }:
+{
+ # TODO support symlinks in bindMount-integrations
+ bindMounts.${dirOf (lib.strings.normalizePath (toString appConfig.root))}.isReadOnly = false;
+}
diff --git a/modules/abuilder/default.nix b/modules/abuilder/default.nix
new file mode 100644
index 0000000..a4dc76a
--- /dev/null
+++ b/modules/abuilder/default.nix
@@ -0,0 +1,26 @@
+{ config, lib, pkgs, ... }:
+let cfg = config.services.abuilder; in
+{
+ options.services.abuilder = {
+ enable = lib.mkEnableOption "abuilder build daemon";
+ repositories = lib.mkOption {
+ type = lib.types.listOf lib.types.path;
+ default = [ ];
+ };
+ };
+
+ config = lib.mkIf cfg.enable (lib.mkMerge [
+ {
+ environment.systemPackages = [ pkgs.abuilder ];
+
+ # TODO harden `systemd.services.abuilder`
+ systemd.services."abuilder".after = [ "network.target" ];
+ systemd.services."abuilder".environment.ABUILDER_STATE = "/var/lib/abuilder";
+ systemd.services."abuilder".environment.ABUILDER_URLS = lib.concatStringsSep ":" cfg.repositories;
+ systemd.services."abuilder".environment.NIX_PATH = "nixpkgs=/etc/nixos/nixpkgs";
+ systemd.services."abuilder".path = [ pkgs.git pkgs.nix ];
+ systemd.services."abuilder".script = "${pkgs.abuilder}/bin/abuilder";
+ systemd.services."abuilder".wantedBy = [ "multi-user.target" ];
+ }
+ ]);
+}
diff --git a/nix/sources.json b/nix/sources.json
index 9195cbd..b6f08ce 100644
--- a/nix/sources.json
+++ b/nix/sources.json
@@ -1,4 +1,10 @@
{
+ "abuilder": {
+ "branch": "main",
+ "repo": "git@code.nomath.org:~/abuilder",
+ "rev": "9f2d5ae570c120f19434f03eb20ab2c3ecf36e0c",
+ "type": "git"
+ },
"fysiweb-cli": {
"branch": "main",
"repo": "git@github.com:aforemny/fysiweb-cli.git",
diff --git a/pkgs/abuilder/default.nix b/pkgs/abuilder/default.nix
new file mode 100644
index 0000000..396dbb8
--- /dev/null
+++ b/pkgs/abuilder/default.nix
@@ -0,0 +1 @@
+import "${(import ../../nix/sources.nix).abuilder}/abuilder.nix"
diff --git a/pkgs/nomath-org/default.nix b/pkgs/nomath-org/default.nix
deleted file mode 100644
index b7aa5ff..0000000
--- a/pkgs/nomath-org/default.nix
+++ /dev/null
@@ -1 +0,0 @@
-import "${(import ../../nix/sources.nix).nomath-org}/nomath-org.nix"
diff --git a/pkgs/static-nomath-org/default.nix b/pkgs/static-nomath-org/default.nix
deleted file mode 100644
index 099ecf9..0000000
--- a/pkgs/static-nomath-org/default.nix
+++ /dev/null
@@ -1 +0,0 @@
-import "${(import ../../nix/sources.nix).static-nomath-org}/static-nomath-org.nix"
diff --git a/systems/system1/configuration.nix b/systems/system1/configuration.nix
index 343ed53..4f47b3c 100644
--- a/systems/system1/configuration.nix
+++ b/systems/system1/configuration.nix
@@ -1,9 +1,12 @@
{ lib, pkgs, ... }:
{
imports = [
+ # TODO auto-load config
<fysiweb/configs>
<fysiweb/configs/hcloud>
../../configs
+ # TODO auto-load modules
+ ../../modules/abuilder
];
config = lib.mkMerge [
@@ -12,15 +15,16 @@
}
{
fysiweb-apps.public.static-website."nomath-org".domain = "nomath.org";
- fysiweb-apps.public.static-website."nomath-org".root = "${pkgs.nomath-org}";
+ fysiweb-apps.public.static-website."nomath-org".root = "/var/lib/abuilder/nomath-org/main";
}
{
fysiweb-apps.public.static-website."static-nomath-org".domain = "static.nomath.org";
- fysiweb-apps.public.static-website."static-nomath-org".root = "${pkgs.static-nomath-org}";
+ fysiweb-apps.public.static-website."static-nomath-org".root = "/var/lib/abuilder/static-nomath-org/main";
}
{
fysiweb-apps.public.cgit."code-nomath-org".domain = "code.nomath.org";
+ fysiweb-apps.public.cgit."code-nomath-org".repositories."abuilder".description = "simple build daemon";
fysiweb-apps.public.cgit."code-nomath-org".repositories."anissue".description = "in-source issue management";
fysiweb-apps.public.cgit."code-nomath-org".repositories."apaperless".description = "document archival system";
fysiweb-apps.public.cgit."code-nomath-org".repositories."infra".description = "nomath.org infrastructure";
@@ -34,5 +38,13 @@
fysiweb-apps.public.cgit."code-nomath-org".settings.root-desc = "";
fysiweb-apps.public.cgit."code-nomath-org".settings.root-title = "code.nomath.org";
}
+ {
+ # TODO add abuilder fysiweb app
+ services.abuilder.enable = true;
+ services.abuilder.repositories = [
+ "/var/lib/git/nomath-org"
+ "/var/lib/git/static-nomath-org"
+ ];
+ }
];
}