From 835faf218d37a2079c8c32ababb43bf2d6664e25 Mon Sep 17 00:00:00 2001 From: Chris Kruining Date: Sat, 20 Jul 2024 22:22:47 +0200 Subject: [PATCH] WIP splitting up configuration.nix into modules --- flake.lock | 40 +++++++------- hosts/default/configuration.nix | 89 ++++++------------------------ modules/desktop/plasma.nix | 24 ++++++++ modules/home-manager/nextcloud.nix | 30 ++++++++++ modules/programs/desktop.nix | 6 -- modules/system/audio.nix | 19 +++++++ modules/system/boot.nix | 15 +++++ modules/system/zsa_voyager.nix | 35 ++++++++++++ 8 files changed, 160 insertions(+), 98 deletions(-) create mode 100644 modules/desktop/plasma.nix create mode 100644 modules/home-manager/nextcloud.nix delete mode 100644 modules/programs/desktop.nix create mode 100644 modules/system/audio.nix create mode 100644 modules/system/boot.nix create mode 100644 modules/system/zsa_voyager.nix diff --git a/flake.lock b/flake.lock index 1caad86..0ad6ecd 100644 --- a/flake.lock +++ b/flake.lock @@ -53,11 +53,11 @@ "base16-helix": { "flake": false, "locked": { - "lastModified": 1696727917, - "narHash": "sha256-FVrbPk+NtMra0jtlC5oxyNchbm8FosmvXIatkRbYy1g=", + "lastModified": 1720809814, + "narHash": "sha256-numb3xigRGnr/deF7wdjBwVg7fpbTH7reFDkJ75AJkY=", "owner": "tinted-theming", "repo": "base16-helix", - "rev": "dbe1480d99fe80f08df7970e471fac24c05f2ddb", + "rev": "34f41987bec14c0f3f6b2155c19787b1f6489625", "type": "github" }, "original": { @@ -101,15 +101,15 @@ "base16-vim": { "flake": false, "locked": { - "lastModified": 1663659192, - "narHash": "sha256-uJvaYYDMXvoo0fhBZUhN8WBXeJ87SRgof6GEK2efFT0=", - "owner": "chriskempson", + "lastModified": 1716150083, + "narHash": "sha256-ZMhnNmw34ogE5rJZrjRv5MtG3WaqKd60ds2VXvT6hEc=", + "owner": "tinted-theming", "repo": "base16-vim", - "rev": "3be3cd82cd31acfcab9a41bad853d9c68d30478d", + "rev": "6e955d704d046b0dc3e5c2d68a2a6eeffd2b5d3d", "type": "github" }, "original": { - "owner": "chriskempson", + "owner": "tinted-theming", "repo": "base16-vim", "type": "github" } @@ -170,11 +170,11 @@ ] }, "locked": { - "lastModified": 1714900398, - "narHash": "sha256-H7XYHpjk1G6dkA3AnbYrKtaTFjcCE7ul6nUVlVQxtsA=", + "lastModified": 1721135958, + "narHash": "sha256-H548rpPMsn25LDKn1PCFmPxmWlClJJGnvdzImHkqjuY=", "owner": "nix-community", "repo": "home-manager", - "rev": "fdaaf543bad047639ef0b356ea2e6caec2f1215c", + "rev": "afd2021bedff2de92dfce0e257a3d03ae65c603d", "type": "github" }, "original": { @@ -191,11 +191,11 @@ ] }, "locked": { - "lastModified": 1714981474, - "narHash": "sha256-b3/U21CJjCjJKmA9WqUbZGZgCvospO3ArOUTgJugkOY=", + "lastModified": 1715930644, + "narHash": "sha256-W9pyM3/vePxrffHtzlJI6lDS3seANQ+Nqp+i58O46LI=", "owner": "nix-community", "repo": "home-manager", - "rev": "6ebe7be2e67be7b9b54d61ce5704f6fb466c536f", + "rev": "e3ad5108f54177e6520535768ddbf1e6af54b59d", "type": "github" }, "original": { @@ -206,11 +206,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1714763106, - "narHash": "sha256-DrDHo74uTycfpAF+/qxZAMlP/Cpe04BVioJb6fdI0YY=", + "lastModified": 1721379653, + "narHash": "sha256-8MUgifkJ7lkZs3u99UDZMB4kbOxvMEXQZ31FO3SopZ0=", "owner": "nixos", "repo": "nixpkgs", - "rev": "e9be42459999a253a9f92559b1f5b72e1b44c13d", + "rev": "1d9c2c9b3e71b9ee663d11c5d298727dace8d374", "type": "github" }, "original": { @@ -258,11 +258,11 @@ "nixpkgs": "nixpkgs_2" }, "locked": { - "lastModified": 1716037261, - "narHash": "sha256-eF0A36GdegKkEiwFArjCysGU/XEYvzj7x5jfkFMtmqM=", + "lastModified": 1721478802, + "narHash": "sha256-+WMQs0fMAmpWPsKNgIFQoKLtvS4qtTj+mC++cD1May4=", "owner": "danth", "repo": "stylix", - "rev": "76e7daf5a16d442ac98e844582f7dc1354610886", + "rev": "6f36b27afd7b7ac8664bb62b7b27728540972c82", "type": "github" }, "original": { diff --git a/hosts/default/configuration.nix b/hosts/default/configuration.nix index 38bcccb..08b07c4 100644 --- a/hosts/default/configuration.nix +++ b/hosts/default/configuration.nix @@ -1,12 +1,16 @@ -# Edit this configuration file to define what should be installed on -# your system. Help is available in the configuration.nix(5) man page, on -# https://search.nixos.org/options and in the NixOS manual (`nixos-help`). - { config, lib, pkgs, inputs, ... }: - { - imports = [ # Include the results of the hardware scan. + imports = [ ./hardware-configuration.nix + ../../modules/system/boot.nix + ../../modules/system/audio.nix + ../../modules/system/zsa_voyager.nix + + ../../modules/desktop/plasma.nix + + + + ../../modules/programs/security.nix ../../modules/programs/theme.nix ../../modules/programs/shell.nix @@ -14,7 +18,6 @@ ../../modules/programs/harden.nix ../../modules/programs/communication.nix ../../modules/programs/office.nix - ../../modules/programs/desktop.nix inputs.home-manager.nixosModules.default ]; @@ -22,33 +25,6 @@ allowUnfree = true; }; - # Use the GRUB 2 boot loader. -# boot.loader.grub.enable = true; - boot.loader.systemd-boot.enable = true; - # boot.loader.grub.efiSupport = true; - # boot.loader.grub.efiInstallAsRemovable = true; - # boot.loader.efi.efiSysMountPoint = "/boot/efi"; - # Define on which hard drive you want to install Grub. - # boot.loader.grub.device = "/dev/sda"; # or "nodev" for efi only - -# fileSystems."/home/chris/games" = { -# device = "/dev/disk/by-label/Games"; -# fsType = "ntfs-3g"; -# options = [ "rw" "uid=chris" ]; -# }; - - fileSystems."/home/chris/new_games" = { - device = "/dev/disk/by-label/games"; - fsType = "ext4"; -# options = [ "rw" "uid=chris" ]; - }; - - fileSystems."/home/chris/data" = { - device = "/dev/disk/by-label/Data"; - fsType = "ntfs-3g"; - options = [ "rw" "uid=chris" ]; - }; - networking.hostName = "chris-pc"; # Pick only one of the below networking options. # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. @@ -59,52 +35,21 @@ # Set your time zone. time.timeZone = "Europe/Amsterdam"; - # Configure network proxy if necessary - # networking.proxy.default = "http://user:password@proxy:port/"; - # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain"; - - # Select internationalisation properties. - # i18n.defaultLocale = "en_US.UTF-8"; - # console = { - # font = "Lat2-Terminus16"; - # keyMap = "us"; - # useXkbConfig = true; # use xkb.options in tty. - # }; - # Enable the X11 windowing system. services.xserver.enable = true; - # Enable the Plasma 5 Desktop Environment. - services.displayManager = { - sddm = { - enable = true; - wayland.enable = true; - }; - autoLogin = { - enable = true; - user = "chris"; - }; - }; -# services.xserver.desktopManager.plasma5.enable = true; - services.desktopManager.plasma6.enable = true; - - - # Configure keymap in X11 - # services.xserver.xkb.layout = "us"; - # services.xserver.xkb.options = "eurosign:e,caps:escape"; - - # Enable CUPS to print documents. - # services.printing.enable = true; - # Enable sound. - sound.enable = true; -# hardware.pulseaudio.enable = true; + sound.enable = false; + hardware.pulseaudio.enable = false; + users.extraGroups.audio.members = [ "chris" ]; security.rtkit.enable = true; services.pipewire = { enable = true; - alsa.enable = true; + alsa.enable = true + alsa.support32Bit = true; pulse.enable = true; + jack.enable = true; }; # Define a user account. Don't forget to set a password with ‘passwd’. @@ -128,7 +73,7 @@ environment.systemPackages = with pkgs; [ neovim wget - chromium +# chromium thunderbird zoxide bottles diff --git a/modules/desktop/plasma.nix b/modules/desktop/plasma.nix new file mode 100644 index 0000000..04029b6 --- /dev/null +++ b/modules/desktop/plasma.nix @@ -0,0 +1,24 @@ +{ pkgs, ... }: +{ + services = { + displayManager = { + sddm = { + enable = true; + wayland.enable = true; + }; + autoLogin = { + enable = true; + user = "chris"; + }; + }; + }; + + services.desktopManager.plasma6.enable = true; + + environment.plasma6.excludePackages = with pkgs.kdePackages; [ + konsole + ]; + + # should enable theme integration with gtk apps (i.e. firefox, thunderbird) + programs.dconf.enable = true; +} diff --git a/modules/home-manager/nextcloud.nix b/modules/home-manager/nextcloud.nix new file mode 100644 index 0000000..3ba8387 --- /dev/null +++ b/modules/home-manager/nextcloud.nix @@ -0,0 +1,30 @@ +{ ... }: +{ + home.file.".netrc".text = '' + login root + password KaasIsAwesome! + ''; + + systemd.user = { + services.nextcloud-autosync = { + Unit = { + Description = "Automatic nextcloud sync"; + After = "network-online.target"; + }; + Service = { + Type = "simple"; + ExecStart = "${pkgs.nextcloud-client}/bin/nextcloudcmd -h -n --path /var/music /home/chris/Music https://cloud.kruining.eu"; + TimeoutStopSec = "180"; + KillMode = "process"; + KillSignal = "SIGINT"; + }; + Install.WantedBy = [ "multi-user.target" ]; + }; + timers.nextcloud-autosync = { + Unit.Description = "Automatic nextcloud sync"; + Timer.OnBootSec = "5min"; + Timer.OnUnitActiveSec = "60min"; + Install.WantedBy = [ "multi-user.target" "timers.target" ]; + }; + }; +} diff --git a/modules/programs/desktop.nix b/modules/programs/desktop.nix deleted file mode 100644 index 47769b6..0000000 --- a/modules/programs/desktop.nix +++ /dev/null @@ -1,6 +0,0 @@ -{ config, pkgs, options, ... }: -{ - environment.systemPackages = with pkgs; [ - ladybird - ]; -} diff --git a/modules/system/audio.nix b/modules/system/audio.nix new file mode 100644 index 0000000..c4c5fb4 --- /dev/null +++ b/modules/system/audio.nix @@ -0,0 +1,19 @@ +{ pkgs, ... }: +{ + sound.enable = false; + hardware.pulseaudio.enable = false; + + users.extraGroups.audio.members = [ "chris" ]; + + security.rtkit.enable = true; + + services.pipewire = { + enable = true; + alsa = { + enable = true; + support32Bit = true; + }; + pulse.enable = true; + jack.enable = true; + }; +} diff --git a/modules/system/boot.nix b/modules/system/boot.nix new file mode 100644 index 0000000..b54ae1e --- /dev/null +++ b/modules/system/boot.nix @@ -0,0 +1,15 @@ +{}: +{ + boot.loader.systemd-boot-enable = true; + + fileSystems."/home/chris/new_games" = { + device = "/dev/disk/by-label/games"; + fsType = "ext4"; + }; + + fileSystems."/home/chris/data" = { + device = "/dev/disk/by-label/Data"; + fsType = "ntfs-3g"; + options = [ "rw" "uid=chris" ]; + }; +} diff --git a/modules/system/zsa_voyager.nix b/modules/system/zsa_voyager.nix new file mode 100644 index 0000000..c900954 --- /dev/null +++ b/modules/system/zsa_voyager.nix @@ -0,0 +1,35 @@ +{ config, pkgs, options, ... }: +{ + environment.systemPackages = with pkgs; [ + keymapp + ]; + + hardware.keyboard.zsa.enable = true; + + services.udev.extraRules = '' + # Rules for Oryx web flashing and live training + KERNEL=="hidraw*", ATTRS{idVendor}=="16c0", MODE="0664", GROUP="plugdev" + KERNEL=="hidraw*", ATTRS{idVendor}=="3297", MODE="0664", GROUP="plugdev" + + # Legacy rules for live training over webusb (Not needed for firmware v21+) + # Rule for all ZSA keyboards + SUBSYSTEM=="usb", ATTR{idVendor}=="3297", GROUP="plugdev" + # Rule for the Moonlander + SUBSYSTEM=="usb", ATTR{idVendor}=="3297", ATTR{idProduct}=="1969", GROUP="plugdev" + # Rule for the Ergodox EZ + SUBSYSTEM=="usb", ATTR{idVendor}=="feed", ATTR{idProduct}=="1307", GROUP="plugdev" + # Rule for the Planck EZ + SUBSYSTEM=="usb", ATTR{idVendor}=="feed", ATTR{idProduct}=="6060", GROUP="plugdev" + + # Wally Flashing rules for the Ergodox EZ + ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="04[789B]?", ENV{ID_MM_DEVICE_IGNORE}="1" + ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="04[789A]?", ENV{MTP_NO_PROBE}="1" + SUBSYSTEMS=="usb", ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="04[789ABCD]?", MODE:="0666" + KERNEL=="ttyACM*", ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="04[789B]?", MODE:="0666" + + # Keymapp / Wally Flashing rules for the Moonlander and Planck EZ + SUBSYSTEMS=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="df11", MODE:="0666", SYMLINK+="stm32_dfu" + # Keymapp Flashing rules for the Voyager + SUBSYSTEMS=="usb", ATTRS{idVendor}=="3297", MODE:="0666", SYMLINK+="ignition_dfu" + ''; +}