mirror of
https://github.com/hyprwm/hyprland-infra.git
synced 2025-05-12 21:30:36 +01:00
users: add mihai
This commit is contained in:
parent
aa43aee7d9
commit
7a02d87ca2
3 changed files with 32 additions and 0 deletions
1
users/keys/mihai
Normal file
1
users/keys/mihai
Normal file
|
@ -0,0 +1 @@
|
|||
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOq9Gew1rgfdIyuriJ/Ne0B8FE1s8O/U2ajErVQLUDu9 mihai@io
|
18
users/lib.nix
Normal file
18
users/lib.nix
Normal file
|
@ -0,0 +1,18 @@
|
|||
{lib}: let
|
||||
chrs = lib.listToAttrs (lib.imap (i: v: {
|
||||
name = v;
|
||||
value = i + 96;
|
||||
})
|
||||
lib.lowerChars);
|
||||
ord = c: builtins.getAttr c chrs;
|
||||
in {
|
||||
# Make a unique UID from a 4-char identifier
|
||||
mkUid = id: let
|
||||
chars = lib.stringToCharacters (builtins.substring 0 4 id);
|
||||
n = builtins.map (c: lib.mod (ord c) 10) chars;
|
||||
s = builtins.concatStringsSep "" (builtins.map builtins.toString n);
|
||||
in
|
||||
assert builtins.stringLength id >= 4;
|
||||
assert builtins.length chars == 4;
|
||||
1000 + lib.toInt s;
|
||||
}
|
13
users/mihai.nix
Normal file
13
users/mihai.nix
Normal file
|
@ -0,0 +1,13 @@
|
|||
{lib, ...}: let
|
||||
userLib = import ./lib.nix {inherit lib;};
|
||||
in {
|
||||
users.users.mihai = {
|
||||
openssh.authorizedKeys.keyFiles = [./keys/mihai];
|
||||
isNormalUser = true;
|
||||
extraGroups = [
|
||||
"wheel"
|
||||
"trusted"
|
||||
];
|
||||
uid = userLib.mkUid "mihi";
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue