New Hyprland setup

pull/6/head
Tudor Roman 2023-07-12 16:33:05 +02:00
parent f33f9fe181
commit a45f753741
Signed by: tudor
SSH Key Fingerprint: SHA256:3CwS9plgXBecpXImPGxDIaSktUXBejbV/zerZMqzzBk
13 changed files with 579 additions and 29 deletions

View File

@ -51,7 +51,7 @@
"locked": {
"lastModified": 1653679518,
"narHash": "sha256-DWrxMilNdFHWJxvIVaM+49eAuld91BRfcVC6TCHeL2I=",
"ref": "refs/heads/master",
"ref": "master",
"rev": "158ffbd94baae1796273a36dbb3bbcd190cb5757",
"revCount": 28,
"type": "git",
@ -71,11 +71,11 @@
"utils": "utils_3"
},
"locked": {
"lastModified": 1683779844,
"narHash": "sha256-sIeOU0GsCeQEn5TpqE/jFRN4EGsPsjqVRsPdrzIDABM=",
"lastModified": 1686747123,
"narHash": "sha256-XUQK9kwHpTeilHoad7L4LjMCCyY13Oq383CoFADecRE=",
"owner": "serokell",
"repo": "deploy-rs",
"rev": "c80189917086e43d49eece2bd86f56813500a0eb",
"rev": "724463b5a94daa810abfc64a4f87faef4e00f984",
"type": "github"
},
"original": {
@ -152,11 +152,11 @@
"systems": "systems"
},
"locked": {
"lastModified": 1681202837,
"narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=",
"lastModified": 1685518550,
"narHash": "sha256-o2d0KcvaXzTrPRIo0kOLV0/QXHhDQ5DTi+OxcjO8xqY=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "cfacdce06f30d2b68473a46042957675eebb3401",
"rev": "a1720a10a6cfe8234c0e93907ffe81be440f4cef",
"type": "github"
},
"original": {
@ -172,11 +172,11 @@
]
},
"locked": {
"lastModified": 1685599623,
"narHash": "sha256-Tob4CMOVHue0D3RzguDBCtUmX5ji2PsdbQDbIOIKvsc=",
"lastModified": 1687871164,
"narHash": "sha256-bBFlPthuYX322xOlpJvkjUBz0C+MOBjZdDOOJJ+G2jU=",
"owner": "rycee",
"repo": "home-manager",
"rev": "93db05480c0c0f30382d3e80779e8386dcb4f9dd",
"rev": "07c347bb50994691d7b0095f45ebd8838cf6bc38",
"type": "github"
},
"original": {
@ -196,11 +196,11 @@
"xdph": "xdph"
},
"locked": {
"lastModified": 1687020577,
"narHash": "sha256-FUKfxkQtuFVN17vIDDykEPQobEcY5i8LAw6BiDABsYI=",
"lastModified": 1688856272,
"narHash": "sha256-4DRSX1ELf9Me/RVt8nmxwTKrDweQHoZg5/wCUL0ER9E=",
"owner": "hyprwm",
"repo": "Hyprland",
"rev": "74ca81cc7942aa93e796ca794185675bae57003d",
"rev": "b33d82734fb3b88b87e1c89cbf2ec8883ea029ac",
"type": "github"
},
"original": {
@ -253,11 +253,11 @@
},
"nixos-hardware": {
"locked": {
"lastModified": 1684899633,
"narHash": "sha256-NtwerXX8UFsoNy6k+DukJMriWtEjQtMU/Urbff2O2Dg=",
"lastModified": 1688798314,
"narHash": "sha256-MFG5rx7L756rtrPHsL662m64AZ4sKqUcApaiYgSKfNM=",
"owner": "NixOS",
"repo": "nixos-hardware",
"rev": "4cc688ee711159b9bcb5a367be44007934e1a49d",
"rev": "47dca15d86fdd2eabcf434d7cc0b5baa8d1a463c",
"type": "github"
},
"original": {
@ -276,11 +276,11 @@
]
},
"locked": {
"lastModified": 1682982995,
"narHash": "sha256-PK0pSY48JkcLDFphafjpLqeTDs0XUqGMHjsiNuEq5s0=",
"lastModified": 1688393327,
"narHash": "sha256-UHibyCq4nbnbsNE1SL4p87mYn0PLoGNn1ULXrpLeTRA=",
"owner": "nix-community",
"repo": "NixOS-WSL",
"rev": "c5d7db84c422be515dac8fc26420900c349374e8",
"rev": "0982e9ab209aee459ed3331ab4eadbb4d8a023e1",
"type": "github"
},
"original": {
@ -323,11 +323,11 @@
},
"nixpkgs_3": {
"locked": {
"lastModified": 1685533922,
"narHash": "sha256-y4FCQpYafMQ42l1V+NUrMel9RtFtZo59PzdzflKR/lo=",
"lastModified": 1688868408,
"narHash": "sha256-RR9N5XTAxSBhK8MCvLq9uxfdkd7etC//seVXldy0k48=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "3a70dd92993182f8e514700ccf5b1ae9fc8a3b8d",
"rev": "510d721ce097150ae3b80f84b04b13b039186571",
"type": "github"
},
"original": {
@ -442,11 +442,11 @@
},
"unstable": {
"locked": {
"lastModified": 1685383865,
"narHash": "sha256-3uQytfnotO6QJv3r04ajSXbEFMII0dUtw0uqYlZ4dbk=",
"lastModified": 1688679045,
"narHash": "sha256-t3xGEfYIwhaLTPU8FLtN/pLPytNeDwbLI6a7XFFBlGo=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "5e871d8aa6f57cc8e0dc087d1c5013f6e212b4ce",
"rev": "3c7487575d9445185249a159046cc02ff364bff8",
"type": "github"
},
"original": {

View File

@ -66,6 +66,7 @@
inherit system;
config.allowUnfree = true;
overlays = [
inputs.hyprland.overlays.default
(final: prev: {
tudor.site = inputs.site.packages.${system}.site;
tudor.blog = inputs.blog.packages.${system}.blog;

View File

@ -0,0 +1,52 @@
{ config, options, lib, inputs, pkgs, ... }:
let
cfg = config.homeModules.desktop.alacritty;
in
with lib; {
options = {
homeModules.desktop.alacritty = {
enable = mkEnableOption "Enable alacritty";
};
};
config = mkIf cfg.enable {
programs.alacritty = {
enable = true;
settings = {
window.padding = { x = 20; y = 20; };
font.normal = { family = "Berkeley Mono"; style = "Regular"; };
font.size = 16;
# https://git.tcp.direct/moony/alacritty-theme/src/branch/master/themes/gruvbox_light.yaml
# but converted from yaml to json and pasted here
colors = builtins.fromJSON ''
{
"primary": {
"background": "0xfbf1c7",
"foreground": "0x3c3836"
},
"normal": {
"black": "0xfbf1c7",
"red": "0xcc241d",
"green": "0x98971a",
"yellow": "0xd79921",
"blue": "0x458588",
"magenta": "0xb16286",
"cyan": "0x689d6a",
"white": "0x7c6f64"
},
"bright": {
"black": "0x928374",
"red": "0x9d0006",
"green": "0x79740e",
"yellow": "0xb57614",
"blue": "0x076678",
"magenta": "0x8f3f71",
"cyan": "0x427b58",
"white": "0x3c3836"
}
}
'';
};
};
};
}

View File

@ -1,6 +1,9 @@
{ ... }: {
imports = [
./alacritty.nix
./fonts.nix
./hyprland.nix
./nixgl.nix
./waybar
];
}

View File

@ -0,0 +1,15 @@
{ config, options, lib, inputs, pkgs, ... }:
let
cfg = config.homeModules.desktop.fonts;
in
with lib; {
options = {
homeModules.desktop.fonts = {
enable = mkEnableOption "Enable fonts";
};
};
config = mkIf cfg.enable {
fonts.fontconfig.enable = true;
};
}

View File

@ -7,12 +7,26 @@ with lib; {
homeModules.desktop.hyprland = {
enable = mkEnableOption "Enable Hyprland";
nixGLSupport = mkEnableOption "Use NixGL when starting Hyprland";
wallpaperPath = mkOption {
description = "Path to wallpaper to apply";
type = types.str;
default = "/usr/share/backgrounds/f38/default/f38-01-day.png";
};
};
};
config = {
config = mkIf cfg.enable {
services.mako.enable = true;
home.packages = [ pkgs.xdg-desktop-portal-hyprland ];
wayland.windowManager.hyprland = {
enable = true;
xwayland = {
enable = true;
hidpi = true;
};
package = let
system = pkgs.stdenv.hostPlatform.system;
nixGL = inputs.nixgl.packages.${system}.default;
@ -26,9 +40,102 @@ with lib; {
ln -s ${origPkg}/* $out
rm $out/bin
mkdir $out/bin
ln -s ${origPkg}/bin/* $out/bin/
rm $out/bin/Hyprland
echo "exec ${lib.getExe nixGL} ${origPkg}/bin/Hyprland \$@" > $out/bin/Hyprland
chmod +x $out/bin/Hyprland
'') else origPkg;
extraConfig = let
playerctl = "${pkgs.playerctl}/bin/playerctl";
brightnessctl = "${pkgs.brightnessctl}/bin/brightnessctl";
pamixer = "${pkgs.pamixer}/bin/pamixer";
volStep = toString 5;
brightStep = toString 5;
in ''
env = SSH_ASKPASS,${pkgs.ksshaskpass.out}/bin/ksshaskpass
exec-once = mako
exec-once = /usr/libexec/kf5/polkit-kde-authentication-agent-1
exec-once = ${pkgs.swaybg}/bin/swaybg -i ${cfg.wallpaperPath}
input {
kb_layout = ro
touchpad {
# having this not the default is absolutely evil
natural_scroll = true
}
}
decoration {
blur = false
drop_shadow = false
}
misc {
vfr = true
}
animations {
# why don't I use sway at this point
enabled = false
}
monitor = desc:LG Electronics LG HDR 4K 0x0008D101,preferred,0x0,2
# main monitor is 4k, but because it has 2x scaling, it takes 1920 logical pixels
monitor = eDP-1,preferred,1920x0,1
monitor = ,preferred,auto,1
$mainMod = SUPER
bind = $mainMod, Return, exec, nixGL alacritty
bind = $mainMod SHIFT, Return, exec, ${pkgs.xterm}/bin/xterm
bind = $mainMod, M, exit,
bind = $mainMod, space, exec, ${pkgs.wofi}/bin/wofi --show drun
bind = $mainMod, Q, killactive,
bind = $mainMod SHIFT, F, togglefloating,
# requires swaylock being installed.
# on non nixos setups, it must be installed by the system package manager
bind = $mainMod, L, exec, swaylock
bind=,XF86AudioPlay,exec,${playerctl} play
bind=,XF86AudioPause,exec,${playerctl} pause
bind=,XF86AudioPrev,exec,${playerctl} previous
bind=,XF86AudioNext,exec,${playerctl} next
bind=,XF86AudioStop,exec,${playerctl} stop
bind=,XF86AudioRaiseVolume,exec,${pamixer} --increase ${volStep}
bind=,XF86AudioLowerVolume,exec,${pamixer} --decrease ${volStep}
bind=,XF86AudioMute,exec,${pamixer} --toggle-mute
bind=,XF86AudioMicMute,exec,${pamixer} --default-source --toggle-mute
bind=,XF86MonBrightnessUp,exec,${brightnessctl} set +${brightStep}%
bind=,XF86MonBrightnessDown,exec,${brightnessctl} set ${brightStep}%-
bindm = $mainMod, mouse:272, movewindow
bindm = $mainMod, mouse:273, resizewindow
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
'';
};
};
}

View File

@ -0,0 +1,60 @@
{ config, pkgs, lib, options, inputs, ... }:
let
cfg = config.homeModules.desktop.waybar;
in
with lib; {
options = {
homeModules.desktop.waybar = {
enable = mkEnableOption "Enable Waybar";
hyprland = mkEnableOption "Auto-start with hyprland systemd session";
};
};
config = mkIf cfg.enable {
home.packages = with pkgs; [
font-awesome_6
inter
];
programs.waybar = let
enableSystemd = cfg.hyprland == true;
systemdTarget = if cfg.hyprland then "hyprland-session.target" else "";
in {
enable = true;
package = pkgs.waybar-hyprland;
systemd.enable = enableSystemd;
systemd.target = systemdTarget;
style = builtins.readFile ./style.css;
settings.mainBar = {
layer = "top";
position = "top";
height = 45;
modules-left = [ "wlr/workspaces" ];
modules-center = [ "clock" ];
modules-right = [ "tray" "battery" "pulseaudio" ];
battery = {
format-charging = " {capacity}%";
format = "{icon} {capacity}%";
format-icons = [ "" "" "" "" "" ];
};
pulseaudio = {
format = "{icon} {volume}%";
format-icons = [ "" "" "" ];
format-muted = " {volume}% (Muted)";
on-click = "pactl set-sink-mute 0 toggle";
};
"wlr/workspaces" = {
on-click = "activate";
all-outputs = true;
};
tray.show-passive-items = true;
};
};
};
}

View File

@ -0,0 +1,280 @@
* {
/* `otf-font-awesome` is required to be installed for icons */
font-family: Inter, "Font Awesome 6 Free";
font-size: 13px;
}
window#waybar {
background-color: rgba(43, 48, 59, 0.5);
color: #ffffff;
transition-property: background-color;
transition-duration: .5s;
}
window#waybar.hidden {
opacity: 0.2;
}
/*
window#waybar.empty {
background-color: transparent;
}
window#waybar.solo {
background-color: #FFFFFF;
}
*/
window#waybar.termite {
background-color: #3F3F3F;
}
window#waybar.chromium {
background-color: #000000;
border: none;
}
button {
/* Use box-shadow instead of border so the text isn't offset */
box-shadow: inset 0 -3px transparent;
/* Avoid rounded borders under each button name */
border: none;
border-radius: 0;
}
#workspaces button {
padding: 0 5px;
background-color: transparent;
color: #ffffff;
}
#workspaces button:hover {
background: rgba(255, 255, 255, 0.2);
}
#workspaces button.active {
background-color: #64727D;
box-shadow: inset 0 -3px #ffffff;
}
#workspaces button.urgent {
background-color: #eb4d4b;
}
#mode {
background-color: #64727D;
border-bottom: 3px solid #ffffff;
}
#clock,
#battery,
#cpu,
#memory,
#disk,
#temperature,
#backlight,
#network,
#pulseaudio,
#wireplumber,
#custom-media,
#tray,
#mode,
#idle_inhibitor,
#scratchpad,
#mpd {
padding: 0px 10px;
margin: 6px 4px;
color: #ffffff;
border-radius: 8px;
}
#workspaces {
margin: 6px 4px;
border-radius: 8px;
background-color: rgba(0, 0, 0, 0.2);
}
#workspaces button:first-child {
border-top-left-radius: 8px;
border-bottom-left-radius: 8px;
}
#workspaces button:last-child {
border-top-right-radius: 8px;
border-bottom-right-radius: 8px;
}
#clock {
background-color: #64727D;
}
#battery {
background-color: #ffffff;
color: #000000;
}
#battery.charging, #battery.plugged {
color: #ffffff;
background-color: #26A65B;
}
@keyframes blink {
to {
background-color: #ffffff;
color: #000000;
}
}
#battery.critical:not(.charging) {
background-color: #f53c3c;
color: #ffffff;
animation-name: blink;
animation-duration: 0.5s;
animation-timing-function: linear;
animation-iteration-count: infinite;
animation-direction: alternate;
}
label:focus {
background-color: #000000;
}
#cpu {
background-color: #2ecc71;
color: #000000;
}
#memory {
background-color: #9b59b6;
}
#disk {
background-color: #964B00;
}
#backlight {
background-color: #90b1b1;
}
#network {
background-color: #2980b9;
}
#network.disconnected {
background-color: #f53c3c;
}
#pulseaudio {
background-color: #f1c40f;
color: #000000;
}
#pulseaudio.muted {
background-color: #90b1b1;
color: #2a5c45;
}
#wireplumber {
background-color: #fff0f5;
color: #000000;
}
#wireplumber.muted {
background-color: #f53c3c;
}
#custom-media {
background-color: #66cc99;
color: #2a5c45;
min-width: 100px;
}
#custom-media.custom-spotify {
background-color: #66cc99;
}
#custom-media.custom-vlc {
background-color: #ffa000;
}
#temperature {
background-color: #f0932b;
}
#temperature.critical {
background-color: #eb4d4b;
}
#tray {
background-color: #2980b9;
}
#tray > .passive {
-gtk-icon-effect: dim;
}
#tray > .needs-attention {
-gtk-icon-effect: highlight;
background-color: #eb4d4b;
}
#tray widget image {
margin: 0 2px;
}
#idle_inhibitor {
background-color: #2d3436;
}
#idle_inhibitor.activated {
background-color: #ecf0f1;
color: #2d3436;
}
#mpd {
background-color: #66cc99;
color: #2a5c45;
}
#mpd.disconnected {
background-color: #f53c3c;
}
#mpd.stopped {
background-color: #90b1b1;
}
#mpd.paused {
background-color: #51a37a;
}
#language {
background: #00b093;
color: #740864;
padding: 0 5px;
margin: 0 5px;
min-width: 16px;
}
#keyboard-state {
background: #97e1ad;
color: #000000;
padding: 0 0px;
margin: 0 5px;
min-width: 16px;
}
#keyboard-state > label {
padding: 0 5px;
}
#keyboard-state > label.locked {
background: rgba(0, 0, 0, 0.2);
}
#scratchpad {
background: rgba(0, 0, 0, 0.2);
}
#scratchpad.empty {
background-color: transparent;
}

