Use lnxlink in place of custom shutdown script
This commit is contained in:
parent
d04d3634a7
commit
722c44532d
10 changed files with 184 additions and 75 deletions
|
|
@ -1,6 +1,7 @@
|
||||||
{pkgs, ...}: {
|
{pkgs, ...}: {
|
||||||
home.packages = with pkgs; [
|
home.packages = with pkgs; [
|
||||||
firefox
|
firefox
|
||||||
|
vivaldi
|
||||||
];
|
];
|
||||||
|
|
||||||
xdg.mimeApps = {
|
xdg.mimeApps = {
|
||||||
|
|
@ -13,7 +14,7 @@
|
||||||
|
|
||||||
# profile-sync-daemon manages browser profiles in tmpfs
|
# profile-sync-daemon manages browser profiles in tmpfs
|
||||||
services.psd = {
|
services.psd = {
|
||||||
enable = true;
|
enable = false;
|
||||||
resyncTimer = "10m";
|
# resyncTimer = "10m";
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,7 @@
|
||||||
obs-studio # OBS Studio
|
obs-studio # OBS Studio
|
||||||
wasistlos # WhatsApp client
|
wasistlos # WhatsApp client
|
||||||
libreoffice # Productivity Suite (like Microsoft Office)
|
libreoffice # Productivity Suite (like Microsoft Office)
|
||||||
|
onlyoffice-bin # libreoffice alternative
|
||||||
cider # Apple Music player
|
cider # Apple Music player
|
||||||
filezilla # FTP Client
|
filezilla # FTP Client
|
||||||
zathura # Document viewer
|
zathura # Document viewer
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
{...}: {
|
{...}: {
|
||||||
imports = [
|
imports = [
|
||||||
./shutdown.nix
|
./lnxlink.nix
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
64
modules/nixos/services/lnxlink.nix
Normal file
64
modules/nixos/services/lnxlink.nix
Normal file
|
|
@ -0,0 +1,64 @@
|
||||||
|
{
|
||||||
|
pkgs,
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
inputs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
with lib; let
|
||||||
|
cfg = config.services.lnxlink;
|
||||||
|
|
||||||
|
lnxlink = pkgs.python3Packages.buildPythonApplication {
|
||||||
|
pname = "lnxlink";
|
||||||
|
version = "2025.7.0";
|
||||||
|
pyproject = true;
|
||||||
|
|
||||||
|
# Linking my fork here which allows for newer versions of setuptools and wheel.
|
||||||
|
# Also includes some fixes that make the program actually work with NixOS.
|
||||||
|
src = pkgs.fetchFromGitHub {
|
||||||
|
owner = "padarom";
|
||||||
|
repo = "lnxlink";
|
||||||
|
rev = "7202e48";
|
||||||
|
hash = "sha256-E2J1d9D5SJWGEutAPAo1BM98cMzH7QrqIz3yrlXpzGE=";
|
||||||
|
};
|
||||||
|
|
||||||
|
build-system = with pkgs.python3Packages; [setuptools wheel];
|
||||||
|
dependencies = with pkgs.python3Packages; [
|
||||||
|
distro
|
||||||
|
pyyaml
|
||||||
|
paho-mqtt
|
||||||
|
requests
|
||||||
|
psutil
|
||||||
|
inotify
|
||||||
|
jeepney
|
||||||
|
];
|
||||||
|
|
||||||
|
meta = {
|
||||||
|
homepage = "https://github.com/bkbilly/lnxlink";
|
||||||
|
description = "Effortlessly manage your Linux machine using MQTT.";
|
||||||
|
license = licenses.mit;
|
||||||
|
mainProgram = "lnxlink";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
in {
|
||||||
|
options.services = {
|
||||||
|
lnxlink = {
|
||||||
|
enable = mkEnableOption "Enable LNXlink";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
environment.systemPackages = [lnxlink];
|
||||||
|
|
||||||
|
systemd.services.lnxlink = {
|
||||||
|
enable = true;
|
||||||
|
wantedBy = ["multi-user.target"];
|
||||||
|
serviceConfig = {
|
||||||
|
# Note: Logging will also be done to the working directory, so logs will
|
||||||
|
# be lost upon a restart.
|
||||||
|
WorkingDirectory = "/tmp";
|
||||||
|
ExecStart = "${lnxlink}/bin/lnxlink -i -c ${./lnxlink.yaml}";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
84
modules/nixos/services/lnxlink.yaml
Normal file
84
modules/nixos/services/lnxlink.yaml
Normal file
|
|
@ -0,0 +1,84 @@
|
||||||
|
mqtt:
|
||||||
|
prefix: lnxlink
|
||||||
|
clientId: cobalt
|
||||||
|
server: nanomq.intern.muehl.dev
|
||||||
|
port: 1883
|
||||||
|
auth:
|
||||||
|
user: cobalt
|
||||||
|
pass: cobalt
|
||||||
|
tls: false
|
||||||
|
keyfile: ''
|
||||||
|
certfile: ''
|
||||||
|
ca_certs: ''
|
||||||
|
discovery:
|
||||||
|
enabled: true
|
||||||
|
lwt:
|
||||||
|
enabled: true
|
||||||
|
qos: 1
|
||||||
|
clear_on_off: true
|
||||||
|
update_interval: 5
|
||||||
|
update_on_change: false
|
||||||
|
hass_url: null
|
||||||
|
hass_api: null
|
||||||
|
modules: null
|
||||||
|
custom_modules: null
|
||||||
|
exclude:
|
||||||
|
- audio_select
|
||||||
|
- active_window
|
||||||
|
- bash
|
||||||
|
- battery
|
||||||
|
- beacondb
|
||||||
|
- bluetooth
|
||||||
|
- boot_select
|
||||||
|
- brightness
|
||||||
|
- fullscreen
|
||||||
|
- gpio
|
||||||
|
- gpu
|
||||||
|
- idle
|
||||||
|
- inference_time
|
||||||
|
- ir_remote
|
||||||
|
- keep_alive
|
||||||
|
- keyboard_hotkeys
|
||||||
|
- media
|
||||||
|
- mouse
|
||||||
|
- network
|
||||||
|
- notify
|
||||||
|
- power_profile
|
||||||
|
- restful
|
||||||
|
- screen_onoff
|
||||||
|
- screenshot
|
||||||
|
- send_keys
|
||||||
|
- speech_recognition
|
||||||
|
- systemd
|
||||||
|
- sys_updates
|
||||||
|
- steam
|
||||||
|
- wifi
|
||||||
|
- webcam
|
||||||
|
- xdg_open
|
||||||
|
- wol
|
||||||
|
- docker
|
||||||
|
settings:
|
||||||
|
systemd: null
|
||||||
|
gpio:
|
||||||
|
inputs: null
|
||||||
|
outputs: null
|
||||||
|
hotkeys: null
|
||||||
|
battery:
|
||||||
|
include_batteries: []
|
||||||
|
exclude_batteries: []
|
||||||
|
disk_usage:
|
||||||
|
include_disks: []
|
||||||
|
exclude_disks: []
|
||||||
|
statistics: https://analyzer.bkbilly.workers.dev
|
||||||
|
bash:
|
||||||
|
allow_any_command: false
|
||||||
|
expose: null
|
||||||
|
mounts:
|
||||||
|
autocheck: false
|
||||||
|
directories: []
|
||||||
|
ir_remote:
|
||||||
|
receiver: null
|
||||||
|
transmitter: null
|
||||||
|
buttons: []
|
||||||
|
restful:
|
||||||
|
port: 8112
|
||||||
|
|
@ -1,58 +0,0 @@
|
||||||
{
|
|
||||||
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"];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
5
packages/solidtime-desktop/default.nix
Normal file
5
packages/solidtime-desktop/default.nix
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
{pkgs, ...}:
|
||||||
|
pkgs.writeShellApplication {
|
||||||
|
name = "connect-to-mercury";
|
||||||
|
text = builtins.readFile ./connect-to-mercury;
|
||||||
|
}
|
||||||
|
|
@ -3,9 +3,7 @@
|
||||||
# Main tower workstation environment
|
# Main tower workstation environment
|
||||||
{
|
{
|
||||||
pkgs,
|
pkgs,
|
||||||
inputs,
|
|
||||||
lib,
|
lib,
|
||||||
config,
|
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
with lib._elements; {
|
with lib._elements; {
|
||||||
|
|
@ -39,6 +37,7 @@ with lib._elements; {
|
||||||
networking = {
|
networking = {
|
||||||
hostName = "cobalt";
|
hostName = "cobalt";
|
||||||
firewall.enable = false;
|
firewall.enable = false;
|
||||||
|
interfaces.eno1.wakeOnLan.enable = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
# Set your time zone.
|
# Set your time zone.
|
||||||
|
|
@ -88,7 +87,8 @@ with lib._elements; {
|
||||||
# Bluetooth manager
|
# Bluetooth manager
|
||||||
blueman.enable = true;
|
blueman.enable = true;
|
||||||
|
|
||||||
homeassistant-shutdown.enable = true;
|
# Linux link via MQTT
|
||||||
|
lnxlink.enable = true;
|
||||||
|
|
||||||
pulseaudio.enable = true;
|
pulseaudio.enable = true;
|
||||||
pulseaudio.support32Bit = true;
|
pulseaudio.support32Bit = true;
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,29 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
gaming = {
|
||||||
|
type = "disk";
|
||||||
|
device = "/dev/sdd";
|
||||||
|
content = {
|
||||||
|
type = "gpt";
|
||||||
|
partitions = {
|
||||||
|
gaming = {
|
||||||
|
size = "100%";
|
||||||
|
content = {
|
||||||
|
type = "btrfs";
|
||||||
|
extraArgs = ["-f"];
|
||||||
|
mountpoint = "/mnt/games/hdd";
|
||||||
|
mountOptions = [
|
||||||
|
"compress=zstd"
|
||||||
|
"noatime"
|
||||||
|
"nofail"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -28,17 +28,6 @@
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
fileSystems."/mnt/games/hdd" = {
|
|
||||||
device = "/dev/disk/by-label/Spiele";
|
|
||||||
fsType = "ntfs";
|
|
||||||
options = [
|
|
||||||
"nofail"
|
|
||||||
"exec"
|
|
||||||
"users"
|
|
||||||
"permissions"
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
environment.systemPackages = [pkgs.rclone];
|
environment.systemPackages = [pkgs.rclone];
|
||||||
environment.etc."rclone-beryllium.conf".text = ''
|
environment.etc."rclone-beryllium.conf".text = ''
|
||||||
[beryllium]
|
[beryllium]
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue