On 2024-04-01 10:18:09 -0400, Greg Hogan wrote: > On Sun, Mar 31, 2024 at 5:39 PM Spencer Skylar Chan > <scha...@terpmail.umd.edu> wrote: > > > > Dear Guix, > > > > How do I run guix size with a manifest? Most guix shell commands use -m > > for a manifest file, but guix size uses -m for map-file. Right now I'm using > > > > grep -F \" manifest.scm | cut -d \" -f 2 | xargs guix size > > > > but this would only work for autogenerated manifests from > > guix shell --export-manifest and not manifests written by hand. > > > > Thanks, > > Skylar > > I am interested to hear other ideas,
I hope you will not regret this sentence once you see my "one-liner": $ cat manifest.scm ;; What follows is a "manifest" equivalent to the command line you gave. ;; You can store it in a file that you may then pass to any 'guix' command ;; that accepts a '--manifest' (or '-m') option. (specifications->manifest (list "gcc-toolchain")) $ printf '(use-modules (guix packages) (guix derivations) (guix store) (guix profiles) (guix scripts environment) (guix scripts size)) ((@@ (guix scripts size) display-profile) (run-with-store (open-connection) ((@@ (guix scripts size) store-profile) (map (λ (entry) (derivation->output-path (run-with-store (open-connection) (package->derivation (manifest-entry-item entry))))) (manifest-entries (load-manifest "manifest.scm"))))))' | guix repl /dev/stdin store item total self /gnu/store/i3x1cr4b0f20r8pkcfq7sxmwv6261b0y-gcc-toolchain-13.2.0 423.3 0.1 0.0% /gnu/store/vjjk375kysja1jz0837lypd09rdgs47c-gcc-13.2.0 304.5 178.0 42.1% /gnu/store/v5aqhqxjqdvh9fhi64ifxnfji562j178-ld-wrapper-0 189.1 0.1 0.0% /gnu/store/ksx7y5947h14pdv09ah704lkkibw1qp0-guile-3.0.9 134.0 53.1 12.5% /gnu/store/bnw209k5cvbyi04kngddlk2ir77x8yii-binutils-2.38 95.5 54.9 13.0% /gnu/store/gdy0b065fk8wwxv49ln0c7892pam78z1-isl-0.24 83.2 5.2 1.2% /gnu/store/w55122b226ss928lxxg58plalah3xl9h-mpc-1.3.1 80.6 0.5 0.1% /gnu/store/4vn8m606saf5i3nvksgvl958c0i0nvsn-mpfr-4.2.0 80.2 2.2 0.5% /gnu/store/m57d52krll9vlzmc0cqfg6dwn7n0p52j-gcc-13.2.0-lib 80.0 39.4 9.3% /gnu/store/dpvr7rj89j7xdnzpjhhll8dpqh3fizz5-gmp-6.2.1 78.0 2.7 0.6% /gnu/store/sbigf12hsr3ciyvc5pdymlbd5ji4xmv4-libunistring-1.0 77.8 2.5 0.6% /gnu/store/bvqbwh04lfacmsifh4gnfx1z8pmpjls0-pkg-config-0.29.2 76.4 1.1 0.3% /gnu/store/ag3azcwi1r94j9i6bzgqxhk9n40v1ma5-libgc-8.2.2 76.1 0.8 0.2% /gnu/store/hl6lb3irs8wrfv49fnirxshsq590pi9v-zlib-1.2.13 75.5 0.2 0.1% /gnu/store/f62ci08wpcyx4x5drvhpk831ydjmh73j-libffi-3.4.4 75.5 0.2 0.0% /gnu/store/6ncav55lbk5kqvwwflrzcr41hp5jbq0c-gcc-11.3.0-lib 75.3 34.7 8.2% /gnu/store/v9p25q9l5nnaixkhpap5rnymmwbhf9rp-bash-minimal-5.1.16 41.6 1.0 0.2% /gnu/store/ln6hxqjvz6m9gdd9s97pivlqck7hzs99-glibc-2.35 40.6 38.8 9.2% /gnu/store/5iklcps70c0sfkxvlrhg8jhf3q4h18bj-linux-libre-headers-5.15.49 5.9 5.9 1.4% /gnu/store/zzyywykw7kriln18rxqd82f0k5kidla7-bash-static-5.1.16 1.8 1.8 0.4% total: 423.3 MiB The code is based on the "hack at it until it works" approach, not on the "ok so I should first try to understand store monads" approach, so I am sure there are issues with it. But on my simple example it seems to work. The path ("manifest.scm") is hard-coded though. Tomas -- There are only two hard things in Computer Science: cache invalidation, naming things and off-by-one errors.
signature.asc
Description: PGP signature