pandoc: remove GHC from the runtime closure (2.4GB -> 180MB)

Also moves the overrides to its own file before we clutter
all-packages.nix any further.

Comparison of the runtime closure:

Before:

[{'path': b'/nix/store/mxaxvp33wg9sim8qh2kkw041v492bvxj-libunistring-0.9.10',
  'size': '1,634,416'},
 {'path': b'/nix/store/hjng28vbd73qq9iz9j8r397x19aa8fp9-libidn2-2.3.0',
  'size': '222,672'},
 {'path': b'/nix/store/6m2k8kx8h216jlx9dg3lp4m90bz05yck-glibc-2.30',
  'size': '31,082,264'},
 {'path': b'/nix/store/0infa8sv151a1j6zz6lizbpmwv4ksh67-gcc-9.2.0-lib',
  'size': '6,284,904'},
 {'path': b'/nix/store/9si14qjcz8072c0v42zbkglq08s2cg04-bash-4.4-p23',
  'size': '1,325,208'},
 {'path': b'/nix/store/bnqfi6ycx6khjfmyyz0wvdgaq4k5p8wv-ghc-8.6.5-doc',
  'size': '264,802,472'},
 {'path': b'/nix/store/8xhn1y70dbvc5sqxaxvbgc5nqdiahyb2-hashable-1.2.7.0-doc',
  'size': '902,800'},
 {'path': b'/nix/store/cikknfzlf88qj0fi5m7r547biyji0vnw-primitive-0.6.4.0-doc',
  'size': '4,520,392'},
 {'path': b'/nix/store/drbcz1f6qfas7r8fsb6qriafzypah1kd-integer-logarithms-1'
          b'.0.3-doc',
  'size': '354,280'},
 {'path': b'/nix/store/idk0kl0xg7kmzri5d9bfz4h32ycbz1bw-scientific-0.3.6.2-doc',
  'size': '925,408'},
 {'path': b'/nix/store/0qxwawz8fc3nz59n07scgh1b3l68ifwf-attoparsec-0.13.2.3-'
          b'doc',
  'size': '3,234,760'},
 {'path': b'/nix/store/6wfnl0kvgz9r1z8wp53ildc2hgsysybl-libffi-3.3',
  'size': '56,728'},
 {'path': b'/nix/store/d38akrx7lljl6pl5gqdxcsmf57k9w08v-gmp-6.2.0',
  'size': '751,936'},
 {'path': b'/nix/store/fv7c5dxd6cq0w2yl21rpsgmwra87h7x5-ncurses-6.1-20190112',
  'size': '3,556,472'},
 {'path': b'/nix/store/m0w464nw8ry965np116v3zi0azhcr2ql-attr-2.4.48',
  'size': '89,136'},
 {'path': b'/nix/store/fv2g7kwbr8a609rzq56fv8lm5h1brwxd-acl-2.2.53',
  'size': '109,920'},
 {'path': b'/nix/store/bgvd279hrb53i3ah2mi0nf8jp6g6g6g9-coreutils-8.31',
  'size': '1,839,848'},
 {'path': b'/nix/store/6hhxlbabm7xxdfdw9mbxb8llh63k1bxx-linux-headers-4.19.16',
  'size': '4,960,528'},
 {'path': b'/nix/store/v235kcs9jfd5vw9d1ylwilqvf49dyjhg-glibc-2.30-bin',
  'size': '2,750,608'},
 {'path': b'/nix/store/c9l946swbx2v67mwamd3vrypha4l9nz0-glibc-2.30-dev',
  'size': '2,479,160'},
 {'path': b'/nix/store/qvgf4g9c5h3wzq4xjy566vc0pqgc9fjq-zlib-1.2.11',
  'size': '124,336'},
 {'path': b'/nix/store/pbfnvqlf8bgp09gy601554ph83y4qzp5-gcc-9.2.0',
  'size': '143,309,504'},
 {'path': b'/nix/store/nyhj00w339gk2gaj3faz70gjrnbmam8v-binutils-2.31.1',
  'size': '33,502,640'},
 {'path': b'/nix/store/yrrr7hwcmlr11cl61rjmclp9wrrb92iy-expand-response-params',
  'size': '17,368'},
 {'path': b'/nix/store/sh8l6la5mv29girlgswnd23s0vfpcfdn-binutils-wrapper-2.3'
          b'1.1',
  'size': '37,992'},
 {'path': b'/nix/store/i5k2ibiprmks1bddmjm12fgi30maldzf-pcre-8.43',
  'size': '497,632'},
 {'path': b'/nix/store/sjvvyjp67sssnpl0k0g5ysmcm8xscwp4-gnugrep-3.4',
  'size': '802,368'},
 {'path': b'/nix/store/1v0410l20p343l6cvpijz8bi4if2ysh6-gcc-wrapper-9.2.0',
  'size': '41,392'},
 {'path': b'/nix/store/m0cjgyzlz31s85kl92vgcggsdvb9svcj-libffi-3.3-dev',
  'size': '20,296'},
 {'path': b'/nix/store/qfmbizy1jv469c1cjfv2vx5h9mdmqapc-gmp-6.2.0-dev',
  'size': '215,640'},
 {'path': b'/nix/store/yvmfc6lcsljxb8mdpaz63yl1j0z2zzm2-perl-5.30.1',
  'size': '53,237,064'},
 {'path': b'/nix/store/hz3nwwc0k32ygvjn63gw8gm0nf9gprd8-ghc-8.6.5',
  'size': '1,479,053,416'},
 {'path': b'/nix/store/6dva17vynqmcib4zjiwn2wqm3nalwks0-integer-logarithms-1'
          b'.0.3',
  'size': '623,632'},
 {'path': b'/nix/store/akabgy94c61fnazi0qag5jsj8ysc5y0p-primitive-0.6.4.0',
  'size': '9,668,344'},
 {'path': b'/nix/store/m2ba7a3d39g0qqr3xd80wgbli555n9q6-hashable-1.2.7.0',
  'size': '2,462,152'},
 {'path': b'/nix/store/bas2z2zbc24namg1b81kb7cg8x6d6fiw-scientific-0.3.6.2',
  'size': '3,125,400'},
 {'path': b'/nix/store/0plyy7kq8nxkmv9zi4glgfkcmlz255zl-attoparsec-0.13.2.3',
  'size': '16,785,040'},
 {'path': b'/nix/store/amya73lz4zziz1zgzb4fvb5b2mn27g8m-random-1.1-doc',
  'size': '567,288'},
 {'path': b'/nix/store/2n12ini2shm6s7l59ghw98qz198qlnxk-splitmix-0.0.3-doc',
  'size': '439,144'},
 {'path': b'/nix/store/i5l69z2c0fa4rfkcjjz5bh1ygj3gv742-vector-0.12.1.2-doc',
  'size': '17,714,256'},
 {'path': b'/nix/store/2na544033hzy4dv5vdy6g48wfzb2ggy2-vector-0.12.1.2',
  'size': '47,636,440'},
 {'path': b'/nix/store/2yjdlxxhzdi05jcpv8i8dcg8dvg2ms5l-readline-6.3p08',
  'size': '391,888'},
 {'path': b'/nix/store/ra9ccq229ni22zbxcw3spyjzxxriiraa-network-uri-2.6.2.0-'
          b'doc',
  'size': '919,848'},
 {'path': b'/nix/store/3jibbksnd12zj2vkvnm0alp89ax6cfp8-network-uri-2.6.2.0',
  'size': '4,475,984'},
 {'path': b'/nix/store/cbl6ryhcwbmmqcqmn3g05l5vwsqq7lhh-syb-0.7.1-doc',
  'size': '1,077,416'},
 {'path': b'/nix/store/iwdppd7ffrx6sbnrx968g3p8s9siixvq-QuickCheck-2.13.2-doc',
  'size': '5,510,272'},
 {'path': b'/nix/store/8iqwq1m1lc44n23f44rfzvq879crgsd8-unordered-containers'
          b'-0.2.10.0-doc',
  'size': '2,505,120'},
 {'path': b'/nix/store/cwgsw7fmsl32z4wwg4wmb8r4i9cqi7ax-base-compat-0.10.5-doc',
  'size': '3,928,200'},
 {'path': b'/nix/store/dfs4nsfcmvrqb4pfs528mcbx7p6h8rd9-dlist-0.8.0.7-doc',
  'size': '287,408'},
 {'path': b'/nix/store/fmj6pfcrz6gwpd5ikrhv3sv1lvhzdnkr-tagged-0.8.6-doc',
  'size': '585,768'},
 {'path': b'/nix/store/fq7gnr6x16s36yyq3ijzg705frg04dsy-th-abstraction-0.3.1'
          b'.0-doc',
  'size': '1,423,760'},
 {'path': b'/nix/store/qhbh3dj2b9rx7xplp5fz48fpa05rcws1-uuid-types-1.0.3-doc',
  'size': '495,104'},
 {'path': b'/nix/store/cmx2kqns3vy0xlpfwbnxfz4br4a050yv-base-orphans-0.8.2-doc',
  'size': '1,109,168'},
 {'path': b'/nix/store/wj6r2pm4vsbqm17fmcnz3mm8iam9myc8-time-compat-1.9.2.2-'
          b'doc',
  'size': '1,879,624'},
 {'path': b'/nix/store/v0w0r8idgapbna2qjb6g2k2k16qfqz0d-aeson-1.4.6.0-doc',
  'size': '8,699,624'},
 {'path': b'/nix/store/3zsd0wqy8c3x9nvja8bhs8r10y4wl1p1-pandoc-types-1.17.6.'
          b'1-doc',
  'size': '2,551,784'},
 {'path': b'/nix/store/4857x32hdkrrd2iqsn2m5d95xaj1s4p8-network-2.8.0.1-doc',
  'size': '2,117,320'},
 {'path': b'/nix/store/7qn29l7gyvnfc0pvxsmqr7nvkpw0ndn1-tagged-0.8.6',
  'size': '1,883,152'},
 {'path': b'/nix/store/84i7995b3md52k9xvys2jdq7pmyrxckv-unordered-containers'
          b'-0.2.10.0',
  'size': '6,878,528'},
 {'path': b'/nix/store/ankhr2045qag4g0jb14p2z5mjqp7mdpn-base-orphans-0.8.2',
  'size': '1,619,536'},
 {'path': b'/nix/store/cjqcam9fp4bkbz5c2scgpgrywzny8h2k-dlist-0.8.0.7',
  'size': '732,544'},
 {'path': b'/nix/store/d3jdb9fz47z35p05pr3xgyrg7sffp78b-base-compat-0.10.5',
  'size': '2,244,632'},
 {'path': b'/nix/store/k0jpihzyqp475i39haciq86h929lp1ql-random-1.1',
  'size': '3,503,896'},
 {'path': b'/nix/store/i88qnwrc40lskrji9pb0q8f5qpdd7jbi-uuid-types-1.0.3',
  'size': '1,643,272'},
 {'path': b'/nix/store/jl9ns5773w6vx0rqhv1f67ydsww22r27-time-compat-1.9.2.2',
  'size': '4,675,896'},
 {'path': b'/nix/store/pwfwlzn5qa61aravfhw670hjd3cyacfs-th-abstraction-0.3.1.0',
  'size': '5,370,256'},
 {'path': b'/nix/store/bciw51ipp7z9npkpwyj1nkjx6ayk62yl-aeson-1.4.6.0',
  'size': '66,540,376'},
 {'path': b'/nix/store/g8daac71hgx0h735rwnj5n69mswxv4xp-pandoc-2.7.3-data',
  'size': '641,776'},
 {'path': b'/nix/store/r9rz4fiq8z4gppzf7miqkq1cbnw40yz6-splitmix-0.0.3',
  'size': '766,920'},
 {'path': b'/nix/store/hs0mrcymg5alw1jlz46pb5ypgk7yf3js-QuickCheck-2.13.2',
  'size': '20,329,560'},
 {'path': b'/nix/store/pf2bzndm7l357pc3hi5chsavvnn1wbmp-syb-0.7.1',
  'size': '2,904,168'},
 {'path': b'/nix/store/gkllhz4s27p4nqnwyrxc04c6829bsnkn-pandoc-types-1.17.6.1',
  'size': '19,829,464'},
 {'path': b'/nix/store/pywbwq86hy6c592aa1fnzvj8nqvmq90i-lua-5.3.5',
  'size': '1,585,744'},
 {'path': b'/nix/store/r0kkdb3ilqi2blsc77nlkyxvvwwfalh9-HTTP-4000.3.14-doc',
  'size': '3,377,184'},
 {'path': b'/nix/store/r900ixyg8b9i6ygayax9p4rgh79lzbky-network-2.8.0.1',
  'size': '9,063,944'},
 {'path': b'/nix/store/rq51qlkaf3v5g51q19f9dwyfxv86q3qq-HTTP-4000.3.14',
  'size': '11,520,256'},
 {'path': b'/nix/store/z7ln4gszk2nns7qs9k0j6zvw20cv22hw-pandoc-2.7.3',
  'size': '131,976,264'}]
