38 lines
919 B
Nix
38 lines
919 B
Nix
{ pkgs, config, ... }:
|
|
let
|
|
ulf = pkgs.writers.writePython3 "update-local-flakes" {
|
|
} (builtins.readFile ./update-local-flakes.py);
|
|
in
|
|
{
|
|
home.packages = [
|
|
(pkgs.writeShellApplication {
|
|
name = "rb";
|
|
text = ''
|
|
verb="switch"
|
|
if [ "$#" -ge 1 ]
|
|
then
|
|
verb="$1"
|
|
shift
|
|
fi
|
|
nixos_flake="/etc/nixos/flake.nix"
|
|
if [ -f "$nixos_flake" ]
|
|
then
|
|
sudo ${ulf} "$nixos_flake"
|
|
if [ "$verb" = "switch" ] || [ "$verb" = "test" ]
|
|
then
|
|
sudo nixos-rebuild "$verb" --specialisation ${config.frogeye.polarity} "$@"
|
|
else
|
|
sudo nixos-rebuild "$verb" "$@"
|
|
fi
|
|
fi
|
|
hm_flake="${config.xdg.configHome}/home-manager/flake.nix"
|
|
if [ -f "$hm_flake" ]
|
|
then
|
|
${ulf} "$hm_flake"
|
|
home-manager "$verb" "$@"
|
|
fi
|
|
'';
|
|
})
|
|
];
|
|
}
|