nixfiles/nixos/modules/server.nix

46 lines
1.1 KiB
Nix
Raw Normal View History

2022-03-26 14:20:30 +00:00
{ lib, pkgs, config, ... }:
2022-02-13 13:10:21 +00:00
let
2022-02-19 22:55:53 +00:00
inherit (lib) mkIf mkDefault;
2022-03-26 14:20:30 +00:00
inherit (lib.my) mkBoolOpt' mkDefault';
2022-02-13 17:44:14 +00:00
cfg = config.my.server;
2022-02-19 22:55:53 +00:00
uname = if config.my.user.enable then config.my.user.config.name else "root";
2022-02-13 13:10:21 +00:00
in
{
2022-02-13 17:44:14 +00:00
options.my.server.enable = mkBoolOpt' false "Whether to enable common configuration for servers.";
config = mkIf cfg.enable {
2022-02-16 01:38:17 +00:00
services = {
2022-02-19 22:55:53 +00:00
getty.autologinUser = mkDefault uname;
kmscon.autologinUser = mkDefault uname;
2022-05-18 22:52:42 +01:00
resolved.llmnr = mkDefault "false";
2022-02-16 01:38:17 +00:00
};
systemd = {
timers = {
fstrim = mkIf config.services.fstrim.enable {
timerConfig = {
# Upstream unit has these at crazy high values that probably
# make sense on desktops / laptops
AccuracySec = "1min";
RandomizedDelaySec = "5min";
};
};
};
};
2022-02-16 01:38:17 +00:00
my = {
gui.enable = false;
user.homeConfig = {
my.gui.enable = false;
};
2022-02-16 01:38:17 +00:00
};
2022-03-26 14:20:30 +00:00
documentation.nixos.enable = mkDefault' false;
environment.systemPackages = with pkgs; [
tcpdump
];
2022-02-13 13:10:21 +00:00
};
meta.buildDocsInSandbox = false;
2022-02-13 13:10:21 +00:00
}