1
Fork 0

Update justfile to use nixos-rebuild-ng by default

This commit is contained in:
prescientmoon 2025-06-11 23:59:12 +02:00
parent f2a0da8827
commit 879183b13b
Signed by: prescientmoon
SSH key fingerprint: SHA256:WFp/cO76nbarETAoQcQXuV+0h7XJsEsOCI0UsyPIy6U
5 changed files with 29 additions and 20 deletions
devshells
home/features
desktop/firefox
neovim/config/spell
hosts/nixos/common/optional
justfile

View file

@ -1,10 +1,11 @@
{ pkgs, ... }:
{ pkgs, upkgs, ... }:
pkgs.mkShell {
packages = with pkgs; [
just
python3
sops
ssh-to-age
age
packages = [
pkgs.just # script runner
pkgs.python3 # used throughout a bunch of just recipes
pkgs.sops # just sops-rekey
pkgs.ssh-to-age # just ssh-to-age
pkgs.age # just age-public-key
upkgs.nixos-rebuild-ng
];
}

View file

@ -106,7 +106,7 @@
};
in
{
"Google".metaData.alias = "@g";
"google".metaData.alias = "@g";
}
// lib.attrsets.mapAttrs (_: mkBasicSearchEngine) (lib.importTOML ./engines.toml);
# }}}

View file

@ -53,3 +53,4 @@ observenat/!
SHA256
Fatalis
CNAME
homotopically

View file

@ -1,7 +1,7 @@
# This handles audio stuff
{
security.rtkit.enable = true;
hardware.pulseaudio.enable = false;
services.pulseaudio.enable = false;
services.pipewire = {
enable = true;

View file

@ -5,12 +5,13 @@ default:
hostname := `hostname`
# {{{ Nixos rebuilds
[doc("Wrapper around `nixos-rebuild`, taking care of the generic arguments")]
[doc("Wrapper around `nixos-rebuild`")]
[group("nix")]
nixos-rebuild action="switch" host=hostname:
nixos-rebuild action="switch" host=hostname ng="1":
#!/usr/bin/env python3
import subprocess
ng = "{{ng}}" != "0"
host = "{{host}}"
users = {
'tethys': 'adrielus',
@ -19,25 +20,31 @@ nixos-rebuild action="switch" host=hostname:
}
args = [
"nixos-rebuild",
"nixos-rebuild-ng" if ng else "nixos-rebuild",
"{{action}}",
"--show-trace",
"--fast",
"--accept-flake-config",
"--flake",
".#{{host}}"
".#{{host}}",
"--no-reexec" if ng else "--fast"
]
if "{{host}}" == "{{hostname}}":
if host == "{{hostname}}":
print("🧬 Switching nixos configuration (locally) for '{{BLUE + host + NORMAL}}'")
args = [ "sudo", *args ]
else:
print("🧬 Switching nixos configuration (remotely) for '{{BLUE + host + NORMAL}}'")
args.append("--use-remote-sudo")
args += [ "--target-host", f"{users[host]}@{host}" ]
if ng:
args += [ "--sudo", "--ask-sudo-password" ]
else:
args += [ "--use-remote-sudo" ]
try:
subprocess.run(args, check=True)
print("🚀 All done!")
except KeyboardInterrupt:
print("🪓 Command cancelled")
# }}}
# {{{ Miscellaneous nix commands
[doc("Build the custom ISO provided by the flake")]