From b288f544e581f572ee7f63ae6a27d755fc71edaa Mon Sep 17 00:00:00 2001 From: jopejoe1 Date: Fri, 19 May 2023 20:53:02 +0200 Subject: [PATCH] modulise --- common.nix | 176 ----------------------------- flake.nix | 10 +- modules/audio/default.nix | 20 ++++ modules/bluetooth/default.nix | 7 ++ modules/local/default.nix | 41 +++++++ modules/nix/default.nix | 40 +++++++ modules/plasma/default.nix | 27 +++++ modules/printing/default.nix | 22 ++++ modules/ssh/default.nix | 22 ++++ modules/steam/default.nix | 11 ++ modules/users/jopejoe1/default.nix | 21 ++++ systems/kami/default.nix | 1 + 12 files changed, 221 insertions(+), 177 deletions(-) delete mode 100644 common.nix create mode 100644 modules/audio/default.nix create mode 100644 modules/bluetooth/default.nix create mode 100644 modules/local/default.nix create mode 100644 modules/nix/default.nix create mode 100644 modules/plasma/default.nix create mode 100644 modules/printing/default.nix create mode 100644 modules/ssh/default.nix create mode 100644 modules/steam/default.nix create mode 100644 modules/users/jopejoe1/default.nix diff --git a/common.nix b/common.nix deleted file mode 100644 index c4e41f7..0000000 --- a/common.nix +++ /dev/null @@ -1,176 +0,0 @@ -{ lib, config, pkgs, ... }: - -{ - services = { - xserver = { - enable = true; - - libinput.enable = true; - - displayManager.sddm = { - enable = true; - enableHidpi = true; - }; - desktopManager.plasma5 = { - enable = true; - useQtScaling = true; - }; - }; - - openssh = { - enable = true; - ports = [ 22 ]; - openFirewall = true; - allowSFTP = true; - settings = { - X11forwarding = true; - PermitRootLogin = "no"; - passwordAuthentication = true; - kbdInteractiveAuthentication = true; - }; - }; - }; - - programs.kdeconnect = { - enable = true; - package = pkgs.plasma5Packages.kdeconnect-kde; - }; - - xdg = { - sounds.enable = true; - mime.enable = true; - menus.enable = true; - icons.enable = true; - autostart.enable = true; - portal = { - enable = true; - extraPortals = with pkgs; [ xdg-desktop-portal ]; - }; - }; - - i18n = { - defaultLocale = "en_NZ.UTF-8"; - extraLocaleSettings = { - LC_ADDRESS = "de_DE.UTF-8"; - LC_IDENTIFICATION = "de_DE.UTF-8"; - LC_MEASUREMENT = "de_DE.UTF-8"; - LC_MONETARY = "de_DE.UTF-8"; - LC_NAME = "de_DE.UTF-8"; - LC_NUMERIC = "de_DE.UTF-8"; - LC_PAPER = "de_DE.UTF-8"; - LC_TELEPHONE = "de_DE.UTF-8"; - LC_TIME = "de_DE.UTF-8"; - LC_CTYPE = "de_DE.UTF-8"; - LC_COLLATE = "de_DE.UTF-8"; - LC_MESSAGES = "en_NZ.UTF-8"; - }; - }; - - hardware.steam-hardware.enable = true; - - programs.steam = { - enable = false; - remotePlay.openFirewall = true; - dedicatedServer.openFirewall = true; - }; - - environment.variables = { - # Enable icons in tooling since we have nerdfonts. - LOG_ICONS = "true"; - }; - - fonts.fontDir.enable = true; - - nix = { - settings = { - substituters = [ - "https://cache.nixos.org" - "https://nix-community.cachix.org" - "https://prismlauncher.cachix.org" - "https://nixos-search.cachix.org" - ]; - trusted-public-keys = [ - "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=" - "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" - "prismlauncher.cachix.org-1:GhJfjdP1RFKtFSH3gXTIQCvZwsb2cioisOf91y/bK0w=" - "nixos-search.cachix.org-1:1HV3YF8az4fywnH+pAd+CXFEdpTXtv9WpoivPi+H70o=" - ]; - trusted-users = [ "root" ]; - sandbox = true; - require-sigs = true; - max-jobs = "auto"; - auto-optimise-store = true; - allowed-users = [ "*" ]; - experimental-features = [ "nix-command" "flakes" ]; - warn-dirty = false; - }; - }; - - security.rtkit.enable = true; - hardware.bluetooth.enable = true; - hardware.bluetooth.powerOnBoot = true; - - services.pipewire = { - enable = true; - alsa = { - enable = true; - support32Bit = true; - }; - pulse.enable = true; - jack.enable = true; - - wireplumber.enable = true; - }; - - hardware.pulseaudio.enable = false; - - environment.systemPackages = with pkgs; [ - sshfs - deploy-rs - nixfmt - nix-index - nix-prefetch-git - nixpkgs-review - nurl - nix-init - ]; - - services.hardware.openrgb.enable = true; - - services.printing = { - enable = true; - webInterface = true; - drivers = with pkgs; [ hplipWithPlugin ]; - }; - - hardware = { - sane = { - enable = true; - extraBackends = with pkgs; [ sane-airscan hplipWithPlugin ]; - }; - }; - - services.avahi = { - enable = true; - nssmdns = true; - openFirewall = true; - }; - - users.users.jopejoe1 = { - isNormalUser = true; - description = "jopejoe1 🚫"; - initialPassword = "password"; - packages = with pkgs; [ - git - kate - libsForQt5.ark - libreoffice-qt - texlive.combined.scheme-full - tela-icon-theme - ]; - openssh.authorizedKeys.keys = [ - "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCUWMJyy2qq2aacVv/J5raugh7UKEmCs+JpagQh30mYqwLV9YQtOfZ+A3Q1qOOLPHTTciLydsfz8K2jBGXEv49uqz9P33aw63RzSaLdcnXhBJRmZvJ3AujLBKDIo24PLOVasogtu01eyQALTg4npX+qlti2UsxLY5O8E5paFJvJ+5rGE3/34c4xA9xthUm7G7SCSt4AhVXwPGB1tqz1KLqGdTJQhvy80laEDSV4tAYpiabmjhNFKGpf8T7afnw1MzKXz+ba6exBcGaJfy2Q24DLztZsW7fsTE1iCdkbcmos9/jUR6NooKFgDr0M4CL2TVZB5pECSiOev06GMnLt+vpxjFL29YeGMaVMmNCedkL1z1mftbXLEL7934kEK9FpEpSwzbRTJ7iPvfYZuTHiT6fi2Ep7n+zzRS+/ZgDUDLSqZYEBmE4dO4LgcqzOsJo5EgoyLGoqQ4OpvPRY12T3rCWUfEgOCXgToF0WlUyxCaPZCfvUjM4LXNlIy/dtivMxMs8= jopejoe1@yokai" - ]; - }; -} - diff --git a/flake.nix b/flake.nix index a1bdad9..df804c4 100644 --- a/flake.nix +++ b/flake.nix @@ -21,7 +21,15 @@ specialArgs = inputs; modules = [ ./systems/kami - ./common.nix + ./modules/audio + ./modules/bluetooth + ./modules/local + ./modules/nix + ./modules/plasma + ./modules/printing + ./modules/ssh + ./modules/steam + ./modules/users/jopejoe1 { nixpkgs = { config.allowUnfree = true; diff --git a/modules/audio/default.nix b/modules/audio/default.nix new file mode 100644 index 0000000..f3876dc --- /dev/null +++ b/modules/audio/default.nix @@ -0,0 +1,20 @@ +{ pkgs, ... }: + +{ + security.rtkit.enable = true; + + services.pipewire = { + enable = true; + alsa = { + enable = true; + support32Bit = true; + }; + pulse.enable = true; + jack.enable = true; + + wireplumber.enable = true; + }; + + hardware.pulseaudio.enable = false; +} + diff --git a/modules/bluetooth/default.nix b/modules/bluetooth/default.nix new file mode 100644 index 0000000..19c09fd --- /dev/null +++ b/modules/bluetooth/default.nix @@ -0,0 +1,7 @@ +{ pkgs, ... }: + +{ + hardware.bluetooth.enable = true; + hardware.bluetooth.powerOnBoot = true; +} + diff --git a/modules/local/default.nix b/modules/local/default.nix new file mode 100644 index 0000000..3bb0f5d --- /dev/null +++ b/modules/local/default.nix @@ -0,0 +1,41 @@ +{ pkgs, ... }: + +{ + xdg = { + sounds.enable = true; + mime.enable = true; + menus.enable = true; + icons.enable = true; + autostart.enable = true; + portal = { + enable = true; + extraPortals = with pkgs; [ xdg-desktop-portal ]; + }; + }; + + i18n = { + defaultLocale = "en_NZ.UTF-8"; + extraLocaleSettings = { + LC_ADDRESS = "de_DE.UTF-8"; + LC_IDENTIFICATION = "de_DE.UTF-8"; + LC_MEASUREMENT = "de_DE.UTF-8"; + LC_MONETARY = "de_DE.UTF-8"; + LC_NAME = "de_DE.UTF-8"; + LC_NUMERIC = "de_DE.UTF-8"; + LC_PAPER = "de_DE.UTF-8"; + LC_TELEPHONE = "de_DE.UTF-8"; + LC_TIME = "de_DE.UTF-8"; + LC_CTYPE = "de_DE.UTF-8"; + LC_COLLATE = "de_DE.UTF-8"; + LC_MESSAGES = "en_NZ.UTF-8"; + }; + }; + + environment.variables = { + LOG_ICONS = "true"; + }; + + fonts.fontDir.enable = true; +} + + diff --git a/modules/nix/default.nix b/modules/nix/default.nix new file mode 100644 index 0000000..9746a2f --- /dev/null +++ b/modules/nix/default.nix @@ -0,0 +1,40 @@ +{ pkgs, ... }: + +{ + nix = { + settings = { + substituters = [ + "https://cache.nixos.org" + "https://nix-community.cachix.org" + "https://prismlauncher.cachix.org" + "https://nixos-search.cachix.org" + ]; + trusted-public-keys = [ + "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=" + "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" + "prismlauncher.cachix.org-1:GhJfjdP1RFKtFSH3gXTIQCvZwsb2cioisOf91y/bK0w=" + "nixos-search.cachix.org-1:1HV3YF8az4fywnH+pAd+CXFEdpTXtv9WpoivPi+H70o=" + ]; + trusted-users = [ "root" ]; + sandbox = true; + require-sigs = true; + max-jobs = "auto"; + auto-optimise-store = true; + allowed-users = [ "*" ]; + experimental-features = [ "nix-command" "flakes" ]; + warn-dirty = false; + }; + }; + + environment.systemPackages = with pkgs; [ + deploy-rs + nixfmt + nix-index + nix-prefetch-git + nixpkgs-review + nurl + nix-init + ]; +} + + diff --git a/modules/plasma/default.nix b/modules/plasma/default.nix new file mode 100644 index 0000000..2d79725 --- /dev/null +++ b/modules/plasma/default.nix @@ -0,0 +1,27 @@ +{ pkgs, ... }: + +{ + services = { + xserver = { + enable = true; + + libinput.enable = true; + + displayManager.sddm = { + enable = true; + enableHidpi = true; + }; + desktopManager.plasma5 = { + enable = true; + useQtScaling = true; + }; + }; + }; + + programs.kdeconnect = { + enable = true; + package = pkgs.plasma5Packages.kdeconnect-kde; + }; +} + + diff --git a/modules/printing/default.nix b/modules/printing/default.nix new file mode 100644 index 0000000..6ddba00 --- /dev/null +++ b/modules/printing/default.nix @@ -0,0 +1,22 @@ +{ pkgs, ... }: + +{ + services.printing = { + enable = true; + webInterface = true; + drivers = with pkgs; [ hplipWithPlugin ]; + }; + + hardware = { + sane = { + enable = true; + extraBackends = with pkgs; [ sane-airscan hplipWithPlugin ]; + }; + }; + + services.avahi = { + enable = true; + nssmdns = true; + openFirewall = true; + }; +} diff --git a/modules/ssh/default.nix b/modules/ssh/default.nix new file mode 100644 index 0000000..f80a42f --- /dev/null +++ b/modules/ssh/default.nix @@ -0,0 +1,22 @@ +{ pkgs, ... }: + +{ + services = { + openssh = { + enable = true; + ports = [ 22 ]; + openFirewall = true; + allowSFTP = true; + settings = { + X11forwarding = true; + PermitRootLogin = "no"; + passwordAuthentication = true; + kbdInteractiveAuthentication = true; + }; + }; + }; + + environment.systemPackages = with pkgs; [ sshfs ]; +} + + diff --git a/modules/steam/default.nix b/modules/steam/default.nix new file mode 100644 index 0000000..ea1a446 --- /dev/null +++ b/modules/steam/default.nix @@ -0,0 +1,11 @@ +{ pkgs, ... }: + +{ + hardware.steam-hardware.enable = true; + + programs.steam = { + enable = true; + remotePlay.openFirewall = true; + dedicatedServer.openFirewall = true; + }; +} diff --git a/modules/users/jopejoe1/default.nix b/modules/users/jopejoe1/default.nix new file mode 100644 index 0000000..e621cd8 --- /dev/null +++ b/modules/users/jopejoe1/default.nix @@ -0,0 +1,21 @@ +{ pkgs, ... }: + +{ + users.users.jopejoe1 = { + isNormalUser = true; + description = "jopejoe1 🚫"; + initialPassword = "password"; + packages = with pkgs; [ + git + kate + libsForQt5.ark + libreoffice-qt + texlive.combined.scheme-full + tela-icon-theme + ]; + openssh.authorizedKeys.keys = [ + "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCUWMJyy2qq2aacVv/J5raugh7UKEmCs+JpagQh30mYqwLV9YQtOfZ+A3Q1qOOLPHTTciLydsfz8K2jBGXEv49uqz9P33aw63RzSaLdcnXhBJRmZvJ3AujLBKDIo24PLOVasogtu01eyQALTg4npX+qlti2UsxLY5O8E5paFJvJ+5rGE3/34c4xA9xthUm7G7SCSt4AhVXwPGB1tqz1KLqGdTJQhvy80laEDSV4tAYpiabmjhNFKGpf8T7afnw1MzKXz+ba6exBcGaJfy2Q24DLztZsW7fsTE1iCdkbcmos9/jUR6NooKFgDr0M4CL2TVZB5pECSiOev06GMnLt+vpxjFL29YeGMaVMmNCedkL1z1mftbXLEL7934kEK9FpEpSwzbRTJ7iPvfYZuTHiT6fi2Ep7n+zzRS+/ZgDUDLSqZYEBmE4dO4LgcqzOsJo5EgoyLGoqQ4OpvPRY12T3rCWUfEgOCXgToF0WlUyxCaPZCfvUjM4LXNlIy/dtivMxMs8= jopejoe1@yokai" + ]; + }; +} + diff --git a/systems/kami/default.nix b/systems/kami/default.nix index 393b0ab..3842732 100644 --- a/systems/kami/default.nix +++ b/systems/kami/default.nix @@ -8,6 +8,7 @@ networking.hostName = "kami"; networking.hostId = "16c22faf"; + services.hardware.openrgb.enable = true; boot.supportedFilesystems = [ "ntfs" "btrfs" "zfs" ];