dotfiles/update.sh
chayleaf 69ce2ffdbc store secrets separate from this flake
This uses a native plugin (pkgs.nix-plugins) to avoid using --impure,
other options involving secret files are too limited for my use case as
I need eval-time access to secrets. Moving it to a private flake is
another option, but Nix flakes are poorly suited for non-monorepos.
Previously I just renamed .git to .git.bak to make sure Nix pulls the
"private" subdir into store as well, but this new system may be more
robust and can be extended to way be more secure in the future (e.g.
right now I copy the secret .nix files to store, but in general there's
no need to do that).

Of course the main drawback is that now I require a plugin for this
flake to work.
2023-05-26 00:46:38 +07:00

16 lines
728 B
Bash
Executable file

#!/usr/bin/env bash
cp ~/.config/nixpkgs/overlays.nix ./overlays.nix || (mkdir -p ~/.config/nixpkgs && cp ./overlays.nix ~/.config/nixpkgs)
nvfetcher \
-o ./pkgs/_sources \
-c ./pkgs/nvfetcher.toml || echo "failed to update nvfetcher sources"
mozilla-addons-to-nix \
./pkgs/firefox-addons/addons.json \
./pkgs/firefox-addons/generated.nix || echo "failed to update firefox addons"
nix flake update
if [ -z ${SUDO_ASKPASS+x} ]; then
sudo nixos-rebuild switch --flake . --option extra-builtins-file "$(pwd)/extra-builtins.nix"
else
sudo -A nixos-rebuild switch --flake . --option extra-builtins-file "$(pwd)/extra-builtins.nix"
fi
home-manager switch --flake . --option extra-builtins-file "$(pwd)/extra-builtins.nix"