diff options
Diffstat (limited to 'modules/abuilder')
-rw-r--r-- | modules/abuilder/default.nix | 26 |
1 files changed, 26 insertions, 0 deletions
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" ]; + } + ]); +} |