add hyprland and eww config

This commit is contained in:
Leonardo Eugênio 2022-08-20 17:46:03 -03:00
parent 30abda4469
commit 0b6fb9ddca
9 changed files with 341 additions and 7 deletions

View file

@ -94,6 +94,27 @@
"type": "github" "type": "github"
} }
}, },
"hyprland": {
"inputs": {
"nixpkgs": [
"nixpkgs-unstable"
],
"wlroots": "wlroots"
},
"locked": {
"lastModified": 1661019364,
"narHash": "sha256-syJlCuf3idpfdgvYPkWJMgaixGhJPcVeYx8Bl3Z1CvY=",
"owner": "hyprwm",
"repo": "Hyprland",
"rev": "08e874bcf91e524059ceaf8a757c463d412b7136",
"type": "github"
},
"original": {
"owner": "hyprwm",
"repo": "Hyprland",
"type": "github"
}
},
"material-wifi-icons": { "material-wifi-icons": {
"flake": false, "flake": false,
"locked": { "locked": {
@ -192,6 +213,7 @@
"alacritty-sixel": "alacritty-sixel", "alacritty-sixel": "alacritty-sixel",
"dhist": "dhist", "dhist": "dhist",
"home-manager": "home-manager", "home-manager": "home-manager",
"hyprland": "hyprland",
"material-wifi-icons": "material-wifi-icons", "material-wifi-icons": "material-wifi-icons",
"nixpkgs": "nixpkgs_2", "nixpkgs": "nixpkgs_2",
"nixpkgs-unstable": "nixpkgs-unstable", "nixpkgs-unstable": "nixpkgs-unstable",
@ -215,6 +237,24 @@
"repo": "rust-analyzer", "repo": "rust-analyzer",
"type": "github" "type": "github"
} }
},
"wlroots": {
"flake": false,
"locked": {
"host": "gitlab.freedesktop.org",
"lastModified": 1660930713,
"narHash": "sha256-bY7q1NqG/sjCUAWPn/Ne9NCigLlPlH5Lk1WCMqv3rTU=",
"owner": "wlroots",
"repo": "wlroots",
"rev": "7c575922c05e4d5fd9a403c2aa631a54c7531d44",
"type": "gitlab"
},
"original": {
"host": "gitlab.freedesktop.org",
"owner": "wlroots",
"repo": "wlroots",
"type": "gitlab"
}
} }
}, },
"root": "root", "root": "root",

View file

