From ebedd9092359d2ea0b3beaa1c2355b505fbe9b13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20R=C3=B6ger?= Date: Wed, 17 Apr 2024 16:47:06 +0200 Subject: [PATCH] foamat code --- flake.nix | 30 +++++--- home/jonas/firefox.nix | 30 +++++--- home/jonas/home.nix | 6 +- home/jonas/plasma.nix | 73 ++++++++++--------- home/jonas/yubikey.nix | 4 +- hosts/comfy-station/configuration.nix | 47 ++++++------ .../comfy-station/hardware-configuration.nix | 44 ++++++----- hosts/vm/configuration.nix | 34 ++++----- hosts/vm/hardware-configuration.nix | 36 +++++---- modules/chat/default.nix | 8 +- modules/desktop/de/default.nix | 6 +- modules/desktop/de/hyprland.nix | 11 +-- modules/desktop/de/plasma.nix | 14 ++-- modules/desktop/dm/default.nix | 13 ++-- modules/desktop/dm/gdm.nix | 12 +-- modules/desktop/dm/sddm.nix | 13 ++-- modules/desktop/fonts/default.nix | 7 +- modules/hardware/bluetooth.nix | 6 +- modules/hardware/printing.nix | 6 +- modules/hardware/sound.nix | 6 +- modules/hardware/yubikey.nix | 5 +- modules/multimedia/default.nix | 8 +- modules/services/docker.nix | 6 +- 23 files changed, 231 insertions(+), 194 deletions(-) diff --git a/flake.nix b/flake.nix index ab18267..f48e539 100644 --- a/flake.nix +++ b/flake.nix @@ -20,8 +20,14 @@ }; }; - outputs = { self, nixpkgs, nixpkgs-unstable, home-manager, plasma-manager, ... }@inputs : - let + outputs = { + self, + nixpkgs, + nixpkgs-unstable, + home-manager, + plasma-manager, + ... + } @ inputs: let system = "x86_64-linux"; overlay-unstable = final: prev: { unstable = nixpkgs-unstable.legacyPackages.${prev.system}; @@ -34,13 +40,18 @@ inherit inputs; }; modules = [ - ({ config, pkgs, ... }: { nixpkgs.overlays = [ overlay-unstable ]; }) + ({ + config, + pkgs, + ... + }: {nixpkgs.overlays = [overlay-unstable];}) ./hosts/comfy-station/configuration.nix - home-manager.nixosModules.home-manager { - home-manager.extraSpecialArgs = { inherit inputs; }; + home-manager.nixosModules.home-manager + { + home-manager.extraSpecialArgs = {inherit inputs;}; home-manager.useGlobalPkgs = true; home-manager.useUserPackages = true; - home-manager.sharedModules = [ plasma-manager.homeManagerModules.plasma-manager ]; + home-manager.sharedModules = [plasma-manager.homeManagerModules.plasma-manager]; home-manager.users.jonas = import ./home/jonas/home.nix; } ]; @@ -52,11 +63,12 @@ }; modules = [ ./hosts/vm/configuration.nix - home-manager.nixosModules.home-manager { - home-manager.extraSpecialArgs = { inherit inputs; }; + home-manager.nixosModules.home-manager + { + home-manager.extraSpecialArgs = {inherit inputs;}; home-manager.useGlobalPkgs = true; home-manager.useUserPackages = true; - home-manager.sharedModules = [ plasma-manager.homeManagerModules.plasma-manager ]; + home-manager.sharedModules = [plasma-manager.homeManagerModules.plasma-manager]; home-manager.users.jonas = import ./home/jonas/home.nix; } ]; diff --git a/home/jonas/firefox.nix b/home/jonas/firefox.nix index 7e58733..3809ee2 100644 --- a/home/jonas/firefox.nix +++ b/home/jonas/firefox.nix @@ -1,6 +1,8 @@ -{ config, inputs, ... }: - { + config, + inputs, + ... +}: { programs.firefox = { enable = true; @@ -13,17 +15,25 @@ # Search search = { default = "DuckDuckGo"; - order = [ "DuckDuckGo" "Google" ]; + order = ["DuckDuckGo" "Google"]; force = true; engines = { "Nix Packages" = { - urls = [{ - template = "https://search.nixos.org/packages"; - params = [ - { name = "type"; value = "packages"; } - { name = "query"; value = "{searchTerms}"; } - ]; - }]; + urls = [ + { + template = "https://search.nixos.org/packages"; + params = [ + { + name = "type"; + value = "packages"; + } + { + name = "query"; + value = "{searchTerms}"; + } + ]; + } + ]; }; }; }; diff --git a/home/jonas/home.nix b/home/jonas/home.nix index 66d5c0e..7511491 100644 --- a/home/jonas/home.nix +++ b/home/jonas/home.nix @@ -1,6 +1,8 @@ -{ config, pkgs, ... }: - { + config, + pkgs, + ... +}: { imports = [ ./firefox.nix ./plasma.nix diff --git a/home/jonas/plasma.nix b/home/jonas/plasma.nix index f3f8cc4..7bf6fc0 100644 --- a/home/jonas/plasma.nix +++ b/home/jonas/plasma.nix @@ -1,5 +1,8 @@ -{ pkgs, lib, ... }: { + pkgs, + lib, + ... +}: { home.file.".local/share/wallpaper" = { source = ./static/wallpaper; recursive = true; @@ -78,50 +81,48 @@ } ]; - # # Some mid-level settings: # shortcuts = { ksmserver = { - "Lock Session" = [ "Screensaver" "Meta+Ctrl+Alt+L" ]; + "Lock Session" = ["Screensaver" "Meta+Ctrl+Alt+L"]; }; - kwin = { - "Expose" = "Meta+,"; - "Switch Window Down" = "Meta+J"; - "Switch Window Left" = "Meta+H"; - "Switch Window Right" = "Meta+L"; - "Switch Window Up" = "Meta+K"; - "Window Quick Tile Bottom" = "Meta+Shift+J"; - "Window Quick Tile Left" = "Meta+Shift+H"; - "Window Quick Tile Right" = "Meta+Shift+L"; - "Window Quick Tile Top" = "Meta+Shift+K"; - "Kill Window" = "Meta+Alt+Q"; - "Window Close" = "Meta+Shift+Q"; - } // ( - with lib; - let - desktops = map toString (lists.range 1 8); - in - listToAttrs - (map - (i: { - name = "Switch to Desktop ${i}"; - value = "Meta+${i}"; - }) - desktops) - // - listToAttrs (map - (i: { - name = "Window to Desktop ${i}"; - value = "Meta+Shift+${i}"; - }) - desktops) - ); + kwin = + { + "Expose" = "Meta+,"; + "Switch Window Down" = "Meta+J"; + "Switch Window Left" = "Meta+H"; + "Switch Window Right" = "Meta+L"; + "Switch Window Up" = "Meta+K"; + "Window Quick Tile Bottom" = "Meta+Shift+J"; + "Window Quick Tile Left" = "Meta+Shift+H"; + "Window Quick Tile Right" = "Meta+Shift+L"; + "Window Quick Tile Top" = "Meta+Shift+K"; + "Kill Window" = "Meta+Alt+Q"; + "Window Close" = "Meta+Shift+Q"; + } + // ( + with lib; let + desktops = map toString (lists.range 1 8); + in + listToAttrs + (map + (i: { + name = "Switch to Desktop ${i}"; + value = "Meta+${i}"; + }) + desktops) + // listToAttrs (map + (i: { + name = "Window to Desktop ${i}"; + value = "Meta+Shift+${i}"; + }) + desktops) + ); }; - # # Some low-level settings: # diff --git a/home/jonas/yubikey.nix b/home/jonas/yubikey.nix index 411753a..eeb098b 100644 --- a/home/jonas/yubikey.nix +++ b/home/jonas/yubikey.nix @@ -1,6 +1,4 @@ -{ config, ... }: - -{ +{config, ...}: { programs.gpg = { enable = true; mutableKeys = false; diff --git a/hosts/comfy-station/configuration.nix b/hosts/comfy-station/configuration.nix index ec53439..20da595 100644 --- a/hosts/comfy-station/configuration.nix +++ b/hosts/comfy-station/configuration.nix @@ -1,31 +1,32 @@ # Edit this configuration file to define what should be installed on # your system. Help is available in the configuration.nix(5) man page # and in the NixOS manual (accessible by running ‘nixos-help’). - -{ config, pkgs, inputs, ... }: - { - imports = - [ # Include the results of the hardware scan. - ./hardware-configuration.nix - inputs.home-manager.nixosModules.home-manager - ../../modules/hardware/bluetooth.nix - ../../modules/hardware/printing.nix - ../../modules/hardware/sound.nix - ../../modules/hardware/yubikey.nix - ../../modules/services/docker.nix - ../../modules/desktop/dm - ../../modules/desktop/de - ../../modules/desktop/fonts - ../../modules/chat - ../../modules/multimedia - ]; + config, + pkgs, + inputs, + ... +}: { + imports = [ + # Include the results of the hardware scan. + ./hardware-configuration.nix + inputs.home-manager.nixosModules.home-manager + ../../modules/hardware/bluetooth.nix + ../../modules/hardware/printing.nix + ../../modules/hardware/sound.nix + ../../modules/hardware/yubikey.nix + ../../modules/services/docker.nix + ../../modules/desktop/dm + ../../modules/desktop/de + ../../modules/desktop/fonts + ../../modules/chat + ../../modules/multimedia + ]; desktop.dm.name = "sddm"; desktop.dm.autologin = "jonas"; desktop.de.plasma.enable = true; - - nix.settings.experimental-features = [ "nix-command" "flakes" ]; + nix.settings.experimental-features = ["nix-command" "flakes"]; # Enable touchpad support (enabled default in most desktopManager). # services.xserver.libinput.enable = true; @@ -34,7 +35,7 @@ users.users.jonas = { isNormalUser = true; description = "Jonas"; - extraGroups = [ "networkmanager" "wheel" "docker"]; + extraGroups = ["networkmanager" "wheel" "docker"]; }; users.defaultUserShell = pkgs.zsh; @@ -46,6 +47,7 @@ # List packages installed in system profile. To search, run: # $ nix search wget environment.systemPackages = with pkgs; [ + alejandra docker git ranger @@ -119,7 +121,4 @@ # touchpad services.xserver.libinput.touchpad.naturalScrolling = true; - - # steam - programs.steam.enable = true; } diff --git a/hosts/comfy-station/hardware-configuration.nix b/hosts/comfy-station/hardware-configuration.nix index e2069f7..ea64137 100644 --- a/hosts/comfy-station/hardware-configuration.nix +++ b/hosts/comfy-station/hardware-configuration.nix @@ -1,33 +1,37 @@ # Do not modify this file! It was generated by ‘nixos-generate-config’ # and may be overwritten by future invocations. Please make changes # to /etc/nixos/configuration.nix instead. -{ config, lib, pkgs, modulesPath, ... }: - { - imports = - [ (modulesPath + "/installer/scan/not-detected.nix") - ]; + config, + lib, + pkgs, + modulesPath, + ... +}: { + imports = [ + (modulesPath + "/installer/scan/not-detected.nix") + ]; - boot.initrd.availableKernelModules = [ "nvme" "ehci_pci" "xhci_pci" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ]; - boot.initrd.kernelModules = [ "dm-snapshot" ]; - boot.kernelModules = [ "kvm-amd" ]; - boot.extraModulePackages = [ ]; + boot.initrd.availableKernelModules = ["nvme" "ehci_pci" "xhci_pci" "usb_storage" "sd_mod" "rtsx_pci_sdmmc"]; + boot.initrd.kernelModules = ["dm-snapshot"]; + boot.kernelModules = ["kvm-amd"]; + boot.extraModulePackages = []; boot.initrd.luks.devices."lvm-root".device = "/dev/disk/by-uuid/0b55681d-5c7b-4045-b895-d1eb7e306ffb"; - fileSystems."/" = - { device = "/dev/disk/by-uuid/88f53721-1c3f-43fd-8875-59e597aacb10"; - fsType = "ext4"; - }; + fileSystems."/" = { + device = "/dev/disk/by-uuid/88f53721-1c3f-43fd-8875-59e597aacb10"; + fsType = "ext4"; + }; - fileSystems."/boot" = - { device = "/dev/disk/by-uuid/583D-114B"; - fsType = "vfat"; - }; + fileSystems."/boot" = { + device = "/dev/disk/by-uuid/583D-114B"; + fsType = "vfat"; + }; - swapDevices = - [ { device = "/dev/disk/by-uuid/f81521e7-4c09-4e91-8914-3dcd9febdfff"; } - ]; + swapDevices = [ + {device = "/dev/disk/by-uuid/f81521e7-4c09-4e91-8914-3dcd9febdfff";} + ]; # Enables DHCP on each ethernet and wireless interface. In case of scripted networking # (the default) this is the recommended approach. When using systemd-networkd it's diff --git a/hosts/vm/configuration.nix b/hosts/vm/configuration.nix index 8b788c4..3470ed0 100644 --- a/hosts/vm/configuration.nix +++ b/hosts/vm/configuration.nix @@ -1,27 +1,27 @@ # Edit this configuration file to define what should be installed on # your system. Help is available in the configuration.nix(5) man page # and in the NixOS manual (accessible by running ‘nixos-help’). - -{ pkgs, inputs, ... }: - { - imports = - [ # Include the results of the hardware scan. - ./hardware-configuration.nix - inputs.home-manager.nixosModules.home-manager - ../../modules/hardware/bluetooth.nix - ../../modules/hardware/printing.nix - ../../modules/hardware/sound.nix - ../../modules/services/docker.nix - ../../modules/desktop/dm - ../../modules/desktop/de - ]; + pkgs, + inputs, + ... +}: { + imports = [ + # Include the results of the hardware scan. + ./hardware-configuration.nix + inputs.home-manager.nixosModules.home-manager + ../../modules/hardware/bluetooth.nix + ../../modules/hardware/printing.nix + ../../modules/hardware/sound.nix + ../../modules/services/docker.nix + ../../modules/desktop/dm + ../../modules/desktop/de + ]; desktop.dm.name = "sddm"; desktop.dm.autologin = "jonas"; desktop.de.plasma.enable = true; - # Enable touchpad support (enabled default in most desktopManager). # services.xserver.libinput.enable = true; @@ -29,8 +29,8 @@ users.users.jonas = { isNormalUser = true; description = "Jonas"; - extraGroups = [ "networkmanager" "wheel" "docker"]; - packages = with pkgs; [ ]; + extraGroups = ["networkmanager" "wheel" "docker"]; + packages = with pkgs; []; }; users.defaultUserShell = pkgs.zsh; diff --git a/hosts/vm/hardware-configuration.nix b/hosts/vm/hardware-configuration.nix index ae9b81b..5b30829 100644 --- a/hosts/vm/hardware-configuration.nix +++ b/hosts/vm/hardware-configuration.nix @@ -1,27 +1,31 @@ # Do not modify this file! It was generated by ‘nixos-generate-config’ # and may be overwritten by future invocations. Please make changes # to /etc/nixos/configuration.nix instead. -{ config, lib, pkgs, modulesPath, ... }: - { - imports = [ ]; + config, + lib, + pkgs, + modulesPath, + ... +}: { + imports = []; - boot.initrd.availableKernelModules = [ "ata_piix" "ohci_pci" "ehci_pci" "ahci" "sd_mod" "sr_mod" ]; - boot.initrd.kernelModules = [ ]; - boot.kernelModules = [ ]; - boot.extraModulePackages = [ ]; + boot.initrd.availableKernelModules = ["ata_piix" "ohci_pci" "ehci_pci" "ahci" "sd_mod" "sr_mod"]; + boot.initrd.kernelModules = []; + boot.kernelModules = []; + boot.extraModulePackages = []; - fileSystems."/" = - { device = "/dev/disk/by-uuid/a28cd2c0-67f3-4492-9cd9-996fdbe2b8ef"; - fsType = "ext4"; - }; + fileSystems."/" = { + device = "/dev/disk/by-uuid/a28cd2c0-67f3-4492-9cd9-996fdbe2b8ef"; + fsType = "ext4"; + }; - fileSystems."/boot" = - { device = "/dev/disk/by-uuid/0134-2DF5"; - fsType = "vfat"; - }; + fileSystems."/boot" = { + device = "/dev/disk/by-uuid/0134-2DF5"; + fsType = "vfat"; + }; - swapDevices = [ ]; + swapDevices = []; # Enables DHCP on each ethernet and wireless interface. In case of scripted networking # (the default) this is the recommended approach. When using systemd-networkd it's diff --git a/modules/chat/default.nix b/modules/chat/default.nix index e427757..8505d2b 100644 --- a/modules/chat/default.nix +++ b/modules/chat/default.nix @@ -1,8 +1,10 @@ -{ config, pkgs, ... }: - { + config, + pkgs, + ... +}: { users.users."jonas".packages = with pkgs; [ discord zoom ]; -} \ No newline at end of file +} diff --git a/modules/desktop/de/default.nix b/modules/desktop/de/default.nix index 584d6c5..e6eeafa 100644 --- a/modules/desktop/de/default.nix +++ b/modules/desktop/de/default.nix @@ -1,8 +1,6 @@ -{ ... }: - -{ +{...}: { imports = [ ./hyprland.nix ./plasma.nix ]; -} \ No newline at end of file +} diff --git a/modules/desktop/de/hyprland.nix b/modules/desktop/de/hyprland.nix index 2f989b3..03d63d3 100644 --- a/modules/desktop/de/hyprland.nix +++ b/modules/desktop/de/hyprland.nix @@ -1,9 +1,10 @@ -{ lib, config, ... }: - -let - cfg = config.desktop.de.hyprland; -in { + lib, + config, + ... +}: let + cfg = config.desktop.de.hyprland; +in { options.desktop.de.hyprland = { enable = lib.mkEnableOption "enable hyprland desktop environment"; }; diff --git a/modules/desktop/de/plasma.nix b/modules/desktop/de/plasma.nix index 6fda574..3766307 100644 --- a/modules/desktop/de/plasma.nix +++ b/modules/desktop/de/plasma.nix @@ -1,9 +1,11 @@ -{ config, lib, pkgs, ... }: - -let - cfg = config.desktop.de.plasma; -in { + config, + lib, + pkgs, + ... +}: let + cfg = config.desktop.de.plasma; +in { options.desktop.de.plasma = { enable = lib.mkEnableOption "Enable Plasma desktop environment with sddm"; }; @@ -18,4 +20,4 @@ in libsForQt5.qtstyleplugin-kvantum ]; }; -} \ No newline at end of file +} diff --git a/modules/desktop/dm/default.nix b/modules/desktop/dm/default.nix index 1d5e047..bea2462 100644 --- a/modules/desktop/dm/default.nix +++ b/modules/desktop/dm/default.nix @@ -1,9 +1,10 @@ -{ config, lib, ... }: - -let - cfg = config.desktop.dm; -in { + config, + lib, + ... +}: let + cfg = config.desktop.dm; +in { options.desktop.dm = with lib; { name = mkOption { type = types.nullOr (types.enum ["sddm" "gdm"]); @@ -34,7 +35,7 @@ in xkbVariant = ""; xkbOptions = "caps:ctrl_modifier"; }; - services.xserver.displayManager.autoLogin.enable = (cfg.autologin != null); + services.xserver.displayManager.autoLogin.enable = cfg.autologin != null; services.xserver.displayManager.autoLogin.user = cfg.autologin; }; } diff --git a/modules/desktop/dm/gdm.nix b/modules/desktop/dm/gdm.nix index d80c1d6..7a2c7ef 100644 --- a/modules/desktop/dm/gdm.nix +++ b/modules/desktop/dm/gdm.nix @@ -1,12 +1,14 @@ -{ lib, config, ... }: -let - cfg = config.desktop.dm; -in { + lib, + config, + ... +}: let + cfg = config.desktop.dm; +in { config = lib.mkIf (cfg.name == "gdm") { services.xserver.displayManager.gdm = { enable = true; wayland = cfg.wayland; }; }; -} \ No newline at end of file +} diff --git a/modules/desktop/dm/sddm.nix b/modules/desktop/dm/sddm.nix index 079db04..1a817e0 100644 --- a/modules/desktop/dm/sddm.nix +++ b/modules/desktop/dm/sddm.nix @@ -1,13 +1,14 @@ -{ lib, config, ... }: - -let - cfg = config.desktop.dm; -in { + lib, + config, + ... +}: let + cfg = config.desktop.dm; +in { config = lib.mkIf (cfg.name == "sddm") { services.xserver.displayManager.sddm = { enable = true; wayland.enable = cfg.wayland; }; }; -} \ No newline at end of file +} diff --git a/modules/desktop/fonts/default.nix b/modules/desktop/fonts/default.nix index 729b40e..66a3fd3 100644 --- a/modules/desktop/fonts/default.nix +++ b/modules/desktop/fonts/default.nix @@ -1,6 +1,9 @@ -{ config, pkgs, ... }: { + config, + pkgs, + ... +}: { environment.systemPackages = with pkgs; [ fira-code ]; -} \ No newline at end of file +} diff --git a/modules/hardware/bluetooth.nix b/modules/hardware/bluetooth.nix index cfd6a72..58a7426 100644 --- a/modules/hardware/bluetooth.nix +++ b/modules/hardware/bluetooth.nix @@ -1,6 +1,4 @@ -{ config, ... }: - -{ +{config, ...}: { # Enable Bluetooth hardware.bluetooth.enable = true; -} \ No newline at end of file +} diff --git a/modules/hardware/printing.nix b/modules/hardware/printing.nix index 92b7d1f..d178e3b 100644 --- a/modules/hardware/printing.nix +++ b/modules/hardware/printing.nix @@ -1,6 +1,4 @@ -{ config, ... }: - -{ +{config, ...}: { # Enable CUPS to print documents. services.printing.enable = true; -} \ No newline at end of file +} diff --git a/modules/hardware/sound.nix b/modules/hardware/sound.nix index 30ac6f4..66ec273 100644 --- a/modules/hardware/sound.nix +++ b/modules/hardware/sound.nix @@ -1,6 +1,4 @@ -{ config, ... }: - -{ +{config, ...}: { # Enable sound with pipewire. sound.enable = true; hardware.pulseaudio.enable = false; @@ -17,4 +15,4 @@ # no need to redefine it in your config for now) #media-session.enable = true; }; -} \ No newline at end of file +} diff --git a/modules/hardware/yubikey.nix b/modules/hardware/yubikey.nix index 10c24a0..11f680c 100644 --- a/modules/hardware/yubikey.nix +++ b/modules/hardware/yubikey.nix @@ -1,5 +1,8 @@ -{ config, pkgs, ... }: { + config, + pkgs, + ... +}: { # Include udev rules for yubikey. services.udev.packages = with pkgs; [ yubikey-personalization diff --git a/modules/multimedia/default.nix b/modules/multimedia/default.nix index ba25b15..72d70b3 100644 --- a/modules/multimedia/default.nix +++ b/modules/multimedia/default.nix @@ -1,9 +1,11 @@ -{ config, pkgs, ... }: - { + config, + pkgs, + ... +}: { programs.steam.enable = true; users.users."jonas".packages = with pkgs; [ lutris spotify ]; -} \ No newline at end of file +} diff --git a/modules/services/docker.nix b/modules/services/docker.nix index ed25305..7fe2103 100644 --- a/modules/services/docker.nix +++ b/modules/services/docker.nix @@ -1,5 +1,3 @@ -{ config, ... }: - -{ +{config, ...}: { virtualisation.docker.enable = true; -} \ No newline at end of file +}