elm2nix 0.3.0 → 0.3.1
raw patch · 3 files changed
+20/−13 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- README.md +18/−11
- elm2nix.cabal +1/−1
- src/Elm2Nix.hs +1/−1
README.md view
@@ -9,7 +9,7 @@ It consists of multiple commands: - `elm2nix convert`: Given `elm.json` in current directory, all dependencies are parsed and their sha256sum calculated-- `elm2nix snapshot`: Downloads snapshot of http://package.elm-lang.org into `versions.dat`+- `elm2nix snapshot`: Downloads snapshot of https://package.elm-lang.org/all-packages json and converts into binary `registry.dat` used by [elm-compiler](https://github.com/elm/compiler/blob/047d5026fe6547c842db65f7196fed3f0b4743ee/builder/src/Stuff.hs#L147) as a cache - `elm2nix init`: Generates `default.nix` that glues everything together ## Assumptions@@ -36,7 +36,8 @@ $ cd elm-todomvc $ elm2nix init > default.nix $ elm2nix convert > elm-srcs.nix- $ elm2nix snapshot > versions.dat+ # generates ./registry.dat+ $ elm2nix snapshot $ nix-build $ chromium ./result/Main.html @@ -50,22 +51,24 @@ As it's considered experimental, it's generated for now. Might change in the future. -### How to use with ParcelJS and Yarn?+### How do I use elm2nix with [ParcelJS][parceljs] and [Yarn][yarn-v1]? -Instead of running `elm2nix init`, use something like:+Instead of running `elm2nix init`, create a `default.nix` with the following derivation: ```nix { pkgs ? import <nixpkgs> {} }: let- yarnPkg = pkgs.yarn2nix.mkYarnPackage {+ yarnPkg = pkgs.mkYarnPackage { name = "myproject-node-packages";- packageJSON = ./package.json;- unpackPhase = ":";- src = null;+ src = pkgs.lib.cleanSourceWith {+ src = ./.;+ name = "myproject-node-packages.json";+ filter = name: type: baseNameOf (toString name) == "package.json";+ }; yarnLock = ./yarn.lock;- publishBinsFor = ["parcel-bundler"];+ publishBinsFor = ["parcel"]; }; in pkgs.stdenv.mkDerivation { name = "myproject-frontend";@@ -89,12 +92,16 @@ configurePhase = pkgs.elmPackages.fetchElmDeps { elmPackages = import ./elm-srcs.nix;- versionsDat = ./versions.dat;+ elmVersion = "0.19.1";+ registryDat = ./registry.dat; }; installPhase = '' mkdir -p $out- parcel build -d $out index.html+ parcel build --dist-dir $out index.html ''; } ```++[parceljs]: https://parceljs.org/+[yarn-v1]: https://classic.yarnpkg.com/lang/en/
elm2nix.cabal view
@@ -3,7 +3,7 @@ -- see: https://github.com/sol/hpack name: elm2nix-version: 0.3.0+version: 0.3.1 synopsis: Turn your Elm project into buildable Nix project description: Please see the README on Github at <https://github.com/domenkozar/elm2nix#readme> homepage: https://github.com/domenkozar/elm2nix#readme
src/Elm2Nix.hs view
@@ -11,7 +11,7 @@ import Control.Concurrent.Async (mapConcurrently) import Control.Monad (liftM2)-import Control.Monad.Except (liftIO, MonadIO)+import Control.Monad.IO.Class (liftIO, MonadIO) import Control.Monad.Trans.Except (ExceptT, runExceptT, throwE) import Data.Aeson (Value(..)) import Data.List (intercalate, nub)