Add Hyprland and Greetd configurations; update desktop settings and user examples
This commit is contained in:
@@ -10,7 +10,8 @@
|
||||
#
|
||||
# FIXME(starter): add or remove any optional config directories or files ehre
|
||||
common/optional/browsers
|
||||
common/optional/desktops
|
||||
common/optional/desktops/hyprland
|
||||
common/optional/desktops/hyprland/zenbook-screen.nix
|
||||
common/optional/comms
|
||||
common/optional/media
|
||||
common/optional/coding
|
||||
|
||||
@@ -37,10 +37,6 @@ in {
|
||||
sessionPath = [
|
||||
"$HOME/.local/bin"
|
||||
];
|
||||
sessionVariables = {
|
||||
FLAKE = "$HOME/src/nix/nix-config";
|
||||
SHELL = "bash";
|
||||
};
|
||||
};
|
||||
|
||||
home.packages = with pkgs; [
|
||||
|
||||
6
home/panotaka/common/core/shell/nushell.nix
Normal file
6
home/panotaka/common/core/shell/nushell.nix
Normal file
@@ -0,0 +1,6 @@
|
||||
{pkgs, ...}: {
|
||||
programs.nushell = {
|
||||
enable = true;
|
||||
configFile.source = null; # Use default config, or set to a custom file if desired
|
||||
};
|
||||
}
|
||||
19
home/panotaka/common/core/shell/zsh.nix
Normal file
19
home/panotaka/common/core/shell/zsh.nix
Normal file
@@ -0,0 +1,19 @@
|
||||
{pkgs, ...}: {
|
||||
programs.zsh = {
|
||||
enable = true;
|
||||
enableCompletion = true;
|
||||
syntaxHighlighting.enable = true;
|
||||
autosuggestions.enable = true;
|
||||
history = {
|
||||
save = 10000;
|
||||
share = true;
|
||||
};
|
||||
plugins = [
|
||||
{
|
||||
name = "zsh-autopair";
|
||||
src = pkgs.zsh-autopair;
|
||||
}
|
||||
# Add more plugins here as needed
|
||||
];
|
||||
};
|
||||
}
|
||||
48
home/panotaka/common/optional/desktops/hyprland/default.nix
Normal file
48
home/panotaka/common/optional/desktops/hyprland/default.nix
Normal file
@@ -0,0 +1,48 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}: {
|
||||
imports = [
|
||||
./hyprlock.nix
|
||||
./hypridle.nix
|
||||
];
|
||||
|
||||
# Misc settingsmanager configuration
|
||||
wayland.windowManager.hyprland = {
|
||||
enable = true;
|
||||
plugins = with pkgs.hyprlandPlugins; [
|
||||
# Add any additional Hyprland plugins here
|
||||
hyprspace
|
||||
];
|
||||
settings = {
|
||||
# Set mod key
|
||||
"$mod" = "SUPER";
|
||||
# Enable inverted (natural) scrolling on touchpad
|
||||
"input:touchpad:natural_scroll" = true;
|
||||
# Disable middle click on touchpad
|
||||
"input:touchpad:clickfinger_behavior" = false;
|
||||
"input:touchpad:middle_button_emulation" = false;
|
||||
# Enable 3-finger swipe to change workspaces
|
||||
"gestures:workspace_swipe" = true;
|
||||
|
||||
"gestures:workspace_swipe_fingers" = 3;
|
||||
"plugin:overview:reverseSwipe" = true;
|
||||
# Keybinds
|
||||
bind = [
|
||||
# Launch terminal (kitty)
|
||||
"$mod,RETURN,exec,kitty"
|
||||
# Launch browser (zen)
|
||||
"$mod,B,exec,zen"
|
||||
# Close window
|
||||
"$mod,Q,killactive"
|
||||
# Logout
|
||||
"$mod SHIFT,E,exit"
|
||||
|
||||
# Overview
|
||||
"$mod,TAB,overview:toggle"
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
37
home/panotaka/common/optional/desktops/hyprland/hypridle.nix
Normal file
37
home/panotaka/common/optional/desktops/hyprland/hypridle.nix
Normal file
@@ -0,0 +1,37 @@
|
||||
{pkgs, ...}: {
|
||||
services.hypridle = {
|
||||
enable = true;
|
||||
settings = {
|
||||
general = {
|
||||
lock_cmd = "pidof hyprlock || hyprlock";
|
||||
before_sleep_cmd = "loginctl lock-session";
|
||||
after_sleep_cmd = "hyprctl dispatch dpms on";
|
||||
};
|
||||
|
||||
listener = [
|
||||
{
|
||||
timeout = 150;
|
||||
on-timeout = "brightnessctl -s set 10";
|
||||
on-resume = "brightnessctl -r";
|
||||
}
|
||||
{
|
||||
timeout = 300;
|
||||
on-timeout = "loginctl lock-session";
|
||||
}
|
||||
{
|
||||
timeout = 330;
|
||||
on-timeout = "hyprctl dispatch dpms off";
|
||||
on-resume = "hyprctl dispatch dpms on";
|
||||
}
|
||||
{
|
||||
timeout = 1800;
|
||||
on-timeout = "systemctl suspend";
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
home.packages = with pkgs; [
|
||||
hypridle
|
||||
];
|
||||
}
|
||||
13
home/panotaka/common/optional/desktops/hyprland/hyprlock.nix
Normal file
13
home/panotaka/common/optional/desktops/hyprland/hyprlock.nix
Normal file
@@ -0,0 +1,13 @@
|
||||
{pkgs, ...}: {
|
||||
programs.hyprlock = {
|
||||
enable = true;
|
||||
};
|
||||
|
||||
wayland.windowManager.hyprland.keybinds = [
|
||||
"$mod,L,exec,hyprlock"
|
||||
];
|
||||
|
||||
home.packages = with pkgs; [
|
||||
hyprlock
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,140 @@
|
||||
{pkgs, ...}: let
|
||||
# Configuration variables from your script
|
||||
preferred_resolution = "2880x1800";
|
||||
refresh_rate = "120";
|
||||
ui_scale = "1.5";
|
||||
y_offset = "1200";
|
||||
vrr_mode = "1"; # 0 = off, 1 = on, 2 = fullscreen only
|
||||
|
||||
# Inline scripts adapted from your bash script
|
||||
zenbook-top = pkgs.writeShellScriptBin "zenbook-top" ''
|
||||
echo "Setting to top screen only"
|
||||
${pkgs.hyprland}/bin/hyprctl keyword monitor "eDP-1,${preferred_resolution}@${refresh_rate},0x0,${ui_scale},vrr,${vrr_mode}"
|
||||
${pkgs.hyprland}/bin/hyprctl keyword monitor "eDP-2,disable"
|
||||
'';
|
||||
|
||||
zenbook-bottom = pkgs.writeShellScriptBin "zenbook-bottom" ''
|
||||
echo "Setting to bottom screen only"
|
||||
${pkgs.hyprland}/bin/hyprctl keyword monitor "eDP-2,${preferred_resolution}@${refresh_rate},0x0,${ui_scale},vrr,${vrr_mode}"
|
||||
${pkgs.hyprland}/bin/hyprctl keyword monitor "eDP-1,disable"
|
||||
'';
|
||||
|
||||
zenbook-both = pkgs.writeShellScriptBin "zenbook-both" ''
|
||||
echo "Setting to both screens"
|
||||
${pkgs.hyprland}/bin/hyprctl keyword monitor "eDP-1,${preferred_resolution}@${refresh_rate},0x0,${ui_scale},vrr,${vrr_mode}"
|
||||
${pkgs.hyprland}/bin/hyprctl keyword monitor "eDP-2,${preferred_resolution}@${refresh_rate},0x${y_offset},${ui_scale},vrr,${vrr_mode}"
|
||||
'';
|
||||
|
||||
zenbook-left-up = pkgs.writeShellScriptBin "zenbook-left-up" ''
|
||||
echo "Setting to left-right layout"
|
||||
${pkgs.hyprland}/bin/hyprctl keyword monitor "eDP-2,${preferred_resolution}@${refresh_rate},0x0,${ui_scale},vrr,${vrr_mode}"
|
||||
${pkgs.hyprland}/bin/hyprctl keyword monitor "eDP-1,${preferred_resolution}@${refresh_rate},${y_offset}x0,${ui_scale},vrr,${vrr_mode}"
|
||||
'';
|
||||
|
||||
zenbook-right-up = pkgs.writeShellScriptBin "zenbook-right-up" ''
|
||||
echo "Setting to right-left layout"
|
||||
${pkgs.hyprland}/bin/hyprctl keyword monitor "eDP-1,${preferred_resolution}@${refresh_rate},0x0,${ui_scale},vrr,${vrr_mode}"
|
||||
${pkgs.hyprland}/bin/hyprctl keyword monitor "eDP-2,${preferred_resolution}@${refresh_rate},${y_offset}x0,${ui_scale},vrr,${vrr_mode}"
|
||||
'';
|
||||
|
||||
zenbook-normal = pkgs.writeShellScriptBin "zenbook-normal" ''
|
||||
# Check if lid is closed
|
||||
lid_closed=false
|
||||
if grep -q closed /proc/acpi/button/lid/*/state 2>/dev/null; then
|
||||
lid_closed=true
|
||||
fi
|
||||
|
||||
# Check if keyboard is attached (USB dock detection)
|
||||
keyboard_attached=false
|
||||
if ${pkgs.usbutils}/bin/lsusb | grep 0b05:1b2c; then
|
||||
keyboard_attached=true
|
||||
fi
|
||||
|
||||
if [ "$lid_closed" = true ] && [ "$keyboard_attached" = true ]; then
|
||||
echo "Lid closed and keyboard attached — disabling both screens"
|
||||
${pkgs.hyprland}/bin/hyprctl keyword monitor "eDP-1,disable"
|
||||
${pkgs.hyprland}/bin/hyprctl keyword monitor "eDP-2,disable"
|
||||
elif [ "$lid_closed" = true ]; then
|
||||
echo "Lid closed — disabling top screen"
|
||||
${pkgs.hyprland}/bin/hyprctl keyword monitor "eDP-1,disable"
|
||||
${pkgs.hyprland}/bin/hyprctl keyword monitor "eDP-2,${preferred_resolution}@${refresh_rate},0x0,${ui_scale},vrr,${vrr_mode}"
|
||||
elif [ "$keyboard_attached" = true ]; then
|
||||
echo "Keyboard attached — disabling bottom screen"
|
||||
${pkgs.hyprland}/bin/hyprctl keyword monitor "eDP-1,${preferred_resolution}@${refresh_rate},0x0,${ui_scale},vrr,${vrr_mode}"
|
||||
${pkgs.hyprland}/bin/hyprctl keyword monitor "eDP-2,disable"
|
||||
else
|
||||
echo "Normal mode — enabling both screens"
|
||||
${zenbook-both}/bin/zenbook-both
|
||||
fi
|
||||
'';
|
||||
|
||||
zenbook-toggle = pkgs.writeShellScriptBin "zenbook-toggle" ''
|
||||
# Check current state and toggle
|
||||
enabled_count=$(${pkgs.hyprland}/bin/hyprctl monitors | grep -c "eDP.*" || echo "0")
|
||||
if [ "$enabled_count" -eq 1 ]; then
|
||||
${zenbook-both}/bin/zenbook-both
|
||||
else
|
||||
${zenbook-top}/bin/zenbook-top
|
||||
fi
|
||||
'';
|
||||
|
||||
# Event-driven display management (from your original script)
|
||||
zenbook-watch-displays = pkgs.writeShellScriptBin "zenbook-watch-displays" ''
|
||||
${zenbook-normal}/bin/zenbook-normal
|
||||
while ${pkgs.inotify-tools}/bin/inotifywait -e attrib /dev/bus/usb/*/; do
|
||||
${zenbook-normal}/bin/zenbook-normal
|
||||
done
|
||||
'';
|
||||
|
||||
zenbook-set-displays = pkgs.writeShellScriptBin "zenbook-set-displays" ''
|
||||
sleep 1
|
||||
${zenbook-normal}/bin/zenbook-normal
|
||||
'';
|
||||
|
||||
# Auto-run display setup on startup
|
||||
zenbook-autostart = pkgs.writeShellScriptBin "zenbook-autostart" ''
|
||||
# Initial display setup
|
||||
${zenbook-normal}/bin/zenbook-normal
|
||||
|
||||
# Start USB monitoring in background
|
||||
${zenbook-watch-displays}/bin/zenbook-watch-displays &
|
||||
'';
|
||||
in {
|
||||
# Zenbook dual-screen display configuration
|
||||
wayland.windowManager.hyprland.settings = {
|
||||
# Monitor configuration for Zenbook dual screens
|
||||
monitor = [
|
||||
# Primary display (eDP-1) - top screen
|
||||
"eDP-1,${preferred_resolution}@${refresh_rate},0x0,${ui_scale},vrr,${vrr_mode}"
|
||||
# Secondary display (eDP-2) - bottom screen positioned below primary
|
||||
"eDP-2,${preferred_resolution}@${refresh_rate},0x${y_offset},${ui_scale},vrr,${vrr_mode}"
|
||||
# Fallback for any other monitors
|
||||
",preferred,auto,1"
|
||||
];
|
||||
|
||||
# VRR and performance optimizations
|
||||
misc = {
|
||||
# Enable Variable Frame Rate to save power when screen is static
|
||||
vfr = true;
|
||||
};
|
||||
|
||||
# Auto-start the event-driven display management
|
||||
exec-once = [
|
||||
"${zenbook-autostart}/bin/zenbook-autostart"
|
||||
];
|
||||
};
|
||||
|
||||
# Add the scripts to home packages
|
||||
home.packages = [
|
||||
zenbook-top
|
||||
zenbook-bottom
|
||||
zenbook-both
|
||||
zenbook-left-up
|
||||
zenbook-right-up
|
||||
zenbook-normal
|
||||
zenbook-toggle
|
||||
zenbook-watch-displays
|
||||
zenbook-set-displays
|
||||
zenbook-autostart
|
||||
];
|
||||
}
|
||||
15
hosts/common/optional/greetd.nix
Normal file
15
hosts/common/optional/greetd.nix
Normal file
@@ -0,0 +1,15 @@
|
||||
{pkgs, ...}: {
|
||||
services.greetd = {
|
||||
enable = true;
|
||||
settings = {
|
||||
default_session = {
|
||||
command = "${pkgs.greetd.tuigreet}/bin/tuigreet --time --cmd ${pkgs.hyprland}/bin/Hyprland";
|
||||
user = "greeter";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
# Disable conflicting getty services on tty1
|
||||
systemd.services."getty@tty1".enable = false;
|
||||
systemd.services."autovt@tty1".enable = false;
|
||||
}
|
||||
18
hosts/common/optional/hyprland.nix
Normal file
18
hosts/common/optional/hyprland.nix
Normal file
@@ -0,0 +1,18 @@
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
inputs,
|
||||
...
|
||||
}: {
|
||||
programs.hyprland = {
|
||||
enable = true;
|
||||
# You can add more configuration options here as needed
|
||||
# For example, to set a basic config file:
|
||||
# settings = {
|
||||
# ...
|
||||
# };
|
||||
portalPackage = pkgs.xdg-desktop-portal-hyprland;
|
||||
};
|
||||
|
||||
environment.sessionVariables.NIXOS_OZONE_WL = "1";
|
||||
}
|
||||
@@ -13,6 +13,12 @@ in {
|
||||
|
||||
stylix.base16Scheme = "${tinted-schemes}/base16/tokyo-city-dark.yaml";
|
||||
|
||||
stylix.cursor = {
|
||||
package = pkgs.qogir-icon-theme;
|
||||
name = "Qogir";
|
||||
size = 24;
|
||||
};
|
||||
|
||||
stylix.fonts = {
|
||||
serif = {
|
||||
package = pkgs.noto-fonts;
|
||||
|
||||
@@ -7,23 +7,20 @@
|
||||
# .
|
||||
# If you have no need for secondary users, simple delete this file and its parent directory, and ensure that
|
||||
# your `nix-confitg/hosts/[platform]/[hostname]/default.nix` files do not import this file.
|
||||
|
||||
#
|
||||
# Basic user for viewing exampleSecondUser
|
||||
#
|
||||
|
||||
{
|
||||
inputs,
|
||||
lib,
|
||||
pkgs,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
let
|
||||
}: let
|
||||
hostSpec = config.hostSpec;
|
||||
secretsSubPath = "passwords/exampleSecondUser";
|
||||
in
|
||||
{
|
||||
{
|
||||
# Decrypt passwords/exampleSecondUser to /run/secrets-for-users/ so it can be used to create the user
|
||||
sops.secrets.${secretsSubPath}.neededForUsers = true;
|
||||
users.mutableUsers = false; # Required for password to be set via sops during system activation!
|
||||
@@ -37,11 +34,11 @@ in
|
||||
"video"
|
||||
];
|
||||
|
||||
packages = [ pkgs.home-manager ];
|
||||
packages = [pkgs.home-manager];
|
||||
};
|
||||
}
|
||||
# Import this user's personal/home configurations
|
||||
// lib.optionalAttrs (inputs ? "home-manager") {
|
||||
}
|
||||
# Import this user's personal/home configurations
|
||||
// lib.optionalAttrs (inputs ? "home-manager") {
|
||||
home-manager = {
|
||||
extraSpecialArgs = {
|
||||
inherit pkgs inputs;
|
||||
@@ -50,7 +47,7 @@ in
|
||||
users.exampleSecondUser.imports = lib.flatten (
|
||||
lib.optional (!hostSpec.isMinimal) [
|
||||
(
|
||||
{ config, ... }:
|
||||
{config, ...}:
|
||||
import (lib.custom.relativeToRoot "home/exampleSecondUser/${hostSpec.hostName}.nix") {
|
||||
inherit
|
||||
pkgs
|
||||
@@ -64,4 +61,4 @@ in
|
||||
]
|
||||
);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,8 +74,8 @@
|
||||
"hosts/common/optional/services/docker.nix"
|
||||
"hosts/common/optional/services/tailscale.nix"
|
||||
"hosts/common/optional/audio.nix" # pipewire and cli controls
|
||||
"hosts/common/optional/kde.nix"
|
||||
"hosts/common/optional/sddm.nix"
|
||||
"hosts/common/optional/hyprland.nix"
|
||||
"hosts/common/optional/greetd.nix"
|
||||
"hosts/common/optional/flatpak.nix"
|
||||
"hosts/common/optional/thermal-management.nix"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user