From bb897d568263e116252ab4a07e3838e6e5a3bcee Mon Sep 17 00:00:00 2001 From: Bart van der Braak Date: Thu, 17 Oct 2024 23:50:25 +0200 Subject: [PATCH] Increase modularity of configuration --- tongfang/nixos/configuration.nix | 79 +++++--------------------------- tongfang/nixos/packages.nix | 15 ++++++ tongfang/nixos/services.nix | 41 +++++++++++++++++ tongfang/nixos/users.nix | 26 +++++++++++ 4 files changed, 94 insertions(+), 67 deletions(-) create mode 100644 tongfang/nixos/packages.nix create mode 100644 tongfang/nixos/services.nix create mode 100644 tongfang/nixos/users.nix diff --git a/tongfang/nixos/configuration.nix b/tongfang/nixos/configuration.nix index e6fb142..7066980 100644 --- a/tongfang/nixos/configuration.nix +++ b/tongfang/nixos/configuration.nix @@ -3,18 +3,22 @@ { imports = [ ./hardware-configuration.nix + ./users.nix # Import user-specific config + ./packages.nix # Import package-specific config + ./services.nix # Import services config ]; + # Bootloader and EFI settings boot.loader.systemd-boot.enable = true; boot.loader.efi.canTouchEfiVariables = true; + # Hostname and networking networking.hostName = "tongfang"; networking.networkmanager.enable = true; + # Time and locale settings time.timeZone = "Europe/Amsterdam"; - i18n.defaultLocale = "en_US.UTF-8"; - i18n.extraLocaleSettings = { LC_ADDRESS = "nl_NL.UTF-8"; LC_IDENTIFICATION = "nl_NL.UTF-8"; @@ -27,77 +31,18 @@ LC_TIME = "en_US.UTF-8"; }; - services.xserver.enable = false; - services.displayManager.sddm.enable = true; - services.displayManager.sddm.wayland.enable = true; - services.desktopManager.plasma6.enable = true; - - services.xserver.xkb = { - layout = "us"; - variant = ""; - }; - - services.printing.enable = false; - hardware.bluetooth.enable = true; - - hardware.pulseaudio.enable = false; - security.rtkit.enable = true; - services.pipewire = { - enable = true; - alsa.enable = true; - alsa.support32Bit = true; - pulse.enable = true; - }; - - services.libinput.enable = true; - - nixpkgs.config.permittedInsecurePackages = [ - "electron-27.3.11" - ]; - - users.users.bart = { - isNormalUser = true; - description = "Bart van der Braak"; - extraGroups = [ "networkmanager" "wheel" ]; + # Fonts configuration + fonts = { + enableDefaultPackages = true; packages = with pkgs; [ - vscodium - thunderbird - fastfetch - wezterm - neovim - logseq - element-desktop - opentofu - python3 - gnumake + jetbrains-mono ]; }; - services.tailscale.enable = true; - + # Enable Nix Flakes and experimental features nixpkgs.config.allowUnfree = true; nix.settings.experimental-features = [ "nix-command" "flakes" ]; - environment.systemPackages = with pkgs; with inputs; [ - inputs.zen-browser.packages."${system}".default - firefox - git - vim - wget - curl - fzf - jq - ripgrep - ]; - environment.variables = { - EDITOR = "vim"; - ELECTRON_OZONE_PLATFORM_HINT = "wayland"; - NIXOS_OZONE_WL = "1"; - }; - - fonts.packages = with pkgs; [ - jetbrains-mono - ]; - + # System state version system.stateVersion = "24.05"; } diff --git a/tongfang/nixos/packages.nix b/tongfang/nixos/packages.nix new file mode 100644 index 0000000..7088eac --- /dev/null +++ b/tongfang/nixos/packages.nix @@ -0,0 +1,15 @@ +{ pkgs, inputs, config, ... }: + +{ + environment.systemPackages = with pkgs; with inputs; [ + inputs.zen-browser.packages."${system}".default + firefox + git + vim + wget + curl + fzf + jq + ripgrep + ]; +} diff --git a/tongfang/nixos/services.nix b/tongfang/nixos/services.nix new file mode 100644 index 0000000..f03cc0b --- /dev/null +++ b/tongfang/nixos/services.nix @@ -0,0 +1,41 @@ +{ pkgs, ... }: + +{ + # X11 is disabled, but we're using SDDM with Wayland + services.xserver.enable = false; + services.displayManager.sddm.enable = true; + services.displayManager.sddm.wayland.enable = true; + services.desktopManager.plasma6.enable = true; + + # Audio system with PipeWire + # Enable PipeWire and ALSA support + services.pipewire = { + enable = true; + alsa.enable = true; # Enable ALSA support + alsa.support32Bit = true; # Support for 32-bit applications + pulse.enable = true; # Enable PulseAudio compatibility layer + }; + + # Enable libinput for input device handling + services.libinput.enable = true; + + # Enable security-related service for realtime audio tasks + security.rtkit.enable = true; + + # Steam, Tailscale, and other services + programs.steam.enable = true; + services.tailscale.enable = true; + + # Environment variables + environment.variables = { + EDITOR = "vim"; + ELECTRON_OZONE_PLATFORM_HINT = "wayland"; + NIXOS_OZONE_WL = "1"; + }; + + # Printing and Bluetooth + # Disable browsed: https://discourse.nixos.org/t/newly-announced-vulnerabilities-in-cups + services.printing.enable = true; + services.printing.browsed.enable = false; + hardware.bluetooth.enable = true; +} diff --git a/tongfang/nixos/users.nix b/tongfang/nixos/users.nix new file mode 100644 index 0000000..32ed889 --- /dev/null +++ b/tongfang/nixos/users.nix @@ -0,0 +1,26 @@ +{ config, pkgs, ... }: + +{ + users.users.bart = { + isNormalUser = true; + description = "Bart van der Braak"; + extraGroups = [ "networkmanager" "wheel" ]; + packages = with pkgs; [ + vscodium + thunderbird + fastfetch + wezterm + neovim + logseq + element-desktop + opentofu + python3 + gnumake + ]; + }; + + nixpkgs.config.permittedInsecurePackages = [ + # Workaround for electron dependency in Logseq + "electron-27.3.11" + ]; +}