Compare commits

..

6 commits

Author SHA1 Message Date
eaf542722a home: git: fix Python env ignore
All checks were successful
ci/woodpecker/push/check Pipeline was successful
2026-04-08 14:23:36 +00:00
95363f49e6 home: calibre: use upstream module 2026-04-08 14:23:36 +00:00
dbb6f235fd home: vim: clarify how to disable 'ignorecase'
Because I tend to forget the exact way to do it, let's document it so I
have an easy place to check next time.
2026-04-08 14:23:36 +00:00
cea0410c3d home: vim: fix unimpaired mapping descriptions 2026-04-08 14:23:36 +00:00
762779c461 home: vim: prefix augroup with 'ambroisie.*' 2026-04-08 14:23:36 +00:00
277ed53bb0 flake: bump inputs 2026-04-08 14:23:36 +00:00
22 changed files with 150 additions and 205 deletions

30
flake.lock generated
View file

@ -73,11 +73,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1772408722, "lastModified": 1775087534,
"narHash": "sha256-rHuJtdcOjK7rAHpHphUb1iCvgkU3GpfvicLMwwnfMT0=", "narHash": "sha256-91qqW8lhL7TLwgQWijoGBbiD4t7/q75KTi8NxjVmSmA=",
"owner": "hercules-ci", "owner": "hercules-ci",
"repo": "flake-parts", "repo": "flake-parts",
"rev": "f20dc5d9b8027381c474144ecabc9034d6a839a3", "rev": "3107b77cd68437b9a76194f0f7f9c55f2329ca5b",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -117,11 +117,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1775036584, "lastModified": 1775585728,
"narHash": "sha256-zW0lyy7ZNNT/x8JhzFHBsP2IPx7ATZIPai4FJj12BgU=", "narHash": "sha256-8Psjt+TWvE4thRKktJsXfR6PA/fWWsZ04DVaY6PUhr4=",
"owner": "cachix", "owner": "cachix",
"repo": "git-hooks.nix", "repo": "git-hooks.nix",
"rev": "4e0eb042b67d863b1b34b3f64d52ceb9cd926735", "rev": "580633fa3fe5fc0379905986543fd7495481913d",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -159,11 +159,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1774991950, "lastModified": 1775622785,
"narHash": "sha256-kScKj3qJDIWuN9/6PMmgy5esrTUkYinrO5VvILik/zw=", "narHash": "sha256-/yFxO+7oS1SymDfJ2iVO7K5vJKcYfe9XGIJ+quLqz0Q=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "f2d3e04e278422c7379e067e323734f3e8c585a7", "rev": "527e47b78fe67213072f706bf933a9705a8c4974",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -175,11 +175,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1775020384, "lastModified": 1775423009,
"narHash": "sha256-3XiHDhiNxb2vWI0en8ug7WBMEPj9mcaWcMhaFFfhfJY=", "narHash": "sha256-vPKLpjhIVWdDrfiUM8atW6YkIggCEKdSAlJPzzhkQlw=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "c9971bfbabf2fa3f3b7e6e4cbeaa2abd6295b478", "rev": "68d8aa3d661f0e6bd5862291b5bb263b2a6595c9",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -199,11 +199,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1775037587, "lastModified": 1775654726,
"narHash": "sha256-3weRbM7ODQocl6wTgyuKPubhpjS4zP2VA5YxeDx6YG8=", "narHash": "sha256-4R6Bc5EIQ+HxVte1Mo1B3OkyYFVmehywOPiH3Z9CAIU=",
"owner": "nix-community", "owner": "nix-community",
"repo": "NUR", "repo": "NUR",
"rev": "0a0ed0957d4fee887d5101d3975d40e98658d75c", "rev": "c73a8885bd1bb5d329e16a4512e2c2708c5981a7",
"type": "github" "type": "github"
}, },
"original": { "original": {

View file

@ -25,7 +25,7 @@
# Network-Manager applet # Network-Manager applet
nm-applet.enable = true; nm-applet.enable = true;
# Terminal # Terminal
terminal.default = "alacritty"; terminal.program = "alacritty";
# Transmission remote # Transmission remote
trgui.enable = true; trgui.enable = true;
# Zathura document viewer # Zathura document viewer

View file

@ -10,8 +10,10 @@ in
}; };
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
home.packages = [ programs.calibre = {
cfg.package enable = true;
];
inherit (cfg) package;
};
}; };
} }

