forked from NixOS/nixpkgs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request NixOS#290946 from ju1m/systemd-option-list
nixos/systemd: merge unit options as lists when at least one value is a list
- Loading branch information
Showing
5 changed files
with
51 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ lib, callPackage }: | ||
|
||
lib.recurseIntoAttrs { | ||
nixos = callPackage ./nixos { }; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
{ 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" ]; | ||
}; | ||
} |