Signed-off-by: Harald Hoyer <harald@hoyer.xyz>
This commit is contained in:
Harald Hoyer 2024-01-11 13:42:31 +01:00
parent 45d6f4b0f3
commit 1281c57892
191 changed files with 755 additions and 7893 deletions

View file

@ -32,9 +32,9 @@ with lib.plusultra; let
in
{
options.plusultra.user = with types; {
name = mkOpt str "short" "The name to use for the user account.";
fullName = mkOpt str "Jake Hamilton" "The full name of the user.";
email = mkOpt str "jake.hamilton@hey.com" "The email of the user.";
name = mkOpt str "harald" "The name to use for the user account.";
fullName = mkOpt str "Harald Hoyer" "The full name of the user.";
email = mkOpt str "harald@hoyer.xyz" "The email of the user.";
initialPassword =
mkOpt str "password"
"The initial password to use when the user is first created.";
@ -43,6 +43,12 @@ in
"The profile picture to use for the user.";
prompt-init = mkBoolOpt true "Whether or not to show an initial message when opening a new shell.";
extraGroups = mkOpt (listOf str) [ ] "Groups for the user to be assigned.";
sshKeys = mkOpt (listOf str) [
"sk-ssh-ed25519@openssh.com AAAAGnNrLXNzaC1lZDI1NTE5QG9wZW5zc2guY29tAAAAIDsb/Tr69YN5MQLweWPuJaRGm+h2kOyxfD6sqKEDTIwoAAAABHNzaDo= harald@fedora.fritz.box"
"sk-ecdsa-sha2-nistp256@openssh.com AAAAInNrLWVjZHNhLXNoYTItbmlzdHAyNTZAb3BlbnNzaC5jb20AAAAIbmlzdHAyNTYAAABBBACLgT81iB1iWWVuXq6PdQ5GAAGhaZhSKnveQCvcNnAOZ5WKH80bZShKHyAYzrzbp8IGwLWJcZQ7TqRK+qZdfagAAAAEc3NoOg== harald@hoyer.xyz"
"ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBAYbUTKpy4QR3s944/hjJ1UK05asFEs/SmWeUbtS0cdA660sT4xHnRfals73FicOoz+uIucJCwn/SCM804j+wtM="
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMNsmP15vH8BVKo7bdvIiiEjiQboPGcRPqJK0+bH4jKD harald@lenovo.fritz.box"
] "ssh keys";
extraOptions =
mkOpt attrs { }
(mdDoc "Extra options passed to `users.users.<name>`.");
@ -50,19 +56,8 @@ in
config = {
environment.systemPackages = with pkgs; [
cowsay
fortune
lolcat
plusultra.cowsay-plus
propagatedIcon
];
programs.zsh = {
enable = true;
autosuggestions.enable = true;
histFile = "$XDG_CACHE_HOME/zsh.history";
};
plusultra.home = {
file = {
"Desktop/.keep".text = "";
@ -78,81 +73,19 @@ in
}".source =
cfg.icon;
};
extraOptions = {
home.shellAliases = {
lc = "${pkgs.colorls}/bin/colorls --sd";
lcg = "lc --gs";
lcl = "lc -1";
lclg = "lc -1 --gs";
lcu = "${pkgs.colorls}/bin/colorls -U";
lclu = "${pkgs.colorls}/bin/colorls -U -1";
};
programs = {
starship = {
enable = true;
settings = {
character = {
success_symbol = "[](bold green)";
error_symbol = "[](bold red) ";
vicmd_symbol = "[](bold blue) ";
};
};
};
zsh = {
enable = true;
enableCompletion = true;
enableAutosuggestions = true;
syntaxHighlighting.enable = true;
initExtra =
''
# Fix an issue with tmux.
export KEYTIMEOUT=1
# Use vim bindings.
set -o vi
# Improved vim bindings.
source ${pkgs.zsh-vi-mode}/share/zsh-vi-mode/zsh-vi-mode.plugin.zsh
''
+ optionalString cfg.prompt-init ''
${pkgs.toilet}/bin/toilet -f future "Plus Ultra" --gay
'';
shellAliases = {
say = "${pkgs.toilet}/bin/toilet -f pagga";
};
plugins = [
{
name = "zsh-nix-shell";
file = "nix-shell.plugin.zsh";
src = pkgs.fetchFromGitHub {
owner = "chisui";
repo = "zsh-nix-shell";
rev = "v0.4.0";
sha256 = "037wz9fqmx0ngcwl9az55fgkipb745rymznxnssr3rx9irb6apzg";
};
}
];
};
};
};
};
users.users.${cfg.name} =
{
isNormalUser = true;
inherit (cfg) name initialPassword;
# inherit (cfg) name initialPassword;
openssh.authorizedKeys.keys = cfg.sshKeys;
home = "/home/${cfg.name}";
group = "users";
shell = pkgs.zsh;
shell = pkgs.fish;
# Arbitrary user ID to use for the user. Since I only
# have a single user on my machines this won't ever collide.