move overrides to overlay.nix

This commit is contained in:
Kopatz
2024-05-20 12:27:28 +02:00
parent effdbf8ac5
commit e9c3f0871c
8 changed files with 350 additions and 368 deletions

View File

@@ -1 +1,9 @@
My NixOS setup My NixOS setup
## options
I put my options under the `custom` key.
For example: `custom.graphical.plasma.enable = true;`
## pkgs
To build some of the custom pkgs you need a ssh key linked to github with access to my repos.

View File

@@ -1,9 +1,7 @@
{ config, osConfig, pkgs, inputs, lib, ... }: { config, osConfig, pkgs, inputs, lib, ... }:
with lib; with lib;
let let cfg = osConfig.custom.graphical.hyprland;
cfg = osConfig.custom.graphical.hyprland; in {
in
{
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
programs.swaylock.enable = true; programs.swaylock.enable = true;
wayland.windowManager.hyprland = { wayland.windowManager.hyprland = {
@@ -27,7 +25,8 @@ in
# laptop # laptop
"eDP-1,3840x2160@60,0x0,2" "eDP-1,3840x2160@60,0x0,2"
"DP-3,1920x1080@60,1920x0,1" "DP-3,1920x1080@60,1920x0,1"
] else [ ] else
[
# Default # Default
",preferred,auto,auto" ",preferred,auto,auto"
]; ];
@@ -53,9 +52,7 @@ in
follow_mouse = 1; follow_mouse = 1;
touchpad = { touchpad = { natural_scroll = true; };
natural_scroll = true;
};
sensitivity = 0; # -1.0 - 1.0, 0 means no modification. sensitivity = 0; # -1.0 - 1.0, 0 means no modification.
}; };
@@ -100,14 +97,13 @@ in
#animation = border, 1, 10, default #animation = border, 1, 10, default
#animation = borderangle, 1, 8, default #animation = borderangle, 1, 8, default
#animation = fade, 1, 7, default #animation = fade, 1, 7, default
animation = [ animation = [ "workspaces, 0" ];
"workspaces, 0"
];
}; };
dwindle = { dwindle = {
# See https://wiki.hyprland.org/Configuring/Dwindle-Layout/ for more # See https://wiki.hyprland.org/Configuring/Dwindle-Layout/ for more
pseudotile = true; # master switch for pseudotiling. Enabling is bound to mainMod + P in the keybinds section below pseudotile =
true; # master switch for pseudotiling. Enabling is bound to mainMod + P in the keybinds section below
preserve_split = true; # you probably want this preserve_split = true; # you probably want this
}; };
@@ -133,7 +129,6 @@ in
# float,class:^(kitty)$,title:^(kitty)$ # float,class:^(kitty)$,title:^(kitty)$
# See https://wiki.hyprland.org/Configuring/Window-Rules/ for more # See https://wiki.hyprland.org/Configuring/Window-Rules/ for more
# See https://wiki.hyprland.org/Configuring/Keywords/ for more # See https://wiki.hyprland.org/Configuring/Keywords/ for more
"$mainMod" = "SUPER"; "$mainMod" = "SUPER";
@@ -161,7 +156,8 @@ in
"$mainMod, F, fullscreen" "$mainMod, F, fullscreen"
"$mainMod, V, togglefloating" "$mainMod, V, togglefloating"
"$mainMod, I, exec, ${rofi} -show drun -show-icons" "$mainMod, I, exec, ${rofi} -show drun -show-icons"
"$mainMod, S, exec, cat ~/songs | shuf -n 1 | sed \"s/^/b\.p /g\" | ${wl-copy}" ''
$mainMod, S, exec, cat ~/songs | shuf -n 1 | sed "s/^/b.p /g" | ${wl-copy}''
"$mainMod, R, exec, ${swww} img $(ls -d /synced/default/dinge/Bg/* | shuf -n 1)" "$mainMod, R, exec, ${swww} img $(ls -d /synced/default/dinge/Bg/* | shuf -n 1)"
" , Print, exec, ${grim} -g \"$(${slurp} -d)\" - | ${wl-copy}" " , Print, exec, ${grim} -g \"$(${slurp} -d)\" - | ${wl-copy}"
"ALT, SPACE, exec, ${rofi} -show combi" "ALT, SPACE, exec, ${rofi} -show combi"
@@ -234,7 +230,6 @@ in
#"immediate, class:^(Risk.*)$" #"immediate, class:^(Risk.*)$"
]; ];
exec-once = [ exec-once = [
"${pkgs.swww}/bin/swww init; sleep 1;" "${pkgs.swww}/bin/swww init; sleep 1;"
"${pkgs.swww} img $(ls -d /synced/default/dinge/Bg/* | shuf -n 1)" "${pkgs.swww} img $(ls -d /synced/default/dinge/Bg/* | shuf -n 1)"

View File

@@ -1,9 +1,7 @@
{ config, osConfig, pkgs, inputs, lib, ... }: { config, osConfig, pkgs, inputs, lib, ... }:
with lib; with lib;
let let cfg = osConfig.custom.graphical.hyprland;
cfg = osConfig.custom.graphical.hyprland; in {
in
{
config = let config = let
# styles from https://github.com/khaneliman/khanelinix/blob/8375f8cfbe5bfd87565b4dc34c9d30630c17336d/modules/home/desktop/addons/waybar/default.nix # styles from https://github.com/khaneliman/khanelinix/blob/8375f8cfbe5bfd87565b4dc34c9d30630c17336d/modules/home/desktop/addons/waybar/default.nix
theme = builtins.readFile ./styles/catppuccin.css; theme = builtins.readFile ./styles/catppuccin.css;
@@ -27,21 +25,14 @@ in
"hyprland/workspaces" "hyprland/workspaces"
#"hyprland/window" #"hyprland/window"
]; ];
modules-center = []; modules-center = [ ];
modules-right = [ modules-right = [ "group/stats" "group/other" ];
"group/stats"
"group/other"
];
"cpu" = { "cpu" = {
"format" = " {usage}%"; "format" = " {usage}%";
"tooltip" = true; "tooltip" = true;
}; };
"disk" = { "disk" = { "format" = " {percentage_used}%"; };
"format" = " {percentage_used}%"; "memory" = { "format" = "󰍛 {}%"; };
};
"memory" = {
"format" = "󰍛 {}%";
};
"idle_inhibitor" = { "idle_inhibitor" = {
"format" = "{icon} "; "format" = "{icon} ";
@@ -81,10 +72,7 @@ in
"phone" = ""; "phone" = "";
"portable" = ""; "portable" = "";
"car" = ""; "car" = "";
"default" = [ "default" = [ "" "" ];
""
""
];
}; };
"scroll-step" = 1; "scroll-step" = 1;
"on-click" = "${pkgs.pavucontrol}/bin/pavucontrol"; "on-click" = "${pkgs.pavucontrol}/bin/pavucontrol";
@@ -99,38 +87,28 @@ in
"temperature".critical-threshold = 80; "temperature".critical-threshold = 80;
"temperature".format = "{temperatureC}°C "; "temperature".format = "{temperatureC}°C ";
"temperature".interval = 5; "temperature".interval = 5;
"temperature".hwmon-path = lib.mkIf (osConfig.networking.hostName == "nix-laptop") "/sys/class/hwmon/hwmon6/temp1_input"; "temperature".hwmon-path =
lib.mkIf (osConfig.networking.hostName == "nix-laptop")
"/sys/class/hwmon/hwmon6/temp1_input";
"backlight".format = "{percent}% {icon}"; "backlight".format = "{percent}% {icon}";
"backlight".states = [0 50]; "backlight".states = [ 0 50 ];
"backlight".format-icons = ["" ""]; "backlight".format-icons = [ "" "" ];
"battery".states.good = 95; "battery".states.good = 95;
"battery".states.warning = 30; "battery".states.warning = 30;
"battery".states.critical = 15; "battery".states.critical = 15;
"battery".format = "{capacity}% / {power:.2}W {icon}"; "battery".format = "{capacity}% / {power:.2}W {icon}";
"battery".format-icons = ["" "" "" "" ""]; "battery".format-icons = [ "" "" "" "" "" ];
"clock".format = "{:%F %H:%M}"; "clock".format = "{:%F %H:%M}";
"clock".tooltip-format = "<tt><small>{calendar}</small></tt>"; "clock".tooltip-format = "<tt><small>{calendar}</small></tt>";
"tray".icon-size = 21; "tray".icon-size = 21;
"tray".spacing = 10; "tray".spacing = 10;
"group/stats" = { "group/stats" = {
"orientation" = "horizontal"; "orientation" = "horizontal";
"modules" = [ "modules" = [ "network" "cpu" "memory" "disk" "temperature" ];
"network"
"cpu"
"memory"
"disk"
"temperature"
];
}; };
"group/other" = { "group/other" = {
"orientation" = "horizontal"; "orientation" = "horizontal";
"modules" = [ "modules" = [ "tray" "backlight" "pulseaudio" "battery" "clock" ];
"tray"
"backlight"
"pulseaudio"
"battery"
"clock"
];
}; };
"hyprland/window" = { "hyprland/window" = {
"format" = "{}"; "format" = "{}";
@@ -174,7 +152,8 @@ in
"class<firefox-beta>" = ""; "class<firefox-beta>" = "";
"class<firefox-developer-edition>" = ""; "class<firefox-developer-edition>" = "";
"class<firefox> title<.*github.*>" = ""; "class<firefox> title<.*github.*>" = "";
"class<firefox> title<.*twitch|youtube|plex|tntdrama|bally sports.*>" = ""; "class<firefox> title<.*twitch|youtube|plex|tntdrama|bally sports.*>" =
"";
"class<kitty>" = ""; "class<kitty>" = "";
"class<org.wezfurlong.wezterm>" = ""; "class<org.wezfurlong.wezterm>" = "";
"class<mediainfo-gui>" = "󱂷"; "class<mediainfo-gui>" = "󱂷";
@@ -200,7 +179,8 @@ in
}; };
}; };
}; };
style = "${theme}${style}${notificationsStyle}${powerStyle}${statsStyle}${workspacesStyle}"; style =
"${theme}${style}${notificationsStyle}${powerStyle}${statsStyle}${workspacesStyle}";
}; };
}; };
} }