View file

@ -48,29 +48,15 @@ in
"browser.bookmarks.showMobileBookmarks" = true; # Mobile bookmarks "browser.bookmarks.showMobileBookmarks" = true; # Mobile bookmarks
"browser.download.useDownloadDir" = false; # Ask for download location "browser.download.useDownloadDir" = false; # Ask for download location
"browser.in-content.dark-mode" = true; # Dark mode "browser.in-content.dark-mode" = true; # Dark mode
"browser.ml.chat.enabled" = false; # No AI
"browser.ml.chat.menu" = false; # No AI
"browser.ml.chat.page" = false; # No AI
"browser.ml.chat.page.footerBadge" = false; # No AI
"browser.ml.chat.page.menuBadge" = false; # No AI
"browser.ml.chat.shortcuts" = false; # No AI
"browser.ml.chat.sidebar" = false; # No AI
"browser.ml.enable" = false; # No AI
"browser.ml.linkPreview.enabled" = false; # No AI
"browser.ml.pageAssist.enabled" = false; # No AI
"browser.newtabpage.activity-stream.feeds.section.topstories" = false; # Disable top stories "browser.newtabpage.activity-stream.feeds.section.topstories" = false; # Disable top stories
"browser.newtabpage.activity-stream.feeds.sections" = false; "browser.newtabpage.activity-stream.feeds.sections" = false;
"browser.newtabpage.activity-stream.feeds.system.topstories" = false; # Disable top stories "browser.newtabpage.activity-stream.feeds.system.topstories" = false; # Disable top stories
"browser.newtabpage.activity-stream.section.highlights.includePocket" = false; # Disable pocket "browser.newtabpage.activity-stream.section.highlights.includePocket" = false; # Disable pocket
"browser.tabs.groups.smart.enabled" = false; # No AI
"browser.tabs.groups.smart.userEnabled" = false; # No AI
"browser.urlbar.trimURLs" = false; # Always show the `http://` prefix "browser.urlbar.trimURLs" = false; # Always show the `http://` prefix
"extensions.ml.enabled" = false; # No AI
"extensions.pocket.enabled" = false; # Disable pocket "extensions.pocket.enabled" = false; # Disable pocket
"media.eme.enabled" = true; # Enable DRM "media.eme.enabled" = true; # Enable DRM
"media.gmp-widevinecdm.enabled" = true; # Enable DRM "media.gmp-widevinecdm.enabled" = true; # Enable DRM
"media.gmp-widevinecdm.visible" = true; # Enable DRM "media.gmp-widevinecdm.visible" = true; # Enable DRM
"sidebar.notification.badge.aichat" = false; # No AI
"signon.autofillForms" = false; # Disable built-in form-filling "signon.autofillForms" = false; # Disable built-in form-filling
"signon.rememberSignons" = false; # Disable built-in password manager "signon.rememberSignons" = false; # Disable built-in password manager
"ui.systemUsesDarkTheme" = true; # Dark mode "ui.systemUsesDarkTheme" = true; # Dark mode

View file

