changes 08-09-25

This commit is contained in:
2025-08-09 23:20:12 -04:00
parent 4e44a1618b
commit 09302c1562
22 changed files with 145 additions and 79 deletions

View File

@@ -0,0 +1,36 @@
{ pkgs ? import <nixpkgs> { } }:
pkgs.writeShellApplication {
name = "fetchfromgh";
runtimeInputs = [ pkgs.nix-prefetch-scripts ];
text = ''
if [ $# -ne 1 ] || ! echo "$1" | grep -qE "[A-Za-z0-9_-]+/[A-Za-z0-9_-]+"; then
echo "Usage: fetchfromgh someuser/somerepo"
echo " - i.e. fetchfromgh pagedMov/nixos-config"
exit 1
fi
if ! curl -s -o /dev/null -w "%{http_code}" "https://github.com/$1" | grep -q "200"; then
echo "Couldn't find that repository, curl returned 404."
exit 1
fi
json=$(nix-prefetch-git --quiet "https://github.com/$1")
url=$(echo "$json" | jq '.url' | tr -d '"')
owner=$(echo "$url" | awk -F'/' '{print $(NF-1)}')
repo=$(echo "$url" | awk -F'/' '{print $NF}')
rev=$(echo "$json" | jq '.rev' | tr -d '"')
hash=$(echo "$json" | jq '.hash' | tr -d '"')
output="\
src = pkgs.fetchFromGitHub {
owner = \"$owner\";
repo = \"$repo\";
rev = \"$rev\";
hash = \"$hash\";
};
"
echo "$output"
'';
}

View File

@@ -0,0 +1,19 @@
{ pkgs ? import <nixpkgs> { } }:
pkgs.writeShellApplication {
name = "mkshell";
runtimeInputs = [];
text = ''
command cat <<EOF
devShells.\''${system}.default = pkgs.mkShell {
buildInputs = with pkgs; [
];
shellHook = '''
export SHELL=\''${pkgs.zsh}/bin/zsh
exec \''${pkgs.zsh}/bin/zsh
''';
};
EOF
'';
}