Merge pull request #279479 from gepbird/c2fmzq-server-bool-setting-allow-false

nixos/c2fmzq-server: allow setting bool settings to false
This commit is contained in:
Peder Bergebakken Sundt 2024-01-14 18:32:11 +01:00 committed by GitHub
commit fa8616a4c0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 1 deletions

View file

@ -7,7 +7,11 @@ let
argsFormat = { argsFormat = {
type = with lib.types; attrsOf (nullOr (oneOf [ bool int str ])); type = with lib.types; attrsOf (nullOr (oneOf [ bool int str ]));
generate = lib.cli.toGNUCommandLineShell { }; generate = lib.cli.toGNUCommandLineShell {
mkBool = k: v: [
"--${k}=${if v then "true" else "false"}"
];
};
}; };
in { in {
options.services.c2fmzq-server = { options.services.c2fmzq-server = {

View file

@ -12,6 +12,7 @@ import ./make-test-python.nix ({ pkgs, lib, ... }: {
# make sure multiple freeform options evaluate # make sure multiple freeform options evaluate
allow-new-accounts = true; allow-new-accounts = true;
auto-approve-new-accounts = true; auto-approve-new-accounts = true;
licenses = false;
}; };
}; };
environment = { environment = {
@ -74,5 +75,8 @@ import ./make-test-python.nix ({ pkgs, lib, ... }: {
with subtest("Test that PWA is served"): with subtest("Test that PWA is served"):
msg = machine.succeed("curl -sSfL http://localhost:8080") msg = machine.succeed("curl -sSfL http://localhost:8080")
assert "c2FmZQ" in msg, f"Could not find 'c2FmZQ' in the output:\n{msg}" assert "c2FmZQ" in msg, f"Could not find 'c2FmZQ' in the output:\n{msg}"
with subtest("A setting with false value is properly passed"):
machine.succeed("systemctl show -p ExecStart --value c2fmzq-server.service | grep -F -- '--licenses=false'");
''; '';
}) })