add wezterm flake. make nvidia module
This commit is contained in:
parent
a04bbb02cc
commit
63fd57d7ba
7 changed files with 268 additions and 114 deletions
184
flake.lock
184
flake.lock
|
@ -225,6 +225,41 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-utils_3": {
|
||||
"inputs": {
|
||||
"systems": "systems_3"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1710146030,
|
||||
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"freetype2": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1687587065,
|
||||
"narHash": "sha256-+Fh+/k+NWL5Ow9sDLtp8Cv/8rLNA1oByQQCIQS/bysY=",
|
||||
"owner": "wez",
|
||||
"repo": "freetype2",
|
||||
"rev": "e4586d960f339cf75e2e0b34aee30a0ed8353c0d",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "wez",
|
||||
"repo": "freetype2",
|
||||
"rev": "e4586d960f339cf75e2e0b34aee30a0ed8353c0d",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"fromYaml": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
|
@ -310,6 +345,23 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"harfbuzz": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1711722720,
|
||||
"narHash": "sha256-GdxcAPx5QyniSHPAN1ih28AD9JLUPR0ItqW9JEsl3pU=",
|
||||
"owner": "harfbuzz",
|
||||
"repo": "harfbuzz",
|
||||
"rev": "63973005bc07aba599b47fdd4cf788647b601ccd",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "harfbuzz",
|
||||
"ref": "8.4.0",
|
||||
"repo": "harfbuzz",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"home-manager": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
|
@ -372,6 +424,23 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"libpng": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1549245649,
|
||||
"narHash": "sha256-1+cRp0Ungme/OGfc9kGJbklYIWAFxk8Il1M+NV4KSgw=",
|
||||
"owner": "glennrp",
|
||||
"repo": "libpng",
|
||||
"rev": "8439534daa1d3a5705ba92e653eda9251246dd61",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "glennrp",
|
||||
"repo": "libpng",
|
||||
"rev": "8439534daa1d3a5705ba92e653eda9251246dd61",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nix-darwin": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
|
@ -395,11 +464,11 @@
|
|||
},
|
||||
"nixos-hardware": {
|
||||
"locked": {
|
||||
"lastModified": 1724878143,
|
||||
"narHash": "sha256-UjpKo92iZ25M05kgSOw/Ti6VZwpgdlOa73zHj8OcaDk=",
|
||||
"lastModified": 1725477728,
|
||||
"narHash": "sha256-ahej1VRqKmWbG7gewty+GlrSBEeGY/J2Zy8Nt8+3fdg=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixos-hardware",
|
||||
"rev": "95c3dfe6ef2e96ddc1ccdd7194e3cda02ca9a8ef",
|
||||
"rev": "880be1ab837e1e9fe0449dae41ac4d034694d4ce",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -410,11 +479,11 @@
|
|||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1725103162,
|
||||
"narHash": "sha256-Ym04C5+qovuQDYL/rKWSR+WESseQBbNAe5DsXNx5trY=",
|
||||
"lastModified": 1725432240,
|
||||
"narHash": "sha256-+yj+xgsfZaErbfYM3T+QvEE2hU7UuE+Jf0fJCJ8uPS0=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "12228ff1752d7b7624a54e9c1af4b222b3c1073b",
|
||||
"rev": "ad416d066ca1222956472ab7d0555a6946746a80",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -455,11 +524,11 @@
|
|||
"treefmt-nix": "treefmt-nix"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1725269752,
|
||||
"narHash": "sha256-AtZ9fSo2q6UeMoDy6kw6solM1B+BCABbKgCyUclsctg=",
|
||||
"lastModified": 1725499492,
|
||||
"narHash": "sha256-IjpbYl4ljZ6gffzfH/n2qYbtu7PZ1KM2LW+cVL6w1bk=",
|
||||
"owner": "nix-community",
|
||||
"repo": "nixvim",
|
||||
"rev": "18b7597e6ca4b98a6c3f20ddc9783165d5998018",
|
||||
"rev": "e48da949cf41597d43f8e3880fc1389129ad7427",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -498,7 +567,29 @@
|
|||
"nixvim": "nixvim",
|
||||
"shells": "shells",
|
||||
"sops-nix": "sops-nix",
|
||||
"stylix": "stylix"
|
||||
"stylix": "stylix",
|
||||
"wezterm": "wezterm"
|
||||
}
|
||||
},
|
||||
"rust-overlay": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"wezterm",
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1721441897,
|
||||
"narHash": "sha256-gYGX9/22tPNeF7dR6bWN5rsrpU4d06GnQNNgZ6ZiXz0=",
|
||||
"owner": "oxalica",
|
||||
"repo": "rust-overlay",
|
||||
"rev": "b7996075da11a2d441cfbf4e77c2939ce51506fd",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "oxalica",
|
||||
"repo": "rust-overlay",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"shells": {
|
||||
|
@ -526,11 +617,11 @@
|
|||
"nixpkgs-stable": "nixpkgs-stable"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1725201042,
|
||||
"narHash": "sha256-lj5pxOwidP0W//E7IvyhbhXrnEUW99I07+QpERnzTS4=",
|
||||
"lastModified": 1725540166,
|
||||
"narHash": "sha256-htc9rsTMSAY5ek+DB3tpntdD/es0eam2hJgO92bWSys=",
|
||||
"owner": "Mic92",
|
||||
"repo": "sops-nix",
|
||||
"rev": "5db5921e40ae382d6716dce591ea23b0a39d96f7",
|
||||
"rev": "d9d781523a1463965cd1e1333a306e70d9feff07",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -558,11 +649,11 @@
|
|||
"systems": "systems_2"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1725273590,
|
||||
"narHash": "sha256-/GY7CIsOmNW4XGUjKI8sedd9Go6jFSmRMLjaUAtCYw0=",
|
||||
"lastModified": 1725290973,
|
||||
"narHash": "sha256-+jwXF9KI0HfvDgpsoJGvOdfOGGSKOrID1wQB79zjUbo=",
|
||||
"owner": "danth",
|
||||
"repo": "stylix",
|
||||
"rev": "c95de3625235390b7a5160bddaae7243a89f811f",
|
||||
"rev": "ef81ad9e85e60420cc83d4642619c14b57139d33",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -601,6 +692,21 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"systems_3": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"treefmt-nix": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
|
@ -621,6 +727,52 @@
|
|||
"repo": "treefmt-nix",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"wezterm": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils_3",
|
||||
"freetype2": "freetype2",
|
||||
"harfbuzz": "harfbuzz",
|
||||
"libpng": "libpng",
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
],
|
||||
"rust-overlay": "rust-overlay",
|
||||
"zlib": "zlib"
|
||||
},
|
||||
"locked": {
|
||||
"dir": "nix",
|
||||
"lastModified": 1723525023,
|
||||
"narHash": "sha256-ZsDJQSUokodwFMP4FIZm2dYojf5iC4F/EeKC5VuQlqY=",
|
||||
"owner": "wez",
|
||||
"repo": "wezterm",
|
||||
"rev": "30345b36d8a00fed347e4df5dadd83915a7693fb",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"dir": "nix",
|
||||
"owner": "wez",
|
||||
"ref": "main",
|
||||
"repo": "wezterm",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"zlib": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1484501380,
|
||||
"narHash": "sha256-j5b6aki1ztrzfCqu8y729sPar8GpyQWIrajdzpJC+ww=",
|
||||
"owner": "madler",
|
||||
"repo": "zlib",
|
||||
"rev": "cacf7f1d4e3d44d871b605da3b647f07d718623f",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "madler",
|
||||
"ref": "v1.2.11",
|
||||
"repo": "zlib",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
|
|
|
@ -23,6 +23,10 @@
|
|||
url = "github:danth/stylix";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
wezterm = {
|
||||
url = "github:wez/wezterm/main?dir=nix";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
nixos-hardware.url = "github:NixOS/nixos-hardware";
|
||||
};
|
||||
|
||||
|
@ -32,6 +36,7 @@
|
|||
system = "x86_64-linux";
|
||||
|
||||
commonModules = hostname: [
|
||||
./modules
|
||||
./hosts/common
|
||||
./hosts/${hostname}
|
||||
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
imports = [
|
||||
./git.nix
|
||||
./gnupg.nix
|
||||
./nixvim
|
||||
./wezterm.nix
|
||||
./nixvim
|
||||
./browsers.nix
|
||||
./miscellaneous.nix
|
||||
];
|
||||
|
|
|
@ -1,62 +1,43 @@
|
|||
{ ... }:
|
||||
|
||||
{ inputs, pkgs, ... }:
|
||||
{
|
||||
# WebGpu / Nvidia bug (also crashes on AMD drivers): https://github.com/wez/wezterm/issues/6050
|
||||
# Rendering broken in master: https://github.com/NixOS/nixpkgs/issues/336069
|
||||
programs.wezterm = {
|
||||
enable = true;
|
||||
package = inputs.wezterm.packages.${pkgs.system}.default;
|
||||
extraConfig = ''
|
||||
local w = require('wezterm')
|
||||
local w = require('wezterm')
|
||||
|
||||
-- if you are *NOT* lazy-loading smart-splits.nvim (recommended)
|
||||
local function is_vim(pane)
|
||||
-- this is set by the plugin, and unset on ExitPre in Neovim
|
||||
return pane:get_user_vars().IS_NVIM == 'true'
|
||||
end
|
||||
local function is_vim(pane)
|
||||
return pane:get_user_vars().IS_NVIM == 'true'
|
||||
end
|
||||
|
||||
-- if you *ARE* lazy-loading smart-splits.nvim (not recommended)
|
||||
-- you have to use this instead, but note that this will not work
|
||||
-- in all cases (e.g. over an SSH connection). Also note that
|
||||
-- `pane:get_foreground_process_name()` can have high and highly variable
|
||||
-- latency, so the other implementation of `is_vim()` will be more
|
||||
-- performant as well.
|
||||
local function is_vim(pane)
|
||||
-- This gsub is equivalent to POSIX basename(3)
|
||||
-- Given "/foo/bar" returns "bar"
|
||||
-- Given "c:\\foo\\bar" returns "bar"
|
||||
local process_name = string.gsub(pane:get_foreground_process_name(), '(.*[/\\])(.*)', '%2')
|
||||
return process_name == 'nvim' or process_name == 'vim'
|
||||
end
|
||||
|
||||
local direction_keys = {
|
||||
h = 'Left',
|
||||
j = 'Down',
|
||||
k = 'Up',
|
||||
l = 'Right',
|
||||
}
|
||||
|
||||
local function split_nav(resize_or_move, key)
|
||||
return {
|
||||
key = key,
|
||||
mods = resize_or_move == 'resize' and 'META' or 'CTRL',
|
||||
action = w.action_callback(function(win, pane)
|
||||
if is_vim(pane) then
|
||||
-- pass the keys through to vim/nvim
|
||||
win:perform_action({
|
||||
SendKey = { key = key, mods = resize_or_move == 'resize' and 'META' or 'CTRL' },
|
||||
}, pane)
|
||||
else
|
||||
if resize_or_move == 'resize' then
|
||||
win:perform_action({ AdjustPaneSize = { direction_keys[key], 3 } }, pane)
|
||||
else
|
||||
win:perform_action({ ActivatePaneDirection = direction_keys[key] }, pane)
|
||||
end
|
||||
end
|
||||
end),
|
||||
local direction_keys = {
|
||||
h = 'Left',
|
||||
j = 'Down',
|
||||
k = 'Up',
|
||||
l = 'Right',
|
||||
}
|
||||
end
|
||||
|
||||
return {
|
||||
local function split_nav(resize_or_move, key)
|
||||
return {
|
||||
key = key,
|
||||
mods = resize_or_move == 'resize' and 'META' or 'CTRL',
|
||||
action = w.action_callback(function(win, pane)
|
||||
if is_vim(pane) then
|
||||
win:perform_action({
|
||||
SendKey = { key = key, mods = resize_or_move == 'resize' and 'META' or 'CTRL' },
|
||||
}, pane)
|
||||
else
|
||||
if resize_or_move == 'resize' then
|
||||
win:perform_action({ AdjustPaneSize = { direction_keys[key], 3 } }, pane)
|
||||
else
|
||||
win:perform_action({ ActivatePaneDirection = direction_keys[key] }, pane)
|
||||
end
|
||||
end
|
||||
end),
|
||||
}
|
||||
end
|
||||
|
||||
return {
|
||||
front_end = "WebGpu",
|
||||
enable_wayland = false,
|
||||
hide_tab_bar_if_only_one_tab = true,
|
||||
|
@ -66,28 +47,26 @@
|
|||
leader = { key = " ", mods = "CTRL", timeout_milliseconds = 1000 },
|
||||
|
||||
keys = {
|
||||
{
|
||||
mods = "LEADER",
|
||||
key = "-",
|
||||
action = wezterm.action.SplitVertical { domain = "CurrentPaneDomain" }
|
||||
},
|
||||
{
|
||||
mods = "LEADER",
|
||||
key = "=",
|
||||
action = wezterm.action.SplitHorizontal { domain = "CurrentPaneDomain" }
|
||||
},
|
||||
-- move between split panes
|
||||
{
|
||||
mods = "LEADER",
|
||||
key = "-",
|
||||
action = wezterm.action.SplitVertical { domain = "CurrentPaneDomain" }
|
||||
},
|
||||
{
|
||||
mods = "LEADER",
|
||||
key = "=",
|
||||
action = wezterm.action.SplitHorizontal { domain = "CurrentPaneDomain" }
|
||||
},
|
||||
split_nav('move', 'h'),
|
||||
split_nav('move', 'j'),
|
||||
split_nav('move', 'k'),
|
||||
split_nav('move', 'l'),
|
||||
-- resize panes
|
||||
split_nav('resize', 'h'),
|
||||
split_nav('resize', 'j'),
|
||||
split_nav('resize', 'k'),
|
||||
split_nav('resize', 'l'),
|
||||
},
|
||||
}
|
||||
}
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,42 +1,11 @@
|
|||
{ pkgs, config, ... }:
|
||||
{ pkgs, ... }:
|
||||
|
||||
{
|
||||
imports = [
|
||||
./hardware-configuration.nix
|
||||
];
|
||||
|
||||
services.xserver.videoDrivers = ["nvidia"];
|
||||
hardware.nvidia = {
|
||||
|
||||
# Modesetting is required.
|
||||
modesetting.enable = true;
|
||||
|
||||
# Nvidia power management. Experimental, and can cause sleep/suspend to fail.
|
||||
# Enable this if you have graphical corruption issues or application crashes after waking
|
||||
# up from sleep. This fixes it by saving the entire VRAM memory to /tmp/ instead
|
||||
# of just the bare essentials.
|
||||
powerManagement.enable = false;
|
||||
|
||||
# Fine-grained power management. Turns off GPU when not in use.
|
||||
# Experimental and only works on modern Nvidia GPUs (Turing or newer).
|
||||
powerManagement.finegrained = false;
|
||||
|
||||
# Use the NVidia open source kernel module (not to be confused with the
|
||||
# independent third-party "nouveau" open source driver).
|
||||
# Support is limited to the Turing and later architectures. Full list of
|
||||
# supported GPUs is at:
|
||||
# https://github.com/NVIDIA/open-gpu-kernel-modules#compatible-gpus
|
||||
# Only available from driver 515.43.04+
|
||||
# Currently alpha-quality/buggy, so false is currently the recommended setting.
|
||||
open = false;
|
||||
|
||||
# Enable the Nvidia settings menu,
|
||||
# accessible via `nvidia-settings`.
|
||||
nvidiaSettings = true;
|
||||
|
||||
# Optionally, you may need to select the appropriate driver version for your specific GPU.
|
||||
package = config.boot.kernelPackages.nvidiaPackages.beta;
|
||||
};
|
||||
modules.nvidia.enable = true;
|
||||
|
||||
programs.steam = {
|
||||
enable = true;
|
||||
|
|
4
modules/default.nix
Normal file
4
modules/default.nix
Normal file
|
@ -0,0 +1,4 @@
|
|||
_:
|
||||
{
|
||||
imports = [ ./nvidia.nix ];
|
||||
}
|
45
modules/nvidia.nix
Normal file
45
modules/nvidia.nix
Normal file
|
@ -0,0 +1,45 @@
|
|||
{ config, lib, ... }:
|
||||
let
|
||||
cfg = config.modules.nvidia;
|
||||
in
|
||||
{
|
||||
options = {
|
||||
modules.nvidia = {
|
||||
enable = lib.mkEnableOption "Enable the Nvidia module";
|
||||
};
|
||||
};
|
||||
config = lib.mkIf cfg.enable {
|
||||
services.xserver.videoDrivers = ["nvidia"];
|
||||
hardware.nvidia = {
|
||||
|
||||
# Modesetting is required.
|
||||
modesetting.enable = true;
|
||||
|
||||
# Nvidia power management. Experimental, and can cause sleep/suspend to fail.
|
||||
# Enable this if you have graphical corruption issues or application crashes after waking
|
||||
# up from sleep. This fixes it by saving the entire VRAM memory to /tmp/ instead
|
||||
# of just the bare essentials.
|
||||
powerManagement.enable = false;
|
||||
|
||||
# Fine-grained power management. Turns off GPU when not in use.
|
||||
# Experimental and only works on modern Nvidia GPUs (Turing or newer).
|
||||
powerManagement.finegrained = false;
|
||||
|
||||
# Use the NVidia open source kernel module (not to be confused with the
|
||||
# independent third-party "nouveau" open source driver).
|
||||
# Support is limited to the Turing and later architectures. Full list of
|
||||
# supported GPUs is at:
|
||||
# https://github.com/NVIDIA/open-gpu-kernel-modules#compatible-gpus
|
||||
# Only available from driver 515.43.04+
|
||||
# Currently alpha-quality/buggy, so false is currently the recommended setting.
|
||||
open = false;
|
||||
|
||||
# Enable the Nvidia settings menu,
|
||||
# accessible via `nvidia-settings`.
|
||||
nvidiaSettings = true;
|
||||
|
||||
# Optionally, you may need to select the appropriate driver version for your specific GPU.
|
||||
package = config.boot.kernelPackages.nvidiaPackages.beta;
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue