Moved scripts to the overlay folder to be used as packages

All scripts have been moved to the overlay folder in the top level directory

Overlay is now instantiated per configuration to make use of the host variable
This commit is contained in:
2024-11-16 03:42:07 -05:00
parent 2a2263d4cb
commit 8c007c3915
27 changed files with 200 additions and 175 deletions

View File

@@ -0,0 +1,35 @@
{ pkgs ? import <nixpkgs> { } }:
let
nixpkgs_toplevel = pkgs.fetchFromGitHub {
owner = "NixOS";
repo = "nixpkgs";
rev = "63dacb46bf939521bdc93981b4cbb7ecb58427a0";
hash = "sha256-vboIEwIQojofItm2xGCdZCzW96U85l9nDW3ifMuAIdM=";
};
in pkgs.writeShellApplication {
name = "vipkg";
runtimeInputs = with pkgs; [ coreutils fd ripgrep fzf ];
text = ''
[ ! $# -eq 1 ] && echo "Usage: vipkg <nixpkgs package name>" && exit 1
results=$(find "${nixpkgs_toplevel}/pkgs" -wholename "*$1*" -exec find {} \; | sort | uniq | rg '\.nix$')
numresults=$(echo "$results" | wc -l)
[ "$numresults" -eq 0 ] && echo "$1 not found in ${nixpkgs_toplevel}/pkgs" && exit 1
if [ "$numresults" -gt 1 ]; then
results=$(echo "$results" | awk -F"${nixpkgs_toplevel}/pkgs/" '{print $2}')
file=$(echo "$results" | fzf)
full_path="${nixpkgs_toplevel}/pkgs/$file"
nvim "$full_path"
else
result_path=$(echo "$results" | awk -F"${nixpkgs_toplevel}/pkgs/" '{print $2}')
full_path="${nixpkgs_toplevel}/pkgs/$result_path"
nvim "$full_path"
fi
'';
}