depot/third_party/nixpkgs/pkgs/test/systemd/nixos/default.nix
Default email c7cb07f092 Project import generated by Copybara.
GitOrigin-RevId: 1536926ef5621b09bba54035ae2bb6d806d72ac8
2024-02-29 21:09:43 +01:00

37 lines
1.2 KiB
Nix

{ pkgs, lib, stdenv, ... }:
lib.runTests {
# Merging two non-list definitions must still result in an error
# about a conflicting definition.
test-unitOption-merging-non-lists-conflict =
let nixos = pkgs.nixos {
system.stateVersion = lib.trivial.release;
systemd.services.systemd-test-nixos = {
serviceConfig = lib.mkMerge [
{ StateDirectory = "foo"; }
{ StateDirectory = "bar"; }
];
};
};
in {
expr = (builtins.tryEval (nixos.config.systemd.services.systemd-test-nixos.serviceConfig.StateDirectory)).success;
expected = false;
};
# Merging must lift non-list definitions to a list
# if at least one of them is a list.
test-unitOption-merging-list-non-list-append =
let nixos = pkgs.nixos {
system.stateVersion = lib.trivial.release;
systemd.services.systemd-test-nixos = {
serviceConfig = lib.mkMerge [
{ StateDirectory = "foo"; }
{ StateDirectory = ["bar"]; }
];
};
};
in {
expr = nixos.config.systemd.services.systemd-test-nixos.serviceConfig.StateDirectory;
expected = [ "foo" "bar" ];
};
}