Initial commit
This commit is contained in:
commit
cfcc57a8bd
353 changed files with 18756 additions and 0 deletions
37
flake/den/modules/aspects/provides/primary-user.nix
Normal file
37
flake/den/modules/aspects/provides/primary-user.nix
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
{ lib, ... }:
|
||||
let
|
||||
description = ''
|
||||
Sets user as *primary*.
|
||||
|
||||
On NixOS adds wheel and networkmanager groups.
|
||||
On Darwin sets user as system.primaryUser
|
||||
On WSL sets wsl.defaultUser if host has an `wsl` attribute.
|
||||
|
||||
## Usage
|
||||
|
||||
den.aspects.my-user.includes = [ den._.primary-user ];
|
||||
|
||||
'';
|
||||
|
||||
userToHostContext =
|
||||
{ user, host, ... }:
|
||||
let
|
||||
on-wsl.nixos.wsl.defaultUser = user.userName;
|
||||
in
|
||||
{
|
||||
inherit description;
|
||||
includes = lib.optionals (host ? wsl) [ on-wsl ];
|
||||
darwin.system.primaryUser = user.userName;
|
||||
nixos.users.users.${user.userName} = {
|
||||
isNormalUser = true;
|
||||
extraGroups = [
|
||||
"wheel"
|
||||
"networkmanager"
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
in
|
||||
{
|
||||
den.provides.primary-user = userToHostContext;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue