nixos-config/common/users.nix
2024-06-16 17:05:31 -07:00

178 lines
4.7 KiB
Nix

{ config, pkgs, ... }:
let
home = config.constants.homeDir;
usr = config.constants.userName;
usrPwdFile = "users/${usr}/password";
in
{
fonts = {
fontDir.enable = true;
fontconfig.defaultFonts = {
sansSerif = [ "Inter" "Noto Sans CJK SC" ];
monospace = [ "Iosevka" "Noto Sans Mono CJK SC" ];
};
packages = with pkgs; [
inter
iosevka
noto-fonts-cjk
];
};
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
users.${usr} = { config, osConfig, pkgs, ... }:
{
home = {
file = {
fonts = {
enable = osConfig.programs.steam.enable;
source = config.lib.file.mkOutOfStoreSymlink "/run/current-system/sw/share/X11/fonts";
target = ".local/share/fonts";
};
kvantum = {
enable = config.programs.plasma.enable;
target = ".config/Kvantum/kvantum.kvconfig";
text = ''
[General]
theme=Sweet-Ambar-Blue
'';
};
};
packages = with pkgs; [
dua
fd
nil
nixpkgs-fmt
rclone
sops
] ++ (if config.programs.plasma.enable then [
sweet-ambar-blue
wallpaper-engine-plasma6-plugin
yorha-sound-theme
] ++ (with kdePackages; [
qtmultimedia
qtstyleplugin-kvantum
qtwebchannel
qtwebengine
qtwebsockets
]) else [ ]);
stateVersion = osConfig.system.stateVersion;
};
programs = {
bat.enable = true;
bottom.enable = true;
direnv = {
enable = true;
nix-direnv.enable = true;
};
eza.enable = true;
fish.enable = true;
fzf.enable = true;
git = {
enable = true;
extraConfig = {
core.autocrlf = "input";
init.defaultBranch = "development";
pull.rebase = false;
push.autoSetupRemote = true;
};
ignores = [
".direnv"
".envrc"
];
userEmail = osConfig.constants.postMaster;
userName = osConfig.constants.userName;
};
helix = {
enable = true;
defaultEditor = true;
settings = {
editor = {
lsp.display-inlay-hints = true;
soft-wrap.enable = true;
};
theme = "base16_transparent";
};
};
plasma = {
configFile = {
kscreenlockerrc.Daemon.Autolock = false;
kscreenlockerrc.Greeter.WallpaperPlugin = "org.kde.potd";
};
spectacle.shortcuts.captureRectangularRegion = "Meta+Shift+S";
workspace = {
colorScheme = "SweetAmbarBlue";
cursor.theme = "Sweet-cursors";
iconTheme = "Sweet-Rainbow";
lookAndFeel = "Sweet-Ambar-Blue";
theme = "Sweet-Ambar-Blue";
};
};
ripgrep.enable = true;
starship = {
enable = true;
enableTransience = true;
};
tealdeer.enable = true;
zoxide = {
enable = true;
options = [ "--cmd cd" ];
};
};
xdg.enable = true;
};
};
programs = {
fish.enable = true;
nh.enable = true;
};
services = {
openssh = {
hostKeys = [{
comment = "host@${config.networking.hostName}";
path = "/etc/ssh/host";
rounds = 100;
type = "ed25519";
}];
settings = {
PasswordAuthentication = false;
KbdInteractiveAuthentication = false;
};
};
resolved.enable = true;
syncthing = {
configDir = "${home}/.config/syncthing";
dataDir = "${home}/.local/share/syncthing";
openDefaultPorts = true;
overrideDevices = true;
overrideFolders = true;
settings.devices = config.constants.syncthingDevices;
user = usr;
};
};
sops.secrets.${usrPwdFile}.neededForUsers = true;
users = {
mutableUsers = false;
users.${usr} = {
description = "Sicheng Pan";
extraGroups = [
"audio"
"input"
"networkmanager"
"uinput"
"wheel"
];
hashedPasswordFile = config.sops.secrets.${usrPwdFile}.path;
home = config.constants.homeDir;
isNormalUser = true;
openssh.authorizedKeys.keys = config.constants.publicKeys;
shell = pkgs.fish;
};
};
}