1 { config, lib, pkgs, ... }:
4 cfg = config.services.goss;
6 settingsFormat = pkgs.formats.yaml { };
7 configFile = settingsFormat.generate "goss.yaml" cfg.settings;
12 maintainers = [ lib.maintainers.anthonyroussel ];
17 enable = lib.mkEnableOption "Goss daemon";
19 package = lib.mkPackageOption pkgs "goss" { };
21 environment = lib.mkOption {
22 type = lib.types.attrsOf lib.types.str;
26 GOSS_LOGLEVEL = "FATAL";
27 GOSS_LISTEN = ":8080";
30 Environment variables to set for the goss service.
32 See <https://github.com/goss-org/goss/blob/master/docs/manual.md>
36 settings = lib.mkOption {
37 type = lib.types.submodule { freeformType = settingsFormat.type; };
40 addr."tcp://localhost:8080" = {
42 local-address = "127.0.0.1";
50 The global options in `config` file in yaml format.
52 Refer to <https://github.com/goss-org/goss/blob/master/docs/goss-json-schema.yaml> for schema.
58 config = lib.mkIf cfg.enable {
59 environment.systemPackages = [ cfg.package ];
61 systemd.services.goss = {
62 description = "Goss - Quick and Easy server validation";
63 unitConfig.Documentation = "https://github.com/goss-org/goss/blob/master/docs/manual.md";
65 after = [ "network-online.target" ];
66 wantedBy = [ "multi-user.target" ];
67 wants = [ "network-online.target" ];
70 GOSS_FILE = configFile;
73 reloadTriggers = [ configFile ];
77 ExecReload = "${pkgs.coreutils}/bin/kill -HUP $MAINPID";
78 ExecStart = "${cfg.package}/bin/goss serve";
80 Restart = "on-failure";