Compare commits

..

9 Commits

Author SHA1 Message Date
8f247b2e6b Pass all inputs 2025-09-30 14:15:24 +02:00
4ad67653d0 Remove unused input 2025-09-29 20:10:32 +02:00
b6af4b0b12 Split hypr config 2025-09-29 20:09:29 +02:00
6d44289959 Bindings for min/max brightness
Note that setting brightness to 1 (minimal non-zero light) was not available
before.
2025-09-29 01:12:22 +02:00
18982bc1ba Change keybinding for hyprlock 2025-09-29 01:04:38 +02:00
8dc0ad1d34 Setup hypridle for automatically dimming, locking and sleeping 2025-09-29 00:08:08 +02:00
970196d5fb Log in to hyprlock
Got the setup from here:
https://www.reddit.com/r/hyprland/comments/1l7rlq0/how_to_setup_hyprlock_on_nixos/

Also, it's not really secure. I guess i beats booting into my user with no
password.
2025-09-28 23:40:40 +02:00
fe9d7f0575 Add hyprlock 2025-09-28 23:33:04 +02:00
dc8c6e3fa4 Add localsend 2025-09-28 23:18:39 +02:00
13 changed files with 222 additions and 182 deletions

View File

@ -31,17 +31,14 @@
nixpkgs, nixpkgs,
home-manager, home-manager,
nix-rosetta-builder, nix-rosetta-builder,
nanostatus,
emacs-larstvei,
zen-browser,
... ...
}: }@inputs:
{ {
darwinConfigurations = { darwinConfigurations = {
larstvei-macbookpro = darwin.lib.darwinSystem { larstvei-macbookpro = darwin.lib.darwinSystem {
system = "aarch64-darwin"; system = "aarch64-darwin";
specialArgs = { inherit emacs-larstvei; }; specialArgs = { inherit inputs; };
modules = [ modules = [
home-manager.darwinModules.default home-manager.darwinModules.default
@ -54,7 +51,7 @@
nixosConfigurations.thinkpad = nixpkgs.lib.nixosSystem { nixosConfigurations.thinkpad = nixpkgs.lib.nixosSystem {
system = "x86_64-linux"; system = "x86_64-linux";
specialArgs = { inherit emacs-larstvei nanostatus zen-browser; }; specialArgs = { inherit inputs; };
modules = [ modules = [
home-manager.nixosModules.default home-manager.nixosModules.default
./machines/thinkpad ./machines/thinkpad

View File

@ -1,4 +1,4 @@
{ pkgs, emacs-larstvei, ... }: { pkgs, inputs, ... }:
{ {
imports = [ imports = [
../../modules/base ../../modules/base
@ -17,7 +17,7 @@
home-manager = { home-manager = {
useGlobalPkgs = true; useGlobalPkgs = true;
useUserPackages = true; useUserPackages = true;
extraSpecialArgs = { inherit emacs-larstvei; }; extraSpecialArgs = { inherit inputs; };
users.larstvei.imports = [ ../../modules/home/full ]; users.larstvei.imports = [ ../../modules/home/full ];
}; };
} }

View File

@ -11,6 +11,8 @@
../../modules/desktop ../../modules/desktop
]; ];
security.pam.services.hyprlock = { };
networking.hostName = "larstvei-think"; networking.hostName = "larstvei-think";
# Bootloader. # Bootloader.

View File

@ -1,4 +1,4 @@
{ pkgs, zen-browser, ... }: { pkgs, inputs, ... }:
{ {
home.packages = [ home.packages = [
@ -11,8 +11,8 @@
]; ];
imports = [ imports = [
zen-browser.homeModules.beta inputs.zen-browser.homeModules.beta
./hyprland ./hypr
./theme ./theme
]; ];

View File

@ -0,0 +1,32 @@
{
# The animations is taken from Omarchy, see:
# https://github.com/basecamp/omarchy/blob/master/default/hypr/looknfeel.conf
wayland.windowManager.hyprland.settings.animations = {
enabled = true;
bezier = [
"easeOutQuint,0.23,1,0.32,1"
"easeInOutCubic,0.65,0.05,0.36,1"
"linear,0,0,1,1"
"almostLinear,0.5,0.5,0.75,1.0"
"quick,0.15,0,0.1,1"
];
animation = [
"global, 1, 10, default"
"border, 1, 5.39, easeOutQuint"
"windows, 1, 4.79, easeOutQuint"
"windowsIn, 1, 4.1, easeOutQuint, popin 87%"
"windowsOut, 1, 1.49, linear, popin 87%"
"fadeIn, 1, 1.73, almostLinear"
"fadeOut, 1, 1.46, almostLinear"
"fade, 1, 3.03, quick"
"layers, 1, 3.81, easeOutQuint"
"layersIn, 1, 4, easeOutQuint, fade"
"layersOut, 1, 1.5, linear, fade"
"fadeLayersIn, 1, 1.79, almostLinear"
"fadeLayersOut, 1, 1.39, almostLinear"
"workspaces, 0, 0, ease"
];
};
}

View File

@ -0,0 +1,92 @@
{ pkgs, inputs, ... }:
let
nanostatus = inputs.nanostatus.packages.${pkgs.system}.default;
in
{
wayland.windowManager.hyprland.settings = {
input = {
kb_options = "altwin:swap_alt_win";
repeat_delay = 300;
repeat_rate = 50;
touchpad = {
natural_scroll = true;
scroll_factor = 0.4;
tap-to-click = true;
};
};
"$mod" = "SUPER";
"$shiftMod" = "SUPER_SHIFT";
bind = [
# Master layout
"$mod, F, fullscreen"
"$mod, Return, layoutmsg, swapwithmaster master"
"$mod, minus, layoutmsg, mfact -0.01"
"$mod, equal, layoutmsg, mfact +0.01"
"$mod, Tab, layoutmsg, cyclenext"
"$shiftMod, Tab, layoutmsg, cycleprev"
"$mod, comma, layoutmsg, addmaster"
"$mod, period, layoutmsg, removemaster"
# App launchers / session
"$mod, T, exec, kitty"
"$mod, E, exec, emacs"
"$mod, B, exec, zen"
"$mod, Q, killactive"
"$mod, S, exec, grimblast copysave area /tmp/screenshot-$(date +%F--%T).png"
"$shiftMod, S, exec, grimblast copysave screen /tmp/screenshot-$(date +%F--%T).png"
# Window focus & movement
"$mod, H, movefocus, l"
"$mod, J, movefocus, d"
"$mod, K, movefocus, u"
"$mod, L, movefocus, r"
"$shiftMod, H, movewindow, l"
"$shiftMod, J, movewindow, d"
"$shiftMod, K, movewindow, u"
"$shiftMod, L, movewindow, r"
"$mod, =, resizeactive, +10"
"$mod, -, resizeactive, -10"
"$mod, D, exec, darkman toggle"
"$mod, space, exec, ${nanostatus}/bin/nanostatus-toggle"
"$mod, backspace, exec, hyprlock"
# Text input (macOS-like way of producing Norwegian characters)
"$mod, A, exec, wtype 'å'"
"$mod, O, exec, wtype 'ø'"
"$mod, apostrophe, exec, wtype 'æ'"
"$shiftMod, A, exec, wtype 'Å'"
"$shiftMod, O, exec, wtype 'Ø'"
"$shiftMod, apostrophe, exec, wtype 'Æ'"
# Media & brightness
", XF86AudioRaiseVolume, exec, pamixer -i 5 "
", XF86AudioLowerVolume, exec, pamixer -d 5 "
", XF86AudioMute, exec, pamixer -t"
", XF86AudioMicMute, exec, pamixer --default-source -t"
", XF86MonBrightnessUp, exec, brightnessctl set +5%"
", XF86MonBrightnessDown, exec, brightnessctl set 5%-"
"SHIFT, XF86MonBrightnessUp, exec, brightnessctl set 100%"
"SHIFT, XF86MonBrightnessDown, exec, brightnessctl set 1"
]
++ builtins.concatLists (
builtins.genList (
i:
let
code = "1${toString i}";
ws = toString (i + 1);
in
[
"$mod, code:${code}, workspace, ${ws}"
"$shiftMod, code:${code}, movetoworkspace, ${ws}"
]
) 9
);
};
}

View File

@ -0,0 +1,51 @@
{
imports = [
./animations
./bindings
./hypridle
];
programs.kitty.enable = true;
programs.hyprlock.enable = true;
wayland.windowManager.hyprland = {
enable = true;
settings = {
exec-once = [ "hyprlock || hyprctl dispatch exit" ];
misc.disable_hyprland_logo = true;
general = {
border_size = 2;
layout = "master";
};
# No borders or gaps when there is only one window
workspace = "w[t1], gapsin:0, gapsout:0, border:0, rounding:0";
decoration = {
rounding = 15;
inactive_opacity = 0.75;
blur.enabled = false;
shadow.enabled = false;
border_part_of_window = true;
};
monitor = [ ",preferred,auto,1" ];
gestures.workspace_swipe = true;
cursor = {
enable_hyprcursor = false;
inactive_timeout = 2;
};
env = [
"XCURSOR_THEME,Adwaita"
"XCURSOR_SIZE,24"
];
};
};
}

View File

@ -0,0 +1,26 @@
{
services.hypridle = {
enable = true;
settings = {
general = {
lock_cmd = "hyprlock";
before_sleep_cmd = "loginctl lock-session";
};
listener = [
{
timeout = 150; # 2.5 min
on-timeout = "brightnessctl --save && brightnessctl set 1";
on-resume = "brightnessctl --restore";
}
{
timeout = 300; # 5 min
on-resume = "loginctl lock-session";
}
{
timeout = 900; # 15 min
on-timeout = "systemctl suspend-then-hibernate";
}
];
};
};
}

View File

@ -1,157 +0,0 @@
{ pkgs, nanostatus, ... }:
{
programs.kitty.enable = true;
wayland.windowManager.hyprland = {
enable = true;
settings = {
misc.disable_hyprland_logo = true;
general = {
border_size = 2;
layout = "master";
};
# No borders or gaps when there is only one window
workspace = "w[t1], gapsin:0, gapsout:0, border:0";
decoration = {
rounding = 15;
inactive_opacity = 0.75;
blur.enabled = false;
shadow.enabled = false;
border_part_of_window = true;
};
# The animations is taken from Omarchy, see:
# https://github.com/basecamp/omarchy/blob/master/default/hypr/looknfeel.conf
animations = {
enabled = true;
bezier = [
"easeOutQuint,0.23,1,0.32,1"
"easeInOutCubic,0.65,0.05,0.36,1"
"linear,0,0,1,1"
"almostLinear,0.5,0.5,0.75,1.0"
"quick,0.15,0,0.1,1"
];
animation = [
"global, 1, 10, default"
"border, 1, 5.39, easeOutQuint"
"windows, 1, 4.79, easeOutQuint"
"windowsIn, 1, 4.1, easeOutQuint, popin 87%"
"windowsOut, 1, 1.49, linear, popin 87%"
"fadeIn, 1, 1.73, almostLinear"
"fadeOut, 1, 1.46, almostLinear"
"fade, 1, 3.03, quick"
"layers, 1, 3.81, easeOutQuint"
"layersIn, 1, 4, easeOutQuint, fade"
"layersOut, 1, 1.5, linear, fade"
"fadeLayersIn, 1, 1.79, almostLinear"
"fadeLayersOut, 1, 1.39, almostLinear"
"workspaces, 0, 0, ease"
];
};
monitor = [ ",preferred,auto,1" ];
gestures.workspace_swipe = true;
cursor = {
enable_hyprcursor = false;
inactive_timeout = 2;
};
env = [
"XCURSOR_THEME,Adwaita"
"XCURSOR_SIZE,24"
];
input = {
kb_options = "altwin:swap_alt_win";
repeat_delay = 300;
repeat_rate = 50;
touchpad = {
natural_scroll = true;
scroll_factor = 0.4;
tap-to-click = true;
};
};
"$mod" = "SUPER";
"$shiftMod" = "SUPER_SHIFT";
bind = [
# Master layout
"$mod, F, fullscreen"
"$mod, Return, layoutmsg, swapwithmaster master"
"$mod, minus, layoutmsg, mfact -0.01"
"$mod, equal, layoutmsg, mfact +0.01"
"$mod, Tab, layoutmsg, cyclenext"
"$shiftMod, Tab, layoutmsg, cycleprev"
"$mod, comma, layoutmsg, addmaster"
"$mod, period, layoutmsg, removemaster"
# App launchers / session
"$mod, T, exec, kitty"
"$mod, E, exec, emacs"
"$mod, B, exec, zen"
"$mod, Q, killactive"
"$mod, S, exec, grimblast copysave area /tmp/screenshot-$(date +%F--%T).png"
"$shiftMod, S, exec, grimblast copysave screen /tmp/screenshot-$(date +%F--%T).png"
# Window focus & movement
"$mod, H, movefocus, l"
"$mod, J, movefocus, d"
"$mod, K, movefocus, u"
"$mod, L, movefocus, r"
"$shiftMod, H, movewindow, l"
"$shiftMod, J, movewindow, d"
"$shiftMod, K, movewindow, u"
"$shiftMod, L, movewindow, r"
"$mod, =, resizeactive, +10"
"$mod, -, resizeactive, -10"
"$mod, D, exec, darkman toggle"
"$mod, space, exec, ${nanostatus.packages.${pkgs.system}.default}/bin/nanostatus-toggle"
# Text input (macOS-like way of producing Norwegian characters)
"$mod, A, exec, wtype 'å'"
"$mod, O, exec, wtype 'ø'"
"$mod, apostrophe, exec, wtype 'æ'"
"$shiftMod, A, exec, wtype 'Å'"
"$shiftMod, O, exec, wtype 'Ø'"
"$shiftMod, apostrophe, exec, wtype 'Æ'"
# Media & brightness
", XF86AudioRaiseVolume, exec, pamixer -i 5 "
", XF86AudioLowerVolume, exec, pamixer -d 5 "
", XF86AudioMute, exec, pamixer -t"
", XF86AudioMicMute, exec, pamixer --default-source -t"
", XF86MonBrightnessUp, exec, brightnessctl set +5%"
", XF86MonBrightnessDown, exec, brightnessctl set 5%-"
]
++ builtins.concatLists (
builtins.genList (
i:
let
code = "1${toString i}";
ws = toString (i + 1);
in
[
"$mod, code:${code}, workspace, ${ws}"
"$shiftMod, code:${code}, movetoworkspace, ${ws}"
]
) 9
);
};
};
}

View File

@ -1,4 +1,3 @@
{ pkgs, ... }:
let let
bg = { bg = {
light = "FAFAFA"; light = "FAFAFA";

View File

@ -1,10 +1,4 @@
{ { pkgs, inputs, ... }:
pkgs,
nanostatus,
emacs-larstvei,
zen-browser,
...
}:
{ {
imports = [ imports = [
@ -14,7 +8,7 @@
home-manager = { home-manager = {
useGlobalPkgs = true; useGlobalPkgs = true;
useUserPackages = true; useUserPackages = true;
extraSpecialArgs = { inherit nanostatus emacs-larstvei zen-browser; }; extraSpecialArgs = { inherit inputs; };
}; };
users.users.larstvei = { users.users.larstvei = {
@ -32,10 +26,13 @@
services.greetd = { services.greetd = {
enable = true; enable = true;
settings.default_session = { settings = rec {
command = "hyprland"; initial_session = {
command = "hyprland > /dev/null 2>&1";
user = "larstvei"; user = "larstvei";
}; };
default_session = initial_session;
};
}; };
fonts = { fonts = {

View File

@ -1,6 +1,6 @@
{ pkgs, emacs-larstvei, ... }: { pkgs, inputs, ... }:
{ {
home.packages = [ home.packages = [
emacs-larstvei.defaultPackage.${pkgs.system} inputs.emacs-larstvei.defaultPackage.${pkgs.system}
]; ];
} }

View File

@ -6,6 +6,7 @@
gnumake gnumake
jet jet
jq jq
localsend
pandoc pandoc
parallel parallel
ripgrep ripgrep