From f69995591374e9569c0b074ee964e41de8735bd5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Max=20K=C3=A4nner?= Date: Sat, 28 Dec 2024 23:04:14 +0100 Subject: [PATCH] make user option --- modules/nixos/default.nix | 7 +++++++ modules/nixos/music.nix | 2 +- modules/nixos/sway.nix | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/modules/nixos/default.nix b/modules/nixos/default.nix index b0d0400..1a25226 100644 --- a/modules/nixos/default.nix +++ b/modules/nixos/default.nix @@ -11,6 +11,13 @@ in { enable = lib.mkEnableOption "my custom config"; desktop = lib.mkEnableOption "custom config with desktop support"; laptop = lib.mkEnableOption "extra stuff for laptops like wifi"; + user = lib.mkOption { + default = "max"; + example = "foo"; + description = "The main user working on this machine"; + type = lib.types.nonEmptyStr; + readOnly = true; + }; }; config.myConfig = lib.mkIf cfg.enable { diff --git a/modules/nixos/music.nix b/modules/nixos/music.nix index 372218a..95599cc 100644 --- a/modules/nixos/music.nix +++ b/modules/nixos/music.nix @@ -14,7 +14,7 @@ in { enable = true; rtcqs.enable = true; }; - users.users.max.extraGroups = ["audio"]; + users.users.${config.myConfig.user}.extraGroups = ["audio"]; services.pipewire = { enable = true; diff --git a/modules/nixos/sway.nix b/modules/nixos/sway.nix index 9f0048b..6d60448 100644 --- a/modules/nixos/sway.nix +++ b/modules/nixos/sway.nix @@ -38,7 +38,7 @@ in { }; # make brightness keys work - users.users.max.extraGroups = ["video" "input"]; + users.users.${config.myConfig.user}.extraGroups = ["video" "input"]; programs.light.enable = lib.mkIf cfg.laptop true; # make swaylock work