Refactor and clean up based on manual testing

main
mat ess 2023-11-03 00:12:17 -04:00
parent 2abcd54653
commit 6e6f41f061
37 changed files with 831 additions and 686 deletions

View File

@ -1,6 +1,6 @@
{ self, config, ... }: {
flake.darwinModules = {
me = let inherit (config.people) me;
home = let inherit (config.users) me;
in {
home-manager.users.${me} = { imports = [ self.homeModules.darwin ]; };
users.users.${me} = {
@ -10,8 +10,8 @@
};
default.imports = [
self.darwinModules.home-manager
self.darwinModules.me
self.darwinModules_.home-manager
self.darwinModules.home
self.nixosModules.common
./fish.nix
./fonts.nix

View File

@ -1,16 +1,18 @@
{ config, pkgs, lib, ... }: {
environment.variables.SHELL = lib.getExe pkgs.fish;
environment.shells = [ pkgs.fish ];
programs.fish.enable = true;
programs.fish.useBabelfish = true;
programs.fish.babelfishPackage = pkgs.babelfish;
# needed to address bug where $PATH is not properly set for fish:
# https://github.com/LnL7/nix-darwin/issues/122
programs.fish.shellInit = ''
for p in (string split : ${config.environment.systemPath})
if not contains $p $fish_user_paths
set -Ua fish_user_paths $p
programs.fish = {
enable = true;
useBabelfish = true;
babelfishPackage = pkgs.babelfish;
# needed to address bug where $PATH is not properly set for fish:
# https://github.com/LnL7/nix-darwin/issues/122
shellInit = ''
for p in (string split : ${config.environment.systemPath})
if not contains $p $fish_user_paths
set -Ua fish_user_paths $p
end
end
end
'';
'';
};
}

View File

@ -1,10 +1,8 @@
{ pkgs, ... }: {
fonts.fontDir.enable = true;
# TODO: go back to `with pkgs`?
fonts.fonts = builtins.attrValues {
inherit (pkgs)
# TODO: patch recursive with nerd-font
borg-sans-mono recursive
borg-sans-mono recursive recursive-patched
# code^
ia-writer-family ibm-plex

View File

@ -1,99 +1,84 @@
{ flake, config, lib, ... }:
let caskPresent = cask: builtins.elem cask config.homebrew.casks;
in {
{ flake, config, ... }: {
# https://docs.brew.sh/Shell-Completion#configuring-completions-in-fish
# for some reason if the Fish completions are added at the end of `fish_complete_path` they don't
# seem to work, but they do work if added at the start.
programs.fish.interactiveShellInit = ''
if test -d (brew --prefix)"/share/fish/completions"
set -p fish_complete_path (brew --prefix)/share/fish/completions
end
if test -d (brew --prefix)"/share/fish/vendor_completions.d"
set -p fish_complete_path (brew --prefix)/share/fish/vendor_completions.d
end
'';
homebrew.enable = flake.inputs.homebrew-enabled.value;
homebrew.onActivation.autoUpdate = true;
homebrew.onActivation.upgrade = true;
homebrew.onActivation.cleanup = "uninstall";
homebrew.global.brewfile = true;
homebrew.taps = [ "homebrew/cask-versions" "homebrew/services" ];
homebrew.masApps = {
Bitwarden = 1352778147;
"Draw Things" = 6444050820;
GrandPerspective = 1111570163;
Reeder = 1529448980;
Tailscale = 1475387142;
Xcode = 497799835;
programs.fish = {
shellInit = ''
eval "$(${config.homebrew.brewPrefix}/brew shellenv fish)"
'';
interactiveShellInit = ''
if test -d (brew --prefix)"/share/fish/completions"
set -p fish_complete_path (brew --prefix)/share/fish/completions
end
if test -d (brew --prefix)"/share/fish/vendor_completions.d"
set -p fish_complete_path (brew --prefix)/share/fish/vendor_completions.d
end
'';
};
homebrew.caskArgs.no_quarantine = true;
homebrew.casks = [
# system tools
"alfred"
# "bartender" -> dozer
"dozer"
"itsycal"
"knockknock"
"lulu"
"protonvpn"
# "rectangle" -> yabai
"secretive"
"shortcat"
"stay"
"utm"
"yabai"
homebrew = {
enable = flake.inputs.homebrew-enabled.value;
onActivation.autoUpdate = true;
onActivation.upgrade = true;
onActivation.cleanup = "uninstall";
global.brewfile = true;
# "tools for thought"
"anytype"
taps = [ "homebrew/cask-versions" "homebrew/services" ];
# design
"krita"
"macsvg"
masApps = {
Bitwarden = 1352778147;
"Draw Things" = 6444050820;
GrandPerspective = 1111570163;
Reeder = 1529448980;
Tailscale = 1475387142;
Xcode = 497799835;
};
# browsers
"arc"
"firefox"
"orion"
caskArgs.no_quarantine = true;
casks = [
# system tools
"alfred"
# "bartender" -> dozer
"dozer"
"knockknock"
"lulu"
"protonvpn"
"rectangle"
"secretive"
"shortcat"
"stay"
"utm"
# messaging apps
"signal"
# "tools for thought"
"anytype"
"obsidian"
# editors and IDEs
"lapce"
"zed"
# design
"krita"
"macsvg"
# terminal emulators
"warp"
# browsers
"arc"
"firefox"
"orion"
# peripheral tools
"logi-options-plus"
"qflipper"
"remarkable"
"via"
];
# messaging apps
"messenger"
"signal"
# TODO: figure out `brew shellenv` settings
# environment.variables = {
# HOMEBREW_PREFIX = "";
# HOMEBREW_CELLAR = "";
# HOMEBREW_REPOSITORY = "";
# };
# environment.systemPath = [ ];
# editors and IDEs
"lapce"
"zed"
# configure ssh to use secretive's agent
# TODO: move to module?
home-manager.users.${flake.config.people.me} =
lib.mkIf (caskPresent "secretive" && config ? home-manager) (let
socket =
"${config.home.homeDirectory}/Library/Containers/com.maxgoedjen.Secretive.SecretAgent/Data/socket.ssh";
in {
home.sessionVariables.SSH_AUTH_SOCK = socket;
programs.ssh.matchBlocks = {
"*".extraOptions = { IdentityAgent = socket; };
};
});
# terminal emulators
"kitty"
"warp"
# peripheral tools
"logi-options-plus"
"qflipper"
"remarkable"
"via"
];
};
}

View File

@ -1,50 +1,47 @@
{
system.defaults.NSGlobalDomain = {
AppleInterfaceStyleSwitchesAutomatically = true;
NSAutomaticCapitalizationEnabled = false;
_HIHideMenuBar = false;
};
system.defaults = {
NSGlobalDomain = {
AppleInterfaceStyleSwitchesAutomatically = true;
NSAutomaticCapitalizationEnabled = false;
_HIHideMenuBar = false;
};
# Firewall
system.defaults.alf = {
globalstate = 1;
allowsignedenabled = 1;
allowdownloadsignedenabled = 1;
stealthenabled = 1;
};
# firewall
alf = {
globalstate = 1;
allowsignedenabled = 1;
allowdownloadsignedenabled = 1;
stealthenabled = 1;
};
# Dock and Mission Control
system.defaults.dock = {
autohide = true;
expose-group-by-app = false;
mru-spaces = false;
tilesize = 80;
# Disable all hot corners
wvous-bl-corner = 1;
wvous-br-corner = 1;
wvous-tl-corner = 1;
wvous-tr-corner = 1;
};
dock = {
autohide = true;
expose-group-by-app = false;
mru-spaces = false;
tilesize = 80;
# disable all hot corners
wvous-bl-corner = 1;
wvous-br-corner = 1;
wvous-tl-corner = 1;
wvous-tr-corner = 1;
};
# Finder
system.defaults.finder = {
AppleShowAllExtensions = true;
FXEnableExtensionChangeWarning = true;
};
finder = {
AppleShowAllExtensions = true;
FXEnableExtensionChangeWarning = true;
};
# Login and lock screen
system.defaults.loginwindow = {
GuestEnabled = false;
DisableConsoleAccess = true;
};
loginwindow = {
GuestEnabled = false;
DisableConsoleAccess = true;
};
# Spaces
system.defaults.spaces.spans-displays = false;
spaces.spans-displays = false;
# Trackpad
system.defaults.trackpad = {
Clicking = true;
TrackpadRightClick = true;
TrackpadThreeFingerDrag = true;
trackpad = {
Clicking = true;
TrackpadRightClick = true;
TrackpadThreeFingerDrag = true;
};
};
}

View File

@ -53,11 +53,11 @@
]
},
"locked": {
"lastModified": 1697995812,
"narHash": "sha256-UDlK6p/6vAiVOQ92PR0ySDZBS3yiryrlJpSOw3b9Ito=",
"lastModified": 1698422527,
"narHash": "sha256-SDu3Xg263t3oXIyTaH0buOvFnKIDeZsvKDBtOz+jRbs=",
"owner": "nix-community",
"repo": "disko",
"rev": "4122a18340094151d7911e838237ec7627f0d0c5",
"rev": "944d338d24a9d043a3f7461c30ee6cfe4f9cca30",
"type": "github"
},
"original": {
@ -66,35 +66,99 @@
"type": "github"
}
},
"fileicon-src": {
"fish-plugin-autopair": {
"flake": false,
"locked": {
"lastModified": 1690207317,
"narHash": "sha256-lkDivFJoeebFeA55kHHN9av5N7nz5zUiW+uAw74IM5U=",
"owner": "mklement0",
"repo": "fileicon",
"rev": "9c41a44fac462f66a1194e223aa26e4c3b9b5ae3",
"lastModified": 1656950411,
"narHash": "sha256-qt3t1iKRRNuiLWiVoiAYOu+9E7jsyECyIqZJ/oRIT1A=",
"owner": "jorgebucaran",
"repo": "autopair.fish",
"rev": "4d1752ff5b39819ab58d7337c69220342e9de0e2",
"type": "github"
},
"original": {
"owner": "mklement0",
"repo": "fileicon",
"owner": "jorgebucaran",
"repo": "autopair.fish",
"type": "github"
}
},
"fisher-src": {
"fish-plugin-colored-man-pages": {
"flake": false,
"locked": {
"lastModified": 1692640630,
"narHash": "sha256-e8gIaVbuUzTwKtuMPNXBT5STeddYqQegduWBtURLT3M=",
"lastModified": 1651274650,
"narHash": "sha256-ii9gdBPlC1/P1N9xJzqomrkyDqIdTg+iCg0mwNVq2EU=",
"owner": "PatrickF1",
"repo": "colored_man_pages.fish",
"rev": "f885c2507128b70d6c41b043070a8f399988bc7a",
"type": "github"
},
"original": {
"owner": "PatrickF1",
"repo": "colored_man_pages.fish",
"type": "github"
}
},
"fish-plugin-done": {
"flake": false,
"locked": {
"lastModified": 1698312794,
"narHash": "sha256-7aeSE88tvLx64EWvHqLSikRjOjTrZRXj2fdK5vygsqA=",
"owner": "franciscolourenco",
"repo": "done",
"rev": "054347d2a4aa5e0e7920c850f5999651dc90219c",
"type": "github"
},
"original": {
"owner": "franciscolourenco",
"repo": "done",
"type": "github"
}
},
"fish-plugin-fish-abbr-tips": {
"flake": false,
"locked": {
"lastModified": 1674487577,
"narHash": "sha256-F1t81VliD+v6WEWqj1c1ehFBXzqLyumx5vV46s/FZRU=",
"owner": "Gazorby",
"repo": "fish-abbreviation-tips",
"rev": "8ed76a62bb044ba4ad8e3e6832640178880df485",
"type": "github"
},
"original": {
"owner": "Gazorby",
"repo": "fish-abbreviation-tips",
"type": "github"
}
},
"fish-plugin-fish-bang-bang": {
"flake": false,
"locked": {
"lastModified": 1690139185,
"narHash": "sha256-oPPCtFN2DPuM//c48SXb4TrFRjJtccg0YPXcAo0Lxq0=",
"owner": "oh-my-fish",
"repo": "plugin-bang-bang",
"rev": "ec991b80ba7d4dda7a962167b036efc5c2d79419",
"type": "github"
},
"original": {
"owner": "oh-my-fish",
"repo": "plugin-bang-bang",
"type": "github"
}
},
"fish-plugin-replay": {
"flake": false,
"locked": {
"lastModified": 1655689996,
"narHash": "sha256-bM6+oAd/HXaVgpJMut8bwqO54Le33hwO9qet9paK1kY=",
"owner": "jorgebucaran",
"repo": "fisher",
"rev": "2efd33ccd0777ece3f58895a093f32932bd377b6",
"repo": "replay.fish",
"rev": "bd8e5b89ec78313538e747f0292fcaf631e87bd2",
"type": "github"
},
"original": {
"owner": "jorgebucaran",
"repo": "fisher",
"repo": "replay.fish",
"type": "github"
}
},
@ -135,11 +199,11 @@
"nixpkgs-lib": "nixpkgs-lib"
},
"locked": {
"lastModified": 1696343447,
"narHash": "sha256-B2xAZKLkkeRFG5XcHHSXXcP7To9Xzr59KXeZiRf4vdQ=",
"lastModified": 1698882062,
"narHash": "sha256-HkhafUayIqxXyHH1X8d9RDl1M2CkFgZLjKD3MzabiEo=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "c9afaba3dfa4085dbd2ccb38dfade5141e33d9d4",
"rev": "8c9fa2545007b49a5db5f650ae91f227672c3877",
"type": "github"
},
"original": {
@ -207,11 +271,11 @@
"systems": "systems_3"
},
"locked": {
"lastModified": 1694529238,
"narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=",
"lastModified": 1685518550,
"narHash": "sha256-o2d0KcvaXzTrPRIo0kOLV0/QXHhDQ5DTi+OxcjO8xqY=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "ff7b65b44d01cf9ba6a71320833626af21126384",
"rev": "a1720a10a6cfe8234c0e93907ffe81be440f4cef",
"type": "github"
},
"original": {
@ -220,6 +284,21 @@
"type": "github"
}
},
"ghostty": {
"locked": {
"lastModified": 1695482156,
"narHash": "sha256-PFyViLT7eCi/jN6fZ9kFUZF4mYye9Mplm/SEwhUvCDM=",
"owner": "clo4",
"repo": "ghostty-hm-module",
"rev": "3ccb4b02eb84316e7ccbf007a6e29495f7e6bee4",
"type": "github"
},
"original": {
"owner": "clo4",
"repo": "ghostty-hm-module",
"type": "github"
}
},
"gitignore": {
"inputs": {
"nixpkgs": [
@ -251,11 +330,11 @@
"rust-overlay": "rust-overlay"
},
"locked": {
"lastModified": 1697618705,
"narHash": "sha256-BpAFX7mwV4/vpTlMLZtPICKeDPGLx1Q8s3zVZ8IEAkY=",
"lastModified": 1698790188,
"narHash": "sha256-sAp4RIto3fDjb/HJ4NR3HlHo3J8R7tK4/qSGYkhudUA=",
"owner": "helix-editor",
"repo": "helix",
"rev": "e6d2835b0907102831a8979688a8464c064ff842",
"rev": "a069b928973aad99b85dffb9d5ade7dae4b58c43",
"type": "github"
},
"original": {
@ -271,11 +350,11 @@
]
},
"locked": {
"lastModified": 1697688028,
"narHash": "sha256-d9CAOd9W2iTrgB31a8Dvyp6Vgn/gxASCNrD4Z9yzUOY=",
"lastModified": 1698873617,
"narHash": "sha256-FfGFcfbULwbK1vD+H0rslIOfmy4g8f2hXiPkQG3ZCTk=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "c5c1ea85181d2bb44e46e8a944a8a3f56ad88f19",
"rev": "48b0a30202516e25d9885525fbb200a045f23f26",
"type": "github"
},
"original": {
@ -315,38 +394,6 @@
"type": "github"
}
},
"kitty-icon": {
"flake": false,
"locked": {
"lastModified": 1659349637,
"narHash": "sha256-Vy+iLGnysrJMSLfkaYq15pb/wG4kIbfsXRrPgSc3OFs=",
"owner": "DinkDonk",
"repo": "kitty-icon",
"rev": "269c0f0bd1c792cebc7821f299ce9250ed9bcd67",
"type": "github"
},
"original": {
"owner": "DinkDonk",
"repo": "kitty-icon",
"type": "github"
}
},
"kitty-themes": {
"flake": false,
"locked": {
"lastModified": 1696892900,
"narHash": "sha256-W0K9fA+oTsdIgBwFlBZb2QqSvVSLh4/e5Xp/4rvDeXU=",
"owner": "kovidgoyal",
"repo": "kitty-themes",
"rev": "2b4f8aa76ff07fde3648c666ed244c914bf0e155",
"type": "github"
},
"original": {
"owner": "kovidgoyal",
"repo": "kitty-themes",
"type": "github"
}
},
"nil": {
"inputs": {
"flake-utils": "flake-utils_2",
@ -376,11 +423,11 @@
]
},
"locked": {
"lastModified": 1697723594,
"narHash": "sha256-W7lTC+kHGS1YCOutGpxUHF0cK66iY/GYr3INaTyVa/I=",
"lastModified": 1698429334,
"narHash": "sha256-Gq3+QabboczSu7RMpcy79RSLMSqnySO3wsnHQk4DfbE=",
"owner": "lnl7",
"repo": "nix-darwin",
"rev": "19f75c2b45fbfc307ecfeb9dadc41a4c1e4fb980",
"rev": "afe83cbc2e673b1f08d32dd0f70df599678ff1e7",
"type": "github"
},
"original": {
@ -413,26 +460,26 @@
},
"nixos-flake": {
"locked": {
"lastModified": 1691408332,
"narHash": "sha256-0IveIyIFaORG+SzMzXfl9A4IopQ4KDmThDeH34ryL0c=",
"owner": "squirmy",
"lastModified": 1698598244,
"narHash": "sha256-YbvPFt+9CbCiqnuS0dTx+P+W1YRCqzhLXen94sef3Kk=",
"owner": "srid",
"repo": "nixos-flake",
"rev": "531043e2c7825406fb271fb831abe656d0997706",
"rev": "f6b7757ad88483afca306c9f3bf387887fba7284",
"type": "github"
},
"original": {
"owner": "squirmy",
"owner": "srid",
"repo": "nixos-flake",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1697730408,
"narHash": "sha256-Ww//zzukdTrwTrCUkaJA/NsaLEfUfQpWZXBdXBYfhak=",
"lastModified": 1698890957,
"narHash": "sha256-DJ+SppjpPBoJr0Aro9TAcP3sxApCSieY6BYBCoWGUX8=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "ff0a5a776b56e0ca32d47a4a47695452ec7f7d80",
"rev": "c082856b850ec60cda9f0a0db2bc7bd8900d708c",
"type": "github"
},
"original": {
@ -445,11 +492,11 @@
"nixpkgs-lib": {
"locked": {
"dir": "lib",
"lastModified": 1696019113,
"narHash": "sha256-X3+DKYWJm93DRSdC5M6K5hLqzSya9BjibtBsuARoPco=",
"lastModified": 1698611440,
"narHash": "sha256-jPjHjrerhYDy3q9+s5EAsuhyhuknNfowY6yt6pjn9pc=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "f5892ddac112a1e9b3612c39af1b72987ee5783a",
"rev": "0cbe9f69c234a7700596e943bfae7ef27a31b735",
"type": "github"
},
"original": {
@ -480,11 +527,11 @@
},
"nixpkgs-stable": {
"locked": {
"lastModified": 1697851979,
"narHash": "sha256-lJ8k4qkkwdvi+t/Xc6Fn74kUuobpu9ynPGxNZR6OwoA=",
"lastModified": 1685801374,
"narHash": "sha256-otaSUoFEMM+LjBI1XL/xGB5ao6IwnZOXc47qhIgJe8U=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "5550a85a087c04ddcace7f892b0bdc9d8bb080c8",
"rev": "c37ca420157f4abc31e26f436c1145f8951ff373",
"type": "github"
},
"original": {
@ -505,11 +552,11 @@
"nixpkgs-stable": "nixpkgs-stable"
},
"locked": {
"lastModified": 1697746376,
"narHash": "sha256-gu77VkgdfaHgNCVufeb6WP9oqFLjwK4jHcoPZmBVF3E=",
"lastModified": 1698852633,
"narHash": "sha256-Hsc/cCHud8ZXLvmm8pxrXpuaPEeNaaUttaCvtdX/Wug=",
"owner": "cachix",
"repo": "pre-commit-hooks.nix",
"rev": "8cc349bfd082da8782b989cad2158c9ad5bd70fd",
"rev": "dec10399e5b56aa95fcd530e0338be72ad6462a0",
"type": "github"
},
"original": {
@ -522,22 +569,26 @@
"inputs": {
"dark-mode-notify-src": "dark-mode-notify-src",
"disko": "disko",
"fileicon-src": "fileicon-src",
"fisher-src": "fisher-src",
"fish-plugin-autopair": "fish-plugin-autopair",
"fish-plugin-colored-man-pages": "fish-plugin-colored-man-pages",
"fish-plugin-done": "fish-plugin-done",
"fish-plugin-fish-abbr-tips": "fish-plugin-fish-abbr-tips",
"fish-plugin-fish-bang-bang": "fish-plugin-fish-bang-bang",
"fish-plugin-replay": "fish-plugin-replay",
"flake-parts": "flake-parts",
"ghostty": "ghostty",
"helix": "helix",
"home-manager": "home-manager",
"homebrew-enabled": "homebrew-enabled",
"ia-writer-family-src": "ia-writer-family-src",
"kitty-icon": "kitty-icon",
"kitty-themes": "kitty-themes",
"nil": "nil",
"nix-darwin": "nix-darwin",
"nixd": "nixd",
"nixos-flake": "nixos-flake",
"nixpkgs": "nixpkgs",
"pre-commit": "pre-commit",
"starship-src": "starship-src"
"starship-src": "starship-src",
"terminal-themes": "terminal-themes"
}
},
"rust-overlay": {
@ -593,11 +644,11 @@
"starship-src": {
"flake": false,
"locked": {
"lastModified": 1697690660,
"narHash": "sha256-c2BpZYIJ26xc6rq+rpSKtfyk1/L32PYnH31luK+7kAg=",
"lastModified": 1698919886,
"narHash": "sha256-rV1Sf5MbmHVn8sUEn07STsSdXoPZClTqGp3Tmkvp1+0=",
"owner": "starship",
"repo": "starship",
"rev": "099539fd1aa2937e9507a318becffcbc685b83b8",
"rev": "6abc83decdf176842985b4daa5b09771c6b93415",
"type": "github"
},
"original": {
@ -650,6 +701,22 @@
"repo": "default",
"type": "github"
}
},
"terminal-themes": {
"flake": false,
"locked": {
"lastModified": 1697035060,
"narHash": "sha256-Qctds28CIMeyIc6VbWj1jEAlx/HZyBEZJj7u3aZeBog=",
"owner": "mbadolato",
"repo": "iTerm2-Color-Schemes",
"rev": "aed2a8f0565a51913e8ddc1731f25bc71978a1e0",
"type": "github"
},
"original": {
"owner": "mbadolato",
"repo": "iTerm2-Color-Schemes",
"type": "github"
}
}
},
"root": "root",

View File

@ -9,12 +9,12 @@
nix-darwin.inputs.nixpkgs.follows = "nixpkgs";
home-manager.url = "github:nix-community/home-manager";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
nixos-flake.url = "github:squirmy/nixos-flake";
# nixos-flake.url = "github:srid/nixos-flake";
nixos-flake.url = "github:srid/nixos-flake";
pre-commit.url = "github:cachix/pre-commit-hooks.nix";
pre-commit.inputs.nixpkgs.follows = "nixpkgs";
disko.url = "github:nix-community/disko";
disko.inputs.nixpkgs.follows = "nixpkgs";
ghostty.url = "github:clo4/ghostty-hm-module";
# "flag" for toggling homebrew operations
# https://www.mat.services/posts/command-line-flake-arguments/
@ -34,29 +34,32 @@
dark-mode-notify-src.url = "github:bouk/dark-mode-notify";
dark-mode-notify-src.flake = false;
# modify custom macOS file icons
fileicon-src.url = "github:mklement0/fileicon";
fileicon-src.flake = false;
# iA writer fonts
ia-writer-family-src.url = "github:iaolo/iA-Fonts";
ia-writer-family-src.flake = false;
# alternate kitty terminal icon
kitty-icon.url = "github:DinkDonk/kitty-icon";
kitty-icon.flake = false;
# standard kitty terminal themes
kitty-themes.url = "github:kovidgoyal/kitty-themes";
kitty-themes.flake = false;
# fish shell package manager
fisher-src.url = "github:jorgebucaran/fisher";
fisher-src.flake = false;
terminal-themes.url = "github:mbadolato/iTerm2-Color-Schemes";
terminal-themes.flake = false;
# shell prompt
starship-src.url = "github:starship/starship";
starship-src.flake = false;
# extra fish shell plugins
fish-plugin-done.url = "github:franciscolourenco/done";
fish-plugin-done.flake = false;
fish-plugin-fish-abbr-tips.url = "github:Gazorby/fish-abbreviation-tips";
fish-plugin-fish-abbr-tips.flake = false;
fish-plugin-autopair.url = "github:jorgebucaran/autopair.fish";
fish-plugin-autopair.flake = false;
fish-plugin-replay.url = "github:jorgebucaran/replay.fish";
fish-plugin-replay.flake = false;
fish-plugin-fish-bang-bang.url = "github:oh-my-fish/plugin-bang-bang";
fish-plugin-fish-bang-bang.flake = false;
fish-plugin-colored-man-pages.url =
"github:PatrickF1/colored_man_pages.fish";
fish-plugin-colored-man-pages.flake = false;
};
outputs = { self, flake-parts, ... }@inputs:
@ -68,16 +71,17 @@
./darwin
./home
./nixos
./people
./templates
./users
];
flake = {
nixosConfigurations = {
pihole = self.nixos-flake.lib.mkLinuxSystem {
nixpkgs.hostPlatform = "aarch64-linux";
imports = [ self.nixosModules.default ./systems/nixos/pihole.nix ];
};
# pihole = self.nixos-flake.lib.mkLinuxSystem {
# nixpkgs.hostPlatform = "aarch64-linux";
# imports = [ self.nixosModules.default ./systems/nixos/pihole.nix ];
# };
};
darwinConfigurations = {
matbook = self.nixos-flake.lib.mkMacosSystem {
nixpkgs.hostPlatform = "aarch64-darwin";
@ -90,7 +94,7 @@
yelpbook-m1 = self.nixos-flake.lib.mkMacosSystem {
nixpkgs.hostPlatform = "aarch64-darwin";
people.me = "mess";
users.me = "mess";
imports = [
self.darwinModules.default
./systems/darwin/m1.nix

View File

@ -4,16 +4,18 @@
home.enableNixpkgsReleaseCheck = true;
home.stateVersion = "22.05";
imports = [
./extras/helix/auto-theme.nix
./extras/kitty/auto-theme.nix
./extras/kitty/fix-icon.nix
./extras/kitty/nerd-font.nix
# misc file configuration
./files.nix
# misc program configuration
./programs.nix
# per-program configurations
./fish.nix
./ghostty.nix
./git.nix
./helix.nix
./kitty.nix
./programs.nix
./pijul.nix
./ssh.nix
# ./starship-symbols.nix
./starship.nix
];

View File

@ -1,26 +1,24 @@
{ config, pkgs, lib, ... }:
let
cfg = config.programs.helix;
tomlFormat = pkgs.formats.toml { };
inherit (lib) mkIf mkEnableOption mkOption types;
in {
options.programs.helix = {
autoTheme.enable =
mkEnableOption "Automatically switch helix theme with night mode";
lib.mkEnableOption "Automatically switch helix theme with night mode";
autoTheme.light = mkOption {
type = types.str;
autoTheme.light = lib.mkOption {
type = lib.types.str;
description = "Light mode theme";
};
autoTheme.dark = mkOption {
type = types.str;
autoTheme.dark = lib.mkOption {
type = lib.types.str;
description = "Dark mode theme";
};
};
config = mkIf (cfg.enable && cfg.autoTheme.enable) {
config = lib.mkIf (cfg.enable && cfg.autoTheme.enable) {
xdg.configFile = {
"helix/light.toml".source = tomlFormat.generate "helix-autotheme"
(cfg.settings // { theme = cfg.autoTheme.light; });

View File

@ -7,7 +7,7 @@ let
# If shell is running in a Kitty window set the colors.
if [ -n "$KITTY_WINDOW_ID" ]; then
kitty @ --to $KITTY_LISTEN_ON set-colors --all --configured \
${cfg.colors.color-pkg}/"$1".conf &
${cfg.colors.colors-path}/"$1".conf &
fi
'';
term-light = pkgs.writeShellScriptBin "term-light" ''
@ -16,12 +16,11 @@ let
term-dark = pkgs.writeShellScriptBin "term-dark" ''
${term-background}/bin/term-background ${cfg.colors.dark-name}
'';
inherit (lib) mkIf mkOption types;
in {
options.programs.kitty = {
colors = {
enable = mkOption {
type = types.bool;
enable = lib.mkOption {
type = lib.types.bool;
default = false;
description = ''
When enabled, commands <command>term-dark</command> and <command>term-light</command>
@ -35,20 +34,28 @@ in {
'';
};
color-pkg = mkOption {
type = types.package;
default = pkgs.kitty-colors;
description = "Package from which to load kitty colors.";
colors-path = lib.mkOption {
type = lib.types.path;
default = "${pkgs.terminal-colors}/kitty";
description = "Path from which to load kitty colors.";
};
light-name = mkOption {
type = types.str;
color-pkg-path = lib.mkOption {
type = lib.types.optional lib.types.path;
default = null;
description = ''
Path to kitty colors within <literal>color-pkgs</literal>.
'';
};
light-name = lib.mkOption {
type = lib.types.str;
default = "light";
description = "The name to use for the light colorscheme.";
};
dark-name = mkOption {
type = types.str;
dark-name = lib.mkOption {
type = lib.types.str;
default = "dark";
description = "The name to use for the dark colorscheme.";
};
@ -56,18 +63,15 @@ in {
};
config = mkIf cfg.enable {
home.packages =
mkIf cfg.colors.enable [ term-light term-dark term-background ];
config = lib.mkIf (cfg.enable && cfg.colors.enable) {
home.packages = [ term-light term-dark term-background ];
programs.kitty.settings = mkIf cfg.colors.enable {
programs.kitty.settings = {
allow_remote_control = "yes";
listen_on = "unix:/tmp/mykitty";
};
xdg.configFile."kitty/macos-launch-services-cmdline" =
mkIf (pkgs.stdenv.isDarwin && cfg.colors.enable) {
text = "--listen-on unix:/tmp/mykitty";
};
xdg.configFile."kitty/macos-launch-services-cmdline".text =
lib.mkIf pkgs.stdenv.isDarwin "--listen-on unix:/tmp/mykitty";
};
}

View File

@ -1,40 +0,0 @@
{ config, pkgs, lib, ... }:
let
cfg = config.programs.kitty;
inherit (lib) hm mkIf mkOption types;
in {
options.programs.kitty.fixIcon = {
enable = mkOption {
type = types.bool;
default = false;
description = ''
When enabled, uses fileicon to fixup the icon.
'';
};
appPath = mkOption {
type = types.str;
default = null;
description = "Path to kitty.app";
};
iconPath = mkOption {
type = types.str;
default = null;
description = "Path to kitty icns";
};
};
config = mkIf cfg.enable {
home.activation = mkIf (pkgs.stdenv.isDarwin && cfg.fixIcon.enable) {
cleanupKittyIcon =
hm.dag.entryBetween [ "darwinApps" ] [ "writeBoundary" ] ''
if ${pkgs.fileicon} test ${cfg.fixIcon.appPath};
then
$DRY_RUN_CMD sudo ${pkgs.fileicon} rm ${cfg.fixIcon.appPath}
fi
'';
fixKittyIcon = hm.dag.entryAfter [ "darwinApps" ] ''
$DRY_RUN_CMD sudo ${pkgs.fileicon} set ${cfg.fixIcon.appPath} ${cfg.fixIcon.iconPath}
'';
};
};
}

View File

@ -1,11 +1,9 @@
{ config, lib, ... }:
let
cfg = config.programs.kitty;
inherit (lib) mkIf mkOption types;
let cfg = config.programs.kitty;
in {
options.programs.kitty = {
useSymbolsFromNerdFont = mkOption {
type = types.str;
useSymbolsFromNerdFont = lib.mkOption {
type = lib.types.str;
default = "";
example = "JetBrainsMono Nerd Font";
description = ''
@ -18,8 +16,8 @@ in {
};
};
config = mkIf cfg.enable {
programs.kitty.settings = mkIf (cfg.useSymbolsFromNerdFont != "") {
config = lib.mkIf (cfg.enable && cfg.useSymbolsFromNerdFont != "") {
programs.kitty.settings = {
# https://github.com/ryanoasis/nerd-fonts/wiki/Glyph-Sets-and-Code-Points
symbol_map =
"U+E5FA-U+E62B,U+E700-U+E7C5,U+F000-U+F2E0,U+E200-U+E2A9,U+F500-U+FD46,U+E300-U+E3EB,U+F400-U+F4A8,U+2665,U+26a1,U+F27C,U+E0A3,U+E0B4-U+E0C8,U+E0CA,U+E0CC-U+E0D2,U+E0D4,U+23FB-U+23FE,U+2B58,U+F300-U+F313,U+E000-U+E00D ${cfg.useSymbolsFromNerdFont}";

View File

@ -1,21 +1 @@
{ flake, config, ... }: {
xdg = { enable = true; };
home.file = let inherit (flake.config.people) me users;
in {
".pijulconfig".text = ''
[author]
name = "${me}"
full_name = "${users.${me}.name}"
email = "${users.${me}.email}"
'';
".tarsnaprc".text = ''
cachedir ${config.xdg.cacheHome}
keyfile ${config.xdg.configHome}/tarsnap/read-write-delete.key
nodump
print-stats
checkpoint-bytes 1G
humanize-numbers
'';
};
}
{ xdg.enable = true; }

View File

@ -1,169 +1,179 @@
{ pkgs, lib, ... }: {
programs.fish.enable = true;
{ pkgs, lib, ... }:
let nixConfigDirectory = "~/dotfiles.nix";
in {
programs.fish = {
enable = true;
programs.fish.plugins = [ pkgs.fishPlugins.fisher ];
xdg.configFile."fish/fish_plugins".text = ''
fishpkg/fish-humanize-duration
franciscolourenco/done
Gazorby/fish-abbreviation-tips
jorgebucaran/autopair.fish
jorgebucaran/replay.fish
joseluisq/gitnow
matthewess/fish-autovenv
nbsmokee/fish-spin
oh-my-fish/plugin-bang-bang
PatrickF1/colored_man_pages.fish
'';
# see flake.nix and pkgs/default.nix
plugins = pkgs.fishPlugins.flakePlugins;
programs.fish.functions = {
# user functions
mkdcd = {
argumentNames = [ "target" ];
body = ''
if test -z "$target"
echo "mkdcd requires an argument" 1>&2
return 1
end
mkdir -p $target
cd $target
functions = {
# user functions
mkdcd = {
argumentNames = [ "target" ];
body = ''
if test -z "$target"
echo "mkdcd requires an argument" 1>&2
return 1
end
mkdir -p $target
cd $target
'';
};
from-dir = {
argumentNames = [ "dir" ];
body = ''
pushd $dir
set -e argv[1]
$argv
popd
'';
};
darwin-rebuild-edit-with = {
argumentNames = [ "editor" "file" ];
body = ''
if test -z "$file"
set file flake.nix
end
from-nix $editor $file
'';
};
# TODO: use these to implement !! and .. abbreviations
# blocked on additional support for abbr in home-manager
# https://github.com/nix-community/home-manager/issues/3706
#
# taken from
# https://fishshell.com/docs/current/relnotes.html#fish-3-6-0-released-january-7-2023
# last-history-item.body = ''
# echo $history[1]
# '';
# multi-cd.body = ''
# echo cd (string repeat -n (math (string length -- $argv[1]) - 1) ../)
# '';
} // lib.optionalAttrs pkgs.stdenv.isDarwin {
# light/dark mode helpers
# determine if dark mode is active
is-dark-mode.body = ''
defaults read -g AppleInterfaceStyle &>/dev/null
'';
};
from-dir = {
argumentNames = [ "dir" ];
body = ''
pushd $dir
set -e argv[1]
$argv
popd
'';
};
darwin-rebuild-edit-with = {
argumentNames = [ "editor" "file" ];
body = ''
if test -z "$file"
set file flake.nix
end
from-nix $editor $file
'';
};
} // lib.optionalAttrs pkgs.stdenv.isDarwin {
# light/dark mode helpers
# determine if dark mode is active
is-dark-mode.body = ''
defaults read -g AppleInterfaceStyle &>/dev/null
'';
# toggles `$term_background` between "light" and "dark". other Fish functions trigger when this
# variable changes. we use a universal variable so that all instances of Fish have the same
# value for the variable.
toggle-background.body = ''
if test "$term_background" = light
set -U term_background dark
else
set -U term_background light
end
'';
# set `$term_background` based on whether macOS is light or dark mode
set-background-to-macOS.body = ''
if is-dark-mode
set -U term_background dark
else
set -U term_background light
end
'';
# set `$term_background` based on an env var
set-background-to-env = {
argumentNames = [ "env_var" ];
body = ''
switch $$env_var
case 1
echo "Setting dark mode"
# toggles `$term_background` between "light" and "dark". other Fish functions trigger when this
# variable changes. we use a universal variable so that all instances of Fish have the same
# value for the variable.
toggle-background.body = ''
if test "$term_background" = light
set -U term_background dark
case 0
echo "Setting light mode"
else
set -U term_background light
end
'';
};
# sets shell utilities to light or dark colorscheme based on `$term_background`.
set-shell-colors = {
body = ''
# Use correct theme for `btm` and `bat`
if test "$term_background" = light
alias btm "btm --color nord-light"
set -xg BAT_THEME OneHalfLight
# set `$term_background` based on whether macOS is light or dark mode
set-background-to-macOS.body = ''
if is-dark-mode
set -U term_background dark
else
alias btm "btm --color nord"
set -xg BAT_THEME OneHalfDark
set -U term_background light
end
# Set LS_COLORS
set -xg LS_COLORS (${pkgs.vivid}/bin/vivid generate one-$term_background)
'';
onVariable = "term_background";
# set `$term_background` based on an env var
set-background-to-env = {
argumentNames = [ "env_var" ];
body = ''
switch $$env_var
case 1
echo "Setting dark mode"
set -U term_background dark
case 0
echo "Setting light mode"
set -U term_background light
end
'';
};
# sets shell utilities to light or dark colorscheme based on `$term_background`.
set-shell-colors = {
body = ''
# Use correct theme for `btm` and `bat`
if test "$term_background" = light
alias btm "btm --color nord-light"
set -xg BAT_THEME OneHalfLight
else
alias btm "btm --color nord"
set -xg BAT_THEME OneHalfDark
end
# Set LS_COLORS
set -xg LS_COLORS (${pkgs.vivid}/bin/vivid generate one-$term_background)
'';
onVariable = "term_background";
};
};
shellAbbrs = {
".." = "cd ..";
# darwin-rebuild build
drb = "from-nix darwin-rebuild build --flake .";
# darwin-rebuild switch full
drsf = "from-nix darwin-rebuild switch --flake .";
# darwin-rebuild switch (no homebrew)
drs =
"from-nix darwin-rebuild switch --flake . --override-input homebrew-enabled github:boolean-option/false";
# edit darwin-rebuild config in helix
drh = "darwin-rebuild-edit-with hx";
# edit darwin-rebuild config in zed
drz = "zed ${nixConfigDirectory}";
nb = "nix build";
nd = "nix develop";
nf = "nix flake";
nfc = "nix flake check";
nfi = "nix flake init";
nfs = "nix flake show";
nfu = "nix flake update";
nr = "nix run";
ns = "nix search nixpkgs";
nsh = "nix shell";
nrp = "nix repl --expr '{ pkgs = (import <nixpkgs> { }); }'";
g = "git";
stage = "git add .";
commit = "git commit";
push = "git push";
} // lib.optionalAttrs pkgs.stdenv.isDarwin {
tb = "toggle-background";
sb = "set-background-to-macOS";
};
shellAliases = {
# nix related
from-nix = "from-dir ${nixConfigDirectory}";
# other
":q" = "exit";
cat = "bat --style=plain --paging=never";
du = "dust";
http = "xh";
https = "xhs";
top = "btm";
htop = "btm --basic";
colortest = "terminal-colors -o";
};
# configuration that should be above `loginShellInit` and `interactiveShellInit`.
shellInit = ''
set -U fish_term24bit 1
${lib.optionalString pkgs.stdenv.isDarwin "set-background-to-macOS"}
'';
interactiveShellInit = ''
set -g fish_greeting (set_color red)"( ³)"(set_color yellow)" hello "(set_color blue)"( ³)"(set_color normal)
fish_vi_key_bindings
${lib.optionalString pkgs.stdenv.isDarwin "set-shell-colors"}
'';
};
# aliases
# TODO: refactor into abbreviations
programs.fish.shellAliases = let nixConfigDirectory = "~/dotfiles.nix";
in {
# Nix related
from-nix = "from-dir ${nixConfigDirectory}";
# darwin-rebuild build
drb = "from-nix darwin-rebuild build --flake .";
# darwin-rebuild switch full
drsf = "from-nix darwin-rebuild switch --flake .";
# darwin-rebuild switch (no homebrew)
drs = "drsf --override-input homebrew-enabled github:boolean-option/false";
# edit darwin-rebuild config in code/codium
drc = "code ${nixConfigDirectory}";
# edit darwin-rebuild config in (neo)vim
drv = "vim ${nixConfigDirectory}";
# edit darwin-rebuild config in helix
drh = "darwin-rebuild-edit-with hx";
flakeup = "nix flake update ${nixConfigDirectory}/";
nb = "nix build";
nd = "nix develop";
nf = "nix flake";
nr = "nix run";
ns = "nix search nixpkgs";
nsh = "nix shell";
nrp = "nix repl --expr '{ pkgs = (import <nixpkgs> { }); }'";
# Other
".." = "cd ..";
":q" = "exit";
cat = "${pkgs.bat}/bin/bat --style=plain --paging=never";
du = "${pkgs.du-dust}/bin/dust";
g = "${pkgs.gitAndTools.git}/bin/git";
ls = "${pkgs.eza}/bin/eza";
ll = "ls -l --time-style long-iso --icons";
la = "ll -a";
http = "${pkgs.xh}/bin/xh";
https = "${pkgs.xh}/bin/xhs";
top = "${pkgs.bottom}/bin/btm";
htop = "${pkgs.bottom}/bin/btm";
colortest = "${pkgs.terminal-colors}/bin/terminal-colors -o";
} // lib.optionalAttrs pkgs.stdenv.isDarwin {
tb = "toggle-background";
sb = "set-background-to-macOS";
};
# Configuration that should be above `loginShellInit` and `interactiveShellInit`.
programs.fish.shellInit = ''
set -U fish_term24bit 1
${lib.optionalString pkgs.stdenv.isDarwin "set-background-to-macOS"}
'';
home.sessionVariables.VIRTUAL_ENV_DISABLE_PROMPT = "true";
programs.fish.interactiveShellInit = ''
set -g fish_greeting (set_color blue)"( ³) "(set_color cyan)"h"(set_color red)"e"(set_color yellow)"l"(set_color green)"l"(set_color magenta)"o "(set_color blue)"( ³)"(set_color normal)
fish_vi_key_bindings
${lib.optionalString pkgs.stdenv.isDarwin "set-shell-colors"}
'';
}

32
home/ghostty.nix Normal file
View File

@ -0,0 +1,32 @@
{ flake, pkgs, lib, ... }:
let font = "Rec Mono Duotone";
in {
imports = [ flake.inputs.ghostty.homeModules.default ];
programs.ghostty = {
enable = true;
# ghostty is externally managed for now
package = null;
settings = {
# TODO: auto-theme
config-file = [ "${pkgs.terminal-themes}/ghostty/rose-pine" ];
# TODO: powerline replacements
font-family = font;
font-family-bold = "${font} Bold";
font-family-italic = "${font} Italic";
font-family-bold-italic = "${font} Bold Italic";
font-size = 15;
background-opacity = 0.95;
unfocused-split-opacity = 0.8;
window-decoration = true;
window-padding-x = 10;
window-padding-y = 10;
# use system clipboard on e.g. macOS
copy-on-select = "clipboard";
} // lib.optionalAttrs pkgs.stdenv.isDarwin {
background-blur-radius = 20;
macos-non-native-fullscreen = "visible-menu";
macos-option-as-alt = true;
};
};
}

View File

@ -1,20 +1,32 @@
{ flake, ... }:
let inherit (flake.config.people) me users;
let inherit (flake.config.users) me';
in {
programs.git.enable = true;
programs.git = {
enable = true;
programs.git.userEmail = users.${me}.email;
programs.git.userName = users.${me}.name;
userEmail = me'.email;
userName = me'.name;
programs.git.extraConfig = {
diff.colorMoved = "default";
pull.rebase = true;
init.defaultBranch = "main";
help.autocorrect = "prompt";
extraConfig = {
help.autocorrect = "prompt";
init.defaultBranch = "main";
pull.rebase = true;
# recommended by delta
diff.colorMoved = "default";
merge.conflictStyle = "diff3";
};
ignores = [ ".DS_Store" ".direnv" "result" ];
# enhanced diffs
delta = {
enable = true;
options = {
navigate = true;
line-numbers = true;
side-by-side = true;
};
};
};
programs.git.ignores = [ ".DS_Store" ".direnv" "result" ];
# Enhanced diffs
programs.git.delta.enable = true;
}

View File

@ -1,35 +1,39 @@
{ pkgs, lib, ... }: {
programs.helix.enable = true;
imports = [ ./extras/helix/auto-theme.nix ];
programs.helix = {
enable = true;
defaultEditor = true;
programs.helix.settings = {
editor.bufferline = "multiple";
editor.color-modes = true;
editor.cursor-shape.insert = "bar";
editor.cursorline = true;
editor.indent-guides.render = true;
editor.indent-guides.skip-levels = 1;
editor.line-number = "relative";
editor.soft-wrap.enable = true;
editor.whitespace.render = {
space = "none";
tab = "all";
newline = "all";
settings.editor = {
bufferline = "multiple";
color-modes = true;
cursor-shape.insert = "bar";
cursorline = true;
indent-guides = {
render = true;
skip-levels = 1;
};
line-number = "relative";
soft-wrap.enable = true;
whitespace.render = {
space = "none";
tab = "all";
newline = "all";
};
};
# grammars = [{
# name = "lalrpop";
# source = {
# git = "https://github.com/traxys/tree-sitter-lalrpop";
# rev = "7744b56f03ac1e5643fad23c9dd90837fe97291e";
# };
# }];
autoTheme = lib.mkIf pkgs.stdenv.isDarwin {
enable = true;
light = "rose_pine_dawn";
dark = "rose_pine";
};
};
# programs.helix.grammars = [{
# name = "lalrpop";
# source = {
# git = "https://github.com/traxys/tree-sitter-lalrpop";
# rev = "7744b56f03ac1e5643fad23c9dd90837fe97291e";
# };
# }];
programs.helix.autoTheme = lib.mkIf pkgs.stdenv.isDarwin {
enable = true;
light = "rose_pine_dawn";
dark = "rose_pine";
};
home.sessionVariables.EDITOR = "hx";
}

View File

@ -1,7 +1,10 @@
{ pkgs, lib, ... }:
let font = "Rec Mono Duotone";
in {
imports = [ ./extras/kitty/auto-theme.nix ./extras/kitty/nerd-font.nix ];
programs.kitty.enable = true;
# using kitty from homebrew
programs.kitty.package = pkgs.emptyDirectory;
programs.kitty.settings = {
font_family = font;
@ -44,9 +47,8 @@ in {
programs.kitty.useSymbolsFromNerdFont = "CaskaydiaCove Nerd Font";
programs.kitty.colors = {
enable = true;
color-pkg = pkgs.kitty-themes;
dark-name = "themes/rose-pine";
light-name = "themes/rose-pine-dawn";
dark-name = "rose-pine";
light-name = "rose-pine-dawn";
};
programs.fish.functions.set-term-colors = {
body = ''
@ -58,10 +60,4 @@ in {
'';
onVariable = "term_background";
};
programs.kitty.fixIcon = lib.mkIf pkgs.stdenv.isDarwin {
enable = true;
# TODO: use path to kitty package?
appPath = "~/Applications/Home\\ Manager\\ Apps/kitty.app";
iconPath = "${pkgs.kitty-icon}/kitty-dark.icns";
};
}

19
home/pijul.nix Normal file
View File

@ -0,0 +1,19 @@
{ flake, pkgs, ... }:
let
inherit (flake.config.users) me me';
tomlFormat = pkgs.formats.toml { };
in {
home = {
packages = [ pkgs.pijul ];
file = {
# hardcode .config because pijul doesn't support XDG (yet?)
".config/pijul/config.toml".source = tomlFormat.generate "pijul-config" {
author = {
name = me;
full_name = me'.name;
inherit (me') email;
};
};
};
};
}

View File

@ -1,64 +1,38 @@
{ pkgs, lib, ... }: {
programs = {
# a nicer cat
bat = {
enable = true;
config = { style = "auto"; };
};
# load and unload environment variables depending on the current directory
direnv = {
enable = true;
nix-direnv.enable = true;
};
nix-index = { enable = true; };
nushell = { enable = true; };
ssh = {
enable = true;
matchBlocks = {
"*".extraOptions = lib.mkIf pkgs.stdenv.isDarwin {
UseKeychain = "yes";
AddKeysToAgent = "yes";
};
remarkable = {
hostname = "10.11.99.1";
user = "root";
};
};
};
vscode = {
enable = false;
# extensions = [ pijul-vscode ];
};
zoxide = { enable = true; };
};
home.packages = builtins.attrValues ({
inherit (pkgs)
# GUI apps
cinny discord-ptb lagrange obsidian slack zoom-us
discord-ptb obsidian slack zoom-us
# system tools
curl wget
# lightweight session management
# `tmux` session alternative
abduco
# archive tool
atool
# fancy version of `top` with ASCII graphs
# `top` alternative with ASCII graphs
bottom
# fancy version of `du`
# `ncdu` alternative
diskonaut
# `dig` alternative. dogs _can_ look up
dogdns
# `du` alternative
du-dust
# fancy version of `ls`, fork of now-unmaintained `exa`
eza
# fancy version of `find`
# `find` alternative
fd
# wrapper for `ssh` that better at not dropping connections
mosh
# fancy version of `ps`
# `ping` with a graph
gping
# `ps` alternative
procs
# pipe progress viewer
pv
# command line file encryption
rage
# `sed` alternative for _batch file_ edits
sad
# `sed` alternative for _stream_ edits
sd
# backups for the truly paranoid
tarsnap
# terminal color support testing
@ -67,31 +41,29 @@
unrar
# extract XZ archives
xz
# `tmux` multiplexing/layout alternative
zellij
# dev tools
# source code line counter
cloc
# command line tools for digitalocean
doctl
# dev platforms
# command line tools for fly.io
flyctl
# command line tools for netlify
netlify-cli
# dev tools
# session recording
asciinema
# benchmarking tool
hyperfine
# json processor
jq
# task runner
just
# alternative to `git`
pijul
# better version of `grep`
ripgrep
# rust implementation of `tldr`
tealdeer
# source code line counter
tokei
# reimplementation of `httpie` in rust
xh
# useful nix related tools
nixfmt nix-prefetch-git nix-tree
nix-prefetch-git nix-tree
# adding/managing alternative binary caches hosted by Cachix
cachix
# run software from nixpkgs without installing it
@ -103,4 +75,45 @@
# useful macOS CLI commands
m-cli;
});
programs = {
# `cat` with wings
bat = {
enable = true;
config = { style = "auto"; };
};
# load and unload environment variables depending on the current directory
direnv = {
enable = true;
nix-direnv.enable = true;
};
# fork of `exa`, an `ls` alternative
eza = {
enable = true;
enableAliases = true;
icons = true;
git = true;
extraOptions = [ "--group-directories-first" ];
};
jq.enable = true;
man = {
enable = true;
generateCaches = true;
};
nix-index.enable = true;
nushell.enable = true;
# `grep` alternative
ripgrep.enable = true;
# cli help, `tldr` implementation
tealdeer = {
enable = true;
settings = {
display.use_pager = true;
updates.auto_update = true;
updates.auto_update_interval_hours = 24 * 7;
};
};
# `z` alternative
zoxide.enable = true;
};
}

View File

@ -1,4 +1,4 @@
{ config, pkgs, ... }: {
{ config, pkgs, lib, ... }: {
# dark-mode-notify configuration
launchd.agents.dark-mode-notify =
let logPath = "${config.xdg.stateHome}/dark-mode-notify";
@ -10,8 +10,8 @@
StandardErrorPath = "${logPath}/error.log";
StandardOutPath = "${logPath}/out.log";
ProgramArguments = [
"${pkgs.dark-mode-notify}/bin/dark-mode-notify"
"${pkgs.fish}/bin/fish"
"${lib.getExe pkgs.dark-mode-notify}"
"${lib.getExe pkgs.fish}"
"-c"
"set-background-to-env DARKMODE"
];

View File

@ -1,4 +1,13 @@
{ config, pkgs, lib, ... }: {
# set configuration in ~ so tarsnap cli works interactively
home.file.".tarsnaprc".text = ''
cachedir ${config.xdg.cacheHome}
keyfile ${config.xdg.configHome}/tarsnap/read-write-delete.key
nodump
print-stats
checkpoint-bytes 1G
humanize-numbers
'';
# tarsnap periodic backup configuration
launchd.agents.tarsnap = let
logPath = "${config.xdg.stateHome}/tarsnap";
@ -18,22 +27,13 @@
Label = "com.tarsnap.tarsnap";
StandardErrorPath = "${logPath}/error.log";
StandardOutPath = "${logPath}/out.log";
StartCalendarInterval = [
{
# every sunday
Weekday = 0;
# at midnight
Hour = 0;
Minute = 0;
}
{
# every wednesday
Weekday = 3;
# at noon
Hour = 12;
Minute = 0;
}
];
StartCalendarInterval = [{
# every sunday
Weekday = 0;
# at midnight
Hour = 0;
Minute = 0;
}];
Program = lib.getExe tarsnapBackup;
};
};

23
home/ssh.nix Normal file
View File

@ -0,0 +1,23 @@
{ config, lib, pkgs, ... }:
let
socket =
"${config.home.homeDirectory}/Library/Containers/com.maxgoedjen.Secretive.SecretAgent/Data/socket.ssh";
in {
home.sessionVariables.SSH_AUTH_SOCK = socket;
programs.ssh = {
enable = true;
matchBlocks = {
# use the keychain on macOS
"*".extraOptions = lib.mkIf pkgs.stdenv.isDarwin {
UseKeychain = "yes";
AddKeysToAgent = "yes";
IdentityAgent = socket;
};
# entry for easy access to reMarkable tablet
remarkable = {
hostname = "10.11.99.1";
user = "root";
};
};
};
}

View File

@ -1,22 +1,29 @@
{
# Starship Prompt
# https://rycee.gitlab.io/home-manager/options.html#opt-programs.starship.enable
programs.starship.enable = true;
# Starship settings -------------------------------------------------------------------------- {{{
programs.starship.settings = {
# See docs here: https://starship.rs/config/
# Symbols config configured in Flake.
battery.display = [{
threshold = 25;
} # display battery information if charge is <= 25%
];
directory.fish_style_pwd_dir_length = 1; # turn on fish directory truncation
directory.truncation_length = 2; # number of directories not to truncate
memory_usage.disabled =
true; # because it includes cached memory it's reported as full a lot
programs.starship = {
enable = true;
settings = {
battery.display = [{
# display battery information if charge is <= 25%
threshold = 25;
}];
# turn on fish directory truncation
directory.fish_style_pwd_dir_length = 1;
# number of directories not to truncate
directory.truncation_length = 2;
# because it includes cached memory it's reported as full a lot
memory_usage.disabled = true;
};
};
# }}}
# TODO: investigate how to get cmd_duration to show up in transient prompt
# transient prompt
# programs.starship.enableTransience = true;
# programs.fish.functions = {
# starship_transient_prompt_func.body = ''
# starship module directory
# starship module cmd_duration
# starship module line_break
# starship module character
# starship module line_break
# '';
# };
}

View File

@ -2,7 +2,7 @@
flake.nixosModules = {
common.imports = [ ./nix.nix ./caches ];
me = let inherit (config.people) me;
home = let inherit (config.users) me;
in {
home-manager.users.${me} = { imports = [ self.homeModules.linux ]; };
users.users.${me} = {
@ -14,7 +14,7 @@
default.imports = [
self.nixosModules.home-manager
self.nixosModules.me
self.nixosModules.home
self.nixosModules.common
./ssh-access.nix
];

View File

@ -17,14 +17,15 @@
package = pkgs.nixUnstable;
nixPath = {
nixpkgs = "${flake.inputs.nixpkgs}";
darwin = "${flake.inputs.darwin}";
} // lib.optionalAttrs pkgs.stdenv.isDarwin {
darwin = "${flake.inputs.nix-darwin}";
};
registry = {
nixpkgs.flake = flake.inputs.nixpkgs;
self.flake = flake;
self.flake = flake.inputs.self;
};
settings = {
max-jobs = "auto";
# TODO: automatic optimizing and gc
experimental-features = [ "nix-command" "flakes" "repl-flake" ];
extra-platforms = lib.mkIf (pkgs.system == "aarch64-darwin") [
"x86_64-darwin"
@ -33,7 +34,7 @@
# wipe out the registry for purity, cf. https://github.com/MatthewCroughan/nixcfg/commit/ce86bee2755127a4fdaca91e5e037d3fe625cba9
flake-registry = builtins.toFile "empty-flake-registry.json"
''{"flakes":[],"version":2}'';
trusted-users = [ flake.config.people.me "root" "@admin" "@wheel" ];
trusted-users = [ flake.config.users.me "root" "@admin" "@wheel" ];
};
};
}

View File

@ -1,10 +1,10 @@
{ flake, ... }: {
# remote access
users.users = let
inherit (flake.config) people;
myKeys = people.users.${people.me}.sshKeys;
inherit (flake.config.users) me me';
myKeys = me'.sshKeys;
in {
root.openssh.authorizedKeys.keys = myKeys;
${people.me}.openssh.authorizedKeys.keys = myKeys;
${me}.openssh.authorizedKeys.keys = myKeys;
};
}

View File

@ -20,4 +20,5 @@ in stdenv.mkDerivation {
'';
meta.platforms = lib.platforms.darwin;
meta.mainProgram = "dark-mode-notify";
}

View File

@ -1,17 +1,22 @@
inputs: self: super: {
inherit (inputs) kitty-icon kitty-themes;
inherit (inputs) terminal-themes;
dark-mode-notify = self.callPackage ./dark-mode-notify.nix {
inherit (inputs) dark-mode-notify-src;
};
fileicon = self.callPackage ./fileicon.nix { inherit (inputs) fileicon-src; };
# get flake inputs prefixed with fish-plugin- and inject them into fishPlugins as a single list
fishPlugins = super.fishPlugins // {
fisher = {
name = "fisher";
src = inputs.fisher-src;
};
flakePlugins = let
srcs =
self.lib.filterAttrs (input: _: self.lib.hasPrefix "fish-plugin-" input)
inputs;
in self.lib.mapAttrsToList (input: src: {
name = self.lib.removePrefix "fish-plugin-" input;
inherit src;
}) srcs;
};
ia-writer-family = self.callPackage ./ia-writer-family.nix {
inherit (inputs) ia-writer-family-src;
};
recursive-patched = self.callPackage ./recursive-patched.nix { };
yubiswitch = self.callPackage ./yubiswitch.nix { };
}

View File

@ -1,11 +0,0 @@
{ buildNpmPackage, fileicon-src }:
buildNpmPackage {
pname = "fileicon";
version = fileicon-src.shortRev;
src = fileicon-src;
npmDepsHash = "sha256-xQ/lTXomYARpawiMa8iccpq/7VUo/X/5Exovfjq3XHU=";
meta = { };
}

View File

@ -0,0 +1,10 @@
{ nerd-font-patcher, stdenv, recursive }:
stdenv.mkDerivation {
name = "recursive-nerd-font-patched";
src = recursive;
nativeBuildInputs = [ nerd-font-patcher ];
buildPhase = ''
find -name RecMono\*.ttf -execdir nerd-font-patcher -c {} \;
'';
installPhase = "cp -a . $out";
}

View File

@ -1,4 +1,4 @@
{ stdenv, fetchurl, undmg, unzip }:
{ lib, stdenv, fetchurl, undmg, unzip }:
let version = "0.16";
in stdenv.mkDerivation {
pname = "yubiswitch";
@ -21,4 +21,6 @@ in stdenv.mkDerivation {
runHook postInstall
'';
meta.platforms = lib.platforms.darwin;
}

View File

@ -1,6 +1,12 @@
{ pkgs, ... }: {
environment.systemPackages = [ pkgs.terminal-notifier ];
# networking settings
# TODO: do we need to add Tailscale, ProtonVPN, RNDIS (reMarkable), etc?
networking.knownNetworkServices =
[ "USB 10/100/1000 LAN" "Wi-Fi" "Thunderbolt Bridge" ];
# TODO: where / how to configure hostname etc?
# manage build users, package, and daemon
nix.configureBuildUsers = true;
services.nix-daemon.enable = true;

View File

@ -1,4 +1,5 @@
{ pkgs, lib, ... }: {
homebrew.casks = [ "itsycal" ];
home-manager.sharedModules = [{
launchd.agents.tarsnap.enable = lib.mkForce false;
home.packages = [ pkgs.yubiswitch ];

View File

@ -1 +1,9 @@
{ }
{ flake, ... }: {
imports = [ flake.inputs.disko.nixosModules.disko ];
disko.devices.disk = { };
# read why this matters:
# https://nixos.org/manual/nixos/stable/options.html#opt-system.stateVersion
system.stateVersion = "23.11";
}

View File

@ -1,4 +1,4 @@
{ lib, ... }:
{ config, lib, ... }:
let
userSubmodule = lib.types.submodule {
options = {
@ -17,7 +17,7 @@ let
};
};
};
peopleSubmodule = lib.types.submodule {
usersSubmodule = lib.types.submodule {
options = {
users = lib.mkOption { type = lib.types.attrsOf userSubmodule; };
me = lib.mkOption {
@ -30,10 +30,21 @@ let
Should be a key into the `users` attribute set.
'';
};
me' = lib.mkOption {
type = userSubmodule;
description = ''
The rest of the user data for `me`.
'';
readOnly = true;
};
};
};
in {
# TODO: can we hack in an assertion that `me` is a key in `users`?
options = { people = lib.mkOption { type = peopleSubmodule; }; };
config = { people = import ./config.nix; };
options = { users = lib.mkOption { type = usersSubmodule; }; };
config = {
users = (import ./config.nix) // {
me' = lib.mkDefault config.users.users.${config.users.me};
};
};
}