View File

@@ -1,9 +1,7 @@
{config, pkgs, lib, inputs, ... }: { config, pkgs, lib, inputs, ... }:
with lib; with lib;
let let cfg = config.custom.graphical.hyprland;
cfg = config.custom.graphical.hyprland; in {
in
{
options.custom.graphical.hyprland = { options.custom.graphical.hyprland = {
enable = mkEnableOption "Enables hyprland"; enable = mkEnableOption "Enables hyprland";
}; };
@@ -11,28 +9,27 @@ in
enable = mkEnableOption "Enables xwaylandvideobridge for hyprland"; enable = mkEnableOption "Enables xwaylandvideobridge for hyprland";
}; };
config = let config = mkIf cfg.enable {
patchedWaybar = pkgs.unstable.waybar.overrideAttrs (oldAttrs: { mesonFlags = oldAttrs.mesonFlags ++ [ "-Dexperimental=true" ]; });
in mkIf cfg.enable {
services.xserver = { services.xserver = {
xkb.layout = config.mainUser.layout; xkb.layout = config.mainUser.layout;
xkb.variant = config.mainUser.variant; xkb.variant = config.mainUser.variant;
enable = true; enable = true;
displayManager = mkIf (!config.services.xserver.displayManager.sddm.enable) { displayManager =
mkIf (!config.services.xserver.displayManager.sddm.enable) {
gdm.enable = true; gdm.enable = true;
}; };
}; };
environment.sessionVariables = { environment.sessionVariables = {
WLR_NO_HARDWARE_CURSORS="1"; WLR_NO_HARDWARE_CURSORS = "1";
#WLR_DRM_NO_ATOMIC="1"; #WLR_DRM_NO_ATOMIC="1";
#WLR_DRM_DEVICES = "/dev/dri/card0"; #WLR_DRM_DEVICES = "/dev/dri/card0";
LIBVA_DRIVER_NAME="nvidia"; LIBVA_DRIVER_NAME = "nvidia";
# black screen :( # black screen :(
#XDG_SESSION_TYPE = "wayland"; #XDG_SESSION_TYPE = "wayland";
GBM_BACKEND = "nvidia-drm"; GBM_BACKEND = "nvidia-drm";
__GLX_VENDOR_LIBRARY_NAME = "nvidia"; __GLX_VENDOR_LIBRARY_NAME = "nvidia";
WLR_RENDERER_ALLOW_SOFTWARE="1"; WLR_RENDERER_ALLOW_SOFTWARE = "1";
}; };
hardware = { hardware = {
@@ -64,7 +61,6 @@ in
# $ nix search wget # $ nix search wget
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
# hyprland stuff # hyprland stuff
patchedWaybar
dunst dunst
swww swww
rofi-wayland rofi-wayland

View File

@@ -20,7 +20,7 @@ in
fonts.packages = with pkgs; [ fonts.packages = with pkgs; [
#uw-ttyp0 #uw-ttyp0
corefonts corefonts
(nerdfonts.override { fonts = ["Hack" "Noto"]; }) nerdfonts
#noto-fonts #noto-fonts
#noto-fonts-emoji #noto-fonts-emoji
noto-fonts-cjk noto-fonts-cjk

View File

@@ -34,7 +34,7 @@ in {
let nerdfonts = pkgs.nerdfonts.override { fonts = [ "Hack" "Noto" ]; }; let nerdfonts = pkgs.nerdfonts.override { fonts = [ "Hack" "Noto" ]; };
in mkIf cfg.enable { in mkIf cfg.enable {
stylix = { stylix = {
autoEnable = true; autoEnable = mkForce true;
polarity = "dark"; polarity = "dark";
image = cfg.image; image = cfg.image;
override = cfg.override; override = cfg.override;

View File

@@ -7,6 +7,9 @@
# You can change versions, add patches, set compilation flags, anything really. # You can change versions, add patches, set compilation flags, anything really.
# https://nixos.wiki/wiki/Overlays # https://nixos.wiki/wiki/Overlays
modifications = final: prev: { modifications = final: prev: {
discord = prev.discord.override { withVencord = true; };
nerdfonts = prev.nerdfonts.override { fonts = ["Hack" "Noto"]; };
waybar = prev.waybar.overrideAttrs (oldAttrs: { mesonFlags = oldAttrs.mesonFlags ++ [ "-Dexperimental=true" ]; });
# example = prev.example.overrideAttrs (oldAttrs: rec { # example = prev.example.overrideAttrs (oldAttrs: rec {
# ... # ...
# }); # });

View File

@@ -24,7 +24,7 @@
shell = pkgs.zsh; shell = pkgs.zsh;
extraGroups = [ "networkmanager" "wheel" "docker" ]; extraGroups = [ "networkmanager" "wheel" "docker" ];
packages = with pkgs; [ packages = with pkgs; [
(discord.override { withVencord = true; }) discord
brave brave
]; ];
openssh.authorizedKeys.keys = [ config.mainUser.sshKey ]; openssh.authorizedKeys.keys = [ config.mainUser.sshKey ];