git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #17837 from MostAwesomeDude/fossil

build-support: Add fetchfossil function.

commit76dca3d0e067eb924c7e74b0c58d12672fdcdf37 authorDomen Kožar <domen@dev.si> dateSun 21 Aug 2016, 21:47 (10 years ago) parent36f851876b74ab
3 files changed+44
pkgs/build-support/fetchfossil/builder.sh+22 pkgs/build-support/fetchfossil/default.nix+20 pkgs/top-level/all-packages.nix+2
pkgs/build-support/fetchfossil/builder.shnew file+22
@@ -0,0 +1,22 @@
1+source $stdenv/setup
2+header "Cloning Fossil $url [$rev] 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+# Instead, we'll let it write to the build directory.
7+export HOME=$(pwd)
8+
9+# We must explicitly set the admin user for the clone to something reasonable.
10+fossil clone -A nobody "$url" fossil-clone.fossil
11+
12+mkdir fossil-clone
13+WORKDIR=$(pwd)
14+mkdir $out
15+pushd $out
16+fossil open "$WORKDIR/fossil-clone.fossil" "$rev"
17+popd
18+
19+# Just nuke the checkout file.
20+rm $out/.fslckout
21+
22+stopNest
pkgs/build-support/fetchfossil/default.nixnew file+20
@@ -0,0 +1,20 @@
1+{stdenv, fossil}:
2+
3+{name ? null, url, rev, sha256}:
4+
5+stdenv.mkDerivation {
6+ name = "fossil-archive" + (if name != null then "-${name}" else "");
7+ builder = ./builder.sh;
8+ buildInputs = [fossil];
9+
10+ # Envvar docs are hard to find. A link for the future:
11+ # https://www.fossil-scm.org/index.html/doc/trunk/www/env-opts.md
12+ impureEnvVars = [ "http_proxy" ];
13+
14+ outputHashAlgo = "sha256";
15+ outputHashMode = "recursive";
16+ outputHash = sha256;
17+
18+ inherit url rev;
19+ preferLocalBuild = true;
20+}
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 };