Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions modules/context/user.nix
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ let

from-user = { host, user }: fixedTo { inherit host user; } den.aspects.${user.aspect};
from-host = { host, user }: atLeast den.aspects.${host.aspect} { inherit host user; };

in
{
den.ctx = ctx;
Expand Down
1 change: 0 additions & 1 deletion nix/lib/home-env.nix
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ let
includes = [
(den.ctx."${ctxName}-user" { inherit host user; })
(den.ctx.user { inherit host user; })
(den.lib.parametric.fixedTo { inherit host user; } den.aspects.${host.aspect})
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was unconditionally reading from the host aspect

];
};

Expand Down
1 change: 1 addition & 0 deletions templates/ci/modules/features/conditional-config.nix
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
pingu = { };
};
den.default.homeManager.home.stateVersion = "25.11";
den.ctx.user.includes = [ den._.bidirectional ];
den.aspects.igloo.includes = [ git-for-linux-only ];

expr = [
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{ denTest, ... }:
{
flake.tests.deadbugs-issue-292 = {

test-should-not-read-from-host-without-bidirectionality = denTest (
{
den,
lib,
igloo, # igloo = nixosConfigurations.igloo.config
tuxHm, # tuxHm = igloo.home-manager.users.tux
...
}:
{
den.hosts.x86_64-linux.igloo.users.tux = { };

den.aspects.igloo.includes = [ den.aspects.bash ];
den.aspects.tux.includes = [ den.aspects.bash ];

den.aspects.bash.homeManager.programs.bash.historyIgnore = [ "foo" ];

expr = tuxHm.programs.bash.historyIgnore;
expected = [ "foo" ];
}
);

};
}
1 change: 1 addition & 0 deletions templates/ci/modules/features/perUser-perHost.nix
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@
};

den.aspects.igloo.includes = [

(den.lib.perHost { nixos.funny = [ "atHost perHost static" ]; })
(den.lib.perHost (
{ host }:
Expand Down
90 changes: 76 additions & 14 deletions templates/ci/modules/features/user-host-bidirectional-config.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,53 +2,83 @@
{
flake.tests.user-host-bidirectional-config = {

test-host-owned-configures-all-users = denTest (
test-host-owned-unidirectional = denTest (
{
den,
tuxHm,
pinguHm,
...
}:
{
den.default.homeManager.home.stateVersion = "25.11";

den.hosts.x86_64-linux.igloo.users = {
tux = { };
pingu = { };
};

# no bidirectionality enabled, this is ignored
den.aspects.igloo.homeManager.programs.direnv.enable = true;

expr = [
tuxHm.programs.direnv.enable
pinguHm.programs.direnv.enable
];
expected = [
true
true
false
false
];
}
);

test-host-static-configures-all-users = denTest (
test-host-owned-bidirectional = denTest (
{
den,
tuxHm,
pinguHm,
...
}:
{
den.default.homeManager.home.stateVersion = "25.11";
den.hosts.x86_64-linux.igloo.users = {
tux = { };
pingu = { };
};

den.ctx.user.includes = [ den._.bidirectional ];
den.aspects.igloo.homeManager.programs.direnv.enable = true;

expr = [
tuxHm.programs.direnv.enable
pinguHm.programs.direnv.enable
];
expected = [
false
false
];
}
);

test-host-bidirectional-static-includes-configures-all-users = denTest (
{
den,
tuxHm,
pinguHm,
...
}:
{
den.hosts.x86_64-linux.igloo.users = {
tux = { };
pingu = { };
};

den.ctx.user.includes = [ den._.bidirectional ];

den.aspects.igloo.includes = [
{
homeManager.programs.direnv.enable = true;
homeManager.programs.direnv.enable = throw "unreachable, static includes wont be used by bidirectionality";
}
# This is the way, walk in it:
(den.lib.perUser {
homeManager.programs.direnv.enable = true;
})
];

expr = [
Expand All @@ -62,21 +92,56 @@
}
);

test-host-parametric-configures-all-users = denTest (
test-host-parametric-unidirectional = denTest (
{
den,
tuxHm,
pinguHm,
...
}:
{

den.hosts.x86_64-linux.igloo.users = {
tux = { };
pingu = { };
};

den.aspects.igloo.includes = [
(
{ host, user }:
{
homeManager.programs.direnv.enable = true;
}
)
];

expr = [
tuxHm.programs.direnv.enable
pinguHm.programs.direnv.enable
];
expected = [
false
false
];
}
);

test-host-parametric-bidirectional = denTest (
{
den,
tuxHm,
pinguHm,
...
}:
{
den.default.homeManager.home.stateVersion = "25.11";

den.hosts.x86_64-linux.igloo.users = {
tux = { };
pingu = { };
};

den.ctx.user.includes = [ den._.bidirectional ];

den.aspects.igloo.includes = [
(
{ host, user }:
Expand Down Expand Up @@ -105,7 +170,6 @@
...
}:
{
den.default.homeManager.home.stateVersion = "25.11";

den.hosts.x86_64-linux.igloo.users.tux = { };
den.hosts.x86_64-linux.iceberg.users.tux = { };
Expand All @@ -123,15 +187,14 @@
}
);

test-user-static-configures-all-hosts = denTest (
test-user-static-unidirectional-configures-all-hosts = denTest (
{
den,
igloo,
iceberg,
...
}:
{
den.default.homeManager.home.stateVersion = "25.11";

den.hosts.x86_64-linux.igloo.users.tux = { };
den.hosts.x86_64-linux.iceberg.users.tux = { };
Expand Down Expand Up @@ -161,7 +224,6 @@
...
}:
{
den.default.homeManager.home.stateVersion = "25.11";

den.hosts.x86_64-linux.igloo.users.tux = { };
den.hosts.x86_64-linux.iceberg.users.tux = { };
Expand Down
Loading