diff --git a/nix-os/core.nix b/nix-os/core.nix index 30d4c7e..53eaab8 100644 --- a/nix-os/core.nix +++ b/nix-os/core.nix @@ -5,23 +5,7 @@ { inputs, lib, pkgs, ... }: let - /* - * 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 - ''; - } - ); + inherit (pkgs) mkWrappedExecutable; # bool -> nixpkgs[] wrappedNixExecutables = inEnvironment: assert builtins.isBool inEnvironment; [ diff --git a/pkgs/by-name/mk/mkWrappedExecutable/package.nix b/pkgs/by-name/mk/mkWrappedExecutable/package.nix new file mode 100644 index 0000000..039b6f4 --- /dev/null +++ b/pkgs/by-name/mk/mkWrappedExecutable/package.nix @@ -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 + ''; +})