Commit fcbfef1e authored by Adam Stephens's avatar Adam Stephens Committed by Yt
Browse files

buildMix: copy package.json to support phoenix builds

parent de3946fe
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -87,6 +87,12 @@ let
        fi
      done

      # Copy the source so it can be used by dependent packages. For example,
      # phoenix applications need the source of phoenix and phoenix_html to
      # build javascript and css assets.
      mkdir -p $out/src
      cp -r $src/* "$out/src"

      runHook postInstall
    '';

+21 −0
Original line number Diff line number Diff line
@@ -81,6 +81,27 @@ stdenv.mkDerivation (overridable // {
    # Phoenix projects for example will need compile.phoenix
    mix deps.compile --no-deps-check --skip-umbrella-children

    # Symlink dependency sources. This is needed for projects that require
    # access to the source of their dependencies. For example, Phoenix
    # applications need javascript assets to build asset bundles.
    ${lib.optionalString (mixNixDeps != { }) ''
      mkdir -p deps

      ${lib.concatMapStringsSep "\n" (dep: ''
        dep_name=$(basename ${dep} | cut -d '-' -f2)
        dep_path="deps/$dep_name"
        if [ -d "${dep}/src" ]; then
          ln -s ${dep}/src $dep_path
        fi
      '') (builtins.attrValues mixNixDeps)}
    ''}

    # Symlink deps to build root. Similar to above, but allows for mixFodDeps
    # Phoenix projects to find javascript assets.
    ${lib.optionalString (mixFodDeps != null) ''
      ln -s ../deps ./
    ''}

    runHook postConfigure
  '';