All Projects → cachix → Elm2nix

cachix / Elm2nix

Licence: other
Convert Elm project into Nix expressions

Programming Languages

haskell
3896 projects
elm
856 projects

Labels

Projects that are alternatives of or similar to Elm2nix

Nixery
Container registry which transparently builds images using the Nix package manager
Stars: ✭ 1,023 (+1473.85%)
Mutual labels:  nix
Snabblab Nixos
NixOS configuration for the Snabb Lab
Stars: ✭ 53 (-18.46%)
Mutual labels:  nix
Neovim Nightly Overlay
[[email protected]]
Stars: ✭ 60 (-7.69%)
Mutual labels:  nix
Workshops
Stars: ✭ 47 (-27.69%)
Mutual labels:  nix
Microgram
ABANDONED
Stars: ✭ 52 (-20%)
Mutual labels:  nix
Nix Gitignore
superseded / unmaintained
Stars: ✭ 56 (-13.85%)
Mutual labels:  nix
Rust Nightly Nix
A Nix expression for nightly Rust versions
Stars: ✭ 43 (-33.85%)
Mutual labels:  nix
Dotfiles
well-tailored NixOS & nix-darwin dotfiles
Stars: ✭ 63 (-3.08%)
Mutual labels:  nix
Neutron
🌠 Purely functional Apache Pulsar client for Scala built on top of Fs2
Stars: ✭ 53 (-18.46%)
Mutual labels:  nix
Nixos Configurations
Stars: ✭ 58 (-10.77%)
Mutual labels:  nix
Nix Dotfiles
My personal nix and nixos configuration
Stars: ✭ 48 (-26.15%)
Mutual labels:  nix
Idempotent Desktop
🛸 NixOS, Xmonad, Neovim
Stars: ✭ 51 (-21.54%)
Mutual labels:  nix
Hs Nix Template
A Haskell project template that can be built with nix and developed by ghcid and cabal-install.
Stars: ✭ 57 (-12.31%)
Mutual labels:  nix
Rust Overlay
Pure and reproducible nix overlay for binary distributed rust toolchains
Stars: ✭ 46 (-29.23%)
Mutual labels:  nix
Setup.nix
Nixpkgs based build tools for declarative Python packages [[email protected]]
Stars: ✭ 62 (-4.62%)
Mutual labels:  nix
Base16 Zathura
base16 colors for zathura
Stars: ✭ 44 (-32.31%)
Mutual labels:  nix
Nix Hs Hello Windows
Cross compiling Hello World (haskell) to Windows using nix.
Stars: ✭ 55 (-15.38%)
Mutual labels:  nix
Rien
Predictable Haskell development environments with Cabal and Nix.
Stars: ✭ 65 (+0%)
Mutual labels:  nix
Deckdeckgo
The web open source editor for presentations
Stars: ✭ 1,117 (+1618.46%)
Mutual labels:  nix
Homelab
Configuration management for Matt Layher's machines. MIT Licensed.
Stars: ✭ 57 (-12.31%)
Mutual labels:  nix

elm2nix

Build Status Hackage

Convert an Elm project into Nix expressions.

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 init: Generates default.nix that glues everything together

Assumptions

Supports Elm 0.19.1

Installation

From nixpkgs (recommended)

Make sure you have up to date stable or unstable nixpkgs channel.

$ nix-env -i elm2nix

From source

$ git clone https://github.com/domenkozar/elm2nix.git
$ cd elm2nix
$ nix-env -if .

Usage

$ git clone https://github.com/evancz/elm-todomvc.git
$ cd elm-todomvc
$ elm2nix init > default.nix
$ elm2nix convert > elm-srcs.nix
$ elm2nix snapshot > versions.dat
$ nix-build
$ chromium ./result/Main.html

Running tests (as per CI)

$ ./scripts/tests.sh

FAQ

Why is mkDerivation inlined into default.nix?

As it's considered experimental, it's generated for now. Might change in the future.

How to use with ParcelJS and Yarn?

Instead of running elm2nix init, use something like:

{ pkgs ? import <nixpkgs> {}
}:

let
  yarnPkg = pkgs.yarn2nix.mkYarnPackage {
    name = "myproject-node-packages";
    packageJSON = ./package.json;
    unpackPhase = ":";
    src = null;
    yarnLock = ./yarn.lock;
    publishBinsFor = ["parcel-bundler"];
  };
in pkgs.stdenv.mkDerivation {
  name = "myproject-frontend";
  src = pkgs.lib.cleanSource ./.;

  buildInputs = with pkgs.elmPackages; [
    elm
    elm-format
    yarnPkg
    pkgs.yarn
  ];

  patchPhase = ''
    rm -rf elm-stuff
    ln -sf ${yarnPkg}/node_modules .
  '';

  shellHook = ''
    ln -fs ${yarnPkg}/node_modules .
  '';

  configurePhase = pkgs.elmPackages.fetchElmDeps {
    elmPackages = import ./elm-srcs.nix;
    versionsDat = ./versions.dat;
  };

  installPhase = ''
    mkdir -p $out
    parcel build -d $out index.html
  '';
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].