Split up code to support server configuration
This commit is contained in:
		
							parent
							
								
									6364d8afa0
								
							
						
					
					
						commit
						fa2413f272
					
				| @ -72,6 +72,12 @@ | |||||||
|             configuration = ./users/jan.nix; |             configuration = ./users/jan.nix; | ||||||
|           }; |           }; | ||||||
|         }; |         }; | ||||||
|  |         "vm-audio" = mkConfig "x86_64-linux" ./machines/vm-audio.nix { | ||||||
|  |           jan = { | ||||||
|  |             sudo = true; | ||||||
|  |             configuration = ./users/server.nix; | ||||||
|  |           }; | ||||||
|  |         }; | ||||||
|       }; |       }; | ||||||
|       lib = import ./shell-modules/default.nix self.inputs; |       lib = import ./shell-modules/default.nix self.inputs; | ||||||
|     }; |     }; | ||||||
|  | |||||||
| @ -15,7 +15,7 @@ | |||||||
| 
 | 
 | ||||||
|     # Enabled modules |     # Enabled modules | ||||||
|     modules = { |     modules = { | ||||||
|       base.enable = true; |       base.desktop.enable = true; | ||||||
|       bluetooth.enable = true; |       bluetooth.enable = true; | ||||||
|       power-saving.enable = false; |       power-saving.enable = false; | ||||||
|       networkmanager.enable = true; |       networkmanager.enable = true; | ||||||
|  | |||||||
							
								
								
									
										55
									
								
								machines/vm-audio.nix
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										55
									
								
								machines/vm-audio.nix
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,55 @@ | |||||||
|  | { lib, ... }: | ||||||
|  | 
 | ||||||
|  | { | ||||||
|  |   imports = [ | ||||||
|  |     # Import environment | ||||||
|  |     ./vm-base.nix | ||||||
|  |   ]; | ||||||
|  | 
 | ||||||
|  |   config = { | ||||||
|  |     # Machine hostname | ||||||
|  |     networking.hostName = "vm-audio"; | ||||||
|  | 
 | ||||||
|  |     # Enabled modules | ||||||
|  |     modules = { | ||||||
|  |     }; | ||||||
|  | 
 | ||||||
|  |     # Hardware configuration | ||||||
|  |     hardware.enableRedistributableFirmware = true; | ||||||
|  |     boot.initrd.availableKernelModules = [ | ||||||
|  |       "ata_piix" | ||||||
|  |       "uhci_hcd" | ||||||
|  |       "virtio_pci" | ||||||
|  |       "virtio_scsi" | ||||||
|  |       "sd_mod" | ||||||
|  |       "sr_mod" | ||||||
|  |     ]; | ||||||
|  |     boot.initrd.kernelModules = [ ]; | ||||||
|  |     boot.kernelModules = [ "kvm-intel" ]; | ||||||
|  |     boot.extraModulePackages = [ ]; | ||||||
|  |     hardware.cpu.intel.updateMicrocode = true; | ||||||
|  | 
 | ||||||
|  |     # Filesystems | ||||||
|  |     fileSystems."/" = { | ||||||
|  |       device = "/dev/disk/by-partlabel/root"; | ||||||
|  |       fsType = "ext4"; | ||||||
|  |     }; | ||||||
|  | 
 | ||||||
|  |     fileSystems."/boot" = { | ||||||
|  |       device = "/dev/disk/by-partlabel/EFI"; | ||||||
|  |       fsType = "vfat"; | ||||||
|  |       options = [ | ||||||
|  |         "fmask=0077" | ||||||
|  |         "dmask=0077" | ||||||
|  |       ]; | ||||||
|  |     }; | ||||||
|  | 
 | ||||||
|  |     # Swapfile | ||||||
|  |     swapDevices = [ | ||||||
|  |       { | ||||||
|  |         device = "/var/lib/swapfile"; | ||||||
|  |         size = 6 * 1024; | ||||||
|  |       } | ||||||
|  |     ]; | ||||||
|  |   }; | ||||||
|  | } | ||||||
							
								
								
									
										60
									
								
								machines/vm-base.nix
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										60
									
								
								machines/vm-base.nix
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,60 @@ | |||||||
|  | { lib, ... }: | ||||||
|  | 
 | ||||||
|  | { | ||||||
|  |   imports = [ | ||||||
|  |     # Import environment | ||||||
|  |     ../default.nix | ||||||
|  |   ]; | ||||||
|  | 
 | ||||||
|  |   config = { | ||||||
|  |     # State version | ||||||
|  |     system.stateVersion = "24.11"; | ||||||
|  | 
 | ||||||
|  |     # Machine hostname | ||||||
|  |     networking.hostName = lib.mkDefault "vm-base"; | ||||||
|  | 
 | ||||||
|  |     # Enabled modules | ||||||
|  |     modules = { | ||||||
|  |       base.enable = true; | ||||||
|  |       ssh.enable = true; | ||||||
|  |     }; | ||||||
|  | 
 | ||||||
|  |     # Hardware configuration | ||||||
|  |     hardware.enableRedistributableFirmware = true; | ||||||
|  |     boot.initrd.availableKernelModules = [ | ||||||
|  |       "ata_piix" | ||||||
|  |       "uhci_hcd" | ||||||
|  |       "virtio_pci" | ||||||
|  |       "virtio_scsi" | ||||||
|  |       "sd_mod" | ||||||
|  |       "sr_mod" | ||||||
|  |     ]; | ||||||
|  |     boot.initrd.kernelModules = [ ]; | ||||||
|  |     boot.kernelModules = [ "kvm-intel" ]; | ||||||
|  |     boot.extraModulePackages = [ ]; | ||||||
|  |     hardware.cpu.intel.updateMicrocode = true; | ||||||
|  | 
 | ||||||
|  |     # Filesystems | ||||||
|  |     fileSystems."/" = { | ||||||
|  |       device = "/dev/disk/by-partlabel/root"; | ||||||
|  |       fsType = "ext4"; | ||||||
|  |     }; | ||||||
|  | 
 | ||||||
|  |     fileSystems."/boot" = { | ||||||
|  |       device = "/dev/disk/by-partlabel/EFI"; | ||||||
|  |       fsType = "vfat"; | ||||||
|  |       options = [ | ||||||
|  |         "fmask=0077" | ||||||
|  |         "dmask=0077" | ||||||
|  |       ]; | ||||||
|  |     }; | ||||||
|  | 
 | ||||||
|  |     # Swapfile | ||||||
|  |     swapDevices = [ | ||||||
|  |       { | ||||||
|  |         device = "/var/lib/swapfile"; | ||||||
|  |         size = 6 * 1024; | ||||||
|  |       } | ||||||
|  |     ]; | ||||||
|  |   }; | ||||||
|  | } | ||||||
| @ -27,42 +27,13 @@ in | |||||||
|       pciutils |       pciutils | ||||||
|       zip |       zip | ||||||
|       unzip |       unzip | ||||||
| 
 |  | ||||||
|       # TODO: MOVE |  | ||||||
|       quickemu # TODO: Reenable once building this is fixed |  | ||||||
|       pdftk |  | ||||||
| 
 |  | ||||||
|       # TODO: Move to USB module |  | ||||||
|       # usbutils |  | ||||||
|       # udiskie |  | ||||||
|       # udisks |  | ||||||
|       brightnessctl |  | ||||||
|     ]; |     ]; | ||||||
| 
 | 
 | ||||||
