Handle variable overrides correctly

This commit is contained in:
Alexander Bantyev 2020-03-26 20:27:16 +03:00
parent 1dabc4442d
commit b8cbd8929b
Signed by: balsoft
GPG Key ID: E081FF12ADCB4AD5
2 changed files with 4 additions and 4 deletions

View File

@ -39,8 +39,8 @@ opam2nix OPAM {..} =
preparephase = mconcat . intersperse " " . mconcat . intersperse ["\n"] preparephase = mconcat . intersperse " " . mconcat . intersperse ["\n"]
in in
"{ stdenv, fetchzip, " <>deps<> ", extraArgs ? { } }:\n" "{ stdenv, fetchzip, " <>deps<> ", extraArgs ? { } }:\n"
<>"with extraArgs;\n" -- Awful hack to allow this to evaluate even if some of the variables are undefined <>"\n" -- Awful hack to allow this to evaluate even if some of the variables are undefined
<>"stdenv.mkDerivation (rec {\n" <>"stdenv.mkDerivation (let self = with self; with extraArgs; {\n"
<>foldMap (\name' -> " pname = \""<>name'<>"\";\n") name <>foldMap (\name' -> " pname = \""<>name'<>"\";\n") name
<>foldMap (\version' -> " version = \""<>version'<>"\";\n") version <>foldMap (\version' -> " version = \""<>version'<>"\";\n") version
<>foldMap (\url -> " src = builtins.fetchTarball { url = \""<>url<>"\"; };\n") source <>foldMap (\url -> " src = builtins.fetchTarball { url = \""<>url<>"\"; };\n") source
@ -58,7 +58,7 @@ opam2nix OPAM {..} =
<>preparephase checkPhase' <>preparephase checkPhase'
<>"\nrunHook postCheck\n'';\n") checkPhase <>"\nrunHook postCheck\n'';\n") checkPhase
<>" installPhase = ''\nrunHook preInstall\nopaline -prefix $out -libdir $OCAMLFIND_DESTDIR\nrunHook postInstall\n'';\n" <>" installPhase = ''\nrunHook preInstall\nopaline -prefix $out -libdir $OCAMLFIND_DESTDIR\nrunHook postInstall\n'';\n"
<>"} // extraArgs)\n" <>"}; in self // extraArgs)\n"
update :: Maybe a -> a -> Maybe a update :: Maybe a -> a -> Maybe a
update old new = if isNothing old then Just new else old update old new = if isNothing old then Just new else old

View File

@ -1,5 +1,5 @@
opam-version: "2.0" opam-version: "2.0"
name: "tezos-memory-proto-alpha" name: "memory-proto-alpha"
version: "1.0" version: "1.0"
synopsis: "Tezos Protocol Alpha in memory" synopsis: "Tezos Protocol Alpha in memory"
maintainer: "Galfour <ligolang@gmail.com>" maintainer: "Galfour <ligolang@gmail.com>"