View File

@ -8,5 +8,6 @@
./hx.nix
./neovim.nix
./op.nix
./tmux.nix
];
}

View File

@ -6,6 +6,7 @@ with lib; {
options = {
homeModules.tools.git = {
enable = mkEnableOption "Enable Git config";
opCommitSign = mkEnableOption "Enable commit signing with SSH keys from 1Password";
};
};
@ -23,12 +24,12 @@ with lib; {
'';
};
extraConfig = {
extraConfig = {} // (if cfg.opCommitSign then {
user.signingkey = removeSuffix "\n" (builtins.readFile ../../../id_ed25519.pub);
gpg.format = "ssh";
gpg.ssh.allowedSignersFile = "~/.ssh/allowed_signers";
gpg.ssh.program = "/opt/1Password/op-ssh-sign";
commit.gpgsign = true;
};
} else {});
};
home.file.".ssh/allowed_signers".text = ''

View File

@ -0,0 +1,21 @@
{ config, options, pkgs, lib, ... }:
let
cfg = config.homeModules.tools.tmux;
in
with lib; {
options = {
homeModules.tools.tmux = {
enable = mkEnableOption "Enable Tmux";
};
};
config = mkIf cfg.enable {
programs.tmux = {
enable = true;
sensibleOnTop = true;
extraConfig = ''
set -as terminal-features ",*:RGB"
'';
};
};
}

View File

@ -28,6 +28,7 @@
op = {
enable = true;
};
tmux.enable = true;
};
};
}

View File

@ -3,10 +3,18 @@
imports = [ ../tudor ];
homeModules = {
tools = {
git.opCommitSign = true;
};
desktop = {
alacritty.enable = true;
fonts.enable = true;
nixgl.enable = true;
hyprland.enable = true;
hyprland.nixGLSupport = true;
waybar.enable = true;
waybar.hyprland = true;
};
};
}