at 25.11-pre 1.8 kB view raw
1{ 2 config, 3 pkgs, 4 lib, 5 ... 6}: 7let 8 cfg = config.services.meshcentral; 9 configFormat = pkgs.formats.json { }; 10 configFile = configFormat.generate "meshcentral-config.json" cfg.settings; 11in 12with lib; 13{ 14 options.services.meshcentral = with types; { 15 enable = mkEnableOption "MeshCentral computer management server"; 16 package = mkPackageOption pkgs "meshcentral" { }; 17 settings = mkOption { 18 description = '' 19 Settings for MeshCentral. Refer to upstream documentation for details: 20 21 - [JSON Schema definition](https://github.com/Ylianst/MeshCentral/blob/master/meshcentral-config-schema.json) 22 - [simple sample configuration](https://github.com/Ylianst/MeshCentral/blob/master/sample-config.json) 23 - [complex sample configuration](https://github.com/Ylianst/MeshCentral/blob/master/sample-config-advanced.json) 24 - [Old homepage with documentation link](https://www.meshcommander.com/meshcentral2) 25 ''; 26 type = types.submodule { 27 freeformType = configFormat.type; 28 }; 29 example = { 30 settings = { 31 WANonly = true; 32 Cert = "meshcentral.example.com"; 33 TlsOffload = "10.0.0.2,fd42::2"; 34 Port = 4430; 35 }; 36 domains."".certUrl = "https://meshcentral.example.com/"; 37 }; 38 }; 39 }; 40 config = mkIf cfg.enable { 41 services.meshcentral.settings.settings.autoBackup.backupPath = 42 lib.mkDefault "/var/lib/meshcentral/backups"; 43 systemd.services.meshcentral = { 44 wantedBy = [ "multi-user.target" ]; 45 serviceConfig = { 46 ExecStart = "${cfg.package}/bin/meshcentral --datapath /var/lib/meshcentral --configfile ${configFile}"; 47 DynamicUser = true; 48 StateDirectory = "meshcentral"; 49 CacheDirectory = "meshcentral"; 50 }; 51 }; 52 }; 53 meta.maintainers = [ ]; 54}