Skip to content

Add runtime dependency example#23

Closed
nzhang-zh wants to merge 1 commit intomasterfrom
bake-deps
Closed

Add runtime dependency example#23
nzhang-zh wants to merge 1 commit intomasterfrom
bake-deps

Conversation

@nzhang-zh
Copy link
Copy Markdown
Contributor

@nzhang-zh nzhang-zh commented Aug 1, 2020

This PR adds an example to bake runtime dependency (e.g. shellout cli programs)
into the binary so that it becomes part of the closure of the build output.

Based on NixOS/cabal2nix#466

Tries to solve #7

Comment thread Setup.hs
(lib
{ libBuildInfo = libbi
{ cppOptions = cppOptions libbi
++ map fmtCppArg paths
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Finds the path of external programs to bake into the binary and pass that in through cpp

Comment thread src/Deps/Paths.hs
where

hello :: FilePath
hello = PATH_TO_HELLO
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Receives the external tool paths through cpp

@nzhang-zh
Copy link
Copy Markdown
Contributor Author

The build output will have hello package in its closure. And the executable will be able to find hello from the nix store.

~/m/Haskell-Demo ❯❯❯ nix-build release.nix -A application
...
~/m/Haskell-Demo ❯❯❯ nix-store -qR result
...
/nix/store/gql5x518q1xh1vd0ka6my5vg3j1xfqw1-hello-1.0.0.2
...
~/m/Haskell-Demo ❯❯❯ ./result/bin/haskell-demo-deps-exe
Hello, World!

@nzhang-zh nzhang-zh requested a review from CMCDragonkai August 1, 2020 02:25
@nzhang-zh nzhang-zh mentioned this pull request Aug 1, 2020
@nzhang-zh
Copy link
Copy Markdown
Contributor Author

nzhang-zh commented Aug 1, 2020

Related to #7 and #24

@CMCDragonkai
Copy link
Copy Markdown
Member

This can no longer be merged. So the notes of how to do this should go into the issue.

@CMCDragonkai CMCDragonkai deleted the bake-deps branch August 1, 2020 09:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants