diff --git a/flake.nix b/flake.nix index 9d74520..3295a0a 100644 --- a/flake.nix +++ b/flake.nix @@ -3,25 +3,28 @@ nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; }; - outputs = { self, nixpkgs } @ inputs: - let lib = nixpkgs.lib; in - let mod = import ./mod { inherit lib; }; in - let specialArgs = { inherit inputs mod; }; in + outputs = + { self, nixpkgs }@inputs: + let + lib = nixpkgs.lib; + mod = import ./mod { inherit lib; }; + specialArgs = { inherit inputs mod; }; + in { nixosConfigurations = { - "solo" = nixpkgs.lib.nixosSystem - { + "solo" = nixpkgs.lib.nixosSystem { system = "x86_64-linux"; inherit specialArgs; modules = [ ./host/solo ]; }; - "c2" = nixpkgs.lib.nixosSystem - { + "c2" = nixpkgs.lib.nixosSystem { system = "x86_64-linux"; inherit specialArgs; modules = [ ./host/c2 ]; }; }; + + formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.nixfmt-rfc-style; }; } diff --git a/host/c2/default.nix b/host/c2/default.nix index 73d3ac3..574563a 100644 --- a/host/c2/default.nix +++ b/host/c2/default.nix @@ -1,9 +1,10 @@ -{ mod, ... }: { +{ mod, ... }: +{ networking.hostName = "c2"; imports = with mod; [ collections.pc-common - ./hardware-configuration.nix + ./hardware-configuration.nix ]; boot.loader.efi.efiSysMountPoint = "/boot/efi"; diff --git a/host/c2/hardware-configuration.nix b/host/c2/hardware-configuration.nix index f88bc2f..4571ca3 100644 --- a/host/c2/hardware-configuration.nix +++ b/host/c2/hardware-configuration.nix @@ -1,41 +1,68 @@ # 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, ... }: +{ + config, + lib, + pkgs, + modulesPath, + ... +}: { - imports = - [ (modulesPath + "/installer/scan/not-detected.nix") - ]; + imports = [ + (modulesPath + "/installer/scan/not-detected.nix") + ]; - boot.initrd.availableKernelModules = [ "xhci_pci" "nvme" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ]; + boot.initrd.availableKernelModules = [ + "xhci_pci" + "nvme" + "usb_storage" + "sd_mod" + "rtsx_pci_sdmmc" + ]; boot.initrd.kernelModules = [ ]; boot.kernelModules = [ "kvm-intel" ]; boot.extraModulePackages = [ ]; - fileSystems."/" = - { device = "/dev/disk/by-uuid/0aa43f8a-a6e8-47aa-800d-b02d98f2cb8a"; - fsType = "btrfs"; - options = [ "noatime" "compress=zstd:1" "subvol=@" ]; - }; + fileSystems."/" = { + device = "/dev/disk/by-uuid/0aa43f8a-a6e8-47aa-800d-b02d98f2cb8a"; + fsType = "btrfs"; + options = [ + "noatime" + "compress=zstd:1" + "subvol=@" + ]; + }; - fileSystems."/nix" = - { device = "/dev/disk/by-uuid/0aa43f8a-a6e8-47aa-800d-b02d98f2cb8a"; - fsType = "btrfs"; - options = [ "noatime" "compress=zstd:1" "subvol=@nix" ]; - }; + fileSystems."/nix" = { + device = "/dev/disk/by-uuid/0aa43f8a-a6e8-47aa-800d-b02d98f2cb8a"; + fsType = "btrfs"; + options = [ + "noatime" + "compress=zstd:1" + "subvol=@nix" + ]; + }; - fileSystems."/home" = - { device = "/dev/disk/by-uuid/0aa43f8a-a6e8-47aa-800d-b02d98f2cb8a"; - fsType = "btrfs"; - options = [ "noatime" "compress=zstd:1" "subvol=@home" ]; - }; + fileSystems."/home" = { + device = "/dev/disk/by-uuid/0aa43f8a-a6e8-47aa-800d-b02d98f2cb8a"; + fsType = "btrfs"; + options = [ + "noatime" + "compress=zstd:1" + "subvol=@home" + ]; + }; - fileSystems."/boot/efi" = - { device = "/dev/disk/by-uuid/829B-BDFC"; - fsType = "vfat"; - options = [ "fmask=0022" "dmask=0022" ]; - }; + fileSystems."/boot/efi" = { + device = "/dev/disk/by-uuid/829B-BDFC"; + fsType = "vfat"; + options = [ + "fmask=0022" + "dmask=0022" + ]; + }; swapDevices = [ ]; diff --git a/host/solo/default.nix b/host/solo/default.nix index d41caa6..e675554 100644 --- a/host/solo/default.nix +++ b/host/solo/default.nix @@ -1,9 +1,10 @@ -{ mod, ... }: { +{ mod, ... }: +{ networking.hostName = "solo"; services.xserver.enable = true; - imports = with mod; [ + imports = with mod; [ collections.pc-common keyboard nvidia-gpu diff --git a/host/solo/hardware-configuration.nix b/host/solo/hardware-configuration.nix index 59e3331..5808edb 100644 --- a/host/solo/hardware-configuration.nix +++ b/host/solo/hardware-configuration.nix @@ -1,32 +1,47 @@ # 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, ... }: +{ + config, + lib, + pkgs, + modulesPath, + ... +}: { - imports = - [ (modulesPath + "/installer/scan/not-detected.nix") - ]; + imports = [ + (modulesPath + "/installer/scan/not-detected.nix") + ]; - boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usbhid" "sd_mod" ]; + boot.initrd.availableKernelModules = [ + "xhci_pci" + "ahci" + "nvme" + "usbhid" + "sd_mod" + ]; boot.initrd.kernelModules = [ ]; boot.kernelModules = [ "kvm-intel" ]; boot.extraModulePackages = [ ]; - fileSystems."/" = - { device = "/dev/disk/by-uuid/7554858a-648d-47d9-839a-6b66ef2b99d9"; - fsType = "ext4"; - }; + fileSystems."/" = { + device = "/dev/disk/by-uuid/7554858a-648d-47d9-839a-6b66ef2b99d9"; + fsType = "ext4"; + }; - fileSystems."/boot" = - { device = "/dev/disk/by-uuid/8040-8FF4"; - fsType = "vfat"; - options = [ "fmask=0077" "dmask=0077" ]; - }; - - swapDevices = - [ { device = "/dev/disk/by-uuid/9569220a-c151-44ca-a4db-037e63d314be"; } + fileSystems."/boot" = { + device = "/dev/disk/by-uuid/8040-8FF4"; + fsType = "vfat"; + options = [ + "fmask=0077" + "dmask=0077" ]; + }; + + swapDevices = [ + { device = "/dev/disk/by-uuid/9569220a-c151-44ca-a4db-037e63d314be"; } + ]; # 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/mod/audio.nix b/mod/audio.nix index b1a106f..8b99a64 100644 --- a/mod/audio.nix +++ b/mod/audio.nix @@ -1,9 +1,10 @@ -{ pkgs, ... }: { +{ pkgs, ... }: +{ environment.systemPackages = with pkgs; [ pavucontrol alsa-utils ]; - + services.pulseaudio.enable = false; services.pipewire = { enable = true; @@ -11,4 +12,4 @@ alsa.support32Bit = true; pulse.enable = true; }; -} \ No newline at end of file +} diff --git a/mod/boot.nix b/mod/boot.nix index 7076284..3060ab1 100644 --- a/mod/boot.nix +++ b/mod/boot.nix @@ -1,4 +1,5 @@ -{ ... }: { +{ ... }: +{ boot.loader = { efi.canTouchEfiVariables = true; grub = { @@ -7,4 +8,4 @@ device = "nodev"; }; }; -} \ No newline at end of file +} diff --git a/mod/collections/pc-common.nix b/mod/collections/pc-common.nix index e28672c..f2ddca4 100644 --- a/mod/collections/pc-common.nix +++ b/mod/collections/pc-common.nix @@ -1,4 +1,5 @@ -{ mod, ... }: { +{ mod, ... }: +{ imports = with mod; [ audio boot @@ -13,4 +14,4 @@ users window-manager ]; -} \ No newline at end of file +} diff --git a/mod/default.nix b/mod/default.nix index 063100e..049d6de 100644 --- a/mod/default.nix +++ b/mod/default.nix @@ -1,16 +1,21 @@ { lib, ... }: let - walk = path: - let dir = builtins.readDir path; - in lib.mapAttrs' (name: value: { + walk = + path: + let + dir = builtins.readDir path; + in + lib.mapAttrs' (name: value: { name = lib.removeSuffix ".nix" name; - value = if value == "regular" then - import (path + "/${name}") - else if value == "directory" then - walk (path + "/${name}") - else - builtins.throw "Cannot handle item of type ${value}"; + value = + if value == "regular" then + import (path + "/${name}") + else if value == "directory" then + walk (path + "/${name}") + else + builtins.throw "Cannot handle item of type ${value}"; }) dir; -in walk ./. +in +walk ./. diff --git a/mod/fonts.nix b/mod/fonts.nix index 999bd2a..9e5a1b7 100644 --- a/mod/fonts.nix +++ b/mod/fonts.nix @@ -1,4 +1,5 @@ -{ pkgs, ... }: { +{ pkgs, ... }: +{ fonts.packages = with pkgs; [ noto-fonts noto-fonts-cjk-sans @@ -7,4 +8,4 @@ ]; fonts.fontDir.enable = true; fonts.fontconfig.defaultFonts.monospace = [ "Noto Nerd Font Mono" ]; -} \ No newline at end of file +} diff --git a/mod/games.nix b/mod/games.nix index 1023d3f..830b445 100644 --- a/mod/games.nix +++ b/mod/games.nix @@ -1,7 +1,8 @@ -{ pkgs, ... }: { +{ pkgs, ... }: +{ environment.systemPackages = with pkgs; [ runelite ]; programs.steam.enable = true; -} \ No newline at end of file +} diff --git a/mod/keyboard.nix b/mod/keyboard.nix index 7b547db..7b8aff4 100644 --- a/mod/keyboard.nix +++ b/mod/keyboard.nix @@ -1,4 +1,5 @@ -{ pkgs, ... }: { +{ pkgs, ... }: +{ # hardware.keyboard.qmk.enable = true; environment.systemPackages = with pkgs; [ vial ]; services.udev.packages = with pkgs; [ vial ]; diff --git a/mod/locale.nix b/mod/locale.nix index b6aeb34..a01e002 100644 --- a/mod/locale.nix +++ b/mod/locale.nix @@ -1,4 +1,5 @@ -{ ... }: { +{ ... }: +{ time.timeZone = "Europe/Berlin"; i18n.defaultLocale = "en_US.UTF-8"; @@ -21,4 +22,4 @@ layout = "de"; variant = ""; }; -} \ No newline at end of file +} diff --git a/mod/network.nix b/mod/network.nix index a1dbd8e..d4015cf 100644 --- a/mod/network.nix +++ b/mod/network.nix @@ -1,4 +1,5 @@ -{ ... }: { +{ ... }: +{ networking.networkmanager.enable = true; networking.networkmanager.wifi.macAddress = "random"; @@ -10,7 +11,7 @@ useRoutingFeatures = "client"; }; - networking.networkmanager.ensureProfiles.profiles = { + networking.networkmanager.ensureProfiles.profiles = { "tuda-vpn" = { connection = { autoconnect = "false"; @@ -81,4 +82,4 @@ }; }; }; -} \ No newline at end of file +} diff --git a/mod/nix.nix b/mod/nix.nix index 08aeec4..d5be4d4 100644 --- a/mod/nix.nix +++ b/mod/nix.nix @@ -1,27 +1,36 @@ -{ lib, ... }: { +{ lib, ... }: +{ nix.settings = { - experimental-features = [ "nix-command" "flakes" ]; - trusted-users = [ "root" "@wheel" ]; + experimental-features = [ + "nix-command" + "flakes" + ]; + trusted-users = [ + "root" + "@wheel" + ]; auto-optimise-store = true; }; - + programs.nix-ld.enable = true; nixpkgs.config.allowUnfree = false; - nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [ - "nvidia-x11" - "nvidia-settings" - "vscode" - "obsidian" - "steam" - "steam-unwrapped" - "gateway" # jetbrains - "spotify" - "rust-rover" - ]; + nixpkgs.config.allowUnfreePredicate = + pkg: + builtins.elem (lib.getName pkg) [ + "nvidia-x11" + "nvidia-settings" + "vscode" + "obsidian" + "steam" + "steam-unwrapped" + "gateway" # jetbrains + "spotify" + "rust-rover" + ]; # TODO this is for zulip 5.11.1 nixpkgs.config.permittedInsecurePackages = [ "electron-32.3.3" ]; -} \ No newline at end of file +} diff --git a/mod/nvidia-gpu.nix b/mod/nvidia-gpu.nix index cb7172f..b02eb3e 100644 --- a/mod/nvidia-gpu.nix +++ b/mod/nvidia-gpu.nix @@ -1,6 +1,7 @@ -{ config, ... }: { +{ config, ... }: +{ services.xserver.videoDrivers = [ "nvidia" ]; - + hardware.graphics = { enable = true; enable32Bit = true; @@ -8,7 +9,7 @@ hardware.nvidia = { package = config.boot.kernelPackages.nvidiaPackages.stable; - + modesetting.enable = true; nvidiaSettings = true; @@ -16,7 +17,7 @@ powerManagement = { enable = true; finegrained = false; - }; + }; }; boot.kernelParams = [ diff --git a/mod/security.nix b/mod/security.nix index 0834041..2198a04 100644 --- a/mod/security.nix +++ b/mod/security.nix @@ -1,3 +1,4 @@ -{ ... }: { +{ ... }: +{ security.rtkit.enable = true; } diff --git a/mod/services.nix b/mod/services.nix index e1a9a37..52c8227 100644 --- a/mod/services.nix +++ b/mod/services.nix @@ -1,4 +1,5 @@ -{ ... }: { +{ ... }: +{ systemd.services.NetworkManager-wait-online.enable = false; services.printing.enable = true; services.avahi = { @@ -7,4 +8,4 @@ openFirewall = true; }; services.udisks2.enable = true; -} \ No newline at end of file +} diff --git a/mod/shell.nix b/mod/shell.nix index 97ee694..27c9cb8 100644 --- a/mod/shell.nix +++ b/mod/shell.nix @@ -1,5 +1,6 @@ -{ pkgs, ... }: { - environment.shells = with pkgs; [ +{ pkgs, ... }: +{ + environment.shells = with pkgs; [ fish bashInteractive ]; diff --git a/mod/software.nix b/mod/software.nix index ee8a1bd..4535c00 100644 --- a/mod/software.nix +++ b/mod/software.nix @@ -1,52 +1,50 @@ -{ pkgs, ... }: { +{ pkgs, ... }: +{ - environment.systemPackages = let - editors = with pkgs; [ - vscode - emacs - jetbrains.gateway - jetbrains.rust-rover - ]; + environment.systemPackages = + let + editors = with pkgs; [ + vscode + emacs + jetbrains.gateway + jetbrains.rust-rover + ]; - messengers = with pkgs; [ - signal-desktop - element-desktop - zulip - vesktop - ]; + messengers = with pkgs; [ + signal-desktop + element-desktop + zulip + vesktop + ]; - util = with pkgs; [ - wireguard-tools - bitwarden - kitty - nixfmt-rfc-style - nil - ]; + util = with pkgs; [ + wireguard-tools + bitwarden + kitty + nixfmt-rfc-style + nil + ]; - media = with pkgs; [ - vlc - spotify - calibre - ]; + media = with pkgs; [ + vlc + spotify + calibre + ]; - productivity = with pkgs; [ - zotero - obsidian - ]; + productivity = with pkgs; [ + zotero + obsidian + ]; - dev = with pkgs; [ - rustup - python313 - gcc - binutils - ]; + dev = with pkgs; [ + rustup + python313 + gcc + binutils + ]; - in editors - ++ messengers - ++ util - ++ media - ++ productivity - ++ dev; + in + editors ++ messengers ++ util ++ media ++ productivity ++ dev; virtualisation = { docker.enable = true; diff --git a/mod/users.nix b/mod/users.nix index 55f3c8b..539980e 100644 --- a/mod/users.nix +++ b/mod/users.nix @@ -1,9 +1,13 @@ -{ pkgs, ... }: { +{ pkgs, ... }: +{ users.users.hd = { description = "Henri"; isNormalUser = true; - extraGroups = [ "networkmanager" "wheel" ]; + extraGroups = [ + "networkmanager" + "wheel" + ]; shell = pkgs.fish; - packages = []; + packages = [ ]; }; -} \ No newline at end of file +} diff --git a/mod/window-manager.nix b/mod/window-manager.nix index c00d32e..6cf6e43 100644 --- a/mod/window-manager.nix +++ b/mod/window-manager.nix @@ -1,8 +1,9 @@ -{ pkgs, ... }: { +{ pkgs, ... }: +{ # Enable the KDE Plasma Desktop Environment. services.displayManager.sddm = { enable = true; wayland.enable = true; }; services.desktopManager.plasma6.enable = true; -} \ No newline at end of file +}