From a03355b3a13b97eb0f52295e23239f04783b7b3b Mon Sep 17 00:00:00 2001 From: Florian RICHER Date: Mon, 27 May 2024 22:40:30 +0200 Subject: [PATCH] Restructure home and system modules --- home/default.nix | 2 +- hosts/nixos-test/default.nix | 6 +++--- hosts/perso-desktop/default.nix | 6 +++--- hosts/perso-laptop/default.nix | 6 +++--- hosts/pro-laptop/default.nix | 6 +++--- modules/default.nix | 9 --------- modules/home/apps/chromium/default.nix | 4 ++-- modules/home/apps/flatpak/default.nix | 4 ++-- modules/home/apps/jetbrainsToolbox/default.nix | 4 ++-- modules/home/apps/kitty/default.nix | 6 +++--- modules/home/apps/vscode/default.nix | 4 ++-- modules/home/desktop/hyprland/default.nix | 6 +++--- modules/home/shell/atuin/default.nix | 4 ++-- modules/home/shell/direnv/default.nix | 4 ++-- modules/home/shell/git/default.nix | 4 ++-- modules/home/shell/zsh/default.nix | 4 ++-- modules/system/default.nix | 16 ++++------------ modules/{ => system}/desktop/default.nix | 0 modules/{ => system}/desktop/gnome/default.nix | 4 ++-- modules/{ => system}/desktop/plasma/default.nix | 6 +++--- .../system/{ => hardware}/bluetooth/default.nix | 4 ++-- .../system/{system.nix => hardware/common.nix} | 0 modules/system/hardware/default.nix | 17 +++++++++++++++++ .../{ => hardware}/gamingKernel/default.nix | 4 ++-- .../system/{ => hardware}/keymaps/default.nix | 4 ++-- modules/system/{ => hardware}/keymaps/fr.nix | 0 modules/system/{ => hardware}/keymaps/us.nix | 0 .../system/{ => hardware}/nvidia/default.nix | 4 ++-- .../system/{ => hardware}/pipewire/default.nix | 4 ++-- .../system/{ => hardware}/plymouth/default.nix | 4 ++-- .../system/{ => hardware}/printing/default.nix | 4 ++-- .../system/{ => hardware}/waydroid/default.nix | 4 ++-- modules/{ => system}/server/default.nix | 0 modules/{ => system}/server/docker/default.nix | 6 +++--- modules/{ => system}/server/openssh/default.nix | 4 ++-- 35 files changed, 82 insertions(+), 82 deletions(-) delete mode 100644 modules/default.nix rename modules/{ => system}/desktop/default.nix (100%) rename modules/{ => system}/desktop/gnome/default.nix (83%) rename modules/{ => system}/desktop/plasma/default.nix (87%) rename modules/system/{ => hardware}/bluetooth/default.nix (68%) rename modules/system/{system.nix => hardware/common.nix} (100%) create mode 100644 modules/system/hardware/default.nix rename modules/system/{ => hardware}/gamingKernel/default.nix (69%) rename modules/system/{ => hardware}/keymaps/default.nix (78%) rename modules/system/{ => hardware}/keymaps/fr.nix (100%) rename modules/system/{ => hardware}/keymaps/us.nix (100%) rename modules/system/{ => hardware}/nvidia/default.nix (94%) rename modules/system/{ => hardware}/pipewire/default.nix (88%) rename modules/system/{ => hardware}/plymouth/default.nix (68%) rename modules/system/{ => hardware}/printing/default.nix (68%) rename modules/system/{ => hardware}/waydroid/default.nix (69%) rename modules/{ => system}/server/default.nix (100%) rename modules/{ => system}/server/docker/default.nix (60%) rename modules/{ => system}/server/openssh/default.nix (76%) diff --git a/home/default.nix b/home/default.nix index 9a524dd..2697d72 100644 --- a/home/default.nix +++ b/home/default.nix @@ -15,7 +15,7 @@ programs.home-manager.enable = true; nix.settings.experimental-features = [ "nix-command" "flakes" ]; - homeModules = { + modules.home = { apps = { chromium.enable = true; flatpak.enable = true; diff --git a/hosts/nixos-test/default.nix b/hosts/nixos-test/default.nix index 6fabb1b..d3f8dfb 100644 --- a/hosts/nixos-test/default.nix +++ b/hosts/nixos-test/default.nix @@ -7,7 +7,7 @@ { imports = [ - ../../modules + ../../modules/system # Include the results of the hardware scan. ./hardware-configuration.nix @@ -35,7 +35,7 @@ }; }; - modules = { + modules.system = { desktop = { plasma.enable = true; }; @@ -45,7 +45,7 @@ openssh.enable = true; }; - system = { + hardware = { bluetooth.enable = true; gamingKernel.enable = true; keymaps.layout = "us"; diff --git a/hosts/perso-desktop/default.nix b/hosts/perso-desktop/default.nix index 6d167ca..43e5e9a 100644 --- a/hosts/perso-desktop/default.nix +++ b/hosts/perso-desktop/default.nix @@ -7,7 +7,7 @@ { imports = [ - ../../modules + ../../modules/system # Include the results of the hardware scan. ./hardware-configuration.nix @@ -19,12 +19,12 @@ networking.hostName = "nixos-desktop-perso"; # Define your hostname. - modules = { + modules.system = { desktop = { plasma.enable = true; }; - system = { + hardware = { bluetooth.enable = true; gamingKernel.enable = true; keymaps.layout = "us"; diff --git a/hosts/perso-laptop/default.nix b/hosts/perso-laptop/default.nix index a0558d4..911bd26 100644 --- a/hosts/perso-laptop/default.nix +++ b/hosts/perso-laptop/default.nix @@ -7,7 +7,7 @@ { imports = [ - ../../modules + ../../modules/system # Include the results of the hardware scan. ./hardware-configuration.nix @@ -32,12 +32,12 @@ nvidiaBusId = "PCI:1:0:0"; }; - modules = { + modules.system = { desktop = { plasma.enable = true; }; - system = { + hardware = { bluetooth.enable = true; gamingKernel.enable = true; keymaps.layout = "us"; diff --git a/hosts/pro-laptop/default.nix b/hosts/pro-laptop/default.nix index 043d03f..3f7bafa 100644 --- a/hosts/pro-laptop/default.nix +++ b/hosts/pro-laptop/default.nix @@ -7,7 +7,7 @@ { imports = [ - ../../modules + ../../modules/system # Include the results of the hardware scan. ./hardware-configuration.nix @@ -32,12 +32,12 @@ nvidiaBusId = "PCI:1:0:0"; }; - modules = { + modules.system = { desktop = { plasma.enable = true; }; - system = { + hardware = { bluetooth.enable = true; gamingKernel.enable = true; keymaps.layout = "us"; diff --git a/modules/default.nix b/modules/default.nix deleted file mode 100644 index d0e6ab6..0000000 --- a/modules/default.nix +++ /dev/null @@ -1,9 +0,0 @@ -{ config, pkgs, ... }: - -{ - imports = [ - ./desktop - ./server - ./system - ]; -} \ No newline at end of file diff --git a/modules/home/apps/chromium/default.nix b/modules/home/apps/chromium/default.nix index dbc7a90..4a0a40e 100644 --- a/modules/home/apps/chromium/default.nix +++ b/modules/home/apps/chromium/default.nix @@ -2,10 +2,10 @@ with lib; let - cfg = config.homeModules.apps.chromium; + cfg = config.modules.home.apps.chromium; in { - options.homeModules.apps.chromium = { + options.modules.home.apps.chromium = { enable = mkEnableOption '' Enable chromium with my custom configurations ''; diff --git a/modules/home/apps/flatpak/default.nix b/modules/home/apps/flatpak/default.nix index c379bc6..aa779f1 100644 --- a/modules/home/apps/flatpak/default.nix +++ b/modules/home/apps/flatpak/default.nix @@ -2,12 +2,12 @@ with lib; let - cfg = config.homeModules.apps.flatpak; + cfg = config.modules.home.apps.flatpak; in { imports = [ nix-flatpak.homeManagerModules.nix-flatpak ]; - options.homeModules.apps.flatpak = { + options.modules.home.apps.flatpak = { enable = mkEnableOption '' Enable flatpak with my custom configurations ''; diff --git a/modules/home/apps/jetbrainsToolbox/default.nix b/modules/home/apps/jetbrainsToolbox/default.nix index 5bbc656..c79f09f 100644 --- a/modules/home/apps/jetbrainsToolbox/default.nix +++ b/modules/home/apps/jetbrainsToolbox/default.nix @@ -2,10 +2,10 @@ with lib; let - cfg = config.homeModules.apps.jetbrainsToolbox; + cfg = config.modules.home.apps.jetbrainsToolbox; in { - options.homeModules.apps.jetbrainsToolbox = { + options.modules.home.apps.jetbrainsToolbox = { enable = mkEnableOption '' Enable jetbrainsToolbox with my custom configurations ''; diff --git a/modules/home/apps/kitty/default.nix b/modules/home/apps/kitty/default.nix index e8712d6..3ff532f 100644 --- a/modules/home/apps/kitty/default.nix +++ b/modules/home/apps/kitty/default.nix @@ -2,16 +2,16 @@ with lib; let - cfg = config.homeModules.apps.kitty; + cfg = config.modules.home.apps.kitty; in { - options.homeModules.apps.kitty = { + options.modules.home.apps.kitty = { enable = mkEnableOption '' Enable kitty with my custom configurations ''; enableBlur = mkOption { - default = !config.homeModules.desktop.hyprland.enable; # Disable by default if hyprland is enabled (Hyprland enable own blur) + default = !config.modules.home.desktop.hyprland.enable; # Disable by default if hyprland is enabled (Hyprland enable own blur) example = true; description = '' Enable blur (Usefull to disable with hyprland) diff --git a/modules/home/apps/vscode/default.nix b/modules/home/apps/vscode/default.nix index a364002..a52feca 100644 --- a/modules/home/apps/vscode/default.nix +++ b/modules/home/apps/vscode/default.nix @@ -2,10 +2,10 @@ with lib; let - cfg = config.homeModules.apps.vscode; + cfg = config.modules.home.apps.vscode; in { - options.homeModules.apps.vscode = { + options.modules.home.apps.vscode = { enable = mkEnableOption '' Enable vscode with my custom configurations ''; diff --git a/modules/home/desktop/hyprland/default.nix b/modules/home/desktop/hyprland/default.nix index 8c3735a..826b644 100644 --- a/modules/home/desktop/hyprland/default.nix +++ b/modules/home/desktop/hyprland/default.nix @@ -2,7 +2,7 @@ with lib; let - cfg = config.homeModules.desktop.hyprland; + cfg = config.modules.home.desktop.hyprland; set_volume = pkgs.writeScriptBin "set_volume.sh" '' #!${pkgs.runtimeShell} @@ -10,13 +10,13 @@ let ''; in { - options.homeModules.desktop.hyprland = { + options.modules.home.desktop.hyprland = { enable = mkEnableOption '' Enable hyprland with my custom configurations ''; }; config = mkIf cfg.enable { - homeModules.apps.kitty.enable = true; + modules.home.apps.kitty.enable = true; wayland.windowManager.hyprland = { enable = true; diff --git a/modules/home/shell/atuin/default.nix b/modules/home/shell/atuin/default.nix index 7b31170..326afd3 100644 --- a/modules/home/shell/atuin/default.nix +++ b/modules/home/shell/atuin/default.nix @@ -2,10 +2,10 @@ with lib; let - cfg = config.homeModules.shell.atuin; + cfg = config.modules.home.shell.atuin; in { - options.homeModules.shell.atuin = { + options.modules.home.shell.atuin = { enable = mkEnableOption '' Enable atuin with my custom configurations ''; diff --git a/modules/home/shell/direnv/default.nix b/modules/home/shell/direnv/default.nix index 0a8ae02..8ad9113 100644 --- a/modules/home/shell/direnv/default.nix +++ b/modules/home/shell/direnv/default.nix @@ -2,10 +2,10 @@ with lib; let - cfg = config.homeModules.shell.direnv; + cfg = config.modules.home.shell.direnv; in { - options.homeModules.shell.direnv = { + options.modules.home.shell.direnv = { enable = mkEnableOption '' Enable direnv with my custom configurations ''; diff --git a/modules/home/shell/git/default.nix b/modules/home/shell/git/default.nix index 4166a12..ad50961 100644 --- a/modules/home/shell/git/default.nix +++ b/modules/home/shell/git/default.nix @@ -2,10 +2,10 @@ with lib; let - cfg = config.homeModules.shell.git; + cfg = config.modules.home.shell.git; in { - options.homeModules.shell.git = { + options.modules.home.shell.git = { enable = mkEnableOption '' Enable git with my custom configurations ''; diff --git a/modules/home/shell/zsh/default.nix b/modules/home/shell/zsh/default.nix index 610882c..2dbf8a2 100644 --- a/modules/home/shell/zsh/default.nix +++ b/modules/home/shell/zsh/default.nix @@ -2,10 +2,10 @@ with lib; let - cfg = config.homeModules.shell.zsh; + cfg = config.modules.home.shell.zsh; in { - options.homeModules.shell.zsh = { + options.modules.home.shell.zsh = { enable = mkEnableOption '' Enable zsh with my custom configurations ''; diff --git a/modules/system/default.nix b/modules/system/default.nix index 6a98756..ea0cf75 100644 --- a/modules/system/default.nix +++ b/modules/system/default.nix @@ -1,17 +1,9 @@ -{ ... }: +{ config, pkgs, ... }: { imports = [ - ./bluetooth - ./gamingKernel - ./keymaps - ./nvidia - ./pipewire - ./plymouth - ./printing - ./waydroid - - # Common configuration - ./system.nix + ./desktop + ./hardware + ./server ]; } \ No newline at end of file diff --git a/modules/desktop/default.nix b/modules/system/desktop/default.nix similarity index 100% rename from modules/desktop/default.nix rename to modules/system/desktop/default.nix diff --git a/modules/desktop/gnome/default.nix b/modules/system/desktop/gnome/default.nix similarity index 83% rename from modules/desktop/gnome/default.nix rename to modules/system/desktop/gnome/default.nix index 91ffddf..edf0f30 100644 --- a/modules/desktop/gnome/default.nix +++ b/modules/system/desktop/gnome/default.nix @@ -2,10 +2,10 @@ with lib; let - cfg = config.modules.desktop.gnome; + cfg = config.modules.system.desktop.gnome; in { - options.modules.desktop.gnome = { + options.modules.system.desktop.gnome = { enable = mkEnableOption '' Enable gnome with my custom configurations ''; diff --git a/modules/desktop/plasma/default.nix b/modules/system/desktop/plasma/default.nix similarity index 87% rename from modules/desktop/plasma/default.nix rename to modules/system/desktop/plasma/default.nix index 295659e..b0387fe 100644 --- a/modules/desktop/plasma/default.nix +++ b/modules/system/desktop/plasma/default.nix @@ -2,10 +2,10 @@ with lib; let - cfg = config.modules.desktop.plasma; + cfg = config.modules.system.desktop.plasma; in { - options.modules.desktop.plasma = { + options.modules.system.desktop.plasma = { enable = mkEnableOption '' Enable plasma with my custom configurations ''; @@ -36,7 +36,7 @@ in # Uncomment when kwin is available in nixpkgs and NVIDIA 555 nixpkgs.overlays = [ - (import ../../../overlays/kwin) + (import ../../../../overlays/kwin) ]; }; } \ No newline at end of file diff --git a/modules/system/bluetooth/default.nix b/modules/system/hardware/bluetooth/default.nix similarity index 68% rename from modules/system/bluetooth/default.nix rename to modules/system/hardware/bluetooth/default.nix index 3a8ba7e..207ab92 100644 --- a/modules/system/bluetooth/default.nix +++ b/modules/system/hardware/bluetooth/default.nix @@ -2,10 +2,10 @@ with lib; let - cfg = config.modules.system.bluetooth; + cfg = config.modules.system.hardware.bluetooth; in { - options.modules.system.bluetooth = { + options.modules.system.hardware.bluetooth = { enable = mkEnableOption '' Enable pipewire with my custom configurations ''; diff --git a/modules/system/system.nix b/modules/system/hardware/common.nix similarity index 100% rename from modules/system/system.nix rename to modules/system/hardware/common.nix diff --git a/modules/system/hardware/default.nix b/modules/system/hardware/default.nix new file mode 100644 index 0000000..1c84d98 --- /dev/null +++ b/modules/system/hardware/default.nix @@ -0,0 +1,17 @@ +{ ... }: + +{ + imports = [ + ./bluetooth + ./gamingKernel + ./keymaps + ./nvidia + ./pipewire + ./plymouth + ./printing + ./waydroid + + # Common configuration + ./common.nix + ]; +} \ No newline at end of file diff --git a/modules/system/gamingKernel/default.nix b/modules/system/hardware/gamingKernel/default.nix similarity index 69% rename from modules/system/gamingKernel/default.nix rename to modules/system/hardware/gamingKernel/default.nix index 51a7e1b..ed483b9 100644 --- a/modules/system/gamingKernel/default.nix +++ b/modules/system/hardware/gamingKernel/default.nix @@ -2,10 +2,10 @@ with lib; let - cfg = config.modules.system.gamingKernel; + cfg = config.modules.system.hardware.gamingKernel; in { - options.modules.system.gamingKernel = { + options.modules.system.hardware.gamingKernel = { enable = mkEnableOption '' Enable gaming kernel with my custom configurations ''; diff --git a/modules/system/keymaps/default.nix b/modules/system/hardware/keymaps/default.nix similarity index 78% rename from modules/system/keymaps/default.nix rename to modules/system/hardware/keymaps/default.nix index 50fa838..9b18421 100644 --- a/modules/system/keymaps/default.nix +++ b/modules/system/hardware/keymaps/default.nix @@ -2,10 +2,10 @@ with lib; let - cfg = config.modules.system.keymaps; + cfg = config.modules.system.hardware.keymaps; in { - options.modules.system.keymaps = { + options.modules.system.hardware.keymaps = { layout = mkOption { default = "fr"; example = "fr"; diff --git a/modules/system/keymaps/fr.nix b/modules/system/hardware/keymaps/fr.nix similarity index 100% rename from modules/system/keymaps/fr.nix rename to modules/system/hardware/keymaps/fr.nix diff --git a/modules/system/keymaps/us.nix b/modules/system/hardware/keymaps/us.nix similarity index 100% rename from modules/system/keymaps/us.nix rename to modules/system/hardware/keymaps/us.nix diff --git a/modules/system/nvidia/default.nix b/modules/system/hardware/nvidia/default.nix similarity index 94% rename from modules/system/nvidia/default.nix rename to modules/system/hardware/nvidia/default.nix index 539c267..fa6625a 100644 --- a/modules/system/nvidia/default.nix +++ b/modules/system/hardware/nvidia/default.nix @@ -2,10 +2,10 @@ with lib; let - cfg = config.modules.system.nvidia; + cfg = config.modules.system.hardware.nvidia; in { - options.modules.system.nvidia = { + options.modules.system.hardware.nvidia = { enable = mkEnableOption '' Enable nvidia with my custom configurations ''; diff --git a/modules/system/pipewire/default.nix b/modules/system/hardware/pipewire/default.nix similarity index 88% rename from modules/system/pipewire/default.nix rename to modules/system/hardware/pipewire/default.nix index f823798..1f46de4 100644 --- a/modules/system/pipewire/default.nix +++ b/modules/system/hardware/pipewire/default.nix @@ -2,10 +2,10 @@ with lib; let - cfg = config.modules.system.pipewire; + cfg = config.modules.system.hardware.pipewire; in { - options.modules.system.pipewire = { + options.modules.system.hardware.pipewire = { enable = mkEnableOption '' Enable pipewire with my custom configurations ''; diff --git a/modules/system/plymouth/default.nix b/modules/system/hardware/plymouth/default.nix similarity index 68% rename from modules/system/plymouth/default.nix rename to modules/system/hardware/plymouth/default.nix index 420d615..8388b0d 100644 --- a/modules/system/plymouth/default.nix +++ b/modules/system/hardware/plymouth/default.nix @@ -2,10 +2,10 @@ with lib; let - cfg = config.modules.system.plymouth; + cfg = config.modules.system.hardware.plymouth; in { - options.modules.system.plymouth = { + options.modules.system.hardware.plymouth = { enable = mkEnableOption '' Enable plymouth with my custom configurations ''; diff --git a/modules/system/printing/default.nix b/modules/system/hardware/printing/default.nix similarity index 68% rename from modules/system/printing/default.nix rename to modules/system/hardware/printing/default.nix index e967439..6763e32 100644 --- a/modules/system/printing/default.nix +++ b/modules/system/hardware/printing/default.nix @@ -2,10 +2,10 @@ with lib; let - cfg = config.modules.system.printing; + cfg = config.modules.system.hardware.printing; in { - options.modules.system.printing = { + options.modules.system.hardware.printing = { enable = mkEnableOption '' Enable printing with my custom configurations ''; diff --git a/modules/system/waydroid/default.nix b/modules/system/hardware/waydroid/default.nix similarity index 69% rename from modules/system/waydroid/default.nix rename to modules/system/hardware/waydroid/default.nix index cdf5f48..86d3580 100644 --- a/modules/system/waydroid/default.nix +++ b/modules/system/hardware/waydroid/default.nix @@ -2,10 +2,10 @@ with lib; let - cfg = config.modules.system.waydroid; + cfg = config.modules.system.hardware.waydroid; in { - options.modules.system.waydroid = { + options.modules.system.hardware.waydroid = { enable = mkEnableOption '' Enable waydroid with my custom configurations ''; diff --git a/modules/server/default.nix b/modules/system/server/default.nix similarity index 100% rename from modules/server/default.nix rename to modules/system/server/default.nix diff --git a/modules/server/docker/default.nix b/modules/system/server/docker/default.nix similarity index 60% rename from modules/server/docker/default.nix rename to modules/system/server/docker/default.nix index 1708065..39c121a 100644 --- a/modules/server/docker/default.nix +++ b/modules/system/server/docker/default.nix @@ -2,10 +2,10 @@ with lib; let - cfg = config.modules.server.docker; + cfg = config.modules.system.server.docker; in { - options.modules.server.docker = { + options.modules.system.server.docker = { enable = mkEnableOption '' Enable docker with my custom configurations ''; @@ -13,7 +13,7 @@ in config = mkIf cfg.enable { virtualisation.docker = { enable = true; - enableNvidia = config.modules.system.nvidia.enable; + enableNvidia = config.modules.system.hardware.nvidia.enable; }; }; } \ No newline at end of file diff --git a/modules/server/openssh/default.nix b/modules/system/server/openssh/default.nix similarity index 76% rename from modules/server/openssh/default.nix rename to modules/system/server/openssh/default.nix index 1c03e7e..219ddeb 100644 --- a/modules/server/openssh/default.nix +++ b/modules/system/server/openssh/default.nix @@ -2,10 +2,10 @@ with lib; let - cfg = config.modules.server.openssh; + cfg = config.modules.system.server.openssh; in { - options.modules.server.openssh = { + options.modules.system.server.openssh = { enable = mkEnableOption '' Enable openssh with my custom configurations '';