sane-clone: init

script to "git clone" a nix packages source code
This commit is contained in:
Colin 2023-11-24 21:27:08 +00:00
parent 37a95b97f6
commit 9ccbfd8bf0
3 changed files with 27 additions and 0 deletions

View File

@ -20,6 +20,7 @@ in
"sane-scripts.bt-show"
];
"sane-scripts.dev" = declPackageSet [
"sane-scripts.clone"
"sane-scripts.dev-cargo-loop"
"sane-scripts.git-init"
];

View File

@ -66,6 +66,11 @@ let
pyPkgs = [ "sane-lib.bt" ];
pkgs = [ "sane-scripts.lib.bt.propagatedBuildInputs" ];
};
clone = static-nix-shell.mkBash {
pname = "sane-clone";
src = ./src;
pkgs = [ "jq" "nix" ];
};
deadlines = static-nix-shell.mkBash {
pname = "sane-deadlines";
src = ./src;

View File

@ -0,0 +1,21 @@
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p jq -p nix
# use like `eval $(sane-clone tuba)` to clone and cd into a tuba checkout
srcattr="$1.src"
basedir=/home/colin/ref/repos
repourl="$(nix eval nixpkgs#$srcattr.gitRepoUrl | jq --raw-output)"
repoowner="$(nix eval nixpkgs#$srcattr.owner | jq --raw-output)"
reponame="$(nix eval nixpkgs#$srcattr.repo | jq --raw-output)"
ownerdir="$basedir/$repoowner"
clonedir="$ownerdir/$reponame"
mkdir -p "$ownerdir"
git clone "$repourl" "$clonedir"
# drop the user into the checkout
echo "cd $clonedir"
cd "$clonedir"