3
0
Fork 0
forked from mirrors/nixpkgs

Merge pull request #244010 from majiru/add-fetch9front

fetch9front: init
This commit is contained in:
Pol Dellaiera 2023-07-29 08:28:24 +02:00 committed by GitHub
commit 83085359e3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 69 additions and 10 deletions

View file

@ -0,0 +1,36 @@
{ fetchgit, fetchzip, lib }:
lib.makeOverridable (
{ owner
, repo
, rev
, domain ? "git.9front.org"
, name ? "source"
, leaveDotGit ? false
, deepClone ? false
, ... # For hash agility
} @ args:
let
passthruAttrs = removeAttrs args [ "domain" "owner" "repo" "rev" "leaveDotGit" "deepClone" ];
useFetchGit = leaveDotGit || deepClone;
fetcher = if useFetchGit then fetchgit else fetchzip;
gitRepoUrl = "git://${domain}/${owner}/${repo}";
fetcherArgs = (if useFetchGit then {
# git9 does not support shallow fetches
inherit rev leaveDotGit;
url = gitRepoUrl;
} else {
url = "https://${domain}/${owner}/${repo}/${rev}/snap.tar.gz";
passthru = {
inherit gitRepoUrl;
};
}) // passthruAttrs // { inherit name; };
in
fetcher fetcherArgs // { inherit rev; }
)

View file

@ -12,6 +12,7 @@
, branch ? null
, stableVersion ? false # Use version format according to RFC 107 (i.e. LAST_TAG+date=YYYY-MM-DD)
, tagPrefix ? "" # strip this prefix from a tag name when using stable version
, shallowClone ? true
}:
let
@ -22,6 +23,7 @@ let
branch=""
use_stable_version=""
tag_prefix=""
shallow_clone=""
while (( $# > 0 )); do
flag="$1"
@ -39,6 +41,9 @@ let
--tag-prefix=*)
tag_prefix="''${flag#*=}"
;;
--shallow-clone)
shallow_clone=1
;;
*)
echo "$0: unknown option ''${flag}"
exit 1
@ -58,9 +63,12 @@ let
cloneArgs=(
--bare
--depth=1
)
if [[ "$shallow_clone" == "1" ]]; then
cloneArgs+=(--depth=1)
fi
if [[ -n "$branch" ]]; then
cloneArgs+=(--branch="$branch")
fi
@ -101,7 +109,8 @@ let
--rev="$commit_sha"
'';
in [
in
[
updateScript
"--url=${builtins.toString url}"
] ++ lib.optionals (branch != null) [
@ -109,4 +118,6 @@ in [
] ++ lib.optionals stableVersion [
"--use-stable-version"
"--tag-prefix=${tagPrefix}"
] ++ lib.optionals shallowClone [
"--shallow-clone"
]

View file

@ -1,6 +1,7 @@
{ lib
, stdenv
, fetchgit
, fetchFrom9Front
, unstableGitUpdater
, byacc
, installShellFiles
}:
@ -9,8 +10,10 @@ stdenv.mkDerivation {
pname = "rc-9front";
version = "unstable-2022-11-01";
src = fetchgit {
url = "git://shithub.us/cinap_lenrek/rc";
src = fetchFrom9Front {
domain = "shithub.us";
owner = "cinap_lenrek";
repo = "rc";
rev = "69041639483e16392e3013491fcb382efd2b9374";
hash = "sha256-xc+EfC4bc9ZA97jCQ6CGCzeLGf+Hx3/syl090/x4ew4=";
};
@ -31,7 +34,10 @@ stdenv.mkDerivation {
install -m644 rcmain.unix $out/lib/rcmain
'';
passthru.shellPath = "/bin/rc";
passthru = {
shellPath = "/bin/rc";
updateScript = unstableGitUpdater { shallowClone = false; };
};
meta = with lib; {
description = "The 9front shell";

View file

@ -1,6 +1,7 @@
{ stdenv
, lib
, fetchgit
, fetchFrom9Front
, unstableGitUpdater
, installShellFiles
, makeWrapper
, xorg
@ -19,10 +20,11 @@ stdenv.mkDerivation {
pname = "drawterm";
version = "unstable-2023-06-27";
src = fetchgit {
url = "git://git.9front.org/plan9front/drawterm";
src = fetchFrom9Front {
owner = "plan9front";
repo = "drawterm";
rev = "36debf46ac184a22c6936345d22e4cfad995948c";
sha256 = "ebqw1jqeRC0FWeUIO/HaEovuwzU6+B48TjZbVJXByvA=";
hash = "sha256-ebqw1jqeRC0FWeUIO/HaEovuwzU6+B48TjZbVJXByvA=";
};
enableParallelBuilding = true;
@ -54,6 +56,8 @@ stdenv.mkDerivation {
installManPage drawterm.1
'';
passthru.updateScript = unstableGitUpdater { shallowClone = false; };
meta = with lib; {
description = "Connect to Plan 9 CPU servers from other operating systems.";
homepage = "https://drawterm.9front.org/";

View file

@ -1163,6 +1163,8 @@ with pkgs;
fetchFromGitiles = callPackage ../build-support/fetchgitiles { };
fetchFrom9Front = callPackage ../build-support/fetch9front { };
fetchFromRepoOrCz = callPackage ../build-support/fetchrepoorcz { };
fetchgx = callPackage ../build-support/fetchgx { };