mirror of
https://github.com/nmattia/snack.git
synced 2024-11-28 03:45:45 +03:00
Fix nested modules
This commit is contained in:
parent
89f6c30aa0
commit
c5c04957be
@ -117,9 +117,16 @@ rec {
|
||||
};
|
||||
phases =
|
||||
[ "unpackPhase" "buildPhase" ];
|
||||
|
||||
imports = map (mmm: mmm.moduleName) modSpec.moduleImports;
|
||||
buildPhase =
|
||||
''
|
||||
echo "Building module ${modSpec.moduleName}"
|
||||
echo "Local imports are:"
|
||||
for foo in $imports; do
|
||||
echo " - $foo"
|
||||
done
|
||||
|
||||
mkdir -p $out
|
||||
echo "Creating dependencies symtree for module ${modSpec.moduleName}"
|
||||
${makeSymtree}
|
||||
@ -132,6 +139,8 @@ rec {
|
||||
-outputdir $out \
|
||||
${ghcOptsArgs} \
|
||||
2>&1
|
||||
|
||||
ls $out
|
||||
echo "Done building module ${modSpec.moduleName}"
|
||||
'';
|
||||
|
||||
|
@ -12,7 +12,7 @@ rec {
|
||||
basePrefix = (builtins.toString base) + "/";
|
||||
pred = file: path: type:
|
||||
let
|
||||
actual = (lib.strings.removePrefix basePrefix path);
|
||||
actual = lib.strings.removePrefix basePrefix path;
|
||||
expected = file;
|
||||
in
|
||||
(expected == actual) ||
|
||||
@ -20,11 +20,19 @@ rec {
|
||||
# TODO: even though we're doing a lot of cleaning, there's sitll some
|
||||
# 'does-file-exist' happening
|
||||
src0 = lib.cleanSource base;
|
||||
name = # Makes the file name derivation friendly
|
||||
lib.stringAsChars
|
||||
(x:
|
||||
if x == "/" then "_"
|
||||
else if builtins.isNull (builtins.match "[a-zA-Z0-9.+=-_?]" x)
|
||||
then ""
|
||||
else x
|
||||
) file;
|
||||
|
||||
in stdenv.mkDerivation {
|
||||
name = file;
|
||||
inherit name;
|
||||
src = lib.cleanSourceWith { filter = (pred file); src = src0; };
|
||||
builder = writeScript (file + "-single-out")
|
||||
builder = writeScript (name + "-single-out")
|
||||
# TODO: make sure the file actually exists and that there's only one
|
||||
''
|
||||
echo "Singling out file ${file}"
|
||||
|
@ -2,5 +2,5 @@ name: snack-packages-test
|
||||
dependencies:
|
||||
- conduit
|
||||
executable:
|
||||
main: Foo/Foo.hs
|
||||
main: Bar/Foo.hs
|
||||
source-dirs: src
|
||||
|
@ -1,4 +1,4 @@
|
||||
{ main = "Foo.Foo";
|
||||
{ main = "Bar.Foo";
|
||||
src = ./src;
|
||||
dependencies = ["conduit"];
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
import Conduit
|
||||
import FooBar
|
||||
import Bar.FooBar
|
||||
|
||||
main :: IO ()
|
||||
main = runConduit $ spitOut .| takeC 5 .| digest
|
||||
|
@ -1,4 +1,4 @@
|
||||
module FooBar where
|
||||
module Bar.FooBar where
|
||||
|
||||
import Conduit
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user