at 23.11-pre 1.3 kB view raw
1# Fusion Inventory daemon. 2{ config, lib, pkgs, ... }: 3 4with lib; 5 6let 7 cfg = config.services.fusionInventory; 8 9 configFile = pkgs.writeText "fusion_inventory.conf" '' 10 server = ${concatStringsSep ", " cfg.servers} 11 12 logger = stderr 13 14 ${cfg.extraConfig} 15 ''; 16 17in { 18 19 ###### interface 20 21 options = { 22 23 services.fusionInventory = { 24 25 enable = mkEnableOption (lib.mdDoc "Fusion Inventory Agent"); 26 27 servers = mkOption { 28 type = types.listOf types.str; 29 description = lib.mdDoc '' 30 The urls of the OCS/GLPI servers to connect to. 31 ''; 32 }; 33 34 extraConfig = mkOption { 35 default = ""; 36 type = types.lines; 37 description = lib.mdDoc '' 38 Configuration that is injected verbatim into the configuration file. 39 ''; 40 }; 41 }; 42 }; 43 44 45 ###### implementation 46 47 config = mkIf cfg.enable { 48 49 users.users.fusion-inventory = { 50 description = "FusionInventory user"; 51 isSystemUser = true; 52 }; 53 54 systemd.services.fusion-inventory = { 55 description = "Fusion Inventory Agent"; 56 wantedBy = [ "multi-user.target" ]; 57 58 serviceConfig = { 59 ExecStart = "${pkgs.fusionInventory}/bin/fusioninventory-agent --conf-file=${configFile} --daemon --no-fork"; 60 }; 61 }; 62 }; 63}