[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: GHC packages' inputs leak in guix shell
From: |
Saku Laesvuori |
Subject: |
Re: GHC packages' inputs leak in guix shell |
Date: |
Sat, 9 Sep 2023 13:05:22 +0300 |
> > 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)))
```
signature.asc
Description: PGP signature
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: GHC packages' inputs leak in guix shell,
Saku Laesvuori <=