aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Harley2021-11-21 08:23:16 +0000
committerTom Harley2021-11-21 08:23:16 +0000
commit27fe4cc810d630b3933bbb666776e510050b0f9e (patch)
tree3acdc65895689f7063b46c1220eea00ea4b79af0
parentAdd beginnings of stdenv (diff)
downloadmagpkgs-27fe4cc810d630b3933bbb666776e510050b0f9e.tar.gz
magpkgs-27fe4cc810d630b3933bbb666776e510050b0f9e.zip

Remove stdenv/fetch things

It was a bit too much effort for now. Specifically, making fetch helpers that don’t download the item to hash it are a little more involved.

I might come back to this stuff in the future (although it might end up in a separate repo).

-rw-r--r--conjure/default.nix2
-rw-r--r--default.nix7
-rw-r--r--fetch.nix41
-rw-r--r--minion/default.nix44
-rw-r--r--savilerow/default.nix41
-rw-r--r--stdenv.nix42
6 files changed, 51 insertions, 126 deletions
diff --git a/conjure/default.nix b/conjure/default.nix
index b695ddf..2f7755e 100644
--- a/conjure/default.nix
+++ b/conjure/default.nix
@@ -21,7 +21,7 @@
buildInputs = [ unzip makeWrapper ];
libPath = lib.makeLibraryPath [ gmp ];
binPath = if includeSolver
- then lib.makeBinPath [ savilerow savilerow.minion ]
+ then lib.makeBinPath [ "${savilerow}" "${savilerow.minion}" ]
else "";
src = fetchurl {
diff --git a/default.nix b/default.nix
index 19481c7..dac657b 100644
--- a/default.nix
+++ b/default.nix
@@ -1,6 +1,6 @@
-let nixpkgs = import <nixpkgs> {}; in
+let nixpkgs_fallback = import <nixpkgs> {}; in
-{ makeOverridable ? nixpkgs.lib.makeOverridable
+{ nixpkgs ? nixpkgs_fallback
}:
let
@@ -11,9 +11,6 @@ let
callPackage = callPackageWith (nixpkgs // magpkgs);
- stdenv = (callPackage ./stdenv.nix {}) // nixpkgs.stdenv;
- fetch = callPackage ./fetch.nix {};
-
path-of-building = callPackage ./path-of-building {};
minion = callPackage ./minion {};
diff --git a/fetch.nix b/fetch.nix
deleted file mode 100644
index 78cbf9a..0000000
--- a/fetch.nix
+++ /dev/null
@@ -1,41 +0,0 @@
-{ bash
-, coreutils
-, writeTextFile
-, unzip
-, ...
-}:
-
-let fetch = rec {
-
- tar = builtins.fetchTarball;
- url = builtins.fetchurl;
-
- zip =
- { url
- , sha256
- , name ? "unnamed-zipfile"
- }@x:
-
- builtins.trace x
-
- derivation rec {
- inherit name;
-
- src = fetch.url x.url;
-
- buildScript = writeTextFile {
- name = "${name}.zip-downloader";
- executable = true;
-
- text = ''
- ${coreutils}/bin/mkdir -p $out
- ${unzip}/bin/unzip -d $out $src
- '';
- };
-
- builder = "${bash}/bin/bash";
- args = [ "-e" buildScript ];
- system = builtins.currentSystem;
- };
-
-}; in fetch
diff --git a/minion/default.nix b/minion/default.nix
index b72e036..9662b83 100644
--- a/minion/default.nix
+++ b/minion/default.nix
@@ -1,35 +1,41 @@
{ stdenv
, unzip
, coreutils
-, fetch
+, fetchzip
, ...
}:
-stdenv.mkDerivations rec {
- pname = "minion";
+let
+ default_info = {
+ pname = "minion";
+ version = "1.8";
- variations = [
- {
- version = "1.8";
- src = fetch.tar {
- url = https://blogs.cs.st-andrews.ac.uk/constraintmodelling/files/2015/06/minion-1.8-linux.tar_1.gz;
- sha256 = "1346fcssic7hcsy0v4l95ng5iqqlzmm1g8d7p3g944rwzs70g7zp";
- };
- }
+ src = fetchzip {
+ # hacky fix thanks to https://github.com/NixOS/nixpkgs/issues/60157#issuecomment-524965720
+ url = "https://blogs.cs.st-andrews.ac.uk/constraintmodelling/files/2015/06/minion-1.8-linux.tar_1.gz#.tgz";
+ sha256 = "1346fcssic7hcsy0v4l95ng5iqqlzmm1g8d7p3g944rwzs70g7zp";
+ };
+
+ PATH = "${coreutils}/bin";
+ installPhase = ''
+ mkdir -p $out/bin
+ cp $src\/*/minion $out/bin/minion
+ '';
+
+ passthru.variations = map mkv variations;
+ };
+
+ mkv = var: stdenv.mkDerivation (default_info // var);
+
+ variations = [
{
version = "2";
- src = fetch.zip {
+ src = fetchzip {
url = https://github.com/conjure-cp/conjure/releases/download/v2.3.0/conjure-v2.3.0-linux-solvers.zip;
sha256 = "09ajj7zbb4rk9srk3q9gmfkvaymwsd8ai3ddkkinp8y8z018abk0";
};
}
];
- PATH = "${coreutils}/bin";
-
- install = ''
- mkdir -p $out/bin
- cp $src\/*/minion $out/bin/minion
- '';
-}
+in stdenv.mkDerivation default_info
diff --git a/savilerow/default.nix b/savilerow/default.nix
index 6a18114..2aeb50a 100644
--- a/savilerow/default.nix
+++ b/savilerow/default.nix
@@ -1,5 +1,5 @@
{ stdenv
-, fetchurl
+, fetchzip
, makeWrapper
, jre
, jdk
@@ -8,33 +8,25 @@
, minion
-, useMinion ? true
-
, ...
}:
let
- optionalFlag = test: flag: value:
- lib.optionalString test ''--add-flags "${flag} '${value}'" '';
-
-in
- stdenv.mkDerivation rec {
+ default_info = rec {
pname = "savilerow";
version = "1.9.0";
- src = fetchurl {
+ src = fetchzip {
url = "https://savilerow.cs.st-andrews.ac.uk/${pname}-${version}-linux.tgz";
- sha256 = "10ibyfkib4ym6sadaqhk7jp6k0i6mm1bh6i8yzdhxl153gnd8f2h";
- # v1.8.0
- # sha256 = "017abjswjg1q9ap6zx7088kinxlg3pqvz6z37pfx13j5hnz1cfnl";
+ sha256 = "1497lnill33p8qmsyqbvr3dj1f19cka0gclkich62by5xrwkf70n";
};
+ inherit minion;
+
manifest = ./manifest;
nativeBuildInputs = [ makeWrapper ];
- inherit minion;
-
buildPhase = ''
${fastjar}/bin/fastjar -ufm ./savilerow.jar ${manifest}
'';
@@ -47,9 +39,22 @@ in
makeWrapper ${jre}/bin/java $out/bin/savilerow \
--add-flags "-ea -XX:ParallelGCThreads=1 -Xmx8G" \
--add-flags "-jar \"$out/share/java/${pname}.jar\"" \
- ${optionalFlag useMinion "-minion-bin" "${minion}/bin/minion"} \
+ --add-flags "-minion-bin \"${minion}/bin/minion\""
'';
- meta = {
- };
- }
+ passthru.variations = map mkv (variations default_info);
+ };
+
+ mkv = var: stdenv.mkDerivation (default_info // var);
+
+ variations = base: [
+ rec {
+ version = "1.8.0";
+ src = fetchzip {
+ url = "https://savilerow.cs.st-andrews.ac.uk/${base.pname}-${version}-linux.tgz";
+ sha256 = "0k6gfi0ix88xl6h8c9801rz4zq0bq8c61i47mnsjl5zj2cshjhqy";
+ };
+ }
+ ];
+
+in stdenv.mkDerivation default_info
diff --git a/stdenv.nix b/stdenv.nix
deleted file mode 100644
index 607ed76..0000000
--- a/stdenv.nix
+++ /dev/null
@@ -1,42 +0,0 @@
-{ bash
-, writeTextFile
-, ...
-}:
-
-rec {
-
- mkDerivations = x: derivations (spread (removeAttrs x [ "variations" ]) x.variations);
-
- spread = x: ys: map (y: x // y) ys;
-
- addDefaults =
- let
- opt = x: a: if builtins.hasAttr a x then builtins.getAttr a x else "";
-
- res = x: defaults x // x;
-
- buildScript = x: writeTextFile {
- name = "build_script.sh";
- executable = true;
- text = ''
- ${opt (res x) "unpack"}
- ${opt (res x) "build"}
- ${opt (res x) "check"}
- ${opt (res x) "install"}
- ${opt (res x) "checkInstall"}
- '';
- };
-
- defaults = x: {
- name = "${x.pname}-${x.version}";
- system = builtins.currentSystem;
- builder = "${bash}/bin/bash";
- args = [ "-e" (buildScript x) ];
- };
- in res;
-
- derivations = map (x: derivation (addDefaults x));
-
- attrMap = f: builtins.foldl' (x: y: x // f y) {};
- attrMap' = f: xs: builtins.listToAttrs (map f xs);
-}