tests: reduce closure sizes

This commit is contained in:
Robert Helgesson 2024-02-03 19:39:45 +01:00 committed by GitHub
parent 880d9bc211
commit 1ca210648a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 98 additions and 64 deletions

View file

@ -18,6 +18,21 @@
fcitx5-qt = { outPath = null; }; fcitx5-qt = { outPath = null; };
fcitx5-gtk = { outPath = null; }; fcitx5-gtk = { outPath = null; };
fcitx5-chinese-addons = { outPath = null; }; fcitx5-chinese-addons = { outPath = null; };
gtk2 = {
buildScript = ''
mkdir -p $out/bin
echo '#/usr/bin/env bash' > $out/bin/gtk-query-immodules-2.0
chmod +x $out/bin/*
'';
};
gtk3 = {
buildScript = ''
mkdir -p $out/bin
echo '#/usr/bin/env bash' > $out/bin/gtk-query-immodules-3.0
chmod +x $out/bin/*
'';
};
}; };
nixpkgs.overlays = [ nixpkgs.overlays = [

View file

@ -11,10 +11,14 @@
programs.beets = { programs.beets = {
enable = true; enable = true;
package = config.lib.test.mkStubPackage { outPath = "@beets@"; };
mpdIntegration.enableStats = true; mpdIntegration.enableStats = true;
}; };
test.stubs = {
beets = { };
mpd = { };
};
nmt.script = '' nmt.script = ''
assertFileExists home-files/.config/beets/config.yaml assertFileExists home-files/.config/beets/config.yaml
assertFileContent \ assertFileContent \

View file

@ -1,55 +1,51 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
{ {
config = { imports = [ ./mpv-stubs.nix ];
programs.mpv = {
enable = true;
package = pkgs.mpvDummy;
bindings = { programs.mpv = {
WHEEL_UP = "seek 10"; enable = true;
WHEEL_DOWN = "seek -10";
"Alt+0" = "set window-scale 0.5";
};
config = { bindings = {
force-window = true; WHEEL_UP = "seek 10";
ytdl-format = "bestvideo+bestaudio"; WHEEL_DOWN = "seek -10";
cache-default = 4000000; "Alt+0" = "set window-scale 0.5";
};
scriptOpts = {
osc = {
scalewindowed = 2.0;
vidscale = false;
visibility = "always";
};
};
profiles = {
fast = { vo = "vdpau"; };
"protocol.dvd" = {
profile-desc = "profile for dvd:// streams";
alang = "en";
};
};
defaultProfiles = [ "gpu-hq" ];
}; };
test.stubs.mpvDummy = { }; config = {
force-window = true;
ytdl-format = "bestvideo+bestaudio";
cache-default = 4000000;
};
nmt.script = '' scriptOpts = {
assertFileContent \ osc = {
home-files/.config/mpv/mpv.conf \ scalewindowed = 2.0;
${./mpv-example-settings-expected-config} vidscale = false;
assertFileContent \ visibility = "always";
home-files/.config/mpv/input.conf \ };
${./mpv-example-settings-expected-bindings} };
assertFileContent \
home-files/.config/mpv/script-opts/osc.conf \ profiles = {
${./mpv-example-settings-expected-osc-opts} fast = { vo = "vdpau"; };
''; "protocol.dvd" = {
profile-desc = "profile for dvd:// streams";
alang = "en";
};
};
defaultProfiles = [ "gpu-hq" ];
}; };
nmt.script = ''
assertFileContent \
home-files/.config/mpv/mpv.conf \
${./mpv-example-settings-expected-config}
assertFileContent \
home-files/.config/mpv/input.conf \
${./mpv-example-settings-expected-bindings}
assertFileContent \
home-files/.config/mpv/script-opts/osc.conf \
${./mpv-example-settings-expected-osc-opts}
'';
} }

View file

@ -1,25 +1,16 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
{ {
config = { imports = [ ./mpv-stubs.nix ];
programs.mpv = {
enable = true;
package = pkgs.mpvDummy;
scripts = [ pkgs.mpvScript ];
};
nixpkgs.overlays = [ programs.mpv = {
(self: super: { enable = true;
mpvScript = package = pkgs.emptyDirectory;
pkgs.runCommandLocal "mpvScript" { scriptName = "something"; } scripts = [ pkgs.mpvScript ];
"mkdir $out";
})
];
test.stubs.mpvDummy = { };
test.asserts.assertions.expected = [
''
The programs.mpv "package" option is mutually exclusive with "scripts" option.''
];
}; };
test.asserts.assertions.expected = [
''
The programs.mpv "package" option is mutually exclusive with "scripts" option.''
];
} }

View file

@ -0,0 +1,28 @@
{ pkgs, ... }:
{
nixpkgs.overlays = [
(self: super: {
mpvScript = pkgs.runCommandLocal "mpvScript" { scriptName = "something"; }
"mkdir $out";
mpv-unwrapped = super.mpv-unwrapped.overrideAttrs {
builder = pkgs.writeShellScript "dummy" ''
PATH=${pkgs.coreutils}/bin
mkdir -p $dev $man $out/bin $out/Applications/mpv.app/Contents/MacOS
touch $out/bin/{mpv,umpv} \
$out/Applications/mpv.app/Contents/MacOS/{mpv,mpv-bundle}
chmod +x $out/bin/{mpv,umpv} \
$out/Applications/mpv.app/Contents/MacOS/{mpv,mpv-bundle}
'';
};
lua = pkgs.emptyDirectory.overrideAttrs {
luaversion = "0";
withPackages = ps: pkgs.emptyDirectory;
};
})
];
test.stubs = { yt-dlp = { }; };
}