pkgs/mkWrappedExecutable: factor out to its own package
This commit is contained in:
parent
6e76c7422a
commit
8c1eb9dec3
2 changed files with 23 additions and 17 deletions
|
@ -5,23 +5,7 @@
|
||||||
{ inputs, lib, pkgs, ... }:
|
{ inputs, lib, pkgs, ... }:
|
||||||
|
|
||||||
let
|
let
|
||||||
/*
|
inherit (pkgs) mkWrappedExecutable;
|
||||||
* pkg: package - nixpkgs package
|
|
||||||
* exe: string - executable (under bin) in pkgs
|
|
||||||
* wrapperArgs: string[] - arguments to pass to the wrapper
|
|
||||||
*/
|
|
||||||
mkWrappedExecutable = {pkg, exe ? pkg.meta.mainProgram, wrapperArgs}: let inherit (pkgs) lib makeWrapper; in lib.hiPrio (
|
|
||||||
pkgs.stdenv.mkDerivation {
|
|
||||||
inherit wrapperArgs;
|
|
||||||
name = "${pkg.name}-wrap-${exe}";
|
|
||||||
nativeBuildInputs = [ makeWrapper ];
|
|
||||||
phases = ["installPhase"];
|
|
||||||
installPhase = ''
|
|
||||||
mkdir -p $out/bin
|
|
||||||
makeWrapper ${pkg}/bin/${exe} $out/bin/${exe} $wrapperArgs
|
|
||||||
'';
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
# bool -> nixpkgs[]
|
# bool -> nixpkgs[]
|
||||||
wrappedNixExecutables = inEnvironment: assert builtins.isBool inEnvironment; [
|
wrappedNixExecutables = inEnvironment: assert builtins.isBool inEnvironment; [
|
||||||
|
|
22
pkgs/by-name/mk/mkWrappedExecutable/package.nix
Normal file
22
pkgs/by-name/mk/mkWrappedExecutable/package.nix
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
{
|
||||||
|
lib,
|
||||||
|
makeWrapper,
|
||||||
|
stdenv
|
||||||
|
}:
|
||||||
|
|
||||||
|
/*
|
||||||
|
pkg: package - nixpkgs package
|
||||||
|
exe: string - executable (under bin) in pkg
|
||||||
|
wrapperArgs: string[] - arguments to pass to the wrapper
|
||||||
|
*/
|
||||||
|
{ pkg, exe ? pkg.meta.mainProgram, wrapperArgs }:
|
||||||
|
lib.hiPrio (stdenv.mkDerivation {
|
||||||
|
inherit wrapperArgs;
|
||||||
|
name = "${pkg.name}-wrap-${exe}";
|
||||||
|
nativeBuildInputs = [ makeWrapper ];
|
||||||
|
phases = ["installPhase"];
|
||||||
|
installPhase = ''
|
||||||
|
mkdir -p $out/bin
|
||||||
|
makeWrapper ${pkg}/bin/${exe} $out/bin/${exe} $wrapperArgs
|
||||||
|
'';
|
||||||
|
})
|
Loading…
Reference in a new issue