total: 2,476,810,912

After:

[{'path': b'/nix/store/00d9ds1iqjxpbp3c2rsb0wyl3ypcck4y-pandoc-2.7.3-data',
  'size': '641,776'},
 {'path': b'/nix/store/mxaxvp33wg9sim8qh2kkw041v492bvxj-libunistring-0.9.10',
  'size': '1,634,416'},
 {'path': b'/nix/store/hjng28vbd73qq9iz9j8r397x19aa8fp9-libidn2-2.3.0',
  'size': '222,672'},
 {'path': b'/nix/store/6m2k8kx8h216jlx9dg3lp4m90bz05yck-glibc-2.30',
  'size': '31,082,264'},
 {'path': b'/nix/store/0infa8sv151a1j6zz6lizbpmwv4ksh67-gcc-9.2.0-lib',
  'size': '6,284,904'},
 {'path': b'/nix/store/fv7c5dxd6cq0w2yl21rpsgmwra87h7x5-ncurses-6.1-20190112',
  'size': '3,556,472'},
 {'path': b'/nix/store/2yjdlxxhzdi05jcpv8i8dcg8dvg2ms5l-readline-6.3p08',
  'size': '391,888'},
 {'path': b'/nix/store/6wfnl0kvgz9r1z8wp53ildc2hgsysybl-libffi-3.3',
  'size': '56,728'},
 {'path': b'/nix/store/d38akrx7lljl6pl5gqdxcsmf57k9w08v-gmp-6.2.0',
  'size': '751,936'},
 {'path': b'/nix/store/pywbwq86hy6c592aa1fnzvj8nqvmq90i-lua-5.3.5',
  'size': '1,585,744'},
 {'path': b'/nix/store/qvgf4g9c5h3wzq4xjy566vc0pqgc9fjq-zlib-1.2.11',
  'size': '124,336'},
 {'path': b'/nix/store/gg13d8cj775qbn81sbvjqlazxm14b2jq-pandoc-2.7.3',
  'size': '131,919,072'}]
