mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-17 15:22:59 +01:00
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.
This commit is contained in:
parent
c89959e625
commit
20a0e2e3bf
3 changed files with 44 additions and 0 deletions
21
pkgs/build-support/fetchfossil/builder.sh
Normal file
21
pkgs/build-support/fetchfossil/builder.sh
Normal file
|
@ -0,0 +1,21 @@
|
|||
source $stdenv/setup
|
||||
header "Cloning Fossil $url into $out"
|
||||
|
||||
# Fossil, bless its adorable little heart, wants to write global configuration
|
||||
# to $HOME/.fossil. AFAICT, there is no way to disable this functionality.
|
||||
export HOME=.
|
||||
|
||||
# We must explicitly set the admin user for the clone to something reasonable.
|
||||
fossil clone -A nobody "$url" fossil-clone.fossil
|
||||
|
||||
mkdir fossil-clone
|
||||
WORKDIR=$(pwd)
|
||||
mkdir $out
|
||||
pushd $out
|
||||
fossil open "$WORKDIR/fossil-clone.fossil"
|
||||
popd
|
||||
|
||||
# Just nuke the checkout file.
|
||||
rm $out/.fslckout
|
||||
|
||||
stopNest
|
21
pkgs/build-support/fetchfossil/default.nix
Normal file
21
pkgs/build-support/fetchfossil/default.nix
Normal file
|
@ -0,0 +1,21 @@
|
|||
{stdenv, fossil}:
|
||||
|
||||
{name ? null, url, rev ? null, md5 ? null, sha256 ? null}:
|
||||
|
||||
# TODO: statically check if mercurial as the https support if the url starts woth https.
|
||||
stdenv.mkDerivation {
|
||||
name = "fossil-archive" + (if name != null then "-${name}" else "");
|
||||
builder = ./builder.sh;
|
||||
buildInputs = [fossil];
|
||||
|
||||
impureEnvVars = [
|
||||
"http_proxy" "https_proxy" "ftp_proxy" "all_proxy" "no_proxy"
|
||||
];
|
||||
|
||||
outputHashAlgo = if md5 != null then "md5" else "sha256";
|
||||
outputHashMode = "recursive";
|
||||
outputHash = if md5 != null then md5 else sha256;
|
||||
|
||||
inherit url rev;
|
||||
preferLocalBuild = true;
|
||||
}
|
|
@ -162,6 +162,8 @@ in
|
|||
|
||||
fetchdarcs = callPackage ../build-support/fetchdarcs { };
|
||||
|
||||
fetchfossil = callPackage ../build-support/fetchfossil { };
|
||||
|
||||
fetchgit = callPackage ../build-support/fetchgit {
|
||||
git = gitMinimal;
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue