diff --git a/configuration.nix b/configuration/base.nix similarity index 57% rename from configuration.nix rename to configuration/base.nix index d277394..83d459c 100644 --- a/configuration.nix +++ b/configuration/base.nix @@ -5,34 +5,20 @@ { config, lib, pkgs, inputs, ... }: { + imports = + [ + ./nix-settings.nix + ./fonts.nix + ./kde.nix + ./virtualisation.nix + ]; + # Use the systemd-boot EFI boot loader. boot.loader.systemd-boot.enable = true; boot.loader.efi.canTouchEfiVariables = true; boot.kernelPackages = pkgs.linuxPackages_zen; - nixpkgs.config.allowUnfree = true; - nix.settings.experimental-features = [ "nix-command" "flakes" ]; - nix.settings.auto-optimise-store = true; - nix.gc.automatic = true; - nix.gc.options = "--delete-older-than 30d"; - - services.fstrim.enable = true; - - hardware.graphics.enable32Bit = true; # For 32 bit applications hardware.bluetooth.enable = true; - hardware.steam-hardware.enable = true; - - # Enable common container config files in /etc/containers - virtualisation.containers.enable = true; - virtualisation = { - podman = { - enable = true; - # Create a `docker` alias for podman, to use it as a drop-in replacement - dockerCompat = true; - # Required for containers under podman-compose to be able to talk to each other. - defaultNetwork.settings.dns_enabled = true; - }; - }; # networking.hostName = "nixos"; # Define your hostname. # Pick only one of the below networking options. @@ -43,12 +29,6 @@ wifi.powersave = false; }; - # services.resolved.enable = true; - services.mullvad-vpn = { - enable = true; - package = pkgs.mullvad-vpn; - }; - # Set your time zone. time.timeZone = "Europe/London"; @@ -56,45 +36,6 @@ # networking.proxy.default = "http://user:password@proxy:port/"; # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain"; - fonts.enableDefaultPackages = true; - fonts.packages = with pkgs; [ - noto-fonts - noto-fonts-cjk-sans - noto-fonts-cjk-serif - ]; - - # Select internationalisation properties. - i18n = { - defaultLocale = "en_GB.UTF-8"; - supportedLocales = [ - "en_GB.UTF-8/UTF-8" - "en_US.UTF-8/UTF-8" - "ja_JP.UTF-8/UTF-8" - ]; - inputMethod = { - enable = true; - type = "fcitx5"; - fcitx5 = { - waylandFrontend = true; - addons = with pkgs; [ fcitx5-mozc ]; - }; - }; - }; - - - console = { - # font = "Lat2-Terminus16"; - keyMap = "uk"; - # useXkbConfig = true; # use xkb.options in tty. - }; - - # Enable the X11 windowing system. - # services.xserver.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; @@ -106,68 +47,38 @@ pulse.enable = true; }; - services.power-profiles-daemon.enable = false; - services.tlp = { + services.fstrim.enable = true; + # services.resolved.enable = true; + services.mullvad-vpn = { enable = true; - settings = { - RESTORE_DEVICE_STATE_ON_STARTUP = 1; - USB_AUTOSUSPEND = 0; - PLATFORM_PROFILE_ON_AC = "performance"; - PLATFORM_PROFILE_ON_BAT = "low-power"; - CPU_ENERGY_PERF_POLICY_ON_AC = "performance"; - CPU_ENERGY_PERF_POLICY_ON_BAT = "power"; - CPU_BOOST_ON_AC = 1; - CPU_BOOST_ON_BAT = 0; - }; + package = pkgs.mullvad-vpn; }; - # Enable touchpad support (enabled default in most desktopManager). - services.libinput.enable = true; - - services.xserver.enable = true; # optional - services.displayManager.sddm.enable = true; - services.displayManager.sddm.wayland.enable = true; - services.desktopManager.plasma6.enable = true; - services.fwupd.enable = true; services.geoclue2.enable = true; - services.flatpak.enable = true; - programs.steam = { - enable = true; - remotePlay.openFirewall = true; # Open ports in the firewall for Steam Remote Play - dedicatedServer.openFirewall = true; # Open ports in the firewall for Source Dedicated Server - #gamescopeSession.enable = true; - }; - programs.gamemode.enable = true; - - programs.cdemu.enable = true; - programs.nix-ld.enable = true; # List packages installed in system profile. To search, run: # $ nix search wget environment.systemPackages = with pkgs; [ + nixpkgs-fmt + + gcc + vim curl wget inetutils + rar + nuspell hunspellDicts.en-gb-ise - gcc + libva-utils - kdePackages.sddm-kcm smartmontools - kdePackages.plasma-disks - kdePackages.partitionmanager - kdePackages.filelight - kdePackages.ffmpegthumbs - kdePackages.kcalc - rar - nixpkgs-fmt - distrobox ]; # Some programs need SUID wrappers, can be configured further or are diff --git a/configuration/fonts.nix b/configuration/fonts.nix new file mode 100644 index 0000000..7422dea --- /dev/null +++ b/configuration/fonts.nix @@ -0,0 +1,35 @@ +{ config, lib, pkgs, inputs, ... }: + +{ + fonts.enableDefaultPackages = true; + fonts.packages = with pkgs; [ + noto-fonts + noto-fonts-cjk-sans + noto-fonts-cjk-serif + ]; + + # Select internationalisation properties. + i18n = { + defaultLocale = "en_GB.UTF-8"; + supportedLocales = [ + "en_GB.UTF-8/UTF-8" + "en_US.UTF-8/UTF-8" + "ja_JP.UTF-8/UTF-8" + ]; + inputMethod = { + enable = true; + type = "fcitx5"; + fcitx5 = { + waylandFrontend = true; + addons = with pkgs; [ fcitx5-mozc ]; + }; + }; + }; + + + console = { + # font = "Lat2-Terminus16"; + keyMap = "uk"; + # useXkbConfig = true; # use xkb.options in tty. + }; +} diff --git a/configuration/kde.nix b/configuration/kde.nix new file mode 100644 index 0000000..d82ddba --- /dev/null +++ b/configuration/kde.nix @@ -0,0 +1,23 @@ +{ config, lib, pkgs, inputs, ... }: + +{ + services.xserver.enable = true; # optional + + # Configure keymap in X11 + # services.xserver.xkb.layout = "us"; + # services.xserver.xkb.options = "eurosign:e,caps:escape"; + + services.displayManager.sddm.enable = true; + services.displayManager.sddm.wayland.enable = true; + services.desktopManager.plasma6.enable = true; + + environment.systemPackages = with pkgs; + [ ] ++ (with kdePackages; [ + sddm-kcm + plasma-disks + partitionmanager + filelight + ffmpegthumbs + kcalc + ]); +} diff --git a/configuration/nix-settings.nix b/configuration/nix-settings.nix new file mode 100644 index 0000000..6a199cb --- /dev/null +++ b/configuration/nix-settings.nix @@ -0,0 +1,10 @@ +{ config, lib, pkgs, inputs, ... }: + +{ + nixpkgs.config.allowUnfree = true; + nix.settings.experimental-features = [ "nix-command" "flakes" ]; + nix.settings.auto-optimise-store = true; + nix.gc.automatic = true; + nix.gc.options = "--delete-older-than 30d"; +} + diff --git a/configuration/virtualisation.nix b/configuration/virtualisation.nix new file mode 100644 index 0000000..9d9b9c7 --- /dev/null +++ b/configuration/virtualisation.nix @@ -0,0 +1,22 @@ +{ config, lib, pkgs, inputs, ... }: + +{ + virtualisation = { + containers = { + # Enable common container config files in /etc/containers + enable = true; + }; + libvirtd = { + enable = true; + }; + podman = { + enable = true; + # Create a `docker` alias for podman, to use it as a drop-in replacement + dockerCompat = true; + # Required for containers under podman-compose to be able to talk to each other. + defaultNetwork.settings.dns_enabled = true; + }; + }; + programs.virt-manager.enable = true; +} + diff --git a/flake.nix b/flake.nix index 759dd08..9a5adda 100644 --- a/flake.nix +++ b/flake.nix @@ -17,7 +17,7 @@ nixosConfigurations.tuxedo = nixpkgs.lib.nixosSystem { specialArgs = { inherit inputs; }; modules = [ - ./configuration.nix + ./configuration/base.nix ./tuxedo/configuration.nix ]; }; diff --git a/home-manager/development/tools.nix b/home-manager/development/tools.nix new file mode 100644 index 0000000..71646d1 --- /dev/null +++ b/home-manager/development/tools.nix @@ -0,0 +1,15 @@ +{ inputs, config, pkgs, ... }: + +{ + home.packages = with pkgs;[ + git-credential-manager + (with dotnetCorePackages; combinePackages [ + sdk_8_0 + sdk_9_0 + ]) + jetbrains.rider + azure-cli + azuredatastudio + rustup + ]; +} diff --git a/home-manager/vscode.nix b/home-manager/development/vscode.nix similarity index 100% rename from home-manager/vscode.nix rename to home-manager/development/vscode.nix diff --git a/home-manager/fonts.nix b/home-manager/fonts.nix new file mode 100644 index 0000000..49dd99a --- /dev/null +++ b/home-manager/fonts.nix @@ -0,0 +1,19 @@ +{ inputs, config, pkgs, ... }: + +{ + home.packages = with pkgs;[ + liberation_ttf + ubuntu-sans + ubuntu-sans-mono + (nerdfonts.override { fonts = [ "SpaceMono" ]; }) + ]; + + fonts.fontconfig = { + enable = true; + defaultFonts = { + monospace = [ "Ubuntu Sans Mono" ]; + sansSerif = [ "Ubuntu Sans" ]; + serif = [ "Liberation Serif" ]; + }; + }; +} diff --git a/home-manager/gaming.nix b/home-manager/gaming.nix new file mode 100644 index 0000000..ec6b7b6 --- /dev/null +++ b/home-manager/gaming.nix @@ -0,0 +1,11 @@ +{ inputs, config, pkgs, ... }: + +{ + home.packages = with pkgs;[ + steamguard-cli + bottles + protontricks + gamescope + inputs.nixpkgs-unstable.legacyPackages."${pkgs.system}".ryujinx-greemdev + ]; +} diff --git a/modules/gaming.nix b/modules/gaming.nix new file mode 100644 index 0000000..5acfbe8 --- /dev/null +++ b/modules/gaming.nix @@ -0,0 +1,17 @@ +{ config, lib, pkgs, inputs, ... }: + +{ + hardware.graphics.enable32Bit = true; # For 32 bit applications + hardware.steam-hardware.enable = true; + + programs.steam = { + enable = true; + remotePlay.openFirewall = true; # Open ports in the firewall for Steam Remote Play + dedicatedServer.openFirewall = true; # Open ports in the firewall for Source Dedicated Server + #gamescopeSession.enable = true; + }; + programs.gamemode.enable = true; + + # ensure users who need access to this have `cdrom` as `extraGroups` + programs.cdemu.enable = true; +} diff --git a/modules/laptop.nix b/modules/laptop.nix new file mode 100644 index 0000000..20986bf --- /dev/null +++ b/modules/laptop.nix @@ -0,0 +1,21 @@ +{ config, lib, pkgs, inputs, ... }: + +{ + services.power-profiles-daemon.enable = false; + services.tlp = { + enable = true; + settings = { + RESTORE_DEVICE_STATE_ON_STARTUP = 1; + USB_AUTOSUSPEND = 0; + PLATFORM_PROFILE_ON_AC = "performance"; + PLATFORM_PROFILE_ON_BAT = "low-power"; + CPU_ENERGY_PERF_POLICY_ON_AC = "performance"; + CPU_ENERGY_PERF_POLICY_ON_BAT = "power"; + CPU_BOOST_ON_AC = 1; + CPU_BOOST_ON_BAT = 0; + }; + }; + + # Enable touchpad support (enabled default in most desktopManager). + services.libinput.enable = true; +} diff --git a/tuxedo/configuration.nix b/tuxedo/configuration.nix index 2a284e3..e07eaa5 100644 --- a/tuxedo/configuration.nix +++ b/tuxedo/configuration.nix @@ -12,6 +12,8 @@ inputs.disko.nixosModules.default ./disk-config.nix inputs.home-manager.nixosModules.default + ../modules/laptop.nix + ../modules/gaming.nix ]; fileSystems."/mnt/HDD1" = { @@ -29,8 +31,8 @@ hardware.tuxedo-drivers.enable = true; programs.gpu-screen-recorder.enable = true; - virtualisation.libvirtd.enable = true; - programs.virt-manager.enable = true; + + # ......omit many configurations # Define a user account. Don't forget to set a password with ‘passwd’. users.users.worble = { diff --git a/tuxedo/home-manager/home.nix b/tuxedo/home-manager/home.nix index 99625c5..2ff274c 100644 --- a/tuxedo/home-manager/home.nix +++ b/tuxedo/home-manager/home.nix @@ -2,9 +2,12 @@ { imports = [ + ../../home-manager/fonts.nix ../../home-manager/terminal.nix ../../home-manager/firefox/firefox.nix - ../../home-manager/vscode.nix + ../../home-manager/development/tools.nix + ../../home-manager/development/vscode.nix + ../../home-manager/gaming.nix ]; terminal.nixUpdateLocation = "/home/worble/Projects/nixos#tuxedo"; @@ -43,55 +46,28 @@ # (pkgs.writeShellScriptBin "my-hello" '' # echo "Hello, ${config.home.username}!" # '') + thunderbird nextcloud-client - ubuntu-sans - ubuntu-sans-mono - (nerdfonts.override { fonts = [ "SpaceMono" ]; }) keepassxc - bottles - rustup strawberry-qt6 rclone qbittorrent - teamspeak_client - thunderbird - git-credential-manager - (with dotnetCorePackages; combinePackages [ - sdk_8_0 - sdk_9_0 - ]) gimp-with-plugins ffmpeg-full - protonup-qt - protontricks - gamescope yt-dlp joplin-desktop obsidian + teamspeak_client webcord libreoffice-qt - azure-cli - jetbrains.rider - steamguard-cli jellyfin-media-player haruna - azuredatastudio inotify-tools libnotify electrum gpu-screen-recorder-gtk - inputs.nixpkgs-unstable.legacyPackages."${pkgs.system}".ryujinx-greemdev ]; - fonts.fontconfig = { - enable = true; - defaultFonts = { - monospace = [ "Ubuntu Sans Mono" ]; - sansSerif = [ "Ubuntu Sans" ]; - serif = [ "Liberation Serif" ]; - }; - }; - # Home Manager is pretty good at managing dotfiles. The primary way to manage # plain files is through 'home.file'. home.file = { @@ -127,9 +103,9 @@ NIXOS_OZONE_WL = "1"; }; - home.sessionPath = [ - "$HOME/.local/bin" - ]; + # home.sessionPath = [ + # "$HOME/.local/bin" + # ]; # Let Home Manager install and manage itself. programs = { diff --git a/update.sh b/update.sh index b7795f0..bc06463 100755 --- a/update.sh +++ b/update.sh @@ -1,2 +1,2 @@ -#!/bin/sh +#!/usr/bin/env bash sudo nixos-rebuild switch --flake '/home/worble/Projects/nixos#tuxedo' \ No newline at end of file