nix/user/common/default.nix

94 lines
2.5 KiB
Nix
Raw Normal View History

# This is a common user configuration.
2024-04-24 04:58:58 +03:00
{ const
, homeDir
, key
, pkgs
, secret
, config
2024-04-24 04:58:58 +03:00
, style
, username
, util
2024-06-25 04:04:39 +03:00
, lib
, ... } @args: with lib; let
cfg = config.user.common;
# Configuration modules.
2024-06-22 23:34:03 +03:00
btop = import ./top/btop args;
editor = import ./editorconfig args;
foot = import ./foot args;
2024-06-23 00:40:52 +03:00
fuzzel = import ./fuzzel args;
2024-06-22 23:34:03 +03:00
gtk3 = import ./gtk/3 args;
htop = import ./top/htop args;
keyd = import ./keyd args;
mako = import ./mako args;
yazi = import ./yazi args;
2024-04-03 02:05:36 +03:00
in {
2024-06-25 04:04:39 +03:00
options = {
user.common.users = mkOption {
default = [{
name = "root";
homeDir = "/root";
}];
type = types.listOf types.attrs;
};
};
2024-06-25 04:04:39 +03:00
config = {
home-manager = {
users = builtins.foldl' (acc: user: acc // {
${user.name} = {
home = {
username = user.name;
homeDirectory = user.homeDir;
stateVersion = const.stateVersion;
file = {
".config/btop/btop.conf".text = btop.text;
".config/foot/foot.ini".source = foot.file;
".config/fuzzel/fuzzel.ini".source = fuzzel.file;
".config/gtk-3.0/bookmarks".text = gtk3.bookmarks;
".config/htop/htoprc".text = htop.text;
".config/keyd/app.conf".text = keyd.text;
".config/mako/config".source = mako.file;
".config/yazi/init.lua".source = yazi.init;
".config/yazi/keymap.toml".source = yazi.keymap;
".config/yazi/theme.toml".source = yazi.theme;
".config/yazi/yazi.toml".source = yazi.yazi;
".editorconfig".source = editor.file;
".parallel/will-cite".text = "";
"media/template".source = ./template;
};
};
2024-06-25 04:04:39 +03:00
xdg.userDirs = {
enable = true;
createDirectories = true;
desktop = "${user.homeDir}/";
documents = "${user.homeDir}/document/";
download = "${user.homeDir}/download/";
music = "${user.homeDir}/media/music/";
pictures = "${user.homeDir}/media/picture/";
publicShare = "${user.homeDir}/media/share/";
templates = "${user.homeDir}/media/template/";
videos = "${user.homeDir}/media/video/";
extraConfig = {
XDG_TMP_DIR = "${user.homeDir}/tmp/";
};
};
2024-04-14 08:32:29 +03:00
2024-06-25 04:04:39 +03:00
programs = {
home-manager.enable = true;
gpg = {
enable = true;
inherit (secret.crypto) publicKeys;
};
};
2024-04-14 23:48:14 +03:00
};
2024-06-25 04:04:39 +03:00
}) {} cfg.users;
# If file exists, rename it with a new extension.
backupFileExtension = "old";
2024-04-14 08:32:29 +03:00
};
};
}