Make deployment work again on cobalt
This commit is contained in:
parent
53b8448159
commit
6e433cff6f
7 changed files with 71 additions and 58 deletions
8
Justfile
8
Justfile
|
|
@ -1,6 +1,5 @@
|
|||
set shell := ["bash", "-c"]
|
||||
editor := env('EDITOR')
|
||||
rebuild := if os() == "linux" { "nixos-rebuild" } else { "darwin-rebuild" }
|
||||
|
||||
default:
|
||||
@just --list --justfile {{justfile()}}
|
||||
|
|
@ -10,7 +9,12 @@ default:
|
|||
# Runs `nixos-rebuild` or `darwin-rebuild` depending on the OS
|
||||
[group('nix')]
|
||||
deploy:
|
||||
sudo {{rebuild}} switch --flake .
|
||||
{{if os() == "linux" { \
|
||||
"nixos-rebuild switch --flake . --sudo" \
|
||||
} else { \
|
||||
"sudo darwin-rebuild switch --flake ." \
|
||||
} \
|
||||
}}
|
||||
|
||||
europium:
|
||||
nixos-rebuild switch --flake .#europium --target-host europium --build-host europium --use-remote-sudo
|
||||
|
|
|
|||
|
|
@ -12,9 +12,7 @@
|
|||
./misc/gaming.nix
|
||||
./misc/onedrive.nix
|
||||
./misc/everything.nix # TODO: Determine if we really always want all these programs or they should be composable
|
||||
./global/terminal
|
||||
./global/current-packages.nix
|
||||
./editors/helix
|
||||
./editors/jetbrains
|
||||
]
|
||||
++ (import ./config.nix all);
|
||||
|
|
|
|||
|
|
@ -1,42 +0,0 @@
|
|||
{pkgs, ...}: let
|
||||
# The command to run in order to shut down the computer
|
||||
command = "${pkgs.systemd}/bin/systemctl poweroff -i";
|
||||
|
||||
# Write this command into a shell script
|
||||
bin = pkgs.writeShellScriptBin "shutdown" command;
|
||||
in {
|
||||
users.users.hass = {
|
||||
isNormalUser = true;
|
||||
home = "/home/hass";
|
||||
description = "HomeAssistant automations";
|
||||
extraGroups = [];
|
||||
openssh.authorizedKeys.keys = ["ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICzLKowPwiQtAIgrY1wSvdolcDkbXokWrda//EEzQfR5 root@homeassistant"];
|
||||
};
|
||||
|
||||
# Create a symlink to the shell script we created to the absolute path
|
||||
# /etc/shutdown-script
|
||||
environment.etc.shutdown-script.source = "${bin}/bin/shutdown";
|
||||
|
||||
security.sudo.extraRules = [
|
||||
{
|
||||
users = ["hass"];
|
||||
commands = [
|
||||
{
|
||||
# Allow the 'hass' user to run the shutdown script
|
||||
command = "/etc/shutdown-script";
|
||||
options = ["NOPASSWD"];
|
||||
}
|
||||
];
|
||||
}
|
||||
];
|
||||
|
||||
# Allow the 'hass' user to log in, but not via password authentication.
|
||||
# The authorized key is specified above.
|
||||
services.openssh = {
|
||||
enable = true;
|
||||
settings = {
|
||||
PasswordAuthentication = false;
|
||||
AllowUsers = ["hass"];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
{pkgs, ...}: {
|
||||
services.openssh = {
|
||||
enable = true;
|
||||
settings = {
|
||||
PasswordAuthentication = false;
|
||||
AllowUsers = ["christopher"];
|
||||
};
|
||||
};
|
||||
}
|
||||
5
modules/nixos/services/default.nix
Normal file
5
modules/nixos/services/default.nix
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
{...}: {
|
||||
imports = [
|
||||
./shutdown.nix
|
||||
];
|
||||
}
|
||||
58
modules/nixos/services/shutdown.nix
Normal file
58
modules/nixos/services/shutdown.nix
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
{
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
# The command to run in order to shut down the computer
|
||||
command = "${pkgs.systemd}/bin/systemctl poweroff -i";
|
||||
|
||||
# Write this command into a shell script
|
||||
bin = pkgs.writeShellScriptBin "shutdown" command;
|
||||
|
||||
cfg = config.services.homeassistant-shutdown;
|
||||
in {
|
||||
options.services = {
|
||||
homeassistant-shutdown = {
|
||||
enable = mkEnableOption "HomeAssistant shutdown service";
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
users.users.hass = {
|
||||
isNormalUser = true;
|
||||
home = "/home/hass";
|
||||
description = "HomeAssistant automations";
|
||||
extraGroups = [];
|
||||
openssh.authorizedKeys.keys = ["ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICzLKowPwiQtAIgrY1wSvdolcDkbXokWrda//EEzQfR5 root@homeassistant"];
|
||||
};
|
||||
|
||||
# Create a symlink to the shell script we created to the absolute path
|
||||
# /etc/shutdown-script
|
||||
environment.etc.shutdown-script.source = "${bin}/bin/shutdown";
|
||||
|
||||
security.sudo.extraRules = [
|
||||
{
|
||||
users = ["hass"];
|
||||
commands = [
|
||||
{
|
||||
# Allow the 'hass' user to run the shutdown script
|
||||
command = "/etc/shutdown-script";
|
||||
options = ["NOPASSWD"];
|
||||
}
|
||||
];
|
||||
}
|
||||
];
|
||||
|
||||
# Allow the 'hass' user to log in, but not via password authentication.
|
||||
# The authorized key is specified above.
|
||||
services.openssh = {
|
||||
enable = true;
|
||||
settings = {
|
||||
PasswordAuthentication = false;
|
||||
AllowUsers = ["hass"];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -19,9 +19,6 @@ with lib._elements; {
|
|||
./beszel-agent.nix
|
||||
|
||||
./wayland.nix
|
||||
|
||||
# TODO: Add config settings like "services.shutdown.enable = true;"
|
||||
"${inputs.self}/modules/nixos/common/services/shutdown.nix"
|
||||
];
|
||||
|
||||
elements = {
|
||||
|
|
@ -95,6 +92,8 @@ with lib._elements; {
|
|||
# Bluetooth manager
|
||||
blueman.enable = true;
|
||||
|
||||
homeassistant-shutdown.enable = true;
|
||||
|
||||
pulseaudio.enable = true;
|
||||
pulseaudio.support32Bit = true;
|
||||
pipewire.enable = lib.mkForce false;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue