From e441dc43cf5c9707cf580c36805a5aaa66f33b3c Mon Sep 17 00:00:00 2001 From: sinanmohd Date: Sat, 2 Sep 2023 11:45:57 +0530 Subject: module/userdata: init --- configuration.nix | 9 ++++----- modules/userdata.nix | 18 ++++++++++++++++++ modules/wayland.nix | 6 +++++- 3 files changed, 27 insertions(+), 6 deletions(-) create mode 100644 modules/userdata.nix diff --git a/configuration.nix b/configuration.nix index f128856..27b351e 100644 --- a/configuration.nix +++ b/configuration.nix @@ -1,16 +1,16 @@ { config, pkgs, lib, ... }: let - user = config.passthru.user; + user = config.userdata.user; + groups = config.userdata.groups; in { imports = [ ./hardware-configuration.nix # hw scan + ./modules/userdata.nix ./hosts/cez.nix ]; - passthru.user = "sinan"; - # boot boot = { tmp.useTmpfs = true; @@ -29,9 +29,8 @@ in isNormalUser = true; extraGroups = [ "wheel" - "seat" "adbusers" - ]; + ] ++ groups; packages = with pkgs; [ yt-dlp geoipWithDatabase diff --git a/modules/userdata.nix b/modules/userdata.nix new file mode 100644 index 0000000..71a5a96 --- /dev/null +++ b/modules/userdata.nix @@ -0,0 +1,18 @@ +{ lib, ... }: + +let + inherit (lib) mkOption types mdDoc; +in +{ + options.userdata = { + user = mkOption { + type = types.str; + default = "sinan"; + description = mdDoc "owner's username"; + }; + groups = mkOption { + type = types.listOf types.str; + description = mdDoc "Groups the owner should be in"; + }; + }; +} diff --git a/modules/wayland.nix b/modules/wayland.nix index 17b9279..7af2f51 100644 --- a/modules/wayland.nix +++ b/modules/wayland.nix @@ -1,5 +1,8 @@ { config, pkgs, ... }: +let + user = config.userdata.user; +in { imports = [ ./seatd.nix ]; @@ -20,7 +23,7 @@ wob wlr-randr ]; - users.users.${config.passthru.user}.packages = with pkgs; [ + users.users.${user}.packages = with pkgs; [ zathura mpv imv @@ -75,6 +78,7 @@ }; }; + userdata.groups = [ "seat" ]; security.pam.services.swaylock.text = "auth include login"; hardware.opengl.enable = true; } -- cgit v1.2.3