-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: add devbox integration #38
base: lamdera-next
Are you sure you want to change the base?
chore: add devbox integration #38
Conversation
devbox.json
Outdated
"zlib": { | ||
"version": "latest", | ||
"outputs": ["out", "dev"] | ||
}, | ||
"hpack": "latest" | ||
}, | ||
"env": { | ||
"LD_LIBRARY_PATH": "$DEVBOX_PACKAGES_DIR/lib:$LD_LIBRARY_PATH" | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems important that the zlib
dependency has the outputs
field, and that we export the LD_LIBRARY_PATH
env variable. Otherwise, we would have issues with pkg-config
finding the zlib
library during compilation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Huh, nice. I've had issues with zlib paths before – I guess this fixes that!
devbox.json
Outdated
"shell": { | ||
"init_hook": [ | ||
"echo 'Welcome to devbox!' > /dev/null" | ||
], | ||
"scripts": { | ||
"test": [ | ||
"echo \"Error: no test specified\" && exit 1" | ||
] | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm planning to remove the init_hook
and scripts
fields, but let me know if we would like any additions like some useful scripts or something 🙏
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome, thanks @seanstrom !
Some minor feedback.
Also; when I run devbox shell
and then stack ghci
I see this error printed out about 120 times:
gcc: error: unrecognized command-line option '--target=arm64-apple-darwin'
Any idea why? I see gcc is version pinned, I guess latest had some issues?
.envrc
Outdated
# Automatically sets up your devbox environment whenever you cd into this | ||
# directory via our direnv integration: | ||
|
||
eval "$(devbox generate direnv --print-envrc)" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is nice, but I don't think this should be the default for direnv, as I think more folks use direnv than they do devbox so the first thing they'd get greeted with is an odd error upon entering the project dir.
Happy to keep it as .envrc-devbox
and add a note in the readme that a devbox setup is available and that optionally you can also use it automatically with direnv if you like.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yeah good point!
I'll rename the file to .envrc-devbox
and update the docs too 👍
I think this error happens when dependencies use the GCC compiler and attempt to cross-compile. I recall reading that GCC doesn't support the flag At the moment, I'm not able to reproduce that issue again, so I'll need a moment to figure out how to reset my env to test this again. In the mean time, maybe try overriding / exporting an environment variable like: On a side note, what is the reason for needing GCC in this project? Would Clang be okay for compiling the dependencies? |
It's a long time since I set things up so I don't recall if gcc specifically was required. Just tried running a recompile in ghci and that seems to have a hard failure if that helps repro;
|
@supermario I've pushed up some changes that should set the desired C compiler to be Clang during compilation. Can you pull down these changes and try re-entering the devbox shell? Also it would be good to confirm what running: |
@seanstrom hrm different issue now 🤔 $ stack install
[1 of 2] Compiling Main ( /Users/mario/.stack/setup-exe-src/setup-CKvAmRb3.hs, /Users/mario/.stack/setup-exe-src/setup-CKvAmRb3.o )
gcc: error: unrecognized command-line option '--target=arm64-apple-darwin'
`gcc' failed in phase `Assembler'. (Exit code: 1)
Error: [S-6374]
While building simple Setup.hs (scroll up to its section to see the error) using:
/Users/mario/.ghcup/ghc/9.2.8/bin/ghc -rtsopts -threaded -clear-package-db -global-package-db -hide-all-packages -package base -main-is StackSetupShim.mainOverride -package Cabal-3.6.3.0 /Users/mario/.stack/setup-exe-src/setup-CKvAmRb3.hs /Users/mario/.stack/setup-exe-src/setup-shim-CKvAmRb3.hs -o /Users/mario/.stack/setup-exe-cache/aarch64-osx/tmp-Cabal-simple_CKvAmRb3_3.6.3.0_ghc-9.2.8
Process exited with code: ExitFailure 1 $ echo $CC
clang
$ which `echo $CC`
/nix/store/wkadfwbhn9b4kdih88j7izzy20qw79bk-clang-wrapper-19.1.5/bin/clang |
Summary
.envrc
file for integrating Direnv with Devbox. This is an optional feature, but it can be convenient for entering a Devbox workspace and automatically have the shell env prepared.stack install
,stack build
, andstack ghci
.