mirror of
https://github.com/JulienMalka/snowfield.git
synced 2025-06-07 18:09:04 +02:00
Compare commits
10 commits
5ae45f779a
...
3b86219eb3
Author | SHA1 | Date | |
---|---|---|---|
3b86219eb3 | |||
70712a39a6 | |||
b5fdf4a7c5 | |||
ce6e0f69af | |||
2d68129ec8 | |||
3619673217 | |||
bdbd6de553 | |||
4ab45f2921 | |||
07397c1c2d | |||
88f786527c |
11 changed files with 514 additions and 146 deletions
|
@ -46,6 +46,7 @@ with lib;
|
|||
mbsync = {
|
||||
enable = true;
|
||||
create = "maildir";
|
||||
expunge = "both";
|
||||
extraConfig.channel = {
|
||||
"CopyArrivalDate" = "yes";
|
||||
};
|
||||
|
@ -67,6 +68,7 @@ with lib;
|
|||
mbsync = {
|
||||
enable = true;
|
||||
create = "maildir";
|
||||
expunge = "both";
|
||||
extraConfig.channel = {
|
||||
"CopyArrivalDate" = "yes";
|
||||
};
|
||||
|
@ -89,6 +91,7 @@ with lib;
|
|||
mbsync = {
|
||||
enable = true;
|
||||
create = "maildir";
|
||||
expunge = "both";
|
||||
extraConfig.channel = {
|
||||
"CopyArrivalDate" = "yes";
|
||||
};
|
||||
|
@ -111,6 +114,7 @@ with lib;
|
|||
mbsync = {
|
||||
enable = true;
|
||||
create = "maildir";
|
||||
expunge = "both";
|
||||
extraConfig.channel = {
|
||||
"CopyArrivalDate" = "yes";
|
||||
};
|
||||
|
@ -138,6 +142,9 @@ with lib;
|
|||
programs.notmuch = {
|
||||
enable = lib.mkDefault true;
|
||||
new.tags = [ "new" ];
|
||||
hooks.preNew = lib.mkDefault ''
|
||||
${pkgs.notmuch-mailmover}/bin/notmuch-mailmover --config ${./mailmover.lua}
|
||||
'';
|
||||
hooks.postNew = lib.mkDefault ''
|
||||
${pkgs.afew}/bin/afew --tag --new
|
||||
'';
|
||||
|
@ -149,13 +156,9 @@ with lib;
|
|||
[FolderNameFilter]
|
||||
maildir_separator = /
|
||||
folder_lowercases = true
|
||||
folder_blacklist = Sent
|
||||
[ArchiveSentMailsFilter]
|
||||
sent_tag = sent
|
||||
[Filter.1]
|
||||
query = tag:archive
|
||||
query = tag:new
|
||||
tags = -new
|
||||
[InboxFilter]
|
||||
'';
|
||||
};
|
||||
|
||||
|
|
173
home-manager-modules/mails/mailmover.lua
Normal file
173
home-manager-modules/mails/mailmover.lua
Normal file
|
@ -0,0 +1,173 @@
|
|||
local match_modes = {
|
||||
ALL = "all",
|
||||
FIRST = "first",
|
||||
UNIQUE = "unique",
|
||||
}
|
||||
|
||||
--- Execute a shell command and return its output
|
||||
local function execute_command(cmd)
|
||||
local handle = io.popen(cmd)
|
||||
local result = handle:read("*a")
|
||||
handle:close()
|
||||
return result
|
||||
end
|
||||
|
||||
--- Get all folders from the Maildir structure
|
||||
local function get_maildir_folders(maildir_path)
|
||||
local cmd = "find " .. maildir_path .. " -type d -name cur | sed 's|/cur$||' | sed 's|" .. maildir_path .. "/||'"
|
||||
local output = execute_command(cmd)
|
||||
|
||||
local folders = {}
|
||||
for folder in string.gmatch(output, "([^\n]+)") do
|
||||
if folder ~= "" then
|
||||
folders[#folders+1] = folder
|
||||
end
|
||||
end
|
||||
|
||||
return folders
|
||||
end
|
||||
|
||||
--- Check if one path is a parent of another
|
||||
local function is_parent_path(parent, child)
|
||||
return child:match("^" .. parent .. "/") ~= nil
|
||||
end
|
||||
|
||||
--- Check if a folder contains "Archive" in its name
|
||||
local function contains_archive(folder)
|
||||
return string.find(folder, "Archive") ~= nil
|
||||
end
|
||||
|
||||
--- Generate rules based on folder structure
|
||||
local function generate_rules(maildir_path)
|
||||
local folders = get_maildir_folders(maildir_path)
|
||||
local rules = {}
|
||||
|
||||
-- Create a sorted copy of folders, from longest path to shortest
|
||||
-- This ensures we process children before parents
|
||||
local sorted_folders = {}
|
||||
for _, folder in ipairs(folders) do
|
||||
table.insert(sorted_folders, folder)
|
||||
end
|
||||
table.sort(sorted_folders, function(a, b)
|
||||
return #a > #b
|
||||
end)
|
||||
|
||||
-- Store each folder's subfolder tags for exclusion
|
||||
local subfolder_tags = {}
|
||||
for _, folder in ipairs(sorted_folders) do
|
||||
subfolder_tags[folder] = {}
|
||||
end
|
||||
|
||||
-- Collect all subfolder-specific tags for each folder
|
||||
for _, folder in ipairs(sorted_folders) do
|
||||
local parts = {}
|
||||
for part in string.gmatch(folder, "([^/]+)") do
|
||||
table.insert(parts, part)
|
||||
end
|
||||
|
||||
-- For each folder, find its parent folders and add its deepest tag to their exclusion list
|
||||
if #parts > 0 then
|
||||
local deepest_tag = string.lower(parts[#parts])
|
||||
local parent_path = ""
|
||||
|
||||
for i = 1, #parts - 1 do
|
||||
if i > 1 then
|
||||
parent_path = parent_path .. "/"
|
||||
end
|
||||
parent_path = parent_path .. parts[i]
|
||||
|
||||
-- Add this tag to the parent's exclusion list
|
||||
if subfolder_tags[parent_path] then
|
||||
table.insert(subfolder_tags[parent_path], deepest_tag)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Now generate rules with proper exclusions
|
||||
for _, folder in ipairs(folders) do
|
||||
-- Skip Trash and Sent as they're already handled
|
||||
if folder ~= "Trash" and folder ~= "Sent" then
|
||||
local query_parts = {}
|
||||
local exclusion_parts = {}
|
||||
|
||||
-- Convert each folder component to a lowercase tag requirement
|
||||
for part in string.gmatch(folder, "([^/]+)") do
|
||||
table.insert(query_parts, "tag:" .. string.lower(part))
|
||||
end
|
||||
|
||||
-- Add exclusions for subfolder-specific tags
|
||||
if subfolder_tags[folder] then
|
||||
for _, tag in ipairs(subfolder_tags[folder]) do
|
||||
table.insert(exclusion_parts, "not tag:" .. tag)
|
||||
end
|
||||
end
|
||||
|
||||
-- Add "not tag:sent" for any folder containing "Archive"
|
||||
if contains_archive(folder) then
|
||||
table.insert(exclusion_parts, "not tag:sent")
|
||||
end
|
||||
|
||||
-- Build the complete query
|
||||
local query = table.concat(query_parts, " and ")
|
||||
if #exclusion_parts > 0 then
|
||||
query = query .. " and " .. table.concat(exclusion_parts, " and ")
|
||||
end
|
||||
|
||||
-- Add rule for this folder
|
||||
rules[#rules+1] = {
|
||||
folder = folder,
|
||||
query = query,
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
-- Sort rules by complexity (number of tags) - more specific rules first
|
||||
table.sort(rules, function(a, b)
|
||||
if a.folder == "Trash" then return true end
|
||||
if b.folder == "Trash" then return false end
|
||||
if a.folder == "Sent" then return true end
|
||||
if b.folder == "Sent" then return false end
|
||||
|
||||
local a_count = select(2, string.gsub(a.query, "tag:", ""))
|
||||
local b_count = select(2, string.gsub(b.query, "tag:", ""))
|
||||
return a_count > b_count
|
||||
end)
|
||||
|
||||
local final_rules = {}
|
||||
for _, rule in ipairs(rules) do
|
||||
if string.lower(rule.folder) ~= "drafts" then
|
||||
table.insert(final_rules, rule)
|
||||
end
|
||||
end
|
||||
|
||||
return final_rules
|
||||
end
|
||||
|
||||
-- Path to maildir
|
||||
local maildir_path = os.getenv("HOME") .. "/Maildir"
|
||||
|
||||
--- Configuration for notmuch-mailmover.
|
||||
--
|
||||
--- @class config
|
||||
--- @field maildir string Path to the maildir
|
||||
--- @field notmuch_config string Path to the notmuch configuration
|
||||
--- @field rename boolean Rename the files when moving
|
||||
--- @field max_age_days number Maximum age (days) of the messages to be procssed
|
||||
--- @field rule_match_mode config.match_mode Match mode for rules
|
||||
--- @field rules rule[] List of rules
|
||||
---
|
||||
--- @class rule
|
||||
--- @field folder string Folder to move the messages to
|
||||
--- @field query string Notmuch query to match the messages
|
||||
local config = {
|
||||
maildir = maildir_path,
|
||||
notmuch_config = "/home/julien/.config/notmuch/default/config",
|
||||
rename = true,
|
||||
max_age_days = 356,
|
||||
rule_match_mode = match_modes.UNIQUE,
|
||||
rules = generate_rules(maildir_path),
|
||||
}
|
||||
|
||||
|
||||
return config
|
90
lon.lock
90
lon.lock
|
@ -7,9 +7,9 @@
|
|||
"owner": "ryantm",
|
||||
"repo": "agenix",
|
||||
"branch": "main",
|
||||
"revision": "e600439ec4c273cf11e06fe4d9d906fb98fa097c",
|
||||
"url": "https://github.com/ryantm/agenix/archive/e600439ec4c273cf11e06fe4d9d906fb98fa097c.tar.gz",
|
||||
"hash": "sha256-uenf8fv2eG5bKM8C/UvFaiJMZ4IpUFaQxk9OH5t/1gA="
|
||||
"revision": "96e078c646b711aee04b82ba01aefbff87004ded",
|
||||
"url": "https://github.com/ryantm/agenix/archive/96e078c646b711aee04b82ba01aefbff87004ded.tar.gz",
|
||||
"hash": "sha256-bHCFgGeu8XjWlVuaWzi3QONjDW3coZDqSHvnd4l7xus="
|
||||
},
|
||||
"buildbot-nix": {
|
||||
"type": "GitHub",
|
||||
|
@ -27,9 +27,9 @@
|
|||
"owner": "zhaofengli",
|
||||
"repo": "colmena",
|
||||
"branch": "main",
|
||||
"revision": "a6b51f5feae9bfb145daa37fd0220595acb7871e",
|
||||
"url": "https://github.com/zhaofengli/colmena/archive/a6b51f5feae9bfb145daa37fd0220595acb7871e.tar.gz",
|
||||
"hash": "sha256-LLpiqfOGBippRax9F33kSJ/Imt8gJXb6o0JwSBiNHCk="
|
||||
"revision": "2370d4336eda2a9ef29fce10fa7076ae011983ab",
|
||||
"url": "https://github.com/zhaofengli/colmena/archive/2370d4336eda2a9ef29fce10fa7076ae011983ab.tar.gz",
|
||||
"hash": "sha256-hPSLvw6AZQYrZyGI6Uq4XgST7benF/0zcCpugn/P0yM="
|
||||
},
|
||||
"disko": {
|
||||
"type": "GitHub",
|
||||
|
@ -37,9 +37,9 @@
|
|||
"owner": "nix-community",
|
||||
"repo": "disko",
|
||||
"branch": "master",
|
||||
"revision": "e51159153b5fbe5c41caab41a7212df93c42d34b",
|
||||
"url": "https://github.com/nix-community/disko/archive/e51159153b5fbe5c41caab41a7212df93c42d34b.tar.gz",
|
||||
"hash": "sha256-sQzLVCRPfAV/TJXru/jhCyecMXinG/sW8KLoYg0nOpk="
|
||||
"revision": "b5d1320ebc2f34dbea4655f95167f55e2130cdb3",
|
||||
"url": "https://github.com/nix-community/disko/archive/b5d1320ebc2f34dbea4655f95167f55e2130cdb3.tar.gz",
|
||||
"hash": "sha256-mLlkVX1kKbAa/Ns5u26wDYw4YW4ziMFM21fhtRmfirU="
|
||||
},
|
||||
"dns": {
|
||||
"type": "GitHub",
|
||||
|
@ -57,9 +57,9 @@
|
|||
"owner": "nix-community",
|
||||
"repo": "emacs-overlay",
|
||||
"branch": "master",
|
||||
"revision": "7a9a25389a6ad9402f9aa5087ccb36f8383045a8",
|
||||
"url": "https://github.com/nix-community/emacs-overlay/archive/7a9a25389a6ad9402f9aa5087ccb36f8383045a8.tar.gz",
|
||||
"hash": "sha256-YMy01dURXhxyjx2W+Dv83b2RRnNq28K4t4+kvrRxFto="
|
||||
"revision": "c2f57f602ba4f7da96ac08537240774531cb0fb3",
|
||||
"url": "https://github.com/nix-community/emacs-overlay/archive/c2f57f602ba4f7da96ac08537240774531cb0fb3.tar.gz",
|
||||
"hash": "sha256-PT/AKx72aC7db9xBCtj3w/hOLw7AoBESMLwW48vCMqY="
|
||||
},
|
||||
"git-hooks": {
|
||||
"type": "GitHub",
|
||||
|
@ -67,9 +67,9 @@
|
|||
"owner": "cachix",
|
||||
"repo": "git-hooks.nix",
|
||||
"branch": "master",
|
||||
"revision": "9364dc02281ce2d37a1f55b6e51f7c0f65a75f17",
|
||||
"url": "https://github.com/cachix/git-hooks.nix/archive/9364dc02281ce2d37a1f55b6e51f7c0f65a75f17.tar.gz",
|
||||
"hash": "sha256-R10v2hoJRLq8jcL4syVFag7nIGE7m13qO48wRIukWNg="
|
||||
"revision": "fa466640195d38ec97cf0493d6d6882bc4d14969",
|
||||
"url": "https://github.com/cachix/git-hooks.nix/archive/fa466640195d38ec97cf0493d6d6882bc4d14969.tar.gz",
|
||||
"hash": "sha256-Wb2xeSyOsCoTCTj7LOoD6cdKLEROyFAArnYoS+noCWo="
|
||||
},
|
||||
"home-manager": {
|
||||
"type": "GitHub",
|
||||
|
@ -77,9 +77,9 @@
|
|||
"owner": "nix-community",
|
||||
"repo": "home-manager",
|
||||
"branch": "release-24.11",
|
||||
"revision": "9d3d080aec2a35e05a15cedd281c2384767c2cfe",
|
||||
"url": "https://github.com/nix-community/home-manager/archive/9d3d080aec2a35e05a15cedd281c2384767c2cfe.tar.gz",
|
||||
"hash": "sha256-Gs076ot1YuAAsYVcyidLKUMIc4ooOaRGO0PqTY7sBzA="
|
||||
"revision": "50eee705bbdbac942074a8c120e8194185633675",
|
||||
"url": "https://github.com/nix-community/home-manager/archive/50eee705bbdbac942074a8c120e8194185633675.tar.gz",
|
||||
"hash": "sha256-EyXUNSa+H+YvGVuQJP1nZskXAowxKYp79RNUsNdQTj4="
|
||||
},
|
||||
"home-manager-unstable": {
|
||||
"type": "GitHub",
|
||||
|
@ -87,9 +87,9 @@
|
|||
"owner": "nix-community",
|
||||
"repo": "home-manager",
|
||||
"branch": "master",
|
||||
"revision": "c630dfa8abcc65984cc1e47fb25d4552c81dd37e",
|
||||
"url": "https://github.com/nix-community/home-manager/archive/c630dfa8abcc65984cc1e47fb25d4552c81dd37e.tar.gz",
|
||||
"hash": "sha256-gBlb8R9gnjUAT5XabJeel3C2iEUiBHx3+91651y3Sqo="
|
||||
"revision": "8a318641ac13d3bc0a53651feaee9560f9b2d89a",
|
||||
"url": "https://github.com/nix-community/home-manager/archive/8a318641ac13d3bc0a53651feaee9560f9b2d89a.tar.gz",
|
||||
"hash": "sha256-i6BoiQP0PasExESQHszC0reQHfO6D4aI2GzOwZMOI20="
|
||||
},
|
||||
"impermanence": {
|
||||
"type": "GitHub",
|
||||
|
@ -107,9 +107,9 @@
|
|||
"owner": "nix-community",
|
||||
"repo": "lanzaboote",
|
||||
"branch": "master",
|
||||
"revision": "3bdeebbc484a09391c4f0ec8a37bb77809426660",
|
||||
"url": "https://github.com/nix-community/lanzaboote/archive/3bdeebbc484a09391c4f0ec8a37bb77809426660.tar.gz",
|
||||
"hash": "sha256-2j+sln9RwQn+g7J4GmdFFgvqXnLkvWBNMaUzONlkzUE="
|
||||
"revision": "995637eb3ab78eac33f8ee6b45cc2ecd5ede12ba",
|
||||
"url": "https://github.com/nix-community/lanzaboote/archive/995637eb3ab78eac33f8ee6b45cc2ecd5ede12ba.tar.gz",
|
||||
"hash": "sha256-4GAHjus6JRpYHVROMIhFIz/sgLDF/klBM3UHulbSK9s="
|
||||
},
|
||||
"lila": {
|
||||
"type": "GitHub",
|
||||
|
@ -117,9 +117,9 @@
|
|||
"owner": "JulienMalka",
|
||||
"repo": "lila",
|
||||
"branch": "main",
|
||||
"revision": "9c52498d310c8ecca8de63e50658bd5089617e3a",
|
||||
"url": "https://github.com/JulienMalka/lila/archive/9c52498d310c8ecca8de63e50658bd5089617e3a.tar.gz",
|
||||
"hash": "sha256-GOXCyP1DjN7RV+FULaPxBmXnKaw3jTw5W9uDfhbY/CM="
|
||||
"revision": "7e84b2a9656fd139c6e12ff3dadde07a495bd796",
|
||||
"url": "https://github.com/JulienMalka/lila/archive/7e84b2a9656fd139c6e12ff3dadde07a495bd796.tar.gz",
|
||||
"hash": "sha256-TIK8220a8M/PQ36pJSRd2yBHhM7/PfMUTtj62qTD94c="
|
||||
},
|
||||
"lon": {
|
||||
"type": "GitHub",
|
||||
|
@ -127,9 +127,9 @@
|
|||
"owner": "nikstur",
|
||||
"repo": "lon",
|
||||
"branch": "main",
|
||||
"revision": "a8b4406e5151af87b989564d4aa98ecd6d4d3500",
|
||||
"url": "https://github.com/nikstur/lon/archive/a8b4406e5151af87b989564d4aa98ecd6d4d3500.tar.gz",
|
||||
"hash": "sha256-VGvK0ahBl440NMs03WqmP7T4a1DP13yfX47YI84rlGU="
|
||||
"revision": "ad3bc97747c651e23fbc12c70a5849d3d8e9fdf4",
|
||||
"url": "https://github.com/nikstur/lon/archive/ad3bc97747c651e23fbc12c70a5849d3d8e9fdf4.tar.gz",
|
||||
"hash": "sha256-MgMDxS9xiiSkL/KsCTxLrr9wd9n1S/wq4lrA/NSyqBE="
|
||||
},
|
||||
"nix-index-database": {
|
||||
"type": "GitHub",
|
||||
|
@ -137,9 +137,9 @@
|
|||
"owner": "mic92",
|
||||
"repo": "nix-index-database",
|
||||
"branch": "main",
|
||||
"revision": "895d81b6228bbd50a6ef22f5a58a504ca99763ea",
|
||||
"url": "https://github.com/mic92/nix-index-database/archive/895d81b6228bbd50a6ef22f5a58a504ca99763ea.tar.gz",
|
||||
"hash": "sha256-/Ak+Quinhmdxa9m3shjm4lwwwqmzG8zzGhhhhgR1k9I="
|
||||
"revision": "137fd2bd726fff343874f85601b51769b48685cc",
|
||||
"url": "https://github.com/mic92/nix-index-database/archive/137fd2bd726fff343874f85601b51769b48685cc.tar.gz",
|
||||
"hash": "sha256-ShizFaJCAST23tSrHHtFFGF0fwd72AG+KhPZFFQX/0o="
|
||||
},
|
||||
"nixos-anywhere": {
|
||||
"type": "GitHub",
|
||||
|
@ -147,9 +147,9 @@
|
|||
"owner": "nix-community",
|
||||
"repo": "nixos-anywhere",
|
||||
"branch": "main",
|
||||
"revision": "e8e5d63e46f99fc75d300fb0d0447456d5057698",
|
||||
"url": "https://github.com/nix-community/nixos-anywhere/archive/e8e5d63e46f99fc75d300fb0d0447456d5057698.tar.gz",
|
||||
"hash": "sha256-HC9kugsuRpPdR1dfRV0hTIqAn+PSR9rn8QWCETILI4o="
|
||||
"revision": "edf1adb89307f921575b5fcd0c6bb4e684fbd38b",
|
||||
"url": "https://github.com/nix-community/nixos-anywhere/archive/edf1adb89307f921575b5fcd0c6bb4e684fbd38b.tar.gz",
|
||||
"hash": "sha256-F9IekLaLYVG/UNUiaN194qu0n1pOgeqjGkD1l5OVEgM="
|
||||
},
|
||||
"nixpkgs": {
|
||||
"type": "GitHub",
|
||||
|
@ -157,9 +157,9 @@
|
|||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"branch": "nixos-24.11",
|
||||
"revision": "a880f49904d68b5e53338d1e8c7bf80f59903928",
|
||||
"url": "https://github.com/nixos/nixpkgs/archive/a880f49904d68b5e53338d1e8c7bf80f59903928.tar.gz",
|
||||
"hash": "sha256-o4FjFOUmjSRMK7dn0TFdAT0RRWUWD+WsspPHa+qEQT8="
|
||||
"revision": "5b35d248e9206c1f3baf8de6a7683fee126364aa",
|
||||
"url": "https://github.com/nixos/nixpkgs/archive/5b35d248e9206c1f3baf8de6a7683fee126364aa.tar.gz",
|
||||
"hash": "sha256-NTtKOTLQv6dPfRe00OGSywg37A1FYqldS6xiNmqBUYc="
|
||||
},
|
||||
"proxmox": {
|
||||
"type": "GitHub",
|
||||
|
@ -167,9 +167,9 @@
|
|||
"owner": "saumonnet",
|
||||
"repo": "proxmox-nixos",
|
||||
"branch": "main",
|
||||
"revision": "4ad21ba619d779b229e308b58066bafd65d5153d",
|
||||
"url": "https://github.com/saumonnet/proxmox-nixos/archive/4ad21ba619d779b229e308b58066bafd65d5153d.tar.gz",
|
||||
"hash": "sha256-knX3c5OWE1C5QRDdvup+zqlWvwCLDHiME6+i18WwKsE="
|
||||
"revision": "4ebf07bd714747a9cd01e5bdb97dc0f04b92b7bc",
|
||||
"url": "https://github.com/saumonnet/proxmox-nixos/archive/4ebf07bd714747a9cd01e5bdb97dc0f04b92b7bc.tar.gz",
|
||||
"hash": "sha256-WtqTRYzXb2wTxPaIhzZof8lIp80lRZAlCZq2Q98jSZI="
|
||||
},
|
||||
"stateless-uptime-kuma": {
|
||||
"type": "Git",
|
||||
|
@ -186,9 +186,9 @@
|
|||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"branch": "nixos-unstable",
|
||||
"revision": "063dece00c5a77e4a0ea24e5e5a5bd75232806f8",
|
||||
"url": "https://github.com/nixos/nixpkgs/archive/063dece00c5a77e4a0ea24e5e5a5bd75232806f8.tar.gz",
|
||||
"hash": "sha256-nEo1t3Q0F+0jQ36HJfbJtiRU4OI+/0jX/iITURKe3EE="
|
||||
"revision": "979daf34c8cacebcd917d540070b52a3c2b9b16e",
|
||||
"url": "https://github.com/nixos/nixpkgs/archive/979daf34c8cacebcd917d540070b52a3c2b9b16e.tar.gz",
|
||||
"hash": "sha256-uKCfuDs7ZM3QpCE/jnfubTg459CnKnJG/LwqEVEdEiw="
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{ pkgs, ... }:
|
||||
{ pkgs, lib, ... }:
|
||||
{
|
||||
|
||||
luj.hmgr.julien = {
|
||||
|
@ -13,6 +13,21 @@
|
|||
luj.programs.firefox.enable = true;
|
||||
luj.programs.pass.enable = true;
|
||||
|
||||
luj.emails.enable = true;
|
||||
|
||||
services.mbsync.postExec = lib.mkForce null;
|
||||
|
||||
services.mbsync.enable = lib.mkForce false;
|
||||
programs.mbsync.enable = lib.mkForce false;
|
||||
programs.notmuch.hooks.postNew = lib.mkForce "";
|
||||
|
||||
services.muchsync.remotes."gustave" = {
|
||||
frequency = "minutely";
|
||||
local.checkForModifiedFiles = true;
|
||||
remote.checkForModifiedFiles = true;
|
||||
remote.host = "gustave";
|
||||
};
|
||||
|
||||
programs.direnv = {
|
||||
enable = true;
|
||||
nix-direnv.enable = true;
|
||||
|
@ -62,6 +77,12 @@
|
|||
emacs-lsp-booster
|
||||
hunspellDicts.en_US
|
||||
hunspellDicts.fr-moderne
|
||||
rust-analyzer
|
||||
cargo
|
||||
rustc
|
||||
pyright
|
||||
unstable.nixfmt-rfc-style
|
||||
i3lock
|
||||
]
|
||||
++ builtins.filter lib.attrsets.isDerivation (builtins.attrValues pkgs.nerd-fonts);
|
||||
fonts.fontconfig.enable = true;
|
||||
|
|
|
@ -5,6 +5,55 @@
|
|||
inputs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
|
||||
stumpwmContrib = pkgs.fetchFromGitHub {
|
||||
owner = "stumpwm";
|
||||
repo = "stumpwm-contrib";
|
||||
rev = "1e3fa7abae30e5d5498e69ba56da6a7e265144cc";
|
||||
hash = "sha256-ewPeamcEWcvAHY1pmnbsVmej8gSt2qIo+lSMjpKwF6k=";
|
||||
|
||||
};
|
||||
sbcl_stump = pkgs.sbcl_2_4_6;
|
||||
stumpwmWithDeps = sbcl_stump.pkgs.stumpwm.overrideLispAttrs (x: {
|
||||
lispLibs =
|
||||
x.lispLibs
|
||||
++ (with sbcl_stump.pkgs; [
|
||||
clx-truetype
|
||||
slynk
|
||||
]);
|
||||
});
|
||||
|
||||
stumpwmWithDepsRunnable = pkgs.runCommand "stuumpwm-with-deps-runnable" { } ''
|
||||
mkdir -p "$out/bin" "$out/lib"
|
||||
cp -r "${stumpwmContrib}" "contrib"
|
||||
chmod u+rwX -R contrib
|
||||
export HOME="$PWD"
|
||||
FIRA_CODE_PATH="${pkgs.fira-code}/share/fonts/truetype"
|
||||
POWERLINE_PATH="${pkgs.powerline-fonts}/share/fonts/truetype"
|
||||
ln -s "${stumpwmWithDeps}" "$out/lib/stumpwm"
|
||||
${(sbcl_stump.withPackages (_: [ stumpwmWithDeps ]))}/bin/sbcl \
|
||||
--eval '(require :asdf)' --eval '(asdf:disable-output-translations)' \
|
||||
--eval '(require :stumpwm)' \
|
||||
--eval '(in-package :stumpwm)' \
|
||||
--eval '(setf *default-package* :stumpwm)' \
|
||||
--eval '(set-module-dir "contrib")' \
|
||||
--eval '(defvar stumpwm::*local-module-dir* "contrib")' \
|
||||
--eval '(load-module "mem")' \
|
||||
--eval '(load-module "cpu")' \
|
||||
--eval '(load-module "battery-portable")' \
|
||||
--eval '(load-module "net")' \
|
||||
--eval '(load-module "urgentwindows")' \
|
||||
--eval '(load-module "ttf-fonts")' \
|
||||
--eval '(require :slynk)' \
|
||||
--eval '(require :clx-truetype)' \
|
||||
--eval '(defvar *wallpaper* nil)' \
|
||||
--eval '(setf *wallpaper* "${./wallpaper.jpeg}")' \
|
||||
--eval "(setf clx-truetype:*font-dirs* (list \"$FIRA_CODE_PATH\" \"$POWERLINE_PATH\"))" \
|
||||
--eval "(sb-ext:save-lisp-and-die \"$out/bin/stumpwm\" :executable t :toplevel #'stumpwm:stumpwm)"
|
||||
test -x "$out/bin/stumpwm"
|
||||
'';
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
./hardware.nix
|
||||
|
@ -34,6 +83,19 @@
|
|||
};
|
||||
boot.initrd.systemd.tpm2.enable = true;
|
||||
|
||||
services.xserver = {
|
||||
enable = true;
|
||||
displayManager.lightdm.enable = true;
|
||||
windowManager.stumpwm.enable = true;
|
||||
windowManager.stumpwm.package = stumpwmWithDepsRunnable;
|
||||
};
|
||||
|
||||
services.picom = {
|
||||
enable = true;
|
||||
backend = "xr_glx_hybrid";
|
||||
vSync = true;
|
||||
};
|
||||
|
||||
services.pipewire = {
|
||||
enable = true;
|
||||
alsa.enable = true;
|
||||
|
@ -62,6 +124,41 @@
|
|||
networking.networkmanager.dns = "systemd-resolved";
|
||||
services.resolved.enable = true;
|
||||
|
||||
services.autorandr = {
|
||||
enable = true;
|
||||
profiles = {
|
||||
default = {
|
||||
fingerprint = {
|
||||
eDP-1-1 = "00ffffffffffff0006af9af900000000141f0104a51e13780363f5a854489d240e505400000001010101010101010101010101010101fa3c80b870b0244010103e002dbc1000001ac83080b870b0244010103e002dbc1000001a000000fe004a38335646804231343055414e0000000000024101b2001100000a410a20200068";
|
||||
};
|
||||
config = {
|
||||
eDP-1-1.enable = true;
|
||||
};
|
||||
};
|
||||
dock-julien = {
|
||||
fingerprint = {
|
||||
eDP-1-1 = "00ffffffffffff0006af9af900000000141f0104a51e13780363f5a854489d240e505400000001010101010101010101010101010101fa3c80b870b0244010103e002dbc1000001ac83080b870b0244010103e002dbc1000001a000000fe004a38335646804231343055414e0000000000024101b2001100000a410a20200068";
|
||||
DP-1-5-3 = "00ffffffffffff0010ac42d1425439312021010380351e78eaa3d5ab524f9d240f5054a54b008100b300d100714fa9408180d1c00101565e00a0a0a02950302035000f282100001a000000ff004446354c5459330a2020202020000000fc0044454c4c205032343233440a20000000fd00314b1d711c000a2020202020200107020318b14d010203071112161304141f051065030c001000023a801871382d40582c45000f282100001e011d8018711c1620582c25000f282100009e011d007251d01e206e2855000f282100001e7e3900a080381f4030203a000f282100001a00000000000000000000000000000000000000000000000000000000000000c1";
|
||||
DP-1-5-1 = "00ffffffffffff0026cd6b610f01010117210104a5351e783be725a8554ea0260d5054bfef80d140d100d1c0b30095009040818081c0565e00a0a0a02950302035000f282100001a000000ff0031323134383332333030313335000000fd00314b0f5a19000a202020202020000000fc00504c32343933510a202020202001c5020320f153101f051404131e1d121116150f0e030207060123097f0783010000394e00a0a0a02250302035000f282100001a000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000079";
|
||||
};
|
||||
config = {
|
||||
eDP-1-1.enable = false;
|
||||
DP-1-5-1 = {
|
||||
enable = true;
|
||||
primary = true;
|
||||
position = "0x0";
|
||||
mode = "2560x1440";
|
||||
};
|
||||
DP-1-5-3 = {
|
||||
enable = true;
|
||||
position = "2560x0";
|
||||
mode = "2560x1440";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
# Select internationalisation properties.
|
||||
i18n.defaultLocale = "en_US.UTF-8";
|
||||
console = {
|
||||
|
@ -74,36 +171,50 @@
|
|||
# Load nvidia driver for Xorg and Wayland
|
||||
services.xserver.videoDrivers = [ "nvidia" ];
|
||||
|
||||
services.libinput.touchpad.tapping = false;
|
||||
|
||||
hardware.nvidia.prime = {
|
||||
sync.enable = true;
|
||||
intelBusId = "PCI:0:2:0";
|
||||
nvidiaBusId = "PCI:1:0:0";
|
||||
};
|
||||
|
||||
hardware.nvidia = {
|
||||
|
||||
# Modesetting is required.
|
||||
modesetting.enable = true;
|
||||
|
||||
# Nvidia power management. Experimental, and can cause sleep/suspend to fail.
|
||||
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+
|
||||
# Do not disable this unless your GPU is unsupported or if you have a good reason to.
|
||||
powerManagement.enable = true;
|
||||
#powerManagement.finegrained = true;
|
||||
open = true;
|
||||
|
||||
# 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.
|
||||
dynamicBoost.enable = true;
|
||||
package = config.boot.kernelPackages.nvidiaPackages.beta;
|
||||
};
|
||||
|
||||
environment.variables = {
|
||||
# Required to run the correct GBM backend for nvidia GPUs on wayland
|
||||
GBM_BACKEND = "nvidia-drm";
|
||||
# Apparently, without this nouveau may attempt to be used instead
|
||||
# (despite it being blacklisted)
|
||||
__GLX_VENDOR_LIBRARY_NAME = "nvidia";
|
||||
# Hardware cursors are currently broken on wlroots
|
||||
WLR_NO_HARDWARE_CURSORS = "1";
|
||||
};
|
||||
|
||||
boot.extraModprobeConfig =
|
||||
"options nvidia "
|
||||
+ lib.concatStringsSep " " [
|
||||
# nvidia assume that by default your CPU does not support PAT,
|
||||
# but this is effectively never the case in 2023
|
||||
"NVreg_UsePageAttributeTable=1"
|
||||
# This is sometimes needed for ddc/ci support, see
|
||||
# https://www.ddcutil.com/nvidia/
|
||||
#
|
||||
# Current monitor does not support it, but this is useful for
|
||||
# the future
|
||||
"NVreg_RegistryDwords=RMUseSwI2c=0x01;RMI2cSpeed=100"
|
||||
];
|
||||
|
||||
boot.initrd.kernelModules = [ "nvidia" ];
|
||||
boot.extraModulePackages = [ config.boot.kernelPackages.nvidia_x11 ];
|
||||
|
||||
programs.dconf.enable = true;
|
||||
|
||||
|
@ -123,6 +234,7 @@
|
|||
wl-mirror
|
||||
texlive.combined.scheme-full
|
||||
mu
|
||||
stumpwmWithDepsRunnable
|
||||
];
|
||||
|
||||
networking.hosts = {
|
||||
|
|
|
@ -1,35 +1,48 @@
|
|||
# Do not modify this file! It was generated by ‘nixos-generate-config’
|
||||
# and may be overwritten by future invocations. Please make changes
|
||||
# to /etc/nixos/configuration.nix instead.
|
||||
{ config, lib, modulesPath, ... }:
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
modulesPath,
|
||||
...
|
||||
}:
|
||||
|
||||
{
|
||||
imports =
|
||||
[
|
||||
(modulesPath + "/installer/scan/not-detected.nix")
|
||||
];
|
||||
imports = [
|
||||
(modulesPath + "/installer/scan/not-detected.nix")
|
||||
];
|
||||
|
||||
boot.initrd.availableKernelModules = [ "xhci_pci" "thunderbolt" "vmd" "nvme" "usb_storage" "usbhid" "sd_mod" "rtsx_pci_sdmmc" ];
|
||||
boot.initrd.availableKernelModules = [
|
||||
"xhci_pci"
|
||||
"thunderbolt"
|
||||
"vmd"
|
||||
"nvme"
|
||||
"usb_storage"
|
||||
"usbhid"
|
||||
"sd_mod"
|
||||
"rtsx_pci_sdmmc"
|
||||
];
|
||||
boot.initrd.kernelModules = [ ];
|
||||
boot.kernelModules = [ "kvm-intel" ];
|
||||
boot.extraModulePackages = [ ];
|
||||
boot.kernelPackages = pkgs.linuxPackages_latest;
|
||||
|
||||
fileSystems."/" =
|
||||
{
|
||||
device = "/dev/disk/by-uuid/f7072a83-0478-48ea-9f55-074541c1c524";
|
||||
fsType = "btrfs";
|
||||
};
|
||||
fileSystems."/" = {
|
||||
device = "/dev/disk/by-uuid/f7072a83-0478-48ea-9f55-074541c1c524";
|
||||
fsType = "btrfs";
|
||||
};
|
||||
|
||||
boot.initrd.luks.devices."cryptroot".device = "/dev/disk/by-uuid/56dc5a16-94ca-4a9c-a215-51ed55aec6b5";
|
||||
boot.initrd.luks.devices."cryptroot".device =
|
||||
"/dev/disk/by-uuid/56dc5a16-94ca-4a9c-a215-51ed55aec6b5";
|
||||
|
||||
fileSystems."/boot" =
|
||||
{
|
||||
device = "/dev/disk/by-uuid/9331-9E52";
|
||||
fsType = "vfat";
|
||||
};
|
||||
fileSystems."/boot" = {
|
||||
device = "/dev/disk/by-uuid/9331-9E52";
|
||||
fsType = "vfat";
|
||||
};
|
||||
|
||||
swapDevices =
|
||||
[{ device = "/dev/disk/by-uuid/63debceb-44e6-4e27-94df-092dd59fd9e2"; }];
|
||||
swapDevices = [ { device = "/dev/disk/by-uuid/63debceb-44e6-4e27-94df-092dd59fd9e2"; } ];
|
||||
|
||||
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
|
||||
# (the default) this is the recommended approach. When using systemd-networkd it's
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{ pkgs, ... }:
|
||||
{ pkgs, lib, ... }:
|
||||
{
|
||||
|
||||
luj.hmgr.julien = {
|
||||
|
@ -13,9 +13,23 @@
|
|||
luj.programs.fish.enable = true;
|
||||
luj.programs.dunst.enable = true;
|
||||
luj.programs.firefox.enable = true;
|
||||
luj.emails.enable = true;
|
||||
luj.programs.hyprland.enable = true;
|
||||
|
||||
luj.emails.enable = true;
|
||||
|
||||
services.mbsync.postExec = lib.mkForce null;
|
||||
|
||||
services.mbsync.enable = lib.mkForce false;
|
||||
programs.mbsync.enable = lib.mkForce false;
|
||||
programs.notmuch.hooks.postNew = lib.mkForce "";
|
||||
|
||||
services.muchsync.remotes."gustave" = {
|
||||
frequency = "minutely";
|
||||
local.checkForModifiedFiles = true;
|
||||
remote.checkForModifiedFiles = true;
|
||||
remote.host = "gustave";
|
||||
};
|
||||
|
||||
programs.emacs = {
|
||||
enable = true;
|
||||
package = pkgs.emacs-igc;
|
||||
|
@ -39,6 +53,16 @@
|
|||
size = 15;
|
||||
};
|
||||
|
||||
services.screen-locker = {
|
||||
enable = true;
|
||||
lockCmd = "XSECURELOCK_PASSWORD_PROMPT=time_hex ${pkgs.xsecurelock}/bin/xsecurelock";
|
||||
xautolock.enable = false; # means use xss-lock
|
||||
xss-lock.extraOptions = [
|
||||
"--notifier=${pkgs.xsecurelock}/libexec/xsecurelock/dimmer"
|
||||
"-l" # prevents suspend before locker is started
|
||||
];
|
||||
};
|
||||
|
||||
home.packages =
|
||||
with pkgs;
|
||||
[
|
||||
|
@ -79,6 +103,8 @@
|
|||
kanidm
|
||||
yubioath-flutter
|
||||
ltex-ls
|
||||
powerline-fonts
|
||||
drawio
|
||||
]
|
||||
++ builtins.filter lib.attrsets.isDerivation (builtins.attrValues pkgs.nerd-fonts);
|
||||
|
||||
|
|
|
@ -27,6 +27,13 @@
|
|||
];
|
||||
};
|
||||
|
||||
"arcadia" = {
|
||||
id = "E5CGH2H-3XMMCKQ-5PTMKKA-4C4VDS3-JCBZGRM-4GTAWHQ-QRJ367E-BXFMUAU";
|
||||
addresses = [
|
||||
"tcp://arcadia.luj:22000"
|
||||
];
|
||||
};
|
||||
|
||||
};
|
||||
folders = {
|
||||
"dev" = {
|
||||
|
@ -34,6 +41,7 @@
|
|||
devices = [
|
||||
"gustave"
|
||||
"gallifrey"
|
||||
"arcadia"
|
||||
];
|
||||
};
|
||||
};
|
||||
|
|
BIN
machines/fischer/wallpaper.jpeg
Normal file
BIN
machines/fischer/wallpaper.jpeg
Normal file
Binary file not shown.
After Width: | Height: | Size: 253 KiB |
|
@ -1,17 +1,18 @@
|
|||
{
|
||||
devices = {
|
||||
disk = {
|
||||
sda = {
|
||||
main = {
|
||||
type = "disk";
|
||||
device = "/dev/sda";
|
||||
device = "/dev/sdb";
|
||||
content = {
|
||||
type = "gpt";
|
||||
partitions = {
|
||||
boot = {
|
||||
size = "1M";
|
||||
type = "EF02";
|
||||
};
|
||||
ESP = {
|
||||
priority = 1;
|
||||
name = "ESP";
|
||||
start = "1M";
|
||||
end = "128M";
|
||||
size = "512M";
|
||||
type = "EF00";
|
||||
content = {
|
||||
type = "filesystem";
|
||||
|
@ -19,35 +20,60 @@
|
|||
mountpoint = "/boot";
|
||||
};
|
||||
};
|
||||
swap = {
|
||||
size = "16G";
|
||||
content = {
|
||||
type = "swap";
|
||||
discardPolicy = "both";
|
||||
};
|
||||
};
|
||||
root = {
|
||||
size = "100%";
|
||||
content = {
|
||||
type = "btrfs";
|
||||
extraArgs = [ "-f" ]; # Override existing partition
|
||||
# Subvolumes must set a mountpoint in order to be mounted,
|
||||
# unless their parent is mounted
|
||||
subvolumes = {
|
||||
# Subvolume name is different from mountpoint
|
||||
"/root" = {
|
||||
mountpoint = "/";
|
||||
};
|
||||
# Subvolume name is the same as the mountpoint
|
||||
"/persistent" = {
|
||||
mountpoint = "/persistent";
|
||||
};
|
||||
"/nix" = {
|
||||
mountOptions = [
|
||||
"compress=zstd"
|
||||
"noatime"
|
||||
];
|
||||
mountpoint = "/nix";
|
||||
};
|
||||
};
|
||||
type = "lvm_pv";
|
||||
vg = "mainpool";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
lvm_vg = {
|
||||
mainpool = {
|
||||
type = "lvm_vg";
|
||||
lvs = {
|
||||
root = {
|
||||
size = "100G";
|
||||
pool = "mainpool";
|
||||
content = {
|
||||
type = "filesystem";
|
||||
format = "ext4";
|
||||
mountpoint = "/";
|
||||
mountOptions = [ "defaults" ];
|
||||
};
|
||||
};
|
||||
persistent = {
|
||||
size = "1500G";
|
||||
pool = "mainpool";
|
||||
content = {
|
||||
type = "filesystem";
|
||||
format = "ext4";
|
||||
mountpoint = "/persistent";
|
||||
mountOptions = [ "defaults" ];
|
||||
};
|
||||
};
|
||||
|
||||
store = {
|
||||
size = "200G";
|
||||
pool = "mainpool";
|
||||
content = {
|
||||
type = "filesystem";
|
||||
format = "ext4";
|
||||
mountpoint = "/nix";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,4 +1,9 @@
|
|||
{ lib, modulesPath, ... }:
|
||||
{
|
||||
lib,
|
||||
modulesPath,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
{
|
||||
imports = [ (modulesPath + "/profiles/qemu-guest.nix") ];
|
||||
|
@ -15,33 +20,14 @@
|
|||
boot.kernelModules = [ ];
|
||||
boot.extraModulePackages = [ ];
|
||||
|
||||
fileSystems."/persistent".neededForBoot = lib.mkForce true;
|
||||
|
||||
boot.initrd.postDeviceCommands = lib.mkAfter ''
|
||||
mkdir /btrfs_tmp
|
||||
mount /dev/disk/by-partlabel/disk-sda-root /btrfs_tmp
|
||||
if [[ -e /btrfs_tmp/root ]]; then
|
||||
mkdir -p /btrfs_tmp/old_roots
|
||||
timestamp=$(date --date="@$(stat -c %Y /btrfs_tmp/root)" "+%Y-%m-%-d_%H:%M:%S")
|
||||
mv /btrfs_tmp/root "/btrfs_tmp/old_roots/$timestamp"
|
||||
fi
|
||||
|
||||
delete_subvolume_recursively() {
|
||||
IFS=$'\n'
|
||||
for i in $(btrfs subvolume list -o "$1" | cut -f 9- -d ' '); do
|
||||
delete_subvolume_recursively "/btrfs_tmp/$i"
|
||||
done
|
||||
btrfs subvolume delete "$1"
|
||||
}
|
||||
|
||||
for i in $(find /btrfs_tmp/old_roots/ -maxdepth 1 -mtime +30); do
|
||||
delete_subvolume_recursively "$i"
|
||||
done
|
||||
|
||||
btrfs subvolume create /btrfs_tmp/root
|
||||
umount /btrfs_tmp
|
||||
boot.initrd.postDeviceCommands = ''
|
||||
lvm lvremove --force /dev/mainpool/root || :
|
||||
yes | lvm lvcreate --size 100G --name root mainpool
|
||||
${pkgs.e2fsprogs}/bin/mkfs.ext4 /dev/mainpool/root
|
||||
'';
|
||||
|
||||
fileSystems."/persistent".neededForBoot = lib.mkForce true;
|
||||
|
||||
networking.useDHCP = lib.mkDefault true;
|
||||
|
||||
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue