Skip to content

Commit

Permalink
Split up shell.nix and default.nix
Browse files Browse the repository at this point in the history
  • Loading branch information
Luc Tielen committed Apr 16, 2019
1 parent 6ea0c93 commit aebdff4
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 28 deletions.
36 changes: 9 additions & 27 deletions default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,33 +4,15 @@ with pkgs;
with luaPackages;

let
buildArgs = { inherit buildLuarocksPackage fetchurl lua; };
deps = builtins.mapAttrs (dep: path: import path buildArgs) {
moonscript = ./nix/moonscript.nix;
luacov = ./nix/luacov.nix;
luacov-coveralls = ./nix/luacov-coveralls.nix;
lanes = ./nix/lanes.nix;
};
ffi = if isLuaJIT then [] else [ luaffi ];
runTimeDeps = [ lua argparse luafilesystem ];
testDeps = with deps; ffi ++ [
lanes
moonscript
busted
luacheck
luacov
luacov-coveralls
];
pkgInfo = import ./nix/lua-quickcheck.nix { inherit lua pkgs; };
in
{
lua-quickcheck = stdenv.mkDerivation rec {
name = "lua-quickcheck";
env = buildEnv { name = name; paths = buildInputs; };
buildInputs = runTimeDeps;
src = ./.;
};
shell = mkShell {
inputsFrom = testDeps;
buildInputs = runTimeDeps;
with pkgInfo;
stdenv.mkDerivation {
inherit name;
buildInputs = buildDeps;
src = ./.;
env = buildEnv {
inherit name;
paths = buildDeps;
};
}
28 changes: 28 additions & 0 deletions nix/lua-quickcheck.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{ lua, pkgs }:

with pkgs;
with luaPackages;

let
buildArgs = { inherit buildLuarocksPackage fetchurl lua; };
deps = builtins.mapAttrs (dep: path: import path buildArgs) {
moonscript = ./moonscript.nix;
luacov = ./luacov.nix;
luacov-coveralls = ./luacov-coveralls.nix;
lanes = ./lanes.nix;
};
ffi = if isLuaJIT then [] else [ luaffi ];
buildDeps = [ luarocks lua argparse luafilesystem ];
testDeps = with deps; ffi ++ [
lanes
moonscript
busted
luacheck
luacov
luacov-coveralls
];
in
{
name = "lua-quickcheck";
inherit buildDeps testDeps;
}
11 changes: 10 additions & 1 deletion shell.nix
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
{ luaVersion ? "luajit_2_1", pkgs ? import ./nix/packages.nix {} }:

(import ./. { inherit luaVersion pkgs; }).shell
with pkgs;
with luaPackages;

let
pkgInfo = import ./nix/lua-quickcheck.nix { inherit lua pkgs; };
in
with pkgInfo; mkShell {
buildInputs = buildDeps;
inputsFrom = testDeps;
}

0 comments on commit aebdff4

Please sign in to comment.