total: 178,252,208
This commit is contained in:
Profpatsch 2020-04-28 12:28:37 +02:00
parent 453dca2edc
commit 6f693a9afe
2 changed files with 30 additions and 4 deletions

View File

@ -0,0 +1,29 @@
{ haskellPackages, haskell, removeReferencesTo }:
let
static = haskell.lib.justStaticExecutables haskellPackages.pandoc;
in
(haskell.lib.overrideCabal static (drv: {
configureFlags = drv.configureFlags or [] ++ ["-fembed_data_files"];
buildDepends = drv.buildDepends or [] ++ [haskellPackages.file-embed];
buildTools = (drv.buildTools or []) ++ [ removeReferencesTo ];
})).overrideAttrs (drv: {
# These libraries are still referenced, because pandoc references
# their `Paths_*` module for figuring out their version.
# The `Paths_*` module is generated by Cabal, and contains the
# version, but also paths to e.g. the data directories, which
# lead to a transitive runtime dependency on the whole GHC distribution.
# This should ideally be fixed in haskellPackages (or even Cabal),
# but a minimal pandoc is important enough to patch it manually.
disallowedReferences = [ haskellPackages.pandoc-types haskellPackages.HTTP ];
postInstall = ''
remove-references-to \
-t ${haskellPackages.pandoc-types} \
$out/bin/pandoc
remove-references-to \
-t ${haskellPackages.HTTP} \
$out/bin/pandoc
'';
})

View File

@ -5752,10 +5752,7 @@ in
pal = callPackage ../tools/misc/pal { }; pal = callPackage ../tools/misc/pal { };
pandoc = haskell.lib.overrideCabal (haskell.lib.justStaticExecutables haskellPackages.pandoc) (drv: { pandoc = callPackage ../development/tools/pandoc { };
configureFlags = drv.configureFlags or [] ++ ["-fembed_data_files"];
buildDepends = drv.buildDepends or [] ++ [haskellPackages.file-embed];
});
pamtester = callPackage ../tools/security/pamtester { }; pamtester = callPackage ../tools/security/pamtester { };