tests/modules/home-manager: init

This commit is contained in:
Gabriel Arazas 2024-03-06 07:37:33 +08:00
parent f016e180b5
commit 0f593318c5
No known key found for this signature in database
GPG Key ID: ADE0C41DAB221FCC
4 changed files with 100 additions and 0 deletions

View File

@ -0,0 +1,56 @@
# We're basically reimplmenting parts from the home-manager test suite here
# just with our own modules included.
{ pkgs ? import <nixpkgs> { }
, homeManagerSrc ? <home-manager>
, enableBig ? true
}:
let
nmt = pkgs.nix-lib-nmt;
lib = import "${homeManagerSrc}/modules/lib/stdlib-extended.nix" pkgs.lib;
homeManagerModules = import "${homeManagerSrc}/modules/modules.nix" {
inherit pkgs lib;
check = false;
};
modules = homeManagerModules ++ [
../../../modules/home-manager
../../../modules/home-manager/_private
# Copied over from home-manager test suite.
{
# Bypass <nixpkgs> reference inside modules/modules.nix to make the test
# suite more pure.
_module.args.pkgsPath = pkgs.path;
# Fix impurities. Without these some of the user's environment
# will leak into the tests through `builtins.getEnv`.
xdg.enable = true;
home = {
username = "hm-user";
homeDirectory = "/home/hm-user";
stateVersion = lib.mkDefault "18.09";
};
# Avoid including documentation since this will cause
# unnecessary rebuilds of the tests.
manual.manpages.enable = lib.mkDefault false;
imports = [
"${homeManagerSrc}/tests/asserts.nix"
"${homeManagerSrc}/tests/big-test.nix"
"${homeManagerSrc}/tests/stubs.nix"
];
test.enableBig = enableBig;
}
];
inherit (pkgs.stdenv.hostPlatform) isDarwin isLinux;
in
import nmt {
inherit pkgs lib modules;
testedAttrPath = [ "home" "activationPackage" ];
tests = builtins.foldl' (a: b: a // (import b)) { } [
./programs/neovide
];
}

View File

@ -0,0 +1,29 @@
{ config, lib, ... }: {
programs.neovide = {
enable = true;
settings = {
maximized = true;
font = {
normal = [ "MonoLisa Nerd Font" ];
size = 18;
features.MonoLisa = [
"+ss01"
"+ss07"
"+ss11"
"-calt"
"+ss09"
"+ss02"
"+ss14"
"+ss16"
"+ss17"
];
};
};
};
test.stubs.neovide = { };
nmt.script = ''
assertFileExists home-files/.config/neovide/config.toml
'';
}

View File

@ -0,0 +1,4 @@
{
neovide-basic-settings = ./basic.nix;
neovide-empty-settings = ./empty-settings.nix;
}

View File

@ -0,0 +1,11 @@
{ ... }:
{
programs.neovide.enable = true;
test.stubs.neovide = { };
nmt.script = ''
assertPathNotExists home-files/.config/neovide/config.toml
'';
}