nix-system/home/home.nix
Antoine Vaure 59a18017f6
Some checks failed
/ build-all (push) Has been cancelled
increase ccache maxsize to 100Gi
2025-07-28 10:53:45 +02:00

219 lines
6.4 KiB
Nix

{ inputs, config, lib, pkgs, variant, ... }:
{
imports = [
./lf.nix
./fish.nix
./terminal-software.nix
] ++ (if variant != "hs" then
[
./ui.nix
./gui-software.nix
./gaming.nix
./additional-software.nix
]
else []);
# Home Manager needs a bit of information about you and the paths it should
# manage.
home.homeDirectory = "/home/${config.home.username}";
home.stateVersion = "23.05"; # Please read the comment before changing.
home.packages = with pkgs; [
(python313.withPackages (pp: with pp; [
numpy
matplotlib
]))
# bluez
go-mtpfs
xdg-utils
davfs2
sshfs
ghc
yt-dlp
aria2
yazi
ncdu
ripgrep
android-tools
scrcpy
];
home.file = {
".config/kitty/light.conf".source = dotfiles/kitty/light.conf;
".config/kitty/dark.conf".source = dotfiles/kitty/dark.conf;
".config/rofi/colors-dark.rasi".source = dotfiles/rofi/colors-dark.rasi;
".config/rofi/colors-light.rasi".source = dotfiles/rofi/colors-light.rasi;
".config/rofi/theme.rasi".source = dotfiles/rofi/theme.rasi;
".config/keepmenu/config.ini".source = dotfiles/keepmenu.ini;
".bin/runmenu".source = pkgs.writers.writeBash "runmenu" ''
${config.programs.rofi.package}/bin/rofi -matching normal -sort -show run
'';
".bin/notifications".source = bin/notifications;
".bin/window_dir".source = pkgs.writers.writeBash "window_dir" ''
PID=$(${pkgs.hyprland}/bin/hyprctl activewindow | grep pid | cut -d' ' -f 2)
PID=$(echo $(ps --ppid $PID -o pid | tail -n1))
cwd=$(readlink /proc/"$PID"/cwd)
echo "$cwd"
'';
".bin/exec_on_stdin_newline".source = pkgs.writers.writePython3 "exec_on_stdin_newline" {} ''
# run command whjen a newline is added to stdin
import subprocess
from sys import stdin, argv
cmd = argv[1:]
subprocess.call(cmd, shell=True)
while stdin.readline():
subprocess.call(cmd, shell=True)
'';
".bin/screenshot".source = (import ./bin/screenshot.nix) pkgs;
".bin/ocrzone".source = pkgs.writers.writeBash "ocrzone" ''
${pkgs.pkgs.sway-contrib.grimshot}/bin/grimshot save area - | \
${pkgs.tesseract}/bin/tesseract -l fra - - | \
${pkgs.wl-clipboard}/bin/wl-copy
'';
".bin/wifi-toggle".source = pkgs.writers.writeBash "wifi-toggle" ''
if [[ $(nmcli radio wifi) == "enabled" ]]; then
nmcli radio wifi off
else
nmcli radio wifi on
fi
'';
".bin/rofi-udisk".source = pkgs.writers.writeBash "rofi-udisk" ''
device=$(${pkgs.udiskie}/bin/udiskie-info -a -o "{ui_label} {in_use}" -f is_filesystem | \
${pkgs.gnused}/bin/sed 's/True$/[Mounted]/' | \
${pkgs.gnused}/bin/sed 's/False$//' | \
${config.programs.rofi.package}/bin/rofi -dmenu | \
${pkgs.coreutils}/bin/cut -d':' -f1)
if [ -n "$device" ] ; then
if ${pkgs.mount}/bin/mount | ${pkgs.gnugrep}/bin/grep "$device" ; then
${pkgs.libnotify}/bin/notify-send "Unmounting $device..."
output=$(${pkgs.udisks}/bin/udisksctl unmount -b $device 2>&1)
if [ $? -eq 0 ] ; then
${pkgs.libnotify}/bin/notify-send "Device successfully unmounted."
else
${pkgs.libnotify}/bin/notify-send "Failed to unmount device" "$output"
fi
else
${pkgs.libnotify}/bin/notify-send "Mounting $device..."
output=$(${pkgs.udisks}/bin/udisksctl mount -b $device 2>&1)
if [ $? -eq 0 ] ; then
${pkgs.libnotify}/bin/notify-send "Device successfully mounted."
else
${pkgs.libnotify}/bin/notify-send "Failed to mount device" "$output"
fi
fi
fi
'';
".bin/mount-android".source = pkgs.writers.writeBash "mount-android" ''
if ${pkgs.mount}/bin/mount | ${pkgs.gnugrep}/bin/grep $(realpath ~/android); then
umount $(realpath ~/android)
${pkgs.libnotify}/bin/notify-send "Android unmounted"
elif ${pkgs.simple-mtpfs}/bin/simple-mtpfs $(realpath ~/android); then
${pkgs.libnotify}/bin/notify-send "Android mounted in ~/android"
else
${pkgs.libnotify}/bin/notify-send "Can't find Android device"
fi
'';
".bin/dark".source = (import ./bin/dark.nix) pkgs; # deprecated, prefer darkman
};
home.sessionPath = [
"$HOME/.local/bin"
"$HOME/.bin"
];
home.sessionVariables = {
GOPATH = "${config.home.homeDirectory}/.local/share/go";
GOMODCACHE = "${config.home.homeDirectory}/.cache/go/pkg/mod";
NIXOS_OZONE_WL = "1";
GDK_BACKEND = "wayland,x11";
QT_QPA_PLATFORM = "wayland;xcb";
CLUTTER_BACKEND = "wayland";
XDG_CURRENT_DESKTOP = "Hyprland";
XDG_SESSION_TYPE = "wayland";
XDG_SESSION_DESKTOP = "Hyprland";
QT_AUTO_SCREEN_SCALE_FACTOR = "1";
WLR_NO_HARDWARE_CURSORS = "0";
XCURSOR_SIZE = "24";
CCACHE_MAXSIZE = "100Gi";
} // (if variant == "allegro" then {
TMPDIR = "/home/${config.home.username}/tmp";
GSETTINGS_SCHEMA_DIR = "${pkgs.gsettings-desktop-schemas}/share/gsettings-schemas/gsettings-desktop-schemas-47.1/glib-2.0/schemas";
} else {});
home.keyboard.options = [
"caps:escape"
];
xdg = {
enable = true;
systemDirs.data = [ "${config.home.homeDirectory}/.local/share" ];
userDirs = {
enable = true;
createDirectories = false;
download = "${config.home.homeDirectory}/downloads";
templates = "${config.home.homeDirectory}/templates";
desktop = "${config.home.homeDirectory}";
documents = "${config.home.homeDirectory}";
music = "${config.home.homeDirectory}";
pictures = "${config.home.homeDirectory}";
publicShare = "${config.home.homeDirectory}";
videos = "${config.home.homeDirectory}";
};
mimeApps = {
enable = true;
};
};
services.darkman = {
enable = true;
lightModeScripts = {
rm-file-indicator = "rm $XDG_STATE_HOME/darkmode";
};
darkModeScripts = {
set-file-indicator = "touch $XDG_STATE_HOME/darkmode";
};
};
services.gnome-keyring.enable = true;
services.syncthing.enable = variant != "hs";
services.kdeconnect.enable = variant != "allegro";
programs.home-manager.enable = true;
programs.nh = {
enable = true;
flake = "${config.home.homeDirectory}/nix-system";
};
programs.git = {
enable = true;
aliases = {
co = "checkout";
};
extraConfig = {
pull.rebase = true;
};
};
}