aboutsummaryrefslogtreecommitdiff
path: root/fetch.nix
diff options
context:
space:
mode:
authorTom Harley2021-10-22 13:04:45 +0100
committerTom Harley2021-10-22 13:04:45 +0100
commit6c85a7b8ee2bd135a5c7f9abd99f5f2d75599717 (patch)
treee0fc9330f7e9b790deb6369e29f3e4ac37f1873a /fetch.nix
parentBump PoB's version number (diff)
downloadmagpkgs-6c85a7b8ee2bd135a5c7f9abd99f5f2d75599717.tar.gz
magpkgs-6c85a7b8ee2bd135a5c7f9abd99f5f2d75599717.zip

Add beginnings of stdenv

Diffstat (limited to 'fetch.nix')
-rw-r--r--fetch.nix41
1 files changed, 41 insertions, 0 deletions
diff --git a/fetch.nix b/fetch.nix
new file mode 100644
index 0000000..78cbf9a
--- /dev/null
+++ b/fetch.nix
@@ -0,0 +1,41 @@
+{ 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