-
Notifications
You must be signed in to change notification settings - Fork 23
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
Refactor and Readme #15
base: master
Are you sure you want to change the base?
Conversation
- Easier to read, no ">>> echo" - Less boilerpate (chmod, shebang) - More like convention (binaries are inside /bin) of an expression
${spagoPkgs.buildSpagoStyle} # == spago2nix build | ||
installSpagoStyle # == spago2nix install | ||
|
||
${spagoPackages.mkBuildProjectOutput { inherit src purescript; }} |
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.
see below why I think purescript
and not purs
. Somehow it would be nice to enhance the example how to obtain this package. As easy-purescript
is not yet in NIXOS stable, maybe a this should be somehow noted.
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.
yeah, really anyone who uses this tool should also be consuming easy-purescript-nix https://github.com/justinwoo/easy-purescript-nix/
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 didn't work for me, build fails with /nix/store/whpnlfj79vd8p175rp1bwg0x7wz5lmj1-stdenv-linux/setup: line 81: /nix/store/q3m23c4r1zyvd40d5x4p2gfnmm04mdfx-build-project-output: Is a directory
src/Generate.purs
Outdated
>>$out echo "echo done." | ||
chmod +x $out | ||
buildSpagoStyle = pkgs.writeShellScriptBin "build-spago-style" '' | ||
EXTRA_FILES=$@ |
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 find it a good practice to declare explicitly what you do with the arguments in a bash script.
''; | ||
|
||
mkBuildProjectOutput = | ||
{ src, purs }: | ||
{ src, purescript }: |
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.
Isn't it better to depend on purescript, as that's the package that contains the purs
binary?
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.
sure, it's just a name change
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.
EXTRA_FILES=$@ | ||
|
||
echo "echo building project..." | ||
echo "purs compile ${builtins.toString ( |
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.
Actually this should also depend on purs
/purescript
. Currently it circumvents nix. But I did not change it as maybe the whole function is not needed anymore now that we have mkBuildProjectOutput
.
Otherwise it could be ${purescript}/bin/purs
.
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 actually do use this script quite often, since mkBuildProjectOutput is the opposite of what i want to use when developing. but yes, changing it to using purescript from easy-purescript-nix is probably fine
bcdc7b1
to
7d62a40
Compare
7d62a40
to
c4aad22
Compare
@@ -55,10 +55,15 @@ let | |||
in | |||
pkgs.stdenv.mkDerivation rec { | |||
# < ... > | |||
src = ./.; |
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 should be src = ./src;
, because the idea is that you directly consume sources without any directory structure. in addition, because requiring root sources is just not what i think anyone should do without a filter
Thanks for this great package! The current mock derivation on README doesn't work for me as it fails to build .purs from In case you're interested, here's an example for using spago2nix with |
This PR enhances the README example to use the newly created
mkBuildProjectOutput
function.It contains also some refactoring on the other build functions in the generated file.