independent home manager config

Changed files
+1199 -1451
home
hosts
modules
nix-on-droid
+29 -66
flake.lock
···
"type": "github"
}
},
-
"eeww": {
-
"inputs": {
-
"flake-utils": "flake-utils_3",
-
"nixpkgs": [
-
"nixpkgs"
-
]
-
},
-
"locked": {
-
"lastModified": 1670945505,
-
"narHash": "sha256-gN6ATdvUuNDBKYTQeax5oNtUeQIiCGQyYgfueLsC8Es=",
-
"owner": "RyanGibb",
-
"repo": "eeww",
-
"rev": "12f3908ffa24fcbdf8df6e422d27022965b8058c",
-
"type": "github"
-
},
-
"original": {
-
"owner": "RyanGibb",
-
"ref": "nixos",
-
"repo": "eeww",
-
"type": "github"
-
}
-
},
"eilean": {
"inputs": {
"nixos-mailserver": "nixos-mailserver",
···
},
"eon": {
"inputs": {
-
"flake-utils": "flake-utils_4",
+
"flake-utils": "flake-utils_3",
"nixpkgs": [
"nixpkgs"
],
···
"type": "indirect"
}
},
-
"flake-utils_10": {
-
"locked": {
-
"lastModified": 1676283394,
-
"narHash": "sha256-XX2f9c3iySLCw54rJ/CZs+ZK6IQy7GXNY4nSOyu2QG4=",
-
"owner": "numtide",
-
"repo": "flake-utils",
-
"rev": "3db36a8b464d0c4532ba1c7dda728f4576d6d073",
-
"type": "github"
-
},
-
"original": {
-
"id": "flake-utils",
-
"type": "indirect"
-
}
-
},
"flake-utils_2": {
"inputs": {
"systems": "systems_2"
···
}
},
"flake-utils_3": {
-
"locked": {
-
"lastModified": 1667395993,
-
"narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=",
-
"owner": "numtide",
-
"repo": "flake-utils",
-
"rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f",
-
"type": "github"
-
},
-
"original": {
-
"id": "flake-utils",
-
"type": "indirect"
-
}
-
},
-
"flake-utils_4": {
"inputs": {
"systems": "systems_4"
},
···
"type": "github"
}
},
-
"flake-utils_5": {
+
"flake-utils_4": {
"locked": {
"lastModified": 1676283394,
"narHash": "sha256-XX2f9c3iySLCw54rJ/CZs+ZK6IQy7GXNY4nSOyu2QG4=",
···
"type": "indirect"
}
},
-
"flake-utils_6": {
+
"flake-utils_5": {
"inputs": {
"systems": "systems_5"
},
···
"type": "github"
}
},
-
"flake-utils_7": {
+
"flake-utils_6": {
"locked": {
"lastModified": 1638122382,
"narHash": "sha256-sQzZzAbvKEqN9s0bzWuYmRaA03v40gaJ4+iL1LXjaeI=",
···
"type": "github"
}
},
-
"flake-utils_8": {
+
"flake-utils_7": {
"inputs": {
"systems": "systems_6"
},
···
"type": "github"
}
},
-
"flake-utils_9": {
+
"flake-utils_8": {
"inputs": {
"systems": "systems_7"
},
···
"type": "github"
}
},
+
"flake-utils_9": {
+
"locked": {
+
"lastModified": 1676283394,
+
"narHash": "sha256-XX2f9c3iySLCw54rJ/CZs+ZK6IQy7GXNY4nSOyu2QG4=",
+
"owner": "numtide",
+
"repo": "flake-utils",
+
"rev": "3db36a8b464d0c4532ba1c7dda728f4576d6d073",
+
"type": "github"
+
},
+
"original": {
+
"id": "flake-utils",
+
"type": "indirect"
+
}
+
},
"fn06-website": {
"inputs": {
-
"flake-utils": "flake-utils_5",
+
"flake-utils": "flake-utils_4",
"nixpkgs": [
"nixpkgs"
]
···
},
"hyperbib-eeg": {
"inputs": {
-
"flake-utils": "flake-utils_6",
+
"flake-utils": "flake-utils_5",
"nixpkgs": [
"nixpkgs"
],
···
},
"i3-workspace-history": {
"inputs": {
-
"flake-utils": "flake-utils_8",
+
"flake-utils": "flake-utils_7",
"gomod2nix": "gomod2nix",
"nixpkgs": [
"nixpkgs"
···
},
"neovim": {
"inputs": {
-
"flake-utils": "flake-utils_9",
+
"flake-utils": "flake-utils_8",
"nixpkgs": "nixpkgs_4"
},
"locked": {
···
},
"nixpkgs_6": {
"locked": {
-
"lastModified": 1711124224,
-
"narHash": "sha256-l0zlN/3CiodvWDtfBOVxeTwYSRz93muVbXWSpaMjXxM=",
+
"lastModified": 1712168706,
+
"narHash": "sha256-XP24tOobf6GGElMd0ux90FEBalUtw6NkBSVh/RlA6ik=",
"owner": "nixos",
"repo": "nixpkgs",
-
"rev": "56528ee42526794d413d6f244648aaee4a7b56c0",
+
"rev": "1487bdea619e4a7a53a4590c475deabb5a9d1bfb",
"type": "github"
},
"original": {
···
"opam-nix_2": {
"inputs": {
"flake-compat": "flake-compat_3",
-
"flake-utils": "flake-utils_7",
+
"flake-utils": "flake-utils_6",
"mirage-opam-overlays": "mirage-opam-overlays_2",
"nixpkgs": [
"hyperbib-eeg",
···
"agenix": "agenix",
"alec-website": "alec-website",
"colour-guesser": "colour-guesser",
-
"eeww": "eeww",
"eilean": "eilean",
"eon": "eon",
"fn06-website": "fn06-website",
···
},
"ryan-website": {
"inputs": {
-
"flake-utils": "flake-utils_10",
+
"flake-utils": "flake-utils_9",
"nixpkgs": [
"nixpkgs"
+10 -5
flake.nix
···
home-manager.url = "github:RyanGibb/home-manager/fork";
agenix.url = "github:ryantm/agenix";
nix-on-droid.url = "github:nix-community/nix-on-droid/release-23.05";
-
eeww.url = "github:RyanGibb/eeww/nixos";
eon.url = "github:RyanGibb/eon";
eilean.url = "github:RyanGibb/eilean-nix/main";
ryan-website.url = "git+ssh://git@github.com/RyanGibb/website.git";
···
ryan-website.inputs.nixpkgs.follows = "nixpkgs";
alec-website.inputs.nixpkgs.follows = "nixpkgs";
fn06-website.inputs.nixpkgs.follows = "nixpkgs";
-
eeww.inputs.nixpkgs.follows = "nixpkgs";
eon.inputs.nixpkgs.follows = "nixpkgs";
colour-guesser.inputs.nixpkgs.follows = "nixpkgs";
i3-workspace-history.inputs.nixpkgs.follows = "nixpkgs";
···
};
outputs = { self, nixpkgs, nixpkgs-unstable, nixos-hardware, home-manager
-
, agenix, nix-on-droid, eeww, eon, eilean, fn06-website
-
, i3-workspace-history, hyperbib-eeg, neovim, ... }@inputs:
+
, agenix, nix-on-droid, eon, eilean, fn06-website, i3-workspace-history
+
, hyperbib-eeg, neovim, ... }@inputs:
let
getSystemOverlays = system: nixpkgsConfig:
[
···
config = nixpkgsConfig;
};
agenix = agenix.packages.${system}.default;
-
eeww = eeww.defaultPackage.${system};
eon = eon.defaultPackage.${system};
mautrix-signal = final.overlay-unstable.mautrix-signal;
i3-workspace-history =
···
];
};
};
+
+
homeConfigurations.ryan = let
+
system = "x86_64-linux";
+
pkgs = nixpkgs.legacyPackages.${system};
+
in home-manager.lib.homeManagerConfiguration {
+
inherit pkgs;
+
modules = [ ./home/default.nix ];
+
};
legacyPackages = {
nixpkgs = nixpkgs.lib.genAttrs nixpkgs.lib.systems.flakeExposed
+193
home/default.nix
···
+
{ pkgs, config, lib, ... }:
+
+
let cfg = config.custom;
+
in {
+
imports = [ ./mail.nix ./gui.nix ./i3.nix ./sway.nix ./nvim/default.nix ];
+
+
options.custom.machineColour = lib.mkOption {
+
type = lib.types.str;
+
default = "cyan";
+
};
+
+
config = {
+
home.sessionVariables = {
+
EDITOR = "nvim";
+
NIX_AUTO_RUN = "y";
+
NIX_AUTO_RUN_INTERACTIVE = "y";
+
BROWSER = "firefox"; # urlview
+
GOPATH = "$HOME/.go";
+
};
+
home.packages = with pkgs; [
+
tree
+
htop
+
bind
+
inetutils
+
dua
+
fd
+
nix-prefetch-git
+
gnumake
+
vlock
+
bat
+
killall
+
nmap
+
gcc
+
fzf
+
tcpdump
+
sshfs
+
nix-tree
+
#atuin
+
git-crypt
+
jq
+
bc
+
pandoc
+
w3m
+
ranger
+
bluetuith
+
powertop
+
ripgrep
+
toot
+
iamb
+
];
+
+
home.shellAliases = {
+
ls = "ls -p --color=auto";
+
pls = "sudo $(fc -ln -1)";
+
o = "xdg-open";
+
se = "sudoedit";
+
su = "su -p";
+
ssh = "TERM=xterm ssh";
+
nix-shell = "nix-shell --command zsh";
+
inhibit-lid = "systemd-inhibit --what=handle-lid-switch sleep 1d";
+
tmux = "tmux -2";
+
feh = "feh --scale-down --auto-zoom";
+
nix-stray-roots =
+
"nix-store --gc --print-roots | egrep -v '^(/nix/var|/run|/proc|{censored})'";
+
};
+
+
# https://github.com/nix-community/home-manager/issues/1439#issuecomment-1106208294
+
home.activation = {
+
linkDesktopApplications = {
+
after = [ "writeBoundary" "createXdgUserDirectories" ];
+
before = [ ];
+
data = ''
+
rm -rf ${config.xdg.dataHome}/"applications/home-manager"
+
mkdir -p ${config.xdg.dataHome}/"applications/home-manager"
+
cp -Lr ${config.home.homeDirectory}/.nix-profile/share/applications/* ${config.xdg.dataHome}/"applications/home-manager/"
+
'';
+
};
+
};
+
+
programs.zsh = {
+
enable = true;
+
history = {
+
size = 1000000;
+
path = "$HOME/.histfile";
+
share = false;
+
};
+
enableAutosuggestions = true;
+
syntaxHighlighting.enable = true;
+
enableCompletion = true;
+
initExtraFirst = ''
+
export ZSH_AUTOSUGGEST_STRATEGY=(match_prev_cmd completion history)
+
export ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE="fg=5"
+
PROMPT='%(?..%F{red}%3?%f )%F{${config.custom.machineColour}}%n@%m%f:%~ %#'$'\n'
+
'';
+
initExtra = builtins.readFile ./zsh.cfg;
+
};
+
+
programs.bash.initExtra = ''
+
PS1='\[\e[36m\]\u@\h:\W\[\e[0m\] $ '
+
'';
+
+
programs.git = {
+
enable = true;
+
extraConfig = {
+
init = { defaultBranch = "main"; };
+
user = {
+
email = "ryan@freumh.org";
+
name = "Ryan Gibb";
+
};
+
alias = {
+
s = "status";
+
c = "commit";
+
cm = "commit --message";
+
ca = "commit --amend";
+
cu = "commit --message update";
+
ci = "commit --message initial";
+
br = "branch";
+
co = "checkout";
+
df = "diff";
+
l = "log";
+
lg = "log -p";
+
lol = "log --graph --decorate --pretty=oneline --abbrev-commit";
+
lola =
+
"log --graph --decorate --pretty=oneline --abbrev-commit --all";
+
ls = "ls-files";
+
a = "add";
+
aa = "add --all";
+
au = "add -u";
+
ap = "add --patch";
+
ai = "add -i";
+
ps = "push";
+
pf = "push --force";
+
pu = "push --set-upstream";
+
pl = "pull";
+
pr = "pull --rebase";
+
acp = "!git add --all && git commit --message update && git push";
+
d = "diff";
+
dc = "diff --cached";
+
};
+
};
+
};
+
+
programs.tmux = {
+
enable = true;
+
extraConfig = let
+
toggle-status-bar = pkgs.writeScript "toggle-status-bar.sh" ''
+
#!/usr/bin/env bash
+
window_count=$(tmux list-windows | wc -l)
+
if [ "$window_count" -ge "2" ]; then
+
tmux set-option status on
+
else
+
tmux set-option status off
+
fi
+
'';
+
in ''
+
set-window-option -g mode-keys vi
+
set-option -g mouse on
+
set-option -g set-titles on
+
set-option -g set-titles-string "#T"
+
bind-key t capture-pane -S -\; new-window '(tmux show-buffer; tmux delete-buffer) | nvim -c $'
+
bind-key u capture-pane\; new-window '(tmux show-buffer; tmux delete-buffer) | ${pkgs.urlview}/bin/urlview'
+
set-hook -g session-window-changed 'run-shell ${toggle-status-bar}'
+
set-hook -g session-created 'run-shell ${toggle-status-bar}'
+
# Fixes C-Up/Down in TUIs
+
set-option default-terminal tmux
+
# https://stackoverflow.com/questions/62182401/neovim-screen-lagging-when-switching-mode-from-insert-to-normal
+
# locking
+
set -s escape-time 0
+
set -g lock-command vlock
+
set -g lock-after-time 0 # Seconds; 0 = never
+
bind L lock-session
+
# for .zprofile display environment starting https://github.com/tmux/tmux/issues/3483
+
set-option -g update-environment XDG_VTNR
+
# Allow clipboard with OSC-52 work
+
set -s set-clipboard on
+
'';
+
};
+
+
programs.less = {
+
enable = true;
+
keys = ''
+
#line-edit
+
\e[1;5D word-left
+
\e[1;5C word-right
+
'';
+
};
+
+
programs.go.goPath = "~/.go";
+
+
home.stateVersion = "22.05";
+
};
+
}
+
+173
home/gui.nix
···
+
{ pkgs, config, lib, ... }:
+
+
let cfg = config.custom.gui;
+
in {
+
options.custom.gui.enable = lib.mkEnableOption "gui";
+
+
config = lib.mkIf cfg.enable {
+
gtk = {
+
enable = true;
+
font = {
+
name = "Noto Sans 11";
+
package = pkgs.noto-fonts;
+
};
+
iconTheme = {
+
package = pkgs.gruvbox-dark-icons-gtk;
+
name = "gruvbox-dark";
+
};
+
theme = {
+
package = pkgs.gruvbox-dark-gtk;
+
name = "gruvbox-dark";
+
};
+
};
+
+
home = {
+
sessionVariables = {
+
# evince workaround
+
GTK_THEME = "gruvbox-dark";
+
WALLPAPER = let wallpaper = ./wallpaper.jpg;
+
in pkgs.runCommand (builtins.baseNameOf wallpaper) { }
+
"cp ${wallpaper} $out";
+
+
};
+
pointerCursor = {
+
name = "Adwaita";
+
package = pkgs.gnome.adwaita-icon-theme;
+
size = 32;
+
};
+
file = {
+
".profile".text = ''
+
source "$HOME/.nix-profile/etc/profile.d/hm-session-vars.sh"
+
'';
+
".config/gtk-3.0/bookmarks" = {
+
force = true;
+
text = ''
+
file:///${config.home.homeDirectory}/archive
+
file:///${config.home.homeDirectory}/documents
+
file:///${config.home.homeDirectory}/downloads
+
file:///${config.home.homeDirectory}/pictures
+
file:///${config.home.homeDirectory}/videos
+
file:///${config.home.homeDirectory}/projects
+
'';
+
};
+
".config/mimeapps.list" = {
+
force = true;
+
source = ./mimeapps.list;
+
};
+
};
+
};
+
+
programs.firefox = let
+
settings = {
+
"browser.ctrlTab.recentlyUsedOrder" = false;
+
"browser.tabs.warnOnClose" = false;
+
"browser.toolbars.bookmarks.visibility" = "never";
+
+
# Only hide UI elements on F11 (i.e. don't go fullscreen, leave that to WM)
+
"full-screen-api.ignore-widgets" = true;
+
# Right click issue fix
+
"ui.context_menus.after_mouseup" = true;
+
+
# Use userChrome.css
+
"toolkit.legacyUserProfileCustomizations.stylesheets" = true;
+
+
"browser.shell.checkDefaultBrowser" = false;
+
+
# sync toolbar
+
"services.sync.prefs.sync.browser.uiCustomization.state" = true;
+
+
"extensions.pocket.enabled" = false;
+
};
+
userChrome = ''
+
#webrtcIndicator {
+
display: none;
+
}
+
+
/* Move find bar to top */
+
.browserContainer > findbar {
+
-moz-box-ordinal-group: 0;
+
}
+
+
#TabsToolbar
+
{
+
visibility: collapse;
+
}
+
'';
+
in {
+
enable = true;
+
profiles.default = {
+
settings = settings;
+
userChrome = userChrome;
+
};
+
profiles.secondary = {
+
id = 1;
+
isDefault = false;
+
settings = settings;
+
userChrome = userChrome;
+
};
+
package = (pkgs.firefox.override {
+
nativeMessagingHosts = with pkgs; [ tridactyl-native ];
+
});
+
};
+
+
xdg = {
+
desktopEntries = {
+
# https://gitlab.freedesktop.org/xdg/xdg-utils/-/issues/84
+
# `echo $XDG_DATA_DIRS`
+
nvim = {
+
name = "Neovim";
+
genericName = "Text Editor";
+
exec = "alacritty -e nvim %F";
+
terminal = false;
+
categories = [ "Application" "Utility" "TextEditor" ];
+
icon = "nvim";
+
mimeType = [ "text/english" "text/plain" ];
+
};
+
aerc = {
+
name = "aerc";
+
genericName = "Mail Client";
+
exec = "alacritty -e aerc";
+
terminal = false;
+
categories = [ "Office" "Network" "Email" "ConsoleOnly" ];
+
icon = "utilities-terminal";
+
mimeType = [ "x-scheme-handler/mailto" ];
+
};
+
};
+
configFile = {
+
"Thunar/uca.xml".source = ./thunar.xml;
+
"fontconfig/fonts.conf".source = ./fonts.conf;
+
"alacritty.yml".source = ./alacritty.yml;
+
"Element/config.json".source = ./element.json;
+
"swappy/config".text = ''
+
[Default]
+
save_dir=~/capture/capture/
+
save_filename_format=screenshot_%Y-%m-%dT%H:%M:%S%z.png
+
'';
+
"tridactyl/tridactylrc".source = ./tridactylrc;
+
};
+
userDirs = {
+
enable = true;
+
createDirectories = true;
+
download = "$HOME/downloads";
+
pictures = "$HOME/pictures";
+
videos = "$HOME/videos";
+
documents = "$HOME/documents/";
+
music = "$HOME/";
+
# https://bugzilla.mozilla.org/show_bug.cgi?id=1082717
+
desktop = "$HOME/";
+
templates = "$HOME/";
+
publicShare = "$HOME/";
+
};
+
};
+
+
services.kdeconnect.enable = true;
+
+
services.spotifyd = {
+
enable = true;
+
settings.global = {
+
username = "ryangibb321@gmail.com";
+
password_cmd = "pass show spotify/ryangibb321@gmail.com";
+
};
+
};
+
};
+
}
+68
home/i3.nix
···
+
{ pkgs, config, lib, ... }:
+
+
let
+
replacements = {
+
wm = "i3";
+
wmmsg = "i3-msg";
+
rofi = "rofi";
+
app_id = "class";
+
bar_extra = "";
+
locked = "";
+
polkit_gnome = "${pkgs.polkit_gnome}";
+
locker = "xsecurelock";
+
enable_output = "xrandr --output $laptop_output --auto";
+
disable_output = "xrandr --output $laptop_output --off";
+
drun = "rofi -i -modi drun -show drun";
+
run = "rofi -i -modi run -show run";
+
dmenu = "rofi -i -dmenu -p";
+
displays = "arandr";
+
bar = "i3bar";
+
notification_deamon = "dunst";
+
i3-workspace-history = "${pkgs.i3-workspace-history}";
+
i3-workspace-history-args = "";
+
};
+
util = import ./util.nix { inherit pkgs lib; };
+
cfg = config.custom.gui.i3;
+
in {
+
options.custom.gui.i3.enable = lib.mkEnableOption "i3";
+
+
config = lib.mkIf cfg.enable {
+
# TODO
+
# idling
+
+
home.pointerCursor.x11.enable = true;
+
+
home.file = {
+
".xinitrc".text = ''
+
export XDG_SESSION_TYPE=x11
+
export GDK_BACKEND=x11
+
export DESKTOP_SESSION=plasma
+
exec i3 &> ~/.i3_log
+
'';
+
".zprofile".text = ''
+
# Autostart at login on TTY 2
+
if [ -z "''${DISPLAY}" ] && [ "''${XDG_VTNR}" -eq 2 ]; then
+
source $HOME/.nix-profile/etc/profile.d/hm-session-vars.sh
+
exec startx
+
fi
+
'';
+
};
+
+
xdg.configFile = let
+
entries = {
+
"dunst/dunstrc".source = ./dunst;
+
"i3/config".text = let wmFilenames = util.listFilesInDir ./wm/config.d;
+
in let i3Filenames = util.listFilesInDir ./wm/i3;
+
in (util.concatFilesReplace
+
([ ./wm/config ] ++ wmFilenames ++ i3Filenames) replacements);
+
"i3blocks".source = ./i3blocks;
+
"rofi/config.rasi".source = ./rofi.rasi;
+
};
+
in (util.inDirReplace ./wm/scripts "i3/scripts" replacements) // entries;
+
+
services.redshift = {
+
enable = true;
+
provider = "geoclue2";
+
};
+
};
+
}
+312
home/mail.nix
···
+
{ pkgs, config, lib, ... }:
+
+
let
+
address-book = pkgs.writeScriptBin "address-book" ''
+
#!/usr/bin/env bash
+
${pkgs.ugrep}/bin/ugrep -jPh -m 100 --color=never "$1"\
+
${config.accounts.email.maildirBasePath}/addressbook/maildir\
+
${config.accounts.email.maildirBasePath}/addressbook/cam-ldap
+
'';
+
sync-mail = pkgs.writeScriptBin "sync-mail" ''
+
#!/usr/bin/env bash
+
${pkgs.isync}/bin/mbsync "$1"
+
${pkgs.mu}/bin/mu index
+
${pkgs.procps}/bin/pkill -RTMIN+13 i3block
+
'';
+
cfg = config.custom.mail;
+
in {
+
options.custom.mail.enable = lib.mkEnableOption "mail";
+
+
config = lib.mkIf cfg.enable {
+
home.packages = with pkgs; [
+
maildir-rank-addr
+
(pkgs.writeScriptBin "cam-ldap-addr" ''
+
${pkgs.openldap}/bin/ldapsearch -xZ -H ldaps://ldap.lookup.cam.ac.uk -b "ou=people,o=University of Cambridge,dc=cam,dc=ac,dc=uk" displayName mail\
+
| ${pkgs.gawk}/bin/awk '/^dn:/{displayName=""; mail=""; next} /^displayName:/{displayName=$2; for(i=3;i<=NF;i++) displayName=displayName " " $i; next} /^mail:/{mail=$2; next} /^$/{if(displayName!="" && mail!="") print mail "\t" displayName}'\
+
> ${config.accounts.email.maildirBasePath}/addressbook/cam-ldap
+
'')
+
address-book
+
];
+
+
xdg.configFile = {
+
"maildir-rank-addr/config".text = with config.accounts.email; ''
+
maildir = "${config.accounts.email.maildirBasePath}"
+
outputpath = "${config.accounts.email.maildirBasePath}/addressbook/maildir"
+
addresses = [
+
"ryan@freumh.org",
+
"misc@freumh.org",
+
"ryan@gibbr.org",
+
"misc@gibbr.org",
+
"ryan.gibb@cl.cam.ac.uk",
+
"rtg24@cam.ac.uk",
+
"rtg2@st-andrews.ac.uk",
+
"ryangibb321@gmail.com",
+
"ryangibb@btconnect.com",
+
]
+
'';
+
};
+
+
programs = {
+
password-store.enable = true;
+
gpg.enable = true;
+
mbsync.enable = true;
+
mu.enable = true;
+
msmtp.enable = true;
+
aerc = {
+
enable = true;
+
extraConfig = {
+
general.unsafe-accounts-conf = true;
+
general.default-save-path = "~/downloads";
+
ui.mouse-enabled = true;
+
compose.address-book-cmd = "${address-book}/bin/address-book '%s'";
+
compose.file-picker-cmd =
+
"${pkgs.ranger}/bin/ranger --choosefiles=%f";
+
compose.format-flowed = true;
+
ui.index-columns = "date<=,name<50,flags>=,subject<*";
+
ui.column-name = "{{index (.From | persons) 0}}";
+
"ui:folder=Sent".index-columns = "date<=,to<50,flags>=,subject<*";
+
"ui:folder=Sent".column-to = "{{index (.To | persons) 0}}";
+
openers."text/html" = "firefox --new-window";
+
hooks.mail-recieved = ''
+
notify-send "[$AERC_ACCOUNT/$AERC_FOLDER] mail from $AERC_FROM_NAME" "$AERC_SUBJECT"'';
+
filters = {
+
"text/plain" = "wrap -w 90 | colorize";
+
"text/calendar" = "calendar";
+
"message/delivery-status" = "colorize";
+
"message/rfc822" = "colorize";
+
"text/html" = "html | colorize";
+
};
+
};
+
extraBinds = import ./aerc-binds.nix;
+
};
+
neomutt = {
+
enable = true;
+
extraConfig = ''
+
# Macro to switch accounts
+
macro index,pager <F1> '"<change-folder> ${config.accounts.email.maildirBasePath}/ryan@freumh.org/Inbox<enter>"'
+
macro index,pager <F2> '"<change-folder> ${config.accounts.email.maildirBasePath}/ryangibb321@gmail.com/Inbox<enter>"'
+
macro index,pager <F3> '"<change-folder> ${config.accounts.email.maildirBasePath}/ryan.gibb@cl.cam.ac.uk/Inbox<enter>"'
+
+
# mutt macros for mu
+
macro index <F8> "<shell-escape>mu find --clearlinks --format=links --linksdir=${config.accounts.email.maildirBasePath}/search " \
+
"mu find"
+
macro index <F9> "<change-folder-readonly>˜/Maildir/search" \
+
"mu find results"
+
'';
+
};
+
};
+
+
services = {
+
imapnotify.enable = true;
+
gpg-agent.enable = true;
+
};
+
+
accounts.email = {
+
maildirBasePath = "mail";
+
order = [ "ryangibb321@gmail.com" "ryan.gibb@cl.cam.ac.uk" ];
+
accounts = {
+
"ryan@freumh.org" = rec {
+
primary = true;
+
realName = "Ryan Gibb";
+
userName = "ryan@freumh.org";
+
address = "ryan@freumh.org";
+
passwordCommand = "${pkgs.pass}/bin/pass show email/ryan@freumh.org";
+
imap.host = "mail.freumh.org";
+
smtp = {
+
host = "mail.freumh.org";
+
port = 465;
+
};
+
folders = {
+
drafts = "Drafts";
+
inbox = "Inbox";
+
sent = "Sent";
+
trash = "Trash";
+
};
+
imapnotify = {
+
enable = true;
+
boxes = [ "Inbox" ];
+
onNotify =
+
"${pkgs.isync}/bin/mbsync ryan@freumh.org && ${pkgs.mu}/bin/mu index && ${pkgs.procps}/bin/pkill -RTMIN+13 i3blocks";
+
};
+
mbsync = {
+
enable = true;
+
create = "both";
+
expunge = "both";
+
remove = "both";
+
};
+
msmtp = { enable = true; };
+
aerc = {
+
enable = true;
+
extraAccounts = {
+
check-mail-cmd =
+
"${pkgs.isync}/bin/mbsync ryan@freumh.org && ${pkgs.mu}/bin/mu index && ${pkgs.procps}/bin/pkill -RTMIN+13 i3blocks";
+
check-mail-timeout = "1m";
+
check-mail = "1h";
+
folders-sort =
+
[ "Inbox" "Sent" "Drafts" "Archive" "Spam" "Trash" ];
+
folder-map = "${pkgs.writeText "folder-map" ''
+
Spam = Junk
+
Bin = Trash
+
''}";
+
};
+
};
+
neomutt = {
+
enable = true;
+
extraConfig = ''
+
bind index g noop
+
macro index gi "<change-folder>=${folders.inbox}<enter>"
+
macro index gs "<change-folder>=${folders.sent}<enter>"
+
macro index gd "<change-folder>=${folders.drafts}<enter>"
+
macro index gt "<change-folder>=${folders.trash}<enter>"
+
'';
+
};
+
};
+
"misc@freumh.org" = rec {
+
userName = "misc@freumh.org";
+
address = "misc@freumh.org";
+
realName = "Misc";
+
passwordCommand = "${pkgs.pass}/bin/pass show email/misc@freumh.org";
+
imap.host = "mail.freumh.org";
+
smtp = {
+
host = "mail.freumh.org";
+
port = 465;
+
};
+
folders = {
+
drafts = "Drafts";
+
inbox = "Inbox";
+
sent = "Sent";
+
trash = "Bin";
+
};
+
imapnotify = {
+
enable = true;
+
boxes = [ "Inbox" ];
+
onNotify =
+
"${pkgs.isync}/bin/mbsync misc@freumh.org && ${pkgs.mu}/bin/mu index && ${pkgs.procps}/bin/pkill -RTMIN+13 i3blocks";
+
};
+
mbsync = {
+
enable = true;
+
create = "both";
+
expunge = "both";
+
remove = "both";
+
};
+
msmtp = { enable = true; };
+
neomutt = {
+
enable = true;
+
extraConfig = ''
+
bind index g noop
+
macro index gi "<change-folder>=${folders.inbox}<enter>"
+
macro index gs "<change-folder>=${folders.sent}<enter>"
+
macro index gd "<change-folder>=${folders.drafts}<enter>"
+
macro index gt "<change-folder>=${folders.trash}<enter>"
+
'';
+
};
+
};
+
"ryan.gibb@cl.cam.ac.uk" = rec {
+
userName = "rtg24@fm.cl.cam.ac.uk";
+
address = "ryan.gibb@cl.cam.ac.uk";
+
realName = "Ryan Gibb";
+
passwordCommand =
+
"${pkgs.pass}/bin/pass show email/ryan.gibb@cl.cam.ac.uk";
+
flavor = "fastmail.com";
+
folders = {
+
drafts = "Drafts";
+
inbox = "Inbox";
+
sent = "Sent";
+
trash = "Trash";
+
};
+
imapnotify = {
+
enable = true;
+
boxes = [ "Inbox" ];
+
onNotify =
+
"${pkgs.isync}/bin/mbsync ryan.gibb@cl.cam.ac.uk && ${pkgs.mu}/bin/mu index && ${pkgs.procps}/bin/pkill -RTMIN+13 i3blocks";
+
};
+
mbsync = {
+
enable = true;
+
create = "both";
+
expunge = "both";
+
remove = "both";
+
};
+
msmtp = { enable = true; };
+
aerc = {
+
enable = true;
+
extraAccounts = {
+
check-mail-cmd =
+
"${pkgs.isync}/bin/mbsync ryan.gibb@cl.cam.ac.uk && ${pkgs.mu}/bin/mu index && ${pkgs.procps}/bin/pkill -RTMIN+13 i3blocks";
+
check-mail-timeout = "1m";
+
check-mail = "1h";
+
aliases = "rtg24@cam.ac.uk";
+
folders-sort =
+
[ "Inbox" "Sidebox" "Sent" "Drafts" "Archive" "Spam" "Trash" ];
+
folder-map = "${pkgs.writeText "folder-map" ''
+
Bin = Trash
+
''}";
+
};
+
};
+
neomutt = {
+
enable = true;
+
extraConfig = ''
+
bind index g noop
+
macro index gi "<change-folder>=${folders.inbox}<enter>"
+
macro index gs "<change-folder>=${folders.sent}<enter>"
+
macro index gd "<change-folder>=${folders.drafts}<enter>"
+
macro index gt "<change-folder>=${folders.trash}<enter>"
+
'';
+
};
+
};
+
"ryangibb321@gmail.com" = rec {
+
userName = "ryangibb321@gmail.com";
+
address = "ryangibb321@gmail.com";
+
realName = "Ryan Gibb";
+
passwordCommand =
+
"${pkgs.pass}/bin/pass show email/ryangibb321@gmail.com";
+
flavor = "gmail.com";
+
folders = {
+
drafts = "Drafts";
+
inbox = "Inbox";
+
sent = "Sent Mail";
+
trash = "Bin";
+
};
+
imapnotify = {
+
enable = true;
+
boxes = [ "Inbox" ];
+
onNotify =
+
"${pkgs.isync}/bin/mbsync ryangibb321@gmail.com && ${pkgs.mu}/bin/mu index && ${pkgs.procps}/bin/pkill -RTMIN+13 i3blocks";
+
};
+
mbsync = {
+
enable = true;
+
create = "both";
+
expunge = "both";
+
remove = "both";
+
};
+
msmtp = { enable = true; };
+
aerc = {
+
enable = true;
+
extraAccounts = {
+
check-mail-cmd =
+
"${pkgs.isync}/bin/mbsync ryangibb321@gmail.com && ${pkgs.mu}/bin/mu index && ${pkgs.procps}/bin/pkill -RTMIN+13 i3blocks";
+
check-mail-timeout = "1m";
+
check-mail = "1h";
+
folders-sort =
+
[ "Inbox" "Sidebox" "Sent" "Drafts" "Archive" "Spam" "Trash" ];
+
folder-map = "${pkgs.writeText "folder-map" ''
+
* = [Gmail]/*
+
Sent = 'Sent Mail'
+
Archive = 'All Mail'
+
''}";
+
};
+
};
+
neomutt = {
+
enable = true;
+
extraConfig = ''
+
bind index g noop
+
macro index gi "<change-folder>=${folders.inbox}<enter>"
+
macro index gs "<change-folder>=${folders.sent}<enter>"
+
macro index gd "<change-folder>=${folders.drafts}<enter>"
+
macro index gt "<change-folder>=${folders.trash}<enter>"
+
'';
+
};
+
};
+
};
+
};
+
};
+
}
+117
home/nvim/default.nix
···
+
{ pkgs, config, lib, ... }:
+
+
let
+
obsidian-nvim = (pkgs.vimUtils.buildVimPlugin {
+
pname = "obsidian.nvim";
+
version = "2.6.0";
+
src = pkgs.fetchFromGitHub {
+
owner = "epwalsh";
+
repo = "obsidian.nvim";
+
rev = "v2.6.0";
+
sha256 = "sha256-+w3XYoobuH17oinPfQxhrizbmQB5IbbulUK69674/Wg=";
+
};
+
});
+
ltex-ls-nvim = (pkgs.vimUtils.buildVimPlugin {
+
pname = "ltex-ls.nvim";
+
version = "2.6.0";
+
src = pkgs.fetchFromGitHub {
+
owner = "vigoux";
+
repo = "ltex-ls.nvim";
+
rev = "c8139ea6b7f3d71adcff121e16ee8726037ffebd";
+
sha256 = "sha256-jY3ALr6h88xnWN2QdKe3R0vvRcSNhFWDW56b2NvnTCs=";
+
};
+
});
+
cfg = config.custom;
+
in {
+
options.custom.nvim-lsps = lib.mkEnableOption "nvim-lsps";
+
+
config = {
+
programs.neovim = {
+
enable = true;
+
viAlias = true;
+
vimAlias = true;
+
extraPackages = with pkgs;
+
[ ripgrep nixd ] ++ lib.lists.optionals cfg.nvim-lsps [
+
nixfmt
+
# stop complaining when launching but a devshell is better
+
ocamlPackages.ocaml-lsp
+
ocamlPackages.ocamlformat
+
lua-language-server
+
pyright
+
black
+
ltex-ls
+
jdt-language-server
+
nodejs_18
+
clang-tools
+
typst-lsp
+
];
+
extraLuaConfig = builtins.readFile ./nvim.lua;
+
# undo transparent background
+
# + "colorscheme gruvbox";
+
plugins = with pkgs.vimPlugins; [
+
{
+
plugin = nvim-lspconfig;
+
runtime = let
+
ml-style = ''
+
setlocal expandtab
+
setlocal shiftwidth=2
+
setlocal tabstop=2
+
setlocal softtabstop=2
+
'';
+
in {
+
# format-flowed
+
"ftplugin/mail.vim".text = ''
+
setlocal tw=72
+
set formatoptions+=w
+
'';
+
"ftplugin/nix.vim".text = ml-style;
+
"ftplugin/ocaml.vim".text = ml-style;
+
"after/ftplugin/markdown.vim".text = ''
+
set com-=fb:-
+
set com+=b:-\ [\ ],b:-\ [x],b:-
+
set formatoptions+=ro
+
'';
+
"ftplugin/java.lua".text = ''
+
local project_name = vim.fn.fnamemodify(vim.fn.getcwd(), ':p:h:t')
+
local workspace_dir = '~/.cache/jdt/' .. project_name
+
require('jdtls').start_or_attach {
+
on_attach = On_attach,
+
capabilities = Capabilities,
+
cmd = { 'jdt-language-server', '-data', workspace_dir, },
+
root_dir = vim.fs.dirname(vim.fs.find({'gradlew', '.git', 'mvnw'}, { upward = true })[1]),
+
}
+
'';
+
};
+
}
+
gruvbox-nvim
+
+
telescope-nvim
+
telescope-fzf-native-nvim
+
trouble-nvim
+
+
obsidian-nvim
+
plenary-nvim
+
pkgs.ripgrep
+
+
cmp-nvim-lsp
+
cmp-nvim-lsp-signature-help
+
cmp-path
+
cmp-buffer
+
cmp-cmdline
+
cmp-spell
+
luasnip
+
nvim-cmp
+
+
vimtex
+
nvim-surround
+
comment-nvim
+
+
ltex-ls-nvim
+
nvim-jdtls
+
# TODO nvim-dap
+
+
copilot-vim
+
];
+
};
+
};
+
}
+84
home/sway.nix
···
+
{ pkgs, config, lib, ... }:
+
+
let
+
replacements = {
+
wm = "sway";
+
wmmsg = "swaymsg";
+
rofi = "wofi";
+
app_id = "app_id";
+
bar_extra = ''
+
icon_theme Papirus
+
'';
+
locked = "--locked";
+
polkit_gnome = "${pkgs.polkit_gnome}";
+
locker = "swaylock -f -i $WALLPAPER";
+
enable_output = "swaymsg output $laptop_output enable";
+
disable_output = "swaymsg output $laptop_output disable";
+
drun = "wofi -i --show drun --allow-images -a";
+
run = "wofi -i --show run";
+
dmenu = "wofi -d -i -p";
+
displays = "wdisplays";
+
bar = "swaybar";
+
notification_deamon = "mako";
+
i3-workspace-history = "${pkgs.i3-workspace-history}";
+
i3-workspace-history-args = "-sway";
+
};
+
util = import ./util.nix { inherit pkgs lib; };
+
cfg = config.custom.gui.sway;
+
in {
+
options.custom.gui.sway.enable = lib.mkEnableOption "sway";
+
+
config = lib.mkIf cfg.enable {
+
home.sessionVariables = {
+
QT_QPA_PLATFORM = "wayland";
+
SDL_VIDEODRIVER = "wayland";
+
MOZ_ENABLE_WAYLAND = 1;
+
MOZ_DBUS_REMOTE = 1;
+
QT_STYLE_OVERRIDE = "Fusion";
+
TERMINAL = "alacritty";
+
WLR_NO_HARDWARE_CURSORS = 1;
+
NIXOS_OZONE_WL = 1;
+
+
# for intellij
+
_JAVA_AWT_WM_NONREPARENTING = 1;
+
+
# for screensharing
+
XDG_SESSION_TYPE = "wayland";
+
XDG_CURRENT_DESKTOP = "sway";
+
};
+
+
home.file.".zprofile".text = ''
+
# Autostart sway at login on TTY 1
+
if [ -z "''${DISPLAY}" ] && [ "''${XDG_VTNR}" -eq 1 ]; then
+
source $HOME/.nix-profile/etc/profile.d/hm-session-vars.sh
+
exec sway -d 2> $HOME/.sway_log
+
fi
+
'';
+
+
xdg.configFile = let
+
entries = {
+
"fusuma/config.yml".source = ./fusuma.yml;
+
"kanshi/config".source = ./kanshi;
+
"mako/config".source = ./mako;
+
"swaylock/config".source = ./swaylock;
+
"wofi/style.css".source = ./wofi.css;
+
"swappy/config".text = ''
+
[Default]
+
save_dir=$XDG_PICTURES_DIR/capture/
+
save_filename_format=screenshot_%Y-%m-%dT%H:%M:%S%z.png
+
'';
+
"sway/config".text =
+
let wmFilenames = util.listFilesInDir ./wm/config.d;
+
in let swayFilenames = util.listFilesInDir ./wm/sway;
+
in (util.concatFilesReplace
+
([ ./wm/config ] ++ wmFilenames ++ swayFilenames) replacements);
+
"i3blocks".source = ./i3blocks;
+
};
+
in (util.inDirReplace ./wm/scripts "sway/scripts" replacements) // entries;
+
+
services.gammastep = {
+
enable = true;
+
provider = "geoclue2";
+
};
+
};
+
}
+1 -1
hosts/barnacle/default.nix
···
nixpkgs.hostPlatform = "x86_64-linux";
-
personal = {
+
custom = {
enable = true;
laptop = true;
gui.i3 = true;
+4 -2
hosts/capybara/default.nix
···
{
imports = [ ./hardware-configuration.nix ];
-
personal = {
+
custom = {
enable = true;
tailscale = true;
-
machineColour = "red";
};
+
+
home-manager.users.${config.custom.username}.config.custom.machineColour =
+
"red";
networking.networkmanager.enable = true;
+5 -29
hosts/duck/default.nix
···
{
imports = [ ./hardware-configuration.nix ];
-
personal = {
+
custom = {
enable = true;
tailscale = true;
-
machineColour = "green";
};
+
+
home-manager.users.${config.custom.username}.config.custom.machineColour =
+
"green";
swapDevices = [{
device = "/var/swap";
···
};
security.acme = {
-
defaults.email = "${config.eilean.username}@${config.networking.domain}";
+
defaults.email = "${config.custom.username}@${config.networking.domain}";
acceptTerms = true;
};
-
-
systemd.services.eeww = {
-
enable = true;
-
description = "eeww";
-
after = [ "network.target" ];
-
wantedBy = [ "multi-user.target" ];
-
serviceConfig = {
-
ExecStart = "${pkgs.eeww}/main.exe -p 80";
-
WorkingDirectory =
-
"${ryan-website.packages.${config.nixpkgs.hostPlatform.system}.default}";
-
Restart = "always";
-
RestartSec = "10s";
-
AmbientCapabilities = [ "CAP_NET_BIND_SERVICE" ];
-
User = "eeww";
-
Group = "eeww";
-
};
-
};
-
-
users.users."eeww" = {
-
description = "eeww";
-
useDefaultShell = true;
-
group = "eeww";
-
isSystemUser = true;
-
};
-
-
users.groups."eeww" = { };
networking.firewall = {
allowedTCPPorts = [
+4 -2
hosts/elephant/default.nix
···
{
imports = [ ./hardware-configuration.nix ./zfs.nix ./services.nix ];
-
personal = {
+
custom = {
enable = true;
tailscale = true;
-
machineColour = "blue";
};
+
+
home-manager.users.${config.custom.username}.config.custom.machineColour =
+
"blue";
environment.systemPackages = with pkgs; [
smartmontools
+1 -1
hosts/elephant/services.nix
···
{
security.acme = {
-
defaults.email = "${config.eilean.username}@${config.networking.domain}";
+
defaults.email = "${config.custom.username}@${config.networking.domain}";
acceptTerms = true;
};
+11 -10
hosts/gecko/default.nix
···
{
imports = [ ./hardware-configuration.nix ];
-
personal = {
+
custom = {
enable = true;
tailscale = true;
-
machineColour = "blue";
laptop = true;
printing = true;
gui.i3 = true;
gui.sway = true;
gui.extra = true;
ocaml = true;
+
workstation = true;
+
};
+
+
home-manager.users.${config.custom.username}.config.custom = {
+
machineColour = "blue";
nvim-lsps = true;
};
···
repository = "rest:http://100.64.0.9:8000/${config.networking.hostName}/";
passwordFile = config.age.secrets.restic-gecko.path;
initialize = true;
-
paths = [
-
"/home/${config.custom.username}"
-
"/etc/NetworkManager/system-connections"
-
];
+
paths = [ "/home/ryan}" "/etc/NetworkManager/system-connections" ];
exclude = [
-
"/home/${config.custom.username}/videos"
-
"/home/${config.custom.username}/.thunderbird"
-
"/home/${config.custom.username}/.cache"
-
"/home/${config.custom.username}/.local/share/Steam"
+
"/home/ryan/videos"
+
"/home/ryan/.thunderbird"
+
"/home/ryan/.cache"
+
"/home/ryan/.local/share/Steam"
];
timerConfig = { OnUnitActiveSec = "1d"; };
extraBackupArgs = [ "-vv" ];
+2 -4
hosts/mouse/installer.nix
···
"wheel" # enable sudo
];
hashedPassword = hashedPassword;
-
openssh.authorizedKeys.keyFiles =
-
[ ../../modules/personal/authorized_keys ];
+
openssh.authorizedKeys.keyFiles = [ ../../modules/authorized_keys ];
};
users.root = {
hashedPassword = hashedPassword;
-
openssh.authorizedKeys.keyFiles =
-
[ ../../modules/personal/authorized_keys ];
+
openssh.authorizedKeys.keyFiles = [ ../../modules/authorized_keys ];
};
};
+2 -4
hosts/mouse/sd-image.nix
···
"wheel" # enable sudo
];
hashedPassword = hashedPassword;
-
openssh.authorizedKeys.keyFiles =
-
[ ../../modules/personal/authorized_keys ];
+
openssh.authorizedKeys.keyFiles = [ ../../modules/authorized_keys ];
};
users.root = {
hashedPassword = hashedPassword;
-
openssh.authorizedKeys.keyFiles =
-
[ ../../modules/personal/authorized_keys ];
+
openssh.authorizedKeys.keyFiles = [ ../../modules/authorized_keys ];
};
};
+8 -2
hosts/owl/default.nix
···
inputs.fn06-website.nixosModules.default
];
+
eilean = {
+
username = config.custom.username;
+
serverIpv4 = "135.181.100.27";
+
serverIpv6 = "2a01:4f9:c011:87ad:0:0:0:0";
+
};
+
networking.domain = lib.mkDefault "freumh.org";
eilean.publicInterface = "enp1s0";
eilean.mailserver.enable = true;
age.secrets.matrix-shared-secret = {
···
path = [ pkgs.ffmpeg ];
};
-
hosting = {
+
custom = {
freumh.enable = true;
nix-cache.enable = true;
rmfakecloud.enable = true;
···
cname = "vps";
keys = pkgs.stdenv.mkDerivation {
name = "ryan-keys";
-
src = ../../modules/personal/authorized_keys;
+
src = ../../modules/authorized_keys;
phases = [ "buildPhase" ];
buildPhase = ''
touch $out
+4 -2
hosts/owl/minimal.nix
···
{
imports = [ ./hardware-configuration.nix ];
-
personal = {
+
custom = {
enable = true;
tailscale = true;
-
machineColour = "yellow";
};
+
+
home-manager.users.${config.custom.username}.config.custom.machineColour =
+
"yellow";
boot.tmp.cleanOnBoot = true;
zramSwap.enable = true;
+4 -2
hosts/shrew/default.nix
···
{
imports = [ ./hardware-configuration.nix "${nixos-hardware}/raspberry-pi/4" ];
-
personal = {
+
custom = {
enable = true;
tailscale = true;
-
machineColour = "red";
gui.sway = true;
};
+
+
home-manager.users.${config.custom.username}.config.custom.machineColour =
+
"red";
networking.networkmanager.enable = true;
+5 -5
hosts/shrew/sd-image.nix
···
-
{ lib, nixpkgs, ... }:
+
{ config, lib, nixpkgs, ... }:
{
imports =
···
nixpkgs.hostPlatform = "aarch64-linux";
-
personal = {
-
enable = true;
-
machineColour = "red";
-
};
+
custom = { enable = true; };
+
+
home-manager.users.${config.custom.username}.config.custom.machineColour =
+
"red";
networking.wireless = {
enable = true;
+2 -2
hosts/swan/default.nix
···
-
{ pkgs, config, lib, eilean, ... }:
+
{ pkgs, config, lib, ... }:
let domain = "eeg.cl.cam.ac.uk";
in {
imports = [ ./hardware-configuration.nix ./minimal.nix ];
security.acme = {
-
defaults.email = "${config.eilean.username}@${config.networking.domain}";
+
defaults.email = "${config.custom.username}@${config.networking.domain}";
acceptTerms = true;
};
+4 -4
hosts/swan/minimal.nix
···
{
imports = [ ./hardware-configuration.nix ];
-
personal = {
-
enable = true;
-
machineColour = "green";
-
};
+
custom = { enable = true; };
+
+
home-manager.users.${config.custom.username}.config.custom.machineColour =
+
"green";
services.openssh.openFirewall = true;
+6 -3
hosts/vulpine/default.nix
···
-
{ pkgs, ... }:
+
{ pkgs, config, ... }:
{
imports = [ ./hardware-configuration.nix ];
-
personal = {
+
custom = {
enable = true;
tailscale = true;
-
machineColour = "magenta";
laptop = true;
gui.i3 = true;
gui.sway = true;
gui.extra = true;
+
workstation = true;
};
+
+
home-manager.users.${config.custom.username}.config.custom.machineColour =
+
"magenta";
boot.loader.grub = {
enable = true;
+18
modules/auto-upgrade.nix
···
+
{ pkgs, ... }@inputs: {
+
system.autoUpgrade = {
+
enable = true;
+
allowReboot = true;
+
flake = inputs.self.outPath;
+
flags = [ "--update-input" "nixpkgs" "-L" ];
+
dates = "03:00";
+
randomizedDelaySec = "1hr";
+
rebootWindow = {
+
lower = "03:00";
+
upper = "05:00";
+
};
+
};
+
systemd.services.nixos-upgrade.preStart = with pkgs; ''
+
DIR=/etc/nixos
+
${sudo}/bin/sudo -u `stat -c "%U" $DIR` ${git}/bin/git -C $DIR pull || exit 0
+
'';
+
}
+71 -51
modules/default.nix
···
-
{ config, lib, pkgs, ... }@inputs:
+
{ pkgs, config, lib, ... }@inputs:
-
{
+
let cfg = config.custom;
+
in {
imports = [
-
./personal/default.nix
-
./personal/nvim/default.nix
-
./personal/wireguard-hosts.nix
-
./personal/printing.nix
-
./personal/laptop.nix
-
./personal/nix-index.nix
-
./personal/ssh.nix
-
./personal/ocaml.nix
-
./personal/scripts.nix
-
./personal/gui/extra.nix
-
./personal/gui/kde.nix
-
./personal/gui/i3.nix
-
./personal/gui/default.nix
-
./personal/gui/sway.nix
-
./personal/tailscale.nix
-
./personal/shell.nix
-
./personal/external-hdd-backup.nix
-
./hosting/freumh.nix
-
./hosting/nix-cache.nix
-
./hosting/eeww.nix
-
./hosting/rmfakecloud.nix
+
./auto-upgrade.nix
+
./workstation.nix
+
./printing.nix
+
./freumh.nix
+
./scripts.nix
+
./ocaml.nix
+
./nix-cache.nix
+
./external-hdd-backup.nix
+
./laptop.nix
+
./nix-index.nix
+
./ssh.nix
+
./gui/extra.nix
+
./gui/kde.nix
+
./gui/i3.nix
+
./gui/default.nix
+
./gui/sway.nix
+
./rmfakecloud.nix
+
./tailscale.nix
+
./dict.nix
];
-
options.custom.username = lib.mkOption {
-
type = lib.types.str;
-
default = "ryan";
+
options.custom = {
+
enable = lib.mkEnableOption "custom";
+
username = lib.mkOption {
+
type = lib.types.str;
+
default = "ryan";
+
};
};
config = let nixPath = "/etc/nix-path";
-
in {
-
eilean = {
-
username = config.custom.username;
-
serverIpv4 = "135.181.100.27";
-
serverIpv6 = "2a01:4f9:c011:87ad:0:0:0:0";
+
in lib.mkIf cfg.enable {
+
console = {
+
font = "Lat2-Terminus16";
+
keyMap = "uk";
};
-
networking.domain = lib.mkDefault "freumh.org";
+
i18n.defaultLocale = "en_GB.UTF-8";
-
services.localtimed.enable = true;
-
services.geoclue2.enable = true;
+
networking.domain = "freumh.org";
-
i18n.defaultLocale = "en_GB.UTF-8";
+
eilean.username = cfg.username;
nix = {
settings = lib.mkMerge [
{
experimental-features = [ "nix-command" "flakes" ];
auto-optimise-store = true;
-
trusted-users = [ config.custom.username ];
+
trusted-users = [ cfg.username ];
}
-
(lib.mkIf (config.networking.hostName != "vps") {
+
(lib.mkIf (config.networking.hostName != "owl") {
substituters = [
"https://cache.nixos.org?priority=100"
"https://binarycache.${config.networking.domain}?priority=10"
···
};
systemd.tmpfiles.rules = [ "L+ ${nixPath} - - - - ${pkgs.path}" ];
-
system.autoUpgrade = {
-
enable = true;
-
allowReboot = true;
-
flake = inputs.self.outPath;
-
flags = [ "--update-input" "nixpkgs" "-L" ];
-
dates = "03:00";
-
randomizedDelaySec = "1hr";
-
rebootWindow = {
-
lower = "03:00";
-
upper = "05:00";
+
users = let
+
hashedPassword =
+
"$6$IPvnJnu6/fp1Jxfy$U6EnzYDOC2NqE4iqRrkJJbSTHHNWk0KwK1xyk9jEvlu584UWQLyzDVF5I1Sh47wQhSVrvUI4mrqw6XTTjfPj6.";
+
in {
+
mutableUsers = false;
+
groups.plugdev = { };
+
users.${cfg.username} = {
+
isNormalUser = true;
+
extraGroups = [
+
"wheel" # enable sudo
+
"networkmanager"
+
"video"
+
"plugdev"
+
];
+
shell = pkgs.zsh;
+
# we let home manager manager zsh
+
ignoreShellProgramCheck = true;
+
hashedPassword = hashedPassword;
};
+
users.root.hashedPassword = hashedPassword;
};
-
systemd.services.nixos-upgrade.preStart = with pkgs; ''
-
DIR=/etc/nixos
-
${sudo}/bin/sudo -u `stat -c "%U" $DIR` ${git}/bin/git -C $DIR pull || exit 0
-
'';
+
+
environment.systemPackages = with pkgs; [ nix agenix ];
+
+
networking = rec {
+
# nameservers = [ "freumh.org" ];
+
nameservers = [ "1.1.1.1" ];
+
networkmanager.dns = "none";
+
};
+
+
home-manager = {
+
useGlobalPkgs = true;
+
users.${config.custom.username} = import ../home/default.nix;
+
};
+
# zsh completion
+
environment.pathsToLink = [ "/share/zsh" ];
};
}
-55
modules/hosting/eeww.nix
···
-
{ pkgs, config, lib, ... }:
-
-
with lib;
-
-
let cfg = config.services.eeww;
-
in {
-
options = {
-
services.eeww = {
-
enable = mkEnableOption "eeww";
-
domain = lib.mkOption { type = lib.types.str; };
-
port = lib.mkOption {
-
type = lib.types.port;
-
default = 8081;
-
};
-
user = lib.mkOption {
-
type = lib.types.str;
-
default = "eeww";
-
};
-
group = lib.mkOption {
-
type = lib.types.str;
-
default = cfg.user;
-
};
-
};
-
};
-
-
config = lib.mkIf cfg.enable {
-
# TODO use unix socket?
-
services.nginx.virtualHosts."${cfg.domain}".locations."/".proxyPass =
-
"http://localhost:${builtins.toString cfg.port}";
-
-
systemd.services.eeww = {
-
enable = true;
-
description = "eeww";
-
after = [ "network.target" ];
-
wantedBy = [ "multi-user.target" ];
-
serviceConfig = {
-
ExecStart = "${pkgs.eeww}/main.exe -p 8081";
-
WorkingDirectory = "${pkgs.ryan-website}";
-
Restart = "always";
-
RestartSec = "10s";
-
User = "eeww";
-
Group = "eeww";
-
};
-
};
-
-
users.users."${cfg.user}" = {
-
description = "eeww";
-
useDefaultShell = true;
-
group = cfg.group;
-
isSystemUser = true;
-
};
-
-
users.groups."${cfg.group}" = { };
-
};
-
}
+3 -3
modules/hosting/freumh.nix modules/freumh.nix
···
{ pkgs, config, lib, ... }:
-
let cfg = config.hosting;
+
let cfg = config.custom;
in {
-
options.hosting.freumh.enable = lib.mkEnableOption "freumh";
+
options.custom.freumh.enable = lib.mkEnableOption "freumh";
config = lib.mkIf cfg.freumh.enable {
security.acme = {
-
defaults.email = "${config.eilean.username}@${config.networking.domain}";
+
defaults.email = "${config.custom.username}@${config.networking.domain}";
acceptTerms = true;
};
+3 -3
modules/hosting/nix-cache.nix modules/nix-cache.nix
···
{ config, pkgs, lib, ... }:
-
let cfg = config.hosting;
+
let cfg = config.custom;
in {
-
options.hosting.nix-cache.enable = lib.mkEnableOption "nix-cache";
+
options.custom.nix-cache.enable = lib.mkEnableOption "nix-cache";
config = lib.mkIf cfg.nix-cache.enable {
age.secrets."cache-priv-key.pem" = {
-
file = ../../secrets/cache-priv-key.pem.age;
+
file = ../secrets/cache-priv-key.pem.age;
mode = "770";
owner = "${config.systemd.services.nix-serve.serviceConfig.User}";
group = "${config.systemd.services.nix-serve.serviceConfig.Group}";
+3 -3
modules/hosting/rmfakecloud.nix modules/rmfakecloud.nix
···
with lib;
let
-
cfg = config.hosting.rmfakecloud;
+
cfg = config.custom.rmfakecloud;
domain = config.networking.domain;
in {
-
options.hosting.rmfakecloud = {
+
options.custom.rmfakecloud = {
enable = mkEnableOption "rmfakecloud";
port = mkOption {
type = types.port;
···
};
config = lib.mkIf cfg.enable {
-
age.secrets.rmfakecloud.file = ../../secrets/rmfakecloud.age;
+
age.secrets.rmfakecloud.file = ../secrets/rmfakecloud.age;
services.rmfakecloud = {
enable = true;
storageUrl = "https://${cfg.domain}";
modules/personal/authorized_keys modules/authorized_keys
-180
modules/personal/default.nix
···
-
{ pkgs, config, lib, ... }:
-
-
let cfg = config.personal;
-
in {
-
options.personal = { enable = lib.mkEnableOption "personal"; };
-
-
config = lib.mkIf cfg.enable {
-
console = {
-
font = "Lat2-Terminus16";
-
keyMap = "uk";
-
};
-
-
users = let
-
hashedPassword =
-
"$6$IPvnJnu6/fp1Jxfy$U6EnzYDOC2NqE4iqRrkJJbSTHHNWk0KwK1xyk9jEvlu584UWQLyzDVF5I1Sh47wQhSVrvUI4mrqw6XTTjfPj6.";
-
in {
-
mutableUsers = false;
-
groups.plugdev = { };
-
users.${config.custom.username} = {
-
isNormalUser = true;
-
extraGroups = [
-
"wheel" # enable sudo
-
"networkmanager"
-
"video"
-
"plugdev"
-
];
-
shell = pkgs.zsh;
-
hashedPassword = hashedPassword;
-
};
-
users.root.hashedPassword = hashedPassword;
-
};
-
-
environment = {
-
systemPackages = with pkgs; [
-
nix
-
agenix
-
tree
-
htop
-
bind
-
inetutils
-
dua
-
fd
-
nix-prefetch-git
-
gnumake
-
vlock
-
bat
-
killall
-
nmap
-
gcc
-
fzf
-
tcpdump
-
sshfs
-
nix-tree
-
#atuin
-
git-crypt
-
jq
-
bc
-
pandoc
-
w3m
-
ranger
-
bluetuith
-
powertop
-
ripgrep
-
toot
-
iamb
-
];
-
variables.EDITOR = "nvim";
-
shellAliases = {
-
ls = "ls -p --color=auto";
-
pls = "sudo $(fc -ln -1)";
-
o = "xdg-open";
-
se = "sudoedit";
-
su = "su -p";
-
ssh = "TERM=xterm ssh";
-
nix-shell = "nix-shell --command zsh";
-
inhibit-lid = "systemd-inhibit --what=handle-lid-switch sleep 1d";
-
tmux = "tmux -2";
-
feh = "feh --scale-down --auto-zoom";
-
nix-stray-roots =
-
"nix-store --gc --print-roots | egrep -v '^(/nix/var|/run|/proc|{censored})'";
-
};
-
sessionVariables = {
-
NIX_AUTO_RUN = "y";
-
NIX_AUTO_RUN_INTERACTIVE = "y";
-
BROWSER = "firefox"; # urlview
-
};
-
};
-
-
networking = rec {
-
# nameservers = [ ${config.eilean.serverIpv4} ];
-
nameservers = [ "1.1.1.1" ];
-
networkmanager.dns = "none";
-
};
-
-
programs.git = {
-
enable = true;
-
config = {
-
init = { defaultBranch = "main"; };
-
user = {
-
email = "${config.custom.username}@${config.networking.domain}";
-
name = "Ryan Gibb";
-
};
-
alias = {
-
s = "status";
-
c = "commit";
-
cm = "commit --message";
-
ca = "commit --amend";
-
cu = "commit --message update";
-
ci = "commit --message initial";
-
br = "branch";
-
co = "checkout";
-
df = "diff";
-
l = "log";
-
lg = "log -p";
-
lol = "log --graph --decorate --pretty=oneline --abbrev-commit";
-
lola =
-
"log --graph --decorate --pretty=oneline --abbrev-commit --all";
-
ls = "ls-files";
-
a = "add";
-
aa = "add --all";
-
au = "add -u";
-
ap = "add --patch";
-
ai = "add -i";
-
ps = "push";
-
pf = "push --force";
-
pu = "push --set-upstream";
-
pl = "pull";
-
pr = "pull --rebase";
-
acp = "!git add --all && git commit --message update && git push";
-
d = "diff";
-
dc = "diff --cached";
-
};
-
};
-
};
-
-
programs.tmux = {
-
enable = true;
-
extraConfig = let
-
toggle-status-bar = pkgs.writeScript "toggle-status-bar.sh" ''
-
#!/usr/bin/env bash
-
window_count=$(tmux list-windows | wc -l)
-
if [ "$window_count" -ge "2" ]; then
-
tmux set-option status on
-
else
-
tmux set-option status off
-
fi
-
'';
-
in ''
-
set-window-option -g mode-keys vi
-
set-option -g mouse on
-
set-option -g set-titles on
-
set-option -g set-titles-string "#T"
-
bind-key t capture-pane -S -\; new-window '(tmux show-buffer; tmux delete-buffer) | nvim -c $'
-
bind-key u capture-pane\; new-window '(tmux show-buffer; tmux delete-buffer) | ${pkgs.urlview}/bin/urlview'
-
set-hook -g session-window-changed 'run-shell ${toggle-status-bar}'
-
set-hook -g session-created 'run-shell ${toggle-status-bar}'
-
# Fixes C-Up/Down in TUIs
-
set-option default-terminal tmux
-
# https://stackoverflow.com/questions/62182401/neovim-screen-lagging-when-switching-mode-from-insert-to-normal
-
# locking
-
set -s escape-time 0
-
set -g lock-command vlock
-
set -g lock-after-time 0 # Seconds; 0 = never
-
bind L lock-session
-
# for .zprofile display environment starting https://github.com/tmux/tmux/issues/3483
-
set-option -g update-environment XDG_VTNR
-
# Allow clipboard with OSC-52 work
-
set -s set-clipboard on
-
'';
-
};
-
-
programs.less = {
-
enable = true;
-
lineEditingKeys = {
-
"\\e[1;5D" = "word-left";
-
"\\e[1;5C" = "word-right";
-
};
-
};
-
};
-
}
+3 -3
modules/personal/dict.nix modules/dict.nix
···
{ pkgs, config, lib, ... }:
-
let cfg = config.personal;
+
let cfg = config.custom;
in {
-
options.personal.dict = lib.mkOption {
-
type = types.bool;
+
options.custom.dict = lib.mkOption {
+
type = lib.types.bool;
default = true;
};
+3 -3
modules/personal/external-hdd-backup.nix modules/external-hdd-backup.nix
···
{ pkgs, config, lib, ... }:
-
let cfg = config.personal;
+
let cfg = config.custom;
in {
-
options.personal.backup = {
+
options.custom.external-hdd-backup = {
enable = lib.mkEnableOption "laptop";
disk = lib.mkOption {
type = lib.types.str;
···
};
};
-
config = lib.mkIf cfg.backup.enable {
+
config = lib.mkIf cfg.external-hdd-backup.enable {
systemd.services.backup = {
description = "Backup service";
# NB udisks isn't viable as non-root due to:
+5 -3
modules/personal/gui/default.nix modules/gui/default.nix
···
{ pkgs, config, lib, ... }:
-
let cfg = config.personal.gui;
+
let cfg = config.custom.gui;
in {
-
options.personal.gui.enable = lib.mkOption {
+
options.custom.gui.enable = lib.mkOption {
type = lib.types.bool;
default = cfg.i3 || cfg.sway || cfg.kde;
};
config = lib.mkIf cfg.enable {
-
home-manager.users.${config.custom.username} = import ../home/default.nix;
+
home-manager.users.${config.custom.username} = { config, ... }: {
+
config.custom.gui.enable = true;
+
};
networking.networkmanager.enable = true;
programs.nm-applet = {
+2 -2
modules/personal/gui/extra.nix modules/gui/extra.nix
···
{ pkgs, config, lib, ... }:
-
let cfg = config.personal.gui;
+
let cfg = config.custom.gui;
in {
-
options.personal.gui.extra = lib.mkEnableOption "extra";
+
options.custom.gui.extra = lib.mkEnableOption "extra";
config = lib.mkIf cfg.extra {
environment.systemPackages = with pkgs; [
+5 -3
modules/personal/gui/i3.nix modules/gui/i3.nix
···
{ pkgs, config, lib, ... }:
-
let cfg = config.personal.gui;
+
let cfg = config.custom.gui;
in {
-
options.personal.gui.i3 = lib.mkEnableOption "i3";
+
options.custom.gui.i3 = lib.mkEnableOption "i3";
config = lib.mkIf cfg.i3 {
-
home-manager.users.${config.custom.username} = import ../home/i3.nix;
+
home-manager.users.${config.custom.username} = { config, ... }: {
+
config.custom.gui.i3.enable = true;
+
};
services.xserver = {
enable = true;
+2 -2
modules/personal/gui/kde.nix modules/gui/kde.nix
···
{ config, lib, ... }:
-
let cfg = config.personal.gui;
+
let cfg = config.custom.gui;
in {
-
options.personal.gui.kde = lib.mkEnableOption "kde";
+
options.custom.gui.kde = lib.mkEnableOption "kde";
config = lib.mkIf cfg.kde {
services.xserver = {
+5 -3
modules/personal/gui/sway.nix modules/gui/sway.nix
···
{ pkgs, config, lib, ... }:
-
let cfg = config.personal.gui;
+
let cfg = config.custom.gui;
in {
-
options.personal.gui.sway = lib.mkEnableOption "sway";
+
options.custom.gui.sway = lib.mkEnableOption "sway";
config = lib.mkIf cfg.sway {
-
home-manager.users.${config.custom.username} = import ../home/sway.nix;
+
home-manager.users.${config.custom.username} = { config, ... }: {
+
config.custom.gui.sway.enable = true;
+
};
programs.sway = {
enable = true;
modules/personal/home/alacritty.yml home/alacritty.yml
-190
modules/personal/home/default.nix
···
-
{ pkgs, config, ... }:
-
-
{
-
imports = [ ./mail/default.nix ];
-
-
gtk = {
-
enable = true;
-
font = {
-
name = "Noto Sans 11";
-
package = pkgs.noto-fonts;
-
};
-
iconTheme = {
-
package = pkgs.gruvbox-dark-icons-gtk;
-
name = "gruvbox-dark";
-
};
-
theme = {
-
package = pkgs.gruvbox-dark-gtk;
-
name = "gruvbox-dark";
-
};
-
};
-
-
# evince workaround
-
home.sessionVariables.GTK_THEME = "gruvbox-dark";
-
-
home.sessionVariables.WALLPAPER = let wallpaper = ./wallpaper.jpg;
-
in pkgs.runCommand (builtins.baseNameOf wallpaper) { } "cp ${wallpaper} $out";
-
-
home.sessionVariables.GOPATH = "$HOME/.go";
-
-
home.pointerCursor = {
-
name = "Adwaita";
-
package = pkgs.gnome.adwaita-icon-theme;
-
size = 32;
-
};
-
-
home.file.".profile".text = ''
-
source "$HOME/.nix-profile/etc/profile.d/hm-session-vars.sh"
-
'';
-
-
programs.firefox = let
-
settings = {
-
"browser.ctrlTab.recentlyUsedOrder" = false;
-
"browser.tabs.warnOnClose" = false;
-
"browser.toolbars.bookmarks.visibility" = "never";
-
-
# Only hide UI elements on F11 (i.e. don't go fullscreen, leave that to WM)
-
"full-screen-api.ignore-widgets" = true;
-
# Right click issue fix
-
"ui.context_menus.after_mouseup" = true;
-
-
# Use userChrome.css
-
"toolkit.legacyUserProfileCustomizations.stylesheets" = true;
-
-
"browser.shell.checkDefaultBrowser" = false;
-
-
# sync toolbar
-
"services.sync.prefs.sync.browser.uiCustomization.state" = true;
-
-
"extensions.pocket.enabled" = false;
-
};
-
userChrome = ''
-
#webrtcIndicator {
-
display: none;
-
}
-
-
/* Move find bar to top */
-
.browserContainer > findbar {
-
-moz-box-ordinal-group: 0;
-
}
-
-
#TabsToolbar
-
{
-
visibility: collapse;
-
}
-
'';
-
in {
-
enable = true;
-
profiles.default = {
-
settings = settings;
-
userChrome = userChrome;
-
};
-
profiles.secondary = {
-
id = 1;
-
isDefault = false;
-
settings = settings;
-
userChrome = userChrome;
-
};
-
package = (pkgs.firefox.override {
-
nativeMessagingHosts = with pkgs; [ tridactyl-native ];
-
});
-
};
-
-
home.file = {
-
".config/gtk-3.0/bookmarks" = {
-
force = true;
-
text = ''
-
file:///${config.home.homeDirectory}/archive
-
file:///${config.home.homeDirectory}/documents
-
file:///${config.home.homeDirectory}/downloads
-
file:///${config.home.homeDirectory}/pictures
-
file:///${config.home.homeDirectory}/videos
-
file:///${config.home.homeDirectory}/projects
-
'';
-
};
-
".config/mimeapps.list" = {
-
force = true;
-
source = ./mimeapps.list;
-
};
-
};
-
-
xdg = {
-
desktopEntries = {
-
# https://gitlab.freedesktop.org/xdg/xdg-utils/-/issues/84
-
# `echo $XDG_DATA_DIRS`
-
nvim = {
-
name = "Neovim";
-
genericName = "Text Editor";
-
exec = "alacritty -e nvim %F";
-
terminal = false;
-
categories = [ "Application" "Utility" "TextEditor" ];
-
icon = "nvim";
-
mimeType = [ "text/english" "text/plain" ];
-
};
-
aerc = {
-
name = "aerc";
-
genericName = "Mail Client";
-
exec = "alacritty -e aerc";
-
terminal = false;
-
categories = [ "Office" "Network" "Email" "ConsoleOnly" ];
-
icon = "utilities-terminal";
-
mimeType = [ "x-scheme-handler/mailto" ];
-
};
-
};
-
configFile = {
-
"Thunar/uca.xml".source = ./thunar.xml;
-
"fontconfig/fonts.conf".source = ./fonts.conf;
-
"alacritty.yml".source = ./alacritty.yml;
-
"Element/config.json".source = ./element.json;
-
"swappy/config".text = ''
-
[Default]
-
save_dir=~/capture/capture/
-
save_filename_format=screenshot_%Y-%m-%dT%H:%M:%S%z.png
-
'';
-
"tridactyl/tridactylrc".source = ./tridactylrc;
-
};
-
userDirs = {
-
enable = true;
-
createDirectories = true;
-
download = "$HOME/downloads";
-
pictures = "$HOME/pictures";
-
videos = "$HOME/videos";
-
documents = "$HOME/documents/";
-
music = "$HOME/";
-
# https://bugzilla.mozilla.org/show_bug.cgi?id=1082717
-
desktop = "$HOME/";
-
templates = "$HOME/";
-
publicShare = "$HOME/";
-
};
-
};
-
-
# https://github.com/nix-community/home-manager/issues/1439#issuecomment-1106208294
-
home.activation = {
-
linkDesktopApplications = {
-
after = [ "writeBoundary" "createXdgUserDirectories" ];
-
before = [ ];
-
data = ''
-
rm -rf ${config.xdg.dataHome}/"applications/home-manager"
-
mkdir -p ${config.xdg.dataHome}/"applications/home-manager"
-
cp -Lr ${config.home.homeDirectory}/.nix-profile/share/applications/* ${config.xdg.dataHome}/"applications/home-manager/"
-
'';
-
};
-
};
-
-
programs.go.goPath = "~/.go";
-
-
home.stateVersion = "22.05";
-
-
services.kdeconnect.enable = true;
-
-
home.packages = with pkgs; [ ];
-
-
services.spotifyd = {
-
enable = true;
-
settings.global = {
-
username = "ryangibb321@gmail.com";
-
password_cmd = "pass show spotify/ryangibb321@gmail.com";
-
};
-
};
-
}
-
modules/personal/home/dunst home/dunst
modules/personal/home/element.json home/element.json
modules/personal/home/fonts.conf home/fonts.conf
modules/personal/home/fusuma.yml home/fusuma.yml
-63
modules/personal/home/i3.nix
···
-
{ pkgs, lib, ... }:
-
-
let
-
replacements = {
-
wm = "i3";
-
wmmsg = "i3-msg";
-
rofi = "rofi";
-
app_id = "class";
-
bar_extra = "";
-
locked = "";
-
polkit_gnome = "${pkgs.polkit_gnome}";
-
locker = "xsecurelock";
-
enable_output = "xrandr --output $laptop_output --auto";
-
disable_output = "xrandr --output $laptop_output --off";
-
drun = "rofi -i -modi drun -show drun";
-
run = "rofi -i -modi run -show run";
-
dmenu = "rofi -i -dmenu -p";
-
displays = "arandr";
-
bar = "i3bar";
-
notification_deamon = "dunst";
-
i3-workspace-history = "${pkgs.i3-workspace-history}";
-
i3-workspace-history-args = "";
-
};
-
in let util = import ./util.nix { inherit pkgs lib; };
-
in {
-
# TODO
-
# idling
-
-
home.pointerCursor.x11.enable = true;
-
-
home.file = {
-
".xinitrc".text = ''
-
export XDG_SESSION_TYPE=x11
-
export GDK_BACKEND=x11
-
export DESKTOP_SESSION=plasma
-
exec i3 &> ~/.i3_log
-
'';
-
".zprofile".text = ''
-
# Autostart at login on TTY 2
-
if [ -z "''${DISPLAY}" ] && [ "''${XDG_VTNR}" -eq 2 ]; then
-
source $HOME/.nix-profile/etc/profile.d/hm-session-vars.sh
-
exec startx
-
fi
-
'';
-
};
-
-
xdg.configFile = let
-
entries = {
-
"dunst/dunstrc".source = ./dunst;
-
"i3/config".text = let wmFilenames = util.listFilesInDir ./wm/config.d;
-
in let i3Filenames = util.listFilesInDir ./wm/i3;
-
in (util.concatFilesReplace
-
([ ./wm/config ] ++ wmFilenames ++ i3Filenames) replacements);
-
"i3blocks".source = ./i3blocks;
-
"rofi/config.rasi".source = ./rofi.rasi;
-
};
-
in (util.inDirReplace ./wm/scripts "i3/scripts" replacements) // entries;
-
-
services.redshift = {
-
enable = true;
-
provider = "geoclue2";
-
};
-
}
modules/personal/home/i3blocks/backlight home/i3blocks/backlight
modules/personal/home/i3blocks/battery home/i3blocks/battery
modules/personal/home/i3blocks/config home/i3blocks/config
modules/personal/home/i3blocks/cpu home/i3blocks/cpu
modules/personal/home/i3blocks/disk home/i3blocks/disk
modules/personal/home/i3blocks/idle home/i3blocks/idle
modules/personal/home/i3blocks/load_average home/i3blocks/load_average
modules/personal/home/i3blocks/mail home/i3blocks/mail
modules/personal/home/i3blocks/memory home/i3blocks/memory
modules/personal/home/i3blocks/network home/i3blocks/network
modules/personal/home/i3blocks/pulse home/i3blocks/pulse
modules/personal/home/i3blocks/record home/i3blocks/record
modules/personal/home/i3blocks/temperature home/i3blocks/temperature
modules/personal/home/kanshi home/kanshi
modules/personal/home/mail/aerc-binds.nix home/aerc-binds.nix
-305
modules/personal/home/mail/default.nix
···
-
{ pkgs, config, ... }:
-
-
let
-
address-book = pkgs.writeScriptBin "address-book" ''
-
#!/usr/bin/env bash
-
${pkgs.ugrep}/bin/ugrep -jPh -m 100 --color=never "$1"\
-
${config.accounts.email.maildirBasePath}/addressbook/maildir\
-
${config.accounts.email.maildirBasePath}/addressbook/cam-ldap
-
'';
-
sync-mail = pkgs.writeScriptBin "sync-mail" ''
-
#!/usr/bin/env bash
-
${pkgs.isync}/bin/mbsync "$1"
-
${pkgs.mu}/bin/mu index
-
${pkgs.procps}/bin/pkill -RTMIN+13 i3block
-
'';
-
in {
-
home.packages = with pkgs; [
-
maildir-rank-addr
-
(pkgs.writeScriptBin "cam-ldap-addr" ''
-
${pkgs.openldap}/bin/ldapsearch -xZ -H ldaps://ldap.lookup.cam.ac.uk -b "ou=people,o=University of Cambridge,dc=cam,dc=ac,dc=uk" displayName mail\
-
| ${pkgs.gawk}/bin/awk '/^dn:/{displayName=""; mail=""; next} /^displayName:/{displayName=$2; for(i=3;i<=NF;i++) displayName=displayName " " $i; next} /^mail:/{mail=$2; next} /^$/{if(displayName!="" && mail!="") print mail "\t" displayName}'\
-
> ${config.accounts.email.maildirBasePath}/addressbook/cam-ldap
-
'')
-
address-book
-
];
-
-
xdg.configFile = {
-
"maildir-rank-addr/config".text = with config.accounts.email; ''
-
maildir = "${config.accounts.email.maildirBasePath}"
-
outputpath = "${config.accounts.email.maildirBasePath}/addressbook/maildir"
-
addresses = [
-
"ryan@freumh.org",
-
"misc@freumh.org",
-
"ryan@gibbr.org",
-
"misc@gibbr.org",
-
"ryan.gibb@cl.cam.ac.uk",
-
"rtg24@cam.ac.uk",
-
"rtg2@st-andrews.ac.uk",
-
"ryangibb321@gmail.com",
-
"ryangibb@btconnect.com",
-
]
-
'';
-
};
-
-
programs = {
-
password-store.enable = true;
-
gpg.enable = true;
-
mbsync.enable = true;
-
mu.enable = true;
-
msmtp.enable = true;
-
aerc = {
-
enable = true;
-
extraConfig = {
-
general.unsafe-accounts-conf = true;
-
general.default-save-path = "~/downloads";
-
ui.mouse-enabled = true;
-
compose.address-book-cmd = "${address-book}/bin/address-book '%s'";
-
compose.file-picker-cmd = "${pkgs.ranger}/bin/ranger --choosefiles=%f";
-
compose.format-flowed = true;
-
ui.index-columns = "date<=,name<50,flags>=,subject<*";
-
ui.column-name = "{{index (.From | persons) 0}}";
-
"ui:folder=Sent".index-columns = "date<=,to<50,flags>=,subject<*";
-
"ui:folder=Sent".column-to = "{{index (.To | persons) 0}}";
-
openers."text/html" = "firefox --new-window";
-
hooks.mail-recieved = ''
-
notify-send "[$AERC_ACCOUNT/$AERC_FOLDER] mail from $AERC_FROM_NAME" "$AERC_SUBJECT"'';
-
filters = {
-
"text/plain" = "wrap -w 90 | colorize";
-
"text/calendar" = "calendar";
-
"message/delivery-status" = "colorize";
-
"message/rfc822" = "colorize";
-
"text/html" = "html | colorize";
-
};
-
};
-
extraBinds = import ./aerc-binds.nix;
-
};
-
neomutt = {
-
enable = true;
-
extraConfig = ''
-
# Macro to switch accounts
-
macro index,pager <F1> '"<change-folder> ${config.accounts.email.maildirBasePath}/ryan@freumh.org/Inbox<enter>"'
-
macro index,pager <F2> '"<change-folder> ${config.accounts.email.maildirBasePath}/ryangibb321@gmail.com/Inbox<enter>"'
-
macro index,pager <F3> '"<change-folder> ${config.accounts.email.maildirBasePath}/ryan.gibb@cl.cam.ac.uk/Inbox<enter>"'
-
-
# mutt macros for mu
-
macro index <F8> "<shell-escape>mu find --clearlinks --format=links --linksdir=${config.accounts.email.maildirBasePath}/search " \
-
"mu find"
-
macro index <F9> "<change-folder-readonly>˜/Maildir/search" \
-
"mu find results"
-
'';
-
};
-
};
-
-
services = {
-
imapnotify.enable = true;
-
gpg-agent.enable = true;
-
};
-
-
accounts.email = {
-
maildirBasePath = "mail";
-
order = [ "ryangibb321@gmail.com" "ryan.gibb@cl.cam.ac.uk" ];
-
accounts = {
-
"ryan@freumh.org" = rec {
-
primary = true;
-
realName = "Ryan Gibb";
-
userName = "ryan@freumh.org";
-
address = "ryan@freumh.org";
-
passwordCommand = "${pkgs.pass}/bin/pass show email/ryan@freumh.org";
-
imap.host = "mail.freumh.org";
-
smtp = {
-
host = "mail.freumh.org";
-
port = 465;
-
};
-
folders = {
-
drafts = "Drafts";
-
inbox = "Inbox";
-
sent = "Sent";
-
trash = "Trash";
-
};
-
imapnotify = {
-
enable = true;
-
boxes = [ "Inbox" ];
-
onNotify =
-
"${pkgs.isync}/bin/mbsync ryan@freumh.org && ${pkgs.mu}/bin/mu index && ${pkgs.procps}/bin/pkill -RTMIN+13 i3blocks";
-
};
-
mbsync = {
-
enable = true;
-
create = "both";
-
expunge = "both";
-
remove = "both";
-
};
-
msmtp = { enable = true; };
-
aerc = {
-
enable = true;
-
extraAccounts = {
-
check-mail-cmd =
-
"${pkgs.isync}/bin/mbsync ryan@freumh.org && ${pkgs.mu}/bin/mu index && ${pkgs.procps}/bin/pkill -RTMIN+13 i3blocks";
-
check-mail-timeout = "1m";
-
check-mail = "1h";
-
folders-sort = [ "Inbox" "Sent" "Drafts" "Archive" "Spam" "Trash" ];
-
folder-map = "${pkgs.writeText "folder-map" ''
-
Spam = Junk
-
Bin = Trash
-
''}";
-
};
-
};
-
neomutt = {
-
enable = true;
-
extraConfig = ''
-
bind index g noop
-
macro index gi "<change-folder>=${folders.inbox}<enter>"
-
macro index gs "<change-folder>=${folders.sent}<enter>"
-
macro index gd "<change-folder>=${folders.drafts}<enter>"
-
macro index gt "<change-folder>=${folders.trash}<enter>"
-
'';
-
};
-
};
-
"misc@freumh.org" = rec {
-
userName = "misc@freumh.org";
-
address = "misc@freumh.org";
-
realName = "Misc";
-
passwordCommand = "${pkgs.pass}/bin/pass show email/misc@freumh.org";
-
imap.host = "mail.freumh.org";
-
smtp = {
-
host = "mail.freumh.org";
-
port = 465;
-
};
-
folders = {
-
drafts = "Drafts";
-
inbox = "Inbox";
-
sent = "Sent";
-
trash = "Bin";
-
};
-
imapnotify = {
-
enable = true;
-
boxes = [ "Inbox" ];
-
onNotify =
-
"${pkgs.isync}/bin/mbsync misc@freumh.org && ${pkgs.mu}/bin/mu index && ${pkgs.procps}/bin/pkill -RTMIN+13 i3blocks";
-
};
-
mbsync = {
-
enable = true;
-
create = "both";
-
expunge = "both";
-
remove = "both";
-
};
-
msmtp = { enable = true; };
-
neomutt = {
-
enable = true;
-
extraConfig = ''
-
bind index g noop
-
macro index gi "<change-folder>=${folders.inbox}<enter>"
-
macro index gs "<change-folder>=${folders.sent}<enter>"
-
macro index gd "<change-folder>=${folders.drafts}<enter>"
-
macro index gt "<change-folder>=${folders.trash}<enter>"
-
'';
-
};
-
};
-
"ryan.gibb@cl.cam.ac.uk" = rec {
-
userName = "rtg24@fm.cl.cam.ac.uk";
-
address = "ryan.gibb@cl.cam.ac.uk";
-
realName = "Ryan Gibb";
-
passwordCommand =
-
"${pkgs.pass}/bin/pass show email/ryan.gibb@cl.cam.ac.uk";
-
flavor = "fastmail.com";
-
folders = {
-
drafts = "Drafts";
-
inbox = "Inbox";
-
sent = "Sent";
-
trash = "Trash";
-
};
-
imapnotify = {
-
enable = true;
-
boxes = [ "Inbox" ];
-
onNotify =
-
"${pkgs.isync}/bin/mbsync ryan.gibb@cl.cam.ac.uk && ${pkgs.mu}/bin/mu index && ${pkgs.procps}/bin/pkill -RTMIN+13 i3blocks";
-
};
-
mbsync = {
-
enable = true;
-
create = "both";
-
expunge = "both";
-
remove = "both";
-
};
-
msmtp = { enable = true; };
-
aerc = {
-
enable = true;
-
extraAccounts = {
-
check-mail-cmd =
-
"${pkgs.isync}/bin/mbsync ryan.gibb@cl.cam.ac.uk && ${pkgs.mu}/bin/mu index && ${pkgs.procps}/bin/pkill -RTMIN+13 i3blocks";
-
check-mail-timeout = "1m";
-
check-mail = "1h";
-
aliases = "rtg24@cam.ac.uk";
-
folders-sort =
-
[ "Inbox" "Sidebox" "Sent" "Drafts" "Archive" "Spam" "Trash" ];
-
folder-map = "${pkgs.writeText "folder-map" ''
-
Bin = Trash
-
''}";
-
};
-
};
-
neomutt = {
-
enable = true;
-
extraConfig = ''
-
bind index g noop
-
macro index gi "<change-folder>=${folders.inbox}<enter>"
-
macro index gs "<change-folder>=${folders.sent}<enter>"
-
macro index gd "<change-folder>=${folders.drafts}<enter>"
-
macro index gt "<change-folder>=${folders.trash}<enter>"
-
'';
-
};
-
};
-
"ryangibb321@gmail.com" = rec {
-
userName = "ryangibb321@gmail.com";
-
address = "ryangibb321@gmail.com";
-
realName = "Ryan Gibb";
-
passwordCommand =
-
"${pkgs.pass}/bin/pass show email/ryangibb321@gmail.com";
-
flavor = "gmail.com";
-
folders = {
-
drafts = "Drafts";
-
inbox = "Inbox";
-
sent = "Sent Mail";
-
trash = "Bin";
-
};
-
imapnotify = {
-
enable = true;
-
boxes = [ "Inbox" ];
-
onNotify =
-
"${pkgs.isync}/bin/mbsync ryangibb321@gmail.com && ${pkgs.mu}/bin/mu index && ${pkgs.procps}/bin/pkill -RTMIN+13 i3blocks";
-
};
-
mbsync = {
-
enable = true;
-
create = "both";
-
expunge = "both";
-
remove = "both";
-
};
-
msmtp = { enable = true; };
-
aerc = {
-
enable = true;
-
extraAccounts = {
-
check-mail-cmd =
-
"${pkgs.isync}/bin/mbsync ryangibb321@gmail.com && ${pkgs.mu}/bin/mu index && ${pkgs.procps}/bin/pkill -RTMIN+13 i3blocks";
-
check-mail-timeout = "1m";
-
check-mail = "1h";
-
folders-sort =
-
[ "Inbox" "Sidebox" "Sent" "Drafts" "Archive" "Spam" "Trash" ];
-
folder-map = "${pkgs.writeText "folder-map" ''
-
* = [Gmail]/*
-
Sent = 'Sent Mail'
-
Archive = 'All Mail'
-
''}";
-
};
-
};
-
neomutt = {
-
enable = true;
-
extraConfig = ''
-
bind index g noop
-
macro index gi "<change-folder>=${folders.inbox}<enter>"
-
macro index gs "<change-folder>=${folders.sent}<enter>"
-
macro index gd "<change-folder>=${folders.drafts}<enter>"
-
macro index gt "<change-folder>=${folders.trash}<enter>"
-
'';
-
};
-
};
-
};
-
};
-
}
modules/personal/home/mako home/mako
modules/personal/home/mimeapps.list home/mimeapps.list
modules/personal/home/rofi.rasi home/rofi.rasi
-78
modules/personal/home/sway.nix
···
-
{ pkgs, lib, ... }:
-
-
let
-
replacements = {
-
wm = "sway";
-
wmmsg = "swaymsg";
-
rofi = "wofi";
-
app_id = "app_id";
-
bar_extra = ''
-
icon_theme Papirus
-
'';
-
locked = "--locked";
-
polkit_gnome = "${pkgs.polkit_gnome}";
-
locker = "swaylock -f -i $WALLPAPER";
-
enable_output = "swaymsg output $laptop_output enable";
-
disable_output = "swaymsg output $laptop_output disable";
-
drun = "wofi -i --show drun --allow-images -a";
-
run = "wofi -i --show run";
-
dmenu = "wofi -d -i -p";
-
displays = "wdisplays";
-
bar = "swaybar";
-
notification_deamon = "mako";
-
i3-workspace-history = "${pkgs.i3-workspace-history}";
-
i3-workspace-history-args = "-sway";
-
};
-
in let util = import ./util.nix { inherit pkgs lib; };
-
in {
-
home.sessionVariables = {
-
QT_QPA_PLATFORM = "wayland";
-
SDL_VIDEODRIVER = "wayland";
-
MOZ_ENABLE_WAYLAND = 1;
-
MOZ_DBUS_REMOTE = 1;
-
QT_STYLE_OVERRIDE = "Fusion";
-
TERMINAL = "alacritty";
-
WLR_NO_HARDWARE_CURSORS = 1;
-
NIXOS_OZONE_WL = 1;
-
-
# for intellij
-
_JAVA_AWT_WM_NONREPARENTING = 1;
-
-
# for screensharing
-
XDG_SESSION_TYPE = "wayland";
-
XDG_CURRENT_DESKTOP = "sway";
-
};
-
-
home.file.".zprofile".text = ''
-
# Autostart sway at login on TTY 1
-
if [ -z "''${DISPLAY}" ] && [ "''${XDG_VTNR}" -eq 1 ]; then
-
source $HOME/.nix-profile/etc/profile.d/hm-session-vars.sh
-
exec sway -d 2> $HOME/.sway_log
-
fi
-
'';
-
-
xdg.configFile = let
-
entries = {
-
"fusuma/config.yml".source = ./fusuma.yml;
-
"kanshi/config".source = ./kanshi;
-
"mako/config".source = ./mako;
-
"swaylock/config".source = ./swaylock;
-
"wofi/style.css".source = ./wofi.css;
-
"swappy/config".text = ''
-
[Default]
-
save_dir=$XDG_PICTURES_DIR/capture/
-
save_filename_format=screenshot_%Y-%m-%dT%H:%M:%S%z.png
-
'';
-
"sway/config".text = let wmFilenames = util.listFilesInDir ./wm/config.d;
-
in let swayFilenames = util.listFilesInDir ./wm/sway;
-
in (util.concatFilesReplace
-
([ ./wm/config ] ++ wmFilenames ++ swayFilenames) replacements);
-
"i3blocks".source = ./i3blocks;
-
};
-
in (util.inDirReplace ./wm/scripts "sway/scripts" replacements) // entries;
-
-
services.gammastep = {
-
enable = true;
-
provider = "geoclue2";
-
};
-
}
modules/personal/home/swaylock home/swaylock
modules/personal/home/thunar.xml home/thunar.xml
modules/personal/home/tridactylrc home/tridactylrc
modules/personal/home/util.nix home/util.nix
modules/personal/home/vscode/keybindings.json home/vscode/keybindings.json
modules/personal/home/vscode/settings.json home/vscode/settings.json
modules/personal/home/wallpaper.jpg home/wallpaper.jpg
modules/personal/home/wm/config home/wm/config
modules/personal/home/wm/config.d/appearance home/wm/config.d/appearance
modules/personal/home/wm/config.d/bindings home/wm/config.d/bindings
modules/personal/home/wm/config.d/default_workspaces home/wm/config.d/default_workspaces
modules/personal/home/wm/config.d/exec home/wm/config.d/exec
modules/personal/home/wm/config.d/output home/wm/config.d/output
modules/personal/home/wm/i3/bindings home/wm/i3/bindings
modules/personal/home/wm/i3/config home/wm/i3/config
modules/personal/home/wm/i3/exec home/wm/i3/exec
modules/personal/home/wm/i3/input home/wm/i3/input
modules/personal/home/wm/i3/output home/wm/i3/output
modules/personal/home/wm/scripts/bat_monitor.sh home/wm/scripts/bat_monitor.sh
modules/personal/home/wm/scripts/bluetooth_device.sh home/wm/scripts/bluetooth_device.sh
modules/personal/home/wm/scripts/cycle_sink.sh home/wm/scripts/cycle_sink.sh
modules/personal/home/wm/scripts/dpms_off.sh home/wm/scripts/dpms_off.sh
modules/personal/home/wm/scripts/dpms_toggle.sh home/wm/scripts/dpms_toggle.sh
modules/personal/home/wm/scripts/focus_leaf.sh home/wm/scripts/focus_leaf.sh
modules/personal/home/wm/scripts/focus_on_id.sh home/wm/scripts/focus_on_id.sh
modules/personal/home/wm/scripts/focus_root.sh home/wm/scripts/focus_root.sh
modules/personal/home/wm/scripts/get_cur_focus_id.sh home/wm/scripts/get_cur_focus_id.sh
modules/personal/home/wm/scripts/get_cur_ws_name.sh home/wm/scripts/get_cur_ws_name.sh
modules/personal/home/wm/scripts/get_focused_output.sh home/wm/scripts/get_focused_output.sh
modules/personal/home/wm/scripts/get_free_ws_num.sh home/wm/scripts/get_free_ws_num.sh
modules/personal/home/wm/scripts/get_ws_title.sh home/wm/scripts/get_ws_title.sh
modules/personal/home/wm/scripts/laptop_clamshell.sh home/wm/scripts/laptop_clamshell.sh
modules/personal/home/wm/scripts/lock_on_lid_close.sh home/wm/scripts/lock_on_lid_close.sh
modules/personal/home/wm/scripts/network_connect.sh home/wm/scripts/network_connect.sh
modules/personal/home/wm/scripts/notification_log.sh home/wm/scripts/notification_log.sh
modules/personal/home/wm/scripts/open_file.sh home/wm/scripts/open_file.sh
modules/personal/home/wm/scripts/pause_player.sh home/wm/scripts/pause_player.sh
modules/personal/home/wm/scripts/select_ws.sh home/wm/scripts/select_ws.sh
modules/personal/home/wm/scripts/slurp_point.sh home/wm/scripts/slurp_point.sh
modules/personal/home/wm/scripts/slurp_windows.sh home/wm/scripts/slurp_windows.sh
modules/personal/home/wm/scripts/swayidle_dpms.sh home/wm/scripts/swayidle_dpms.sh
modules/personal/home/wm/scripts/swayidle_inhibit.sh home/wm/scripts/swayidle_inhibit.sh
modules/personal/home/wm/scripts/swayidle_lock.sh home/wm/scripts/swayidle_lock.sh
modules/personal/home/wm/scripts/swayidle_lock_no_dpms.sh home/wm/scripts/swayidle_lock_no_dpms.sh
modules/personal/home/wm/scripts/swayidle_suspend.sh home/wm/scripts/swayidle_suspend.sh
modules/personal/home/wm/scripts/tab_windows.sh home/wm/scripts/tab_windows.sh
modules/personal/home/wm/scripts/title_ws.sh home/wm/scripts/title_ws.sh
modules/personal/home/wm/scripts/vault_file.sh home/wm/scripts/vault_file.sh
modules/personal/home/wm/scripts/vault_file_titled.sh home/wm/scripts/vault_file_titled.sh
modules/personal/home/wm/scripts/wifi.sh home/wm/scripts/wifi.sh
modules/personal/home/wm/scripts/window_switcher.sh home/wm/scripts/window_switcher.sh
modules/personal/home/wm/scripts/window_switcher_scratch.sh home/wm/scripts/window_switcher_scratch.sh
modules/personal/home/wm/scripts/ws_mv.sh home/wm/scripts/ws_mv.sh
modules/personal/home/wm/scripts/ws_switch.sh home/wm/scripts/ws_switch.sh
modules/personal/home/wm/scripts/ws_switch_mv.sh home/wm/scripts/ws_switch_mv.sh
modules/personal/home/wm/sway/bindings home/wm/sway/bindings
modules/personal/home/wm/sway/config home/wm/sway/config
modules/personal/home/wm/sway/exec home/wm/sway/exec
modules/personal/home/wm/sway/input home/wm/sway/input
modules/personal/home/wm/sway/output home/wm/sway/output
modules/personal/home/wofi.css home/wofi.css
+2 -2
modules/personal/laptop.nix modules/laptop.nix
···
{ pkgs, config, lib, ... }:
-
let cfg = config.personal;
+
let cfg = config.custom;
in {
-
options.personal.laptop = lib.mkEnableOption "laptop";
+
options.custom.laptop = lib.mkEnableOption "laptop";
config = lib.mkIf cfg.laptop {
users.users.${config.custom.username}.extraGroups = [ "input" ];
+1 -1
modules/personal/nix-index.nix modules/nix-index.nix
···
{ pkgs, config, lib, ... }:
-
let cfg = config.personal;
+
let cfg = config.custom;
in {
config = lib.mkIf cfg.enable {
environment.systemPackages = [ pkgs.nix-index ];
-119
modules/personal/nvim/default.nix
···
-
{ pkgs, config, lib, ... }:
-
-
let cfg = config.personal;
-
in let
-
obsidian-nvim = (pkgs.vimUtils.buildVimPlugin {
-
pname = "obsidian.nvim";
-
version = "2.6.0";
-
src = pkgs.fetchFromGitHub {
-
owner = "epwalsh";
-
repo = "obsidian.nvim";
-
rev = "v2.6.0";
-
sha256 = "sha256-+w3XYoobuH17oinPfQxhrizbmQB5IbbulUK69674/Wg=";
-
};
-
});
-
ltex-ls-nvim = (pkgs.vimUtils.buildVimPlugin {
-
pname = "ltex-ls.nvim";
-
version = "2.6.0";
-
src = pkgs.fetchFromGitHub {
-
owner = "vigoux";
-
repo = "ltex-ls.nvim";
-
rev = "c8139ea6b7f3d71adcff121e16ee8726037ffebd";
-
sha256 = "sha256-jY3ALr6h88xnWN2QdKe3R0vvRcSNhFWDW56b2NvnTCs=";
-
};
-
});
-
in {
-
options.personal.nvim-lsps = lib.mkEnableOption "nvim-lsps";
-
-
config = lib.mkIf cfg.enable {
-
environment.systemPackages = with pkgs;
-
[ ripgrep nixd ] ++ lib.lists.optionals cfg.nvim-lsps [
-
nixfmt
-
# stop complaining when launching but a devshell is better
-
ocamlPackages.ocaml-lsp
-
ocamlPackages.ocamlformat
-
lua-language-server
-
pyright
-
black
-
ltex-ls
-
jdt-language-server
-
nodejs_18
-
clang-tools
-
typst-lsp
-
];
-
programs.neovim = {
-
enable = true;
-
viAlias = true;
-
vimAlias = true;
-
runtime = let
-
ml-style = ''
-
setlocal expandtab
-
setlocal shiftwidth=2
-
setlocal tabstop=2
-
setlocal softtabstop=2
-
'';
-
in {
-
# format-flowed
-
"ftplugin/mail.vim".text = ''
-
setlocal tw=72
-
set formatoptions+=w
-
'';
-
"ftplugin/nix.vim".text = ml-style;
-
"ftplugin/ocaml.vim".text = ml-style;
-
"after/ftplugin/markdown.vim".text = ''
-
set com-=fb:-
-
set com+=b:-\ [\ ],b:-\ [x],b:-
-
set formatoptions+=ro
-
'';
-
"ftplugin/java.lua".text = ''
-
local project_name = vim.fn.fnamemodify(vim.fn.getcwd(), ':p:h:t')
-
local workspace_dir = '~/.cache/jdt/' .. project_name
-
require('jdtls').start_or_attach {
-
on_attach = On_attach,
-
capabilities = Capabilities,
-
cmd = { 'jdt-language-server', '-data', workspace_dir, },
-
root_dir = vim.fs.dirname(vim.fs.find({'gradlew', '.git', 'mvnw'}, { upward = true })[1]),
-
}
-
'';
-
};
-
configure = {
-
customRC = "luafile ${./nvim.lua}";
-
packages.myVimPackage = with pkgs.vimPlugins; {
-
start = [
-
gruvbox-nvim
-
-
telescope-nvim
-
telescope-fzf-native-nvim
-
trouble-nvim
-
-
obsidian-nvim
-
plenary-nvim
-
pkgs.ripgrep
-
-
nvim-lspconfig
-
-
cmp-nvim-lsp
-
cmp-nvim-lsp-signature-help
-
cmp-path
-
cmp-buffer
-
cmp-cmdline
-
cmp-spell
-
luasnip
-
nvim-cmp
-
-
vimtex
-
nvim-surround
-
comment-nvim
-
-
ltex-ls-nvim
-
nvim-jdtls
-
# TODO nvim-dap
-
-
copilot-vim
-
];
-
opt = [ ];
-
};
-
};
-
};
-
};
-
}
modules/personal/nvim/nvim.lua home/nvim/nvim.lua
+2 -2
modules/personal/ocaml.nix modules/ocaml.nix
···
{ pkgs, config, lib, ... }:
-
let cfg = config.personal;
+
let cfg = config.custom;
in {
-
options.personal.ocaml = lib.mkEnableOption "ocaml";
+
options.custom.ocaml = lib.mkEnableOption "ocaml";
config = lib.mkIf cfg.ocaml {
environment.systemPackages = with pkgs; [
+2 -2
modules/personal/printing.nix modules/printing.nix
···
{ config, lib, ... }:
-
let cfg = config.personal;
+
let cfg = config.custom;
in {
-
options.personal.printing = lib.mkEnableOption "printing";
+
options.custom.printing = lib.mkEnableOption "printing";
config = lib.mkIf cfg.printing {
networking.firewall = {
+1 -1
modules/personal/scripts.nix modules/scripts.nix
···
{ config, lib, ... }:
-
let cfg = config.personal;
+
let cfg = config.custom;
in {
config = lib.mkIf cfg.enable {
environment.interactiveShellInit = "export PATH=$PATH:/etc/nixos/scripts";
-30
modules/personal/shell.nix
···
-
{ config, lib, ... }:
-
-
let cfg = config.personal;
-
in {
-
options.personal.machineColour = lib.mkOption {
-
type = lib.types.str;
-
default = "cyan";
-
};
-
-
config = lib.mkIf cfg.enable {
-
programs.zsh = {
-
enable = true;
-
histSize = 100000;
-
autosuggestions = {
-
enable = true;
-
highlightStyle = "fg=5";
-
};
-
syntaxHighlighting = { enable = true; };
-
autosuggestions.strategy = [ "match_prev_cmd" "completion" "history" ];
-
promptInit = ''
-
PROMPT='%(?..%F{red}%3?%f )%F{${config.personal.machineColour}}%n@%m%f:%~ %#'$'\n'
-
'';
-
setOptions = [ "HIST_IGNORE_DUPS" "HIST_FCNTL_LOCK" ];
-
interactiveShellInit = builtins.readFile ./zsh.cfg;
-
};
-
programs.bash.promptInit = ''
-
PS1='\[\e[36m\]\u@\h:\W\[\e[0m\] $ '
-
'';
-
};
-
}
+1 -1
modules/personal/ssh.nix modules/ssh.nix
···
{ pkgs, config, lib, ... }:
-
let cfg = config.personal;
+
let cfg = config.custom;
in {
config = lib.mkIf cfg.enable {
users.mutableUsers = false;
+2 -2
modules/personal/tailscale.nix modules/tailscale.nix
···
with lib;
-
let cfg = config.personal;
+
let cfg = config.custom;
in {
-
options.personal.tailscale = mkEnableOption "tailscale";
+
options.custom.tailscale = mkEnableOption "tailscale";
config = lib.mkIf cfg.tailscale {
# set up with `tailscale up --login-server https://headscale.freumh.org --hostname`
-30
modules/personal/wireguard-hosts.nix
···
-
{ config, lib, ... }:
-
-
let cfg = config.personal;
-
in {
-
config.wireguard.hosts = lib.mkIf cfg.enable {
-
"vps" = {
-
ip = "10.0.0.1";
-
publicKey = "2nS3QA2XVG4IgRmtTsOQbpjbqKgRhoZ4gL8PeQhJLGE=";
-
server = true;
-
endpoint = config.eilean.serverIpv4;
-
};
-
"dell-xps" = {
-
ip = "10.0.0.2";
-
publicKey = "K9Lq7lQeueo4/fjCRBHOWQjcTHd5vhCHljI6m/ZOcUM=";
-
};
-
"pixel-4a" = {
-
ip = "10.0.0.3";
-
publicKey = "KPstJ3Dd8YgZ2vsu0RIzjxdZhv1RlAVw2PGqyV1+eX4=";
-
};
-
"desktop" = {
-
ip = "10.0.0.4";
-
publicKey = "aP0A0Lc7ABFvITmi9DIZiRKen3kBspMa6nsfrMrep2Y=";
-
};
-
"rasp-pi" = {
-
ip = "10.0.0.5";
-
publicKey = "xG1dOV/C/rvPUbAMp6F+cEAC3t1DxNFJLPF457RTmQ4=";
-
persistentKeepalive = 25;
-
};
-
};
-
}
+1 -8
modules/personal/zsh.cfg home/zsh.cfg
···
-
HISTFILE=~/.histfile
-
HISTSIZE=100000
-
SAVEHIST=100000
-
-
setopt autocd nomatch notify interactive_comments inc_append_history histignorespace
+
setopt autocd nomatch notify interactive_comments inc_append_history
unsetopt beep extendedglob share_history
-
-
autoload -Uz compinit
-
compinit
# https://superuser.com/questions/476532/how-can-i-make-zshs-vi-mode-behave-more-like-bashs-vi-mode
vi-search-fix() {
+11
modules/workstation.nix
···
+
{ pkgs, config, lib, ... }@inputs:
+
+
let cfg = config.custom;
+
in {
+
options.custom.workstation = lib.mkEnableOption "custom";
+
+
config = lib.mkIf cfg.workstation {
+
services.localtimed.enable = true;
+
services.geoclue2.enable = true;
+
};
+
}
+4 -159
nix-on-droid/default.nix
···
home-manager = {
useGlobalPkgs = true;
config = { pkgs, lib, ... }: {
+
imports = [ ./home/default.nix ];
+
# Use the same overlays as the system packages
nixpkgs = { inherit (config.nixpkgs) overlays; };
···
};
programs.zsh = {
-
enable = true;
-
history.size = 100000;
-
enableAutosuggestions = true;
-
syntaxHighlighting.enable = true;
-
initExtraFirst = ''
-
export ZSH_AUTOSUGGEST_STRATEGY=(match_prev_cmd completion history)
-
export ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE="fg=5"
-
PROMPT='%(?..%F{red}%3?%f )%F{blue}%n@%m%f:%~ %#'$'\n'
-
'';
-
initExtra = builtins.readFile ../modules/personal/zsh.cfg + ''
+
initExtra = builtins.readFile ./zsh.cfg + ''
bindkey "^[[A" up-line-or-beginning-search
bindkey "^[[B" down-line-or-beginning-search
'';
};
-
programs.git = {
-
enable = true;
-
userEmail = "ryan@$freumh.org";
-
userName = "Ryan Gibb";
-
aliases = {
-
s = "status";
-
c = "commit";
-
cm = "commit --message";
-
ca = "commit --amend";
-
cu = "commit --message update";
-
ci = "commit --message initial";
-
br = "branch";
-
co = "checkout";
-
df = "diff";
-
l = "log";
-
lg = "log -p";
-
lol = "log --graph --decorate --pretty=oneline --abbrev-commit";
-
lola =
-
"log --graph --decorate --pretty=oneline --abbrev-commit --all";
-
ls = "ls-files";
-
a = "add";
-
aa = "add --all";
-
au = "add -u";
-
ap = "add --patch";
-
ps = "push";
-
pf = "push --force";
-
pu = "push --set-upstream";
-
pl = "pull";
-
pr = "pull --rebase";
-
acp = "!git add --all && git commit --message update && git push";
-
};
-
};
-
-
programs.neovim = {
-
enable = true;
-
viAlias = true;
-
vimAlias = true;
-
extraPackages = with pkgs; [
-
ripgrep
-
nixd
-
alejandra
-
# stop complaining when launching but a devshell is better
-
#ocamlPackages.ocaml-lsp
-
#ocamlPackages.ocamlformat
-
marksman
-
lua-language-server
-
#pyright
-
#black
-
ltex-ls
-
];
-
extraLuaConfig = builtins.readFile ../modules/personal/nvim/nvim.lua;
-
# undo transparent background
-
# + "colorscheme gruvbox";
-
plugins = let
-
obsidian-nvim = (pkgs.vimUtils.buildVimPlugin {
-
pname = "obsidian.nvim";
-
version = "2.6.0";
-
src = pkgs.fetchFromGitHub {
-
owner = "epwalsh";
-
repo = "obsidian.nvim";
-
rev = "v2.6.0";
-
sha256 = "sha256-+w3XYoobuH17oinPfQxhrizbmQB5IbbulUK69674/Wg=";
-
};
-
});
-
ltex-ls-nvim = (pkgs.vimUtils.buildVimPlugin {
-
pname = "ltex-ls.nvim";
-
version = "2.6.0";
-
src = pkgs.fetchFromGitHub {
-
owner = "vigoux";
-
repo = "ltex-ls.nvim";
-
rev = "c8139ea6b7f3d71adcff121e16ee8726037ffebd";
-
sha256 = "sha256-jY3ALr6h88xnWN2QdKe3R0vvRcSNhFWDW56b2NvnTCs=";
-
};
-
});
-
in with pkgs.vimPlugins; [
-
gruvbox-nvim
-
-
telescope-nvim
-
telescope-fzf-native-nvim
-
trouble-nvim
-
-
obsidian-nvim
-
plenary-nvim
-
pkgs.ripgrep
-
-
{
-
plugin = nvim-lspconfig;
-
runtime = let
-
ml-style = ''
-
setlocal expandtab
-
setlocal shiftwidth=2
-
setlocal tabstop=2
-
setlocal softtabstop=2
-
'';
-
in {
-
"ftplugin/mail.vim".text = ''
-
let b:did_ftplugin = 1
-
'';
-
"ftplugin/nix.vim".text = ml-style;
-
"ftplugin/ocaml.vim".text = ml-style;
-
"after/ftplugin/markdown.vim".text = ''
-
set com-=fb:-
-
set com+=b:-
-
set formatoptions+=ro
-
'';
-
};
-
}
-
-
cmp-nvim-lsp
-
cmp-nvim-lsp-signature-help
-
cmp-path
-
cmp-buffer
-
cmp-cmdline
-
cmp-spell
-
luasnip
-
nvim-cmp
-
-
vimtex
-
nvim-surround
-
comment-nvim
-
-
ltex-ls-nvim
-
nvim-jdtls
-
# TODO nvim-dap
-
-
copilot-vim
-
];
-
};
-
-
programs.tmux = {
-
enable = true;
-
extraConfig = ''
-
set-window-option -g mode-keys vi
-
set-option -g mouse on
-
set-option -g set-titles on
-
set-option -g set-titles-string "#T"
-
bind-key t capture-pane -S -\; new-window '(tmux show-buffer; tmux delete-buffer) | nvim -c $'
-
bind-key u capture-pane\; new-window '(tmux show-buffer; tmux delete-buffer) | ${pkgs.urlview}/bin/urlview'
-
# Fixes C-Up/Down in TUIs
-
set-option default-terminal tmux
-
# https://stackoverflow.com/questions/62182401/neovim-screen-lagging-when-switching-mode-from-insert-to-normal
-
set -s escape-time 0
-
set -g lock-command vlock
-
set -g lock-after-time 0 # Seconds; 0 = never
-
bind L lock-session
-
'';
-
};
-
home.file = {
-
".ssh/authorized_keys".source = ../modules/personal/authorized_keys;
+
".ssh/authorized_keys".source = ../modules/authorized_keys;
};
programs.ssh = {