git.iko.soy/typeable/nixpkgs
on master help sign in
build-support: Add fetchfossil function.

This is a dead-simple fetcher which clones a Fossil repository, opens it directly into $out, and then nicks out the single Fossil checkout marker.

commit20a0e2e3bf839588740b9265545d22506a511890 authorCorbin <cds@corbinsimpson.com> dateThu 18 Aug 2016, 22:29 (10 years ago) parentc89959e
3 files changed+44
pkgs/build-support/fetchfossil/builder.sh+21 pkgs/build-support/fetchfossil/default.nix+21 pkgs/top-level/all-packages.nix+2
pkgs/build-support/fetchfossil/builder.shnew file+21
@@ -0,0 +1,21 @@
1+source $stdenv/setup
2+header "Cloning Fossil $url into $out"
3+
4+# Fossil, bless its adorable little heart, wants to write global configuration
5+# to $HOME/.fossil. AFAICT, there is no way to disable this functionality.
6+export HOME=.
7+
8+# We must explicitly set the admin user for the clone to something reasonable.
9+fossil clone -A nobody "$url" fossil-clone.fossil
10+
11+mkdir fossil-clone
12+WORKDIR=$(pwd)
13+mkdir $out
14+pushd $out
15+fossil open "$WORKDIR/fossil-clone.fossil"
16+popd
17+
18+# Just nuke the checkout file.
19+rm $out/.fslckout
20+
21+stopNest
pkgs/build-support/fetchfossil/default.nixnew file+21
@@ -0,0 +1,21 @@
1+{stdenv, fossil}:
2+
3+{name ? null, url, rev ? null, md5 ? null, sha256 ? null}:
4+
5+# TODO: statically check if mercurial as the https support if the url starts woth https.
6+stdenv.mkDerivation {
7+ name = "fossil-archive" + (if name != null then "-${name}" else "");
8+ builder = ./builder.sh;
9+ buildInputs = [fossil];
10+
11+ impureEnvVars = [
12+ "http_proxy" "https_proxy" "ftp_proxy" "all_proxy" "no_proxy"
13+ ];
14+
15+ outputHashAlgo = if md5 != null then "md5" else "sha256";
16+ outputHashMode = "recursive";
17+ outputHash = if md5 != null then md5 else sha256;
18+
19+ inherit url rev;
20+ preferLocalBuild = true;
21+}
pkgs/top-level/all-packages.nix+2
@@ -162,6 +162,8 @@ in
162162
163163 fetchdarcs = callPackage ../build-support/fetchdarcs { };
164164
165+ fetchfossil = callPackage ../build-support/fetchfossil { };
166+
165167 fetchgit = callPackage ../build-support/fetchgit {
166168 git = gitMinimal;
167169 };