Skip to content

Instantly share code, notes, and snippets.

@soenkehahn
Last active August 29, 2015 14:08
Show Gist options
  • Save soenkehahn/b1beb4f32d54cc177f9c to your computer and use it in GitHub Desktop.
Save soenkehahn/b1beb4f32d54cc177f9c to your computer and use it in GitHub Desktop.
nix: use specific revision of servant
let
filterHaskellSource = builtins.filterSource (path: type:
type != "unknown" &&
baseNameOf path != ".git" &&
baseNameOf path != "result" &&
baseNameOf path != "dist");
in
{ pkgs ? import <nixpkgs> { }
, src ? filterHaskellSource ./.
}:
let
servantSrc = filterHaskellSource <servant>;
servant-new-impl = pkgs.haskellPackages.buildLocalCabalWithArgs {
name = "servant";
src = "${servantSrc}/servant/";
};
in
pkgs.haskellPackages.buildLocalCabalWithArgs {
inherit src;
name = "kraken";
args = {
servant = servant-new-impl;
};
}
@jkarni
Copy link

jkarni commented Nov 5, 2014

Nice. I was thinking of:

{ pkgs ? import <nixpkgs> { config.allowUnfree = true; }
, src ?  builtins.filterSource (path: type:
    type != "unknown" &&
    baseNameOf path != ".git" &&
    baseNameOf path != "result" &&
    baseNameOf path != "dist") ./.
, servant
}:
pkgs.haskellPackages.buildLocalCabalWithArgs {
  name = "isourcerer";
  inherit src;
  args = {
    servant = servant;
  };
}

with nix-shell --arg servant "import ../servant/servant {}".

But having a default but overridable git commit would be ideal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment