Skip to content
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

[POC] Elm json "source-directories" support #27

Open
wants to merge 23 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
move dirty patches to patchPhase
turboMaCk committed May 23, 2019
commit 256138e70404989be1fd2cd1df9d3c168e987925
13 changes: 8 additions & 5 deletions data/default.nix
Original file line number Diff line number Diff line change
@@ -25,13 +25,12 @@ let
inherit versionsDat;
};

installPhase = let
elmfile = module: "\${srcdir}/\${builtins.replaceStrings ["."] ["/"] module}\${extension}";
patchPhase = let
# TODO: review naming
elmJson = pkgs.lib.importJSON ./elm.json;
elmJsonFile = pkgs.writeText "elm.json" (builtins.toJSON generatedElmJson);
# TODO: hacky.. there might be a better way
genSrcs = xs: map (path: if path == "." then srcdir else builtins.replaceStrings [".." "/"] ["" ""] path) xs;
genSrcs = xs: map (path: if path == "." then srcdir else builtins.replaceStrings ["../" ".." "./" "."] ["" "" "" ""] path) xs;
generatedElmJson = with pkgs.lib;
if hasAttrByPath ["source-directories"] elmJson then
# TODO: check if there isn't better function
@@ -41,11 +40,15 @@ let
else
elmJson;
in ''
mkdir -p \$out/share/doc

cp \${elmJsonFile} ./elm.json
echo "Generating new elm.json..."
cat elm.json
'';

installPhase = let
elmfile = module: "\${srcdir}/\${builtins.replaceStrings ["."] ["/"] module}\${extension}";
in ''
mkdir -p \$out/share/doc

\${lib.concatStrings (map (module: ''
echo "compiling \${elmfile module}"