From 606d121ba0b5f36f9a6419c48e6986a27ac1f5b0 Mon Sep 17 00:00:00 2001 From: Alexander Foremny Date: Tue, 20 Feb 2024 07:00:30 +0100 Subject: add abuilder service --- modules/abuilder/default.nix | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 modules/abuilder/default.nix (limited to 'modules/abuilder/default.nix') 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" ]; + } + ]); +} -- cgit v1.2.3