mirror of
https://github.com/SebastianStork/nixos-config.git
synced 2026-01-22 22:37:44 +01:00
modules: Move bluetooth, sound and wlan modules into the services namespace
This commit is contained in:
parent
e914990eaf
commit
b82eeb8595
5 changed files with 10 additions and 12 deletions
16
modules/system/services/bluetooth.nix
Normal file
16
modules/system/services/bluetooth.nix
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
{ config, lib, ... }:
|
||||
{
|
||||
options.custom.services.bluetooth.enable = lib.mkEnableOption "";
|
||||
|
||||
config = lib.mkIf config.custom.services.bluetooth.enable {
|
||||
hardware = {
|
||||
bluetooth = {
|
||||
enable = true;
|
||||
powerOnBoot = true;
|
||||
};
|
||||
logitech.wireless.enable = true;
|
||||
};
|
||||
|
||||
services.blueman.enable = true;
|
||||
};
|
||||
}
|
||||
16
modules/system/services/sound.nix
Normal file
16
modules/system/services/sound.nix
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
{ config, lib, ... }:
|
||||
{
|
||||
options.custom.services.sound.enable = lib.mkEnableOption "";
|
||||
|
||||
config = lib.mkIf config.custom.services.sound.enable {
|
||||
security.rtkit.enable = true;
|
||||
services.pipewire = {
|
||||
enable = true;
|
||||
pulse.enable = true;
|
||||
alsa = {
|
||||
enable = true;
|
||||
support32Bit = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
42
modules/system/services/wlan.nix
Normal file
42
modules/system/services/wlan.nix
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
let
|
||||
cfg = config.custom.services.wlan;
|
||||
in
|
||||
{
|
||||
options.custom.services.wlan = {
|
||||
enable = lib.mkEnableOption "";
|
||||
networks = lib.mkOption {
|
||||
type = lib.types.listOf lib.types.nonEmptyStr;
|
||||
default = config.custom.sops.secrets.iwd |> lib.attrNames;
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
networking.wireless.iwd = {
|
||||
enable = true;
|
||||
settings = {
|
||||
General.EnableNetworkConfiguration = true;
|
||||
Settings.AutoConnect = true;
|
||||
};
|
||||
};
|
||||
|
||||
environment.systemPackages = [ pkgs.iwgtk ];
|
||||
|
||||
sops.secrets =
|
||||
cfg.networks
|
||||
|> lib.map (name: {
|
||||
name = "iwd/${name}";
|
||||
value = { };
|
||||
})
|
||||
|> lib.listToAttrs;
|
||||
|
||||
systemd.tmpfiles.rules =
|
||||
cfg.networks
|
||||
|> lib.map (name: "C /var/lib/iwd/${name} - - - - ${config.sops.secrets."iwd/${name}".path}");
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue