Skip to content

Commit

Permalink
I must enjoy torturing myself
Browse files Browse the repository at this point in the history
  • Loading branch information
nicball committed Apr 18, 2024
1 parent c4aa9cc commit 8d1870a
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 31 deletions.
1 change: 0 additions & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@

mypkgs = ps: builtins.intersectAttrs (overlay 42 42) ps;


addEverything = system: pkgs: ps: ps // {
everything =
let
Expand Down
2 changes: 1 addition & 1 deletion pkgs/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ self: super:

transfersh = self.callPackage ./transfersh.nix {};

inherit ((self.callPackages ./wrap-derivation-output.nix { inherit self; }).fns)
inherit (self.callPackages ./wrap-derivation-output.nix { inherit self; })
modifyDerivationOutput
wrapDerivationOutput;

Expand Down
56 changes: 27 additions & 29 deletions pkgs/wrap-derivation-output.nix
Original file line number Diff line number Diff line change
Expand Up @@ -14,34 +14,32 @@ let
in

{
fns = {
modifyDerivationOutput =
drv:
{ buildInputs ? []
, nativeBuildInputs ? []
, extraCommands
, ...
}@args:
stdenv.mkDerivation (getDerivationName args // {
inherit buildInputs nativeBuildInputs;
dontUnpack = true;
installPhase = ''
runHook preInstall
mkdir $out
${lndir}/bin/lndir -silent ${drv} $out
${extraCommands}
runHook postInstall
'';
meta.platforms = drv.meta.platforms;
});
modifyDerivationOutput =
drv:
{ buildInputs ? []
, nativeBuildInputs ? []
, extraCommands
, ...
}@args:
stdenv.mkDerivation (getDerivationName args // {
inherit buildInputs nativeBuildInputs;
dontUnpack = true;
installPhase = ''
runHook preInstall
mkdir $out
${lndir}/bin/lndir -silent ${drv} $out
${extraCommands}
runHook postInstall
'';
meta.platforms = drv.meta.platforms;
});

wrapDerivationOutput = drv: path: args:
self.modifyDerivationOutput drv (getDerivationName drv // {
nativeBuildInputs = [ makeWrapper ];
extraCommands = ''
mv $out/${path} $out/${path}-unwrapped
makeWrapper $out/${path}-unwrapped $out/${path} ${args}
'';
});
};
wrapDerivationOutput = drv: path: args:
self.modifyDerivationOutput drv (getDerivationName drv // {
nativeBuildInputs = [ makeWrapper ];
extraCommands = ''
mv $out/${path} $out/${path}-unwrapped
makeWrapper $out/${path}-unwrapped $out/${path} ${args}
'';
});
}

0 comments on commit 8d1870a

Please sign in to comment.