nix fmt rfc

This commit is contained in:
Christoph Hollizeck 2024-04-04 19:31:55 +02:00
parent 3a8003e671
commit 56df50bdc1
Signed by: Daholli
GPG key ID: 249300664F2AF2C7
41 changed files with 430 additions and 351 deletions

View file

@ -6,7 +6,8 @@
...
}:
with lib;
with lib.wyrdgard; let
with lib.wyrdgard;
let
cfg = config.wyrdgard.user;
defaultIconFileName = "profile.png";
defaultIcon = pkgs.stdenvNoCC.mkDerivation {
@ -19,37 +20,37 @@ with lib.wyrdgard; let
cp $src $out
'';
passthru = {fileName = defaultIconFileName;};
passthru = {
fileName = defaultIconFileName;
};
};
propagatedIcon =
pkgs.runCommandNoCC "propagated-icon"
{passthru = {fileName = cfg.icon.fileName;};}
''
local target="$out/share/wyrdgard-icons/user/${cfg.name}"
mkdir -p "$target"
{
passthru = {
fileName = cfg.icon.fileName;
};
}
''
local target="$out/share/wyrdgard-icons/user/${cfg.name}"
mkdir -p "$target"
cp ${cfg.icon} "$target/${cfg.icon.fileName}"
'';
in {
cp ${cfg.icon} "$target/${cfg.icon.fileName}"
'';
in
{
options.wyrdgard.user = with types; {
name = mkOpt str "cholli" "The name to use for the user account.";
fullName = mkOpt str "Christoph Hollizeck" "The full name of the user.";
email = mkOpt str "christoph.hollizeck@hey.com" "The email of the user.";
initialPassword =
mkOpt str "asdf"
"The initial password to use when the user is first created.";
icon =
mkOpt (nullOr package) defaultIcon
"The profile picture to use for the user.";
extraGroups = mkOpt (listOf str) [] "Groups for the user to be assigned.";
extraOptions =
mkOpt attrs {}
(mdDoc "Extra options passed to `users.users.<name>`.");
initialPassword = mkOpt str "asdf" "The initial password to use when the user is first created.";
icon = mkOpt (nullOr package) defaultIcon "The profile picture to use for the user.";
extraGroups = mkOpt (listOf str) [ ] "Groups for the user to be assigned.";
extraOptions = mkOpt attrs { } (mdDoc "Extra options passed to `users.users.<name>`.");
};
config = {
environment.systemPackages = with pkgs; [
];
environment.systemPackages = with pkgs; [ ];
programs.zsh = {
enable = true;
@ -67,33 +68,28 @@ in {
"Videos/.keep".text = "";
"projects/.keep".text = "";
".face".source = cfg.icon;
"Pictures/${
cfg.icon.fileName or (builtins.baseNameOf cfg.icon)
}".source =
cfg.icon;
"Pictures/${cfg.icon.fileName or (builtins.baseNameOf cfg.icon)}".source = cfg.icon;
};
};
users.users.${cfg.name} =
{
isNormalUser = true;
users.users.${cfg.name} = {
isNormalUser = true;
inherit (cfg) name initialPassword;
inherit (cfg) name initialPassword;
home = "/home/${cfg.name}";
group = "users";
home = "/home/${cfg.name}";
group = "users";
shell = pkgs.zsh;
shell = pkgs.zsh;
# Arbitrary user ID to use for the user. Since I only
# have a single user on my machines this won't ever collide.
# However, if you add multiple users you'll need to change this
# so each user has their own unique uid (or leave it out for the
# system to select).
uid = 1000;
# Arbitrary user ID to use for the user. Since I only
# have a single user on my machines this won't ever collide.
# However, if you add multiple users you'll need to change this
# so each user has their own unique uid (or leave it out for the
# system to select).
uid = 1000;
extraGroups = ["steamcmd"] ++ cfg.extraGroups;
}
// cfg.extraOptions;
extraGroups = [ "steamcmd" ] ++ cfg.extraGroups;
} // cfg.extraOptions;
};
}