Modular, context-aware and aspect-oriented dendritic Nix configurations. Discussions: https://oeiuwq.zulipchat.com/join/nqp26cd4kngon6mo3ncgnuap/ den.oeiuwq.com
configurations den dendritic nix aspect oriented
at cross 37 lines 791 B view raw
1{ lib, ... }: 2let 3 description = '' 4 Sets user as *primary*. 5 6 On NixOS adds wheel and networkmanager groups. 7 On Darwin sets user as system.primaryUser 8 On WSL sets wsl.defaultUser if host has an `wsl` attribute. 9 10 ## Usage 11 12 den.aspects.my-user.includes = [ den._.primary-user ]; 13 14 ''; 15 16 userToHostContext = 17 { user, host, ... }: 18 let 19 on-wsl.nixos.wsl.defaultUser = user.userName; 20 in 21 { 22 inherit description; 23 includes = lib.optionals (host ? wsl) [ on-wsl ]; 24 darwin.system.primaryUser = user.userName; 25 nixos.users.users.${user.userName} = { 26 isNormalUser = true; 27 extraGroups = [ 28 "wheel" 29 "networkmanager" 30 ]; 31 }; 32 }; 33 34in 35{ 36 den.provides.primary-user = userToHostContext; 37}