From c59157a75378c89f3c21d07a31d3dcabb6986378 Mon Sep 17 00:00:00 2001 From: Rouven Seifert Date: Fri, 20 Jan 2023 10:46:28 +0100 Subject: [PATCH] initial halfway working config --- flake.lock | 114 +++++++++++++- flake.nix | 4 +- hosts/thinkpad/default.nix | 11 +- hosts/thinkpad/modules/gdm/default.nix | 6 + shared/input.nix | 20 +-- users/rouven/modules/default.nix | 3 +- users/rouven/modules/hyprland/default.nix | 5 + users/rouven/modules/hyprland/hyprland.conf | 160 ++++++++++++++++++++ 8 files changed, 301 insertions(+), 22 deletions(-) create mode 100644 hosts/thinkpad/modules/gdm/default.nix create mode 100644 users/rouven/modules/hyprland/default.nix create mode 100644 users/rouven/modules/hyprland/hyprland.conf diff --git a/flake.lock b/flake.lock index 1b4bff4..0b56290 100644 --- a/flake.lock +++ b/flake.lock @@ -37,6 +37,48 @@ "type": "github" } }, + "hyprland": { + "inputs": { + "hyprland-protocols": "hyprland-protocols", + "nixpkgs": "nixpkgs", + "wlroots": "wlroots", + "xdph": "xdph" + }, + "locked": { + "lastModified": 1674143063, + "narHash": "sha256-CfP6ZYjxLeC1Q6W4f+RCd2sokIX8RnyTA8wYzYmx9XE=", + "owner": "hyprwm", + "repo": "Hyprland", + "rev": "5112056fdbda989191310364444f328240bbf6f1", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "Hyprland", + "type": "github" + } + }, + "hyprland-protocols": { + "inputs": { + "nixpkgs": [ + "hyprland", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1671839510, + "narHash": "sha256-+PY1qqJfmZzzROgcIY4I7AkCwpnC+qBIYk2eFoA9RWc=", + "owner": "hyprwm", + "repo": "hyprland-protocols", + "rev": "b8f55e02a328c47ed373133c52483bbfa20a1b75", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "hyprland-protocols", + "type": "github" + } + }, "nix-colors": { "inputs": { "base16-schemes": "base16-schemes", @@ -58,15 +100,15 @@ }, "nixpkgs": { "locked": { - "lastModified": 1673796341, - "narHash": "sha256-1kZi9OkukpNmOaPY7S5/+SlCDOuYnP3HkXHvNDyLQcc=", - "owner": "nixos", + "lastModified": 1673540789, + "narHash": "sha256-xqnxBOK3qctIeUVxecydrEDbEXjsvHCPGPbvsl63M/U=", + "owner": "NixOS", "repo": "nixpkgs", - "rev": "6dccdc458512abce8d19f74195bb20fdb067df50", + "rev": "0f213d0fee84280d8c3a97f7469b988d6fe5fcdf", "type": "github" }, "original": { - "owner": "nixos", + "owner": "NixOS", "ref": "nixos-unstable", "repo": "nixpkgs", "type": "github" @@ -103,11 +145,28 @@ "type": "github" } }, + "nixpkgs_2": { + "locked": { + "lastModified": 1673796341, + "narHash": "sha256-1kZi9OkukpNmOaPY7S5/+SlCDOuYnP3HkXHvNDyLQcc=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "6dccdc458512abce8d19f74195bb20fdb067df50", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, "root": { "inputs": { "home-manager": "home-manager", + "hyprland": "hyprland", "nix-colors": "nix-colors", - "nixpkgs": "nixpkgs", + "nixpkgs": "nixpkgs_2", "sops-nix": "sops-nix" } }, @@ -146,6 +205,49 @@ "repo": "flake-utils", "type": "github" } + }, + "wlroots": { + "flake": false, + "locked": { + "host": "gitlab.freedesktop.org", + "lastModified": 1672824257, + "narHash": "sha256-SbYoZj57VlopTzI+OSW9jlgYxN1gI1KLg/s/HV+87eE=", + "owner": "wlroots", + "repo": "wlroots", + "rev": "5f264a7d6c8af27d41ff440c05262b022c055593", + "type": "gitlab" + }, + "original": { + "host": "gitlab.freedesktop.org", + "owner": "wlroots", + "repo": "wlroots", + "type": "gitlab" + } + }, + "xdph": { + "inputs": { + "hyprland-protocols": [ + "hyprland", + "hyprland-protocols" + ], + "nixpkgs": [ + "hyprland", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1673116118, + "narHash": "sha256-eR0yDSkR2XYMesfdRWJs25kAdXET2mbNNHu5t+KUcKA=", + "owner": "hyprwm", + "repo": "xdg-desktop-portal-hyprland", + "rev": "d479c846531fd0e1d2357c9588b8310a2b859ef2", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "xdg-desktop-portal-hyprland", + "type": "github" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index fdefd39..55df5d2 100644 --- a/flake.nix +++ b/flake.nix @@ -4,12 +4,13 @@ nixpkgs.url = github:nixos/nixpkgs/nixos-unstable; home-manager.url = github:nix-community/home-manager; home-manager.inputs.nixpkgs.follows = "nixpkgs"; + hyprland.url = github:hyprwm/Hyprland; sops-nix.url = github:Mic92/sops-nix; sops-nix.inputs.nixpkgs.follows = "nixpkgs"; nix-colors.url = github:Misterio77/nix-colors; }; - outputs = { self, nixpkgs, home-manager, sops-nix, nix-colors }: { + outputs = { self, nixpkgs, home-manager, hyprland, sops-nix, nix-colors }: { formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.nixpkgs-fmt; nixosConfigurations = { thinkpad = nixpkgs.lib.nixosSystem { @@ -23,6 +24,7 @@ home-manager.users.rouven = { imports = [ nix-colors.homeManagerModule + hyprland.homeManagerModules.default ]; config.colorScheme = nix-colors.colorSchemes.dracula; }; diff --git a/hosts/thinkpad/default.nix b/hosts/thinkpad/default.nix index fd80443..ba0a055 100755 --- a/hosts/thinkpad/default.nix +++ b/hosts/thinkpad/default.nix @@ -8,9 +8,10 @@ ./hardware-configuration.nix ./modules/autorandr ./modules/networks - ./modules/lightdm + #./modules/lightdm + #./modules/gdm ../../shared/vim.nix - ../../shared/input.nix + #../../shared/input.nix ../../shared/sops.nix ../../shared/gpg.nix ../../shared/zsh-fix.nix @@ -29,9 +30,9 @@ services.xserver = { enable = true; - displayManager = { - defaultSession = "none+awesome"; - }; + #displayManager = { + #defaultSession = "none+awesome"; + #}; windowManager.awesome = { enable = true; luaModules = with pkgs.luaPackages; [ diff --git a/hosts/thinkpad/modules/gdm/default.nix b/hosts/thinkpad/modules/gdm/default.nix new file mode 100644 index 0000000..a31ce17 --- /dev/null +++ b/hosts/thinkpad/modules/gdm/default.nix @@ -0,0 +1,6 @@ +{ config, pkgs, ... }: +{ + services.xserver.displayManager.gdm = { + enable = true; + }; +} diff --git a/shared/input.nix b/shared/input.nix index 2d91e55..87be135 100644 --- a/shared/input.nix +++ b/shared/input.nix @@ -6,13 +6,15 @@ # Configure keymap in X11 services.xserver.layout = "us"; services.xserver.xkbVariant = "dvorak-alt-intl"; - services.xserver.displayManager.sessionCommands = - "${pkgs.xorg.xmodmap}/bin/xmodmap ${pkgs.writeText "xkb-layout" '' - keycode 108 = Mode_switch - keycode 94 = Shift_L NoSymbol Shift_L - keysym a = a A adiaeresis Adiaeresis - keysym o = o O odiaeresis Odiaeresis - keysym u = u U udiaeresis Udiaeresis - keysym s = s S ssharp - ''}"; + + # Port this to wayland TODO. doesn't even work with gdm lmao + #services.xserver.displayManager.setupCommands = + #"${pkgs.xorg.xmodmap}/bin/xmodmap ${pkgs.writeText "xkb-layout" '' + #keycode 108 = Mode_switch + #keycode 94 = Shift_L NoSymbol Shift_L + #keysym a = a A adiaeresis Adiaeresis + #keysym o = o O odiaeresis Odiaeresis + #keysym u = u U udiaeresis Udiaeresis + #keysym s = s S ssharp + #''}"; } diff --git a/users/rouven/modules/default.nix b/users/rouven/modules/default.nix index 2a97049..30111d9 100644 --- a/users/rouven/modules/default.nix +++ b/users/rouven/modules/default.nix @@ -9,9 +9,10 @@ ./fzf ./git ./gpg + ./hyprland ./kdeconnect ./neovim - ./picom + #./picom ./ssh ./tmux ./vifm diff --git a/users/rouven/modules/hyprland/default.nix b/users/rouven/modules/hyprland/default.nix new file mode 100644 index 0000000..d8ca26f --- /dev/null +++ b/users/rouven/modules/hyprland/default.nix @@ -0,0 +1,5 @@ +{ config, ... }: +{ + wayland.windowManager.hyprland.enable = true; + xdg.configFile."hypr/hyprland.conf".source = ./hyprland.conf; +} diff --git a/users/rouven/modules/hyprland/hyprland.conf b/users/rouven/modules/hyprland/hyprland.conf new file mode 100644 index 0000000..a1767dc --- /dev/null +++ b/users/rouven/modules/hyprland/hyprland.conf @@ -0,0 +1,160 @@ + +######################################################################################## +AUTOGENERATED HYPR CONFIG. +PLEASE USE THE CONFIG PROVIDED IN THE GIT REPO /examples/hypr.conf AND EDIT IT, +OR EDIT THIS ONE ACCORDING TO THE WIKI INSTRUCTIONS. +######################################################################################## + +# +# Please note not all available settings / options are set here. +# For a full list, see the wiki +# + +# See https://wiki.hyprland.org/Configuring/Monitors/ +monitor=,preferred,auto,auto + + +# See https://wiki.hyprland.org/Configuring/Keywords/ for more + +# Execute your favorite apps at launch +# exec-once = waybar & hyprpaper & firefox + +# Source a file (multi-file configs) +# source = ~/.config/hypr/myColors.conf + +# For all categories, see https://wiki.hyprland.org/Configuring/Variables/ +input { + kb_layout = us + kb_variant = dvorak-alt-intl + kb_model = + kb_options = + kb_rules = + + follow_mouse = 1 + + touchpad { + natural_scroll = no + } + + sensitivity = 0 # -1.0 - 1.0, 0 means no modification. +} + +general { + # See https://wiki.hyprland.org/Configuring/Variables/ for more + + gaps_in = 5 + gaps_out = 20 + border_size = 2 + col.active_border = rgba(33ccffee) rgba(00ff99ee) 45deg + col.inactive_border = rgba(595959aa) + + layout = dwindle +} + +decoration { + # See https://wiki.hyprland.org/Configuring/Variables/ for more + + rounding = 10 + blur = yes + blur_size = 3 + blur_passes = 1 + blur_new_optimizations = on + + drop_shadow = yes + shadow_range = 4 + shadow_render_power = 3 + col.shadow = rgba(1a1a1aee) +} + +animations { + enabled = yes + + # Some default animations, see https://wiki.hyprland.org/Configuring/Animations/ for more + + bezier = myBezier, 0.05, 0.9, 0.1, 1.05 + + animation = windows, 1, 7, myBezier + animation = windowsOut, 1, 7, default, popin 80% + animation = border, 1, 10, default + animation = fade, 1, 7, default + animation = workspaces, 1, 6, default +} + +dwindle { + # See https://wiki.hyprland.org/Configuring/Dwindle-Layout/ for more + pseudotile = yes # master switch for pseudotiling. Enabling is bound to mainMod + P in the keybinds section below + preserve_split = yes # you probably want this +} + +master { + # See https://wiki.hyprland.org/Configuring/Master-Layout/ for more + new_is_master = true +} + +gestures { + # See https://wiki.hyprland.org/Configuring/Variables/ for more + workspace_swipe = off +} + +# Example per-device config +# See https://wiki.hyprland.org/Configuring/Keywords/#executing for more +device:epic mouse V1 { + sensitivity = -0.5 +} + +# Example windowrule v1 +# windowrule = float, ^(kitty)$ +# Example windowrule v2 +# windowrulev2 = float,class:^(kitty)$,title:^(kitty)$ +# See https://wiki.hyprland.org/Configuring/Window-Rules/ for more + + +# See https://wiki.hyprland.org/Configuring/Keywords/ for more +$mainMod = SUPER + +# Example binds, see https://wiki.hyprland.org/Configuring/Binds/ for more +bind = $mainMod, O, exec, alacritty +bind = $mainMod, C, killactive, +bind = $mainMod, M, exit, +bind = $mainMod, V, togglefloating, +bind = $mainMod, R, exec, wofi --show drun +bind = $mainMod, P, pseudo, # dwindle +bind = $mainMod, J, togglesplit, # dwindle + +# Move focus with mainMod + arrow keys +bind = $mainMod, left, movefocus, l +bind = $mainMod, right, movefocus, r +bind = $mainMod, up, movefocus, u +bind = $mainMod, down, movefocus, d + +# Switch workspaces with mainMod + [0-9] +bind = $mainMod, 1, workspace, 1 +bind = $mainMod, 2, workspace, 2 +bind = $mainMod, 3, workspace, 3 +bind = $mainMod, 4, workspace, 4 +bind = $mainMod, 5, workspace, 5 +bind = $mainMod, 6, workspace, 6 +bind = $mainMod, 7, workspace, 7 +bind = $mainMod, 8, workspace, 8 +bind = $mainMod, 9, workspace, 9 +bind = $mainMod, 0, workspace, 10 + +# Move active window to a workspace with mainMod + SHIFT + [0-9] +bind = $mainMod SHIFT, 1, movetoworkspace, 1 +bind = $mainMod SHIFT, 2, movetoworkspace, 2 +bind = $mainMod SHIFT, 3, movetoworkspace, 3 +bind = $mainMod SHIFT, 4, movetoworkspace, 4 +bind = $mainMod SHIFT, 5, movetoworkspace, 5 +bind = $mainMod SHIFT, 6, movetoworkspace, 6 +bind = $mainMod SHIFT, 7, movetoworkspace, 7 +bind = $mainMod SHIFT, 8, movetoworkspace, 8 +bind = $mainMod SHIFT, 9, movetoworkspace, 9 +bind = $mainMod SHIFT, 0, movetoworkspace, 10 + +# Scroll through existing workspaces with mainMod + scroll +bind = $mainMod, mouse_down, workspace, e+1 +bind = $mainMod, mouse_up, workspace, e-1 + +# Move/resize windows with mainMod + LMB/RMB and dragging +bindm = $mainMod, mouse:272, movewindow +bindm = $mainMod, mouse:273, resizewindow