mirror of
https://github.com/Smaug123/nix-dotfiles
synced 2025-10-05 22:48:39 +00:00
Split into modules (#50)
This commit is contained in:
56
flake.lock
generated
56
flake.lock
generated
@@ -7,11 +7,11 @@
|
||||
"rust-overlay": "rust-overlay"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1711325419,
|
||||
"narHash": "sha256-dKZUWMB4py9rhefu1lsrCrwksK4WX/dtW8Ma807KyPA=",
|
||||
"lastModified": 1712279577,
|
||||
"narHash": "sha256-Bwn4rmQi2L2iX6g3ycQMA4baE3zgPHAO0xPBpr2T4/k=",
|
||||
"owner": "tpwrules",
|
||||
"repo": "nixos-apple-silicon",
|
||||
"rev": "93e85575f63b32b9996676513d95288fc1c87ca9",
|
||||
"rev": "d47afc3f0f8b3078c818da8609c41340af61a2ec",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -50,11 +50,11 @@
|
||||
"nixpkgs-stable": "nixpkgs-stable"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1711789603,
|
||||
"narHash": "sha256-5c8prZYLBFgMDoBrBTMuAu6F33HHF9kfK+i4d39gUDA=",
|
||||
"lastModified": 1712941527,
|
||||
"narHash": "sha256-wD9XQFGW0qzRW1YHj6oklCHzgKNxjwS0tZ/hFGgiHX4=",
|
||||
"owner": "nix-community",
|
||||
"repo": "emacs-overlay",
|
||||
"rev": "f8ad90d467e2a48cf91aa0b3b75ac7929dc07425",
|
||||
"rev": "9f4406718ada7af83892e17355ef7fd202c20897",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -102,11 +102,11 @@
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1709336216,
|
||||
"narHash": "sha256-Dt/wOWeW6Sqm11Yh+2+t0dfEWxoMxGBvv3JpIocFl9E=",
|
||||
"lastModified": 1712014858,
|
||||
"narHash": "sha256-sB4SWl2lX95bExY2gMFG5HIzvva5AVMJd4Igm+GpZNw=",
|
||||
"owner": "hercules-ci",
|
||||
"repo": "flake-parts",
|
||||
"rev": "f7b3c975cf067e56e7cda6cb098ebe3fb4d74ca2",
|
||||
"rev": "9126214d0a59633752a136528f5f3b9aa8565b7d",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -219,11 +219,11 @@
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1711625603,
|
||||
"narHash": "sha256-W+9dfqA9bqUIBV5u7jaIARAzMe3kTq/Hp2SpSVXKRQw=",
|
||||
"lastModified": 1712759992,
|
||||
"narHash": "sha256-2APpO3ZW4idlgtlb8hB04u/rmIcKA8O7pYqxF66xbNY=",
|
||||
"owner": "nix-community",
|
||||
"repo": "home-manager",
|
||||
"rev": "c0ef0dab55611c676ad7539bf4e41b3ec6fa87d2",
|
||||
"rev": "31357486b0ef6f4e161e002b6893eeb4fafc3ca9",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -254,11 +254,11 @@
|
||||
},
|
||||
"locked": {
|
||||
"dir": "contrib",
|
||||
"lastModified": 1711756269,
|
||||
"narHash": "sha256-3e0j/bvXCI1eOxt6x/ENGkhlDRD3nxLhDU0Q8JViiw0=",
|
||||
"lastModified": 1712877603,
|
||||
"narHash": "sha256-8JesAgnsv1bD+xHNoqefz0Gv243wSiCKnzh4rhZLopU=",
|
||||
"owner": "neovim",
|
||||
"repo": "neovim",
|
||||
"rev": "2424c3e6967ef953222cf48564629ffe5812d415",
|
||||
"rev": "18ee9f9e7dbbc9709ee9c1572870b4ad31443569",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -279,11 +279,11 @@
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1711757045,
|
||||
"narHash": "sha256-+85QI5/ABsk3ObUS2/uPkShQQuHbaq4bgzVBE5zAY94=",
|
||||
"lastModified": 1712880226,
|
||||
"narHash": "sha256-2CGLzsFft8zF/gEY4qDN0uAjRCWUqvNJ9yV118NlzTg=",
|
||||
"owner": "nix-community",
|
||||
"repo": "neovim-nightly-overlay",
|
||||
"rev": "8c9dcf6816db1b976046e491dfb61eef8c15a202",
|
||||
"rev": "58d367a1924bf0d02bcc5bd2c5af8ac97f178381",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -294,27 +294,27 @@
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1711163522,
|
||||
"narHash": "sha256-YN/Ciidm+A0fmJPWlHBGvVkcarYWSC+s3NTPk/P+q3c=",
|
||||
"lastModified": 1712163089,
|
||||
"narHash": "sha256-Um+8kTIrC19vD4/lUCN9/cU9kcOsD1O1m+axJqQPyMM=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "44d0940ea560dee511026a53f0e2e2cde489b4d4",
|
||||
"rev": "fd281bd6b7d3e32ddfa399853946f782553163b5",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "44d0940ea560dee511026a53f0e2e2cde489b4d4",
|
||||
"rev": "fd281bd6b7d3e32ddfa399853946f782553163b5",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs-stable": {
|
||||
"locked": {
|
||||
"lastModified": 1711668574,
|
||||
"narHash": "sha256-u1dfs0ASQIEr1icTVrsKwg2xToIpn7ZXxW3RHfHxshg=",
|
||||
"lastModified": 1712741485,
|
||||
"narHash": "sha256-bCs0+MSTra80oXAsnM6Oq62WsirOIaijQ/BbUY59tR4=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "219951b495fc2eac67b1456824cc1ec1fd2ee659",
|
||||
"rev": "b2cf36f43f9ef2ded5711b30b1f393ac423d8f72",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -326,11 +326,11 @@
|
||||
},
|
||||
"nixpkgs_2": {
|
||||
"locked": {
|
||||
"lastModified": 1711715736,
|
||||
"narHash": "sha256-9slQ609YqT9bT/MNX9+5k5jltL9zgpn36DpFB7TkttM=",
|
||||
"lastModified": 1712849433,
|
||||
"narHash": "sha256-flQtf/ZPJgkLY/So3Fd+dGilw2DKIsiwgMEn7BbBHL0=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "807c549feabce7eddbf259dbdcec9e0600a0660d",
|
||||
"rev": "f173d0881eff3b21ebb29a2ef8bedbc106c86ea5",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@@ -5,49 +5,7 @@
|
||||
dotnet,
|
||||
secretsPath,
|
||||
...
|
||||
}: let
|
||||
deobfuscate = str: let
|
||||
lib = nixpkgs.lib;
|
||||
base64Table =
|
||||
builtins.listToAttrs
|
||||
(lib.imap0 (i: c: lib.nameValuePair c i)
|
||||
(lib.stringToCharacters "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"));
|
||||
|
||||
# Generated using python3:
|
||||
# print(''.join([ chr(n) for n in range(1, 256) ]), file=open('ascii', 'w'))
|
||||
ascii = builtins.readFile ./ascii;
|
||||
|
||||
# List of base-64 numbers
|
||||
numbers64 = map (c: base64Table.${c}) (lib.lists.reverseList (lib.stringToCharacters str));
|
||||
|
||||
# List of base-256 numbers
|
||||
numbers256 = lib.concatLists (lib.genList (
|
||||
i: let
|
||||
v =
|
||||
lib.foldl'
|
||||
(acc: el: acc * 64 + el)
|
||||
0
|
||||
(lib.sublist (i * 4) 4 numbers64);
|
||||
in [
|
||||
(lib.mod (v / 256 / 256) 256)
|
||||
(lib.mod (v / 256) 256)
|
||||
(lib.mod v 256)
|
||||
]
|
||||
) (lib.length numbers64 / 4));
|
||||
in
|
||||
# Converts base-256 numbers to ascii
|
||||
lib.concatMapStrings (
|
||||
n:
|
||||
# Can't represent the null byte in Nix..
|
||||
let
|
||||
result = lib.substring (n - 1) 1 ascii;
|
||||
in
|
||||
if result == " "
|
||||
then ""
|
||||
else result
|
||||
)
|
||||
numbers256;
|
||||
in {
|
||||
}: {
|
||||
# Let Home Manager install and manage itself.
|
||||
programs.home-manager.enable = true;
|
||||
|
||||
@@ -67,47 +25,24 @@ in {
|
||||
|
||||
fonts.fontconfig.enable = true;
|
||||
|
||||
programs.tmux = {
|
||||
shell = "${nixpkgs.zsh}/bin/zsh";
|
||||
escapeTime = 50;
|
||||
mouse = false;
|
||||
prefix = "C-b";
|
||||
enable = true;
|
||||
terminal = "screen-256color";
|
||||
extraConfig = ''
|
||||
set-option -sa terminal-features ',xterm-256color:RGB'
|
||||
'';
|
||||
};
|
||||
|
||||
programs.zsh = {
|
||||
enable = true;
|
||||
autocd = true;
|
||||
autosuggestion.enable = true;
|
||||
enableCompletion = true;
|
||||
history = {
|
||||
expireDuplicatesFirst = true;
|
||||
};
|
||||
sessionVariables = {
|
||||
EDITOR = "vim";
|
||||
LC_ALL = "en_US.UTF-8";
|
||||
LC_CTYPE = "en_US.UTF-8";
|
||||
RUSTFLAGS = "-L ${nixpkgs.libiconv}/lib -L ${nixpkgs.libcxx}/lib";
|
||||
RUST_BACKTRACE = "full";
|
||||
};
|
||||
shellAliases = {
|
||||
vim = "nvim";
|
||||
view = "vim -R";
|
||||
grep = "${nixpkgs.ripgrep}/bin/rg";
|
||||
};
|
||||
sessionVariables = {
|
||||
RIPGREP_CONFIG_PATH = ./ripgrep.conf;
|
||||
};
|
||||
initExtra = builtins.readFile ./.zshrc;
|
||||
};
|
||||
imports = [
|
||||
# ./modules/agda.nix
|
||||
# ./modules/emacs.nix
|
||||
./modules/direnv.nix
|
||||
./modules/tmux.nix
|
||||
./modules/zsh.nix
|
||||
./modules/ripgrep.nix
|
||||
./modules/alacritty.nix
|
||||
./modules/rust.nix
|
||||
(import ./modules/mail.nix
|
||||
{
|
||||
inherit mbsync secretsPath;
|
||||
pkgs = nixpkgs;
|
||||
})
|
||||
];
|
||||
|
||||
programs.fzf = {
|
||||
enable = true;
|
||||
enableZshIntegration = true;
|
||||
};
|
||||
|
||||
programs.git = {
|
||||
@@ -322,25 +257,7 @@ in {
|
||||
package = nixpkgs.neovim-nightly;
|
||||
};
|
||||
|
||||
programs.direnv = {
|
||||
enable = true;
|
||||
enableZshIntegration = true;
|
||||
nix-direnv.enable = true;
|
||||
};
|
||||
|
||||
programs.alacritty = {
|
||||
enable = true;
|
||||
settings = {
|
||||
font = {
|
||||
normal = {
|
||||
family = "FiraCode Nerd Font Mono";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
home.packages = [
|
||||
nixpkgs.notmuch
|
||||
nixpkgs.nodePackages_latest.dockerfile-language-server-nodejs
|
||||
nixpkgs.nodePackages_latest.bash-language-server
|
||||
nixpkgs.nodePackages_latest.vscode-json-languageserver
|
||||
@@ -353,8 +270,6 @@ in {
|
||||
nixpkgs.nil
|
||||
nixpkgs.fsautocomplete
|
||||
nixpkgs.keepassxc
|
||||
nixpkgs.rust-analyzer
|
||||
nixpkgs.tmux
|
||||
nixpkgs.wget
|
||||
nixpkgs.yt-dlp
|
||||
nixpkgs.cmake
|
||||
@@ -365,32 +280,20 @@ in {
|
||||
nixpkgs.hledger-web
|
||||
dotnet
|
||||
nixpkgs.jitsi-meet
|
||||
nixpkgs.ripgrep
|
||||
nixpkgs.elan
|
||||
nixpkgs.coreutils-prefixed
|
||||
nixpkgs.shellcheck
|
||||
nixpkgs.html-tidy
|
||||
nixpkgs.hugo
|
||||
nixpkgs.agda
|
||||
nixpkgs.pijul
|
||||
nixpkgs.universal-ctags
|
||||
nixpkgs.asciinema
|
||||
nixpkgs.git-lfs
|
||||
nixpkgs.imagemagick
|
||||
nixpkgs.nixpkgs-fmt
|
||||
nixpkgs.grpc-tools
|
||||
nixpkgs.element-desktop
|
||||
nixpkgs.ihp-new
|
||||
nixpkgs.direnv
|
||||
nixpkgs.lnav
|
||||
nixpkgs.age
|
||||
nixpkgs.nodejs
|
||||
nixpkgs.nodePackages.pyright
|
||||
nixpkgs.sqlitebrowser
|
||||
nixpkgs.typst
|
||||
nixpkgs.poetry
|
||||
nixpkgs.woodpecker-agent
|
||||
nixpkgs.alacritty
|
||||
nixpkgs.lynx
|
||||
nixpkgs.alejandra
|
||||
nixpkgs.ffmpeg
|
||||
@@ -398,154 +301,8 @@ in {
|
||||
nixpkgs.pandoc
|
||||
nixpkgs.fd
|
||||
nixpkgs.sumneko-lua-language-server
|
||||
(nixpkgs.nerdfonts.override {fonts = ["FiraCode" "DroidSansMono"];})
|
||||
];
|
||||
|
||||
accounts.email.accounts."Gmail" = let
|
||||
address = (deobfuscate "AFTN0cWdh12c") + "gmail.com";
|
||||
in {
|
||||
notmuch.enable = true;
|
||||
neomutt = {
|
||||
enable = true;
|
||||
};
|
||||
address = address;
|
||||
flavor = "gmail.com";
|
||||
mbsync = {
|
||||
enable = true;
|
||||
create = "maildir";
|
||||
extraConfig.account = {
|
||||
AuthMechs = "XOAUTH2";
|
||||
};
|
||||
};
|
||||
userName = address;
|
||||
# This is accompanied by a developer application at Google:
|
||||
# https://console.cloud.google.com/apis/credentials
|
||||
# Create an OAuth 2.0 Client ID with type `Desktop`.
|
||||
# The Google application needs the https://mail.google.com scope; mine has
|
||||
# an authorized domain `google.com` but I don't know if that's required.
|
||||
# Enter the client ID and client secret into a two-line text file
|
||||
# named gmail-client-app.txt immediately next to the intended destination
|
||||
# secret file (the arg to mutt-oauth2.py in the invocation):
|
||||
# so here it would be /path/to/gmail-client-app.txt .
|
||||
# Run `./mail/mutt-oauth2.py /path/to/secret --authorize --verbose` once manually,
|
||||
# and that will populate /path/to/secret.
|
||||
# I've left it unencrypted here; the original uses GPG to store it encrypted at rest.
|
||||
passwordCommand = ''${nixpkgs.python3}/bin/python ${./mail/mutt-oauth2.py} ${secretsPath}/gmail.txt'';
|
||||
realName = "Patrick Stevens";
|
||||
};
|
||||
|
||||
accounts.email.accounts."BTInternet" = let
|
||||
address = (deobfuscate "z5WZ2VGdz5yajlmc0FGc") + "@btinternet.com";
|
||||
in {
|
||||
notmuch.enable = true;
|
||||
neomutt = {
|
||||
enable = true;
|
||||
};
|
||||
address = address;
|
||||
imap = {
|
||||
host = "mail.btinternet.com";
|
||||
port = 993;
|
||||
tls = {
|
||||
enable = true;
|
||||
useStartTls = false;
|
||||
};
|
||||
};
|
||||
mbsync = {
|
||||
enable = true;
|
||||
create = "maildir";
|
||||
};
|
||||
realName = "Patrick Stevens";
|
||||
passwordCommand = "cat ${secretsPath}/btinternet.txt";
|
||||
smtp = {
|
||||
host = "mail.btinternet.com";
|
||||
port = 465;
|
||||
tls = {
|
||||
enable = true;
|
||||
useStartTls = false;
|
||||
};
|
||||
};
|
||||
userName = address;
|
||||
primary = true;
|
||||
};
|
||||
|
||||
accounts.email.accounts."Proton" = let
|
||||
address = deobfuscate "gAya15ybj5ycuVmdlR3crNWayRXYwB0ajlmc0FGc";
|
||||
in {
|
||||
notmuch.enable = true;
|
||||
neomutt = {
|
||||
enable = true;
|
||||
};
|
||||
address = address;
|
||||
# I use the ProtonMail bridge, which sits at localhost.
|
||||
imap = {
|
||||
host = "127.0.0.1";
|
||||
port = 1143; # 8125; if using hydroxide
|
||||
tls = {
|
||||
enable = false;
|
||||
useStartTls = true;
|
||||
};
|
||||
};
|
||||
mbsync = {
|
||||
enable = true;
|
||||
create = "maildir";
|
||||
extraConfig.account = {
|
||||
# Because ProtonMail Bridge is localhost, we don't
|
||||
# care that we can only auth to it in plain text.
|
||||
AuthMechs = "LOGIN";
|
||||
};
|
||||
};
|
||||
realName = "Patrick Stevens";
|
||||
passwordCommand =
|
||||
# I store the ProtonMail Bridge password here.
|
||||
# Extracting it from a keychain would be better.
|
||||
"cat ${secretsPath}/proton.txt";
|
||||
smtp = {
|
||||
host = "127.0.0.1";
|
||||
port = 1025; # 8126; if using hydroxide
|
||||
tls = {enable = false;};
|
||||
};
|
||||
userName = address;
|
||||
};
|
||||
|
||||
programs.mbsync = {
|
||||
enable = true;
|
||||
extraConfig = ''
|
||||
CopyArrivalDate yes
|
||||
'';
|
||||
package = mbsync;
|
||||
};
|
||||
programs.neomutt = {
|
||||
enable = true;
|
||||
extraConfig = ''
|
||||
set use_threads=threads sort=last-date sort_aux=date
|
||||
'';
|
||||
sidebar.enable = true;
|
||||
vimKeys = true;
|
||||
};
|
||||
|
||||
programs.notmuch.enable = true;
|
||||
|
||||
home.file.".mailcap".source = ./mail/mailcap;
|
||||
home.file.".ideavimrc".source = ./ideavimrc;
|
||||
home.file.".config/yt-dlp/config".source = ./youtube-dl.conf;
|
||||
# Not actually used, but if I ever need to debug it'll be easier
|
||||
# if I can see what the current state of the world is by looking in .config
|
||||
home.file.".config/ripgrep/config".source = ./ripgrep.conf;
|
||||
|
||||
programs.emacs = {
|
||||
enable = true;
|
||||
package = nixpkgs.emacs;
|
||||
extraPackages = epkgs: [epkgs.evil];
|
||||
extraConfig = ''
|
||||
(load-file (let ((coding-system-for-read 'utf-8))
|
||||
(shell-command-to-string "agda-mode locate")))
|
||||
(require 'evil)
|
||||
(evil-mode 1)
|
||||
(evil-set-undo-system 'undo-redo)
|
||||
;; Allow hash to be entered
|
||||
(global set-key (kbd "M-3") '(lambda () (interactive) (insert "#")))
|
||||
'';
|
||||
};
|
||||
|
||||
home.file.".cargo/config.toml".source = ./cargo-config.toml;
|
||||
}
|
||||
|
7
home-manager/modules/agda.nix
Normal file
7
home-manager/modules/agda.nix
Normal file
@@ -0,0 +1,7 @@
|
||||
{pkgs, ...}: {
|
||||
imports = [./emacs.nix];
|
||||
|
||||
home.packages = [
|
||||
pkgs.agda
|
||||
];
|
||||
}
|
17
home-manager/modules/alacritty.nix
Normal file
17
home-manager/modules/alacritty.nix
Normal file
@@ -0,0 +1,17 @@
|
||||
{pkgs, ...}: {
|
||||
programs.alacritty = {
|
||||
enable = true;
|
||||
settings = {
|
||||
font = {
|
||||
normal = {
|
||||
family = "FiraCode Nerd Font Mono";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
home.packages = [
|
||||
pkgs.alacritty
|
||||
(pkgs.nerdfonts.override {fonts = ["FiraCode" "DroidSansMono"];})
|
||||
];
|
||||
}
|
10
home-manager/modules/direnv.nix
Normal file
10
home-manager/modules/direnv.nix
Normal file
@@ -0,0 +1,10 @@
|
||||
{pkgs, ...}: {
|
||||
home.packages = [
|
||||
pkgs.direnv
|
||||
];
|
||||
programs.direnv = {
|
||||
enable = true;
|
||||
enableZshIntegration = true;
|
||||
nix-direnv.enable = true;
|
||||
};
|
||||
}
|
14
home-manager/modules/emacs.nix
Normal file
14
home-manager/modules/emacs.nix
Normal file
@@ -0,0 +1,14 @@
|
||||
{pkgs, ...}: {
|
||||
programs.emacs = {
|
||||
enable = true;
|
||||
package = pkgs.emacs;
|
||||
extraPackages = epkgs: [epkgs.evil];
|
||||
extraConfig = ''
|
||||
(load-file (let ((coding-system-for-read 'utf-8))
|
||||
(shell-command-to-string "agda-mode locate")))
|
||||
(require 'evil)
|
||||
(evil-mode 1)
|
||||
(evil-set-undo-system 'undo-redo)
|
||||
'';
|
||||
};
|
||||
}
|
179
home-manager/modules/mail.nix
Normal file
179
home-manager/modules/mail.nix
Normal file
@@ -0,0 +1,179 @@
|
||||
{
|
||||
pkgs,
|
||||
mbsync,
|
||||
secretsPath,
|
||||
...
|
||||
}: let
|
||||
deobfuscate = str: let
|
||||
lib = pkgs.lib;
|
||||
base64Table =
|
||||
builtins.listToAttrs
|
||||
(lib.imap0 (i: c: lib.nameValuePair c i)
|
||||
(lib.stringToCharacters "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"));
|
||||
|
||||
# Generated using python3:
|
||||
# print(''.join([ chr(n) for n in range(1, 256) ]), file=open('ascii', 'w'))
|
||||
ascii = builtins.readFile ./mail/ascii;
|
||||
|
||||
# List of base-64 numbers
|
||||
numbers64 = map (c: base64Table.${c}) (lib.lists.reverseList (lib.stringToCharacters str));
|
||||
|
||||
# List of base-256 numbers
|
||||
numbers256 = lib.concatLists (lib.genList (
|
||||
i: let
|
||||
v =
|
||||
lib.foldl'
|
||||
(acc: el: acc * 64 + el)
|
||||
0
|
||||
(lib.sublist (i * 4) 4 numbers64);
|
||||
in [
|
||||
(lib.mod (v / 256 / 256) 256)
|
||||
(lib.mod (v / 256) 256)
|
||||
(lib.mod v 256)
|
||||
]
|
||||
) (lib.length numbers64 / 4));
|
||||
in
|
||||
# Converts base-256 numbers to ascii
|
||||
lib.concatMapStrings (
|
||||
n:
|
||||
# Can't represent the null byte in Nix..
|
||||
let
|
||||
result = lib.substring (n - 1) 1 ascii;
|
||||
in
|
||||
if result == " "
|
||||
then ""
|
||||
else result
|
||||
)
|
||||
numbers256;
|
||||
in {
|
||||
accounts.email.accounts."Gmail" = let
|
||||
address = (deobfuscate "AFTN0cWdh12c") + "gmail.com";
|
||||
in {
|
||||
notmuch.enable = true;
|
||||
neomutt = {
|
||||
enable = true;
|
||||
};
|
||||
address = address;
|
||||
flavor = "gmail.com";
|
||||
mbsync = {
|
||||
enable = true;
|
||||
create = "maildir";
|
||||
extraConfig.account = {
|
||||
AuthMechs = "XOAUTH2";
|
||||
};
|
||||
};
|
||||
userName = address;
|
||||
# This is accompanied by a developer application at Google:
|
||||
# https://console.cloud.google.com/apis/credentials
|
||||
# Create an OAuth 2.0 Client ID with type `Desktop`.
|
||||
# The Google application needs the https://mail.google.com scope; mine has
|
||||
# an authorized domain `google.com` but I don't know if that's required.
|
||||
# Enter the client ID and client secret into a two-line text file
|
||||
# named gmail-client-app.txt immediately next to the intended destination
|
||||
# secret file (the arg to mutt-oauth2.py in the invocation):
|
||||
# so here it would be /path/to/gmail-client-app.txt .
|
||||
# Run `./mail/mutt-oauth2.py /path/to/secret --authorize --verbose` once manually,
|
||||
# and that will populate /path/to/secret.
|
||||
# I've left it unencrypted here; the original uses GPG to store it encrypted at rest.
|
||||
passwordCommand = ''${pkgs.python3}/bin/python ${./mail/mutt-oauth2.py} ${secretsPath}/gmail.txt'';
|
||||
realName = "Patrick Stevens";
|
||||
};
|
||||
|
||||
accounts.email.accounts."BTInternet" = let
|
||||
address = (deobfuscate "z5WZ2VGdz5yajlmc0FGc") + "@btinternet.com";
|
||||
in {
|
||||
notmuch.enable = true;
|
||||
neomutt = {
|
||||
enable = true;
|
||||
};
|
||||
address = address;
|
||||
imap = {
|
||||
host = "mail.btinternet.com";
|
||||
port = 993;
|
||||
tls = {
|
||||
enable = true;
|
||||
useStartTls = false;
|
||||
};
|
||||
};
|
||||
mbsync = {
|
||||
enable = true;
|
||||
create = "maildir";
|
||||
};
|
||||
realName = "Patrick Stevens";
|
||||
passwordCommand = "cat ${secretsPath}/btinternet.txt";
|
||||
smtp = {
|
||||
host = "mail.btinternet.com";
|
||||
port = 465;
|
||||
tls = {
|
||||
enable = true;
|
||||
useStartTls = false;
|
||||
};
|
||||
};
|
||||
userName = address;
|
||||
primary = true;
|
||||
};
|
||||
|
||||
accounts.email.accounts."Proton" = let
|
||||
address = deobfuscate "gAya15ybj5ycuVmdlR3crNWayRXYwB0ajlmc0FGc";
|
||||
in {
|
||||
notmuch.enable = true;
|
||||
neomutt = {
|
||||
enable = true;
|
||||
};
|
||||
address = address;
|
||||
# I use the ProtonMail bridge, which sits at localhost.
|
||||
imap = {
|
||||
host = "127.0.0.1";
|
||||
port = 1143; # 8125; if using hydroxide
|
||||
tls = {
|
||||
enable = false;
|
||||
useStartTls = true;
|
||||
};
|
||||
};
|
||||
mbsync = {
|
||||
enable = true;
|
||||
create = "maildir";
|
||||
extraConfig.account = {
|
||||
# Because ProtonMail Bridge is localhost, we don't
|
||||
# care that we can only auth to it in plain text.
|
||||
AuthMechs = "LOGIN";
|
||||
};
|
||||
};
|
||||
realName = "Patrick Stevens";
|
||||
passwordCommand =
|
||||
# I store the ProtonMail Bridge password here.
|
||||
# Extracting it from a keychain would be better.
|
||||
"cat ${secretsPath}/proton.txt";
|
||||
smtp = {
|
||||
host = "127.0.0.1";
|
||||
port = 1025; # 8126; if using hydroxide
|
||||
tls = {enable = false;};
|
||||
};
|
||||
userName = address;
|
||||
};
|
||||
|
||||
programs.mbsync = {
|
||||
enable = true;
|
||||
extraConfig = ''
|
||||
CopyArrivalDate yes
|
||||
'';
|
||||
package = mbsync;
|
||||
};
|
||||
programs.neomutt = {
|
||||
enable = true;
|
||||
extraConfig = ''
|
||||
set use_threads=threads sort=last-date sort_aux=date
|
||||
'';
|
||||
sidebar.enable = true;
|
||||
vimKeys = true;
|
||||
};
|
||||
|
||||
programs.notmuch.enable = true;
|
||||
|
||||
home.file.".mailcap".source = ./mail/mailcap;
|
||||
|
||||
home.packages = [
|
||||
pkgs.notmuch
|
||||
pkgs.lynx
|
||||
];
|
||||
}
|
7
home-manager/modules/ripgrep.nix
Normal file
7
home-manager/modules/ripgrep.nix
Normal file
@@ -0,0 +1,7 @@
|
||||
{pkgs, ...}: {
|
||||
home.packages = [
|
||||
pkgs.ripgrep
|
||||
];
|
||||
|
||||
home.file.".config/ripgrep/config".source = ./ripgrep/ripgrep.conf;
|
||||
}
|
10
home-manager/modules/rust.nix
Normal file
10
home-manager/modules/rust.nix
Normal file
@@ -0,0 +1,10 @@
|
||||
{pkgs, ...}: {
|
||||
programs.zsh.sessionVariables = {
|
||||
RUSTFLAGS = "-L ${pkgs.libiconv}/lib -L ${pkgs.libcxx}/lib";
|
||||
RUST_BACKTRACE = "full";
|
||||
};
|
||||
home.file.".cargo/config.toml".source = ./rust/cargo-config.toml;
|
||||
home.packages = [
|
||||
pkgs.rust-analyzer
|
||||
];
|
||||
}
|
18
home-manager/modules/tmux.nix
Normal file
18
home-manager/modules/tmux.nix
Normal file
@@ -0,0 +1,18 @@
|
||||
{pkgs, ...}: {
|
||||
imports = [./zsh.nix];
|
||||
home.packages = [
|
||||
pkgs.tmux
|
||||
];
|
||||
|
||||
programs.tmux = {
|
||||
shell = "${pkgs.zsh}/bin/zsh";
|
||||
escapeTime = 50;
|
||||
mouse = false;
|
||||
prefix = "C-b";
|
||||
enable = true;
|
||||
terminal = "screen-256color";
|
||||
extraConfig = ''
|
||||
set-option -sa terminal-features ',xterm-256color:RGB'
|
||||
'';
|
||||
};
|
||||
}
|
23
home-manager/modules/zsh.nix
Normal file
23
home-manager/modules/zsh.nix
Normal file
@@ -0,0 +1,23 @@
|
||||
{pkgs, ...}: {
|
||||
programs.zsh = {
|
||||
enable = true;
|
||||
autocd = true;
|
||||
autosuggestion.enable = true;
|
||||
enableCompletion = true;
|
||||
history = {
|
||||
expireDuplicatesFirst = true;
|
||||
};
|
||||
sessionVariables = {
|
||||
EDITOR = "vim";
|
||||
LC_ALL = "en_US.UTF-8";
|
||||
LC_CTYPE = "en_US.UTF-8";
|
||||
};
|
||||
shellAliases = {
|
||||
vim = "nvim";
|
||||
view = "vim -R";
|
||||
};
|
||||
initExtra = builtins.readFile ./zsh/zshrc;
|
||||
};
|
||||
|
||||
programs.fzf.enableZshIntegration = true;
|
||||
}
|
Reference in New Issue
Block a user