calliope/user.nix
2025-05-23 01:35:12 -04:00

62 lines
1.4 KiB
Nix
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# User config definitions
{
config,
pkgs,
lib,
...
}:
with lib; let
cfg = config.calliope;
in {
options.calliope = {
hostname = mkOption {
type = types.str;
default = "calliope";
};
ipv4Address = mkOption {
type = types.str;
};
name = mkOption {
type = types.str;
};
cec = mkOption {
type = types.str;
};
username = mkOption {
type = types.str;
};
shell = mkOption {
default = pkgs.zsh;
type = types.package;
};
authorizedKeys = mkOption {
type = types.listOf types.singleLineStr;
default = [];
};
# TODO:
sshIdentities = mkOption {};
};
config = {
calliope.username = lib.mkDefault cfg.cec;
networking.hostName = cfg.hostname;
# Enable automatic login for the user.
services.getty.autologinUser = lib.mkDefault cfg.username;
# Define a user account. Don't forget to set a password with passwd.
users.users."${cfg.username}" = {
isNormalUser = true;
description = cfg.name;
initialPassword = "C!sc0!@#";
shell = cfg.shell;
extraGroups = ["networkmanager" "wheel"];
openssh.authorizedKeys.keys = cfg.authorizedKeys;
};
# TODO: set the ipv4 address, and figure out how to set this without knowing interface name
# TODO: set default gateway
# TODO: use CEC to set up git identity
# TODO: set SSH Private keys
};
}