1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-12-24 02:39:48 +01:00

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/bottom
./modules/programs/broot
./modules/programs/browserpass
./modules/programs/btop
./modules/programs/dircolors
./modules/programs/direnv
@ -157,6 +156,7 @@ import nmt {
./modules/programs/autorandr
./modules/programs/beets # One test relies on services.mpd
./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/foot
./modules/programs/fuzzel

View file

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