|     security.krb5 = { |  | ||||||
|       enable = true; |  | ||||||
|       settings = { |  | ||||||
|         libdefaults = { |  | ||||||
|           rdns = false; |  | ||||||
|         }; |  | ||||||
|         realms = { |  | ||||||
|           "GEWISWG.GEWIS.NL" = { |  | ||||||
|             kdc = [ |  | ||||||
|               "https://gewisvdesktop.gewis.nl/KdcProxy" |  | ||||||
|             ]; |  | ||||||
|           }; |  | ||||||
|         }; |  | ||||||
|       }; |  | ||||||
|     }; |  | ||||||
| 
 |  | ||||||
|     modules = { |     modules = { | ||||||
|       # Enable base modules |       # Enable base modules | ||||||
|       clean-tmp.enable = true; |       clean-tmp.enable = true; | ||||||
|       fontconfig.enable = true; |  | ||||||
|       neovim.enable = true; |       neovim.enable = true; | ||||||
|       systemd-boot.enable = true; |       systemd-boot.enable = true; | ||||||
|       nixgreety.enable = true; |  | ||||||
|       pipewire.enable = true; |  | ||||||
|     }; |     }; | ||||||
| 
 | 
 | ||||||
|     # TODO: Remove everything below, it is here out of convenience and should be elsewhere |     # TODO: Remove everything below, it is here out of convenience and should be elsewhere | ||||||
| @ -75,34 +46,9 @@ in | |||||||
|       enable = true; |       enable = true; | ||||||
|     }; |     }; | ||||||
|     networking.firewall.enable = true; |     networking.firewall.enable = true; | ||||||
|     programs.dconf.enable = true; |  | ||||||
|     services.libinput.enable = true; |  | ||||||
|     services.upower.enable = true; # For battery percentage in gnome |  | ||||||
|     modules.unfree.enable = true; |     modules.unfree.enable = true; | ||||||
|     modules.unfree.allowedPackages = [ |  | ||||||
|       "nvidia-x11" |  | ||||||
|       "nvidia-settings" |  | ||||||
|     ]; |  | ||||||
|     nix.settings.experimental-features = "nix-command flakes"; |     nix.settings.experimental-features = "nix-command flakes"; | ||||||
|     # networking.useDHCP = true; |  | ||||||
|     nixpkgs.hostPlatform = "x86_64-linux"; |     nixpkgs.hostPlatform = "x86_64-linux"; | ||||||
|     networking.firewall.allowedTCPPortRanges = [ |  | ||||||
|       { |  | ||||||
|         from = 10000; |  | ||||||
|         to = 11000; |  | ||||||
|       } |  | ||||||
|     ]; |  | ||||||
|     networking.firewall.allowedUDPPortRanges = [ |  | ||||||
|       { |  | ||||||
|         from = 10000; |  | ||||||
|         to = 11000; |  | ||||||
|       } |  | ||||||
|     ]; |  | ||||||
|     security.rtkit.enable = true; |  | ||||||
| 
 |  | ||||||
|     # TODO: Move to USB module |  | ||||||
|     # services.gvfs.enable = true; |  | ||||||
|     services.udisks2.enable = true; |  | ||||||
| 
 | 
 | ||||||