@ -7,6 +7,11 @@
home-manager.inputs.nixpkgs.follows = "nixpkgs"; home-manager.inputs.nixpkgs.follows = "nixpkgs";
nur.url = "github:nix-community/NUR"; nur.url = "github:nix-community/NUR";
hyprland = {
url = "github:hyprwm/Hyprland";
inputs.nixpkgs.follows = "nixpkgs-unstable";
};
alacritty-sixel.url = "github:microo8/alacritty-sixel"; alacritty-sixel.url = "github:microo8/alacritty-sixel";
alacritty-sixel.flake = false; alacritty-sixel.flake = false;
@ -19,8 +24,7 @@
# my stuff # my stuff
dhist.url = "github:lelgenio/dhist"; dhist.url = "github:lelgenio/dhist";
}; };
outputs = { nixpkgs, nixpkgs-unstable, home-manager, alacritty-sixel outputs = inputs@{ nixpkgs, nixpkgs-unstable, home-manager, nur, ... }:
, ranger-sixel, material-wifi-icons, nur, dhist, ... }:
let let
system = "x86_64-linux"; system = "x86_64-linux";
pkgs = import nixpkgs { pkgs = import nixpkgs {
@ -39,16 +43,21 @@
common_modules = [ common_modules = [
./system/configuration.nix ./system/configuration.nix
# nur.nixosModules.nur # nur.nixosModules.nur
inputs.hyprland.nixosModules.default
{
programs.hyprland.enable = true;
# programs.hyprland.package = null;
}
({ config, pkgs, ... }: { ({ config, pkgs, ... }: {
nixpkgs.overlays = [ nixpkgs.overlays = [
overlay-unstable overlay-unstable
nur.overlay nur.overlay
(_: old-pkgs: { (_: old-pkgs: {
uservars = import ./user/variables.nix; uservars = import ./user/variables.nix;
dhist = dhist.packages.${system}.dhist; dhist = inputs.dhist.packages.${system}.dhist;
alacritty = (old-pkgs.alacritty.overrideAttrs alacritty = (old-pkgs.alacritty.overrideAttrs
(old-alacritty: rec { (old-alacritty: rec {
src = alacritty-sixel; src = inputs.alacritty-sixel;
cargoDeps = old-alacritty.cargoDeps.overrideAttrs cargoDeps = old-alacritty.cargoDeps.overrideAttrs
(old-pkgs.lib.const { (old-pkgs.lib.const {
inherit src; inherit src;
@ -57,14 +66,14 @@
}); });
})); }));
ranger = (old-pkgs.ranger.overridePythonAttrs (old-ranger: rec { ranger = (old-pkgs.ranger.overridePythonAttrs (old-ranger: rec {
src = ranger-sixel; src = inputs.ranger-sixel;
checkInputs = [ ]; checkInputs = [ ];
propagatedBuildInputs = with old-pkgs.python3Packages; propagatedBuildInputs = with old-pkgs.python3Packages;
old-ranger.propagatedBuildInputs ++ [ astroid pylint pytest ]; old-ranger.propagatedBuildInputs ++ [ astroid pylint pytest ];
})); }));
material-wifi-icons = pkgs.stdenv.mkDerivation rec { material-wifi-icons = pkgs.stdenv.mkDerivation rec {
name = "material-wifi-icons"; name = "material-wifi-icons";
src = material-wifi-icons; src = inputs.material-wifi-icons;
installPhase = let dest = "$out/share/fonts/${name}"; installPhase = let dest = "$out/share/fonts/${name}";
in '' in ''
mkdir -p ${dest} mkdir -p ${dest}
@ -83,6 +92,9 @@
home-manager.backupFileExtension = "bkp"; home-manager.backupFileExtension = "bkp";
# Optionally, use home-manager.extraSpecialArgs to pass # Optionally, use home-manager.extraSpecialArgs to pass
# arguments to home.nix # arguments to home.nix
home-manager.extraSpecialArgs = {
inherit inputs;
};
} }
]; ];
in { in {

View file

@ -237,6 +237,10 @@ in {
networking.firewall.enable = false; networking.firewall.enable = false;
security.sudo.wheelNeedsPassword = false; security.sudo.wheelNeedsPassword = false;
nix = { nix = {
settings = {
substituters = ["https://hyprland.cachix.org"];
trusted-public-keys = ["hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc="];
};
package = pkgs.nixFlakes; # or versioned attributes like nixVersions.nix_2_8 package = pkgs.nixFlakes; # or versioned attributes like nixVersions.nix_2_8
extraOptions = '' extraOptions = ''
experimental-features = nix-command flakes experimental-features = nix-command flakes

61
user/eww/eww.scss Normal file
View file

@ -0,0 +1,61 @@
* {
all: unset; //Unsets everything so you can style everything from scratch
}
//Global Styles
.bar {
background-color: #202020;
color: #b0b4bc;
padding: 10px;
}
// Styles on classes (see eww.yuck for more information)
.sidestuff slider {
all: unset;
color: #cc5757;
}
.metric scale trough highlight {
all: unset;
background-color: #D35D6E;
color: #000000;
border-radius: 10px;
}
.metric scale trough {
all: unset;
background-color: #4e4e4e;
border-radius: 50px;
min-height: 3px;
min-width: 50px;
margin-left: 10px;
margin-right: 20px;
}
.metric scale trough highlight {
all: unset;
background-color: #D35D6E;
color: #000000;
border-radius: 10px;
}
.metric scale trough {
all: unset;
background-color: #4e4e4e;
border-radius: 50px;
min-height: 3px;
min-width: 50px;
margin-left: 10px;
margin-right: 20px;
}
.label-ram {
font-size: large;
}
.workspaces button:hover {
color: #D35D6E;
}
.workspaces button.active {
color: #D35D6E;
}

80
user/eww/eww.yuck Normal file
View file

@ -0,0 +1,80 @@
(defwidget bar []
(centerbox :orientation "h"
(workspaces)
(music)
(sidestuff)))
(defwidget sidestuff []
(box :class "sidestuff" :orientation "h" :space-evenly false :halign "end"
; (metric :label "🔊"
; :value volume
; :onchange "amixer -D pulse sset Master {}%")
(metric :label ""
:value {EWW_RAM.used_mem_perc}
:onchange "")
(metric :label "💾"
:value {round((1 - (EWW_DISK["/"].free / EWW_DISK["/"].total)) * 100, 0)}
:onchange "")
time))
(defwidget workspaces []
(box :class "workspaces"
:orientation "h"
:space-evenly true
:halign "start"
:spacing 10
(button :class "${active_workspace == 1 ? 'active' : '' }" :onclick "wmctrl -s 0" 1)
(button :class "${active_workspace == 2 ? 'active' : '' }" :onclick "wmctrl -s 1" 2)
(button :class "${active_workspace == 3 ? 'active' : '' }" :onclick "wmctrl -s 2" 3)
(button :class "${active_workspace == 4 ? 'active' : '' }" :onclick "wmctrl -s 3" 4)
(button :class "${active_workspace == 5 ? 'active' : '' }" :onclick "wmctrl -s 4" 5)
(button :class "${active_workspace == 6 ? 'active' : '' }" :onclick "wmctrl -s 5" 6)
(button :class "${active_workspace == 7 ? 'active' : '' }" :onclick "wmctrl -s 6" 7)
(button :class "${active_workspace == 8 ? 'active' : '' }" :onclick "wmctrl -s 7" 8)
(button :class "${active_workspace == 9 ? 'active' : '' }" :onclick "wmctrl -s 8" 9)))
(defwidget music []
(box :class "music"
:orientation "h"
:space-evenly false
:halign "center"
{music != "" ? "🎵${music}" : ""}))
(defwidget metric [label value onchange]
(box :orientation "h"
:class "metric"
:space-evenly false
(box :class "label" label)
(scale :min 0
:max 101
:active {onchange != ""}
:value value
:onchange onchange)))
(deflisten music :initial ""
"playerctl --follow metadata --format '{{ artist }} - {{ title }}' || true")
; (defpoll volume :interval "1s"
; "scripts/getvol")
(defpoll time :interval "10s"
"date '+%H:%M %b %d, %Y'")
(defpoll active_workspace :interval "10ms"
"hyprctl monitors -j | jq '.[]|.activeWorkspace.id'")
(defwindow bar
:monitor 0
:windowtype "dock"
:geometry (geometry :x "0%"
:y "0%"
:width "100%"
:height "10px"
:anchor "top center")
:reserve (struts :side "top" :distance "4%")
:exclusive true
(bar))

2
user/eww/scripts/getram Executable file
View file

@ -0,0 +1,2 @@
#!/bin/sh
printf "%.0f\n" $(free -m | grep Mem | awk '{print ($3/$2)*100}')

2
user/eww/scripts/getvol Executable file
View file

@ -0,0 +1,2 @@
#!/bin/sh
amixer -D pulse sget Master | grep 'Left:' | awk -F'[][]' '{ print $2 }' | tr -d '%' | head -1

View file

@ -1,4 +1,4 @@
{ config, pkgs, lib, ... }: { config, pkgs, lib, inputs,... }:
let let
inherit (import ./variables.nix) key theme color accent font; inherit (import ./variables.nix) key theme color accent font;
@ -15,11 +15,13 @@ in {
./helix.nix ./helix.nix
./kakoune.nix ./kakoune.nix
./sway.nix ./sway.nix
./hyprland.nix
./git.nix ./git.nix
./qutebrowser ./qutebrowser
./gpg.nix ./gpg.nix
./rofi.nix ./rofi.nix
./rnnoise.nix ./rnnoise.nix
inputs.hyprland.homeManagerModules.default
]; ];
# Home Manager needs a bit of information about you and the # Home Manager needs a bit of information about you and the
# paths it should manage. # paths it should manage.
@ -39,6 +41,7 @@ in {
home.packages = with pkgs; [ home.packages = with pkgs; [
alacritty alacritty
terminal # see flake.nix terminal # see flake.nix
waybar
exa exa
fd fd
_diffr _diffr

130
user/hyprland.nix Normal file
View file

@ -0,0 +1,130 @@
{ config, pkgs, lib, ... }: {
config = {
wayland.windowManager.hyprland = {
enable = false;
extraConfig = ''
monitor=,preferred,auto,1
input {
kb_file=
kb_layout=us(colemak)
kb_variant=
kb_model=
kb_options=
kb_rules=
follow_mouse=1
touchpad {
natural_scroll=no
}
}
general {
sensitivity=1.0 # for mouse cursor
main_mod=SUPER
gaps_in=5
gaps_out=10
border_size=2
col.active_border=0xffF44336
col.inactive_border=0x66333333
apply_sens_to_raw=0 # whether to apply the sensitivity to raw input (e.g. used by games where you aim using your mouse)
damage_tracking=full # leave it on full unless you hate your GPU and want to make it suffer
}
decoration {
rounding=5
blur=1
blur_size=3 # minimum 1
blur_passes=1 # minimum 1, more passes = more resource intensive.
# Your blur "amount" is blur_size * blur_passes, but high blur_size (over around 5-ish) will produce artifacts.
# if you want heavy blur, you need to up the blur_passes.
# the more passes, the more you can up the blur_size without noticing artifacts.
}
animations {
enabled=1
animation=windows,1,7,default
animation=border,1,10,default
animation=fade,1,10,default
animation=workspaces,1,6,default
}
dwindle {
pseudotile=0 # enable pseudotiling on dwindle
}
gestures {
workspace_swipe=no
}
# example window rules
# for windows named/classed as abc and xyz
#windowrule=move 69 420,abc
#windowrule=size 420 69,abc
#windowrule=tile,xyz
#windowrule=float,abc
#windowrule=pseudo,abc
#windowrule=monitor 0,xyz
# example binds
bind=SUPER,Q,exec,kitty
bind=SUPER,RETURN,exec,alacritty
bind=SUPER,x,killactive,
bind=SUPER,M,exit,
# bind=SUPER,E,exec,dolphin
bind=SUPER,V,togglefloating,
bind=SUPER,s,exec,wlauncher
bind=SUPER,P,pseudo,
bind=SUPER,f,fullscreen
bind=SUPER,n,movefocus,l
bind=SUPER,o,movefocus,r
bind=SUPER,i,movefocus,u
bind=SUPER,e,movefocus,d
bind=SUPER,left,movefocus,l
bind=SUPER,right,movefocus,r
bind=SUPER,up,movefocus,u
bind=SUPER,down,movefocus,d
bind=SUPER,1,workspace,1
bind=SUPER,2,workspace,2
bind=SUPER,3,workspace,3
bind=SUPER,4,workspace,4
bind=SUPER,5,workspace,5
bind=SUPER,6,workspace,6
bind=SUPER,7,workspace,7
bind=SUPER,8,workspace,8
bind=SUPER,9,workspace,9
bind=SUPER,0,workspace,10
bind=ALT,1,movetoworkspace,1
bind=ALT,2,movetoworkspace,2
bind=ALT,3,movetoworkspace,3
bind=ALT,4,movetoworkspace,4
bind=ALT,5,movetoworkspace,5
bind=ALT,6,movetoworkspace,6
bind=ALT,7,movetoworkspace,7
bind=ALT,8,movetoworkspace,8
bind=ALT,9,movetoworkspace,9
bind=ALT,0,movetoworkspace,10
bind=SUPER,u,workspace,e-1
bind=SUPER,y,workspace,e+1
bind=SUPER,mouse_down,workspace,e-1
bind=SUPER,mouse_up,workspace,e+1
'';
};
home.file.".config/eww".source = ./eww;
home.packages = with pkgs; [
eww-wayland
jq
];
};
}