From 03fca8b28b6deb79e0f4e96267eb4d9aaa889eea Mon Sep 17 00:00:00 2001 From: Mohammad Rafiq Date: Mon, 7 Jul 2025 19:24:36 +0800 Subject: [PATCH] refactor(modules): clean up folder structure --- nix/{ => flake-parts}/debug.nix | 0 nix/{flake-parts => }/meta.nix | 0 nix/modules/{ => cli}/git.nix | 0 nix/modules/{ => cli}/shell.nix | 0 nix/modules/machine/default.nix | 33 ++++++++++++++++- .../{options => }/machine/virtualisation.nix | 0 nix/modules/options/machine/default.nix | 37 ------------------- nix/modules/{options => system}/persist.nix | 0 nix/modules/{ => system}/secrets.nix | 0 nix/modules/{ => system}/system.nix | 0 nix/modules/{ => system}/users.nix | 0 nix/modules/{options => }/unfree-packages.nix | 0 12 files changed, 32 insertions(+), 38 deletions(-) rename nix/{ => flake-parts}/debug.nix (100%) rename nix/{flake-parts => }/meta.nix (100%) rename nix/modules/{ => cli}/git.nix (100%) rename nix/modules/{ => cli}/shell.nix (100%) rename nix/modules/{options => }/machine/virtualisation.nix (100%) delete mode 100644 nix/modules/options/machine/default.nix rename nix/modules/{options => system}/persist.nix (100%) rename nix/modules/{ => system}/secrets.nix (100%) rename nix/modules/{ => system}/system.nix (100%) rename nix/modules/{ => system}/users.nix (100%) rename nix/modules/{options => }/unfree-packages.nix (100%) diff --git a/nix/debug.nix b/nix/flake-parts/debug.nix similarity index 100% rename from nix/debug.nix rename to nix/flake-parts/debug.nix diff --git a/nix/flake-parts/meta.nix b/nix/meta.nix similarity index 100% rename from nix/flake-parts/meta.nix rename to nix/meta.nix diff --git a/nix/modules/git.nix b/nix/modules/cli/git.nix similarity index 100% rename from nix/modules/git.nix rename to nix/modules/cli/git.nix diff --git a/nix/modules/shell.nix b/nix/modules/cli/shell.nix similarity index 100% rename from nix/modules/shell.nix rename to nix/modules/cli/shell.nix diff --git a/nix/modules/machine/default.nix b/nix/modules/machine/default.nix index 22e2d75..e657fa2 100644 --- a/nix/modules/machine/default.nix +++ b/nix/modules/machine/default.nix @@ -1,7 +1,38 @@ +{ lib, ... }: +let + inherit (lib.options) mkEnableOption; + inherit (lib.modules) mkIf mkMerge; +in { flake.modules.nixos.default = - { modulesPath, ... }: + { config, modulesPath, ... }: + let + cfg = config.machine; + in { imports = [ (modulesPath + "/installer/scan/not-detected.nix") ]; + options.machine.bluetooth.enable = mkEnableOption ""; + options.machine.usb.automount = mkEnableOption ""; + config = mkMerge [ + (mkIf cfg.usb.automount { + services.udisks2.enable = true; + home-manager.sharedModules = [ + { + services.udiskie = { + enable = true; + automount = true; + notify = true; + }; + } + ]; + }) + (mkIf cfg.bluetooth.enable { + persistDirs = [ "/var/lib/bluetooth" ]; + hardware.bluetooth = { + enable = true; + settings.General.Experimental = true; + }; + }) + ]; }; } diff --git a/nix/modules/options/machine/virtualisation.nix b/nix/modules/machine/virtualisation.nix similarity index 100% rename from nix/modules/options/machine/virtualisation.nix rename to nix/modules/machine/virtualisation.nix diff --git a/nix/modules/options/machine/default.nix b/nix/modules/options/machine/default.nix deleted file mode 100644 index 48adc2a..0000000 --- a/nix/modules/options/machine/default.nix +++ /dev/null @@ -1,37 +0,0 @@ -{ lib, ... }: -let - inherit (lib.options) mkEnableOption; - inherit (lib.modules) mkIf mkMerge; -in -{ - flake.modules.nixos.default = - { config, ... }: - let - cfg = config.machine; - in - { - options.machine.bluetooth.enable = mkEnableOption ""; - options.machine.usb.automount = mkEnableOption ""; - config = mkMerge [ - (mkIf cfg.usb.automount { - services.udisks2.enable = true; - home-manager.sharedModules = [ - { - services.udiskie = { - enable = true; - automount = true; - notify = true; - }; - } - ]; - }) - (mkIf cfg.bluetooth.enable { - persistDirs = [ "/var/lib/bluetooth" ]; - hardware.bluetooth = { - enable = true; - settings.General.Experimental = true; - }; - }) - ]; - }; -} diff --git a/nix/modules/options/persist.nix b/nix/modules/system/persist.nix similarity index 100% rename from nix/modules/options/persist.nix rename to nix/modules/system/persist.nix diff --git a/nix/modules/secrets.nix b/nix/modules/system/secrets.nix similarity index 100% rename from nix/modules/secrets.nix rename to nix/modules/system/secrets.nix diff --git a/nix/modules/system.nix b/nix/modules/system/system.nix similarity index 100% rename from nix/modules/system.nix rename to nix/modules/system/system.nix diff --git a/nix/modules/users.nix b/nix/modules/system/users.nix similarity index 100% rename from nix/modules/users.nix rename to nix/modules/system/users.nix diff --git a/nix/modules/options/unfree-packages.nix b/nix/modules/unfree-packages.nix similarity index 100% rename from nix/modules/options/unfree-packages.nix rename to nix/modules/unfree-packages.nix