kasei: split services into `services` directory

This commit is contained in:
Oystein Kristoffer Tveit 2023-12-11 13:27:40 +01:00
parent 7193a12ac2
commit b1650e91a6
Signed by: oysteikt
GPG Key ID: 9F2F7D8250F35146
7 changed files with 89 additions and 34 deletions

View File

@ -1,5 +1,14 @@
{ config, lib, pkgs, inputs, specialArgs, ... }:
{
imports = [
./services/docker.nix
./services/libvirtd.nix
./services/logiops.nix
./services/postgres.nix
./services/stable-diffusion.nix
./services/tailscale.nix
];
machineVars = {
headless = false;
gaming = true;
@ -37,13 +46,7 @@
hostName = "kasei";
networkmanager.enable = true;
interfaces.enp6s0.useDHCP = true;
firewall = {
enable = true;
allowedTCPPorts = [ 7860 ];
allowedUDPPorts = [ config.services.tailscale.port ];
checkReversePath = "loose";
trustedInterfaces = [ "tailscale0" ];
};
firewall.enable = true;
hostId = "f0660cef";
};
@ -56,32 +59,6 @@
tailscale.enable = true;
};
# TODO: remove when merged: https://github.com/NixOS/nixpkgs/pull/167388
systemd = {
services = {
logid = {
description = "Logitech Configuration Daemon";
startLimitIntervalSec = 0;
wants = [ "multi-user.target" ];
after = [ "multi-user.target" ];
wantedBy = [ "graphical-session.target" ];
serviceConfig = {
Type = "simple";
ExecStart = "${pkgs.logiops}/bin/logid";
User = "root";
ExecReload = "/bin/kill -HUP $MAINPID";
Restart="on-failure";
};
};
};
};
virtualisation = {
docker.enable = true;
libvirtd.enable = true;
};
boot = {
initrd.availableKernelModules = [ "nvme" "xhci_pci" "ahci" "usb_storage" "usbhid" "sd_mod" "sr_mod" ];
initrd.kernelModules = [ ];
@ -134,6 +111,5 @@
cpu.amd.updateMicrocode = true;
enableRedistributableFirmware = true;
keyboard.zsa.enable = true;
logitech.wireless.enable = true;
};
}

View File

@ -0,0 +1,4 @@
{ ... }:
{
virtualisation.docker.enable = true;
}

View File

@ -0,0 +1,4 @@
{ ... }:
{
virtualisation.libvirtd.enable = true;
}

View File

@ -0,0 +1,23 @@
{ pkgs, ... }:
{
# TODO: remove when merged: https://github.com/NixOS/nixpkgs/pull/167388
systemd.services = {
logid = {
description = "Logitech Configuration Daemon";
startLimitIntervalSec = 0;
wants = [ "multi-user.target" ];
after = [ "multi-user.target" ];
wantedBy = [ "graphical-session.target" ];
serviceConfig = {
Type = "simple";
ExecStart = "${pkgs.logiops}/bin/logid";
User = "root";
ExecReload = "/bin/kill -HUP $MAINPID";
Restart="on-failure";
};
};
};
hardware.logitech.wireless.enable = true;
}

View File

@ -0,0 +1,13 @@
{ ... }:
{
services.postgresql = {
enable = true;
enableTCPIP = true;
authentication = ''
# tailscale xps
host all all 100.94.170.21/32 md5
'';
};
networking.firewall.allowedTCPPorts = [ 5432 ];
}

View File

@ -0,0 +1,25 @@
{ pkgs, ... }:
{
systemd.services.sdwebui = {
description = "Stable Diffusion Web UI";
wants = [ "multi-user.target" ];
after = [ "multi-user.target" ];
path = with pkgs; [
nix
git
nix-output-monitor
bash
];
serviceConfig = {
Type = "simple";
ExecStart = "/home/h7x4/sd-webui/run.sh";
User = "h7x4";
ExecReload = "/bin/kill -HUP $MAINPID";
Restart="on-failure";
WorkingDirectory = "/home/h7x4/sd-webui";
};
};
networking.firewall.allowedTCPPorts = [ 7860 ];
}

View File

@ -0,0 +1,10 @@
{ config, ... }:
{
services.tailscale.enable = true;
networking.firewall = {
allowedUDPPorts = [ config.services.tailscale.port ];
checkReversePath = "loose";
trustedInterfaces = [ "tailscale0" ];
};
}