Closed hyperrealgopher closed 3 years ago
I don't even understand it all fully yet! Is the idea that I now put my ./result/bin/burrow
up as a tagged github release for people to download? And that nix just made the compilation/build of the release reproducible?
~/Projects/burrow feature/nix-packaging
❯ ./result/bin/burrow --source example-gopherhole/ --destination built/ --spacecookie
burrow: data/fonts/basicthorpe.bmf: hGetContents: invalid argument (invalid byte sequence)
Like the article suggests I should make a makefile.
Maybe I'll add table-layout
back as a dependency if I can figure out why ir results in an error about QuickCheck
.
This helped me solve the UTF8 problem: https://github.com/NixOS/nixpkgs/issues/64603
Maybe I should figure this out: https://github.com/nh2/static-haskell-nix
~/Projects/burrow feature/nix-packaging ❯ ./result/bin/burrow --source example-gopherhole/ --destination built/ --spacecookie burrow: data/fonts/basicthorpe.bmf: hGetContents: invalid argument (invalid byte sequence)
See the Cabal manual on how to acces data files in a portable way (that will also work with nix regardless of $PWD
).
I don't even understand it all fully yet! Is the idea that I now put my
./result/bin/burrow
up as a tagged github release for people to download? And that nix just made the compilation/build of the release reproducible?
Not with standard nixpkgs as the binaries are not fully linked statically, i. e. it'd still expect to find libc
, gmp
and a few system dependencies installed normally in /nix/store
which makes it impractical for distributing.
Using pkgsStatic
may save you the trouble of switching to nh2's project, however it currently still has trouble with TemplateHaskell
(so it may be a problem if a dependency of yours uses that).
You can still use standard nixpkgs haskellPackages
for CI and development environments though.
Maybe I'll add
table-layout
back as a dependency if I can figure out why ir results in an error aboutQuickCheck
.
What is the error? Also why was the test suite removed?
Thank you so much for taking the time to review this experiment/me learning about Nix!
~/Projects/burrow feature/nix-packaging ❯ ./result/bin/burrow --source example-gopherhole/ --destination built/ --spacecookie burrow: data/fonts/basicthorpe.bmf: hGetContents: invalid argument (invalid byte sequence)
See the Cabal manual on how to acces data files in a portable way (that will also work with nix regardless of
$PWD
).
Yeah I did this with waffle. The error in question is actually because of some weird envvar issue I fixed by setting another envvar. I however, didn't want to use it in this case because I actually want the data directory to be relative to the user's project folder/gopherhole they're building (it has the config too). I should probably include those fonts as a default and include the config as a default though, now that I think about it, in case they're not found in the current path! Thanks for getting me to think about that!
I don't even understand it all fully yet! Is the idea that I now put my
./result/bin/burrow
up as a tagged github release for people to download? And that nix just made the compilation/build of the release reproducible?Not with standard nixpkgs as the binaries are not fully linked statically, i. e. it'd still expect to find
libc
,gmp
and a few system dependencies installed normally in/nix/store
which makes it impractical for distributing.Using
pkgsStatic
may save you the trouble of switching to nh2's project, however it currently still has trouble withTemplateHaskell
(so it may be a problem if a dependency of yours uses that).You can still use standard nixpkgs
haskellPackages
for CI and development environments though.
I see! Thank you for that information! I am looking through Tweag's guide on statically linked Haskell binaries with Bazel, but I have to admit, at the moment it's all Greek to me.
Maybe I'll add
table-layout
back as a dependency if I can figure out why ir results in an error aboutQuickCheck
.What is the error? Also why was the test suite removed?
I was getting an error about QuickCheck
:
❯ nix-build release.nix
warning: unable to download 'https://cache.nixos.org/9akxxj4c6n0bnplk831f9mqcbnrd70mh.narinfo': Couldn't resolve host name (6); retrying in 345 ms
these derivations will be built:
/nix/store/fwfsrvgpmyzb91ylhj3wssyd6c7vl2m5-table-layout-0.9.1.0.drv
/nix/store/dvhjcdk0frcxycdyyzdmb7qwb14k9388-burrow-0.1.0.0.drv
building '/nix/store/fwfsrvgpmyzb91ylhj3wssyd6c7vl2m5-table-layout-0.9.1.0.drv'...
setupCompilerEnvironmentPhase
Build with /nix/store/qam66cqpir6n9260xzs19mbdx6kd6md0-ghc-8.10.4.
unpacking sources
unpacking source archive /nix/store/g7pxbb982x72r3xhp7lx1q87cj3bhqjq-table-layout-0.9.1.0.tar.gz
source root is table-layout-0.9.1.0
setting SOURCE_DATE_EPOCH to timestamp 1000000000 of file table-layout-0.9.1.0/test-suite/TestSpec.hs
patching sources
compileBuildDriverPhase
setupCompileFlags: -package-db=/tmp/nix-build-table-layout-0.9.1.0.drv-0/setup-package.conf.d -j8 +RTS -A64M -RTS -threaded -rtsopts
[1 of 1] Compiling Main ( Setup.hs, /tmp/nix-build-table-layout-0.9.1.0.drv-0/Main.o )
Linking Setup ...
configuring
configureFlags: --verbose --prefix=/nix/store/aamy990cibbxq7anywgkg2yabydfrpiv-table-layout-0.9.1.0 --libdir=$prefix/lib/$compiler --libsubdir=$abi/$libname --docdir=/nix/store/nd426k51szgxcdhc0bdniqxr1kqmg914-table-layout-0.9.1.0-doc/share/doc/table-layout-0.9.1.0 --with-gcc=gcc --package-db=/tmp/nix-build-table-layout-0.9.1.0.drv-0/package.conf.d --ghc-options=-j8 +RTS -A64M -RTS --disable-split-objs --enable-library-profiling --profiling-detail=exported-functions --disable-profiling --enable-shared --disable-coverage --enable-static --disable-executable-dynamic --enable-tests --disable-benchmarks --enable-library-vanilla --disable-library-for-ghci --ghc-option=-split-sections --extra-lib-dirs=/nix/store/9m4hy7cy70w6v2rqjmhvd7ympqkj6yxk-ncurses-6.2/lib --extra-lib-dirs=/nix/store/0d71ygfwbmy1xjlbj1v027dfmy9cqavy-libffi-3.3/lib --extra-lib-dirs=/nix/store/lqwgi0in94ll5fwsbh8ligvn8l0vqn7v-gmp-6.2.1/lib
Using Parsec parser
Configuring table-layout-0.9.1.0...
CallStack (from HasCallStack):
$, called at libraries/Cabal/Cabal/Distribution/Simple/Configure.hs:1024:20 in Cabal-3.2.1.0:Distribution.Simple.Configure
configureFinalizedPackage, called at libraries/Cabal/Cabal/Distribution/Simple/Configure.hs:477:12 in Cabal-3.2.1.0:Distribution.Simple.Configure
configure, called at libraries/Cabal/Cabal/Distribution/Simple.hs:625:20 in Cabal-3.2.1.0:Distribution.Simple
confHook, called at libraries/Cabal/Cabal/Distribution/Simple/UserHooks.hs:65:5 in Cabal-3.2.1.0:Distribution.Simple.UserHooks
configureAction, called at libraries/Cabal/Cabal/Distribution/Simple.hs:180:19 in Cabal-3.2.1.0:Distribution.Simple
defaultMainHelper, called at libraries/Cabal/Cabal/Distribution/Simple.hs:116:27 in Cabal-3.2.1.0:Distribution.Simple
defaultMain, called at Setup.hs:2:8 in main:Main
Setup: Encountered missing or private dependencies:
QuickCheck >=2.8 && <2.14
builder for '/nix/store/fwfsrvgpmyzb91ylhj3wssyd6c7vl2m5-table-layout-0.9.1.0.drv' failed with exit code 1
cannot build derivation '/nix/store/dvhjcdk0frcxycdyyzdmb7qwb14k9388-burrow-0.1.0.0.drv': 1 dependencies couldn't be built
error: build of '/nix/store/dvhjcdk0frcxycdyyzdmb7qwb14k9388-burrow-0.1.0.0.drv' failed
The test sutie was removed because I initially thought it had to do with the QuickCheck
error, but I should add it back.
Closing this for now since static builds were introduced in 0.1.0.0 using github workflow and docker/alpine.
Begin the Nix packaging process.
I am new to Nix packaging.
I was having problems with getting table-layouts to work so I removed the dependency entirely. I recall there being issues with this dependency in the past and I was using it to justify text, but I have my own function for doing that. So to temporarily save me the headache, in order to get the package to build, I have removed that dependency.
I was following this guide to get my first release working: https://maybevoid.com/posts/2019-01-27-getting-started-haskell-nix.html
When I change
burrow.cabal
I run:nix-shell --pure -p cabal2nix --run "cabal2nix ." > default.nix
. When I want to build the release I runnix-build release.nix
.Also I had to use the envvar
NIXPKGS_ALLOW_BROKEN=1
to allowerrata
to not halt the process.