add index download function to bash

This commit is contained in:
Rouven Seifert 2023-04-14 11:56:42 +02:00
parent 889c6939cf
commit be735ec0e7
Signed by: rouven.seifert
GPG key ID: B95E8FE6B11C4D09
2 changed files with 13 additions and 0 deletions

12
shared/bash.nix Normal file
View file

@ -0,0 +1,12 @@
{ ... }:
{
programs.bash.shellInit = ''
download_nixpkgs_cache_index () {
filename="index-$(uname -m)-$(uname | tr A-Z a-z)"
mkdir -p ~/.cache/nix-index && cd ~/.cache/nix-index
# -N will only download a new version if there is an update.
wget -q -N https://github.com/Mic92/nix-index-database/releases/latest/download/$filename
ln -f $filename files
}
'';
}

View file

@ -1,6 +1,7 @@
{ ... }: { ... }:
{ {
imports = [ imports = [
./bash.nix
./caches.nix ./caches.nix
./gpg.nix ./gpg.nix
./sops.nix ./sops.nix