From be735ec0e7b1612eb409eae1672b1853c647e35c Mon Sep 17 00:00:00 2001 From: Rouven Seifert Date: Fri, 14 Apr 2023 11:56:42 +0200 Subject: [PATCH] add index download function to bash --- shared/bash.nix | 12 ++++++++++++ shared/default.nix | 1 + 2 files changed, 13 insertions(+) create mode 100644 shared/bash.nix diff --git a/shared/bash.nix b/shared/bash.nix new file mode 100644 index 0000000..9f66b29 --- /dev/null +++ b/shared/bash.nix @@ -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 + } + ''; +} diff --git a/shared/default.nix b/shared/default.nix index 0f1bb04..c022965 100644 --- a/shared/default.nix +++ b/shared/default.nix @@ -1,6 +1,7 @@ { ... }: { imports = [ + ./bash.nix ./caches.nix ./gpg.nix ./sops.nix