WIP: home-manager modules and install tooling (in progress, unreviewed)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01J1cugeLkfFLZMpiztQ8TyN
This commit is contained in:
30 files changed
+2619
No files matched your search
@@ -0,0 +1,30 @@
|
||||
# Everyday desktop applications.
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
cfg = config.my.home.apps;
|
||||
in
|
||||
{
|
||||
options.my.home.apps.enable = lib.mkEnableOption "desktop applications";
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
programs = {
|
||||
firefox.enable = true;
|
||||
mpv.enable = true;
|
||||
imv.enable = true;
|
||||
zathura.enable = true;
|
||||
};
|
||||
|
||||
home.packages = with pkgs; [
|
||||
vesktop # Discord client with working screen sharing on Wayland
|
||||
telegram-desktop
|
||||
file-roller
|
||||
loupe # image viewer
|
||||
nautilus
|
||||
];
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
# Home-manager modules, all behind `my.home.<name>.enable` (default false).
|
||||
# Loaded for every user through home-manager.sharedModules (see lib/default.nix);
|
||||
# hosts/<name>/home.nix turns the wanted ones on.
|
||||
{
|
||||
imports = [
|
||||
./hyprland
|
||||
./noctalia.nix
|
||||
./wezterm.nix
|
||||
./neovim
|
||||
./shell.nix
|
||||
./git.nix
|
||||
./ssh.nix
|
||||
./xdg.nix
|
||||
./theming.nix
|
||||
./apps.nix
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
# Git identity and defaults. The name and email come from my.user so the
|
||||
# identity is defined once, in the host file.
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
osConfig,
|
||||
...
|
||||
}:
|
||||
let
|
||||
cfg = config.my.home.git;
|
||||
in
|
||||
{
|
||||
options.my.home.git.enable = lib.mkEnableOption "Git and GitHub CLI configuration";
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
programs = {
|
||||
git = {
|
||||
enable = true;
|
||||
|
||||
settings = {
|
||||
user = {
|
||||
name = osConfig.my.user.fullName;
|
||||
inherit (osConfig.my.user) email;
|
||||
};
|
||||
init.defaultBranch = "main";
|
||||
pull.rebase = true;
|
||||
push.autoSetupRemote = true;
|
||||
rebase.autoStash = true;
|
||||
merge.conflictStyle = "zdiff3";
|
||||
diff.colorMoved = "default";
|
||||
};
|
||||
|
||||
ignores = [
|
||||
".direnv/"
|
||||
"result"
|
||||
"result-*"
|
||||
".DS_Store"
|
||||
];
|
||||
};
|
||||
|
||||
# Syntax-highlighted diffs as the git pager.
|
||||
delta = {
|
||||
enable = true;
|
||||
enableGitIntegration = true;
|
||||
options = {
|
||||
navigate = true;
|
||||
line-numbers = true;
|
||||
};
|
||||
};
|
||||
|
||||
gh = {
|
||||
enable = true;
|
||||
settings.git_protocol = "ssh";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,129 @@
|
||||
-- Keybindings. Shell features (launcher, panels, media keys) go through
|
||||
-- Noctalia's IPC: https://docs.noctalia.dev/noctalia/ipc/
|
||||
local nix = require("nixvars")
|
||||
|
||||
local mainMod = "SUPER"
|
||||
local ipc = "noctalia msg "
|
||||
|
||||
-- Binds act as if the first layout (us) were active, so they also work while
|
||||
-- the Russian layout is selected.
|
||||
|
||||
----------------------
|
||||
---- APPLICATIONS ----
|
||||
----------------------
|
||||
|
||||
hl.bind(mainMod .. " + Return", hl.dsp.exec_cmd(nix.terminal))
|
||||
hl.bind(mainMod .. " + E", hl.dsp.exec_cmd(nix.fileManager))
|
||||
|
||||
---------------
|
||||
---- WINDOWS ----
|
||||
---------------
|
||||
|
||||
hl.bind(mainMod .. " + Q", hl.dsp.window.close())
|
||||
hl.bind(mainMod .. " + F", hl.dsp.window.fullscreen())
|
||||
hl.bind(mainMod .. " + SHIFT + F", hl.dsp.window.fullscreen({ mode = "maximized" }))
|
||||
hl.bind(mainMod .. " + SHIFT + Space", hl.dsp.window.float({ action = "toggle" }))
|
||||
hl.bind(mainMod .. " + P", hl.dsp.window.pseudo())
|
||||
hl.bind(mainMod .. " + T", hl.dsp.layout("togglesplit")) -- dwindle only
|
||||
|
||||
-- Emergency exit if the shell is not running.
|
||||
hl.bind(mainMod .. " + SHIFT + Escape", hl.dsp.exit())
|
||||
|
||||
-- Move focus with mainMod + arrow keys or hjkl
|
||||
hl.bind(mainMod .. " + left", hl.dsp.focus({ direction = "left" }))
|
||||
hl.bind(mainMod .. " + right", hl.dsp.focus({ direction = "right" }))
|
||||
hl.bind(mainMod .. " + up", hl.dsp.focus({ direction = "up" }))
|
||||
hl.bind(mainMod .. " + down", hl.dsp.focus({ direction = "down" }))
|
||||
hl.bind(mainMod .. " + H", hl.dsp.focus({ direction = "left" }))
|
||||
hl.bind(mainMod .. " + L", hl.dsp.focus({ direction = "right" }))
|
||||
hl.bind(mainMod .. " + K", hl.dsp.focus({ direction = "up" }))
|
||||
hl.bind(mainMod .. " + J", hl.dsp.focus({ direction = "down" }))
|
||||
|
||||
-- Move the window with mainMod + SHIFT + arrow keys or hjkl
|
||||
hl.bind(mainMod .. " + SHIFT + left", hl.dsp.window.move({ direction = "left" }))
|
||||
hl.bind(mainMod .. " + SHIFT + right", hl.dsp.window.move({ direction = "right" }))
|
||||
hl.bind(mainMod .. " + SHIFT + up", hl.dsp.window.move({ direction = "up" }))
|
||||
hl.bind(mainMod .. " + SHIFT + down", hl.dsp.window.move({ direction = "down" }))
|
||||
hl.bind(mainMod .. " + SHIFT + H", hl.dsp.window.move({ direction = "left" }))
|
||||
hl.bind(mainMod .. " + SHIFT + L", hl.dsp.window.move({ direction = "right" }))
|
||||
hl.bind(mainMod .. " + SHIFT + K", hl.dsp.window.move({ direction = "up" }))
|
||||
hl.bind(mainMod .. " + SHIFT + J", hl.dsp.window.move({ direction = "down" }))
|
||||
|
||||
-- Resize with mainMod + CTRL + arrow keys or hjkl
|
||||
local resizeStep = 40
|
||||
local resizeKeys = {
|
||||
{ "left", "H", -resizeStep, 0 },
|
||||
{ "right", "L", resizeStep, 0 },
|
||||
{ "up", "K", 0, -resizeStep },
|
||||
{ "down", "J", 0, resizeStep },
|
||||
}
|
||||
for _, r in ipairs(resizeKeys) do
|
||||
local action = hl.dsp.window.resize({ x = r[3], y = r[4], relative = true })
|
||||
hl.bind(mainMod .. " + CTRL + " .. r[1], action, { repeating = true })
|
||||
hl.bind(mainMod .. " + CTRL + " .. r[2], action, { repeating = true })
|
||||
end
|
||||
|
||||
-- Move/resize windows with mainMod + LMB/RMB and dragging
|
||||
hl.bind(mainMod .. " + mouse:272", hl.dsp.window.drag(), { mouse = true })
|
||||
hl.bind(mainMod .. " + mouse:273", hl.dsp.window.resize(), { mouse = true })
|
||||
|
||||
--------------------
|
||||
---- WORKSPACES ----
|
||||
--------------------
|
||||
|
||||
-- Switch workspaces with mainMod + [0-9]
|
||||
-- Move active window to a workspace with mainMod + SHIFT + [0-9]
|
||||
for i = 1, 10 do
|
||||
local key = i % 10 -- 10 maps to key 0
|
||||
hl.bind(mainMod .. " + " .. key, hl.dsp.focus({ workspace = i }))
|
||||
hl.bind(mainMod .. " + SHIFT + " .. key, hl.dsp.window.move({ workspace = i }))
|
||||
end
|
||||
|
||||
-- Scratchpad (special workspace)
|
||||
hl.bind(mainMod .. " + minus", hl.dsp.workspace.toggle_special("magic"))
|
||||
hl.bind(mainMod .. " + SHIFT + minus", hl.dsp.window.move({ workspace = "special:magic" }))
|
||||
|
||||
-- Scroll through existing workspaces with mainMod + scroll
|
||||
hl.bind(mainMod .. " + mouse_down", hl.dsp.focus({ workspace = "e+1" }))
|
||||
hl.bind(mainMod .. " + mouse_up", hl.dsp.focus({ workspace = "e-1" }))
|
||||
|
||||
------------------
|
||||
---- NOCTALIA ----
|
||||
------------------
|
||||
|
||||
hl.bind(mainMod .. " + Space", hl.dsp.exec_cmd(ipc .. "panel-toggle launcher"))
|
||||
hl.bind(mainMod .. " + S", hl.dsp.exec_cmd(ipc .. "panel-toggle control-center"))
|
||||
hl.bind(mainMod .. " + comma", hl.dsp.exec_cmd(ipc .. "settings-toggle"))
|
||||
hl.bind(mainMod .. " + V", hl.dsp.exec_cmd(ipc .. "panel-toggle clipboard"))
|
||||
hl.bind(mainMod .. " + W", hl.dsp.exec_cmd(ipc .. "panel-toggle wallpaper"))
|
||||
hl.bind(mainMod .. " + Escape", hl.dsp.exec_cmd(ipc .. "panel-toggle session"))
|
||||
hl.bind(mainMod .. " + ALT + L", hl.dsp.exec_cmd(ipc .. "session lock"))
|
||||
hl.bind("ALT + Tab", hl.dsp.exec_cmd(ipc .. "window-switcher hold"))
|
||||
|
||||
-- Volume, microphone, brightness and media keys
|
||||
local held = { locked = true, repeating = true }
|
||||
hl.bind("XF86AudioRaiseVolume", hl.dsp.exec_cmd(ipc .. "volume-up"), held)
|
||||
hl.bind("XF86AudioLowerVolume", hl.dsp.exec_cmd(ipc .. "volume-down"), held)
|
||||
hl.bind("XF86AudioMute", hl.dsp.exec_cmd(ipc .. "volume-mute"), held)
|
||||
hl.bind("XF86AudioMicMute", hl.dsp.exec_cmd(ipc .. "mic-mute"), held)
|
||||
hl.bind("XF86MonBrightnessUp", hl.dsp.exec_cmd(ipc .. "brightness-up"), held)
|
||||
hl.bind("XF86MonBrightnessDown", hl.dsp.exec_cmd(ipc .. "brightness-down"), held)
|
||||
|
||||
hl.bind("XF86AudioNext", hl.dsp.exec_cmd(ipc .. "media next"), { locked = true })
|
||||
hl.bind("XF86AudioPause", hl.dsp.exec_cmd(ipc .. "media toggle"), { locked = true })
|
||||
hl.bind("XF86AudioPlay", hl.dsp.exec_cmd(ipc .. "media toggle"), { locked = true })
|
||||
hl.bind("XF86AudioPrev", hl.dsp.exec_cmd(ipc .. "media previous"), { locked = true })
|
||||
|
||||
---------------------
|
||||
---- SCREENSHOTS ----
|
||||
---------------------
|
||||
|
||||
-- grim + slurp, straight to the clipboard. Cancelling slurp aborts the capture.
|
||||
hl.bind("Print", hl.dsp.exec_cmd('geometry=$(slurp) && grim -g "$geometry" - | wl-copy'))
|
||||
hl.bind("SHIFT + Print", hl.dsp.exec_cmd("grim - | wl-copy"))
|
||||
-- Region to ~/Pictures/Screenshots and the clipboard.
|
||||
hl.bind("CTRL + Print", hl.dsp.exec_cmd(
|
||||
'dir="$HOME/Pictures/Screenshots"; mkdir -p "$dir" && geometry=$(slurp) && ' ..
|
||||
'file="$dir/$(date +%F_%H-%M-%S).png" && grim -g "$geometry" "$file" && wl-copy < "$file"'))
|
||||
-- Noctalia's own region capture with the annotation editor.
|
||||
hl.bind(mainMod .. " + Print", hl.dsp.exec_cmd(ipc .. "screenshot-region"))
|
||||
@@ -0,0 +1,67 @@
|
||||
# Hyprland user configuration. Hyprland 0.56 reads Lua, so the real config lives
|
||||
# in the plain .lua files next to this module; Nix only passes in the few
|
||||
# values that come from the system config (keyboard layouts, cursor, apps).
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
osConfig,
|
||||
...
|
||||
}:
|
||||
let
|
||||
cfg = config.my.home.hyprland;
|
||||
cursor = config.home.pointerCursor;
|
||||
|
||||
# Exposed to the Lua files as `require("nixvars")`.
|
||||
nixVars = {
|
||||
kbLayout = lib.concatStringsSep "," osConfig.my.locale.keyboardLayouts;
|
||||
kbOptions = lib.concatStringsSep "," osConfig.my.locale.keyboardOptions;
|
||||
terminal = "wezterm";
|
||||
fileManager = "nautilus";
|
||||
cursorSize = if cursor.enable then cursor.size else 24;
|
||||
cursorTheme = if cursor.enable then cursor.name else "";
|
||||
};
|
||||
in
|
||||
{
|
||||
options.my.home.hyprland.enable = lib.mkEnableOption "Hyprland user configuration (Lua)";
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
wayland.windowManager.hyprland = {
|
||||
enable = true;
|
||||
configType = "lua";
|
||||
|
||||
# The NixOS module (programs.hyprland) installs the compositor and the
|
||||
# portal, built from the flake overlay. Installing them again here would
|
||||
# put a second copy in the user profile.
|
||||
package = null;
|
||||
portalPackage = null;
|
||||
|
||||
# UWSM owns the session and graphical-session.target; HM's own
|
||||
# hyprland-session.target and dbus import would only duplicate that.
|
||||
systemd.enable = false;
|
||||
xwayland.enable = true;
|
||||
|
||||
# Loaded in name order; `nixvars` is a helper module, not loaded on its own.
|
||||
extraLuaFiles = {
|
||||
nixvars = {
|
||||
content = "return ${lib.generators.toLua { } nixVars}\n";
|
||||
autoLoad = false;
|
||||
};
|
||||
"10-settings" = ./settings.lua;
|
||||
"20-binds" = ./binds.lua;
|
||||
"30-rules" = ./rules.lua;
|
||||
};
|
||||
};
|
||||
|
||||
# Tools the binds call (screenshots, file manager).
|
||||
home.packages = with pkgs; [
|
||||
grim
|
||||
slurp
|
||||
wl-clipboard
|
||||
nautilus
|
||||
];
|
||||
|
||||
# Electron and Chromium apps pick Wayland instead of XWayland.
|
||||
home.sessionVariables.NIXOS_OZONE_WL = "1";
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
-- Window, layer and workspace rules.
|
||||
|
||||
-- Ignore maximize requests from all apps.
|
||||
hl.window_rule({
|
||||
name = "suppress-maximize-events",
|
||||
match = { class = ".*" },
|
||||
|
||||
suppress_event = "maximize",
|
||||
})
|
||||
|
||||
-- Fix some dragging issues with XWayland.
|
||||
hl.window_rule({
|
||||
name = "fix-xwayland-drags",
|
||||
match = {
|
||||
class = "^$",
|
||||
title = "^$",
|
||||
xwayland = true,
|
||||
float = true,
|
||||
fullscreen = false,
|
||||
pin = false,
|
||||
},
|
||||
|
||||
no_focus = true,
|
||||
})
|
||||
|
||||
-- Hyprland-run windowrule.
|
||||
hl.window_rule({
|
||||
name = "move-hyprland-run",
|
||||
match = { class = "hyprland-run" },
|
||||
|
||||
move = "20 monitor_h-120",
|
||||
float = true,
|
||||
})
|
||||
|
||||
-- Anything fullscreen keeps the screen awake (video players, games, browsers).
|
||||
hl.window_rule({
|
||||
name = "idle-inhibit-fullscreen",
|
||||
match = { class = ".*" },
|
||||
|
||||
idle_inhibit = "fullscreen",
|
||||
})
|
||||
|
||||
------------------
|
||||
---- NOCTALIA ----
|
||||
------------------
|
||||
|
||||
-- Settings window floats at a comfortable size.
|
||||
hl.window_rule({
|
||||
name = "noctalia-settings",
|
||||
match = { class = "dev.noctalia.Noctalia" },
|
||||
|
||||
float = true,
|
||||
size = { 1080, 920 },
|
||||
})
|
||||
|
||||
-- Blur behind the bar, panels, dock and notifications; Hyprland's own layer
|
||||
-- animations are off so they do not fight Noctalia's.
|
||||
hl.layer_rule({
|
||||
name = "noctalia",
|
||||
match = {
|
||||
namespace = "^noctalia-(bar-.+|notification|dock|panel|attached-panel|osd|window-switcher)$",
|
||||
},
|
||||
|
||||
no_anim = true,
|
||||
ignore_alpha = 0.5,
|
||||
blur = true,
|
||||
blur_popups = true,
|
||||
})
|
||||
|
||||
----------------
|
||||
---- GAMING ----
|
||||
----------------
|
||||
|
||||
-- Steam Big Picture games (steam_app_<id>) may tear for lower input latency.
|
||||
-- This only takes effect in fullscreen with general.allow_tearing enabled.
|
||||
hl.window_rule({
|
||||
name = "steam-games-tearing",
|
||||
match = { class = "^steam_app_\\d+$" },
|
||||
|
||||
immediate = true,
|
||||
})
|
||||
|
||||
-- Steam's small utility windows.
|
||||
hl.window_rule({
|
||||
name = "steam-utility-windows",
|
||||
match = { class = "^steam$", title = "^(Friends List|Steam Settings)$" },
|
||||
|
||||
float = true,
|
||||
})
|
||||
@@ -0,0 +1,117 @@
|
||||
-- Monitors, environment, look and feel, input.
|
||||
-- API reference: the official example (hyprland.lua) shipped with Hyprland.
|
||||
local nix = require("nixvars")
|
||||
|
||||
------------------
|
||||
---- MONITORS ----
|
||||
------------------
|
||||
|
||||
-- Any output, native mode, placed automatically. Use mode = "highrr" to prefer
|
||||
-- the highest refresh rate instead.
|
||||
hl.monitor({
|
||||
output = "",
|
||||
mode = "preferred",
|
||||
position = "auto",
|
||||
scale = "auto",
|
||||
})
|
||||
|
||||
-------------------------------
|
||||
---- ENVIRONMENT VARIABLES ----
|
||||
-------------------------------
|
||||
|
||||
hl.env("XCURSOR_SIZE", tostring(nix.cursorSize))
|
||||
hl.env("HYPRCURSOR_SIZE", tostring(nix.cursorSize))
|
||||
if nix.cursorTheme ~= "" then
|
||||
hl.env("XCURSOR_THEME", nix.cursorTheme)
|
||||
end
|
||||
|
||||
-----------------------
|
||||
---- LOOK AND FEEL ----
|
||||
-----------------------
|
||||
|
||||
-- Gaps, rounding, shadow and blur follow the Noctalia documentation so the
|
||||
-- shell's bar and panels sit well on top of the windows.
|
||||
hl.config({
|
||||
general = {
|
||||
gaps_in = 5,
|
||||
gaps_out = 10,
|
||||
|
||||
border_size = 2,
|
||||
|
||||
col = {
|
||||
-- Catppuccin Mocha: mauve to blue, surface1 when unfocused.
|
||||
active_border = { colors = { "rgba(cba6f7ee)", "rgba(89b4faee)" }, angle = 45 },
|
||||
inactive_border = "rgba(45475aaa)",
|
||||
},
|
||||
|
||||
resize_on_border = true,
|
||||
|
||||
-- Only windows with the `immediate` rule (see 30-rules.lua) tear.
|
||||
allow_tearing = true,
|
||||
|
||||
layout = "dwindle",
|
||||
},
|
||||
|
||||
decoration = {
|
||||
rounding = 20,
|
||||
rounding_power = 2,
|
||||
|
||||
shadow = {
|
||||
enabled = true,
|
||||
range = 4,
|
||||
render_power = 3,
|
||||
color = 0xee1a1a1a,
|
||||
},
|
||||
|
||||
blur = {
|
||||
enabled = true,
|
||||
size = 3,
|
||||
passes = 2,
|
||||
vibrancy = 0.1696,
|
||||
},
|
||||
},
|
||||
|
||||
animations = {
|
||||
enabled = true,
|
||||
},
|
||||
|
||||
dwindle = {
|
||||
preserve_split = true,
|
||||
},
|
||||
|
||||
master = {
|
||||
new_status = "master",
|
||||
},
|
||||
|
||||
misc = {
|
||||
-- Noctalia draws the wallpaper.
|
||||
force_default_wallpaper = 0,
|
||||
disable_hyprland_logo = true,
|
||||
},
|
||||
|
||||
ecosystem = {
|
||||
no_update_news = true,
|
||||
no_donation_nag = true,
|
||||
},
|
||||
})
|
||||
|
||||
---------------
|
||||
---- INPUT ----
|
||||
---------------
|
||||
|
||||
hl.config({
|
||||
input = {
|
||||
kb_layout = nix.kbLayout,
|
||||
kb_options = nix.kbOptions,
|
||||
|
||||
numlock_by_default = true,
|
||||
|
||||
follow_mouse = 1,
|
||||
sensitivity = 0,
|
||||
},
|
||||
})
|
||||
|
||||
-- Persistent workspaces keep the empty ones visible in Noctalia's indicator.
|
||||
for i = 1, 5 do
|
||||
hl.workspace_rule({ workspace = tostring(i), persistent = true })
|
||||
end
|
||||
@@ -0,0 +1,54 @@
|
||||
# Neovim with LSP, completion, fuzzy finding and format-on-save.
|
||||
# The editor config is in init.lua next to this file.
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
cfg = config.my.home.neovim;
|
||||
in
|
||||
{
|
||||
options.my.home.neovim.enable = lib.mkEnableOption "Neovim editor";
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
programs.neovim = {
|
||||
enable = true;
|
||||
defaultEditor = true;
|
||||
viAlias = true;
|
||||
vimAlias = true;
|
||||
|
||||
plugins = with pkgs.vimPlugins; [
|
||||
nvim-treesitter.withAllGrammars
|
||||
nvim-lspconfig
|
||||
blink-cmp
|
||||
telescope-nvim
|
||||
telescope-fzf-native-nvim
|
||||
plenary-nvim
|
||||
lualine-nvim
|
||||
gitsigns-nvim
|
||||
which-key-nvim
|
||||
oil-nvim
|
||||
conform-nvim
|
||||
catppuccin-nvim
|
||||
nvim-web-devicons
|
||||
mini-nvim
|
||||
];
|
||||
|
||||
# Language servers, formatters and search tools, visible to nvim only.
|
||||
extraPackages = with pkgs; [
|
||||
nixd
|
||||
nixfmt
|
||||
lua-language-server
|
||||
stylua
|
||||
bash-language-server
|
||||
shfmt
|
||||
ripgrep
|
||||
fd
|
||||
];
|
||||
|
||||
initLua = builtins.readFile ./init.lua;
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,149 @@
|
||||
-- Plugins are installed by Nix (see default.nix); this file only configures them.
|
||||
|
||||
vim.g.mapleader = " "
|
||||
vim.g.maplocalleader = " "
|
||||
|
||||
-----------------
|
||||
---- OPTIONS ----
|
||||
-----------------
|
||||
|
||||
local o = vim.opt
|
||||
o.number = true
|
||||
o.relativenumber = true
|
||||
o.signcolumn = "yes"
|
||||
o.cursorline = true
|
||||
o.termguicolors = true
|
||||
o.mouse = "a"
|
||||
o.clipboard = "unnamedplus"
|
||||
o.undofile = true
|
||||
o.ignorecase = true
|
||||
o.smartcase = true
|
||||
o.splitright = true
|
||||
o.splitbelow = true
|
||||
o.scrolloff = 8
|
||||
o.updatetime = 250
|
||||
o.timeoutlen = 400
|
||||
o.expandtab = true
|
||||
o.shiftwidth = 2
|
||||
o.tabstop = 2
|
||||
o.smartindent = true
|
||||
o.wrap = false
|
||||
o.list = true
|
||||
o.listchars = { tab = "» ", trail = "·", nbsp = "␣" }
|
||||
o.inccommand = "split"
|
||||
|
||||
---------------------
|
||||
---- COLORSCHEME ----
|
||||
---------------------
|
||||
|
||||
require("catppuccin").setup({ flavour = "mocha" })
|
||||
vim.cmd.colorscheme("catppuccin")
|
||||
|
||||
require("nvim-web-devicons").setup()
|
||||
require("lualine").setup({ options = { theme = "catppuccin", globalstatus = true } })
|
||||
require("gitsigns").setup()
|
||||
require("which-key").setup()
|
||||
require("oil").setup()
|
||||
|
||||
-- mini.nvim: only the small editing helpers.
|
||||
require("mini.pairs").setup()
|
||||
require("mini.surround").setup()
|
||||
|
||||
--------------------
|
||||
---- TREESITTER ----
|
||||
--------------------
|
||||
|
||||
-- Parsers come from nvim-treesitter.withAllGrammars. Starting the built-in
|
||||
-- highlighter works with both the old and the rewritten nvim-treesitter.
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
callback = function(args)
|
||||
pcall(vim.treesitter.start, args.buf)
|
||||
end,
|
||||
})
|
||||
|
||||
--------------------
|
||||
---- TELESCOPE ----
|
||||
--------------------
|
||||
|
||||
local telescope = require("telescope")
|
||||
telescope.setup({})
|
||||
pcall(telescope.load_extension, "fzf")
|
||||
|
||||
local builtin = require("telescope.builtin")
|
||||
vim.keymap.set("n", "<leader>ff", builtin.find_files, { desc = "Find files" })
|
||||
vim.keymap.set("n", "<leader>fg", builtin.live_grep, { desc = "Grep" })
|
||||
vim.keymap.set("n", "<leader>fb", builtin.buffers, { desc = "Buffers" })
|
||||
vim.keymap.set("n", "<leader>fh", builtin.help_tags, { desc = "Help" })
|
||||
vim.keymap.set("n", "<leader>fr", builtin.oldfiles, { desc = "Recent files" })
|
||||
|
||||
vim.keymap.set("n", "-", "<cmd>Oil<cr>", { desc = "File explorer" })
|
||||
|
||||
-------------
|
||||
---- LSP ----
|
||||
-------------
|
||||
|
||||
-- Neovim 0.11+ API. nvim-lspconfig supplies the default cmd, filetypes and
|
||||
-- root markers for each server; the language servers are on nvim's PATH
|
||||
-- (extraPackages in default.nix).
|
||||
require("blink.cmp").setup({
|
||||
keymap = { preset = "default" },
|
||||
sources = { default = { "lsp", "path", "snippets", "buffer" } },
|
||||
})
|
||||
|
||||
vim.lsp.config("*", {
|
||||
capabilities = require("blink.cmp").get_lsp_capabilities(),
|
||||
})
|
||||
|
||||
vim.lsp.config("nixd", {
|
||||
settings = {
|
||||
nixd = {
|
||||
formatting = { command = { "nixfmt" } },
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
vim.lsp.config("lua_ls", {
|
||||
settings = {
|
||||
Lua = {
|
||||
runtime = { version = "LuaJIT" },
|
||||
diagnostics = { globals = { "vim", "hl" } },
|
||||
workspace = { checkThirdParty = false },
|
||||
telemetry = { enable = false },
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
vim.lsp.enable({ "nixd", "lua_ls", "bashls" })
|
||||
|
||||
vim.api.nvim_create_autocmd("LspAttach", {
|
||||
callback = function(args)
|
||||
local function map(lhs, rhs, desc)
|
||||
vim.keymap.set("n", lhs, rhs, { buffer = args.buf, desc = desc })
|
||||
end
|
||||
map("gd", vim.lsp.buf.definition, "Go to definition")
|
||||
map("gr", vim.lsp.buf.references, "References")
|
||||
map("K", vim.lsp.buf.hover, "Hover")
|
||||
map("<leader>rn", vim.lsp.buf.rename, "Rename")
|
||||
map("<leader>ca", vim.lsp.buf.code_action, "Code action")
|
||||
map("<leader>e", vim.diagnostic.open_float, "Line diagnostics")
|
||||
end,
|
||||
})
|
||||
|
||||
vim.diagnostic.config({ virtual_text = true, severity_sort = true })
|
||||
|
||||
-----------------------
|
||||
---- FORMAT ON SAVE ----
|
||||
-----------------------
|
||||
|
||||
require("conform").setup({
|
||||
formatters_by_ft = {
|
||||
nix = { "nixfmt" },
|
||||
lua = { "stylua" },
|
||||
sh = { "shfmt" },
|
||||
bash = { "shfmt" },
|
||||
},
|
||||
format_on_save = {
|
||||
timeout_ms = 1000,
|
||||
lsp_format = "fallback",
|
||||
},
|
||||
})
|
||||
@@ -0,0 +1,50 @@
|
||||
# Noctalia v5 shell (bar, launcher, notifications, lock screen, wallpaper).
|
||||
# The module itself comes from the noctalia flake (home-manager sharedModules).
|
||||
# Settings are validated at build time by `noctalia config validate`, so only
|
||||
# keys from the upstream schema may appear here. Anything changed in the
|
||||
# settings window at runtime is stored separately and overrides this file.
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
cfg = config.my.home.noctalia;
|
||||
in
|
||||
{
|
||||
options.my.home.noctalia.enable = lib.mkEnableOption "Noctalia shell";
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
programs.noctalia = {
|
||||
enable = true;
|
||||
|
||||
# A user service instead of hl.exec_cmd, so it restarts on failure and
|
||||
# follows graphical-session.target (managed by UWSM).
|
||||
systemd.enable = true;
|
||||
|
||||
settings = {
|
||||
theme = {
|
||||
mode = "dark";
|
||||
source = "builtin";
|
||||
builtin = "Catppuccin";
|
||||
};
|
||||
|
||||
shell = {
|
||||
font_family = "Inter";
|
||||
telemetry_enabled = false;
|
||||
|
||||
# No other polkit agent is started in the session.
|
||||
polkit_agent = true;
|
||||
|
||||
# Apps started from the launcher get their own systemd scope, so
|
||||
# restarting the shell service does not kill them.
|
||||
launch_apps_as_systemd_services = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
# Shell font.
|
||||
home.packages = [ pkgs.inter ];
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
# Interactive shell: zsh with starship prompt, fzf, zoxide, eza, bat, direnv.
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
cfg = config.my.home.shell;
|
||||
in
|
||||
{
|
||||
options.my.home.shell.enable = lib.mkEnableOption "zsh shell environment and CLI tools";
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
programs = {
|
||||
zsh = {
|
||||
enable = true;
|
||||
enableCompletion = true;
|
||||
autosuggestion.enable = true;
|
||||
syntaxHighlighting.enable = true;
|
||||
autocd = true;
|
||||
|
||||
history = {
|
||||
size = 50000;
|
||||
save = 50000;
|
||||
# Share between open terminals, skip duplicates and space-prefixed lines.
|
||||
share = true;
|
||||
ignoreDups = true;
|
||||
ignoreSpace = true;
|
||||
extended = true;
|
||||
};
|
||||
|
||||
shellAliases = {
|
||||
cat = "bat";
|
||||
".." = "cd ..";
|
||||
g = "git";
|
||||
# nh builds, diffs and activates the flake in one step.
|
||||
rebuild = "nh os switch";
|
||||
rebuild-boot = "nh os boot";
|
||||
rebuild-test = "nh os test";
|
||||
};
|
||||
};
|
||||
|
||||
starship = {
|
||||
enable = true;
|
||||
settings = {
|
||||
add_newline = false;
|
||||
# Keeps the prompt on one line when the nix shell or direnv is active.
|
||||
nix_shell.format = "[$symbol$state]($style) ";
|
||||
};
|
||||
};
|
||||
|
||||
fzf = {
|
||||
enable = true;
|
||||
defaultCommand = "fd --type f --hidden --exclude .git";
|
||||
fileWidget.command = "fd --type f --hidden --exclude .git";
|
||||
changeDirWidget.command = "fd --type d --hidden --exclude .git";
|
||||
};
|
||||
|
||||
# `z dir` jumps to frecent directories, `zi` picks with fzf.
|
||||
zoxide.enable = true;
|
||||
|
||||
# ls, ll, la, lt and lla aliases come from the zsh integration.
|
||||
eza = {
|
||||
enable = true;
|
||||
icons = "auto";
|
||||
git = true;
|
||||
};
|
||||
|
||||
bat.enable = true;
|
||||
|
||||
direnv = {
|
||||
enable = true;
|
||||
nix-direnv.enable = true;
|
||||
};
|
||||
|
||||
btop.enable = true;
|
||||
fastfetch.enable = true;
|
||||
};
|
||||
|
||||
# fd backs the fzf commands above.
|
||||
home.packages = [ pkgs.fd ];
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
# SSH client, agent and the user's keys.
|
||||
# Private keys are agenix secrets (decrypted at boot into /run/agenix); this
|
||||
# module only links them into ~/.ssh so ssh finds them at the usual path.
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
osConfig,
|
||||
...
|
||||
}:
|
||||
let
|
||||
cfg = config.my.home.ssh;
|
||||
|
||||
secrets = osConfig.my.secrets;
|
||||
|
||||
# Keys that actually have an encrypted secret in the repo. Without a secret
|
||||
# nothing is linked, so a fresh install still boots and ssh falls back to
|
||||
# whatever key the user generates by hand.
|
||||
keys = lib.filter (k: osConfig.age.secrets ? "ssh-${k}") secrets.userSshKeys;
|
||||
|
||||
pubFile = k: secrets.dir + "/ssh-${k}.pub";
|
||||
|
||||
# The decrypted file lives outside the store, so link it by absolute path.
|
||||
keyFiles = lib.listToAttrs (
|
||||
map (
|
||||
k:
|
||||
lib.nameValuePair ".ssh/${k}" {
|
||||
source = config.lib.file.mkOutOfStoreSymlink osConfig.age.secrets."ssh-${k}".path;
|
||||
}
|
||||
) keys
|
||||
);
|
||||
|
||||
# Public keys are not secret, so they are plain files from the repo.
|
||||
pubFiles = lib.listToAttrs (
|
||||
map (k: lib.nameValuePair ".ssh/${k}.pub" { source = pubFile k; }) (
|
||||
lib.filter (k: builtins.pathExists (pubFile k)) keys
|
||||
)
|
||||
);
|
||||
in
|
||||
{
|
||||
options.my.home.ssh.enable = lib.mkEnableOption "SSH client, agent and agenix-provided keys";
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
programs.ssh = {
|
||||
enable = true;
|
||||
|
||||
# Spell the defaults out below instead of relying on the deprecated ones.
|
||||
enableDefaultConfig = false;
|
||||
|
||||
settings = {
|
||||
"*" = {
|
||||
# Load a key into the agent on first use, so the passphrase (if any)
|
||||
# is typed once per login.
|
||||
AddKeysToAgent = "yes";
|
||||
ServerAliveInterval = 60;
|
||||
ServerAliveCountMax = 3;
|
||||
HashKnownHosts = false;
|
||||
UserKnownHostsFile = "~/.ssh/known_hosts";
|
||||
};
|
||||
|
||||
"github.com" = {
|
||||
User = "git";
|
||||
IdentityFile = "~/.ssh/id_ed25519";
|
||||
# Offer only this key, not everything in the agent.
|
||||
IdentitiesOnly = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
# A plain user service rather than gnome-keyring's agent: no keyring to
|
||||
# unlock, and it sets SSH_AUTH_SOCK for shells, systemd and D-Bus. The
|
||||
# system must not start another agent (programs.ssh.startAgent).
|
||||
services.ssh-agent.enable = true;
|
||||
|
||||
home.file = keyFiles // pubFiles;
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
# Dark GTK and Qt look, icons and cursor. Noctalia themes the shell itself;
|
||||
# this keeps the apps consistent with it.
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
cfg = config.my.home.theming;
|
||||
in
|
||||
{
|
||||
options.my.home.theming.enable = lib.mkEnableOption "GTK/Qt theme, icons and cursor";
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
gtk = {
|
||||
enable = true;
|
||||
colorScheme = "dark";
|
||||
|
||||
theme = {
|
||||
name = "adw-gtk3-dark";
|
||||
package = pkgs.adw-gtk3;
|
||||
};
|
||||
|
||||
iconTheme = {
|
||||
name = "Papirus-Dark";
|
||||
package = pkgs.papirus-icon-theme;
|
||||
};
|
||||
};
|
||||
|
||||
# GTK picks the cursor up from here (gtk.enable below).
|
||||
home.pointerCursor = {
|
||||
enable = true;
|
||||
package = pkgs.bibata-cursors;
|
||||
name = "Bibata-Modern-Classic";
|
||||
size = 24;
|
||||
gtk.enable = true;
|
||||
};
|
||||
|
||||
# Qt apps follow the GTK settings, with the Adwaita dark widget style.
|
||||
qt = {
|
||||
enable = true;
|
||||
platformTheme.name = "gtk3";
|
||||
style.name = "adwaita-dark";
|
||||
};
|
||||
|
||||
# libadwaita and GTK 4 apps read the preference from dconf. The system
|
||||
# needs programs.dconf.enable for this to be applied.
|
||||
dconf.settings."org/gnome/desktop/interface".color-scheme = "prefer-dark";
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
# WezTerm terminal (SUPER+Return in Hyprland).
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
cfg = config.my.home.wezterm;
|
||||
in
|
||||
{
|
||||
options.my.home.wezterm.enable = lib.mkEnableOption "WezTerm terminal";
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
programs.wezterm = {
|
||||
enable = true;
|
||||
|
||||
extraConfig = ''
|
||||
local act = wezterm.action
|
||||
local config = wezterm.config_builder()
|
||||
|
||||
config.color_scheme = 'Catppuccin Mocha'
|
||||
config.font = wezterm.font_with_fallback { 'JetBrainsMono Nerd Font', 'Noto Color Emoji' }
|
||||
config.font_size = 12.0
|
||||
|
||||
-- Wayland-native, no client-side titlebar (Hyprland draws the borders).
|
||||
config.enable_wayland = true
|
||||
config.window_decorations = 'NONE'
|
||||
config.window_padding = { left = 8, right = 8, top = 8, bottom = 8 }
|
||||
|
||||
-- A tab bar only when there is more than one tab.
|
||||
config.hide_tab_bar_if_only_one_tab = true
|
||||
config.use_fancy_tab_bar = false
|
||||
|
||||
config.scrollback_lines = 20000
|
||||
config.audible_bell = 'Disabled'
|
||||
config.check_for_updates = false
|
||||
|
||||
-- Hyprland owns SUPER and ALT+Tab, so splits live on CTRL+SHIFT.
|
||||
-- phys: keys are layout independent and work with the ru layout.
|
||||
config.keys = {
|
||||
{ key = 'phys:D', mods = 'CTRL|SHIFT', action = act.SplitHorizontal { domain = 'CurrentPaneDomain' } },
|
||||
{ key = 'phys:E', mods = 'CTRL|SHIFT', action = act.SplitVertical { domain = 'CurrentPaneDomain' } },
|
||||
}
|
||||
|
||||
return config
|
||||
'';
|
||||
};
|
||||
|
||||
# The font the config asks for; the emoji font is a fallback.
|
||||
home.packages = with pkgs; [
|
||||
nerd-fonts.jetbrains-mono
|
||||
noto-fonts-color-emoji
|
||||
];
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
# XDG base dirs, the user folders and default applications.
|
||||
# Documents, Downloads, Music, Pictures and Videos are separate subvolumes on
|
||||
# the data SSD mounted into $HOME (my.disks); Desktop, Templates and Public
|
||||
# are plain directories on the system disk. Home-manager's default folder
|
||||
# names already match, so only the unwanted ones are changed.
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
let
|
||||
cfg = config.my.home.xdg;
|
||||
|
||||
firefox = "firefox.desktop";
|
||||
fileManager = "org.gnome.Nautilus.desktop";
|
||||
imageViewer = "org.gnome.Loupe.desktop";
|
||||
mediaPlayer = "mpv.desktop";
|
||||
pdfViewer = "org.pwmt.zathura.desktop";
|
||||
archiveManager = "org.gnome.FileRoller.desktop";
|
||||
in
|
||||
{
|
||||
options.my.home.xdg.enable = lib.mkEnableOption "XDG directories and default applications";
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
xdg = {
|
||||
enable = true;
|
||||
|
||||
userDirs = {
|
||||
enable = true;
|
||||
createDirectories = true;
|
||||
|
||||
# No ~/Projects: code lives wherever the user clones it.
|
||||
projects = null;
|
||||
};
|
||||
|
||||
mimeApps = {
|
||||
enable = true;
|
||||
|
||||
defaultApplications = {
|
||||
"text/html" = firefox;
|
||||
"x-scheme-handler/http" = firefox;
|
||||
"x-scheme-handler/https" = firefox;
|
||||
"x-scheme-handler/about" = firefox;
|
||||
"x-scheme-handler/unknown" = firefox;
|
||||
|
||||
"inode/directory" = fileManager;
|
||||
|
||||
"image/*" = imageViewer;
|
||||
"video/*" = mediaPlayer;
|
||||
"audio/*" = mediaPlayer;
|
||||
"application/pdf" = pdfViewer;
|
||||
|
||||
"application/zip" = archiveManager;
|
||||
"application/x-tar" = archiveManager;
|
||||
"application/x-7z-compressed" = archiveManager;
|
||||
"application/vnd.rar" = archiveManager;
|
||||
};
|
||||
};
|
||||
|
||||
# "Open in terminal" actions (desktop entries with Terminal=true) use WezTerm.
|
||||
terminal-exec = {
|
||||
enable = true;
|
||||
settings.default = [ "org.wezfurlong.wezterm.desktop" ];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
# Installer ISO (`nix build .#iso`): the minimal NixOS installer plus this
|
||||
# flake and the install tooling. Wired up in lib/default.nix (mkInstaller).
|
||||
{
|
||||
lib,
|
||||
pkgs,
|
||||
inputs,
|
||||
self,
|
||||
...
|
||||
}:
|
||||
let
|
||||
inherit (pkgs.stdenv.hostPlatform) system;
|
||||
|
||||
# Every flake input including nested ones, so the sources are on the ISO and
|
||||
# a locked flake installs without re-downloading them.
|
||||
allInputs = builtins.genericClosure {
|
||||
startSet = map (i: {
|
||||
key = toString i.outPath;
|
||||
inherit i;
|
||||
}) (lib.attrValues inputs);
|
||||
operator =
|
||||
x:
|
||||
map (i: {
|
||||
key = toString i.outPath;
|
||||
inherit i;
|
||||
}) (lib.attrValues (x.i.inputs or { }));
|
||||
};
|
||||
in
|
||||
{
|
||||
nix.settings = {
|
||||
experimental-features = [
|
||||
"nix-command"
|
||||
"flakes"
|
||||
];
|
||||
# The flake's nixConfig lists binary caches (Noctalia, nix-community).
|
||||
accept-flake-config = true;
|
||||
};
|
||||
|
||||
# nmtui / nmcli instead of wpa_supplicant.
|
||||
networking.networkmanager.enable = true;
|
||||
networking.wireless.enable = lib.mkForce false;
|
||||
|
||||
environment.systemPackages = [
|
||||
pkgs.install-system
|
||||
pkgs.create-keys
|
||||
pkgs.set-password
|
||||
pkgs.secret-from-file
|
||||
pkgs.git
|
||||
pkgs.jq
|
||||
pkgs.age
|
||||
pkgs.sbctl
|
||||
pkgs.btrfs-progs
|
||||
pkgs.neovim
|
||||
inputs.disko.packages.${system}.disko
|
||||
inputs.agenix.packages.${system}.default
|
||||
];
|
||||
|
||||
# The flake itself, read-only. install-system copies it before changing it.
|
||||
environment.etc."nixos-config".source = self;
|
||||
|
||||
system.extraDependencies = map (x: x.i.outPath) allInputs;
|
||||
|
||||
users.motd = ''
|
||||
|
||||
NixOS installer for the "desktop" flake
|
||||
|
||||
1. Network: nmtui (Ethernet works out of the box)
|
||||
2. Install: sudo install-system
|
||||
(flake: /etc/nixos-config, or --flake DIR for a copy on a stick;
|
||||
--keys-dir DIR for keys/ on a mounted stick)
|
||||
3. Keys: create-keys, set-password, secret-from-file (see the README)
|
||||
|
||||
install-system asks which disks to use and erases them only after you type the host name.
|
||||
|
||||
'';
|
||||
}
|
||||
Reference in new issue
Block a user