mirror of
https://github.com/nix-community/home-manager.git
synced 2025-03-31 04:04:32 +00:00
tests: test per-user home.useUserPackages
This commit is contained in:
parent
61c4772096
commit
634172f673
3 changed files with 16 additions and 1 deletions
|
@ -4,7 +4,7 @@
|
|||
name = "nixos-basics";
|
||||
meta.maintainers = [ pkgs.lib.maintainers.rycee ];
|
||||
|
||||
nodes.machine = { config, ... }:
|
||||
nodes.machine = { config, pkgs, ... }:
|
||||
let inherit (config.home-manager.users) bob;
|
||||
in {
|
||||
imports = [ ../../../nixos ]; # Import the HM NixOS module.
|
||||
|
@ -38,10 +38,13 @@
|
|||
uid = 1000;
|
||||
};
|
||||
|
||||
home-manager.useUserPackages = true;
|
||||
|
||||
home-manager.users = let
|
||||
common = {
|
||||
home.stateVersion = "24.11";
|
||||
home.file.test.text = "testfile";
|
||||
home.packages = [ pkgs.hello ];
|
||||
# Enable a light-weight systemd service.
|
||||
services.pueue.enable = true;
|
||||
};
|
||||
|
@ -54,6 +57,7 @@
|
|||
home.stateVersion = "24.11";
|
||||
home.username = lib.mkForce name;
|
||||
home.homeDirectory = lib.mkForce "/var/tmp/hm/home/bob";
|
||||
home.useUserPackages = false;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@ -142,6 +146,9 @@
|
|||
expected = "testfile"
|
||||
assert actual == expected, f"expected {path} to contain {expected}, but got {actual}"
|
||||
|
||||
with subtest(f"Command from `home.packages` (user {user})"):
|
||||
succeed_as_user(user, "hello")
|
||||
|
||||
with subtest(f"Pueue service (user {user})"):
|
||||
with user_login(machine, user, "${password}"):
|
||||
actual = succeed_as_user(user, "pueue status")
|
||||
|
|
|
@ -2,4 +2,5 @@
|
|||
home-session-path = ./session-path.nix;
|
||||
home-session-search-variables = ./session-search-variables.nix;
|
||||
home-session-variables = ./session-variables.nix;
|
||||
home-use-user-packages = ./use-user-packages.nix;
|
||||
}
|
||||
|
|
7
tests/modules/home-environment/use-user-packages.nix
Normal file
7
tests/modules/home-environment/use-user-packages.nix
Normal file
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
home.useUserPackages = true;
|
||||
|
||||
test.asserts.warnings.expected = [
|
||||
"You have enabled `home.useUserPackages`, but this option has no effect outside of NixOS configurations."
|
||||
];
|
||||
}
|
Loading…
Add table
Reference in a new issue