From 4e15944edb305cc058f3f1062e9a1b5c2e2840bb Mon Sep 17 00:00:00 2001 From: Truxnell <19149206+truxnell@users.noreply.github.com> Date: Fri, 29 Mar 2024 21:20:57 +1100 Subject: [PATCH] feat: minimise server footprint (#32) Co-authored-by: Truxnell <9149206+truxnell@users.noreply.github.com> --- nixos/modules/nixos/system/nix.nix | 2 +- nixos/profiles/global.nix | 36 ------------------------------ nixos/profiles/role-server.nix | 22 ++++++++++++++++-- nixos/profiles/role-worstation.nix | 35 ++++++++++++++++++++++++++--- 4 files changed, 53 insertions(+), 42 deletions(-) diff --git a/nixos/modules/nixos/system/nix.nix b/nixos/modules/nixos/system/nix.nix index d13b293..2f38015 100644 --- a/nixos/modules/nixos/system/nix.nix +++ b/nixos/modules/nixos/system/nix.nix @@ -38,7 +38,7 @@ in gc = mkIf cfg.gc.enable { # garbage collection automatic = cfg.gc.enable; - options = "--delete-older-than 30d"; + options = "--delete-older-than 7d"; inherit (cfg.gc) persistent; }; diff --git a/nixos/profiles/global.nix b/nixos/profiles/global.nix index 43f1c97..5dfc83b 100644 --- a/nixos/profiles/global.nix +++ b/nixos/profiles/global.nix @@ -30,47 +30,11 @@ with lib; }; - i18n = { - defaultLocale = lib.mkDefault "en_AU.UTF-8"; - }; - - # TODO refactor this shit out wow - - # SOPS settings - # https://github.com/Mic92/sops-nix - - - - - - networking.useDHCP = lib.mkDefault true; - environment.systemPackages = with pkgs; [ - jq - yq - btop - vim - git - dnsutils - nix - # TODO Move - nil - nixpkgs-fmt - statix - nvd - gh - ]; - - programs.direnv = { - # TODO move to home-manager - enable = true; - nix-direnv.enable = true; - }; - programs.mtr.enable = true; } diff --git a/nixos/profiles/role-server.nix b/nixos/profiles/role-server.nix index 22d6361..c4052db 100644 --- a/nixos/profiles/role-server.nix +++ b/nixos/profiles/role-server.nix @@ -17,8 +17,26 @@ with lib; max-free = lib.mkDefault (1000 * 1000 * 1000); min-free = lib.mkDefault (128 * 1000 * 1000); }; + + services.logrotate.enable = mkDefault true; + + environment.noXlibs = mkDefault true; + documentation = { + enable = mkDefault false; + doc.enable = mkDefault false; + info.enable = mkDefault false; + man.enable = mkDefault false; + nixos.enable = mkDefault false; + }; + programs.command-not-found.enable = mkDefault false; + + services.udisks2.enable = mkDefault false; + xdg = { + autostart.enable = mkDefault false; + icons.enable = mkDefault false; + mime.enable = mkDefault false; + sounds.enable = mkDefault false; + }; }; - - } diff --git a/nixos/profiles/role-worstation.nix b/nixos/profiles/role-worstation.nix index efe68fb..10e3667 100644 --- a/nixos/profiles/role-worstation.nix +++ b/nixos/profiles/role-worstation.nix @@ -10,6 +10,11 @@ with config; de.gnome.enable = true; editor.vscodium.enable = true; browser.firefox.enable = true; + # Lets see if fish everywhere is OK on the pi's + # TODO decide if i drop to bash on pis? + shell.fish.enable = true; + # But wont enable plugins globally, leave them for workstations + }; boot = { @@ -28,9 +33,33 @@ with config; # set xserver videodrivers if used services.xserver.enable = true; - # Laptop so ill likely use wireles - # very likely to be set by GUI packages but lets - # be declarative. + + environment.systemPackages = with pkgs; [ + jq + yq + btop + vim + git + dnsutils + nix + + # TODO Move + nil + nixpkgs-fmt + statix + nvd + gh + ]; + + i18n = { + defaultLocale = lib.mkDefault "en_AU.UTF-8"; + }; + programs.direnv = { + # TODO move to home-manager + enable = true; + nix-direnv.enable = true; + }; + programs.mtr.enable = true; }