AZ-NIX/home/logistik/home.nix

313 lines
9.0 KiB
Nix

# This is a default home.nix generated by the follwing hone-manager command
#
# home-manager init ./
{
config,
lib,
pkgs,
hostname ? "AZPILOGISTIK01",
...
}: {
# Home Manager needs a bit of information about you and the paths it should
# manage.
home.username = "pi";
home.homeDirectory = lib.mkDefault "/home/${config.home.username}";
# This value determines the Home Manager release that your configuration is
# compatible with. This helps avoid breakage when a new Home Manager release
# introduces backwards incompatible changes.
#
# You should not change this value, even if you update Home Manager. If you do
# want to update the value, then make sure to first check the Home Manager
# release notes.
home.stateVersion = "25.05"; # Please read the comment before changing.
# The home.packages option allows you to install Nix packages into your
# environment.
home.packages = with pkgs; [
rose-pine-hyprcursor
nitch
# # Adds the 'hello' command to your environment. It prints a friendly
# # "Hello, world!" when run.
# pkgs.hello
# # 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}!"
# '')
];
home.pointerCursor = {
gtk.enable = true;
package = pkgs.bibata-cursors;
name = "Bibata-Modern-Ice";
size = 32;
};
programs.git = {
enable = true;
aliases = {
st = "status";
logd = "log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit";
};
};
programs.kitty.enable = true;
programs.chromium = {
enable = true;
commandLineArgs = [
"--password-store=basic"
"--start-fullscreen"
"--ozone-platform=x11"
"--disable-restore-session-state"
"--disable-logging"
"--disable-session-storage"
];
};
wayland.windowManager.hyprland = {
enable = true;
settings = {
xwayland = {
force_zero_scaling = true;
};
exec-once = [
"chromium $WEBAPP_URL"
];
monitor = [
];
workspace = [
"1, monitor:eDP-1, default:true"
"2, monitor:eDP-1"
];
input = {
touchdevice = {
enabled = true;
};
kb_layout = "de,us";
kb_variant = "";
kb_model = "";
kb_rules = "";
kb_options = "ctrl:nocaps";
follow_mouse = 1;
};
general = {
gaps_in = 5;
gaps_out = 5;
border_size = 1;
"col.active_border" = "rgba(9742b5ee) rgba(9742b5ee) 45deg";
"col.inactive_border" = "rgba(44475aaa)";
"col.nogroup_border" = "rgba(282a36dd)";
"col.nogroup_border_active" = "rgb(bd93f9) rgb(44475a) 90deg";
no_border_on_floating = false;
layout = "dwindle";
};
decoration = {
shadow = {
enabled = false;
};
rounding = 8;
blur = {
enabled = false;
};
};
animations = {
enabled = false;
};
dwindle = {
pseudotile = true;
preserve_split = true;
};
master = {
new_status = "master";
};
device = [
{
name = "epic-mouse-v1";
sensitivity = -0.5;
}
];
windowrule = [
"float, class:file_progress"
"float, class:confirm"
"float, class:dialog"
"float, class:download"
"float, class:notification"
"float, class:error"
"float, class:splash"
"float, class:confirmreset"
"float, title:Open File"
"float, title:branchdialog"
"bordercolor rgb(ffffff),xwayland:1"
"workspace 1,class:(chromium-browser)"
"fullscreen,class:(chromium-browser)"
];
"$mainMod" = "SUPER";
"$terminal" = "kitty";
bind = [
"$mainMod, t, exec, $terminal -e bash -c 'nitch; exec bash'"
"$mainMod, B, exec, chromium"
"$mainMod, q, killactive"
"$mainMod, M, exec, $terminal -e btop"
"$mainMod, N, exec, $terminal -e nvim"
"$mainMod, F, fullscreen"
"$mainMod, 1, workspace, 1"
"$mainMod, 2, workspace, 2"
"$mainMod, 3, workspace, 3"
"$mainMod, 4, workspace, 4"
"$mainMod, 5, workspace, 50"
"$mainMod SHIFT, 1, movetoworkspace, 1"
"$mainMod SHIFT, 2, movetoworkspace, 2"
"$mainMod SHIFT, 3, movetoworkspace, 3"
"$mainMod SHIFT, 4, movetoworkspace, 4"
"$mainMod, mouse_down, workspace, e+1"
"$mainMod, mouse_up, workspace, e-1"
];
bindm = [
"$mainMod, mouse:272, movewindow"
"$mainMod, mouse:273, resizewindow"
];
};
};
coding.editors.neovim.enable = true;
# Home Manager is pretty good at managing dotfiles. The primary way to manage
# plain files is through 'home.file'.
home.file = {
".profile".text = ''
# ~/.profile: executed by the command interpreter for login shells.
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
# exists.
# see /usr/share/doc/bash/examples/startup-files for examples.
# the files are located in the bash-doc package.
# the default umask is set in /etc/profile; for setting the umask
# for ssh logins, install and configure the libpam-umask package.
#umask 022
# if running bash
if [ -n "$BASH_VERSION" ]; then
# include .bashrc if it exists
if [ -f "$HOME/.bashrc" ]; then
. "$HOME/.bashrc"
fi
fi
# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ]; then
PATH="$HOME/bin:$PATH"
fi
# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/.local/bin" ]; then
PATH="$HOME/.local/bin:$PATH"
fi
if [[ -z $DISPLAY ]] && [[ -z $WAYLAND_DISPLAY ]] && [[ $(tty) == /dev/tty1 ]]; then
exec nixGL Hyprland
fi
'';
# # Building this configuration will create a copy of 'dotfiles/screenrc' in
# # the Nix store. Activating the configuration will then make '~/.screenrc' a
# # symlink to the Nix store copy.
# ".screenrc".source = dotfiles/screenrc;
# # You can also set the file content immediately.
# ".gradle/gradle.properties".text = ''
# org.gradle.console=verbose
# org.gradle.daemon.idletimeout=3600000
# '';
};
# Home Manager can also manage your environment variables through
# 'home.sessionVariables'. If you don't want to manage your shell through Home
# Manager then you have to manually source 'hm-session-vars.sh' located at
# either
#
# ~/.nix-profile/etc/profile.d/hm-session-vars.sh
#
# or
#
# ~/.local/state/nix/profiles/profile/etc/profile.d/hm-session-vars.sh
#
# or
#
# /etc/profiles/per-user/m3tam3re/etc/profile.d/hm-session-vars.sh
#
home.sessionVariables = {
# EDITOR = "emacs";
};
# Let Home Manager install and manage itself.
programs.home-manager.enable = true;
# Systemd Timer für nächtliches home-manager update
# Der hostname wird zur Build-Zeit in das Script eingebettet
systemd.user.services.home-manager-update = let
flakeConfig = "logistik@${hostname}";
repoUrl = "git+https://git.az-gruppe.com/AZ-Intec-GmbH/AZ-NIX.git";
in {
Unit = {
Description = "Update home-manager configuration for ${hostname}";
After = "network-online.target";
};
Service = {
Type = "oneshot";
ExecStart = "${pkgs.writeShellScript "home-manager-update" ''
set -e
echo "[$(${pkgs.coreutils}/bin/date)] Starting home-manager update for ${flakeConfig}..."
# Prüfe ob lokales Repo existiert
if [ -d "/home/${config.home.username}/AZ-NIX" ]; then
echo "Using local repository..."
cd /home/${config.home.username}/AZ-NIX
${pkgs.git}/bin/git pull
${pkgs.nix}/bin/nix run home-manager/release-25.05 -- switch --flake .#${flakeConfig}
else
echo "Using remote repository..."
${pkgs.nix}/bin/nix run home-manager/release-25.05 -- switch \
--flake ${repoUrl}#${flakeConfig}
fi
echo "[$(${pkgs.coreutils}/bin/date)] Update completed successfully"
pkill -15 chromium
echo "Rebooting system..."
${pkgs.systemd}/bin/systemctl reboot
''}";
};
};
systemd.user.timers.home-manager-update = {
Unit = {
Description = "Timer for nightly home-manager update";
};
Timer = {
OnCalendar = "03:00:00";
Persistent = true;
};
Install = {
WantedBy = ["timers.target"];
};
};
}