nixos-config/tests/lib/home-manager.nix

58 lines
1.2 KiB
Nix
Raw Permalink Normal View History

2024-03-08 08:39:13 +00:00
{ pkgs, lib, self }:
let
# We're just using stub configurations instead.
nixosConfig = {
programs = {
firefox = {
enable = true;
};
};
services = {
pipewire = {
enable = true;
wireplumber.enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
jack.enable = true;
};
};
};
hmConfig = {
services = {
activitywatch.enable = true;
bleachbit = {
enable = true;
cleaners = [
"firefox.cookies"
"discord.cache"
];
};
};
};
hmConfig' = {
inherit nixosConfig;
osConfig = nixosConfig;
} // hmConfig;
in
lib.runTests {
testHomeManagerStandaloneEmpty = {
expr = self.home-manager.hasNixOSConfigAttr { } [ "programs" "firefox" "enable" ] false;
expected = false;
};
testHomeManagerStandalone = {
expr = self.home-manager.hasNixOSConfigAttr hmConfig [ "programs" "firefox" "enable" ] false;
expected = false;
};
testHomeManagerWithinNixOS = {
expr = self.home-manager.hasNixOSConfigAttr hmConfig' [ "programs" "firefox" "enable" ] false;
expected = true;
};
}