From d305535b014f31a5b6ce6a32be6407b5614375a1 Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Wed, 23 Jul 2025 19:26:21 +0100 Subject: [PATCH] Refactor bluetooth configuration --- hosts/lemp11/configuration.nix | 1 - hosts/t480/configuration.nix | 1 - hosts/t490/configuration.nix | 1 - hosts/t490/hardware.nix | 5 ----- modules/nixos/bluetooth.nix | 16 ---------------- modules/nixos/default.nix | 1 - modules2/bluetooth.nix | 7 +++++++ modules2/flake-parts.nix | 7 +++++++ modules2/hosts/t480/imports.nix | 7 +++++++ modules2/nixos-configurations.nix | 8 ++++++-- 10 files changed, 27 insertions(+), 27 deletions(-) delete mode 100644 hosts/t490/hardware.nix delete mode 100644 modules/nixos/bluetooth.nix create mode 100644 modules2/bluetooth.nix create mode 100644 modules2/flake-parts.nix create mode 100644 modules2/hosts/t480/imports.nix diff --git a/hosts/lemp11/configuration.nix b/hosts/lemp11/configuration.nix index ef50aff1..d1fdbcd4 100644 --- a/hosts/lemp11/configuration.nix +++ b/hosts/lemp11/configuration.nix @@ -20,7 +20,6 @@ features = { core = { - bluetooth.enable = true; zram.enable = true; }; diff --git a/hosts/t480/configuration.nix b/hosts/t480/configuration.nix index f0db5fc7..c1098e18 100644 --- a/hosts/t480/configuration.nix +++ b/hosts/t480/configuration.nix @@ -35,7 +35,6 @@ }; core = { - bluetooth.enable = true; openssh.enable = true; pipewire.enable = true; xbanish.enable = true; diff --git a/hosts/t490/configuration.nix b/hosts/t490/configuration.nix index 92a9aee5..04153f0e 100644 --- a/hosts/t490/configuration.nix +++ b/hosts/t490/configuration.nix @@ -17,7 +17,6 @@ ]; features = { - core.bluetooth.enable = true; core.zram.enable = true; desktop.dconf.enable = true; }; diff --git a/hosts/t490/hardware.nix b/hosts/t490/hardware.nix deleted file mode 100644 index 3798ca48..00000000 --- a/hosts/t490/hardware.nix +++ /dev/null @@ -1,5 +0,0 @@ -{ - hardware = { - bluetooth.enable = true; - }; -} diff --git a/modules/nixos/bluetooth.nix b/modules/nixos/bluetooth.nix deleted file mode 100644 index dbf51398..00000000 --- a/modules/nixos/bluetooth.nix +++ /dev/null @@ -1,16 +0,0 @@ -{ config, lib, ... }: - -with lib; - -let - cfg = config.features.core.bluetooth; -in -{ - options.features.core.bluetooth.enable = mkEnableOption "Enable bluetooth"; - - config = mkIf cfg.enable { - hardware.bluetooth.enable = true; - - services.blueman.enable = true; - }; -} diff --git a/modules/nixos/default.nix b/modules/nixos/default.nix index e44efd87..6e2bd4ff 100644 --- a/modules/nixos/default.nix +++ b/modules/nixos/default.nix @@ -1,7 +1,6 @@ { imports = [ ./avahi.nix - ./bluetooth.nix ./dconf.nix ./docker.nix ./dwm diff --git a/modules2/bluetooth.nix b/modules2/bluetooth.nix new file mode 100644 index 00000000..a2ebab1e --- /dev/null +++ b/modules2/bluetooth.nix @@ -0,0 +1,7 @@ +{ + flake.modules.nixos.pc = { + hardware.bluetooth.enable = true; + + services.blueman.enable = true; + }; +} diff --git a/modules2/flake-parts.nix b/modules2/flake-parts.nix new file mode 100644 index 00000000..1a92203d --- /dev/null +++ b/modules2/flake-parts.nix @@ -0,0 +1,7 @@ +{ inputs, ... }: + +{ + imports = [ + inputs.flake-parts.flakeModules.modules + ]; +} diff --git a/modules2/hosts/t480/imports.nix b/modules2/hosts/t480/imports.nix new file mode 100644 index 00000000..99e72a01 --- /dev/null +++ b/modules2/hosts/t480/imports.nix @@ -0,0 +1,7 @@ +{ config, ... }: + +{ + flake.modules.nixos."hosts/t480".imports = with config.flake.modules.nixos; [ + pc + ]; +} diff --git a/modules2/nixos-configurations.nix b/modules2/nixos-configurations.nix index 2d3c949b..b378e027 100644 --- a/modules2/nixos-configurations.nix +++ b/modules2/nixos-configurations.nix @@ -1,4 +1,4 @@ -{ inputs, self, ... }: +{ config, inputs, self, ... }: { flake = @@ -21,7 +21,11 @@ inputs.nixpkgs.lib.nixosSystem { inherit system; - modules = [ "${self}/hosts/${hostname}/configuration.nix" ]; + modules = [ + "${self}/hosts/${hostname}/configuration.nix" + + config.flake.modules.nixos."hosts/${hostname}" + ]; specialArgs = specialArgs // { inherit hostname stateVersion system;