mirror of
https://github.com/ItsDrike/nixdots
synced 2025-06-29 20:00:42 +00:00
Add workstation-specific settings
This commit is contained in:
parent
fca6296841
commit
27b0d375f2
18 changed files with 258 additions and 9 deletions
8
system/roles/workstation/services/default.nix
Normal file
8
system/roles/workstation/services/default.nix
Normal file
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
imports = [
|
||||
./earlyoom.nix
|
||||
./mount.nix
|
||||
./printing.nix
|
||||
];
|
||||
}
|
||||
|
22
system/roles/workstation/services/earlyoom.nix
Normal file
22
system/roles/workstation/services/earlyoom.nix
Normal file
|
@ -0,0 +1,22 @@
|
|||
{pkgs, ...}: {
|
||||
# https://dataswamp.org/~solene/2022-09-28-earlyoom.html
|
||||
# avoid the linux kernel locking itself when we're putting too much strain on the memory
|
||||
# this helps avoid having to shut down forcefully when we OOM
|
||||
services.earlyoom = {
|
||||
enable = true;
|
||||
enableNotifications = true; # annoying, but we want to know what's killed
|
||||
freeSwapThreshold = 2;
|
||||
freeMemThreshold = 2;
|
||||
extraArgs = [
|
||||
"-g" # kill all processes within a process group
|
||||
"--avoid 'Hyprland|soffice|soffice.bin|firefox|thunderbird)$'" # things we want to not kill
|
||||
"--prefer '^(electron|.*.exe)$'" # I wish we could kill electron permanently
|
||||
];
|
||||
|
||||
# we should ideally write the logs into a designated log file; or even better, to the journal
|
||||
# for now we can hope this echo sends the log to somewhere we can observe later
|
||||
killHook = pkgs.writeShellScript "earlyoom-kill-hook" ''
|
||||
echo "Process $EARLYOOM_NAME ($EARLYOOM_PID) was killed"
|
||||
'';
|
||||
};
|
||||
}
|
11
system/roles/workstation/services/mount.nix
Normal file
11
system/roles/workstation/services/mount.nix
Normal file
|
@ -0,0 +1,11 @@
|
|||
{ config, ... }:
|
||||
{
|
||||
services = {
|
||||
# enable GVfs, a userspace virtual filesystem
|
||||
# (allows viewing ftp,sftp,... directly from the file manager)
|
||||
gvfs.enable = true;
|
||||
|
||||
# Storage daemon required for udiskie auto-mount
|
||||
udisks2.enable = !config.boot.isContainer;
|
||||
};
|
||||
}
|
27
system/roles/workstation/services/printing.nix
Normal file
27
system/roles/workstation/services/printing.nix
Normal file
|
@ -0,0 +1,27 @@
|
|||
{ config, lib, pkgs, ... }: let
|
||||
inherit (lib) mkIf;
|
||||
|
||||
cfg = config.myOptions.workstation.printing;
|
||||
in {
|
||||
config = mkIf cfg.enable {
|
||||
# enable cups and add some drivers for common printers
|
||||
services = {
|
||||
printing = {
|
||||
enable = true;
|
||||
drivers = with pkgs; [
|
||||
gutenprint
|
||||
hplip
|
||||
];
|
||||
};
|
||||
|
||||
# required for network discovery of printers
|
||||
avahi = {
|
||||
enable = true;
|
||||
# resolve .local domains for printers
|
||||
nssmdns4 = true;
|
||||
# open the avahi port(s) in the firewall
|
||||
openFirewall = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue