tests/stubs: inherit default versions from pkgs (#4069)

* tests/stubs: inherit default versions from pkgs

* tests/browserpass: temporarily disable on darwin

The package currently fails to evaluate on darwin due to a nixpkgs
problem: https://github.com/NixOS/nixpkgs/pull/236258#issuecomment-1583450593
This commit is contained in:
Naïm Favier 2023-06-09 00:59:06 +02:00 committed by GitHub
parent f889ec0ec3
commit 69bdd6de50
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 4 deletions

View file

@ -64,7 +64,6 @@ import nmt {
./modules/programs/bat ./modules/programs/bat
./modules/programs/bottom ./modules/programs/bottom
./modules/programs/broot ./modules/programs/broot
./modules/programs/browserpass
./modules/programs/btop ./modules/programs/btop
./modules/programs/dircolors ./modules/programs/dircolors
./modules/programs/direnv ./modules/programs/direnv
@ -157,6 +156,7 @@ import nmt {
./modules/programs/autorandr ./modules/programs/autorandr
./modules/programs/beets # One test relies on services.mpd ./modules/programs/beets # One test relies on services.mpd
./modules/programs/borgmatic ./modules/programs/borgmatic
./modules/programs/browserpass # TODO re-enable on Darwin when https://github.com/NixOS/nixpkgs/pull/236258#issuecomment-1583450593 is fixed
./modules/programs/firefox ./modules/programs/firefox
./modules/programs/foot ./modules/programs/foot
./modules/programs/fuzzel ./modules/programs/fuzzel

View file

@ -15,12 +15,13 @@ let
outPath = mkOption { outPath = mkOption {
type = types.nullOr types.str; type = types.nullOr types.str;
default = "@${name}@"; default = "@${name}@";
defaultText = "@\${name}@"; defaultText = 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";
}; };
buildScript = mkOption { buildScript = mkOption {
@ -65,7 +66,12 @@ in {
config = { config = {
lib.test.mkStubPackage = mkStubPackage; lib.test.mkStubPackage = mkStubPackage;
nixpkgs.overlays = mkIf (config.test.stubs != { }) nixpkgs.overlays = mkIf (config.test.stubs != { }) [
[ (self: super: mapAttrs (n: mkStubPackage) config.test.stubs) ]; (self: super:
mapAttrs (n: v:
mkStubPackage (v // optionalAttrs (v.version == null) {
version = super.${n}.version or null;
})) config.test.stubs)
];
}; };
} }