refactor(treewide): cleanup

This commit is contained in:
ooks-io 2024-04-30 20:20:35 +12:00
parent 2fe6c44941
commit 2d93503bbc
30 changed files with 76 additions and 273 deletions

View file

@ -2,36 +2,26 @@
{
imports = [
./hardware
./gaming
./shell
./bootloader
./nix
./programs
./user
./displayManager
./networking
./locale
./virtualisation
./virtualization
./security
./services
./audio
./meta
./host
./video
];
options.systemModules = {
pipewire = {
enable = lib.mkEnableOption "Enable pipewire module";
};
networking = {
enable = lib.mkEnableOption "Enable networking module";
};
virtualisation = {
enable = lib.mkEnableOption "Enable virtualisation module";
};
locale = {
enable = lib.mkEnableOption "Enable locale module";
};
};
}

View file

@ -0,0 +1,68 @@
{ lib, config, pkgs, ... }:
let
inherit (lib) mkIf;
inherit (builtins) elem;
steamFix = pkgs.steam.override {
extraPkgs = pkgs: with pkgs; [
xorg.libXcursor
xorg.libXi
xorg.libXinerama
xorg.libXScrnSaver
libpng
libpulseaudio
libvorbis
stdenv.cc.cc.lib
libkrb5
keyutils
mangohud
winetricks
protontricks
gtk3
gtk3-x11
];
};
host = config.systemModules.host;
in
{
config = mkIf (elem "gamiing" host.function) {
hardware.opengl.extraPackages = [ pkgs.gamescope ];
programs = {
steam = {
enable = true;
package = steamFix;
extraCompatPackages = [ pkgs.proton-ge-bin.steamcompattool ];
};
gamescope = {
enable = true;
capSysNice = true;
};
gamemode = {
enable = true;
settings = {
general = {
renice = 15;
softrealtime = "auto";
};
custom = {
start = "${pkgs.libnotify}/bin/notify-send 'GameMode started'";
end = "${pkgs.libnotify}/bin/notify-send 'GameMode ended'";
};
};
};
};
networking.firewall = {
allowedTCPPorts = [ 3074 ];
allowedUDPPorts = [
88
500
3074
2075
3544
4500
];
};
};
}

View file

@ -36,7 +36,7 @@ in
isNormalUser = true;
shell = pkgs.${cfg.shell};
initialPassword = "password";
openssh.authorizedKeys = "${cfg.sshKey}";
openssh.authorizedKeys.keys = [ "${cfg.sshKey}" ];
extraGroups = [
"wheel"
"video"

View file

@ -4,5 +4,6 @@
./name
./type
./function
./hardware
];
}

View file

