From: Saku Laesvuori <saku@laesvuori.fi>
To: Lars-Dominik Braun <lars@6xq.net>
Cc: Simon Tournier <zimon.toutoune@gmail.com>, help-guix@gnu.org
Subject: Re: GHC packages' inputs leak in guix shell
Date: Sat, 9 Sep 2023 13:05:22 +0300 [thread overview]
Message-ID: <p4jjdigofugtd66rsmq336z2obcj3jfbrbeiui7jitr37czyyc@s3ueljv5sroe> (raw)
In-Reply-To: <20230829203050.wxtdnalegrwrphrb@X-kone>
[-- Attachment #1: Type: text/plain, Size: 4605 bytes --]
> > I can’t check right now, but I’m guessing a plain `cabal install`
> > would also add base64-bytestring to GHC’s visible packages?
>
> I tested with cabal-install and it somehow manages to hide the haskell
> packages that are installed as dependencies.
Apparently cabal uses ghc environments[1], which are files that define a
list of flags for ghc, to hide all packages except the explicitly
installed ones. Guix could probably also create a file like that for
every profile that contains ghc and/or packages for it. Another way
would be adding a phase to hide all the haskell packages in the
package-db ($out/lib/ghc-9.2.5/ghc-esqueleto-3.5.8.1.conf.d) except for
the package itself.
Creating environment files could maybe cause problems when combining
profiles, so I think hiding dependency packages in a build phase would
be a better solution. I tried this with ghc-esqueleto and it seems to
work (though I'm sure the code isn't particularly clean and it certainly
is slower than I would like).
[1]: https://ghc.gitlab.haskell.org/ghc/doc/users_guide/packages.html#package-environments
```
(define-public ghc-esqueleto
(package
(name "ghc-esqueleto")
(version "3.5.8.1")
(source (origin
(method url-fetch)
(uri (hackage-uri "esqueleto" version))
(sha256
(base32
"0k7h2hbxv14x0kq9w2wi83h0swzlri99ic9rj76540l39yqwjc5v"))))
(build-system haskell-build-system)
(properties '((upstream-name . "esqueleto")))
(inputs (list ghc-aeson
ghc-attoparsec
ghc-blaze-html
ghc-conduit
ghc-monad-logger
ghc-persistent
ghc-resourcet
ghc-tagged
ghc-unliftio
ghc-unordered-containers
openssl
zlib))
(native-inputs (list ghc-hspec
ghc-hspec-core
ghc-mysql
ghc-mysql-simple
ghc-persistent-mysql
ghc-persistent-postgresql
ghc-persistent-sqlite
ghc-postgresql-simple
ghc-quickcheck))
(arguments
(list
#:tests? #f ; Needs a running MySQLd.
#:phases #~(modify-phases %standard-phases
(add-after 'register 'hide-dependencies
(begin
(use-modules (srfi srfi-1)
(ice-9 popen)
(ice-9 rdelim))
(lambda* (#:key name inputs #:allow-other-keys)
(let* ((out #$output)
(lib (string-append out "/lib"))
(haskell (assoc-ref inputs "haskell"))
(name-version (strip-store-file-name haskell))
(version (last (string-split name-version #\-)))
(conf-dir (string-append lib "/ghc-" version "/" name ".conf.d"))
(port (open-input-pipe
(string-append "ghc-pkg list --simple-output "
"--package-db=" conf-dir)))
(pkgs (string-split (read-line port) #\space))
(ghc-pkg (lambda (args)
(apply invoke "ghc-pkg"
(string-append "--package-db=" conf-dir)
args))))
(for-each (lambda (pkg)
(ghc-pkg (list "hide" pkg)))
pkgs)
(ghc-pkg (list "expose" (string-drop name 4)))))))))) ; drop "ghc-"
(home-page "https://github.com/bitemyapp/esqueleto")
(synopsis "Type-safe embedded domain specific language for SQL queries")
(description
"This library provides a type-safe embedded domain specific
language (EDSL) for SQL queries that works with SQL backends as provided by
@code{ghc-persistent}. Its language closely resembles SQL, so you don't have
to learn new concepts, just new syntax, and it's fairly easy to predict the
generated SQL and optimize it for your backend.")
(license license:bsd-3)))
```
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2023-09-09 10:06 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-15 6:51 GHC packages' inputs leak in guix shell Saku Laesvuori
2023-08-24 9:11 ` Simon Tournier
2023-08-24 16:16 ` Saku Laesvuori
2023-08-28 11:40 ` Simon Tournier
2023-08-28 19:15 ` Saku Laesvuori
2023-08-29 7:12 ` Lars-Dominik Braun
2023-08-29 20:30 ` Saku Laesvuori
2023-09-09 10:05 ` Saku Laesvuori [this message]
2023-10-04 18:26 ` bug#66347: GHC packages " Simon Tournier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=p4jjdigofugtd66rsmq336z2obcj3jfbrbeiui7jitr37czyyc@s3ueljv5sroe \
--to=saku@laesvuori.fi \
--cc=help-guix@gnu.org \
--cc=lars@6xq.net \
--cc=zimon.toutoune@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.