nix: deduplicate home-manager merging
Some checks failed
Test / Sandbox (push) Successful in 37s
Test / Create distribution (push) Successful in 32s
Test / Sandbox (race detector) (push) Successful in 37s
Test / Fpkg (push) Successful in 39s
Test / Fortify (push) Successful in 2m10s
Test / Fortify (race detector) (push) Successful in 2m46s
Test / Flake checks (push) Failing after 1m7s
Some checks failed
Test / Sandbox (push) Successful in 37s
Test / Create distribution (push) Successful in 32s
Test / Sandbox (race detector) (push) Successful in 37s
Test / Fpkg (push) Successful in 39s
Test / Fortify (push) Successful in 2m10s
Test / Fortify (race detector) (push) Successful in 2m46s
Test / Flake checks (push) Failing after 1m7s
This becomes a problem when extraHomeConfig defines nixos module options. Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
parent
9a7c81a44e
commit
d2b046df28
18
nixos.nix
18
nixos.nix
@ -9,6 +9,7 @@ packages:
|
||||
let
|
||||
inherit (lib)
|
||||
lists
|
||||
attrsets
|
||||
mkMerge
|
||||
mkIf
|
||||
mapAttrs
|
||||
@ -238,15 +239,24 @@ in
|
||||
++ foldlAttrs (
|
||||
acc': _: app:
|
||||
acc'
|
||||
++ [
|
||||
++ (
|
||||
let
|
||||
key = getsubname fid app.identity;
|
||||
in
|
||||
[
|
||||
{
|
||||
${getsubname fid app.identity} = mkMerge [
|
||||
${key} = (
|
||||
mkMerge (
|
||||
[
|
||||
cfg.extraHomeConfig
|
||||
app.extraConfig
|
||||
{ home.packages = app.packages; }
|
||||
];
|
||||
]
|
||||
++ (if (attrsets.hasAttrByPath [ key ] acc) then (if !app.shareUid then throw "unexpected username collision" else [ ]) else [ app.extraConfig ])
|
||||
)
|
||||
);
|
||||
}
|
||||
]
|
||||
)
|
||||
) [ { ${getsubname fid 0} = cfg.extraHomeConfig; } ] cfg.apps
|
||||
) [ privPackages ] cfg.users
|
||||
);
|
||||
|
@ -96,13 +96,19 @@
|
||||
users.alice = 0;
|
||||
|
||||
extraHomeConfig = {
|
||||
# To test merge deduplication:
|
||||
options._fortify.noop = lib.mkEnableOption "nothing";
|
||||
|
||||
config = {
|
||||
home.stateVersion = "23.05";
|
||||
};
|
||||
};
|
||||
|
||||
apps = {
|
||||
"cat.gensokyo.extern.foot.noEnablements" = {
|
||||
name = "ne-foot";
|
||||
identity = 1;
|
||||
shareUid = true;
|
||||
verbose = true;
|
||||
share = pkgs.foot;
|
||||
packages = with pkgs; [
|
||||
@ -130,7 +136,8 @@
|
||||
|
||||
"cat.gensokyo.extern.Alacritty.x11" = {
|
||||
name = "x11-alacritty";
|
||||
identity = 3;
|
||||
identity = 1;
|
||||
shareUid = true;
|
||||
verbose = true;
|
||||
share = pkgs.alacritty;
|
||||
packages = with pkgs; [
|
||||
|
@ -206,9 +206,9 @@ machine.wait_until_fails("pgrep foot", timeout=5)
|
||||
|
||||
# Test XWayland (foot does not support X):
|
||||
swaymsg("exec x11-alacritty")
|
||||
wait_for_window(f"u0_a{aid(2)}@machine")
|
||||
wait_for_window(f"u0_a{aid(0)}@machine")
|
||||
machine.send_chars("clear; glinfo && touch /tmp/x11-ok\n")
|
||||
machine.wait_for_file(tmpdir_path(2, "x11-ok"), timeout=15)
|
||||
machine.wait_for_file(tmpdir_path(0, "x11-ok"), timeout=15)
|
||||
collect_state_ui("alacritty_x11")
|
||||
check_state("x11-alacritty", 2)
|
||||
machine.send_chars("exit\n")
|
||||
|
Loading…
x
Reference in New Issue
Block a user