{ pkgs, config, lib, ... }: let projects = { btf = [ "bxi-test-frameworks" "bxi-frameworks" ]; bxi3 = [ "bxi3" ]; libs2 = [ "bxi-jenkins-libs2" ]; hps = [ "bxi-hps" ]; doc = [ "bxi-doc" ]; qemu-bxi = [ "qemu" ]; container = [ "bxi-containers" ]; flash-tools = [ "bxi-flash-tools" ]; gpumap = [ "gpumap" ]; ofi = [ "libfabric-bxi-portals" ]; lustre = [ "lustre-ptl4lnd" ]; ptlnet = [ "ptlnet" ]; openshmem = [ "sandia-openshmem" ]; bxi-base = [ "bxi-base" ]; bxi2-portals = [ "bxi-portals" ]; bxi2-mod = [ "bxi-module" ]; bxi2-ptltest = [ "bxi-portals-tests" ]; bxicomm = [ "bxicomm" ]; bxi3lnd = [ "lustre-release-bxi3" ]; }; mailingLists = { iommu = { mail = "iommu@lists.linux.dev"; tags = [ "PATCH" "RFC" ]; }; kvm = { mail = "kvm@vger.kernel.org"; tags = [ "PATCH" "RFC" ]; }; qemu = { mail = "qemu-devel@nongnu.org"; tags = [ "PATCH" "RFC" "Stable" ]; }; }; in { imports = [ ./work.nix ]; home.packages = with pkgs; [ teams-for-linux bear clang-analyzer clang-tools cppcheck jira-cli-go libfabric opensc pcsclite pcsc-tools # Broken (27 feb 2024) # python3Packages.clustershell shellcheck shfmt slack sshfs nixgl.nixGLIntel ]; programs.git = { settings.user.name = "Quentin Boyer"; settings.user.email = config.workAddr; includes = [ { condition = "gitdir:~/Perso/"; contents = { user = { email = "quentin@familleboyer.net"; name = "traxys"; }; }; } ]; }; home.sessionVariables = { OPENSC_SO = "${pkgs.opensc}"; EMAIL_CONN_TEST = "x"; }; home.file = { "libs/opensc-pkcs11.so".source = "${pkgs.opensc}/lib/opensc-pkcs11.so"; "libs/libpcsclite.so.1".source = "${pkgs.pcsclite}/lib/libpcsclite.so.1"; "bin/bxi-cn" = { text = '' #!/usr/bin/env bash exec podman run -e KERNEL_BULL_ENV=1 -it -v .:/src -w /src bril-docker-release/bxi-rhel:8.6 "$@" ''; executable = true; }; "bin/bxigpu-cn" = { text = '' #!/usr/bin/env bash exec podman run -e KERNEL_BULL_ENV=1 -it -v .:/src -w /src bril-docker-release/bxi-gpu:8.6 "$@" ''; executable = true; }; }; terminal.font.size = 10.5; programs.mbsync.enable = true; programs.msmtp.enable = true; programs.aerc = { enable = true; extraAccounts = { work-t = let workCfg = config.accounts.email.accounts.work.aerc; in { inherit (workCfg.extraAccounts) check-mail-cmd check-mail-timeout; from = "Quentin Boyer <${config.workAddr}>"; outgoing = "msmtpq --read-envelope-from --read-recipients"; default = "_unread"; postpone = "Drafts"; source = "notmuch://~/Maildir"; address-book-cmd = "${pkgs.notmuch-addrlookup}/bin/notmuch-addrlookup --format=aerc %s"; query-map = let mkPatchDir = name: "projects/${name}=tag:${name}"; patchDirs = builtins.concatStringsSep "\n" (builtins.map mkPatchDir (builtins.attrNames projects)); mkListDirs = name: '' ext/${name}=tag:${name} ext/${name}/non-patch=tag:${name} and tag:non-patch ext/${name}/unread=tag:${name} and thread:{tag:unread} ''; listDirs = lib.pipe mailingLists [ builtins.attrNames (builtins.map mkListDirs) (builtins.concatStringsSep "\n") ]; listIgnores = lib.pipe mailingLists [ builtins.attrNames (builtins.map (nm: "and not tag:${nm}")) (builtins.concatStringsSep " ") ]; in "${pkgs.writeText "querymap" '' inbox=tag:inbox and not tag:spammy _patches/inflight=thread:{tag:inflight} _patches/review=thread:{tag:review} _unread=thread:{tag:unread} ${listIgnores} _todo=thread:{tag:todo} ${listDirs} ${patchDirs} ''}"; }; }; extraConfig = { general.unsafe-accounts-conf = true; ui = { mouse-enabled = true; threading-enabled = true; dirlist-tree = true; }; filters = { "text/plain" = "colorize"; "text/calendar" = "calendar"; "message/delivery-status" = "colorize"; "message/rfc822" = "colorize"; "text/html" = "html | colorize"; "subject,~^\\[PATCH" = "delta"; "subject,~^\\[RFC" = "delta"; }; openers = { "x-scheme-handler/http*" = "firefox"; }; }; extraBinds = { global = { "" = ":prev-tab"; "" = ":next-tab"; "" = ":term"; "?" = ":help keys"; }; messages = { "q" = ":quit"; "j" = ":next"; "" = ":next"; "" = ":next 100%"; "k" = ":prev"; "" = ":prev"; "" = ":prev 100%"; "g" = ":select 0"; "G" = ":select -1"; "J" = ":next-folder"; "K" = ":prev-folder"; "T" = ":toggle-threads"; "" = ":view"; "C" = ":compose"; "" = ":read"; "rr" = ":reply -a"; "rq" = ":reply -aq"; "Rr" = ":reply"; "Rq" = ":reply -q"; "/" = ":search"; "\\" = ":filter"; "n" = ":next-result"; "N" = ":prev-result"; "" = ":clear"; "v" = ":mark -t"; "V" = ":mark -v"; "tdi" = ":tag -inflight:select 0"; "tdr" = ":tag -review:select 0"; "tdt" = ":tag -todo:select 0"; "zI" = ":cf inbox"; "zi" = ":cf _patches/inflight"; "zr" = ":cf _patches/review"; "zu" = ":cf _unread"; "zt" = ":cf _todo"; "zT" = ":cf tag:"; }; view = { "/" = ":toggle-key-passthrough/"; "q" = ":close"; "O" = ":open"; "S" = ":save"; "D" = ":delete"; "" = ":open-link "; "f" = ":forward"; "rr" = ":reply -a"; "rq" = ":reply -aq"; "Rr" = ":reply"; "Rq" = ":reply -q"; "H" = ":toggle-headers"; "" = ":prev-part"; "" = ":prev-part"; "J" = ":next"; "K" = ":prev"; }; "view::passthrough" = { "$noinherit" = "true"; "$ex" = ""; "" = ":toggle-key-passthrough"; }; compose = { "$noinherit" = true; "$ex" = ""; "" = ":prev-field"; "" = ":next-field"; "" = ":next-field"; "" = ":prev-field"; "" = ":prev-tab"; "" = ":next-tab"; }; "compose::editor" = { "$noinherit" = true; "$ex" = ""; "" = ":prev-field"; "" = ":next-field"; "" = ":prev-tab"; "" = ":next-tab"; }; "compose::review" = { "y" = ":send"; "n" = ":abort"; "v" = ":preview"; "p" = ":postpone"; "q" = ":choose -o d discard abort -o p postpone postpone"; "e" = ":edit"; "a" = ":attach"; "d" = ":detach"; }; }; }; programs.notmuch = { enable = true; new.tags = [ "new" ]; hooks = { preNew = "${pkgs.isync}/bin/mbsync --all"; postNew = let mkProjectMatch = project: "subject:'/PATCH\\s${project}\\s/'"; mkProjectMatches = labels: lib.concatStringsSep " or " (builtins.map mkProjectMatch labels); mkProject = tag: labels: '' notmuch tag +${tag} -unread -new -- tag:new and \( ${mkProjectMatches labels} \) and tag:me notmuch tag +${tag} +unread -new -- tag:new and \( ${mkProjectMatches labels} \) and not tag:me ''; projectFilters = builtins.concatStringsSep "\n" (lib.attrsets.mapAttrsToList mkProject projects); spammyFilters = [ "subject:'[confluence] Recommended in Confluence for Boyer, Quentin'" "subject:'[PCI-SIG]'" "from:enterprisedb.com" ]; spammySearch = lib.concatStringsSep " or " spammyFilters; mkList = tag: info: let subjects = lib.pipe info.tags [ (builtins.map (tag: "subject:\"/\\[${tag}/\"")) (builtins.concatStringsSep " OR ") ]; in '' notmuch tag +${tag} -new -- tag:new and to:${info.mail} and '(${subjects})' notmuch tag +${tag} +non-patch -new -- tag:new and to:${info.mail} ''; tagLists = lib.pipe mailingLists [ (lib.mapAttrsToList mkList) (builtins.concatStringsSep "\n") ]; in '' notmuch tag +work -- tag:new and 'path:work/**' ${tagLists} notmuch tag +inflight -- tag:new and from:${config.workAddr} and subject:'/^\[PATCH/' notmuch tag +review -- tag:new and not from:${config.workAddr} and subject:'/^\[PATCH/' notmuch tag -unread +me -- tag:new and from:${config.workAddr} notmuch tag -unread -new +spammy -- tag:new and \( ${spammySearch} \) ${projectFilters} notmuch tag +inbox +unread -new -- tag:new and not tag:me notmuch tag +inbox -unread -new -- tag:new and tag:me ''; }; }; programs.fish.shellAliases = { "khal-today" = "khal list today today -f '{start-time}-{end-time}: {title}'"; }; traxys.waybar.modules."custom/khal".enable = true; traxys.waybar.modules."disk#root".enable = false; traxys.waybar.modules."battery".enable = true; traxys.waybar.modules."network#wifi" = { enable = true; interface = "wlp4s0"; }; accounts = { calendar = { accounts.personal.primary = lib.mkForce false; accounts.work = { primary = true; remote = { url = "http://localhost:1080/users/${config.workAddr}/calendar/"; type = "caldav"; userName = "${config.workAddr}"; passwordCommand = [ "echo" "foobar" ]; }; khal = { enable = true; color = "light green"; }; vdirsyncer.enable = true; }; }; email = { accounts.work = rec { address = config.workAddr; imap = { host = "localhost"; port = 1143; tls.enable = false; }; mbsync = { enable = true; create = "maildir"; subFolders = "Verbatim"; extraConfig = { account = { AuthMechs = "LOGIN"; Timeout = 0; }; channel = { Sync = [ "Pull" "New" "Upgrade" ]; }; }; }; passwordCommand = "echo foobar"; notmuch.enable = true; msmtp = { enable = true; extraConfig.auth = "plain"; }; primary = true; realName = "Quentin Boyer"; userName = address; smtp = { host = "localhost"; port = 1025; tls.enable = false; }; aerc = { enable = true; extraAccounts = { check-mail-cmd = "notmuch new"; check-mail-timeout = "60s"; }; }; }; }; }; systemd.user.services.ssh-vm = { Unit.Description = "SSH tunnel to the VM"; Service = { ExecStart = "/usr/bin/ssh -o 'ServerAliveInterval=10' -NT vm -R 1025:localhost:1025"; RestartSec = 5; Restart = "always"; }; Install = { WantedBy = [ "default.target" ]; }; }; systemd.user.services.notmuch-new = { Unit = { Description = "notmuch synchronization"; }; Service = { Type = "oneshot"; ExecStart = "${pkgs.notmuch}/bin/notmuch new"; }; }; systemd.user.timers.notmuch = { Unit = { Description = "notmuch synchronization"; }; Timer = { OnCalendar = "*:0/5"; Unit = "notmuch-new.service"; }; Install = { WantedBy = [ "default.target" ]; }; }; home.homeDirectory = "/home/boyerq"; home.username = "boyerq"; home.stateVersion = "21.11"; traxys.wm = "niri"; programs.niri.settings.binds."Mod+Shift+l".action = lib.mkForce ( config.lib.niri.actions.spawn "/usr/bin/swaylock" ); wayland.windowManager.sway.extraConfig = "exec /usr/libexec/polkit-gnome-authentication-agent-1"; programs.fish.functions = { hwbmc = '' echo "BMC for $argv[1] on https://localhost:9080" ssh -N -L 9080:$argv[1]:443 bxib0 ''; }; }