@ -5,12 +5,6 @@ let
in
{
imports = [
./gaming
./workstation
./media-server
];
options.systemModules.host.function = mkOption {
type = with types; listOf (enum ["gaming" "workstation" "media-server"]);
default = [];

View file

@ -2,19 +2,18 @@
let
inherit (lib) mkMerge mkEnableOption mkIf versionAtLeast versionOlder;
hardware = config.systemModules.host.hardware.cpu;
cfg = hardware.amd;
kernelVersion = config.kernelPackages.kernel.version;
inherit (builtins) elem;
cpu = config.systemModules.host.hardware.cpu;
cfg = cpu.amd;
kernelVersion = config.boot.kernelPackages.kernel.version;
kernelVersionAtLeast = versionAtLeast kernelVersion;
kernelVersionOlder= versionOlder kernelVersion;
in
{
options.systemModules.host.hardware.cpu.amd = {
pstate.enable = mkEnableOption "Enable pstate amd module";
};
options.systemModules.host.hardware.cpu.amd.pstate.enable = mkEnableOption "Enable amd pstate module";
config = mkIf (builtins.elem hardware.type ["amd"]) {
config = mkIf (elem cpu.type ["amd"]) {
environment.systemPackages = [pkgs.amdctl];
hardware.cpu.amd.updateMicrocode = true;
boot = mkMerge [

View file

@ -3,6 +3,6 @@
./cpu
./gpu
./features
./ssd
./common
];
}

View file

@ -1,7 +1,7 @@
{ lib, config, ... }:
let
features = config.systemModules.host.hardware.ssd;
features = config.systemModules.host.hardware.features;
inherit (lib) mkIf;
inherit (builtins) elem;
in

View file

@ -15,7 +15,7 @@ in
};
config = {
networking.hostname = cfg.name;
networking.hostName = cfg.name;
environment.sessionVariables.HN = cfg.name;
};
}

View file

@ -2,7 +2,7 @@
let
inherit (lib) mkIf;
host = config.systemModules.type;
host = config.systemModules.host;
in
{

View file

@ -1,7 +1,7 @@
{ config, lib, inputs, ... }:
let
inherit (lib) mkIf;
inherit (lib) mkIf mapAttrs mkDefault;
host = config.systemModules.host;
in
@ -10,13 +10,13 @@ in
nix = {
settings = {
trusted-users = [ "root" "@wheel" ];
auto-optimise-store = lib.mkDefault true;
auto-optimise-store = mkDefault true;
experimental-features = [ "nix-command" "flakes" "repl-flake" ];
warn-dirty = false;
system-features = [ "kvm" "big-parallel" "nixos-test" ];
flake-registry = "";
};
registry = lib.mapAttrs (_: value: { flake = value; }) inputs;
registry = mapAttrs (_: value: { flake = value; }) inputs;
nixPath = [ "nixpkgs=${inputs.nixpkgs.outPath}" ];
};
};

View file

@ -6,7 +6,7 @@ let
in
{
config = mkIf host.type != "phone" {
config = mkIf (host.type != "phone") {
nixpkgs = {
overlays = builtins.attrValues outputs.overlays;
config = {

View file

@ -1,14 +1,13 @@
{ lib, config, ... }:
let
inherit (lib) mkIf mkEnableOption;
cfg = config.systemModules.programs.bandwhich;
inherit (lib) mkIf;
inherit (builtins) elem;
host = config.systemModules.host;
in
{
options.systemModules.programs.bandwhich.enable = mkEnableOption "Enable bandwhich system module";
config = mkIf cfg.enable {
config = mkIf (elem "workstation" host.function) {
programs.bandwhich.enable = true;
};
}

View file

@ -1,14 +1,13 @@
{ lib, config, ... }:
let
inherit (lib) mkIf mkEnableOption;
cfg = config.systemModules.programs.dconf;
inherit (lib) mkIf;
inherit (builtins) elem;
host = config.systemModules.host;
in
{
options.systemModules.programs.dconf.enable = mkEnableOption "Enable dconf system module";
config = mkIf cfg.enable {
config = mkIf (elem "workstation" host.function){
programs.dconf.enable = true;
};
}

View file

@ -1,14 +1,9 @@
{ lib, ... }:
{
imports = [
./gnomeServices.nix
./dconf
./kdeconnect
./seahorse
./wireshark
./bandwhich
];
options.systemModules.programs = {
gnomeServices = {
enable = lib.mkEnableOption "Enable gnome services module";
};
};
}

View file

@ -1,18 +0,0 @@
{ config, lib, pkgs, ... }:
let
cfg = config.systemModules.programs.gnomeServices;
in
{
config = lib.mkIf cfg.enable {
services = {
dbus.packages = with pkgs; [
gcr
gnome.gnome-settings-daemon
];
gnome.gnome-keyring.enable = true;
gvfs.enable = true;
};
};
}

View file

@ -9,9 +9,8 @@ in
options.systemModules.services.kdeconnect.enable = mkEnableOption "Enable kdeconnect system module";
config = mkIf cfg.enable {
services.kdeconnect = {
programs.kdeconnect = {
enable = true;
indicator = true;
};
};
}

View file

@ -1,14 +1,13 @@
{ lib, config, ... }:
let
inherit (lib) mkIf mkEnableOption;
cfg = config.systemModules.programs.seahorse;
inherit (lib) mkIf;
inherit (builtins) elem;
host = config.systemModules.host;
in
{
options.systemModules.programs.seahorse.enable = mkEnableOption "Enable seahorse system module";
config = mkIf cfg.enable {
config = mkIf (elem "workstation" host.function) {
programs.seahorse.enable = true;
};
}

View file

@ -1,14 +1,13 @@
{ lib, config, ... }:
let
inherit (lib) mkIf mkEnableOption;
cfg = config.systemModules.programs.wireshark;
inherit (lib) mkIf;
inherit (builtins) elem;
host = config.systemModules.host;
in
{
options.systemModules.programs.wireshark.enable = mkEnableOption "Enable wireshark system module";
config = mkIf cfg.enable {
config = mkIf (elem "workstation" host.function) {
programs.wireshark.enable = true;
};
}

View file

@ -1,5 +1,5 @@
{
import = [
imports = [
./1password
./kernel
./pam

View file

@ -5,7 +5,6 @@
./mediaServer
./system76Scheduler
./dbus
./kdeconnect
./gnome
./gvfs
];

View file

@ -7,6 +7,6 @@ in
{
config = mkIf ( host.type != "phone") {
services.gvfs = true;
services.gvfs.enable = true;
};
}

View file

@ -8,7 +8,7 @@ in
{
options.systemModules.zsh.enable = mkEnableOption "Enable zsh module";
options.systemModules.shell.zsh.enable = mkEnableOption "Enable zsh module";
config = mkIf (adminShell == "zsh" || cfg.enable) {
programs.zsh = {

View file

@ -1,14 +0,0 @@
{ lib, ... }:
{
imports = [
./shell
./ooks.nix
];
options.systemModules.user = {
ooks = {
enable = lib.mkEnableOption "Enable the user ooks";
};
};
}

View file

@ -1,30 +0,0 @@
{ lib, pkgs, config, ... }:
let
ifTheyExist = groups: builtins.filter (group: builtins.hasAttr group config.users.groups) groups;
cfg = config.systemModules.user.ooks;
in
{
config = lib.mkIf cfg.enable {
users.users.ooks = {
isNormalUser = true;
extraGroups = [
"wheel"
"video"
"audio"
] ++ ifTheyExist [
"git"
"media"
"network"
"libvirtd"
"deluge"
"streamer"
"torrenter"
];
packages = [ pkgs.home-manager ];
};
home-manager.users.ooks = import ../../../home/user/ooks/${config.networking.hostName};
};
}