nix/home.nix

172 lines
4.8 KiB
Nix

args @ { inputs, lib, config, pkgs, ... }:
let
importCfg = ({prefix, name}:
let
cfg_path = ./${prefix}/${name}.nix;
in (
if builtins.pathExists cfg_path then (
((import cfg_path) args)
) else (
{ enable = true; }
)
)
);
in rec {
home.stateVersion = "23.11";
home.username = "krizej";
home.homeDirectory = "/home/krizej";
services = lib.genAttrs (import ./services)
(cfg_name: importCfg { prefix = "services"; name = cfg_name; });
programs = lib.genAttrs (import ./programs)
(cfg_name: importCfg { prefix = "programs"; name = cfg_name; });
home.packages = with pkgs; [
xarchiver
fortune
jetbrains.pycharm-community
jetbrains.clion
# android-studio
# android-tools
feh
element-desktop
lxappearance
pavucontrol
ezquake
discord
libreoffice-qt
wineWowPackages.stable
winetricks
pamixer
gimp
xorg.xkill
gamemode
gdb
trenchbroom
vkquake
ericw-tools
xdotool
yad
pcmanfm
gvfs
# # It is sometimes useful to fine-tune packages, for example, by applying
# # overrides. You can do that directly here, just don't forget the
# # parentheses. Maybe you want to install Nerd Fonts with a limited number of
# # fonts?
# (pkgs.nerdfonts.override { fonts = [ "FantasqueSansMono" ]; })
# # You can also create simple shell scripts directly inside your
# # configuration. For example, this adds a command 'my-hello' to your
# # environment:
# (pkgs.writeShellScriptBin "my-hello" ''
# echo "Hello, ${config.home.username}!"
# '')
(pkgs.writeShellScriptBin "i3custom-center-mouse-on-focus" ''
eval $(xdotool getwindowfocus getwindowgeometry --shell)
MX=$(($X + $WIDTH / 2))
MY=$(($Y + $HEIGHT / 2))
xdotool mousemove $MX $MY
'')
(pkgs.writeShellScriptBin "i3custom-window-actions" ''
yad --splash --mouse --close-on-unfocus --undecorated \
--gtkrc="${home.homeDirectory}/.config/i3/i3gtk.css" \
--text="i3 window actions" \
--button float:0 --button kill:1
case $? in
0) i3custom-floating-toggle;;
1) i3-msg "kill";;
-1) ;;
esac
'')
(pkgs.writeShellScriptBin "i3custom-floating-toggle" ''
i3-msg "mark --add _; [con_mark=f] floating disable, border pixel 1, mark --add --toggle _; [con_mark=_] floating enable, border normal; mark --add --toggle f;"
'')
];
home.file = {
".config/i3/workspace2.json".source = files/workspace2.json;
".config/i3/i3gtk.css".source = files/i3gtk.css;
# FIXME not .vim bro!!!!!!!!!
".vim/colors/darcula.vim".source = files/darcula.vim;
# # You can also set the file content immediately.
# ".gradle/gradle.properties".text = ''
# org.gradle.console=verbose
# org.gradle.daemon.idletimeout=3600000
# '';
};
home.sessionVariables = let
HOME = home.homeDirectory;
in rec {
EDITOR = "vim";
MANSECT = "2:3:3p:3type:1:1p:n:l:8:0:0p:5:4:9:6:7";
# xdg crap thx poz
XDG_DATA_HOME = "${HOME}/.local/share";
XDG_CONFIG_HOME = "${HOME}/.config";
XDG_STATE_HOME = "${HOME}/.local/state";
XDG_CACHE_HOME = "${HOME}/.cache";
ANDROID_USER_HOME = "${XDG_DATA_HOME}/android";
ANDROID_HOME = "${XDG_DATA_HOME}/android/sdk";
GRADLE_USER_HOME = "${XDG_DATA_HOME}/gradle";
PYTHONSTARTUP = "${XDG_CONFIG_HOME}/python/pythonrc";
HISTFILE = "${XDG_CACHE_HOME}/bash/history";
CARGO_HOME = "${XDG_DATA_HOME}/cargo";
_JAVA_OPTIONS = "-Djava.utils.prefs.userRoot=${XDG_CONFIG_HOME}/java";
GNUPGHOME = "${XDG_DATA_HOME}/gnupg";
WINEPREFIX = "${XDG_DATA_HOME}/wine";
RUSTUP_HOME = "${XDG_DATA_HOME}/rustup";
NUGET_PACKAGES = "${XDG_CACHE_HOME}/NuGetPackages";
FCEUX_HOME = "${XDG_CONFIG_HOME}/fceux";
DOTNET_CLI_HOME = "${XDG_CONFIG_HOME}/dotnet";
GTK2_RC_FILES = lib.mkForce "${XDG_CONFIG_HOME}/gtk-2.0/gtkrc";
};
xdg.userDirs = let
home = config.home.homeDirectory;
in {
enable = true;
desktop = "${home}/desktop";
documents = "${home}/documents";
download = "${home}/downloads";
music = "${home}/music";
pictures = "${home}/pictures";
publicShare = "${home}/public";
templates = "${home}/templates";
videos = "${home}/videos";
};
# xorg crap (incl. themes etc)
xsession = {
enable = true;
# special case - i3 is not listed in ./programs/default.nix
windowManager.i3 = (import ./programs/i3.nix args);
};
home.pointerCursor = {
gtk.enable = true;
x11.enable = true;
name = "aero-drop";
package = pkgs.win7-cursors;
};
gtk = {
enable = true;
iconTheme = {
name = "Arc";
package = pkgs.arc-icon-theme;
};
theme = {
name = "Arc-Mono";
package = pkgs.arc-mono-gtk-theme;
};
};
}