|     console.packages = [ |     console.packages = [ | ||||||
|       pkgs.dina-psfu |       pkgs.dina-psfu | ||||||
|  | |||||||
							
								
								
									
										81
									
								
								modules/base/desktop.nix
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										81
									
								
								modules/base/desktop.nix
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,81 @@ | |||||||
|  | { | ||||||
|  |   lib, | ||||||
|  |   config, | ||||||
|  |   pkgs, | ||||||
|  |   ... | ||||||
|  | }: | ||||||
|  | 
 | ||||||
|  | with lib; | ||||||
|  | let | ||||||
|  |   cfg = config.modules.base.desktop; | ||||||
|  | in | ||||||
|  | { | ||||||
|  |   options.modules.base.desktop = { | ||||||
|  |     enable = mkEnableOption "desktop"; | ||||||
|  |   }; | ||||||
|  | 
 | ||||||
|  |   config = mkIf cfg.enable { | ||||||
|  |     environment.systemPackages = with pkgs; [ | ||||||
|  |       # TODO: MOVE | ||||||
|  |       quickemu # TODO: Reenable once building this is fixed | ||||||
|  |       pdftk | ||||||
|  | 
 | ||||||
|  |       # TODO: Move to USB module | ||||||
|  |       # usbutils | ||||||
|  |       # udiskie | ||||||
|  |       # udisks | ||||||
|  |       brightnessctl | ||||||
|  |     ]; | ||||||
|  | 
 | ||||||
|  |     # Move to Realm module | ||||||
|  |     security.krb5 = { | ||||||
|  |       enable = true; | ||||||
|  |       settings = { | ||||||
|  |         libdefaults = { | ||||||
|  |           rdns = false; | ||||||
|  |         }; | ||||||
|  |         realms = { | ||||||
|  |           "GEWISWG.GEWIS.NL" = { | ||||||
|  |             kdc = [ | ||||||
|  |               "https://gewisvdesktop.gewis.nl/KdcProxy" | ||||||
|  |             ]; | ||||||
|  |           }; | ||||||
|  |         }; | ||||||
|  |       }; | ||||||
|  |     }; | ||||||
|  | 
 | ||||||
|  |     modules = { | ||||||
|  |       # Enable base modules | ||||||
|  |       base.enable = true; | ||||||
|  |       fontconfig.enable = true; | ||||||
|  |       nixgreety.enable = true; | ||||||
|  |       pipewire.enable = true; | ||||||
|  |       graphics.enable = true; | ||||||
|  |     }; | ||||||
|  | 
 | ||||||
|  |     programs.dconf.enable = true; | ||||||
|  |     services.libinput.enable = true; | ||||||
|  |     services.upower.enable = true; # For battery percentage in gnome | ||||||
|  |     modules.unfree.allowedPackages = [ | ||||||
|  |       "nvidia-x11" | ||||||
|  |       "nvidia-settings" | ||||||
|  |     ]; | ||||||
|  |     networking.firewall.allowedTCPPortRanges = [ | ||||||
|  |       { | ||||||
|  |         from = 10000; | ||||||
|  |         to = 11000; | ||||||
|  |       } | ||||||
|  |     ]; | ||||||
|  |     networking.firewall.allowedUDPPortRanges = [ | ||||||
|  |       { | ||||||
|  |         from = 10000; | ||||||
|  |         to = 11000; | ||||||
|  |       } | ||||||
|  |     ]; | ||||||
|  |     security.rtkit.enable = true; | ||||||
|  | 
 | ||||||
|  |     # TODO: Move to USB module | ||||||
|  |     # services.gvfs.enable = true; | ||||||
|  |     services.udisks2.enable = true; | ||||||
|  |   }; | ||||||
|  | } | ||||||
| @ -10,6 +10,7 @@ with lib; | |||||||
|   imports = [ |   imports = [ | ||||||
|     # Import modules |     # Import modules | ||||||
|     ./base/default.nix |     ./base/default.nix | ||||||
|  |     ./base/desktop.nix | ||||||
|     ./bluetooth/default.nix |     ./bluetooth/default.nix | ||||||
|     ./boot/clean-tmp.nix |     ./boot/clean-tmp.nix | ||||||
|     ./boot/silent-boot.nix |     ./boot/silent-boot.nix | ||||||
| @ -28,6 +29,7 @@ with lib; | |||||||
|     ./power-saving/default.nix |     ./power-saving/default.nix | ||||||
|     ./printing/default.nix |     ./printing/default.nix | ||||||
|     ./sound/pipewire.nix |     ./sound/pipewire.nix | ||||||
|  |     ./ssh/default.nix | ||||||
|     ./users/default.nix |     ./users/default.nix | ||||||
|     ./unfree/default.nix |     ./unfree/default.nix | ||||||
|     ./vpn/tailscale.nix |     ./vpn/tailscale.nix | ||||||
|  | |||||||
| @ -5,8 +5,15 @@ | |||||||
|   ... |   ... | ||||||
| }: | }: | ||||||
| 
 | 
 | ||||||
|  | with lib; | ||||||
|  | let | ||||||
|  |   cfg = config.modules.fontconfig; | ||||||
|  | in | ||||||
| { | { | ||||||
|   config = { |   options.modules.graphics = { | ||||||
|  |     enable = mkEnableOption "graphics"; | ||||||
|  |   }; | ||||||
|  |   config = mkIf cfg.enable { | ||||||
|     # TODO: Modularize further, especially modesetting should be its own module. |     # TODO: Modularize further, especially modesetting should be its own module. | ||||||
|     # Set up graphics |     # Set up graphics | ||||||
|     hardware.graphics.enable32Bit = true; |     hardware.graphics.enable32Bit = true; | ||||||
|  | |||||||
							
								
								
									
										20
									
								
								modules/ssh/default.nix
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								modules/ssh/default.nix
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,20 @@ | |||||||
|  | { | ||||||
|  |   lib, | ||||||
|  |   config, | ||||||
|  |   pkgs, | ||||||
|  |   ... | ||||||
|  | }: | ||||||
|  | 
 | ||||||
|  | with lib; | ||||||
|  | let | ||||||
|  |   cfg = config.modules.ssh; | ||||||
|  | in | ||||||
|  | { | ||||||
|  |   options.modules.ssh = { | ||||||
|  |     enable = mkEnableOption "ssh"; | ||||||
|  |   }; | ||||||
|  | 
 | ||||||
|  |   config = mkIf cfg.enable { | ||||||
|  |     services.openssh.enable = true; | ||||||
|  |   }; | ||||||
|  | } | ||||||
| @ -37,7 +37,7 @@ in | |||||||
|     }; |     }; | ||||||
|   }; |   }; | ||||||
| 
 | 
 | ||||||
|   config = |   config = mkIf config.desktop.enable ( | ||||||
|     lib.recursiveUpdate |     lib.recursiveUpdate | ||||||
|       { |       { | ||||||
|         # Ensure desktop related systemd services (xdg) have access to session variables. |         # Ensure desktop related systemd services (xdg) have access to session variables. | ||||||
| @ -84,5 +84,6 @@ in | |||||||
|         #   } |         #   } | ||||||
|         #   ."${cfg.decorations}" |         #   ."${cfg.decorations}" | ||||||
|         { } |         { } | ||||||
|       ); |       ) | ||||||
|  |   ); | ||||||
| } | } | ||||||
|  | |||||||
| @ -54,6 +54,7 @@ in | |||||||
|   ]; |   ]; | ||||||
| 
 | 
 | ||||||
