tweag / funflow2

Compose and run computational workflows
MIT License
9 stars 0 forks source link

Refreshing Nix after cabal/stack edits #91

Closed vreuter closed 3 years ago

vreuter commented 3 years ago

I edited a .cabal file and then tried to follow instructions in docs/DEVELOPMENT.md to update accordingly. The commands in the docs look like they may need a couple updates:

Sorry, I've spent a while searching through git histories, my local Nix store, and the repo referenced in this project's docs for how to update but haven't figured it out so resorted to wiping out Nix and am now rebuilding. FWIW, there's a test/regen.nix in IOHK/haskell-nix that looks related, but it looks like funflow (original) docs have similar references to these update/regeneration scripts that may need to be updated

vreuter commented 3 years ago

Removing all of /nix/store didn't work, the build still failed with my edited cas-store.cabal, for lack of ability to find source directory for an extra module (Other-modules) I'd defined. Wiping out .stack_work within cas/store also didn't work, so I don't think lingering files within the project from my previous local builds is / was the issue, and that in fact we need to be able to run something to update the Nix build / derivations after a cabal or stack edit.

dorranh commented 3 years ago

Ah sorry for the confusion on this point. The development guide is a bit out of date (created #92). You shouldn't need to update anything in the nix packaging so long as the dependency you are trying to add exists in the stackage snapshop which haskell.nix is using. Haskell.nix handles everything else for you automatically.

The update.sh script in the repo is actually for updating the haskell.nix library itself. In general, funflow is using stack for its packaging, and you should be able to simply add a stackage package to the package.yaml. We also define some extra repositories for fetching packages like kernmantle, which are not published on stackage (example).

dorranh commented 3 years ago

Also, if you are adding new source files, haskell.nix generally filters your git tree to only include files which are tracked by git. You'll need to git add new files before they get picked up in the build. (See the cleanGit in their example here: https://input-output-hk.github.io/haskell.nix/tutorials/getting-started/#scaffolding)

vreuter commented 3 years ago

OK great, I will keep this in mind, or perhaps try it out depending on what you think re: exposure of data constructors in changes in #88

vreuter commented 3 years ago

I wasn't for adding an external dependency (published or unpublished), just trying to include a new module in the build. Specifically, I made a Impl.hs in cas/store/src/Data/CAS/ContentStore and then tried to add it to the Other-modules field in the cas-store.cabal. So @dorranh it sounds like that would have worked, if first I'd even staged (though not committed?!) the relevant changes? It seems like I wouldn't have needed to add anything extra to point to the new source file since I guess the hs-src-dirs is recursive?

vreuter commented 3 years ago

Also, if you are adding new source files, haskell.nix generally filters your git tree to only include files which are tracked by git. You'll need to git add new files before they get picked up in the build. (See the cleanGit in their example here: https://input-output-hk.github.io/haskell.nix/tutorials/getting-started/#scaffolding)

Just used this when adding some new test modules and it worked brilliantly, thanks @dorranh for the Nix tip!

vreuter commented 3 years ago

92 will jointly address the 3 line-items here.