From 9611b8bb8d0e882f03cdfdde773afdd04eb24314 Mon Sep 17 00:00:00 2001 From: Martin Berg Alstad Date: Mon, 14 Apr 2025 23:30:50 +0200 Subject: [PATCH] :sparkles: Moved modeules into shared --- flake.nix | 20 +++++---- hosts/desktop/modules/default.nix | 17 ++------ .../{hardware => }/hardware-configuration.nix | 4 -- hosts/desktop/modules/networking.nix | 22 ---------- hosts/desktop/modules/nix-helper.nix | 12 ------ hosts/thinkpad/modules/default.nix | 20 ++++----- hosts/thinkpad/modules/development.nix | 41 ------------------- hosts/thinkpad/modules/fonts.nix | 19 --------- hosts/thinkpad/modules/gaming/default.nix | 12 ------ hosts/thinkpad/modules/gaming/steam.nix | 8 ---- hosts/thinkpad/modules/gnome/default.nix | 28 ------------- hosts/thinkpad/modules/gnome/nautilus.nix | 15 ------- .../{hardware => }/hardware-configuration.nix | 0 hosts/thinkpad/modules/hardware/audio.nix | 33 --------------- hosts/thinkpad/modules/hardware/default.nix | 8 ---- .../modules/hardware/graphics/default.nix | 6 --- hosts/thinkpad/modules/hardware/keyboard.nix | 11 ----- hosts/thinkpad/modules/hyprland/default.nix | 25 ----------- hosts/thinkpad/modules/locale.nix | 37 ----------------- hosts/thinkpad/modules/qt.nix | 17 -------- hosts/thinkpad/modules/sddm.nix | 22 ---------- hosts/thinkpad/modules/security.nix | 25 +---------- hosts/thinkpad/modules/shell.nix | 19 --------- justfile | 4 +- shared/common.nix | 2 + shared/modules/default.nix | 17 ++++++++ .../modules/development/default.nix | 0 .../modules/development/docker.nix | 0 .../modules/development/dotnet.nix | 0 .../modules/development/nix.nix | 0 .../modules/development/node.nix | 0 .../modules/development/ollama.nix | 0 .../modules/development/rust.nix | 0 {hosts/desktop => shared}/modules/fonts.nix | 0 .../modules/gaming/default.nix | 0 .../modules/gaming/steam.nix | 0 .../modules/gnome/default.nix | 0 .../modules/gnome/nautilus.nix | 0 .../modules/hardware/audio.nix | 0 .../modules/hardware/default.nix | 1 - .../modules/hardware/graphics/default.nix | 0 .../modules/hardware/graphics/nvidia.nix | 9 +++- .../modules/hardware/keyboard.nix | 0 .../modules/hyprland/default.nix | 2 +- {hosts/desktop => shared}/modules/locale.nix | 0 .../modules/networking.nix | 4 +- .../modules/nix-helper.nix | 4 +- {hosts/desktop => shared}/modules/qt.nix | 0 {hosts/desktop => shared}/modules/sddm.nix | 0 .../desktop => shared}/modules/security.nix | 0 {hosts/desktop => shared}/modules/shell.nix | 0 51 files changed, 58 insertions(+), 406 deletions(-) rename hosts/desktop/modules/{hardware => }/hardware-configuration.nix (88%) delete mode 100644 hosts/desktop/modules/networking.nix delete mode 100644 hosts/desktop/modules/nix-helper.nix delete mode 100644 hosts/thinkpad/modules/development.nix delete mode 100644 hosts/thinkpad/modules/fonts.nix delete mode 100644 hosts/thinkpad/modules/gaming/default.nix delete mode 100644 hosts/thinkpad/modules/gaming/steam.nix delete mode 100644 hosts/thinkpad/modules/gnome/default.nix delete mode 100644 hosts/thinkpad/modules/gnome/nautilus.nix rename hosts/thinkpad/modules/{hardware => }/hardware-configuration.nix (100%) delete mode 100644 hosts/thinkpad/modules/hardware/audio.nix delete mode 100644 hosts/thinkpad/modules/hardware/default.nix delete mode 100644 hosts/thinkpad/modules/hardware/graphics/default.nix delete mode 100644 hosts/thinkpad/modules/hardware/keyboard.nix delete mode 100644 hosts/thinkpad/modules/hyprland/default.nix delete mode 100644 hosts/thinkpad/modules/locale.nix delete mode 100644 hosts/thinkpad/modules/qt.nix delete mode 100644 hosts/thinkpad/modules/sddm.nix delete mode 100644 hosts/thinkpad/modules/shell.nix create mode 100644 shared/modules/default.nix rename {hosts/desktop => shared}/modules/development/default.nix (100%) rename {hosts/desktop => shared}/modules/development/docker.nix (100%) rename {hosts/desktop => shared}/modules/development/dotnet.nix (100%) rename {hosts/desktop => shared}/modules/development/nix.nix (100%) rename {hosts/desktop => shared}/modules/development/node.nix (100%) rename {hosts/desktop => shared}/modules/development/ollama.nix (100%) rename {hosts/desktop => shared}/modules/development/rust.nix (100%) rename {hosts/desktop => shared}/modules/fonts.nix (100%) rename {hosts/desktop => shared}/modules/gaming/default.nix (100%) rename {hosts/desktop => shared}/modules/gaming/steam.nix (100%) rename {hosts/desktop => shared}/modules/gnome/default.nix (100%) rename {hosts/desktop => shared}/modules/gnome/nautilus.nix (100%) rename {hosts/desktop => shared}/modules/hardware/audio.nix (100%) rename {hosts/desktop => shared}/modules/hardware/default.nix (68%) rename {hosts/desktop => shared}/modules/hardware/graphics/default.nix (100%) rename {hosts/desktop => shared}/modules/hardware/graphics/nvidia.nix (90%) rename {hosts/desktop => shared}/modules/hardware/keyboard.nix (100%) rename {hosts/desktop => shared}/modules/hyprland/default.nix (84%) rename {hosts/desktop => shared}/modules/locale.nix (100%) rename {hosts/thinkpad => shared}/modules/networking.nix (90%) rename {hosts/thinkpad => shared}/modules/nix-helper.nix (81%) rename {hosts/desktop => shared}/modules/qt.nix (100%) rename {hosts/desktop => shared}/modules/sddm.nix (100%) rename {hosts/desktop => shared}/modules/security.nix (100%) rename {hosts/desktop => shared}/modules/shell.nix (100%) diff --git a/flake.nix b/flake.nix index 534c7e6..c35e792 100644 --- a/flake.nix +++ b/flake.nix @@ -80,6 +80,7 @@ { hostName = "desktop"; system = "x86_64-linux"; + nvidia.enable = true; } { hostName = "thinkpad"; @@ -88,7 +89,7 @@ { hostName = "pi4"; system = "aarch64-linux"; - enableWayland = false; + wayland.enable = false; } # TODO Homelab config ]; @@ -114,8 +115,13 @@ password = "temp"; }, version ? common.version, - enableWayland ? true, - }: + wayland ? { + enable = true; + }, + nvidia ? { + enable = false; + }, + }@systemConfig: # TODO only pass in systemConfig { name = hostName; @@ -128,9 +134,7 @@ common theme lib - hostName - version - enableWayland + systemConfig ; isDarwin = false; }; @@ -149,9 +153,7 @@ common theme libHm - hostName - version - enableWayland + systemConfig ; }; users.${user.name} = import ./hosts/${hostName}/home-manager; diff --git a/hosts/desktop/modules/default.nix b/hosts/desktop/modules/default.nix index 5999ba5..4b22dc7 100644 --- a/hosts/desktop/modules/default.nix +++ b/hosts/desktop/modules/default.nix @@ -1,17 +1,8 @@ +{ lib, ... }: + { imports = [ - ./development - ./fonts.nix - ./gaming - ./gnome - ./hardware - ./locale.nix - ./networking.nix - ./nix-helper.nix - ./hyprland - ./sddm.nix - ./security.nix - ./shell.nix - ./qt.nix + (lib.custom.relativeToRoot "shared/modules") + ./hardware-configuration.nix ]; } diff --git a/hosts/desktop/modules/hardware/hardware-configuration.nix b/hosts/desktop/modules/hardware-configuration.nix similarity index 88% rename from hosts/desktop/modules/hardware/hardware-configuration.nix rename to hosts/desktop/modules/hardware-configuration.nix index 53f0e81..b2745dc 100644 --- a/hosts/desktop/modules/hardware/hardware-configuration.nix +++ b/hosts/desktop/modules/hardware-configuration.nix @@ -1,10 +1,6 @@ -# 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, ... }: diff --git a/hosts/desktop/modules/networking.nix b/hosts/desktop/modules/networking.nix deleted file mode 100644 index cafa9fc..0000000 --- a/hosts/desktop/modules/networking.nix +++ /dev/null @@ -1,22 +0,0 @@ -{ hostName, ... }: - -{ - networking = { - networkmanager.enable = true; - inherit hostName; - # wireless.enable = true; # Enables wireless support via wpa_supplicant. - }; - - # Configure network proxy if necessary - # networking.proxy.default = "http://user:password@proxy:port/"; - # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain"; - # Open ports in the firewall. - # networking.firewall.allowedTCPPorts = [ ... ]; - # networking.firewall.allowedUDPPorts = [ ... ]; - # Or disable the firewall altogether. - # networking.firewall.enable = false; - - programs.ssh.enableAskPassword = false; - - services.tailscale.enable = true; -} diff --git a/hosts/desktop/modules/nix-helper.nix b/hosts/desktop/modules/nix-helper.nix deleted file mode 100644 index f60cc0e..0000000 --- a/hosts/desktop/modules/nix-helper.nix +++ /dev/null @@ -1,12 +0,0 @@ -# Nix-Helper: github.com/viperML/nh -{ - programs.nh = { - enable = true; - flake = ../.; - clean = { - enable = true; - dates = "weekly"; - extraArgs = "--keep-since 30d"; - }; - }; -} diff --git a/hosts/thinkpad/modules/default.nix b/hosts/thinkpad/modules/default.nix index de7f5de..2069513 100644 --- a/hosts/thinkpad/modules/default.nix +++ b/hosts/thinkpad/modules/default.nix @@ -1,19 +1,15 @@ +{ pkgs, lib, ... }: + { imports = [ + (lib.custom.relativeToRoot "shared/modules") ./battery.nix ./bluetooth.nix - ./development.nix - ./fonts.nix - ./gaming - ./gnome - ./hardware - ./locale.nix - ./networking.nix - ./nix-helper.nix - ./hyprland - ./sddm.nix + ./hardware-configuration.nix ./security.nix - ./shell.nix - ./qt.nix + ]; + + environment.systemPackages = with pkgs; [ + hyprsunset # Blue light filter ]; } diff --git a/hosts/thinkpad/modules/development.nix b/hosts/thinkpad/modules/development.nix deleted file mode 100644 index d0cde6b..0000000 --- a/hosts/thinkpad/modules/development.nix +++ /dev/null @@ -1,41 +0,0 @@ -{ pkgs, ... }: - -{ - environment.systemPackages = with pkgs; [ - # IDEs - jetbrains.rust-rover - jetbrains.webstorm - jetbrains.rider - vscodium # TODO set up extensions - # Tools - dotnet-sdk_9 - dotnet-aspnetcore_9 - git - rustup - nodejs_22 - pnpm - just - gcc # Required for C, Rust and others - # Language servers - nixd - nil - # Formatters - nixfmt-rfc-style - treefmt - nodePackages.prettier - shfmt - ]; - - virtualisation.docker = { - enable = true; - storageDriver = "btrfs"; - rootless = { - enable = true; - setSocketVariable = true; - }; - }; - - services.ollama = { - enable = true; - }; -} diff --git a/hosts/thinkpad/modules/fonts.nix b/hosts/thinkpad/modules/fonts.nix deleted file mode 100644 index 260486a..0000000 --- a/hosts/thinkpad/modules/fonts.nix +++ /dev/null @@ -1,19 +0,0 @@ -{ pkgs, theme, ... }: - -{ - environment.systemPackages = with pkgs; [ - font-awesome # Icons - ]; - - fonts = { - fontconfig.enable = true; - packages = with pkgs; [ - (nerdfonts.override { fonts = [ theme.nerdFont ]; }) - jetbrains-mono - # The line below will replace the lines above in 25.05 - # nerd-fonts.jetbrains-mono - font-awesome - ]; - }; - -} diff --git a/hosts/thinkpad/modules/gaming/default.nix b/hosts/thinkpad/modules/gaming/default.nix deleted file mode 100644 index 79f3794..0000000 --- a/hosts/thinkpad/modules/gaming/default.nix +++ /dev/null @@ -1,12 +0,0 @@ -{ pkgs, ... }: - -{ - imports = [ - ./steam.nix - ]; - - environment.systemPackages = with pkgs; [ - heroic - wine - ]; -} diff --git a/hosts/thinkpad/modules/gaming/steam.nix b/hosts/thinkpad/modules/gaming/steam.nix deleted file mode 100644 index 65035f8..0000000 --- a/hosts/thinkpad/modules/gaming/steam.nix +++ /dev/null @@ -1,8 +0,0 @@ -{ - 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 - localNetworkGameTransfers.openFirewall = true; # Open ports in the firewall for Steam Local Network Game Transfers - }; -} diff --git a/hosts/thinkpad/modules/gnome/default.nix b/hosts/thinkpad/modules/gnome/default.nix deleted file mode 100644 index 0a39f32..0000000 --- a/hosts/thinkpad/modules/gnome/default.nix +++ /dev/null @@ -1,28 +0,0 @@ -{ pkgs, ... }: - -{ - imports = [ - ./nautilus.nix - ]; - - environment.systemPackages = with pkgs; [ - # adw-gtk3 - glib - adwaita-icon-theme - gnomeExtensions.appindicator - # gnome-extension-manager - loupe - gnome-calculator - gnome-disk-utility - gnome-clocks - papers # PDFReader - ]; - - programs.dconf.enable = true; # Required for some gnome applications - - services = { - gnome.gnome-keyring.enable = true; - gvfs.enable = true; # Gnome Virtual File-system. Required for various things in nautilus - udev.packages = with pkgs; [ gnome-settings-daemon ]; - }; -} diff --git a/hosts/thinkpad/modules/gnome/nautilus.nix b/hosts/thinkpad/modules/gnome/nautilus.nix deleted file mode 100644 index 523bb95..0000000 --- a/hosts/thinkpad/modules/gnome/nautilus.nix +++ /dev/null @@ -1,15 +0,0 @@ -{ pkgs, ... }: -let - common = import ../../common.nix; -in -{ - environment.systemPackages = with pkgs; [ - nautilus - ffmpegthumbnailer # Thumbnails - ]; - - programs.nautilus-open-any-terminal = { - enable = true; - terminal = common.default.terminal; - }; -} diff --git a/hosts/thinkpad/modules/hardware/hardware-configuration.nix b/hosts/thinkpad/modules/hardware-configuration.nix similarity index 100% rename from hosts/thinkpad/modules/hardware/hardware-configuration.nix rename to hosts/thinkpad/modules/hardware-configuration.nix diff --git a/hosts/thinkpad/modules/hardware/audio.nix b/hosts/thinkpad/modules/hardware/audio.nix deleted file mode 100644 index 2b3429e..0000000 --- a/hosts/thinkpad/modules/hardware/audio.nix +++ /dev/null @@ -1,33 +0,0 @@ -{ pkgs, ... }: - -{ - environment.systemPackages = with pkgs; [ - gst_all_1.gstreamer - gst_all_1.gst-plugins-base - gst_all_1.gst-plugins-good - gst_all_1.gst-plugins-bad - - wireplumber - playerctl # Interaction with audioplayers and browsers - pavucontrol # GUI - spotify - ]; - - hardware.pulseaudio.enable = false; # Will be moved to services in 25.05 - - security.rtkit.enable = true; # Enable RealtimeKit for audio purposes - - services = { - pipewire = { - enable = true; - alsa = { - enable = true; - support32Bit = true; - }; - pulse.enable = true; - # Uncomment the following line if you want to use JACK applications - # jack.enable = true; - }; - # pulseaudio.enable = false; # TODO uncommenct at 25.05 - }; -} diff --git a/hosts/thinkpad/modules/hardware/default.nix b/hosts/thinkpad/modules/hardware/default.nix deleted file mode 100644 index ffd2b30..0000000 --- a/hosts/thinkpad/modules/hardware/default.nix +++ /dev/null @@ -1,8 +0,0 @@ -{ - imports = [ - ./audio.nix - ./graphics - ./hardware-configuration.nix - ./keyboard.nix - ]; -} diff --git a/hosts/thinkpad/modules/hardware/graphics/default.nix b/hosts/thinkpad/modules/hardware/graphics/default.nix deleted file mode 100644 index eaade71..0000000 --- a/hosts/thinkpad/modules/hardware/graphics/default.nix +++ /dev/null @@ -1,6 +0,0 @@ -{ - imports = [ ]; - - # Enable OpenGL - hardware.graphics.enable = true; -} diff --git a/hosts/thinkpad/modules/hardware/keyboard.nix b/hosts/thinkpad/modules/hardware/keyboard.nix deleted file mode 100644 index 8840a94..0000000 --- a/hosts/thinkpad/modules/hardware/keyboard.nix +++ /dev/null @@ -1,11 +0,0 @@ -{ pkgs, ... }: - -{ - environment.systemPackages = with pkgs; [ - via - ]; - - hardware.keyboard.qmk.enable = true; - - services.udev.packages = with pkgs; [ via ]; -} diff --git a/hosts/thinkpad/modules/hyprland/default.nix b/hosts/thinkpad/modules/hyprland/default.nix deleted file mode 100644 index 9e7c4a7..0000000 --- a/hosts/thinkpad/modules/hyprland/default.nix +++ /dev/null @@ -1,25 +0,0 @@ -# System configurations for Hyprland. For home configs, see ./home-manager/hyprland -{ pkgs, ... }: - -{ - environment.systemPackages = with pkgs; [ - xdg-desktop-portal-hyprland - hyprpolkitagent # Auth deamon providing modals for password auth - hyprshot # Screenshots - hyprsunset # Blue light filter - unstable.hyprsysteminfo - unstable.hyprland-qtutils - unstable.hyprland-qt-support - ]; - - programs = { - hyprland = { - enable = true; - xwayland.enable = true; - withUWSM = true; - }; - hyprlock.enable = true; # Lock screen - }; - - services.hypridle.enable = true; # Lock when unused -} diff --git a/hosts/thinkpad/modules/locale.nix b/hosts/thinkpad/modules/locale.nix deleted file mode 100644 index 08677ca..0000000 --- a/hosts/thinkpad/modules/locale.nix +++ /dev/null @@ -1,37 +0,0 @@ -# TODO move locale config for hyprland here -let - utf-8 = "UTF-8"; - en = "en_GB.${utf-8}"; - nb = "nb_NO.${utf-8}"; - common = import ../common.nix; -in -{ - # Configure console keymap - console.keyMap = "uk"; - - # Select internationalisation properties. - i18n = { - defaultLocale = en; - supportedLocales = [ - "${en}/${utf-8}" - "${nb}/${utf-8}" - ]; - extraLocaleSettings = { - LC_ADDRESS = nb; - LC_IDENTIFICATION = nb; - LC_MEASUREMENT = nb; - LC_MONETARY = nb; - LC_NAME = nb; - LC_NUMERIC = nb; - LC_PAPER = nb; - LC_TELEPHONE = nb; - LC_TIME = nb; - }; - }; - - # Configure keymaps - services.xserver.xkb = common.keymaps; - - # Set your time zone. - time.timeZone = "Europe/Oslo"; -} diff --git a/hosts/thinkpad/modules/qt.nix b/hosts/thinkpad/modules/qt.nix deleted file mode 100644 index 789cb01..0000000 --- a/hosts/thinkpad/modules/qt.nix +++ /dev/null @@ -1,17 +0,0 @@ -{ pkgs, ... }: - -{ - environment = { - sessionVariables = { - QT_QPA_PLATFORMTHEME = "qt6ct"; - QT_QPA_PLATFORM = "wayland"; # Enable Wayland for QT - }; - systemPackages = with pkgs.kdePackages; [ - qtwayland - qtsvg - qt6ct - ]; - }; - - qt.enable = true; -} diff --git a/hosts/thinkpad/modules/sddm.nix b/hosts/thinkpad/modules/sddm.nix deleted file mode 100644 index f481f12..0000000 --- a/hosts/thinkpad/modules/sddm.nix +++ /dev/null @@ -1,22 +0,0 @@ -{ pkgs, theme, ... }: -let - flavor = theme.flavor; -in -{ - environment.systemPackages = with pkgs; [ - (catppuccin-sddm.override { - flavor = flavor; - font = theme.nerdFont; - fontSize = "9"; - background = "${../wallpapers/catppuccin_high.png}"; - loginBackground = true; - }) - ]; - - services.displayManager.sddm = { - enable = true; - theme = "catppuccin-${flavor}"; - wayland.enable = true; - package = pkgs.kdePackages.sddm; - }; -} diff --git a/hosts/thinkpad/modules/security.nix b/hosts/thinkpad/modules/security.nix index ea466d7..bcfc93a 100644 --- a/hosts/thinkpad/modules/security.nix +++ b/hosts/thinkpad/modules/security.nix @@ -1,13 +1,6 @@ { pkgs, ... }: { - environment.systemPackages = with pkgs; [ - gnupg - yubioath-flutter - ]; - - programs.gnupg.agent.enable = true; - security = { pam = { services = { @@ -28,18 +21,7 @@ session include login session optional ${pkgs.gnome-keyring}/lib/security/pam_gnome_keyring.so auto_start ''; - login = { - fprintAuth = false; - u2fAuth = false; # U2F and password - }; - sudo.u2fAuth = true; # U2F or password - }; - u2f = { - enable = true; - settings = { - cue = true; # Prompt: Please touch the device - interactive = false; # Prompt: Insert your U2F device, then press ENTER. - }; + login.fprintAuth = false; }; }; }; @@ -60,9 +42,4 @@ # services.fprintd.package = pkgs.fprintd.override { # libfprint = pkgs.libfprint-focaltech-2808-a658; # }; - - services = { - pcscd.enable = true; # Required for Yubikey - udev.packages = with pkgs; [ yubikey-personalization ]; - }; } diff --git a/hosts/thinkpad/modules/shell.nix b/hosts/thinkpad/modules/shell.nix deleted file mode 100644 index 84b5931..0000000 --- a/hosts/thinkpad/modules/shell.nix +++ /dev/null @@ -1,19 +0,0 @@ -# For Fish dotfiles, see: /home-manager/fish.nix -{ pkgs, ... }: - -{ - programs = { - bash = { - # Starts the OS using Bash, then starts fish if it's not running - interactiveShellInit = '' - if [[ $(${pkgs.procps}/bin/ps --no-header --pid=$PPID --format=comm) != "fish" && -z ''${BASH_EXECUTION_STRING} ]] - then - shopt -q login_shell && LOGIN_OPTION='--login' || LOGIN_OPTION="" - exec ${pkgs.fish}/bin/fish $LOGIN_OPTION - fi - ''; - }; - - fish.enable = true; - }; -} diff --git a/justfile b/justfile index b14eadc..a654adf 100644 --- a/justfile +++ b/justfile @@ -5,13 +5,13 @@ fmt: treefmt --on-unmatched info test *FLAGS: - just fmt git add . + just fmt nh os test . {{FLAGS}} switch *FLAGS: - just fmt git add . + just fmt nh os switch . {{FLAGS}} switch-now *FLAGS: diff --git a/shared/common.nix b/shared/common.nix index 94596a2..a6e4485 100644 --- a/shared/common.nix +++ b/shared/common.nix @@ -24,6 +24,8 @@ rec { username = "martin"; + root = ../.; + # This value determines the NixOS release from which the default # settings for stateful data, like file locations and database versions # on your system were taken. It's perfectly fine and recommended to leave diff --git a/shared/modules/default.nix b/shared/modules/default.nix new file mode 100644 index 0000000..5999ba5 --- /dev/null +++ b/shared/modules/default.nix @@ -0,0 +1,17 @@ +{ + imports = [ + ./development + ./fonts.nix + ./gaming + ./gnome + ./hardware + ./locale.nix + ./networking.nix + ./nix-helper.nix + ./hyprland + ./sddm.nix + ./security.nix + ./shell.nix + ./qt.nix + ]; +} diff --git a/hosts/desktop/modules/development/default.nix b/shared/modules/development/default.nix similarity index 100% rename from hosts/desktop/modules/development/default.nix rename to shared/modules/development/default.nix diff --git a/hosts/desktop/modules/development/docker.nix b/shared/modules/development/docker.nix similarity index 100% rename from hosts/desktop/modules/development/docker.nix rename to shared/modules/development/docker.nix diff --git a/hosts/desktop/modules/development/dotnet.nix b/shared/modules/development/dotnet.nix similarity index 100% rename from hosts/desktop/modules/development/dotnet.nix rename to shared/modules/development/dotnet.nix diff --git a/hosts/desktop/modules/development/nix.nix b/shared/modules/development/nix.nix similarity index 100% rename from hosts/desktop/modules/development/nix.nix rename to shared/modules/development/nix.nix diff --git a/hosts/desktop/modules/development/node.nix b/shared/modules/development/node.nix similarity index 100% rename from hosts/desktop/modules/development/node.nix rename to shared/modules/development/node.nix diff --git a/hosts/desktop/modules/development/ollama.nix b/shared/modules/development/ollama.nix similarity index 100% rename from hosts/desktop/modules/development/ollama.nix rename to shared/modules/development/ollama.nix diff --git a/hosts/desktop/modules/development/rust.nix b/shared/modules/development/rust.nix similarity index 100% rename from hosts/desktop/modules/development/rust.nix rename to shared/modules/development/rust.nix diff --git a/hosts/desktop/modules/fonts.nix b/shared/modules/fonts.nix similarity index 100% rename from hosts/desktop/modules/fonts.nix rename to shared/modules/fonts.nix diff --git a/hosts/desktop/modules/gaming/default.nix b/shared/modules/gaming/default.nix similarity index 100% rename from hosts/desktop/modules/gaming/default.nix rename to shared/modules/gaming/default.nix diff --git a/hosts/desktop/modules/gaming/steam.nix b/shared/modules/gaming/steam.nix similarity index 100% rename from hosts/desktop/modules/gaming/steam.nix rename to shared/modules/gaming/steam.nix diff --git a/hosts/desktop/modules/gnome/default.nix b/shared/modules/gnome/default.nix similarity index 100% rename from hosts/desktop/modules/gnome/default.nix rename to shared/modules/gnome/default.nix diff --git a/hosts/desktop/modules/gnome/nautilus.nix b/shared/modules/gnome/nautilus.nix similarity index 100% rename from hosts/desktop/modules/gnome/nautilus.nix rename to shared/modules/gnome/nautilus.nix diff --git a/hosts/desktop/modules/hardware/audio.nix b/shared/modules/hardware/audio.nix similarity index 100% rename from hosts/desktop/modules/hardware/audio.nix rename to shared/modules/hardware/audio.nix diff --git a/hosts/desktop/modules/hardware/default.nix b/shared/modules/hardware/default.nix similarity index 68% rename from hosts/desktop/modules/hardware/default.nix rename to shared/modules/hardware/default.nix index ffd2b30..aac2e08 100644 --- a/hosts/desktop/modules/hardware/default.nix +++ b/shared/modules/hardware/default.nix @@ -2,7 +2,6 @@ imports = [ ./audio.nix ./graphics - ./hardware-configuration.nix ./keyboard.nix ]; } diff --git a/hosts/desktop/modules/hardware/graphics/default.nix b/shared/modules/hardware/graphics/default.nix similarity index 100% rename from hosts/desktop/modules/hardware/graphics/default.nix rename to shared/modules/hardware/graphics/default.nix diff --git a/hosts/desktop/modules/hardware/graphics/nvidia.nix b/shared/modules/hardware/graphics/nvidia.nix similarity index 90% rename from hosts/desktop/modules/hardware/graphics/nvidia.nix rename to shared/modules/hardware/graphics/nvidia.nix index 6b33ac2..5b30c84 100644 --- a/hosts/desktop/modules/hardware/graphics/nvidia.nix +++ b/shared/modules/hardware/graphics/nvidia.nix @@ -1,6 +1,11 @@ -{ pkgs, ... }: - { + pkgs, + lib, + systemConfig, + ... +}: + +lib.mkIf systemConfig.nvidia.enable { boot.kernelParams = [ "nvidia.NVreg_PreserveVideoMemoryAllocations=1" ]; # For hardware acceleration diff --git a/hosts/desktop/modules/hardware/keyboard.nix b/shared/modules/hardware/keyboard.nix similarity index 100% rename from hosts/desktop/modules/hardware/keyboard.nix rename to shared/modules/hardware/keyboard.nix diff --git a/hosts/desktop/modules/hyprland/default.nix b/shared/modules/hyprland/default.nix similarity index 84% rename from hosts/desktop/modules/hyprland/default.nix rename to shared/modules/hyprland/default.nix index 3a79323..8cb2c9e 100644 --- a/hosts/desktop/modules/hyprland/default.nix +++ b/shared/modules/hyprland/default.nix @@ -1,4 +1,4 @@ -# System configurations for Hyprland. For home configs, see ./home-manager/hyprland +# System configurations for Hyprland. For home configs, see ./shared/home-manager/hyprland { pkgs, ... }: { diff --git a/hosts/desktop/modules/locale.nix b/shared/modules/locale.nix similarity index 100% rename from hosts/desktop/modules/locale.nix rename to shared/modules/locale.nix diff --git a/hosts/thinkpad/modules/networking.nix b/shared/modules/networking.nix similarity index 90% rename from hosts/thinkpad/modules/networking.nix rename to shared/modules/networking.nix index cafa9fc..7ac233a 100644 --- a/hosts/thinkpad/modules/networking.nix +++ b/shared/modules/networking.nix @@ -1,9 +1,9 @@ -{ hostName, ... }: +{ systemConfig, ... }: { networking = { networkmanager.enable = true; - inherit hostName; + hostName = systemConfig.hostName; # wireless.enable = true; # Enables wireless support via wpa_supplicant. }; diff --git a/hosts/thinkpad/modules/nix-helper.nix b/shared/modules/nix-helper.nix similarity index 81% rename from hosts/thinkpad/modules/nix-helper.nix rename to shared/modules/nix-helper.nix index f60cc0e..ba8c01b 100644 --- a/hosts/thinkpad/modules/nix-helper.nix +++ b/shared/modules/nix-helper.nix @@ -1,8 +1,10 @@ # Nix-Helper: github.com/viperML/nh +{ common, ... }: + { programs.nh = { enable = true; - flake = ../.; + flake = common.root; clean = { enable = true; dates = "weekly"; diff --git a/hosts/desktop/modules/qt.nix b/shared/modules/qt.nix similarity index 100% rename from hosts/desktop/modules/qt.nix rename to shared/modules/qt.nix diff --git a/hosts/desktop/modules/sddm.nix b/shared/modules/sddm.nix similarity index 100% rename from hosts/desktop/modules/sddm.nix rename to shared/modules/sddm.nix diff --git a/hosts/desktop/modules/security.nix b/shared/modules/security.nix similarity index 100% rename from hosts/desktop/modules/security.nix rename to shared/modules/security.nix diff --git a/hosts/desktop/modules/shell.nix b/shared/modules/shell.nix similarity index 100% rename from hosts/desktop/modules/shell.nix rename to shared/modules/shell.nix