Skip to content

Commit

Permalink
fix git module in nix
Browse files Browse the repository at this point in the history
  • Loading branch information
shmish111 committed Mar 7, 2019
1 parent b8f9de6 commit ff1825c
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 1 deletion.
8 changes: 7 additions & 1 deletion default.nix
Expand Up @@ -59,6 +59,9 @@
# Forces all warnings as errors
, forceError ? true

# If we are in Hydra
, declInput ? null

}:

with pkgs.lib;
Expand All @@ -84,7 +87,10 @@ let
inherit pkgs;
filter = localLib.isPlutus;
};
customOverlays = optional forceError errorOverlay;
gitModuleOverlay = import ./nix/overlays/git-module.nix {
inherit pkgs declInput;
};
customOverlays = optional forceError errorOverlay ++ [gitModuleOverlay];
# Filter down to local packages, except those named in the given list
localButNot = nope:
let okay = builtins.filter (name: !(builtins.elem name nope)) localLib.plutusPkgList;
Expand Down
24 changes: 24 additions & 0 deletions nix/overlays/git-module.nix
@@ -0,0 +1,24 @@
{ pkgs, declInput }:

with pkgs.lib;

let
git-rev = if isNull declInput then builtins.readFile ../../.git/HEAD else declInput.rev;
gitModulePatch = pkgs.writeText "gitModulePatch" ''
diff --git a/src/Git.hs b/src/Git.hs
index b0398a7..45a9066 100644
--- a/src/Git.hs
+++ b/src/Git.hs
@@ -1,4 +1,4 @@
module Git where
gitHead :: String
-gitHead = "master"
+gitHead = "${pkgs.lib.removeSuffix "\n" git-rev}"
'';
in
self: super: {
plutus-playground-server = super.plutus-playground-server.overrideDerivation (oldAttrs: {
patches = [gitModulePatch];
});
}
1 change: 1 addition & 0 deletions nix/overlays/required.nix
Expand Up @@ -11,6 +11,7 @@ let
postCheck = "./Setup doctest --doctest-options=\"${opts}\"";
});
doctestOpts = "-pgmL markdown-unlit -XTemplateHaskell -XDeriveFunctor -XScopedTypeVariables";

in

self: super: {
Expand Down

0 comments on commit ff1825c

Please sign in to comment.