I am trying to build my own nix-shell environment in my NixOS. I have 2 .nix file, default.nix and shell.nix, here's the configuration:
default.nix:
{ stdenv, haskellngPackages}:
let
env = haskellngPackages (p: with p; [
aeson
bytestring
conduit
snap
ghcjs
text
wai
warp
yaml
haskell.packages.lts-4_01.ghc
]);
in
stdenv.mkDerivation {
name = "RiziLab";
buildInputs = [
glpk
pcre
env
];
STACK_IN_NIX_EXTRA_ARGS
= " --extra-lib-dirs=${glpk}/lib"
+ " --extra-include-dirs=${pglpk}/include"
+ " --extra-lib-dirs=${pcre}/lib"
+ " --extra-include-dirs=${pcre}/include"
;
}
shell.nix:
{ pkgs ? (import <nixpkgs> {} ) }:
(import ./default.nix) {
stdenv = pkgs.stdenv;
haskellngPackages = pkgs.haskellngPackages;
}
but when I do nix-shell, i got this error:
error: undefined variable ‘glpk’
from what I understand, the default.nix is only a function which will be called by the shell.nix, cmiiw. The question is:
- Is there any error in my code?
- I have used either
{nixpkgs ? (import <nixpkgs> {} ) }
and{pkgs ? (import <nixpkgs> {})}
but still got the same error, is there any different between these two? - is it okay to exclude ghcwithPackages?