Update justfile to use nixos-rebuild-ng by default
This commit is contained in:
parent
f2a0da8827
commit
879183b13b
5 changed files with 29 additions and 20 deletions
|
@ -1,10 +1,11 @@
|
||||||
{ pkgs, ... }:
|
{ pkgs, upkgs, ... }:
|
||||||
pkgs.mkShell {
|
pkgs.mkShell {
|
||||||
packages = with pkgs; [
|
packages = [
|
||||||
just
|
pkgs.just # script runner
|
||||||
python3
|
pkgs.python3 # used throughout a bunch of just recipes
|
||||||
sops
|
pkgs.sops # just sops-rekey
|
||||||
ssh-to-age
|
pkgs.ssh-to-age # just ssh-to-age
|
||||||
age
|
pkgs.age # just age-public-key
|
||||||
|
upkgs.nixos-rebuild-ng
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
@ -106,7 +106,7 @@
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
"Google".metaData.alias = "@g";
|
"google".metaData.alias = "@g";
|
||||||
}
|
}
|
||||||
// lib.attrsets.mapAttrs (_: mkBasicSearchEngine) (lib.importTOML ./engines.toml);
|
// lib.attrsets.mapAttrs (_: mkBasicSearchEngine) (lib.importTOML ./engines.toml);
|
||||||
# }}}
|
# }}}
|
||||||
|
|
|
@ -53,3 +53,4 @@ observenat/!
|
||||||
SHA256
|
SHA256
|
||||||
Fatalis
|
Fatalis
|
||||||
CNAME
|
CNAME
|
||||||
|
homotopically
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# This handles audio stuff
|
# This handles audio stuff
|
||||||
{
|
{
|
||||||
security.rtkit.enable = true;
|
security.rtkit.enable = true;
|
||||||
hardware.pulseaudio.enable = false;
|
services.pulseaudio.enable = false;
|
||||||
|
|
||||||
services.pipewire = {
|
services.pipewire = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
29
justfile
29
justfile
|
@ -5,12 +5,13 @@ default:
|
||||||
hostname := `hostname`
|
hostname := `hostname`
|
||||||
|
|
||||||
# {{{ Nixos rebuilds
|
# {{{ Nixos rebuilds
|
||||||
[doc("Wrapper around `nixos-rebuild`, taking care of the generic arguments")]
|
[doc("Wrapper around `nixos-rebuild`")]
|
||||||
[group("nix")]
|
[group("nix")]
|
||||||
nixos-rebuild action="switch" host=hostname:
|
nixos-rebuild action="switch" host=hostname ng="1":
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
|
ng = "{{ng}}" != "0"
|
||||||
host = "{{host}}"
|
host = "{{host}}"
|
||||||
users = {
|
users = {
|
||||||
'tethys': 'adrielus',
|
'tethys': 'adrielus',
|
||||||
|
@ -19,25 +20,31 @@ nixos-rebuild action="switch" host=hostname:
|
||||||
}
|
}
|
||||||
|
|
||||||
args = [
|
args = [
|
||||||
"nixos-rebuild",
|
"nixos-rebuild-ng" if ng else "nixos-rebuild",
|
||||||
"{{action}}",
|
"{{action}}",
|
||||||
"--show-trace",
|
"--show-trace",
|
||||||
"--fast",
|
|
||||||
"--accept-flake-config",
|
"--accept-flake-config",
|
||||||
"--flake",
|
"--flake",
|
||||||
".#{{host}}"
|
".#{{host}}",
|
||||||
|
"--no-reexec" if ng else "--fast"
|
||||||
]
|
]
|
||||||
|
|
||||||
if "{{host}}" == "{{hostname}}":
|
if host == "{{hostname}}":
|
||||||
print("🧬 Switching nixos configuration (locally) for '{{BLUE + host + NORMAL}}'")
|
print("🧬 Switching nixos configuration (locally) for '{{BLUE + host + NORMAL}}'")
|
||||||
args = ["sudo", *args]
|
args = [ "sudo", *args ]
|
||||||
else:
|
else:
|
||||||
print("🧬 Switching nixos configuration (remotely) for '{{BLUE + host + NORMAL}}'")
|
print("🧬 Switching nixos configuration (remotely) for '{{BLUE + host + NORMAL}}'")
|
||||||
args.append("--use-remote-sudo")
|
args += [ "--target-host", f"{users[host]}@{host}" ]
|
||||||
args += ["--target-host", f"{users[host]}@{host}"]
|
if ng:
|
||||||
|
args += [ "--sudo", "--ask-sudo-password" ]
|
||||||
|
else:
|
||||||
|
args += [ "--use-remote-sudo" ]
|
||||||
|
|
||||||
subprocess.run(args, check=True)
|
try:
|
||||||
print("🚀 All done!")
|
subprocess.run(args, check=True)
|
||||||
|
print("🚀 All done!")
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
print("🪓 Command cancelled")
|
||||||
# }}}
|
# }}}
|
||||||
# {{{ Miscellaneous nix commands
|
# {{{ Miscellaneous nix commands
|
||||||
[doc("Build the custom ISO provided by the flake")]
|
[doc("Build the custom ISO provided by the flake")]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue