haskellPackages.hledger*: unify and simplify overrides

Turns out we can use the same code to install man pages for all hledger
related packages, since hledger also has the top level man pages.
Verified that the contents of $out/share are the same before and after.
This commit is contained in:
sternenseemann 2023-06-08 16:45:11 +02:00
parent cb7ccdccd7
commit 615b6cad64

View File

@ -1047,52 +1047,45 @@ self: super: {
# jailbreak tasty < 1.2 until servant-docs > 0.11.3 is on hackage.
snap-templates = doJailbreak super.snap-templates; # https://github.com/snapframework/snap-templates/issues/22
# Copy hledger man pages from data directory into the proper place. This code
# should be moved into the cabal2nix generator.
hledger = overrideCabal (drv: {
postInstall = ''
# Don't install files that don't belong into this package to avoid
# conflicts when hledger and hledger-ui end up in the same profile.
rm embeddedfiles/hledger-{api,ui,web}.*
for i in $(seq 1 9); do
for j in embeddedfiles/*.$i; do
mkdir -p $out/share/man/man$i
cp -v $j $out/share/man/man$i/
done
done
mkdir -p $out/share/info
cp -v embeddedfiles/*.info* $out/share/info/
'';
}) super.hledger;
inherit (
let
# Copy hledger man pages from the source traball into the proper place.
# It always contains the relevant man page(s) at the top level. For
# hledger it additionally has all the other man pages in embeddedfiles/
# which we ignore.
installHledgerManPages = overrideCabal (drv: {
postInstall = ''
for i in $(seq 1 9); do
for j in *.$i; do
mkdir -p $out/share/man/man$i
cp -v $j $out/share/man/man$i/
done
done
mkdir -p $out/share/info
cp -v *.info* $out/share/info/
'';
});
hledgerWebTestFix = overrideCabal (drv: {
preCheck = ''
${drv.preCheck or ""}
export HOME="$(mktemp -d)"
'';
});
in
{
hledger = installHledgerManPages super.hledger;
hledger-web = installHledgerManPages (hledgerWebTestFix super.hledger-web);
hledger-ui = installHledgerManPages super.hledger-ui;
}
) hledger
hledger-web
hledger-ui
;
hledger_1_30_1 = doDistribute (super.hledger_1_30_1.override {
hledger-lib = self.hledger-lib_1_30;
});
hledger-ui = overrideCabal (drv: {
postInstall = ''
for i in $(seq 1 9); do
for j in *.$i; do
mkdir -p $out/share/man/man$i
cp -v $j $out/share/man/man$i/
done
done
mkdir -p $out/share/info
cp -v *.info* $out/share/info/
'';
}) super.hledger-ui;
hledger-web = overrideCabal (drv: {
preCheck = "export HOME=$TMPDIR";
postInstall = ''
for i in $(seq 1 9); do
for j in *.$i; do
mkdir -p $out/share/man/man$i
cp -v $j $out/share/man/man$i/
done
done
mkdir -p $out/share/info
cp -v *.info* $out/share/info/
'';
}) super.hledger-web;
# https://github.com/haskell-hvr/resolv/pull/6
resolv_0_1_1_2 = dontCheck super.resolv_0_1_1_2;