2024-01-07 12:54:43 +01:00
|
|
|
{ pkgs, config, ... }:
|
|
|
|
{
|
|
|
|
home.packages = [
|
|
|
|
(pkgs.writeShellApplication {
|
|
|
|
name = "rb";
|
|
|
|
text = ''
|
|
|
|
verb="switch"
|
|
|
|
if [ "$#" -ge 1 ]
|
|
|
|
then
|
|
|
|
verb="$1"
|
|
|
|
shift
|
|
|
|
fi
|
2024-06-10 02:11:04 +02:00
|
|
|
nixos_flake="$(readlink -f /etc/nixos)"
|
|
|
|
if [ -f "$nixos_flake/flake.nix" ]
|
2024-01-07 12:54:43 +01:00
|
|
|
then
|
2024-06-17 15:23:25 +02:00
|
|
|
# TODO For extensions this only works on systems where the flake has been resolved
|
2024-06-10 02:11:04 +02:00
|
|
|
nix run "$nixos_flake#updateLocalFlakes" -- "$nixos_flake"
|
|
|
|
nix run "$nixos_flake#nixosRebuild" -- "$verb" "$@"
|
2024-01-16 22:39:29 +01:00
|
|
|
fi
|
2024-06-10 02:11:04 +02:00
|
|
|
# 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"
|
|
|
|
# home-manager "$verb" "$@"
|
|
|
|
# fi
|
|
|
|
# nod_flake="${config.xdg.configHome}/nix-on-droid/flake.nix"
|
|
|
|
# if [ -f "$nod_flake" ]
|
|
|
|
# then
|
|
|
|
# {ulf} "$nod_flake"
|
|
|
|
# nix-on-droid "$verb" --flake "$(dirname "$nod_flake")" "$@"
|
|
|
|
# fi
|
2024-01-07 12:54:43 +01:00
|
|
|
'';
|
|
|
|
})
|
|
|
|
];
|
|
|
|
}
|