mirror of
https://github.com/foo-dogsquared/nixos-config.git
synced 2025-02-07 12:19:07 +00:00
wrapper-manager-fds/modules: change basePackages to accept a bare package
This will allow us to make changes to `programs.<name>.package`-type of options found in NixOS, home-manager, etc. but it is expensive at the cost of a rebuild which depends on the package.
This commit is contained in:
parent
d69e61f2a8
commit
7009462c3c
@ -196,14 +196,18 @@ in
|
|||||||
};
|
};
|
||||||
|
|
||||||
basePackages = lib.mkOption {
|
basePackages = lib.mkOption {
|
||||||
type = with lib.types; listOf package;
|
type = with lib.types; either package (listOf package);
|
||||||
description = ''
|
description = ''
|
||||||
A list of packages to be included in the wrapper package.
|
Packages to be included in the wrapper package. However, there are
|
||||||
|
differences in behavior when given certain values.
|
||||||
|
|
||||||
::: {.note}
|
* When the value is a bare package, the build process will use
|
||||||
This can override some of the binaries included in this list which is
|
`$PACKAGE.overrideAttrs` to create the package. This makes it suitable
|
||||||
typically intended to be used as a wrapped package.
|
to be used as part of `programs.<name>.package` typically found on
|
||||||
:::
|
other environments (e.g., NixOS).
|
||||||
|
|
||||||
|
* When the value is a list of packages, the build process will use
|
||||||
|
`symlinkJoin` as the builder to create the derivation.
|
||||||
'';
|
'';
|
||||||
default = [ ];
|
default = [ ];
|
||||||
example = lib.literalExpression ''
|
example = lib.literalExpression ''
|
||||||
|
@ -63,6 +63,7 @@
|
|||||||
|
|
||||||
desktopEntries = mkDesktopEntries (lib.attrValues config.xdg.desktopEntries);
|
desktopEntries = mkDesktopEntries (lib.attrValues config.xdg.desktopEntries);
|
||||||
in
|
in
|
||||||
|
if lib.isList config.basePackages then
|
||||||
pkgs.symlinkJoin {
|
pkgs.symlinkJoin {
|
||||||
passthru = config.build.extraPassthru;
|
passthru = config.build.extraPassthru;
|
||||||
name = "wrapper-manager-fds-wrapped-package";
|
name = "wrapper-manager-fds-wrapped-package";
|
||||||
@ -73,7 +74,22 @@
|
|||||||
${config.build.extraSetup}
|
${config.build.extraSetup}
|
||||||
${mkWrapBuild (lib.attrValues config.wrappers)}
|
${mkWrapBuild (lib.attrValues config.wrappers)}
|
||||||
'';
|
'';
|
||||||
};
|
}
|
||||||
|
else
|
||||||
|
config.basePackages.overrideAttrs (final: prev: {
|
||||||
|
nativeBuildInputs =
|
||||||
|
(prev.nativeBuildInputs or [ ])
|
||||||
|
++ (if config.build.isBinary then [ pkgs.makeBinaryWrapper ] else [ pkgs.makeWrapper ])
|
||||||
|
++ lib.optionals (config.xdg.desktopEntries != { }) [ pkgs.copyDesktopItems ];
|
||||||
|
desktopItems = (prev.desktopItems or [ ]) ++ desktopEntries;
|
||||||
|
postFixup = ''
|
||||||
|
${prev.postFixup or ""}
|
||||||
|
${mkWrapBuild (lib.attrValues config.wrappers)}
|
||||||
|
'';
|
||||||
|
passthru = lib.recursiveUpdate (prev.passthru or { }) (config.build.extraPassthru // {
|
||||||
|
unwrapped = config.basePackages;
|
||||||
|
});
|
||||||
|
});
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -12,4 +12,5 @@ in
|
|||||||
{
|
{
|
||||||
fastfetch = build [ ./wrapper-fastfetch.nix ];
|
fastfetch = build [ ./wrapper-fastfetch.nix ];
|
||||||
neofetch = build [ ./wrapper-neofetch.nix ];
|
neofetch = build [ ./wrapper-neofetch.nix ];
|
||||||
|
single-basepackage = build [ ./single-basepackage.nix ];
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,25 @@
|
|||||||
|
{ config, lib, pkgs, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
basePackages = pkgs.fastfetch;
|
||||||
|
|
||||||
|
wrappers.fastfetch-guix = {
|
||||||
|
arg0 = lib.getExe' pkgs.fastfetch "fastfetch";
|
||||||
|
appendArgs = [
|
||||||
|
"--logo"
|
||||||
|
"Guix"
|
||||||
|
];
|
||||||
|
env.NO_COLOR.value = "1";
|
||||||
|
xdg.desktopEntry.enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
build.extraPassthru.tests = {
|
||||||
|
singleBasePackage =
|
||||||
|
let
|
||||||
|
wrapper = config.build.toplevel;
|
||||||
|
in
|
||||||
|
pkgs.runCommand "wrapper-manager-fastfetch-actually-built" { } ''
|
||||||
|
[ -e "${wrapper}/share/applications/fastfetch-guix.desktop" ] && [ -x "${wrapper}/bin/${config.wrappers.fastfetch-guix.executableName}" ] && touch $out
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user