nixos-config/common/users.nix
2025-04-19 09:50:10 +08:00

292 lines
7.5 KiB
Nix

{
config,
pkgs,
...
}:
with config.constants; let
usrPwdFile = "users/${userName}/password";
in {
console.enable = false;
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-sans
];
};
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
users.${userName} = {
config,
osConfig,
pkgs,
...
}: {
home = {
file.kvantum = {
enable = config.programs.plasma.enable;
target = ".config/Kvantum/kvantum.kvconfig";
text = ''
[General]
theme=Sweet-Ambar-Blue
'';
};
packages = with pkgs;
[
alejandra
dua
fd
nil
rclone
sops
]
++ (
if config.programs.plasma.enable
then [
kdePackages.qtstyleplugin-kvantum
sweet-ambar-blue
yorha-sound-theme
]
else []
);
stateVersion = osConfig.system.stateVersion;
};
programs = {
bat.enable = true;
bottom.enable = true;
direnv = {
enable = true;
nix-direnv.enable = true;
};
eza.enable = true;
firefox.enable = config.programs.plasma.enable;
fish.enable = true;
fzf.enable = true;
git = {
enable = true;
extraConfig = {
column.ui = "auto";
commit.verbose = true;
core.autocrlf = "input";
fetch = {
prune = true;
pruneTags = true;
all = true;
};
help.autocorrect = "prompt";
init.defaultBranch = "development";
pull.rebase = false;
push = {
autoSetupRemote = true;
default = "simple";
};
rebase = {
autoSquash = true;
autoStash = true;
};
};
ignores = [
".direnv"
".envrc"
];
userEmail = postMaster;
userName = userName;
};
helix = {
enable = true;
defaultEditor = true;
settings = {
editor = {
lsp.display-inlay-hints = true;
soft-wrap.enable = true;
};
theme = "base16_transparent";
};
};
kitty = {
enable = config.programs.plasma.enable;
settings = {
background_opacity = "0.96";
hide_window_decorations = "yes";
remember_window_size = "no";
};
themeFile = "tokyo_night_moon";
};
plasma = {
enable = osConfig.services.desktopManager.plasma6.enable;
configFile = {
baloofilerc = {
"Basic Settings".Indexing-Enabled = true;
General."only basic indexing" = true;
};
kded5rc.Module-browserintegrationreminder.autoload = false;
kdeglobals.General = {
TerminalApplication = "kitty";
TerminalService = "kitty.desktop";
};
};
desktop.icons = {
alignment = "left";
arrangement = "leftToRight";
lockInPlace = true;
sorting = {
foldersFirst = true;
mode = "type";
};
};
immutableByDefault = true;
kscreenlocker = {
appearance.wallpaperPictureOfTheDay.provider = "bing";
autoLock = true;
lockOnResume = true;
passwordRequired = true;
timeout = 30;
};
kwin = {
borderlessMaximizedWindows = true;
effects = {
blur.enable = true;
desktopSwitching.animation = "slide";
dimAdminMode.enable = true;
windowOpenClose.animation = "glide";
};
virtualDesktops = {
number = 4;
rows = 1;
};
};
overrideConfig = true;
panels = [
{
floating = false;
height = 36;
widgets = [
{
kickoff = {
icon = "nix-snowflake-white";
sortAlphabetically = true;
};
}
"org.kde.plasma.pager"
{
iconTasks.launchers = [];
}
"org.kde.plasma.marginsseparator"
{
systemTray.items = {
shown = [
"org.kde.kdeconnect"
];
hidden = [
"org.kde.plasma.battery"
"org.kde.plasma.bluetooth"
"org.kde.plasma.brightness"
"org.kde.plasma.devicenotifier"
"org.kde.plasma.manage-inputmethod"
"Fcitx"
];
};
}
"org.kde.plasma.digitalclock"
];
}
];
powerdevil.AC = {
autoSuspend.action = "nothing";
dimDisplay.enable = true;
powerButtonAction = "showLogoutScreen";
whenLaptopLidClosed = "turnOffScreen";
whenSleepingEnter = "standby";
};
spectacle.shortcuts.captureRectangularRegion = "Meta+Shift+S";
workspace = {
colorScheme = "SweetAmbarBlue";
iconTheme = "Sweet-Rainbow";
lookAndFeel = "Sweet-Ambar-Blue";
soundTheme = "yorha";
wallpaperPictureOfTheDay.provider = "bing";
};
};
ripgrep.enable = true;
starship = {
enable = true;
enableTransience = true;
};
tealdeer.enable = true;
zoxide = {
enable = true;
options = ["--cmd cd"];
};
};
};
};
i18n = {
defaultLocale = "zh_CN.UTF-8";
supportedLocales = ["all"];
};
programs = {
command-not-found.enable = false;
fish.enable = true;
nh.enable = true;
nix-index.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 = "${homeDir}/.config/syncthing";
dataDir = "${homeDir}/.local/share/syncthing";
openDefaultPorts = true;
overrideDevices = true;
overrideFolders = true;
settings.devices = syncthingDevices;
user = userName;
};
};
sops.secrets.${usrPwdFile}.neededForUsers = true;
users = {
mutableUsers = false;
users.${userName} = {
description = "Sicheng Pan";
extraGroups = [
"audio"
"dialout"
"input"
"networkmanager"
"uinput"
"wheel"
];
hashedPasswordFile = config.sops.secrets.${usrPwdFile}.path;
home = homeDir;
isNormalUser = true;
openssh.authorizedKeys.keys = publicKeys;
shell = pkgs.fish;
};
};
}