update-local-flakes: Make available as package

If extensions have their lock file updated in some cases,
running .#updateLocalFlakes will not work.
This commit is contained in:
Geoffrey Frogeye 2024-06-17 18:21:09 +02:00
parent c4058e8102
commit 0d047d3e46
Signed by: geoffrey
GPG key ID: C72403E7F82E6AD8
5 changed files with 17 additions and 7 deletions

View file

@ -1,6 +1,7 @@
{ pkgs, config, ... }:
{
home.packages = [
pkgs.update-local-flakes
(pkgs.writeShellApplication {
name = "rb";
text = ''
@ -13,21 +14,20 @@
nixos_flake="$(readlink -f /etc/nixos)"
if [ -f "$nixos_flake/flake.nix" ]
then
# TODO For extensions this only works on systems where the flake has been resolved
nix run "$nixos_flake#updateLocalFlakes" -- "$nixos_flake"
update-local-flakes "$nixos_flake"
nix run "$nixos_flake#nixosRebuild" -- "$verb" "$@"
fi
# TODO Fix nix-on-droid and home-manager
# hm_flake="${config.xdg.configHome}/home-manager/flake.nix"
# if [ -f "$hm_flake" ]
# then
# {ulf} "$hm_flake"
# update-local-flakes "$hm_flake"
# home-manager "$verb" "$@"
# fi
# nod_flake="${config.xdg.configHome}/nix-on-droid/flake.nix"
# if [ -f "$nod_flake" ]
# then
# {ulf} "$nod_flake"
# update-local-flakes "$nod_flake"
# nix-on-droid "$verb" --flake "$(dirname "$nod_flake")" "$@"
# fi
'';