1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-11-09 03:56:04 +01:00

tests: remove with lib (#6511)

This commit is contained in:
Austin Horstman 2025-02-21 21:20:07 -08:00 committed by GitHub
parent e495cd8c80
commit 439a125afe
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
100 changed files with 77 additions and 398 deletions

View file

@ -1,8 +1,6 @@
{ config, lib, pkgs, ... }: { config, lib, ... }:
let inherit (lib) concatStringsSep mkOption types;
with lib; in {
{
options.test.asserts = { options.test.asserts = {
warnings = { warnings = {
enable = mkOption { enable = mkOption {
@ -37,8 +35,8 @@ with lib;
}; };
}; };
config = mkMerge [ config = lib.mkMerge [
(mkIf config.test.asserts.warnings.enable { (lib.mkIf config.test.asserts.warnings.enable {
home.file = { home.file = {
"asserts/warnings.actual".text = concatStringsSep '' "asserts/warnings.actual".text = concatStringsSep ''
@ -57,12 +55,13 @@ with lib;
''; '';
}) })
(mkIf config.test.asserts.assertions.enable { (lib.mkIf config.test.asserts.assertions.enable {
home.file = { home.file = {
"asserts/assertions.actual".text = concatStringsSep '' "asserts/assertions.actual".text = concatStringsSep ''
-- --
'' (map (x: x.message) (filter (x: !x.assertion) config.assertions)); ''
(map (x: x.message) (lib.filter (x: !x.assertion) config.assertions));
"asserts/assertions.expected".text = concatStringsSep '' "asserts/assertions.expected".text = concatStringsSep ''
-- --

View file

@ -1,4 +1,4 @@
{ ... }: { {
home.username = "alice"; home.username = "alice";
home.homeDirectory = "/home/alice"; home.homeDirectory = "/home/alice";
home.stateVersion = "24.11"; home.stateVersion = "24.11";

View file

@ -1,4 +1,4 @@
{ ... }: { {
home.username = "alice"; home.username = "alice";
home.homeDirectory = "/home/alice"; home.homeDirectory = "/home/alice";

View file

@ -1,5 +1,3 @@
{ ... }:
{ {
accounts.email = { accounts.email = {
maildirBasePath = "Mail"; maildirBasePath = "Mail";

View file

@ -1,5 +1,3 @@
{ ... }:
{ {
home.file."disabled" = { home.file."disabled" = {
enable = false; enable = false;

View file

@ -1,5 +1,3 @@
{ ... }:
{ {
home.file."executable" = { home.file."executable" = {
text = ""; text = "";

View file

@ -1,5 +1,3 @@
{ ... }:
{ {
home.file.".hidden".source = ./.hidden; home.file.".hidden".source = ./.hidden;

View file

@ -1,5 +1,3 @@
{ ... }:
{ {
home.file."source with spaces!".source = ./. + "/source with spaces!"; home.file."source with spaces!".source = ./. + "/source with spaces!";

View file

@ -1,5 +1,3 @@
{ ... }:
{ {
home.file = { home.file = {
conflict1 = { conflict1 = {

View file

@ -1,5 +1,3 @@
{ ... }:
{ {
home.file."$HOME/$FOO/bar baz".text = "blah"; home.file."$HOME/$FOO/bar baz".text = "blah";

View file

@ -1,5 +1,3 @@
{ ... }:
{ {
home.file."using-text".text = '' home.file."using-text".text = ''
This is the This is the

View file

@ -1,7 +1,3 @@
{ config, lib, pkgs, ... }:
with lib;
{ {
config = { config = {
launchd.agents."test-service" = { launchd.agents."test-service" = {

View file

@ -1,5 +1,3 @@
{ ... }:
{ {
editorconfig = { editorconfig = {
enable = true; enable = true;

View file

@ -1,8 +1,4 @@
{ config, lib, pkgs, ... }: { pkgs, ... }: {
with lib;
{
config = { config = {
home.packages = [ pkgs.comic-relief pkgs.unifont ]; home.packages = [ pkgs.comic-relief pkgs.unifont ];

View file

@ -1,5 +1,3 @@
{ ... }:
{ {
nix = { nix = {
registry = { registry = {

View file

@ -1,8 +1,4 @@
{ config, lib, ... }: { config, ... }: {
with lib;
{
config = { config = {
pam.sessionVariables = { pam.sessionVariables = {
V1 = "v1"; V1 = "v1";

View file

@ -1,7 +1,3 @@
{ config, lib, pkgs, ... }:
with lib;
{ {
home.file.testfile.text = "not special"; home.file.testfile.text = "not special";
specialisation.test.configuration = { specialisation.test.configuration = {

View file

@ -1,8 +1,4 @@
{ config, lib, pkgs, ... }: { config, lib, ... }: {
with lib;
{
config = { config = {
# Test fallback behavior for stateVersion >= 20.09, which is pure. # Test fallback behavior for stateVersion >= 20.09, which is pure.
xdg.enable = lib.mkForce false; xdg.enable = lib.mkForce false;

View file

@ -1,8 +1,4 @@
{ config, lib, pkgs, ... }: { pkgs, ... }: {
with lib;
{
config = { config = {
xdg.desktopEntries = { xdg.desktopEntries = {
full = { # full definition full = { # full definition

View file

@ -1,8 +1,4 @@
{ config, lib, pkgs, ... }: { config, ... }: {
with lib;
{
config = { config = {
xdg.configHome = /. + "${config.home.homeDirectory}/.dummy-config"; xdg.configHome = /. + "${config.home.homeDirectory}/.dummy-config";
xdg.dataHome = /. + "${config.home.homeDirectory}/.dummy-data"; xdg.dataHome = /. + "${config.home.homeDirectory}/.dummy-data";

View file

@ -1,7 +1,3 @@
{ config, lib, pkgs, ... }:
with lib;
{ {
config = { config = {
xdg.mimeApps = { xdg.mimeApps = {

View file

@ -1,4 +1,4 @@
{ ... }: { {
config = { config = {
xdg.mime.enable = false; xdg.mime.enable = false;
nmt.script = '' nmt.script = ''

View file

@ -1,7 +1,3 @@
{ config, lib, pkgs, ... }:
with lib;
{ {
config = { config = {
xsession = { xsession = {

View file

@ -1,7 +1,3 @@
{ config, lib, pkgs, ... }:
with lib;
{ {
config = { config = {
home.stateVersion = "19.09"; home.stateVersion = "19.09";

View file

@ -1,7 +1,3 @@
{ config, lib, pkgs, ... }:
with lib;
{ {
config = { config = {
programs.abook.enable = true; programs.abook.enable = true;

View file

@ -1,7 +1,3 @@
{ config, lib, pkgs, ... }:
with lib;
{ {
config = { config = {
programs.abook = { programs.abook = {

View file

@ -1,7 +1,3 @@
{ config, lib, pkgs, ... }:
with lib;
{ {
config = { config = {
test.asserts.assertions.expected = ['' test.asserts.assertions.expected = [''

View file

@ -1,7 +1,3 @@
{ config, lib, pkgs, ... }:
with lib;
{ {
config = { config = {
nmt.script = let dir = "home-files/.config/aerc"; nmt.script = let dir = "home-files/.config/aerc";

View file

@ -1,8 +1,4 @@
{ config, lib, pkgs, ... }: { config, pkgs, ... }: {
with lib;
{
config = { config = {
nmt.script = let nmt.script = let
dir = if (pkgs.stdenv.isDarwin && !config.xdg.enable) then dir = if (pkgs.stdenv.isDarwin && !config.xdg.enable) then

View file

@ -1,5 +1,3 @@
{ ... }:
{ {
programs.atuin = { programs.atuin = {
enable = true; enable = true;

View file

@ -1,7 +1,3 @@
{ config, lib, pkgs, ... }:
with lib;
{ {
config = { config = {
programs.bash = { programs.bash = {

View file

@ -1,8 +1,4 @@
{ config, lib, pkgs, ... }: { config, ... }: {
with lib;
{
config = { config = {
programs.bottom = { programs.bottom = {
enable = true; enable = true;

View file

@ -1,8 +1,4 @@
{ config, lib, pkgs, ... }: { config, ... }: {
with lib;
{
config = { config = {
programs.bottom = { programs.bottom = {
enable = true; enable = true;

View file

@ -1,7 +1,3 @@
{ config, lib, pkgs, ... }:
with lib;
{ {
config = { config = {
programs.boxxy.enable = true; programs.boxxy.enable = true;

View file

@ -1,7 +1,3 @@
{ config, lib, pkgs, ... }:
with lib;
{ {
config = { config = {
programs.boxxy.enable = true; programs.boxxy.enable = true;

View file

@ -1,7 +1,3 @@
{ config, lib, pkgs, ... }:
with lib;
{ {
config = { config = {
programs.dircolors = { programs.dircolors = {

View file

@ -1,4 +1,4 @@
{ ... }: { {
config = { config = {
programs.eww = { programs.eww = {
enable = true; enable = true;

View file

@ -1,4 +1,4 @@
{ ... }: { {
config = { config = {
programs.eww = { enable = true; }; programs.eww = { enable = true; };

View file

@ -1,18 +1,13 @@
modulePath: modulePath:
{ config, lib, ... }: { config, lib, ... }:
with lib;
let let
moduleName = lib.concatStringsSep "." modulePath;
moduleName = concatStringsSep "." modulePath;
firefoxMockOverlay = import ./setup-firefox-mock-overlay.nix modulePath; firefoxMockOverlay = import ./setup-firefox-mock-overlay.nix modulePath;
in { in {
imports = [ firefoxMockOverlay ]; imports = [ firefoxMockOverlay ];
config = mkIf config.test.enableBig (setAttrByPath modulePath { config = lib.mkIf config.test.enableBig (lib.setAttrByPath modulePath {
enable = true; enable = true;
enableGnomeExtensions = true; enableGnomeExtensions = true;
} // { } // {

View file

@ -1,20 +1,15 @@
modulePath: modulePath:
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
with lib;
let let
cfg = lib.getAttrFromPath modulePath config;
cfg = getAttrFromPath modulePath config;
firefoxMockOverlay = import ./setup-firefox-mock-overlay.nix modulePath; firefoxMockOverlay = import ./setup-firefox-mock-overlay.nix modulePath;
in { in {
imports = [ firefoxMockOverlay ]; imports = [ firefoxMockOverlay ];
config = mkIf config.test.enableBig ({ config = lib.mkIf config.test.enableBig ({
home.stateVersion = "23.05"; home.stateVersion = "23.05";
} // setAttrByPath modulePath { } // lib.setAttrByPath modulePath {
enable = true; enable = true;
policies = { BlockAboutConfig = true; }; policies = { BlockAboutConfig = true; };
package = pkgs.${cfg.wrappedPackageName}.override { package = pkgs.${cfg.wrappedPackageName}.override {

View file

@ -1,20 +1,15 @@
modulePath: modulePath:
{ config, lib, pkgs, ... }: { config, lib, ... }:
with lib;
let let
cfg = lib.getAttrFromPath modulePath config;
cfg = getAttrFromPath modulePath config;
firefoxMockOverlay = import ./setup-firefox-mock-overlay.nix modulePath; firefoxMockOverlay = import ./setup-firefox-mock-overlay.nix modulePath;
in { in {
imports = [ firefoxMockOverlay ]; imports = [ firefoxMockOverlay ];
config = lib.mkIf config.test.enableBig ({ config = lib.mkIf config.test.enableBig ({
home.stateVersion = "19.09"; home.stateVersion = "19.09";
} // setAttrByPath modulePath { enable = true; } // { } // lib.setAttrByPath modulePath { enable = true; } // {
nmt.script = '' nmt.script = ''
assertFileRegex \ assertFileRegex \
home-path/bin/${cfg.wrappedPackageName} \ home-path/bin/${cfg.wrappedPackageName} \

View file

@ -1,7 +1,4 @@
{ config, lib, pkgs, ... }: { lib, pkgs, ... }:
with lib;
let let
func = pkgs.writeText "func.fish" '' func = pkgs.writeText "func.fish" ''

View file

@ -1,8 +1,4 @@
{ config, lib, pkgs, ... }: { lib, ... }: {
with lib;
{
config = { config = {
programs.fish = { programs.fish = {
enable = true; enable = true;

View file

@ -1,7 +1,4 @@
{ config, lib, pkgs, ... }: { lib, pkgs, ... }:
with lib;
let let
fooPluginSrc = pkgs.writeText "fooPluginSrc" ""; fooPluginSrc = pkgs.writeText "fooPluginSrc" "";

View file

@ -1,7 +1,3 @@
{ config, lib, pkgs, ... }:
with lib;
{ {
imports = [ ../../accounts/email-test-accounts.nix ]; imports = [ ../../accounts/email-test-accounts.nix ];

View file

@ -1,5 +1,3 @@
{ ... }:
{ {
programs = { programs = {
fish.enable = true; fish.enable = true;

View file

@ -1,5 +1,3 @@
{ ... }:
{ {
programs = { programs = {
zsh.enable = true; zsh.enable = true;

View file

@ -1,7 +1,4 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
with lib;
let let
dummy-gnome-shell-extensions = pkgs.runCommand "dummy-package" { } '' dummy-gnome-shell-extensions = pkgs.runCommand "dummy-package" { } ''
mkdir -p $out/share/gnome-shell/extensions/dummy-package mkdir -p $out/share/gnome-shell/extensions/dummy-package
@ -31,7 +28,7 @@ let
"test-extension-uuid" "test-extension-uuid"
]; ];
actualEnabledExtensions = catAttrs "value" actualEnabledExtensions = lib.catAttrs "value"
config.dconf.settings."org/gnome/shell".enabled-extensions.value; config.dconf.settings."org/gnome/shell".enabled-extensions.value;
in { in {
@ -62,8 +59,8 @@ in {
message = "Expected disable-user-extensions to be false."; message = "Expected disable-user-extensions to be false.";
} }
{ {
assertion = assertion = lib.all (e: lib.elem e actualEnabledExtensions)
all (e: elem e actualEnabledExtensions) expectedEnabledExtensions; expectedEnabledExtensions;
message = '' message = ''
Expected enabled-extensions to contain all of: Expected enabled-extensions to contain all of:
${toString expectedEnabledExtensions} ${toString expectedEnabledExtensions}

View file

@ -1,8 +1,4 @@
{ config, lib, pkgs, ... }: { config, ... }: {
with lib;
{
config = { config = {
programs.gpg = { programs.gpg = {
enable = true; enable = true;

View file

@ -1,8 +1,4 @@
{ config, lib, pkgs, ... }: { lib, pkgs, ... }: {
with lib;
{
config = { config = {
programs.kitty = { programs.kitty = {
enable = true; enable = true;

View file

@ -1,7 +1,3 @@
{ config, lib, pkgs, ... }:
with lib;
{ {
config = { config = {
programs.kitty = { programs.kitty = {

View file

@ -1,8 +1,4 @@
{ config, lib, pkgs, ... }: { config, ... }: {
with lib;
{
imports = [ ../../accounts/email-test-accounts.nix ]; imports = [ ../../accounts/email-test-accounts.nix ];
config = { config = {

View file

@ -1,8 +1,4 @@
{ config, lib, pkgs, ... }: { config, ... }: {
with lib;
{
config = { config = {
programs.looking-glass-client = { programs.looking-glass-client = {
enable = true; enable = true;

View file

@ -1,8 +1,4 @@
{ config, lib, ... }: { config, ... }: {
with lib;
{
config = { config = {
programs.looking-glass-client = { programs.looking-glass-client = {
enable = true; enable = true;

View file

@ -1,7 +1,3 @@
{ config, lib, pkgs, ... }:
with lib;
{ {
config = { config = {
programs.man = { programs.man = {

View file

@ -1,7 +1,3 @@
{ config, lib, pkgs, ... }:
with lib;
{ {
config = { config = {
programs.man = { enable = true; }; programs.man = { enable = true; };

View file

@ -1,8 +1,4 @@
{ config, lib, pkgs, ... }: { config, ... }: {
with lib;
{
imports = [ ../../accounts/email-test-accounts.nix ]; imports = [ ../../accounts/email-test-accounts.nix ];
config = { config = {

View file

@ -1,8 +1,4 @@
{ config, lib, pkgs, ... }: { config, ... }: {
with lib;
{
imports = [ ../../accounts/email-test-accounts.nix ]; imports = [ ../../accounts/email-test-accounts.nix ];
config = { config = {

View file

@ -1,5 +1,3 @@
{ ... }:
{ {
home.preferXdgDirectories = true; home.preferXdgDirectories = true;

View file

@ -1,7 +1,3 @@
{ config, lib, pkgs, ... }:
with lib;
{ {
config = { config = {
programs.readline = { programs.readline = {

View file

@ -1,13 +1,9 @@
{ config, lib, pkgs, ... }: { config, lib, ... }: {
with lib;
{
config = { config = {
programs.ssh = { enable = true; }; programs.ssh = { enable = true; };
home.file.assertions.text = builtins.toJSON home.file.assertions.text = builtins.toJSON
(map (a: a.message) (filter (a: !a.assertion) config.assertions)); (map (a: a.message) (lib.filter (a: !a.assertion) config.assertions));
nmt.script = '' nmt.script = ''
assertFileExists home-files/.ssh/config assertFileExists home-files/.ssh/config

View file

@ -1,7 +1,3 @@
{ config, lib, pkgs, ... }:
with lib;
{ {
config = { config = {
programs.ssh = { programs.ssh = {

View file

@ -1,8 +1,4 @@
{ config, lib, pkgs, ... }: { config, lib, ... }: {
with lib;
{
config = { config = {
programs.ssh = { programs.ssh = {
enable = true; enable = true;
@ -25,7 +21,7 @@ with lib;
}; };
home.file.result.text = builtins.toJSON home.file.result.text = builtins.toJSON
(map (a: a.message) (filter (a: !a.assertion) config.assertions)); (map (a: a.message) (lib.filter (a: !a.assertion) config.assertions));
nmt.script = '' nmt.script = ''
assertFileExists home-files/.ssh/config assertFileExists home-files/.ssh/config

View file

@ -1,7 +1,3 @@
{ config, lib, pkgs, ... }:
with lib;
{ {
config = { config = {
programs.ssh = { programs.ssh = {

View file

@ -1,7 +1,3 @@
{ config, lib, pkgs, ... }:
with lib;
{ {
config = { config = {
programs.ssh = { programs.ssh = {

View file

@ -1,7 +1,3 @@
{ config, lib, pkgs, ... }:
with lib;
{ {
config = { config = {
programs.ssh = { programs.ssh = {

View file

@ -1,7 +1,3 @@
{ config, lib, pkgs, ... }:
with lib;
{ {
config = { config = {
programs.ssh = { programs.ssh = {

View file

@ -1,8 +1,4 @@
{ config, lib, pkgs, ... }: { config, lib, ... }: {
with lib;
{
config = { config = {
programs.ssh = { programs.ssh = {
enable = true; enable = true;
@ -12,7 +8,7 @@ with lib;
proxyJump = "jump-host"; proxyJump = "jump-host";
}; };
ordered = hm.dag.entryAfter [ "xyz" ] { port = 1; }; ordered = lib.hm.dag.entryAfter [ "xyz" ] { port = 1; };
xyz = { xyz = {
identityFile = "file"; identityFile = "file";
@ -49,7 +45,7 @@ with lib;
}; };
home.file.assertions.text = builtins.toJSON home.file.assertions.text = builtins.toJSON
(map (a: a.message) (filter (a: !a.assertion) config.assertions)); (map (a: a.message) (lib.filter (a: !a.assertion) config.assertions));
nmt.script = '' nmt.script = ''
assertFileExists home-files/.ssh/config assertFileExists home-files/.ssh/config

View file

@ -1,8 +1,4 @@
{ config, lib, pkgs, ... }: { config, lib, ... }: {
with lib;
{
config = { config = {
programs.ssh = { programs.ssh = {
enable = true; enable = true;
@ -19,7 +15,7 @@ with lib;
}; };
home.file.assertions.text = builtins.toJSON home.file.assertions.text = builtins.toJSON
(map (a: a.message) (filter (a: !a.assertion) config.assertions)); (map (a: a.message) (lib.filter (a: !a.assertion) config.assertions));
nmt.script = '' nmt.script = ''
assertFileExists home-files/.ssh/config assertFileExists home-files/.ssh/config

View file

@ -1,8 +1,4 @@
{ config, lib, pkgs, ... }: { lib, pkgs, ... }: {
with lib;
{
config = { config = {
programs.texlive.enable = true; programs.texlive.enable = true;
@ -14,7 +10,7 @@ with lib;
combine = tpkgs: combine = tpkgs:
pkgs.symlinkJoin { pkgs.symlinkJoin {
name = "dummy-texlive-combine"; name = "dummy-texlive-combine";
paths = attrValues tpkgs; paths = lib.attrValues tpkgs;
}; };
}; };
}) })

View file

@ -1,7 +1,4 @@
{ config, lib, pkgs, ... }: { pkgs, ... }:
with lib;
let let
substituteExpected = path: substituteExpected = path:

View file

@ -1,7 +1,3 @@
{ config, lib, pkgs, ... }:
with lib;
{ {
config = { config = {
programs.tmux = { programs.tmux = {

View file

@ -1,8 +1,4 @@
{ config, lib, pkgs, ... }: { pkgs, ... }: {
with lib;
{
config = { config = {
programs.tmux = { programs.tmux = {
aggressiveResize = true; aggressiveResize = true;

View file

@ -1,7 +1,3 @@
{ config, lib, pkgs, ... }:
with lib;
{ {
config = { config = {
programs.tmux = { programs.tmux = {

View file

@ -1,7 +1,3 @@
{ config, lib, ... }:
with lib;
{ {
config = { config = {
programs.tmux = { enable = false; }; programs.tmux = { enable = false; };

View file

@ -1,7 +1,3 @@
{ config, lib, pkgs, ... }:
with lib;
{ {
config = { config = {
programs.tmux = { programs.tmux = {

View file

@ -1,7 +1,3 @@
{ config, lib, pkgs, ... }:
with lib;
{ {
config = { config = {
programs.tmux = { programs.tmux = {

View file

@ -1,7 +1,3 @@
{ config, lib, pkgs, ... }:
with lib;
{ {
config = { config = {
programs.tmux = { programs.tmux = {

View file

@ -1,7 +1,3 @@
{ config, lib, pkgs, ... }:
with lib;
{ {
config = { config = {
programs.tmux = { programs.tmux = {

View file

@ -1,8 +1,4 @@
{ config, lib, pkgs, ... }: { config, pkgs, ... }: {
with lib;
{
programs.watson = { programs.watson = {
enable = true; enable = true;
package = config.lib.test.mkStubPackage { }; package = config.lib.test.mkStubPackage { };

View file

@ -1,8 +1,4 @@
{ config, lib, pkgs, ... }: { config, pkgs, ... }: {
with lib;
{
programs.watson = { programs.watson = {
enable = true; enable = true;
package = config.lib.test.mkStubPackage { }; package = config.lib.test.mkStubPackage { };

View file

@ -1,8 +1,4 @@
{ config, lib, pkgs, ... }: { config, ... }: {
with lib;
{
config = { config = {
home.stateVersion = "22.11"; home.stateVersion = "22.11";

View file

@ -1,8 +1,4 @@
{ config, lib, pkgs, ... }: { config, ... }: {
with lib;
{
config = { config = {
home.stateVersion = "22.11"; home.stateVersion = "22.11";

View file

@ -1,8 +1,4 @@
{ config, lib, pkgs, ... }: { config, ... }: {
with lib;
{
config = { config = {
home.stateVersion = "22.11"; home.stateVersion = "22.11";

View file

@ -1,8 +1,4 @@
{ config, lib, pkgs, ... }: { config, ... }: {
with lib;
{
config = { config = {
programs.xmobar = { programs.xmobar = {
enable = true; enable = true;

View file

@ -1,5 +1,3 @@
{ ... }:
{ {
services.activitywatch.enable = true; services.activitywatch.enable = true;

View file

@ -1,5 +1,3 @@
{ ... }:
{ {
services.fluidsynth.enable = true; services.fluidsynth.enable = true;
services.fluidsynth.soundService = "pipewire-pulse"; services.fluidsynth.soundService = "pipewire-pulse";

View file

@ -1,5 +1,3 @@
{ ... }:
{ {
imports = [ ./i3-stubs.nix ]; imports = [ ./i3-stubs.nix ];

View file

@ -1,5 +1,3 @@
{ ... }:
{ {
xsession.windowManager.i3 = { xsession.windowManager.i3 = {
enable = true; enable = true;

View file

@ -1,5 +1,3 @@
{ ... }:
{ {
imports = [ ./i3-stubs.nix ]; imports = [ ./i3-stubs.nix ];

View file

@ -1,5 +1,3 @@
{ ... }:
{ {
imports = [ ./i3-stubs.nix ]; imports = [ ./i3-stubs.nix ];

View file

@ -1,5 +1,3 @@
{ ... }:
{ {
imports = [ ./i3-stubs.nix ]; imports = [ ./i3-stubs.nix ];

View file

@ -1,5 +1,3 @@
{ ... }:
{ {
imports = [ ./i3-stubs.nix ]; imports = [ ./i3-stubs.nix ];

View file

@ -1,5 +1,3 @@
{ ... }:
let let
i3 = { i3 = {
ws1 = "1"; ws1 = "1";

View file

@ -1,5 +1,3 @@
{ ... }:
{ {
systemd.user.timers.test-timer = { systemd.user.timers.test-timer = {
Unit = { Description = "A basic test timer"; }; Unit = { Description = "A basic test timer"; };

View file

@ -1,14 +1,9 @@
{ config, lib, pkgs, ... }: { pkgs, ... }:
with lib;
let let
darwinTestApp = pkgs.runCommandLocal "target-darwin-example-app" { } '' darwinTestApp = pkgs.runCommandLocal "target-darwin-example-app" { } ''
mkdir -p $out/Applications mkdir -p $out/Applications
touch $out/Applications/example-app touch $out/Applications/example-app
''; '';
in { in {
config = { config = {
home.packages = [ darwinTestApp ]; home.packages = [ darwinTestApp ];

View file

@ -1,9 +1,6 @@
{ config, lib, pkgs, ... }: { lib, pkgs, ... }:
with lib;
let let
expectedXdgDataDirs = concatStringsSep ":" [ expectedXdgDataDirs = lib.concatStringsSep ":" [
"\${NIX_STATE_DIR:-/nix/var/nix}/profiles/default/share" "\${NIX_STATE_DIR:-/nix/var/nix}/profiles/default/share"
"/home/hm-user/.nix-profile/share" "/home/hm-user/.nix-profile/share"
"/usr/share/ubuntu" "/usr/share/ubuntu"
@ -12,7 +9,6 @@ let
"/var/lib/snapd/desktop" "/var/lib/snapd/desktop"
"/foo" "/foo"
]; ];
in { in {
config = { config = {
targets.genericLinux.enable = true; targets.genericLinux.enable = true;

View file

@ -1,5 +1,3 @@
{ ... }:
{ {
xresources.properties = { }; xresources.properties = { };

View file

@ -1,5 +1,3 @@
{ ... }:
{ {
xresources = { xresources = {
properties = { properties = {

View file

@ -1,8 +1,6 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
with lib;
let let
inherit (lib) mkOption types;
stubType = types.submodule ({ name, ... }: { stubType = types.submodule ({ name, ... }: {
options = { options = {
@ -15,13 +13,13 @@ let
outPath = mkOption { outPath = mkOption {
type = types.nullOr types.str; type = types.nullOr types.str;
default = "@${name}@"; default = "@${name}@";
defaultText = literalExpression ''"@''${name}@"''; defaultText = lib.literalExpression ''"@''${name}@"'';
}; };
version = mkOption { version = mkOption {
type = types.nullOr types.str; type = types.nullOr types.str;
default = null; default = null;
defaultText = literalExpression "pkgs.\${name}.version or null"; defaultText = lib.literalExpression "pkgs.\${name}.version or null";
}; };
buildScript = mkOption { buildScript = mkOption {
@ -52,7 +50,7 @@ let
meta.mainProgram = name; meta.mainProgram = name;
} buildScript; } buildScript;
stubbedPkg = pkg // optionalAttrs (outPath != null) { stubbedPkg = pkg // lib.optionalAttrs (outPath != null) {
inherit outPath; inherit outPath;
# Prevent getOutput from descending into outputs # Prevent getOutput from descending into outputs
@ -63,7 +61,8 @@ let
buildHost = pkg; buildHost = pkg;
hostTarget = pkg; hostTarget = pkg;
}; };
} // optionalAttrs (version != null) { inherit version; } // extraAttrs; } // lib.optionalAttrs (version != null) { inherit version; }
// extraAttrs;
in stubbedPkg; in stubbedPkg;
in { in {
@ -90,10 +89,11 @@ in {
config = { config = {
lib.test.mkStubPackage = mkStubPackage; lib.test.mkStubPackage = mkStubPackage;
test.stubOverlays = [ ] ++ optional (config.test.stubs != { }) (self: super: test.stubOverlays = [ ] ++ lib.optional (config.test.stubs != { })
mapAttrs (n: v: (self: super:
lib.mapAttrs (n: v:
builtins.traceVerbose "${n} - stubbed" (mkStubPackage (v builtins.traceVerbose "${n} - stubbed" (mkStubPackage (v
// optionalAttrs (v.version == null) { // lib.optionalAttrs (v.version == null) {
version = super.${n}.version or null; version = super.${n}.version or null;
}))) config.test.stubs) ++ config.test.unstubs; }))) config.test.stubs) ++ config.test.unstubs;
}; };