more laptop config

This commit is contained in:
Vivian 2022-08-24 23:44:40 +02:00
parent c79f514dbe
commit 4fed5d2c38
6 changed files with 92 additions and 48 deletions

View file

@ -187,11 +187,11 @@
"utils": "utils_2"
},
"locked": {
"lastModified": 1661323822,
"narHash": "sha256-1UGGcQ00uSo5cPTwL7C3S1zkcScbpF0WzspvnceWkbQ=",
"lastModified": 1661371005,
"narHash": "sha256-PfWRIyJQhBtVhENqmVcI+C9kisctmzos+nrH+feGX3U=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "1d81e6295ca530603478114f4977402d51299ad8",
"rev": "b382b59faf717c5b36f4cd8e1c5d96cdabd382c9",
"type": "github"
},
"original": {
@ -206,11 +206,11 @@
"wlroots": "wlroots"
},
"locked": {
"lastModified": 1661332451,
"narHash": "sha256-Ikd8XUJ3rQLYz6z+OMrecpXD2CvrPHM3VIfadkpxGTI=",
"lastModified": 1661371527,
"narHash": "sha256-gOfHnXvncOW3+zTAMFFMgVqFOBcTaI4gdiKBd7gN7go=",
"owner": "hyprwm",
"repo": "Hyprland",
"rev": "9366c187dce5ed5104f85898c8d3a8531f221e3e",
"rev": "e92469121d37af387cb7fa507ae6ac6225cb9ebc",
"type": "github"
},
"original": {

View file

@ -0,0 +1,2 @@
# null
This folder contains the NixOS configuration for my laptop, with hostname `null`.

View file

@ -9,8 +9,26 @@ let
export __NV_PRIME_RENDER_OFFLOAD_PROVIDER=NVIDIA-G0
export __GLX_VENDOR_LIBRARY_NAME=nvidia
export __VK_LAYER_NV_optimus=NVIDIA_only
export LIBVA_DRIVER_NAME=nvidia
export GBM_BACKEND=nvidia-drm
exec "$@"
'';
run-hyprland = pkgs.writeShellScriptBin "run-hyprland" ''
export _JAVA_AWT_WM_NONREPARENTING=1
export XCURSOR_SIZE=24
export CLUTTER_BACKEND=wayland
export XDG_SESSION_TYPE=wayland
export QT_WAYLAND_DISABLE_WINDOWDECORATION=1
export MOZ_ENABLE_WAYLAND=1
export WLR_NO_HARDWARE_CURSORS=1
export WLR_BACKEND=vulkan
export QT_QPA_PLATFORM=wayland
export GDK_BACKEND=wayland
exec Hyprland
'';
in
{
imports =
@ -27,6 +45,8 @@ in
inputs.hyprland.homeManagerModules.default
];
programs.light.enable = true;
fonts = {
fonts = with pkgs; [
material-design-icons
@ -71,7 +91,6 @@ in
};
};
# Select internationalisation properties.
i18n.defaultLocale = "en_GB.utf8";
@ -87,20 +106,12 @@ in
LC_TIME = "en_DK.utf8";
};
# Enable the X11 windowing system.
# services.xserver.enable = true;
# Enable the GNOME Desktop Environment.
# services.xserver.displayManager.gdm.enable = true;
# services.xserver.desktopManager.gnome.enable = true;
# services.udev.packages = with pkgs; [ gnome.gnome-settings-daemon ];
xdg = {
portal = {
enable = true;
wlr.enable = true;
extraPortals = with pkgs; [
# xdg-desktop-portal-gtk
xdg-desktop-portal-gtk
];
};
};
@ -111,7 +122,14 @@ in
package = null; # Managed by home manager
};
environment.loginShellInit = ''
if [[ "$(tty)" == /dev/tty1 ]]; then
${run-hyprland}/bin/run-hyprland
fi
'';
services.xserver = {
# enable = true;
layout = "us";
xkbVariant = "altgr-intl";
xkbOptions = "caps:swapescape";
@ -119,15 +137,24 @@ in
};
# hardware.nvidia.modesetting.enable = true;
hardware.nvidia.prime = {
offload.enable = true;
intelBusId = "PCI:0:2:0";
nvidiaBusId = "PCI:1:0:0";
hardware.nvidia = {
# open = true;
prime = {
offload.enable = true;
intelBusId = "PCI:0:2:0";
nvidiaBusId = "PCI:1:0:0";
};
};
hardware.opengl.extraPackages = with pkgs; [
vaapiVdpau
];
hardware.opengl = {
enable = true;
extraPackages = with pkgs; [
vaapiVdpau
intel-media-driver # LIBVA_DRIVER_NAME=iHD
vaapiIntel # LIBVA_DRIVER_NAME=i965 (older but works better for Firefox/Chromium)
libvdpau-va-gl
];
};
virtualisation.podman.enable = true;
@ -154,14 +181,11 @@ in
environment.systemPackages = with pkgs; [
pciutils
nvidia-offload
run-hyprland
vim
wireguard-tools
slurp
#gnome.gnome-tweaks
#gnome.dconf-editor
#gnomeExtensions.appindicator
#gnomeExtensions.wireguard-indicator
gdb
];
programs.steam = {

View file

@ -8,8 +8,37 @@
grim # Screenshot tool
wf-recorder # Screenrecorder
wl-clipboard # Clipboard manager
networkmanager_dmenu
];
home.file.".config/networkmanager-dmenu/config.ini".text = ''
[dmenu]
dmenu_command = rofi -dmenu -i
# # Note that dmenu_command can contain arguments as well like:
# # `dmenu_command = rofi -dmenu -i -theme nmdm`
# # `dmenu_command = rofi -dmenu -width 30 -i`
# # `dmenu_command = dmenu -i -l 25 -b -nb #909090 -nf #303030`
# (Default: False) use rofi highlighting instead of '=='
rofi_highlight = true
# compact = <True or False> # (Default: False). Remove extra spacing from display
# pinentry = <Pinentry command> # (Default: None) e.g. `pinentry-gtk`
# wifi_chars = <string of 4 unicode characters representing 1-4 bars strength>
wifi_chars =
# list_saved = <True or False> # (Default: False) list saved connections
[dmenu_passphrase]
# # Uses the -password flag for Rofi, -x for bemenu. For dmenu, sets -nb and
# # -nf to the same color or uses -P if the dmenu password patch is applied
# # https://tools.suckless.org/dmenu/patches/password/
# obscure = True
# obscure_color = #222222
[editor]
# terminal = <name of terminal program>
terminal = alacritty
# gui_if_available = <True or False> (Default: True)
'';
wayland.windowManager.hyprland = {
enable = true;
extraConfig = ''
@ -18,6 +47,7 @@
monitor=eDP-1,1920x1080@60,0x0,1
monitor=eDP-1,addreserved,0,0,48,0
monitor=,preferred,auto,1
general {
layout = dwindle
@ -48,7 +78,7 @@
bind=,Print,exec,grim -g "$(slurp)" - | wl-copy -t image/png
bind=SUPER,W,killactive,
bind=SUPER,M,exit,
bind=SUPERSHIFT,Q,exit,
bind=SUPER,S,togglefloating,
bind=SUPER,P,pseudo,
@ -93,13 +123,11 @@
windowrule=rounding 3,title:^(\s*)$
windowrule=animation popin,title:^(\s*)$
bind=,XF86MonBrightnessUp,exec,brightnessctl set +5%
bind=,XF86MonBrightnessDown,exec,brightnessctl set 5%-
bind=,XF86MonBrightnessUp,exec,light -A 5
bind=,XF86MonBrightnessDown,exec,light -U 5
bind=,XF86MonRaiseVolume,exec,pamixer -i 5
bind=,XF86MonLowerVolume,exec,pamixer -d 5
bind=,XF86AudioMute,exec,pamixer -t
animation=workspaces,1,8,default,slidevert
'';
};
}

View file

@ -1,7 +1,6 @@
{ pkgs, ... }: {
home.packages = with pkgs; [
eww-wayland
brightnessctl
pamixer
lua
(nerdfonts.override { fonts = [ "JetBrainsMono" ]; })

View file

@ -1,26 +1,17 @@
#!/usr/bin/env lua
function trim(s)
return (string.gsub(s, "^%s*(.-)%s*$", "%1"))
end
aw = io.popen("hyprctl monitors | grep active | sed 's/()/(1)/g' | sort | awk 'NR>1{print $1}' RS='(' FS=')'")
active_workspace = aw:read("*a")
aw:close()
ew = io.popen("hyprctl workspaces | grep ID | sed 's/()/(1)/g' | sort | awk 'NR>1{print $1}' RS='(' FS=')'")
existing_workspaces = ew:read("*a")
ew:close()
box = "(box :orientation \"v\" :spacing 1 :space-evenly \"true\" "
for i = 1, #existing_workspaces do
local c = existing_workspaces:sub(i,i)
if tonumber(c) == tonumber(active_workspace) then
local btn = "(button :class \"active\" :onclick \"hyprctl dispatch workspace "..c.." \" \"\")"
for i = 1,10 do
if i == tonumber(active_workspace) then
local btn = "(button :class \"active\" :onclick \"hyprctl dispatch workspace "..i.." \" \"\")"
box = box .. btn
elseif c ~= "\n" then
local btn = "(button :class \"inactive\" :onclick \"hyprctl dispatch workspace "..c.."\" \"\")"
else
local btn = "(button :class \"inactive\" :onclick \"hyprctl dispatch workspace "..i.."\" \"\")"
box = box .. btn
end
end