Merge remote-tracking branch 'origin/nixos' into nixos
This commit is contained in:
commit
13883e7178
19 changed files with 553 additions and 199 deletions
|
|
@ -45,7 +45,7 @@ in
|
|||
focus_follows_pointer = true;
|
||||
};
|
||||
startupPrograms = [
|
||||
"randomWallpaper"
|
||||
"wallpaper -r"
|
||||
];
|
||||
extraConfig = builtins.readFile ./bspwmrc;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,33 +1,5 @@
|
|||
{ lib, ... }:
|
||||
|
||||
{
|
||||
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
|
||||
];
|
||||
imports = lib.my.listModules ./.;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -165,26 +165,26 @@ in
|
|||
bind = $mainMod , RETURN , exec , kitty
|
||||
|
||||
# XF86 keys
|
||||
bind = , XF86AudioLowerVolume , exec , pamixer -d 5
|
||||
bind = , XF86AudioRaiseVolume , exec , pamixer -i 5
|
||||
binde = , XF86AudioLowerVolume , exec , pamixer -d 5
|
||||
binde = , XF86AudioRaiseVolume , exec , pamixer -i 5
|
||||
bind = , XF86AudioMute , exec , pamixer -t
|
||||
bind = , XF86AudioNext , exec , playerctl -p "spotifyd,firefox" next
|
||||
bind = , XF86AudioPlay , exec , playerctl -p "spotifyd,firefox" play-pause
|
||||
bind = , XF86AudioPrev , exec , playerctl -p "spotifyd,firefox" previous
|
||||
bind = , XF86MonBrightnessDown , exec , brightnessctl s 10%-
|
||||
bind = , XF86MonBrightnessUp , exec , brightnessctl s 10%+
|
||||
binde = , XF86MonBrightnessDown , exec , brightnessctl s 10%-
|
||||
binde = , XF86MonBrightnessUp , exec , brightnessctl s 10%+
|
||||
|
||||
# Move focus with mainMod + hjkl
|
||||
bind = $mainMod, H, movefocus, l
|
||||
bind = $mainMod, L, movefocus, r
|
||||
bind = $mainMod, K, movefocus, u
|
||||
bind = $mainMod, J, movefocus, d
|
||||
binde = $mainMod, H, movefocus, l
|
||||
binde = $mainMod, L, movefocus, r
|
||||
binde = $mainMod, K, movefocus, u
|
||||
binde = $mainMod, J, movefocus, d
|
||||
|
||||
# Change current active window size with mainMod + SHIFT + hjkl
|
||||
bind = $mainMod SHIFT, H, resizeactive, -10 0
|
||||
bind = $mainMod SHIFT, J, resizeactive, 0 10
|
||||
bind = $mainMod SHIFT, K, resizeactive, 0 -10
|
||||
bind = $mainMod SHIFT, L, resizeactive, 10 0
|
||||
binde = $mainMod SHIFT, H, resizeactive, -10 0
|
||||
binde = $mainMod SHIFT, J, resizeactive, 0 10
|
||||
binde = $mainMod SHIFT, K, resizeactive, 0 -10
|
||||
binde = $mainMod SHIFT, L, resizeactive, 10 0
|
||||
|
||||
# Move current active window with mainMod + ALT + hjkl
|
||||
bind = $mainMod ALT, H, movewindow, l
|
||||
|
|
@ -223,6 +223,4 @@ in
|
|||
# Move/resize windows with mainMod + LMB/RMB and dragging
|
||||
bindm = $mainMod, mouse:272, movewindow
|
||||
bindm = $mainMod, mouse:273, resizewindow
|
||||
|
||||
exec-once=randomWallpaper
|
||||
''
|
||||
|
|
|
|||
|
|
@ -30,9 +30,12 @@ in
|
|||
config = mkIf cfg.enable {
|
||||
my = {
|
||||
programs = {
|
||||
wallpaper.enable = true;
|
||||
kitty.enable = true;
|
||||
rofi.enable = true;
|
||||
|
||||
};
|
||||
wallpapers.enable = true;
|
||||
services.dunst.enable = true;
|
||||
};
|
||||
|
||||
|
|
@ -95,17 +98,32 @@ in
|
|||
command = "${getExe pkgs.swaylock} -fF";
|
||||
}
|
||||
];
|
||||
timeouts = [
|
||||
{
|
||||
timeout = 300;
|
||||
command = "${hyprland}/bin/hyprctl dispatch dpms off";
|
||||
resumeCommand = "${hyprland}/bin/hyprctl dispatch dpms on";
|
||||
}
|
||||
{
|
||||
timeout = 310;
|
||||
command = "${pkgs.systemd}/bin/loginctl lock-session";
|
||||
}
|
||||
];
|
||||
timeouts =
|
||||
let
|
||||
lockTimeout = 10;
|
||||
in
|
||||
[
|
||||
{
|
||||
timeout = lockTimeout * 60 - 10;
|
||||
command = "${pkgs.libnotify}/bin/notify-send 'Locking screen!'";
|
||||
}
|
||||
{
|
||||
timeout = lockTimeout * 60;
|
||||
command = "${hyprland}/bin/hyprctl dispatch dpms off";
|
||||
resumeCommand = "${hyprland}/bin/hyprctl dispatch dpms on";
|
||||
}
|
||||
{
|
||||
timeout = lockTimeout * 60 + 10;
|
||||
command = "${pkgs.systemd}/bin/loginctl lock-session";
|
||||
}
|
||||
] ++ optional
|
||||
(!cfg.nvidiaSupport) # TODO https://github.com/hyprwm/Hyprland/issues/1728
|
||||
[
|
||||
{
|
||||
timeout = 30 * 60;
|
||||
command = "${pkgs.systemd}/bin/systemctl suspend-then-hibernate";
|
||||
}
|
||||
];
|
||||
systemdTarget = "hyprland-session.target";
|
||||
};
|
||||
};
|
||||
|
|
@ -127,33 +145,41 @@ in
|
|||
};
|
||||
in
|
||||
{
|
||||
enable = true;
|
||||
partOf = [ "graphical-session.target" ];
|
||||
wantedBy = [ "graphical-session.target" ];
|
||||
after = [ "graphical-session.target" ];
|
||||
serviceConfig = {
|
||||
ExecStartPre = "${pkgs.coreutils}/bin/sleep 0.5";
|
||||
ExecStart = "${getExe pkgs.hyprpaper} -c ${config}";
|
||||
RestartSec = "1s";
|
||||
RestartSec = "500ms";
|
||||
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
|
||||
systemd.user.targets.hyprland-session = {
|
||||
partOf = [ "graphical-session.target" ];
|
||||
wantedBy = [ "graphical-session.target" ];
|
||||
before = [ "graphical-session.target" ];
|
||||
};
|
||||
|
||||
systemd.user.services.xdg-desktop-portal-hyprland = {
|
||||
after = [ "hyprland-session.target" ];
|
||||
wantedBy = [ "hyprland-session.target" ];
|
||||
after = [ "hyrpland-session.target" ];
|
||||
requiredBy = [ "xdg-desktop-portal.service" ];
|
||||
};
|
||||
|
||||
home-manager.users.moritz.systemd.user.services.nextcloud-client = {
|
||||
Service = {
|
||||
RestartSec = "1s";
|
||||
Restart = "on-failure";
|
||||
};
|
||||
home-manager.users.moritz.systemd.user.services.nextcloud-client.Service = {
|
||||
RestartSec = "500ms";
|
||||
Restart = "on-failure";
|
||||
};
|
||||
|
||||
# add user packages for wayland and hyprland in particular
|
||||
|
|
@ -214,7 +240,7 @@ in
|
|||
security.rtkit.enable = true;
|
||||
|
||||
|
||||
# dekstop portal (for screensharing)
|
||||
# desktop portal (for screensharing)
|
||||
xdg.portal = {
|
||||
enable = true;
|
||||
wlr.enable = mkForce false;
|
||||
|
|
|
|||
66
modules/programs/nix.nix
Normal file
66
modules/programs/nix.nix
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
{ config
|
||||
, lib
|
||||
, inputs
|
||||
, ...
|
||||
}:
|
||||
|
||||
with lib;
|
||||
let
|
||||
cfg = config.my.programs.nix;
|
||||
in
|
||||
{
|
||||
options.my.programs.nix = {
|
||||
gc = {
|
||||
enable = mkEnableOption "nix-gc";
|
||||
minimumFreedGB = mkOption {
|
||||
default = 32;
|
||||
type = types.int;
|
||||
apply = number: toString (number * 1024 * 1024 * 1024);
|
||||
};
|
||||
};
|
||||
optimise.enable = mkEnableOption "nix-optimise";
|
||||
};
|
||||
|
||||
config.nix = {
|
||||
gc = {
|
||||
automatic = cfg.gc.enable;
|
||||
options = "--max-freed ${cfg.gc.minimumFreedGB} --delete-older-than 14d";
|
||||
dates = "weekly";
|
||||
};
|
||||
|
||||
optimise = {
|
||||
automatic = cfg.optimise.enable;
|
||||
dates = [ "weekly" ];
|
||||
};
|
||||
|
||||
registry = {
|
||||
master-upstream.to = {
|
||||
type = "github";
|
||||
owner = "nixos";
|
||||
repo = "nixpkgs";
|
||||
};
|
||||
master.flake = inputs.master;
|
||||
nixpkgs.flake = inputs.nixpkgs;
|
||||
stable.flake = inputs.stable;
|
||||
};
|
||||
|
||||
settings = {
|
||||
substituters = [
|
||||
"https://cache.nixos.org/"
|
||||
"https://jupyterwith.cachix.org"
|
||||
"https://nix-community.cachix.org"
|
||||
"https://pre-commit-hooks.cachix.org"
|
||||
"https://hyprland.cachix.org"
|
||||
];
|
||||
trusted-public-keys = [
|
||||
"jupyterwith.cachix.org-1:/kDy2B6YEhXGJuNguG1qyqIodMyO4w8KwWH4/vAc7CI="
|
||||
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
|
||||
"cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
|
||||
"pre-commit-hooks.cachix.org-1:Pkk3Panw5AW24TOv6kz3PvLhlH8puAsJTBbOPmBo7Rc="
|
||||
"hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc="
|
||||
];
|
||||
|
||||
trusted-users = [ "root" "@wheel" ];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -71,7 +71,7 @@ in
|
|||
command = "systemctl --user restart waybar";
|
||||
always = true;
|
||||
}
|
||||
{ command = "randomWallpaper"; }
|
||||
{ command = "wallpaper -r"; }
|
||||
];
|
||||
};
|
||||
};
|
||||
|
|
|
|||
30
modules/programs/wallpaper/default.nix
Normal file
30
modules/programs/wallpaper/default.nix
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
{ 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
|
||||
];
|
||||
};
|
||||
}
|
||||
83
modules/programs/wallpaper/wallpaper.sh
Normal file
83
modules/programs/wallpaper/wallpaper.sh
Normal file
|
|
@ -0,0 +1,83 @@
|
|||
#!/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"
|
||||
Loading…
Add table
Add a link
Reference in a new issue