@ -2,21 +2,13 @@
let let
cfg = config.my.home.firefox.tridactyl; cfg = config.my.home.firefox.tridactyl;
term = config.my.home.terminal.default; term = config.my.home.terminal.program;
vimCommandLine = vimCommandLine = {
let alacritty = ''-e "vim" "%f" "+normal!%lGzv%c|"'';
# Termite wants the whole command in a single argument... # Termite wants the whole command in a single argument...
brokenExecCommand = { termite = ''-e "vim %f '+normal!%lGzv%c|'"'';
termite = true; };
};
# Assume most other terminals are sane and not broken...
isBroken = brokenExecCommand.${term} or false;
in
if isBroken then
''-e "vim %f '+normal!%lGzv%c|'"''
else
''-e "vim" "%f" "+normal!%lGzv%c|"'';
in in
{ {
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
@ -25,9 +17,9 @@ in
# Use my configured terminal # Use my configured terminal
term term
# Make it easy to pick out with a window class name # Make it easy to pick out with a window class name
"--title=tridactyl_editor" "--class tridactyl_editor"
# Open vim with the cursor in the correct position # Open vim with the cursor in the correct position
vimCommandLine vimCommandLine.${term}
]; ];
}; };
}; };

View file

@ -5,7 +5,7 @@
*.out *.out
# Python files # Python files
env/ .venv/
__pycache__/ __pycache__/
*.py[cod] *.py[cod]
.mypy_cache/ .mypy_cache/

View file

@ -9,50 +9,18 @@ in
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
programs.less = {
enable = true;
config = ''
#command
# Quit without clearing the screen on `Q`
Q toggle-option -!^Predraw-on-quit\nq
#line-edit
# readline-style command editing
^p up
^n down
^b left
^f right
^a home
^e end
\eb word-left
\ef word-right
^w word-backspace
\ed word-delete
# Simulate delete to start/end of line by repeating word-wise actions
^u word-backspace ${lib.strings.replicate 100 "^w"}
^k word-delete ${lib.strings.replicate 100 "\\ed"}
'';
};
home.sessionVariables = { home.sessionVariables = {
# My default pager # My default pager
PAGER = "less"; PAGER = "less";
# Set `LESS` in the environment so it overrides git's pager (and others) # Clear the screen on start and exit
LESS = LESS = "-R -+X -c";
let # Better XDG compliance
options = { LESSHISTFILE = "${config.xdg.stateHome}/less/history";
# Always use the alternate screen (so that it is cleared on exit)
"+no-init" = true;
# Write text top-down, rather than from the bottom
clear-screen = true;
# Interpret (some) escape sequences
RAW-CONTROL-CHARS = true;
# Use colored text in search and UI
use-color = true;
};
in
lib.concatStringsSep " " (lib.cli.toCommandLineGNU { } options);
}; };
xdg.configFile."lesskey".text = ''
# Quit without clearing the screen on `Q`
Q toggle-option -!^Predraw-on-quit\nq
'';
}; };
} }

View file