|   options.desktop = { |   options.desktop = { | ||||||
|  |     enable = mkEnableOption "desktop"; | ||||||
|     name = mkOption { |     name = mkOption { | ||||||
|       type = types.str; |       type = types.str; | ||||||
|       default = "Shell"; |       default = "Shell"; | ||||||
| @ -90,7 +91,7 @@ in | |||||||
|     }; |     }; | ||||||
|   }; |   }; | ||||||
| 
 | 
 | ||||||
|   config = { |   config = mkIf cfg.enable { | ||||||
|     specialisation = mapAttrs (name: value: { |     specialisation = mapAttrs (name: value: { | ||||||
|       configuration = (environmentBuilders."${value.type}" value); |       configuration = (environmentBuilders."${value.type}" value); | ||||||
|     }) cfg.environments; |     }) cfg.environments; | ||||||
|  | |||||||
							
								
								
									
										156
									
								
								user-modules/desktop/theming/colors.nix
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										156
									
								
								user-modules/desktop/theming/colors.nix
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,156 @@ | |||||||
|  | { | ||||||
|  |   pkgs, | ||||||
|  |   lib, | ||||||
|  |   config, | ||||||
|  |   ... | ||||||
|  | }: | ||||||
|  | 
 | ||||||
|  | with lib; | ||||||
|  | let | ||||||
|  |   cfg = config.desktop.theming; | ||||||
|  | in | ||||||
|  | { | ||||||
|  |   imports = [ | ||||||
|  |     # Import all themes | ||||||
|  |     ./themes/catppuccin.nix | ||||||
|  |     ./themes/gruvbox.nix | ||||||
|  |     ./themes/oxocarbon.nix | ||||||
|  |     ./themes/papercolor.nix | ||||||
|  |     ./themes/sakura.nix | ||||||
|  |     ./themes/nord.nix | ||||||
|  |   ]; | ||||||
|  | 
 | ||||||
|  |   options.desktop.theming = | ||||||
|  |     let | ||||||
|  |       colors = config.desktop.theming.schemeColors; | ||||||
|  |     in | ||||||
|  |     { | ||||||
|  |       darkMode = mkOption { | ||||||
|  |         type = types.bool; | ||||||
|  |         default = false; | ||||||
|  |         example = true; | ||||||
|  |         description = "Whether the app should use dark mode."; | ||||||
|  |       }; | ||||||
|  | 
 | ||||||
|  |       colorScheme = mkOption { | ||||||
|  |         type = types.nullOr types.str; | ||||||
|  |         default = "${pkgs.base16-schemes}/share/themes/catppuccin-mocha.yaml"; | ||||||
|  |         description = "Base 16 color scheme to use for styling. See stylix documentation for more information."; | ||||||
|  |       }; | ||||||
|  | 
 | ||||||
|  |       schemeColors = mkOption { | ||||||
|  |         type = types.attrsOf types.anything; | ||||||
|  |         default = config.lib.stylix.colors; | ||||||
|  |         description = "Generated colors from scheme"; | ||||||
|  |       }; | ||||||
|  | 
 | ||||||
|  |       colors = { | ||||||
|  |         bg = mkOption { | ||||||
|  |           type = types.str; | ||||||
|  |           default = colors.base00; | ||||||
|  |         }; | ||||||
|  |         fg = mkOption { | ||||||
|  |           type = types.str; | ||||||
|  |           default = colors.base05; | ||||||
|  |         }; | ||||||
|  |         bg-status = mkOption { | ||||||
|  |           type = types.str; | ||||||
|  |           default = colors.base01; | ||||||
|  |         }; | ||||||
|  |         fg-status = mkOption { | ||||||
|  |           type = types.str; | ||||||
|  |           default = colors.base04; | ||||||
|  |         }; | ||||||
|  |         bg-selection = mkOption { | ||||||
|  |           type = types.str; | ||||||
|  |           default = colors.base02; | ||||||
|  |         }; | ||||||
|  |         bg-highlight = mkOption { | ||||||
|  |           type = types.str; | ||||||
|  |           default = colors.base03; | ||||||
|  |         }; | ||||||
|  |         fg-search = mkOption { | ||||||
|  |           type = types.str; | ||||||
|  |           default = colors.base0A; | ||||||
|  |         }; | ||||||
|  |         accent = mkOption { | ||||||
|  |           type = types.str; | ||||||
|  |           default = colors.base0E; | ||||||
|  |         }; | ||||||
|  |         border-focused = mkOption { | ||||||
|  |           type = types.str; | ||||||
|  |           default = cfg.colors.fg; | ||||||
|  |         }; | ||||||
|  |         border-unfocused = mkOption { | ||||||
|  |           type = types.str; | ||||||
|  |           default = cfg.colors.bg-selection; | ||||||
|  |         }; | ||||||
|  |       }; | ||||||
|  | 
 | ||||||
|  |       colorsCSS = mkOption { | ||||||
|  |         type = types.lines; | ||||||
|  |         default = | ||||||
|  |           ":root {\n" | ||||||
|  |           + concatStrings ( | ||||||
|  |             map (color: "  --nix-color-${color.name}: #${color.value};\n") (attrsToList cfg.colors) | ||||||
|  |           ) | ||||||
|  |           + "}\n\n"; | ||||||
|  |         description = "Colors as css variables"; | ||||||
|  |       }; | ||||||
|  |     }; | ||||||
|  | 
 | ||||||
|  |   config = { | ||||||
|  |     # Configure gnome theme | ||||||
|  |     dconf.settings = { | ||||||
|  |       "org/gnome/desktop/interface" = { | ||||||
|  |         color-scheme = if cfg.darkMode then "prefer-dark" else "prefer-light"; | ||||||
|  |       }; | ||||||
|  |     }; | ||||||
|  | 
 | ||||||
|  |     # Configure qt theme | ||||||
|  |     qt = { | ||||||
|  |       enable = true; | ||||||
|  |       platformTheme.name = "adwaita"; | ||||||
|  |       style.name = if cfg.darkMode then "adwaita-dark" else "adwaita-light"; | ||||||
|  |     }; | ||||||
|  | 
 | ||||||
|  |     # Configure gtk theme | ||||||
|  |     gtk = { | ||||||
|  |       enable = true; | ||||||
|  |       theme = { | ||||||
|  |         name = if cfg.darkMode then "Adwaita-dark" else "Adwaita-light"; | ||||||
|  |         package = pkgs.gnome-themes-extra; | ||||||
|  |       }; | ||||||
|  |     }; | ||||||
|  | 
 | ||||||
|  |     # TODO: This should just straight up not be here | ||||||
|  |     programs.direnv = { | ||||||
|  |       enable = true; | ||||||
|  |       nix-direnv.enable = true; | ||||||
|  |     }; | ||||||
|  |     modules.git.ignores = [ | ||||||
|  |       ".direnv" | ||||||
|  |     ]; | ||||||
|  | 
 | ||||||
|  |     # Enable stylix | ||||||
|  |     # TODO: Move to own module | ||||||
|  |     stylix = { | ||||||
|  |       enable = true; | ||||||
|  |       autoEnable = false; | ||||||
|  | 
 | ||||||
|  |       targets = { | ||||||
|  |         foot.enable = true; | ||||||
|  |         nixvim.enable = true; | ||||||
|  |         qutebrowser.enable = true; | ||||||
|  |         vscode = { | ||||||
|  |           enable = true; | ||||||
|  |           profileNames = [ "Default" ]; | ||||||
|  |         }; | ||||||
|  |         zathura.enable = true; | ||||||
|  |       }; | ||||||
|  | 
 | ||||||
|  |       base16Scheme = cfg.colorScheme; | ||||||
|  |       polarity = if cfg.darkMode then "dark" else "light"; | ||||||
|  |     }; | ||||||
|  |   }; | ||||||
|  | } | ||||||
| @ -91,186 +91,88 @@ in | |||||||
| { | { | ||||||
|   imports = [ |   imports = [ | ||||||
|     ./background.nix |     ./background.nix | ||||||
| 
 |     ./colors.nix | ||||||
|     # Import all themes |  | ||||||
|     ./themes/catppuccin.nix |  | ||||||
|     ./themes/gruvbox.nix |  | ||||||
|     ./themes/oxocarbon.nix |  | ||||||
|     ./themes/papercolor.nix |  | ||||||
|     ./themes/sakura.nix |  | ||||||
|     ./themes/nord.nix |  | ||||||
|   ]; |   ]; | ||||||
| 
 | 
 | ||||||
|   options.desktop.theming = |   options.desktop.theming = { | ||||||
|     let |     layout = { | ||||||
|       colors = config.desktop.theming.schemeColors; |       borderRadius = mkOption { | ||||||
|     in |         type = types.int; | ||||||
|     { |         default = 0; | ||||||
|       darkMode = mkOption { |         description = "Border radius of windows."; | ||||||
|         type = types.bool; |  | ||||||
|         default = false; |  | ||||||
|         example = true; |  | ||||||
|         description = "Whether the app should use dark mode."; |  | ||||||
|       }; |       }; | ||||||
| 
 | 
 | ||||||
|       colorScheme = mkOption { |       borderSize = mkOption { | ||||||
|         type = types.nullOr types.str; |         type = types.int; | ||||||
|         default = null; |         default = 1; | ||||||
|         description = "Base 16 color scheme to use for styling. See stylix documentation for more information."; |         description = "Size of borders used throughout UI."; | ||||||
|       }; |       }; | ||||||
| 
 | 
 | ||||||
|       schemeColors = mkOption { |       windowPadding = mkOption { | ||||||
|         type = types.attrsOf types.anything; |         type = types.int; | ||||||
|         default = config.lib.stylix.colors; |         default = 2; | ||||||
|         description = "Generated colors from scheme"; |         description = "Margin of each window, actual space between windows will be twice this number."; | ||||||
|       }; |  | ||||||
| 
 |  | ||||||
|       colors = { |  | ||||||
|         bg = mkOption { |  | ||||||
|           type = types.str; |  | ||||||
|           default = colors.base00; |  | ||||||
|         }; |  | ||||||
|         fg = mkOption { |  | ||||||
|           type = types.str; |  | ||||||
|           default = colors.base05; |  | ||||||
|         }; |  | ||||||
|         bg-status = mkOption { |  | ||||||
|           type = types.str; |  | ||||||
|           default = colors.base01; |  | ||||||
|         }; |  | ||||||
|         fg-status = mkOption { |  | ||||||
|           type = types.str; |  | ||||||
|           default = colors.base04; |  | ||||||
|         }; |  | ||||||
|         bg-selection = mkOption { |  | ||||||
|           type = types.str; |  | ||||||
|           default = colors.base02; |  | ||||||
|         }; |  | ||||||
|         bg-highlight = mkOption { |  | ||||||
|           type = types.str; |  | ||||||
|           default = colors.base03; |  | ||||||
|         }; |  | ||||||
|         fg-search = mkOption { |  | ||||||
|           type = types.str; |  | ||||||
|           default = colors.base0A; |  | ||||||
|         }; |  | ||||||
|         accent = mkOption { |  | ||||||
|           type = types.str; |  | ||||||
|           default = colors.base0E; |  | ||||||
|         }; |  | ||||||
|         border-focused = mkOption { |  | ||||||
|           type = types.str; |  | ||||||
|           default = cfg.colors.fg; |  | ||||||
|         }; |  | ||||||
|         border-unfocused = mkOption { |  | ||||||
|           type = types.str; |  | ||||||
|           default = cfg.colors.bg-selection; |  | ||||||
|         }; |  | ||||||
|       }; |  | ||||||
| 
 |  | ||||||
|       colorsCSS = mkOption { |  | ||||||
|         type = types.lines; |  | ||||||
|         default = |  | ||||||
|           ":root {\n" |  | ||||||
|           + concatStrings ( |  | ||||||
|             map (color: "  --nix-color-${color.name}: #${color.value};\n") (attrsToList cfg.colors) |  | ||||||
|           ) |  | ||||||
|           + "}\n\n"; |  | ||||||
|         description = "Colors as css variables"; |  | ||||||
|       }; |  | ||||||
| 
 |  | ||||||
|       layout = { |  | ||||||
|         borderRadius = mkOption { |  | ||||||
|           type = types.int; |  | ||||||
|           default = 0; |  | ||||||
|           description = "Border radius of windows."; |  | ||||||
|         }; |  | ||||||
| 
 |  | ||||||
|         borderSize = mkOption { |  | ||||||
|           type = types.int; |  | ||||||
|           default = 1; |  | ||||||
|           description = "Size of borders used throughout UI."; |  | ||||||
|         }; |  | ||||||
| 
 |  | ||||||
|         windowPadding = mkOption { |  | ||||||
|           type = types.int; |  | ||||||
|           default = 2; |  | ||||||
|           description = "Margin of each window, actual space between windows will be twice this number."; |  | ||||||
|         }; |  | ||||||
|       }; |  | ||||||
| 
 |  | ||||||
|       fonts = { |  | ||||||
|         pkgs = mkOption { |  | ||||||
|           type = types.attrsOf fontModule; |  | ||||||
|           default = builtins.listToAttrs ( |  | ||||||
|             map (module: { |  | ||||||
|               name = module.name; |  | ||||||
|               value = module; |  | ||||||
|             }) (map (module: (import module) { inherit lib config pkgs; }) fontModules) |  | ||||||
|           ); |  | ||||||
|           description = "All available font modules."; |  | ||||||
|         }; |  | ||||||
| 
 |  | ||||||
|         installed = mkOption { |  | ||||||
|           type = types.listOf types.str; |  | ||||||
|           default = fontNameList; |  | ||||||
|           description = "List of installed fonts."; |  | ||||||
|         }; |  | ||||||
| 
 |  | ||||||
|         serif = mkOption { |  | ||||||
|           type = fontModule; |  | ||||||
|           description = "Default serif font"; |  | ||||||
|         }; |  | ||||||
| 
 |  | ||||||
|         sansSerif = mkOption { |  | ||||||
|           type = fontModule; |  | ||||||
|           description = "Default sansSerif font."; |  | ||||||
|         }; |  | ||||||
| 
 |  | ||||||
|         monospace = mkOption { |  | ||||||
|           type = fontModule; |  | ||||||
|           description = "Default monospace font."; |  | ||||||
|         }; |  | ||||||
| 
 |  | ||||||
|         emoji = mkOption { |  | ||||||
|           type = fontModule; |  | ||||||
|           description = "Default emoji font."; |  | ||||||
|         }; |  | ||||||
| 
 |  | ||||||
|         interface = mkOption { |  | ||||||
|           type = fontModule; |  | ||||||
|           description = "Default emoji font."; |  | ||||||
|         }; |  | ||||||
| 
 |  | ||||||
|         extraFonts = mkOption { |  | ||||||
|           type = types.listOf fontModule; |  | ||||||
|           default = [ ]; |  | ||||||
|           description = "Additional fonts to install."; |  | ||||||
|         }; |  | ||||||
|       }; |       }; | ||||||
|     }; |     }; | ||||||
| 
 | 
 | ||||||
|   config = { |     fonts = { | ||||||
|  |       pkgs = mkOption { | ||||||
|  |         type = types.attrsOf fontModule; | ||||||
|  |         default = builtins.listToAttrs ( | ||||||
|  |           map (module: { | ||||||
|  |             name = module.name; | ||||||
|  |             value = module; | ||||||
|  |           }) (map (module: (import module) { inherit lib config pkgs; }) fontModules) | ||||||
|  |         ); | ||||||
|  |         description = "All available font modules."; | ||||||
|  |       }; | ||||||
|  | 
 | ||||||
|  |       installed = mkOption { | ||||||
|  |         type = types.listOf types.str; | ||||||
|  |         default = fontNameList; | ||||||
|  |         description = "List of installed fonts."; | ||||||
|  |       }; | ||||||
|  | 
 | ||||||
|  |       serif = mkOption { | ||||||
|  |         type = fontModule; | ||||||
|  |         description = "Default serif font"; | ||||||
|  |       }; | ||||||
|  | 
 | ||||||
|  |       sansSerif = mkOption { | ||||||
|  |         type = fontModule; | ||||||
|  |         description = "Default sansSerif font."; | ||||||
|  |       }; | ||||||
|  | 
 | ||||||
|  |       monospace = mkOption { | ||||||
|  |         type = fontModule; | ||||||
|  |         description = "Default monospace font."; | ||||||
|  |       }; | ||||||
|  | 
 | ||||||
|  |       emoji = mkOption { | ||||||
|  |         type = fontModule; | ||||||
|  |         description = "Default emoji font."; | ||||||
|  |       }; | ||||||
|  | 
 | ||||||
|  |       interface = mkOption { | ||||||
|  |         type = fontModule; | ||||||
|  |         description = "Default emoji font."; | ||||||
|  |       }; | ||||||
|  | 
 | ||||||
|  |       extraFonts = mkOption { | ||||||
|  |         type = types.listOf fontModule; | ||||||
|  |         default = [ ]; | ||||||
|  |         description = "Additional fonts to install."; | ||||||
|  |       }; | ||||||
|  |     }; | ||||||
|  |   }; | ||||||
|  | 
 | ||||||
|  |   config = mkIf config.desktop.enable { | ||||||
|     # Enable fontconfig |     # Enable fontconfig | ||||||
|     modules.fontconfig.enable = true; |     modules.fontconfig.enable = true; | ||||||
| 
 | 
 | ||||||
|     # Install configured fonts |     # Install configured fonts | ||||||
|     home.packages = fontPackageList; |     home.packages = fontPackageList; | ||||||
| 
 | 
 | ||||||
|     # Configure gnome theme |  | ||||||
|     dconf.settings = { |  | ||||||
|       "org/gnome/desktop/interface" = { |  | ||||||
|         color-scheme = if cfg.darkMode then "prefer-dark" else "prefer-light"; |  | ||||||
|       }; |  | ||||||
|     }; |  | ||||||
| 
 |  | ||||||
|     # Configure qt theme |  | ||||||
|     qt = { |  | ||||||
|       enable = true; |  | ||||||
|       platformTheme.name = "adwaita"; |  | ||||||
|       style.name = if cfg.darkMode then "adwaita-dark" else "adwaita-light"; |  | ||||||
|     }; |  | ||||||
| 
 |  | ||||||
|     # Configure gtk theme |     # Configure gtk theme | ||||||
|     gtk = |     gtk = | ||||||
|       let |       let | ||||||
| @ -287,26 +189,11 @@ in | |||||||
|       in |       in | ||||||
|       { |       { | ||||||
|         enable = true; |         enable = true; | ||||||
| 
 |  | ||||||
|         theme = { |  | ||||||
|           name = if cfg.darkMode then "Adwaita-dark" else "Adwaita-light"; |  | ||||||
|           package = pkgs.gnome-themes-extra; |  | ||||||
|         }; |  | ||||||
| 
 |  | ||||||
|         # TODO: Toggles |         # TODO: Toggles | ||||||
|         gtk3.extraCss = disableCSD; |         gtk3.extraCss = disableCSD; | ||||||
|         gtk4.extraCss = disableCSD; |         gtk4.extraCss = disableCSD; | ||||||
|       }; |       }; | ||||||
| 
 | 
 | ||||||
|     # TODO: This should just straight up not be here |  | ||||||
|     programs.direnv = { |  | ||||||
|       enable = true; |  | ||||||
|       nix-direnv.enable = true; |  | ||||||
|     }; |  | ||||||
|     modules.git.ignores = [ |  | ||||||
|       ".direnv" |  | ||||||
|     ]; |  | ||||||
| 
 |  | ||||||
|     # TODO: Make cursors configurable using modules. |     # TODO: Make cursors configurable using modules. | ||||||
|     home.pointerCursor = { |     home.pointerCursor = { | ||||||
|       gtk.enable = true; |       gtk.enable = true; | ||||||
| @ -322,23 +209,6 @@ in | |||||||
|     # Enable stylix |     # Enable stylix | ||||||
|     # TODO: Move to own module |     # TODO: Move to own module | ||||||
|     stylix = { |     stylix = { | ||||||
|       enable = true; |  | ||||||
|       autoEnable = false; |  | ||||||
| 
 |  | ||||||
|       targets = { |  | ||||||
|         foot.enable = true; |  | ||||||
|         nixvim.enable = true; |  | ||||||
|         qutebrowser.enable = true; |  | ||||||
|         vscode = { |  | ||||||
|           enable = true; |  | ||||||
|           profileNames = [ "NixOS" ]; |  | ||||||
|         }; |  | ||||||
|         zathura.enable = true; |  | ||||||
|       }; |  | ||||||
| 
 |  | ||||||
|       base16Scheme = cfg.colorScheme; |  | ||||||
|       polarity = if cfg.darkMode then "dark" else "light"; |  | ||||||
| 
 |  | ||||||
|       fonts = { |       fonts = { | ||||||
|         serif = getAttrs [ |         serif = getAttrs [ | ||||||
|           "name" |           "name" | ||||||
|  | |||||||
| @ -27,6 +27,7 @@ | |||||||
|     ]; |     ]; | ||||||
| 
 | 
 | ||||||
|     # desktop.development = "river-light"; |     # desktop.development = "river-light"; | ||||||
|  |     desktop.enable = true; | ||||||
|     desktop.environments = { |     desktop.environments = { | ||||||
|       river-dark = { |       river-dark = { | ||||||
|         name = "River Dark"; |         name = "River Dark"; | ||||||
|  | |||||||
							
								
								
									
										62
									
								
								users/server.nix
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										62
									
								
								users/server.nix
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,62 @@ | |||||||
|  | # How Jan likes his linux to be configured on servers | ||||||
|  | 
 | ||||||
|  | { | ||||||
|  |   pkgs, | ||||||
|  |   ... | ||||||
|  | }: | ||||||
|  | 
 | ||||||
|  | { | ||||||
|  |   config = { | ||||||
|  |     # State version | ||||||
|  |     home.stateVersion = "24.11"; | ||||||
|  | 
 | ||||||
|  |     # TODO: Move into modules | ||||||
|  |     home.packages = with pkgs; [ | ||||||
|  |       libreoffice-still | ||||||
|  |       remmina | ||||||
|  |       pinentry | ||||||
|  |       thunderbird | ||||||
|  |       signal-desktop | ||||||
|  |       prusa-slicer | ||||||
|  |       freecad-wayland | ||||||
|  |       inkscape | ||||||
|  |       ente-auth | ||||||
|  |       bitwarden | ||||||
|  |     ]; | ||||||
|  | 
 | ||||||
|  |     # Enabled modules | ||||||
|  |     modules = { | ||||||
|  |       # Tools | ||||||
|  |       git = { | ||||||
|  |         enable = true; | ||||||
|  |         user = "Jan-Bulthuis"; | ||||||
|  |         email = "git@bulthuis.dev"; | ||||||
|  |         # TODO: Move | ||||||
|  |         ignores = [ | ||||||
|  |           ".envrc" | ||||||
|  |           ".direnv" | ||||||
|  |           "flake.nix" | ||||||
|  |           "flake.lock" | ||||||
|  |         ]; | ||||||
|  |       }; | ||||||
|  |       btop.enable = true; | ||||||
|  |       fish.enable = true; | ||||||
|  |       keyring.enable = true; | ||||||
|  |       scripts.enable = true; | ||||||
|  | 
 | ||||||
|  |       # Development | ||||||
|  |       neovim.enable = true; | ||||||
|  | 
 | ||||||
|  |       # Languages | ||||||
|  |       haskell.enable = false; | ||||||
|  |       js.enable = true; | ||||||
|  |       nix.enable = true; | ||||||
|  |       rust.enable = true; | ||||||
|  |       python.enable = true; | ||||||
|  |       cpp.enable = true; | ||||||
|  | 
 | ||||||
|  |       # Enable unfree | ||||||
|  |       unfree.enable = true; | ||||||
|  |     }; | ||||||
|  |   }; | ||||||
|  | } | ||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Jan-Bulthuis
						Jan-Bulthuis