sane-clone: init
script to "git clone" a nix packages source code
This commit is contained in:
parent
37a95b97f6
commit
9ccbfd8bf0
|
@ -20,6 +20,7 @@ in
|
||||||
"sane-scripts.bt-show"
|
"sane-scripts.bt-show"
|
||||||
];
|
];
|
||||||
"sane-scripts.dev" = declPackageSet [
|
"sane-scripts.dev" = declPackageSet [
|
||||||
|
"sane-scripts.clone"
|
||||||
"sane-scripts.dev-cargo-loop"
|
"sane-scripts.dev-cargo-loop"
|
||||||
"sane-scripts.git-init"
|
"sane-scripts.git-init"
|
||||||
];
|
];
|
||||||
|
|
|
@ -66,6 +66,11 @@ let
|
||||||
pyPkgs = [ "sane-lib.bt" ];
|
pyPkgs = [ "sane-lib.bt" ];
|
||||||
pkgs = [ "sane-scripts.lib.bt.propagatedBuildInputs" ];
|
pkgs = [ "sane-scripts.lib.bt.propagatedBuildInputs" ];
|
||||||
};
|
};
|
||||||
|
clone = static-nix-shell.mkBash {
|
||||||
|
pname = "sane-clone";
|
||||||
|
src = ./src;
|
||||||
|
pkgs = [ "jq" "nix" ];
|
||||||
|
};
|
||||||
deadlines = static-nix-shell.mkBash {
|
deadlines = static-nix-shell.mkBash {
|
||||||
pname = "sane-deadlines";
|
pname = "sane-deadlines";
|
||||||
src = ./src;
|
src = ./src;
|
||||||
|
|
21
pkgs/additional/sane-scripts/src/sane-clone
Executable file
21
pkgs/additional/sane-scripts/src/sane-clone
Executable 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"
|
Loading…
Reference in New Issue
Block a user