@ -1,22 +1,9 @@
{ config, lib, ... }: { config, lib, ... }:
let let
cfg = config.my.home.terminal.alacritty; cfg = config.my.home.terminal;
inherit (config.my.home.terminal) colors;
in in
{ {
options.my.home.terminal = with lib; { config = lib.mkIf (cfg.program == "alacritty") {
default = mkOption {
type = with types; nullOr (enum [ "alacritty" ]);
};
alacritty = {
enable = mkEnableOption "alacritty" // {
default = config.my.home.terminal.default == "alacritty";
};
};
};
config = lib.mkIf cfg.enable {
programs.alacritty = { programs.alacritty = {
enable = true; enable = true;
@ -27,36 +14,36 @@ in
colors = { colors = {
primary = { primary = {
background = colors.background; background = cfg.colors.background;
foreground = colors.foreground; foreground = cfg.colors.foreground;
bright_foreground = colors.foregroundBold; bright_foreground = cfg.colors.foregroundBold;
}; };
cursor = { cursor = {
cursor = colors.cursor; cursor = cfg.colors.cursor;
}; };
normal = { normal = {
black = colors.black; black = cfg.colors.black;
red = colors.red; red = cfg.colors.red;
green = colors.green; green = cfg.colors.green;
yellow = colors.yellow; yellow = cfg.colors.yellow;
blue = colors.blue; blue = cfg.colors.blue;
magenta = colors.magenta; magenta = cfg.colors.magenta;
cyan = colors.cyan; cyan = cfg.colors.cyan;
white = colors.white; white = cfg.colors.white;
}; };
bright = { bright = {
black = colors.blackBold; black = cfg.colors.blackBold;
red = colors.redBold; red = cfg.colors.redBold;
green = colors.greenBold; green = cfg.colors.greenBold;
yellow = colors.yellowBold; yellow = cfg.colors.yellowBold;
blue = colors.blueBold; blue = cfg.colors.blueBold;
magenta = colors.magentaBold; magenta = cfg.colors.magentaBold;
cyan = colors.cyanBold; cyan = cfg.colors.cyanBold;
white = colors.whiteBold; white = cfg.colors.whiteBold;
}; };
}; };
}; };

View file

@ -16,11 +16,11 @@ in
options.my.home = with lib; { options.my.home = with lib; {
terminal = { terminal = {
default = mkOption { program = mkOption {
type = with types; nullOr (enum [ ]); type = with types; nullOr (enum [ "alacritty" "termite" ]);
default = null; default = null;
example = "termite"; example = "termite";
description = "Which default terminal to use for home session"; description = "Which terminal to use for home session";
}; };
colors = { colors = {
@ -56,7 +56,7 @@ in
}; };
}; };
config.home.sessionVariables = lib.mkIf (cfg.default != null) { config.home.sessionVariables = lib.mkIf (cfg.program != null) {
TERMINAL = cfg.default; TERMINAL = cfg.program;
}; };
} }

View file

@ -1,22 +1,9 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
let let
cfg = config.my.home.terminal.termite; cfg = config.my.home.terminal;
inherit (config.my.home.terminal) colors;
in in
{ {
options.my.home.terminal = with lib; { config = lib.mkIf (cfg.program == "termite") {
default = mkOption {
type = with types; nullOr (enum [ "termite" ]);
};
termite = {
enable = mkEnableOption "termite" // {
default = config.my.home.terminal.default == "termite";
};
};
};
config = lib.mkIf cfg.enable {
programs.termite = { programs.termite = {
enable = true; enable = true;
@ -37,11 +24,11 @@ in
# Colors # Colors
backgroundColor = colors.background; backgroundColor = cfg.colors.background;
cursorColor = colors.cursor; cursorColor = cfg.colors.cursor;
foregroundColor = colors.foreground; foregroundColor = cfg.colors.foreground;
foregroundBoldColor = colors.foregroundBold; foregroundBoldColor = cfg.colors.foregroundBold;
colorsExtra = with colors; '' colorsExtra = with cfg.colors; ''
# Normal colors # Normal colors
color0 = ${black} color0 = ${black}
color1 = ${red} color1 = ${red}

View file

@ -31,9 +31,9 @@ in
}; };
}); });
default = { ${config.my.home.terminal.default} = { }; }; default = { ${config.my.home.terminal.program} = { }; };
defaultText = literalExpression '' defaultText = literalExpression ''
{ ''${config.my.home.terminal.default} = { }; }; { ''${config.my.home.terminal.program} = { }; };
''; '';
example = { xterm-256color = { }; }; example = { xterm-256color = { }; };
description = '' description = ''

View file

@ -82,7 +82,7 @@ local keys = {
-- Disable option -- Disable option
{ "]o", group = "Disable option" }, { "]o", group = "Disable option" },
{ "]ob", desc = "Light background" }, { "]ob", desc = "Dark background" },
{ "]oc", desc = "Cursor line" }, { "]oc", desc = "Cursor line" },
{ "]od", desc = "Diff" }, { "]od", desc = "Diff" },
{ "]of", "<cmd>FormatDisable<CR>", desc = "LSP Formatting" }, { "]of", "<cmd>FormatDisable<CR>", desc = "LSP Formatting" },
@ -101,7 +101,7 @@ local keys = {
-- Toggle option -- Toggle option
{ "yo", group = "Toggle option" }, { "yo", group = "Toggle option" },
{ "yob", desc = "Light background" }, { "yob", desc = "Toggle background" },
{ "yoc", desc = "Cursor line" }, { "yoc", desc = "Cursor line" },
{ "yod", desc = "Diff" }, { "yod", desc = "Diff" },
{ "yof", "<cmd>FormatToggle<CR>", desc = "LSP Formatting" }, { "yof", "<cmd>FormatToggle<CR>", desc = "LSP Formatting" },

View file

@ -112,7 +112,7 @@ colorscheme gruvbox
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Enable search high-lighting while the search is on-going " Enable search high-lighting while the search is on-going
set hlsearch set hlsearch
" Ignore case on search " Ignore case on search unless \C is in search terms
set ignorecase set ignorecase
" Ignore case unless there is an uppercase letter in the pattern " Ignore case unless there is an uppercase letter in the pattern
set smartcase set smartcase

View file

@ -1,7 +1,7 @@
-- Show lines numbers -- Show lines numbers
vim.opt.number = true vim.opt.number = true
local numbertoggle = vim.api.nvim_create_augroup("numbertoggle", { clear = true }) local numbertoggle = vim.api.nvim_create_augroup("ambroisie.numbertoggle", { clear = true })
-- Toggle numbers between relative and absolute when changing buffers -- Toggle numbers between relative and absolute when changing buffers
vim.api.nvim_create_autocmd({ "BufEnter", "FocusGained", "InsertLeave", "WinEnter" }, { vim.api.nvim_create_autocmd({ "BufEnter", "FocusGained", "InsertLeave", "WinEnter" }, {

View file

@ -76,14 +76,14 @@ local function treesitter_try_attach(buf, language)
-- Syntax highlighting -- Syntax highlighting
vim.treesitter.start(buf, language) vim.treesitter.start(buf, language)
-- Indentation -- Indentation
vim.bo[buf].indentexpr = "v:lua.require('nvim-treesitter').indentexpr()" vim.bo.indentexpr = "v:lua.require('nvim-treesitter').indentexpr()"
return true return true
end end
vim.api.nvim_create_autocmd("FileType", { vim.api.nvim_create_autocmd("FileType", {
pattern = "*", pattern = "*",
group = vim.api.nvim_create_augroup("treesitter_attach", { clear = true }), group = vim.api.nvim_create_augroup("ambroisie.treesitter_attach", { clear = true }),
callback = function(args) callback = function(args)
local buf, filetype = args.buf, args.match local buf, filetype = args.buf, args.match
local language = vim.treesitter.language.get_lang(filetype) local language = vim.treesitter.language.get_lang(filetype)

View file

@ -1,4 +1,4 @@
local signtoggle = vim.api.nvim_create_augroup("signtoggle", { clear = true }) local signtoggle = vim.api.nvim_create_augroup("ambroisie.signtoggle", { clear = true })
-- Only show sign column for the currently focused buffer, if it has a number column -- Only show sign column for the currently focused buffer, if it has a number column
vim.api.nvim_create_autocmd({ "BufEnter", "FocusGained", "WinEnter" }, { vim.api.nvim_create_autocmd({ "BufEnter", "FocusGained", "WinEnter" }, {

View file

@ -1,4 +1,4 @@
{ config, lib, ... }: { config, lib, pkgs, ... }:
let let
mkRelatedOption = description: relatedWMs: mkRelatedOption = description: relatedWMs:
let let
@ -20,14 +20,14 @@ in
options.my.home.wm = with lib; { options.my.home.wm = with lib; {
windowManager = mkOption { windowManager = mkOption {
type = with types; nullOr (enum [ ]); type = with types; nullOr (enum [ "i3" ]);
default = null; default = null;
example = "i3"; example = "i3";
description = "Which window manager to use for home session"; description = "Which window manager to use for home session";
}; };
cursor = { cursor = {
enable = mkRelatedOption "cursor configuration" [ "i3" ]; enable = mkRelatedOption "dunst configuration" [ "i3" ];
}; };
dunst = { dunst = {
@ -68,14 +68,29 @@ in
}; };
screen-lock = { screen-lock = {
enable = mkRelatedOption "automatic screen locker" [ "i3" ]; enable = mkRelatedOption "automatic X screen locker" [ "i3" ];
command = mkOption { command = mkOption {
type = types.str; type = types.str;
default = "${lib.getExe pkgs.i3lock} -n -c 000000";
example = "\${lib.getExe pkgs.i3lock} -n -i lock.png"; example = "\${lib.getExe pkgs.i3lock} -n -i lock.png";
description = "Locker command to run"; description = "Locker command to run";
}; };
cornerLock = {
enable = my.mkDisableOption ''
Move mouse to upper-left corner to lock instantly, lower-right corner to
disable auto-lock.
'';
delay = mkOption {
type = types.int;
default = 5;
example = 15;
description = "How many seconds before locking this way";
};
};
notify = { notify = {
enable = my.mkDisableOption "Notify when about to lock the screen"; enable = my.mkDisableOption "Notify when about to lock the screen";
@ -85,15 +100,17 @@ in
example = 15; example = 15;
description = '' description = ''
How many seconds in advance should there be a notification. How many seconds in advance should there be a notification.
This value must be at lesser than or equal to `cornerLock.delay`
when both options are enabled.
''; '';
}; };
}; };
timeout = mkOption { timeout = mkOption {
type = types.int; type = types.ints.between 1 60;
default = 15; default = 15;
example = 1; example = 1;
description = "Inactive time interval (in minutes) to lock the screen automatically"; description = "Inactive time interval to lock the screen automatically";
}; };
}; };
}; };

View file

@ -3,8 +3,8 @@ let
isEnabled = config.my.home.wm.windowManager == "i3"; isEnabled = config.my.home.wm.windowManager == "i3";
terminal = terminal =
if config.my.home.terminal.default != null if config.my.home.terminal.program != null
then config.my.home.terminal.default then config.my.home.terminal.program
else "i3-sensible-terminal"; else "i3-sensible-terminal";
alt = "Mod1"; # `Alt` key alt = "Mod1"; # `Alt` key
@ -47,25 +47,15 @@ let
if ${systemctlUser} is-active xautolock-session.service; then if ${systemctlUser} is-active xautolock-session.service; then
${systemctlUser} stop --user xautolock-session.service ${systemctlUser} stop --user xautolock-session.service
xset s off xset s off
xset s 0 0
xset -dpms
${notify} "Disabled Xautolock" ${notify} "Disabled Xautolock"
else else
${systemctlUser} start xautolock-session.service ${systemctlUser} start xautolock-session.service
xset s on xset s on
xset s 0 0
xset +dpms
${notify} "Enabled Xautolock" ${notify} "Enabled Xautolock"
fi fi
''; '';
in in
{ {
options.my.home.wm = with lib; {
windowManager = mkOption {
type = with types; nullOr (enum [ "i3" ]);
};
};
config = lib.mkIf isEnabled { config = lib.mkIf isEnabled {
home.packages = with pkgs; [ home.packages = with pkgs; [
ambroisie.dragger # drag-and-drop from the CLI ambroisie.dragger # drag-and-drop from the CLI
@ -75,9 +65,6 @@ in
xdotool # Used by 'rofi-rbw', in a mapping xdotool # Used by 'rofi-rbw', in a mapping
]; ];
# Set `i3lock` as the (default) lock command
my.home.wm.screen-lock.command = lib.mkDefault "${lib.getExe pkgs.i3lock} -n -c 000000";
xsession.windowManager.i3 = { xsession.windowManager.i3 = {
enable = true; enable = true;
@ -136,7 +123,7 @@ in
inherit modifier; inherit modifier;
criteria = [ criteria = [
{ title = "^tridactyl_editor$"; } { class = "^tridactyl_editor$"; }
{ class = "^Blueman-.*$"; } { class = "^Blueman-.*$"; }
{ title = "^htop$"; } { title = "^htop$"; }
{ class = "^Thunderbird$"; instance = "Mailnews"; window_role = "filterlist"; } { class = "^Thunderbird$"; instance = "Mailnews"; window_role = "filterlist"; }
@ -400,10 +387,5 @@ in
}; };
}; };
}; };
# Use a grey background
xsession.profileExtra = ''
${lib.getExe pkgs.xsetroot} -solid '#333333'
'';
}; };
} }

View file

@ -7,7 +7,7 @@ in
programs.rofi = { programs.rofi = {
enable = true; enable = true;
terminal = config.my.home.terminal.default; # null by default terminal = config.my.home.terminal.program; # null by default
package = pkgs.rofi.override { package = pkgs.rofi.override {
plugins = with pkgs; [ plugins = with pkgs; [

View file

@ -2,22 +2,32 @@
let let
cfg = config.my.home.wm.screen-lock; cfg = config.my.home.wm.screen-lock;
lockNotifier = pkgs.writeShellApplication { notificationCmd =
name = "lock-notifier"; let
runtimeInputs = [ duration = toString (cfg.notify.delay * 1000);
pkgs.libnotify notifyCmd = "${lib.getExe pkgs.libnotify} -u critical -t ${duration}";
]; in
text = '' # Needs to be surrounded by quotes for systemd to launch it correctly
duration=${toString cfg.notify.delay} ''"${notifyCmd} -- 'Locking in ${toString cfg.notify.delay} seconds'"'';
notify-send \
-u critical \
-t "$((duration * 1000))" -- \
"Locking in $duration seconds"
'';
};
in in
{ {
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
assertions = [
{
assertion =
let
inherit (cfg) cornerLock notify;
bothEnabled = cornerLock.enable && notify.enable;
cornerLockHigherThanNotify = cornerLock.delay >= notify.delay;
in
bothEnabled -> cornerLockHigherThanNotify;
message = ''
`config.my.home.wm.notify.delay` cannot have a value higher than
`config.my.home.wm.cornerLock.delay`.
'';
}
];
services.screen-locker = { services.screen-locker = {
enable = true; enable = true;
@ -26,11 +36,19 @@ in
lockCmd = cfg.command; lockCmd = cfg.command;
xautolock = { xautolock = {
extraOptions = lib.optionals cfg.notify.enable [ extraOptions = lib.optionals cfg.cornerLock.enable [
# Mouse corners: instant lock on upper-left, never lock on lower-right
"-cornerdelay"
"${toString cfg.cornerLock.delay}"
"-cornerredelay"
"${toString cfg.cornerLock.delay}"
"-corners"
"+00-"
] ++ lib.optionals cfg.notify.enable [
"-notify" "-notify"
"${toString cfg.notify.delay}" "${toString cfg.notify.delay}"
"-notifier" "-notifier"
(lib.getExe lockNotifier) notificationCmd
]; ];
}; };
}; };

View file

@ -1,4 +1,4 @@
{ config, lib, ... }: { config, lib, pkgs, ... }:
let let
cfg = config.my.profiles.x; cfg = config.my.profiles.x;
in in
@ -10,6 +10,12 @@ in
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
# Enable the X11 windowing system. # Enable the X11 windowing system.
services.xserver.enable = true; services.xserver.enable = true;
# Nice wallpaper
services.xserver.displayManager.lightdm.background =
let
wallpapers = "${pkgs.kdePackages.plasma-workspace-wallpapers}/share/wallpapers";
in
"${wallpapers}/summer_1am/contents/images/2560x1600.jpg";
# X configuration # X configuration
my.home.x.enable = true; my.home.x.enable = true;

View file

@ -1,6 +1,6 @@
# Extra wireguard keys that are not hosts NixOS hosts # Extra wireguard keys that are not hosts NixOS hosts
let let
keys = import ../../../../../keys; keys = import ../../../../keys;
all = [ all = [
keys.users.ambroisie keys.users.ambroisie