Skip to content

Commit

Permalink
flakeify
Browse files Browse the repository at this point in the history
  • Loading branch information
BrianHicks committed Sep 13, 2021
1 parent 2d2b925 commit 03fb817
Show file tree
Hide file tree
Showing 4 changed files with 102 additions and 48 deletions.
29 changes: 0 additions & 29 deletions default.nix

This file was deleted.

43 changes: 43 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

56 changes: 56 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{
inputs = {
flake-utils.url = "github:numtide/flake-utils";
nixpkgs.url = "github:NixOS/nixpkgs/release-21.05";
};

outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let pkgs = nixpkgs.legacyPackages.${system};
in rec {
# `nix build`
packages.bad-datalog = pkgs.stdenv.mkDerivation {
name = "bad-datalog";
src = ./.;

buildInputs = [ pkgs.elmPackages.elm pkgs.elmPackages.elm-test ];

buildPhase = pkgs.elmPackages.fetchElmDeps {
elmPackages = import ./nix/elm-srcs.nix;
elmVersion = "0.19.1";
registryDat = ./nix/registry.dat;
};

doCheck = true;
checkPhase = "elm-test";

# it's a little weird that elm2nix says it's fine to build in the install
# phase, but who am I to judge?
installPhase = ''
mkdir -p $out/share/bad-datalog
(
cd sample-apps
elm make src/Main.elm --output $out/share/bad-datalog/index.html
)
'';
};
defaultPackage = packages.bad-datalog;
overlay = final: prev: { bad-datalog = packages.bad-datalog; };

# `nix develop`
devShell = pkgs.mkShell {
buildInputs = with pkgs; [
git

elm2nix
elmPackages.elm
elmPackages.elm-format
elmPackages.elm-json
elmPackages.elm-live
elmPackages.elm-review
elmPackages.elm-test
];
};
});
}
22 changes: 3 additions & 19 deletions shell.nix
Original file line number Diff line number Diff line change
@@ -1,19 +1,3 @@
{ ... }:
let
sources = import ./nix/sources.nix { };
pkgs = import sources.nixpkgs { };
niv = import sources.niv { };
in pkgs.mkShell {
buildInputs = [
niv.niv
pkgs.git

pkgs.elm2nix
pkgs.elmPackages.elm
pkgs.elmPackages.elm-format
pkgs.elmPackages.elm-json
pkgs.elmPackages.elm-live
pkgs.elmPackages.elm-review
pkgs.elmPackages.elm-test
];
}
(import (fetchTarball https://github.com/edolstra/flake-compat/archive/master.tar.gz) {
src = builtins.fetchGit ./.;
}).shellNix

0 comments on commit 03fb817

Please sign in to comment.