Compare commits

..

No commits in common. "f9fd542206d64ec7b2fdf67a7c89a973f7eefd69" and "c9e2642e961a7c01f2fc84f4bc8b406afdfa3987" have entirely different histories.

17 changed files with 110 additions and 174 deletions

View file

@ -45,6 +45,4 @@ lib.makeExtensible (_: rec {
lib.mapAttrs' mkModule modulesInDir; lib.mapAttrs' mkModule modulesInDir;
mapModules' = f: dir: lib.attrValues (mapModules f dir); mapModules' = f: dir: lib.attrValues (mapModules f dir);
listModules = mapModules' (path: path);
}) })

View file

@ -9,6 +9,7 @@ let
cfg = config.my.bin; cfg = config.my.bin;
cycleSinks = import ./cycleSinks.nix { inherit pkgs; }; cycleSinks = import ./cycleSinks.nix { inherit pkgs; };
protonge = import ./protonge.nix { inherit pkgs; }; protonge = import ./protonge.nix { inherit pkgs; };
randomWallpaper = import ./randomWallpaper.nix { inherit pkgs; };
share = import ./share.nix { inherit pkgs; }; share = import ./share.nix { inherit pkgs; };
sxhkdHelp = import ./sxhkdHelp.nix { inherit pkgs; }; sxhkdHelp = import ./sxhkdHelp.nix { inherit pkgs; };
in in
@ -16,9 +17,10 @@ in
options.my.bin.enable = mkEnableOption "bin"; options.my.bin.enable = mkEnableOption "bin";
config = mkIf cfg.enable { config = mkIf cfg.enable {
environment.systemPackages = [ environment.systemPackages = with pkgs; [
cycleSinks cycleSinks
protonge protonge
randomWallpaper
share share
sxhkdHelp sxhkdHelp
]; ];

View file

@ -0,0 +1,17 @@
{ pkgs }:
pkgs.writeShellApplication {
name = "randomWallpaper";
runtimeInputs = with pkgs; [ findutils coreutils feh hyprland jq ];
text = ''
wallpaper="$(find ~/.config/wallpapers/ -type f,l | shuf -n 1)"
if [ -z ''${WAYLAND_DISPLAY+x} ]; then
feh --bg-fill "$wallpaper"
else
hyprctl hyprpaper preload "$wallpaper"
hyprctl monitors -j | jq '.[].name' | xargs -I{} hyprctl hyprpaper wallpaper '{}',"$wallpaper"
hyprctl hyprpaper unload all
fi
'';
}

View file

@ -1,5 +1,10 @@
{ lib, ... }:
{ {
imports = lib.my.listModules ./.; imports = [
./bin
./nix.nix
./shell.nix
./theming
./wallpapers.nix
./yubikey.nix
];
} }

View file

@ -6,10 +6,10 @@
with lib; with lib;
let let
cfg = config.my.programs.nix; cfg = config.my.nix;
in in
{ {
options.my.programs.nix = { options.my.nix = {
gc = { gc = {
enable = mkEnableOption "nix-gc"; enable = mkEnableOption "nix-gc";
minimumFreedGB = mkOption { minimumFreedGB = mkOption {

View file

@ -32,6 +32,10 @@ in
time.timeZone = "Europe/Berlin"; time.timeZone = "Europe/Berlin";
my = { my = {
nix = {
gc.enable = true;
optimise.enable = true;
};
bin.enable = true; bin.enable = true;
shell = { shell = {
abbreviations = { abbreviations = {
@ -59,10 +63,6 @@ in
git.enable = true; git.enable = true;
gpg.enable = true; gpg.enable = true;
navi.enable = true; navi.enable = true;
nix = {
gc.enable = true;
optimise.enable = true;
};
tmux.enable = true; tmux.enable = true;
tmux.keybinds = { tmux.keybinds = {
prefix = { prefix = {

View file

@ -29,7 +29,6 @@ with lib; {
spotify.enable = mkDefault true; spotify.enable = mkDefault true;
ssh.enable = mkDefault true; ssh.enable = mkDefault true;
thunar.enable = mkDefault true; thunar.enable = mkDefault true;
wallpaper.enable = mkDefault true;
zathura.enable = mkDefault true; zathura.enable = mkDefault true;
}; };
services = { services = {

View file

@ -45,7 +45,7 @@ in
focus_follows_pointer = true; focus_follows_pointer = true;
}; };
startupPrograms = [ startupPrograms = [
"wallpaper -r" "randomWallpaper"
]; ];
extraConfig = builtins.readFile ./bspwmrc; extraConfig = builtins.readFile ./bspwmrc;
}; };

View file

@ -1,5 +1,33 @@
{ lib, ... }:
{ {
imports = lib.my.listModules ./.; imports = [
./adb.nix
./bspwm
./chromium.nix
./code.nix
./direnv.nix
./firefox.nix
./fish.nix
./git.nix
./gnome.nix
./gpg.nix
./helix.nix
./hub.nix
./hyprland
./kakoune.nix
./kitty.nix
./ledger
./logseq.nix
./miracast.nix
./navi
./nvim
./python.nix
./rofi
./spotify.nix
./ssh.nix
./sway.nix
./thunar.nix
./tmux.nix
./zathura.nix
./zsh.nix
];
} }

View file

@ -165,26 +165,26 @@ in
bind = $mainMod , RETURN , exec , kitty bind = $mainMod , RETURN , exec , kitty
# XF86 keys # XF86 keys
binde = , XF86AudioLowerVolume , exec , pamixer -d 5 bind = , XF86AudioLowerVolume , exec , pamixer -d 5
binde = , XF86AudioRaiseVolume , exec , pamixer -i 5 bind = , XF86AudioRaiseVolume , exec , pamixer -i 5
bind = , XF86AudioMute , exec , pamixer -t bind = , XF86AudioMute , exec , pamixer -t
bind = , XF86AudioNext , exec , playerctl -p "spotifyd,firefox" next bind = , XF86AudioNext , exec , playerctl -p "spotifyd,firefox" next
bind = , XF86AudioPlay , exec , playerctl -p "spotifyd,firefox" play-pause bind = , XF86AudioPlay , exec , playerctl -p "spotifyd,firefox" play-pause
bind = , XF86AudioPrev , exec , playerctl -p "spotifyd,firefox" previous bind = , XF86AudioPrev , exec , playerctl -p "spotifyd,firefox" previous
binde = , XF86MonBrightnessDown , exec , brightnessctl s 10%- bind = , XF86MonBrightnessDown , exec , brightnessctl s 10%-
binde = , XF86MonBrightnessUp , exec , brightnessctl s 10%+ bind = , XF86MonBrightnessUp , exec , brightnessctl s 10%+
# Move focus with mainMod + hjkl # Move focus with mainMod + hjkl
binde = $mainMod, H, movefocus, l bind = $mainMod, H, movefocus, l
binde = $mainMod, L, movefocus, r bind = $mainMod, L, movefocus, r
binde = $mainMod, K, movefocus, u bind = $mainMod, K, movefocus, u
binde = $mainMod, J, movefocus, d bind = $mainMod, J, movefocus, d
# Change current active window size with mainMod + SHIFT + hjkl # Change current active window size with mainMod + SHIFT + hjkl
binde = $mainMod SHIFT, H, resizeactive, -10 0 bind = $mainMod SHIFT, H, resizeactive, -10 0
binde = $mainMod SHIFT, J, resizeactive, 0 10 bind = $mainMod SHIFT, J, resizeactive, 0 10
binde = $mainMod SHIFT, K, resizeactive, 0 -10 bind = $mainMod SHIFT, K, resizeactive, 0 -10
binde = $mainMod SHIFT, L, resizeactive, 10 0 bind = $mainMod SHIFT, L, resizeactive, 10 0
# Move current active window with mainMod + ALT + hjkl # Move current active window with mainMod + ALT + hjkl
bind = $mainMod ALT, H, movewindow, l bind = $mainMod ALT, H, movewindow, l
@ -223,4 +223,6 @@ in
# Move/resize windows with mainMod + LMB/RMB and dragging # Move/resize windows with mainMod + LMB/RMB and dragging
bindm = $mainMod, mouse:272, movewindow bindm = $mainMod, mouse:272, movewindow
bindm = $mainMod, mouse:273, resizewindow bindm = $mainMod, mouse:273, resizewindow
exec-once=randomWallpaper
'' ''

View file

@ -30,12 +30,9 @@ in
config = mkIf cfg.enable { config = mkIf cfg.enable {
my = { my = {
programs = { programs = {
wallpaper.enable = true;
kitty.enable = true; kitty.enable = true;
rofi.enable = true; rofi.enable = true;
}; };
wallpapers.enable = true;
services.dunst.enable = true; services.dunst.enable = true;
}; };
@ -145,41 +142,33 @@ in
}; };
in in
{ {
enable = true;
partOf = [ "graphical-session.target" ];
wantedBy = [ "graphical-session.target" ]; wantedBy = [ "graphical-session.target" ];
after = [ "graphical-session.target" ];
serviceConfig = { serviceConfig = {
ExecStartPre = "${pkgs.coreutils}/bin/sleep 0.5";
ExecStart = "${pkgs.hyprpaper}/bin/hyprpaper -c ${config}"; ExecStart = "${pkgs.hyprpaper}/bin/hyprpaper -c ${config}";
RestartSec = "500ms"; RestartSec = "1s";
Restart = "on-failure"; Restart = "on-failure";
}; };
}; };
systemd.user.services.random-wallpaper = {
wantedBy = [ "graphical-session.target" ];
requires = [ "hyprpaper.service" ];
serviceConfig = {
ExecStartPre = "${pkgs.coreutils}/bin/sleep 0.5";
ExecStart = "${getExe config.my.programs.wallpaper.package} -r";
RestartSec = "500ms";
Restart = "on-failure";
};
};
# only consider graphical-session.target started when hyprland-sesstion.target is reached # only consider graphical-session.target started when hyprland-sesstion.target is reached
systemd.user.targets.hyprland-session = { systemd.user.targets.hyprland-session = {
partOf = [ "graphical-session.target" ];
wantedBy = [ "graphical-session.target" ]; wantedBy = [ "graphical-session.target" ];
before = [ "graphical-session.target" ]; before = [ "graphical-session.target" ];
}; };
systemd.user.services.xdg-desktop-portal-hyprland = { systemd.user.services.xdg-desktop-portal-hyprland = {
after = [ "hyrpland-session.target" ]; after = [ "hyprland-session.target" ];
requiredBy = [ "xdg-desktop-portal.service" ]; wantedBy = [ "hyprland-session.target" ];
}; };
home-manager.users.moritz.systemd.user.services.nextcloud-client.Service = { home-manager.users.moritz.systemd.user.services.nextcloud-client = {
RestartSec = "500ms"; Service = {
Restart = "on-failure"; RestartSec = "1s";
Restart = "on-failure";
};
}; };
# add user packages for wayland and hyprland in particular # add user packages for wayland and hyprland in particular
@ -240,7 +229,7 @@ in
security.rtkit.enable = true; security.rtkit.enable = true;
# desktop portal (for screensharing) # dekstop portal (for screensharing)
xdg.portal = { xdg.portal = {
enable = true; enable = true;
wlr.enable = mkForce false; wlr.enable = mkForce false;

View file

@ -71,7 +71,7 @@ in
command = "systemctl --user restart waybar"; command = "systemctl --user restart waybar";
always = true; always = true;
} }
{ command = "wallpaper -r"; } { command = "randomWallpaper"; }
]; ];
}; };
}; };

View file

@ -1,30 +0,0 @@
{ lib, config, pkgs, ... }:
with lib;
let
cfg = config.my.programs.wallpaper;
script = pkgs.writeShellApplication {
name = "wallpaper";
runtimeInputs = with pkgs; [ findutils coreutils feh hyprland jq fzf viu ];
text = builtins.readFile ./wallpaper.sh;
};
in
{
options.my.programs.wallpaper = {
enable = mkEnableOption "wallpaper";
package = mkOption {
type = types.package;
default = script;
};
};
config = mkIf cfg.enable {
environment.systemPackages =
[
cfg.package
];
};
}

View file

@ -1,83 +0,0 @@
#!/usr/bin/env bash
WALLPAPERS_PATH="$HOME/.config/wallpapers"
WALLPAPERS=$(find "$WALLPAPERS_PATH" -type f,l)
function help() {
echo "Usage:"
echo -e " wallpaper [OPTIONS] [PATH]"
echo ""
echo "Options:"
echo -e " -h, --help \n\t Show this help message and exit"
echo -e " -r, --random \n\t Set a random wallpaper"
echo -e " -s, --set <PATH> \n\t Set a wallpaper"
}
function randomWallpaper() {
find ~/.config/wallpapers/ -type f,l | shuf -n 1
}
function setWallpaper() {
case "${XDG_CURRENT_DESKTOP,,}" in
hyprland)
hyprctl hyprpaper preload "$1" &>/dev/null
hyprctl monitors -j | jq '.[].name' | xargs -I{} -P 0 hyprctl hyprpaper wallpaper '{}',"$1" &>/dev/null
hyprctl hyprpaper unload all &>/dev/null
;;
*)
feh --bg-fill "$1" &>/dev/null
;;
esac
}
# Parse arguments
# https://stackoverflow.com/a/14203146
POSITIONAL=()
while [[ $# -gt 0 ]]; do
key="$1"
case $key in
-h | --help)
help
exit 0
;;
-r | --random)
WALLPAPER=$(randomWallpaper)
shift # past argument
;;
-s | --set)
WALLPAPER="$2"
shift # past argument
shift # past value
;;
*)
POSITIONAL+=("$1") # save it in an array for later
shift # past argument
;;
esac
done
set -- "${POSITIONAL[@]}" # restore positional arguments
if [[ $# -gt 1 ]]; then
help
exit 1
fi
if [[ $# -eq 1 ]]; then
WALLPAPER="$1"
fi
if [[ -z ${WALLPAPER+x} ]]; then
WALLPAPER=$(echo "$WALLPAPERS" | fzf --preview="viu -sb -h 30 {}" --preview-window=right:70%:wrap)
fi
WALLPAPER=$(realpath "$WALLPAPER")
if [[ ! -e "$WALLPAPER" ]]; then
echo "File not found: $WALLPAPER"
exit 1
fi
echo "Setting wallpaper: '$WALLPAPER'"
setWallpaper "$WALLPAPER"

View file

@ -1,5 +1,13 @@
{ lib, ... }:
{ {
imports = lib.my.listModules ./.; imports = [
./dunst.nix
./gammastep.nix
./kdeconnect.nix
./mullvad.nix
./openconnect.nix
./picom.nix
./printing.nix
./synology-drive.nix
./wireguard.nix
];
} }

View file

@ -1,5 +1,6 @@
{ lib, ... }:
{ {
imports = lib.my.listModules ./.; imports = [
./podman.nix
./virtualisation.nix
];
} }

View file

@ -1,4 +1,4 @@
{ lib, ... }@args: { inputs, lib }:
lib.composeManyExtensions lib.composeManyExtensions
(lib.my.mapModules' (file: import file args) ./.) (lib.my.mapModules' (file: import file { inherit inputs lib; }) ./.)