mirror of
https://github.com/nix-community/home-manager.git
synced 2025-03-10 18:57:22 +00:00
Instead of having to manually stub packages that should not be downloaded we instead automatically stub all packages (except a small list of whitelisted ones). Tests can re-introduce the real package by using the `realPkgs` module argument.
36 lines
873 B
Nix
36 lines
873 B
Nix
modulePath:
|
|
{ config, lib, realPkgs, ... }:
|
|
|
|
let
|
|
|
|
cfg = lib.getAttrFromPath modulePath config;
|
|
|
|
in {
|
|
test.stubs = let unwrappedName = "${cfg.wrappedPackageName}-unwrapped";
|
|
in {
|
|
"${unwrappedName}" = {
|
|
name = unwrappedName;
|
|
extraAttrs = {
|
|
binaryName = cfg.wrappedPackageName;
|
|
gtk3 = null;
|
|
meta.description = "I pretend to be ${cfg.name}";
|
|
};
|
|
outPath = null;
|
|
buildScript = ''
|
|
echo BUILD
|
|
mkdir -p "$out"/{bin,lib}
|
|
touch "$out/bin/${cfg.wrappedPackageName}"
|
|
chmod 755 "$out/bin/${cfg.wrappedPackageName}"
|
|
'';
|
|
};
|
|
|
|
chrome-gnome-shell = {
|
|
buildScript = ''
|
|
mkdir -p $out/lib/mozilla/native-messaging-hosts
|
|
touch $out/lib/mozilla/native-messaging-hosts/dummy
|
|
'';
|
|
};
|
|
};
|
|
|
|
nixpkgs.overlays = [ (_: _: { inherit (realPkgs) mozlz4a; }) ];
|
|
}
|