2023-07-20 15:02:38 +03:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
lib,
|
|
|
|
myData,
|
|
|
|
...
|
2023-10-01 23:14:05 +03:00
|
|
|
}: let
|
|
|
|
cfg = config.mj.base.users;
|
|
|
|
in {
|
2023-07-20 15:02:38 +03:00
|
|
|
options.mj.base.users = with lib.types; {
|
2023-08-18 18:50:39 +03:00
|
|
|
devEnvironment = lib.mkOption {
|
2023-08-18 16:39:03 +03:00
|
|
|
type = bool;
|
|
|
|
default = false;
|
|
|
|
};
|
|
|
|
|
2023-07-20 15:02:38 +03:00
|
|
|
passwd = lib.mkOption {
|
2023-10-01 23:14:05 +03:00
|
|
|
type = attrsOf (submodule {
|
|
|
|
options = {
|
|
|
|
passwordFile = lib.mkOption {
|
|
|
|
type = nullOr path;
|
|
|
|
default = null;
|
|
|
|
};
|
|
|
|
initialPassword = lib.mkOption {
|
|
|
|
type = nullOr str;
|
|
|
|
default = null;
|
|
|
|
};
|
2023-09-13 12:17:43 +03:00
|
|
|
|
2023-10-01 23:14:05 +03:00
|
|
|
extraGroups = lib.mkOption {
|
|
|
|
type = listOf str;
|
|
|
|
default = [];
|
2023-07-20 15:02:38 +03:00
|
|
|
};
|
2023-10-01 23:14:05 +03:00
|
|
|
};
|
|
|
|
});
|
2023-07-20 15:02:38 +03:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config = {
|
|
|
|
users = {
|
|
|
|
mutableUsers = false;
|
|
|
|
|
2023-10-01 23:14:05 +03:00
|
|
|
users = {
|
2023-07-20 15:02:38 +03:00
|
|
|
motiejus =
|
|
|
|
{
|
|
|
|
isNormalUser = true;
|
2023-10-01 23:14:05 +03:00
|
|
|
extraGroups = ["wheel"] ++ cfg.passwd.motiejus.extraGroups;
|
2023-07-24 16:31:38 +03:00
|
|
|
uid = myData.uidgid.motiejus;
|
2023-07-23 15:23:09 +03:00
|
|
|
openssh.authorizedKeys.keys = [myData.people_pubkeys.motiejus];
|
2023-07-20 15:02:38 +03:00
|
|
|
}
|
2023-09-14 13:07:39 +03:00
|
|
|
// lib.filterAttrs (
|
|
|
|
n: v:
|
|
|
|
(n == "passwordFile" || n == "initialPassword") && v != null
|
|
|
|
)
|
2023-10-01 23:14:05 +03:00
|
|
|
cfg.passwd.motiejus or {};
|
2023-07-20 15:02:38 +03:00
|
|
|
|
2023-10-01 23:14:05 +03:00
|
|
|
root = assert lib.assertMsg (cfg.passwd ? root) "root password needs to be defined";
|
|
|
|
lib.filterAttrs (_: v: v != null) cfg.passwd.root;
|
2023-07-20 15:02:38 +03:00
|
|
|
};
|
|
|
|
};
|
2023-08-18 16:26:00 +03:00
|
|
|
|
2023-08-18 16:30:26 +03:00
|
|
|
home-manager.useGlobalPkgs = true;
|
2023-08-18 16:26:00 +03:00
|
|
|
home-manager.users.motiejus = {pkgs, ...}: {
|
2023-09-15 14:39:04 +03:00
|
|
|
home.stateVersion = config.mj.stateVersion;
|
2023-10-01 23:14:05 +03:00
|
|
|
home.packages = lib.mkIf cfg.devEnvironment [pkgs.go];
|
2023-08-18 19:07:52 +03:00
|
|
|
|
2023-08-18 16:26:00 +03:00
|
|
|
programs.direnv.enable = true;
|
2023-08-18 19:07:52 +03:00
|
|
|
|
2023-08-18 21:45:38 +03:00
|
|
|
programs.neovim = {
|
2023-08-25 11:01:46 +03:00
|
|
|
enable = true;
|
|
|
|
vimAlias = true;
|
2023-08-18 21:45:38 +03:00
|
|
|
vimdiffAlias = true;
|
2023-08-25 11:01:46 +03:00
|
|
|
defaultEditor = true;
|
2023-10-01 23:14:05 +03:00
|
|
|
plugins = lib.mkIf cfg.devEnvironment [
|
2023-08-18 16:39:03 +03:00
|
|
|
pkgs.vimPlugins.fugitive
|
|
|
|
pkgs.vimPlugins.vim-go
|
|
|
|
pkgs.vimPlugins.zig-vim
|
|
|
|
];
|
|
|
|
extraConfig = builtins.readFile ./vimrc;
|
|
|
|
};
|
2023-08-18 19:07:52 +03:00
|
|
|
|
2023-08-18 16:26:00 +03:00
|
|
|
programs.git = {
|
|
|
|
enable = true;
|
|
|
|
userEmail = "motiejus@jakstys.lt";
|
2023-09-07 19:46:46 +03:00
|
|
|
userName = "Motiejus Jakštys";
|
2023-08-18 16:26:00 +03:00
|
|
|
aliases.yolo = "commit --amend --no-edit -a";
|
|
|
|
extraConfig = {
|
|
|
|
rerere.enabled = true;
|
|
|
|
pull.ff = "only";
|
|
|
|
merge.conflictstyle = "diff3";
|
|
|
|
};
|
|
|
|
};
|
2023-08-18 19:07:52 +03:00
|
|
|
|
2023-08-18 16:26:00 +03:00
|
|
|
programs.bash = {
|
|
|
|
enable = true;
|
|
|
|
shellAliases = {
|
|
|
|
"l" = "echo -n ł | xclip -selection clipboard";
|
2023-09-15 12:48:14 +03:00
|
|
|
"gp" = "${pkgs.git}/bin/git remote | ${pkgs.parallel}/bin/parallel --verbose git push";
|
2023-08-18 16:26:00 +03:00
|
|
|
};
|
|
|
|
};
|
2023-09-15 12:35:59 +03:00
|
|
|
|
2023-09-15 12:41:37 +03:00
|
|
|
programs.gpg = {
|
|
|
|
enable = true;
|
|
|
|
mutableKeys = false;
|
|
|
|
mutableTrust = false;
|
2023-09-15 14:39:04 +03:00
|
|
|
publicKeys = [
|
|
|
|
{
|
|
|
|
source = ./motiejus-gpg.txt;
|
|
|
|
trust = "ultimate";
|
|
|
|
}
|
|
|
|
];
|
2023-09-15 12:41:37 +03:00
|
|
|
};
|
2023-08-18 16:26:00 +03:00
|
|
|
};
|
2023-07-20 15:02:38 +03:00
|
|
|
};
|
|
|
|
}
|