Johnny Liao
Johnny Liao

Reputation: 567

nix-env and nix-shell have different versions of snap

I was following directions on reflex-platfrom project development,trying to test servant-reflex as a submodule.

My project is here.

In my backend.cabal, I have a built-depend: snap >= 1.1.1.0 && < 1.2

When I nix-shell -A shells.ghc --run "cabal new-build all", it tries to install heist-1.0.1.0 and snap-1.0.0.2, then failed at

Configuring heist-1.0.1.0...
Setup: Encountered missing dependencies:
aeson >=0.6 && <1.2

To see what in my nixos-unstable, I:

`nix-channel --list`
nixos https://nixos.org/channels/nixos-unstable

`nix-env -f "<nixpkgs>" -qaP -A haskellPackages.aeson`
warning: Nix search path entry '/home/demo/.nix-defexpr/channels' does not exist, ignoring
haskellPackages.aeson  aeson-1.2.4.0

`nix-env -f "<nixpkgs>" -qaP -A haskellPackages.snap`
warning: Nix search path entry '/home/demo/.nix-defexpr/channels' does not exist, ignoring
haskellPackages.snap  snap-1.1.0.0

`nix-env -f "<nixpkgs>" -qaP -A haskellPackages.heist`
warning: Nix search path entry '/home/demo/.nix-defexpr/channels' does not exist, ignoring
haskellPackages.heist  heist-1.0.1.2

Q: Why does nix-shell install heist-1.0.1.0 and snap-1.0.0.2, instead of heist-1.0.1.2 and snap-1.1.0.0, which then can dependent on aeson-1.2.4.0?

Upvotes: 1

Views: 466

Answers (1)

Johnny Liao
Johnny Liao

Reputation: 567

Got an answer from elvishjerricco on IRC #nixos.

To doJailbreak heist, you'd use the overrides argument to project

packages is for just declaring directories that you want to turn into haskell packages; it'll run cabal2nix for you. overrides is for doing derivation changes to the haskell package set.

default.nix

(import ./reflex-platform {}).project ({ pkgs, ... }: {

  overrides = self: super: {
   heist = pkgs.haskell.lib.doJailbreak super.heist;
   map-syntax = pkgs.haskell.lib.doJailbreak super.map-syntax;
  };

  packages = {
    common = ./common;
    backend = ./backend;
    frontend = ./frontend;
    google-maps-reflex = ./google-maps-reflex;
  };

  shells = {
    ghc = ["common" "backend" "frontend" "heist"]; # "backend" "frontend"];
    ghcjs = ["common" "frontend"];
  };
})

Upvotes: 2

Related Questions