Refactor and clean up based on manual testing

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

View File

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

View File

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

View File

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

View File

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

View File

@ -53,11 +53,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1697995812, "lastModified": 1698422527,
"narHash": "sha256-UDlK6p/6vAiVOQ92PR0ySDZBS3yiryrlJpSOw3b9Ito=", "narHash": "sha256-SDu3Xg263t3oXIyTaH0buOvFnKIDeZsvKDBtOz+jRbs=",
"owner": "nix-community", "owner": "nix-community",
"repo": "disko", "repo": "disko",
"rev": "4122a18340094151d7911e838237ec7627f0d0c5", "rev": "944d338d24a9d043a3f7461c30ee6cfe4f9cca30",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -66,35 +66,99 @@
"type": "github" "type": "github"
} }
}, },
"fileicon-src": { "fish-plugin-autopair": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1690207317, "lastModified": 1656950411,
"narHash": "sha256-lkDivFJoeebFeA55kHHN9av5N7nz5zUiW+uAw74IM5U=", "narHash": "sha256-qt3t1iKRRNuiLWiVoiAYOu+9E7jsyECyIqZJ/oRIT1A=",
"owner": "mklement0", "owner": "jorgebucaran",
"repo": "fileicon", "repo": "autopair.fish",
"rev": "9c41a44fac462f66a1194e223aa26e4c3b9b5ae3", "rev": "4d1752ff5b39819ab58d7337c69220342e9de0e2",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "mklement0", "owner": "jorgebucaran",
"repo": "fileicon", "repo": "autopair.fish",
"type": "github" "type": "github"
} }
}, },
"fisher-src": { "fish-plugin-colored-man-pages": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1692640630, "lastModified": 1651274650,
"narHash": "sha256-e8gIaVbuUzTwKtuMPNXBT5STeddYqQegduWBtURLT3M=", "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", "owner": "jorgebucaran",
"repo": "fisher", "repo": "replay.fish",
"rev": "2efd33ccd0777ece3f58895a093f32932bd377b6", "rev": "bd8e5b89ec78313538e747f0292fcaf631e87bd2",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "jorgebucaran", "owner": "jorgebucaran",
"repo": "fisher", "repo": "replay.fish",
"type": "github" "type": "github"
} }
}, },
@ -135,11 +199,11 @@
"nixpkgs-lib": "nixpkgs-lib" "nixpkgs-lib": "nixpkgs-lib"
}, },
"locked": { "locked": {
"lastModified": 1696343447, "lastModified": 1698882062,
"narHash": "sha256-B2xAZKLkkeRFG5XcHHSXXcP7To9Xzr59KXeZiRf4vdQ=", "narHash": "sha256-HkhafUayIqxXyHH1X8d9RDl1M2CkFgZLjKD3MzabiEo=",
"owner": "hercules-ci", "owner": "hercules-ci",
"repo": "flake-parts", "repo": "flake-parts",
"rev": "c9afaba3dfa4085dbd2ccb38dfade5141e33d9d4", "rev": "8c9fa2545007b49a5db5f650ae91f227672c3877",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -207,11 +271,11 @@
"systems": "systems_3" "systems": "systems_3"
}, },
"locked": { "locked": {
"lastModified": 1694529238, "lastModified": 1685518550,
"narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=", "narHash": "sha256-o2d0KcvaXzTrPRIo0kOLV0/QXHhDQ5DTi+OxcjO8xqY=",
"owner": "numtide", "owner": "numtide",
"repo": "flake-utils", "repo": "flake-utils",
"rev": "ff7b65b44d01cf9ba6a71320833626af21126384", "rev": "a1720a10a6cfe8234c0e93907ffe81be440f4cef",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -220,6 +284,21 @@
"type": "github" "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": { "gitignore": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [
@ -251,11 +330,11 @@
"rust-overlay": "rust-overlay" "rust-overlay": "rust-overlay"
}, },
"locked": { "locked": {
"lastModified": 1697618705, "lastModified": 1698790188,
"narHash": "sha256-BpAFX7mwV4/vpTlMLZtPICKeDPGLx1Q8s3zVZ8IEAkY=", "narHash": "sha256-sAp4RIto3fDjb/HJ4NR3HlHo3J8R7tK4/qSGYkhudUA=",
"owner": "helix-editor", "owner": "helix-editor",
"repo": "helix", "repo": "helix",
"rev": "e6d2835b0907102831a8979688a8464c064ff842", "rev": "a069b928973aad99b85dffb9d5ade7dae4b58c43",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -271,11 +350,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1697688028, "lastModified": 1698873617,
"narHash": "sha256-d9CAOd9W2iTrgB31a8Dvyp6Vgn/gxASCNrD4Z9yzUOY=", "narHash": "sha256-FfGFcfbULwbK1vD+H0rslIOfmy4g8f2hXiPkQG3ZCTk=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "c5c1ea85181d2bb44e46e8a944a8a3f56ad88f19", "rev": "48b0a30202516e25d9885525fbb200a045f23f26",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -315,38 +394,6 @@
"type": "github" "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": { "nil": {
"inputs": { "inputs": {
"flake-utils": "flake-utils_2", "flake-utils": "flake-utils_2",
@ -376,11 +423,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1697723594, "lastModified": 1698429334,
"narHash": "sha256-W7lTC+kHGS1YCOutGpxUHF0cK66iY/GYr3INaTyVa/I=", "narHash": "sha256-Gq3+QabboczSu7RMpcy79RSLMSqnySO3wsnHQk4DfbE=",
"owner": "lnl7", "owner": "lnl7",
"repo": "nix-darwin", "repo": "nix-darwin",
"rev": "19f75c2b45fbfc307ecfeb9dadc41a4c1e4fb980", "rev": "afe83cbc2e673b1f08d32dd0f70df599678ff1e7",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -413,26 +460,26 @@
}, },
"nixos-flake": { "nixos-flake": {
"locked": { "locked": {
"lastModified": 1691408332, "lastModified": 1698598244,
"narHash": "sha256-0IveIyIFaORG+SzMzXfl9A4IopQ4KDmThDeH34ryL0c=", "narHash": "sha256-YbvPFt+9CbCiqnuS0dTx+P+W1YRCqzhLXen94sef3Kk=",
"owner": "squirmy", "owner": "srid",
"repo": "nixos-flake", "repo": "nixos-flake",
"rev": "531043e2c7825406fb271fb831abe656d0997706", "rev": "f6b7757ad88483afca306c9f3bf387887fba7284",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "squirmy", "owner": "srid",
"repo": "nixos-flake", "repo": "nixos-flake",
"type": "github" "type": "github"
} }
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1697730408, "lastModified": 1698890957,
"narHash": "sha256-Ww//zzukdTrwTrCUkaJA/NsaLEfUfQpWZXBdXBYfhak=", "narHash": "sha256-DJ+SppjpPBoJr0Aro9TAcP3sxApCSieY6BYBCoWGUX8=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "ff0a5a776b56e0ca32d47a4a47695452ec7f7d80", "rev": "c082856b850ec60cda9f0a0db2bc7bd8900d708c",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -445,11 +492,11 @@
"nixpkgs-lib": { "nixpkgs-lib": {
"locked": { "locked": {
"dir": "lib", "dir": "lib",
"lastModified": 1696019113, "lastModified": 1698611440,
"narHash": "sha256-X3+DKYWJm93DRSdC5M6K5hLqzSya9BjibtBsuARoPco=", "narHash": "sha256-jPjHjrerhYDy3q9+s5EAsuhyhuknNfowY6yt6pjn9pc=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "f5892ddac112a1e9b3612c39af1b72987ee5783a", "rev": "0cbe9f69c234a7700596e943bfae7ef27a31b735",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -480,11 +527,11 @@
}, },
"nixpkgs-stable": { "nixpkgs-stable": {
"locked": { "locked": {
"lastModified": 1697851979, "lastModified": 1685801374,
"narHash": "sha256-lJ8k4qkkwdvi+t/Xc6Fn74kUuobpu9ynPGxNZR6OwoA=", "narHash": "sha256-otaSUoFEMM+LjBI1XL/xGB5ao6IwnZOXc47qhIgJe8U=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "5550a85a087c04ddcace7f892b0bdc9d8bb080c8", "rev": "c37ca420157f4abc31e26f436c1145f8951ff373",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -505,11 +552,11 @@
"nixpkgs-stable": "nixpkgs-stable" "nixpkgs-stable": "nixpkgs-stable"
}, },
"locked": { "locked": {
"lastModified": 1697746376, "lastModified": 1698852633,
"narHash": "sha256-gu77VkgdfaHgNCVufeb6WP9oqFLjwK4jHcoPZmBVF3E=", "narHash": "sha256-Hsc/cCHud8ZXLvmm8pxrXpuaPEeNaaUttaCvtdX/Wug=",
"owner": "cachix", "owner": "cachix",
"repo": "pre-commit-hooks.nix", "repo": "pre-commit-hooks.nix",
"rev": "8cc349bfd082da8782b989cad2158c9ad5bd70fd", "rev": "dec10399e5b56aa95fcd530e0338be72ad6462a0",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -522,22 +569,26 @@
"inputs": { "inputs": {
"dark-mode-notify-src": "dark-mode-notify-src", "dark-mode-notify-src": "dark-mode-notify-src",
"disko": "disko", "disko": "disko",
"fileicon-src": "fileicon-src", "fish-plugin-autopair": "fish-plugin-autopair",
"fisher-src": "fisher-src", "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", "flake-parts": "flake-parts",
"ghostty": "ghostty",
"helix": "helix", "helix": "helix",
"home-manager": "home-manager", "home-manager": "home-manager",
"homebrew-enabled": "homebrew-enabled", "homebrew-enabled": "homebrew-enabled",
"ia-writer-family-src": "ia-writer-family-src", "ia-writer-family-src": "ia-writer-family-src",
"kitty-icon": "kitty-icon",
"kitty-themes": "kitty-themes",
"nil": "nil", "nil": "nil",
"nix-darwin": "nix-darwin", "nix-darwin": "nix-darwin",
"nixd": "nixd", "nixd": "nixd",
"nixos-flake": "nixos-flake", "nixos-flake": "nixos-flake",
"nixpkgs": "nixpkgs", "nixpkgs": "nixpkgs",
"pre-commit": "pre-commit", "pre-commit": "pre-commit",
"starship-src": "starship-src" "starship-src": "starship-src",
"terminal-themes": "terminal-themes"
} }
}, },
"rust-overlay": { "rust-overlay": {
@ -593,11 +644,11 @@
"starship-src": { "starship-src": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1697690660, "lastModified": 1698919886,
"narHash": "sha256-c2BpZYIJ26xc6rq+rpSKtfyk1/L32PYnH31luK+7kAg=", "narHash": "sha256-rV1Sf5MbmHVn8sUEn07STsSdXoPZClTqGp3Tmkvp1+0=",
"owner": "starship", "owner": "starship",
"repo": "starship", "repo": "starship",
"rev": "099539fd1aa2937e9507a318becffcbc685b83b8", "rev": "6abc83decdf176842985b4daa5b09771c6b93415",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -650,6 +701,22 @@
"repo": "default", "repo": "default",
"type": "github" "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", "root": "root",

View File

@ -9,12 +9,12 @@
nix-darwin.inputs.nixpkgs.follows = "nixpkgs"; nix-darwin.inputs.nixpkgs.follows = "nixpkgs";
home-manager.url = "github:nix-community/home-manager"; home-manager.url = "github:nix-community/home-manager";
home-manager.inputs.nixpkgs.follows = "nixpkgs"; 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.url = "github:cachix/pre-commit-hooks.nix";
pre-commit.inputs.nixpkgs.follows = "nixpkgs"; pre-commit.inputs.nixpkgs.follows = "nixpkgs";
disko.url = "github:nix-community/disko"; disko.url = "github:nix-community/disko";
disko.inputs.nixpkgs.follows = "nixpkgs"; disko.inputs.nixpkgs.follows = "nixpkgs";
ghostty.url = "github:clo4/ghostty-hm-module";
# "flag" for toggling homebrew operations # "flag" for toggling homebrew operations
# https://www.mat.services/posts/command-line-flake-arguments/ # 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.url = "github:bouk/dark-mode-notify";
dark-mode-notify-src.flake = false; 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 fonts
ia-writer-family-src.url = "github:iaolo/iA-Fonts"; ia-writer-family-src.url = "github:iaolo/iA-Fonts";
ia-writer-family-src.flake = false; 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 # standard kitty terminal themes
kitty-themes.url = "github:kovidgoyal/kitty-themes"; terminal-themes.url = "github:mbadolato/iTerm2-Color-Schemes";
kitty-themes.flake = false; terminal-themes.flake = false;
# fish shell package manager
fisher-src.url = "github:jorgebucaran/fisher";
fisher-src.flake = false;
# shell prompt # shell prompt
starship-src.url = "github:starship/starship"; starship-src.url = "github:starship/starship";
starship-src.flake = false; 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: outputs = { self, flake-parts, ... }@inputs:
@ -68,16 +71,17 @@
./darwin ./darwin
./home ./home
./nixos ./nixos
./people
./templates ./templates
./users
]; ];
flake = { flake = {
nixosConfigurations = { nixosConfigurations = {
pihole = self.nixos-flake.lib.mkLinuxSystem { # pihole = self.nixos-flake.lib.mkLinuxSystem {
nixpkgs.hostPlatform = "aarch64-linux"; # nixpkgs.hostPlatform = "aarch64-linux";
imports = [ self.nixosModules.default ./systems/nixos/pihole.nix ]; # imports = [ self.nixosModules.default ./systems/nixos/pihole.nix ];
}; # };
}; };
darwinConfigurations = { darwinConfigurations = {
matbook = self.nixos-flake.lib.mkMacosSystem { matbook = self.nixos-flake.lib.mkMacosSystem {
nixpkgs.hostPlatform = "aarch64-darwin"; nixpkgs.hostPlatform = "aarch64-darwin";
@ -90,7 +94,7 @@
yelpbook-m1 = self.nixos-flake.lib.mkMacosSystem { yelpbook-m1 = self.nixos-flake.lib.mkMacosSystem {
nixpkgs.hostPlatform = "aarch64-darwin"; nixpkgs.hostPlatform = "aarch64-darwin";
people.me = "mess"; users.me = "mess";
imports = [ imports = [
self.darwinModules.default self.darwinModules.default
./systems/darwin/m1.nix ./systems/darwin/m1.nix

View File

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

View File

@ -1,26 +1,24 @@
{ config, pkgs, lib, ... }: { config, pkgs, lib, ... }:
let let
cfg = config.programs.helix; cfg = config.programs.helix;
tomlFormat = pkgs.formats.toml { }; tomlFormat = pkgs.formats.toml { };
inherit (lib) mkIf mkEnableOption mkOption types;
in { in {
options.programs.helix = { options.programs.helix = {
autoTheme.enable = autoTheme.enable =
mkEnableOption "Automatically switch helix theme with night mode"; lib.mkEnableOption "Automatically switch helix theme with night mode";
autoTheme.light = mkOption { autoTheme.light = lib.mkOption {
type = types.str; type = lib.types.str;
description = "Light mode theme"; description = "Light mode theme";
}; };
autoTheme.dark = mkOption { autoTheme.dark = lib.mkOption {
type = types.str; type = lib.types.str;
description = "Dark mode theme"; description = "Dark mode theme";
}; };
}; };
config = mkIf (cfg.enable && cfg.autoTheme.enable) { config = lib.mkIf (cfg.enable && cfg.autoTheme.enable) {
xdg.configFile = { xdg.configFile = {
"helix/light.toml".source = tomlFormat.generate "helix-autotheme" "helix/light.toml".source = tomlFormat.generate "helix-autotheme"
(cfg.settings // { theme = cfg.autoTheme.light; }); (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 shell is running in a Kitty window set the colors.
if [ -n "$KITTY_WINDOW_ID" ]; then if [ -n "$KITTY_WINDOW_ID" ]; then
kitty @ --to $KITTY_LISTEN_ON set-colors --all --configured \ kitty @ --to $KITTY_LISTEN_ON set-colors --all --configured \
${cfg.colors.color-pkg}/"$1".conf & ${cfg.colors.colors-path}/"$1".conf &
fi fi
''; '';
term-light = pkgs.writeShellScriptBin "term-light" '' term-light = pkgs.writeShellScriptBin "term-light" ''
@ -16,12 +16,11 @@ let
term-dark = pkgs.writeShellScriptBin "term-dark" '' term-dark = pkgs.writeShellScriptBin "term-dark" ''
${term-background}/bin/term-background ${cfg.colors.dark-name} ${term-background}/bin/term-background ${cfg.colors.dark-name}
''; '';
inherit (lib) mkIf mkOption types;
in { in {
options.programs.kitty = { options.programs.kitty = {
colors = { colors = {
enable = mkOption { enable = lib.mkOption {
type = types.bool; type = lib.types.bool;
default = false; default = false;
description = '' description = ''
When enabled, commands <command>term-dark</command> and <command>term-light</command> When enabled, commands <command>term-dark</command> and <command>term-light</command>
@ -35,20 +34,28 @@ in {
''; '';
}; };
color-pkg = mkOption { colors-path = lib.mkOption {
type = types.package; type = lib.types.path;
default = pkgs.kitty-colors; default = "${pkgs.terminal-colors}/kitty";
description = "Package from which to load kitty colors."; description = "Path from which to load kitty colors.";
}; };
light-name = mkOption { color-pkg-path = lib.mkOption {
type = types.str; 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"; default = "light";
description = "The name to use for the light colorscheme."; description = "The name to use for the light colorscheme.";
}; };
dark-name = mkOption { dark-name = lib.mkOption {
type = types.str; type = lib.types.str;
default = "dark"; default = "dark";
description = "The name to use for the dark colorscheme."; description = "The name to use for the dark colorscheme.";
}; };
@ -56,18 +63,15 @@ in {
}; };
config = mkIf cfg.enable { config = lib.mkIf (cfg.enable && cfg.colors.enable) {
home.packages = home.packages = [ term-light term-dark term-background ];
mkIf cfg.colors.enable [ term-light term-dark term-background ];
programs.kitty.settings = mkIf cfg.colors.enable { programs.kitty.settings = {
allow_remote_control = "yes"; allow_remote_control = "yes";
listen_on = "unix:/tmp/mykitty"; listen_on = "unix:/tmp/mykitty";
}; };
xdg.configFile."kitty/macos-launch-services-cmdline" = xdg.configFile."kitty/macos-launch-services-cmdline".text =
mkIf (pkgs.stdenv.isDarwin && cfg.colors.enable) { lib.mkIf pkgs.stdenv.isDarwin "--listen-on unix:/tmp/mykitty";
text = "--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, ... }: { config, lib, ... }:
let let cfg = config.programs.kitty;
cfg = config.programs.kitty;
inherit (lib) mkIf mkOption types;
in { in {
options.programs.kitty = { options.programs.kitty = {
useSymbolsFromNerdFont = mkOption { useSymbolsFromNerdFont = lib.mkOption {
type = types.str; type = lib.types.str;
default = ""; default = "";
example = "JetBrainsMono Nerd Font"; example = "JetBrainsMono Nerd Font";
description = '' description = ''
@ -18,8 +16,8 @@ in {
}; };
}; };
config = mkIf cfg.enable { config = lib.mkIf (cfg.enable && cfg.useSymbolsFromNerdFont != "") {
programs.kitty.settings = mkIf (cfg.useSymbolsFromNerdFont != "") { programs.kitty.settings = {
# https://github.com/ryanoasis/nerd-fonts/wiki/Glyph-Sets-and-Code-Points # https://github.com/ryanoasis/nerd-fonts/wiki/Glyph-Sets-and-Code-Points
symbol_map = 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}"; "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; }
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
'';
};
}

View File

@ -1,169 +1,179 @@
{ pkgs, lib, ... }: { { pkgs, lib, ... }:
programs.fish.enable = true; let nixConfigDirectory = "~/dotfiles.nix";
in {
programs.fish = {
enable = true;
programs.fish.plugins = [ pkgs.fishPlugins.fisher ]; # see flake.nix and pkgs/default.nix
xdg.configFile."fish/fish_plugins".text = '' plugins = pkgs.fishPlugins.flakePlugins;
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
'';
programs.fish.functions = { functions = {
# user functions # user functions
mkdcd = { mkdcd = {
argumentNames = [ "target" ]; argumentNames = [ "target" ];
body = '' body = ''
if test -z "$target" if test -z "$target"
echo "mkdcd requires an argument" 1>&2 echo "mkdcd requires an argument" 1>&2
return 1 return 1
end end
mkdir -p $target mkdir -p $target
cd $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 = { # toggles `$term_background` between "light" and "dark". other Fish functions trigger when this
argumentNames = [ "dir" ]; # variable changes. we use a universal variable so that all instances of Fish have the same
body = '' # value for the variable.
pushd $dir toggle-background.body = ''
set -e argv[1] if test "$term_background" = light
$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"
set -U term_background dark set -U term_background dark
case 0 else
echo "Setting light mode"
set -U term_background light set -U term_background light
end end
''; '';
};
# sets shell utilities to light or dark colorscheme based on `$term_background`. # set `$term_background` based on whether macOS is light or dark mode
set-shell-colors = { set-background-to-macOS.body = ''
body = '' if is-dark-mode
# Use correct theme for `btm` and `bat` set -U term_background dark
if test "$term_background" = light
alias btm "btm --color nord-light"
set -xg BAT_THEME OneHalfLight
else else
alias btm "btm --color nord" set -U term_background light
set -xg BAT_THEME OneHalfDark
end 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"; 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, ... }: { flake, ... }:
let inherit (flake.config.people) me users; let inherit (flake.config.users) me';
in { in {
programs.git.enable = true; programs.git = {
enable = true;
programs.git.userEmail = users.${me}.email; userEmail = me'.email;
programs.git.userName = users.${me}.name; userName = me'.name;
programs.git.extraConfig = { extraConfig = {
diff.colorMoved = "default"; help.autocorrect = "prompt";
pull.rebase = true; init.defaultBranch = "main";
init.defaultBranch = "main"; pull.rebase = true;
help.autocorrect = "prompt";
# 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, ... }: { { pkgs, lib, ... }: {
programs.helix.enable = true; imports = [ ./extras/helix/auto-theme.nix ];
programs.helix = {
enable = true;
defaultEditor = true;
programs.helix.settings = { settings.editor = {
editor.bufferline = "multiple"; bufferline = "multiple";
editor.color-modes = true; color-modes = true;
editor.cursor-shape.insert = "bar"; cursor-shape.insert = "bar";
editor.cursorline = true; cursorline = true;
editor.indent-guides.render = true; indent-guides = {
editor.indent-guides.skip-levels = 1; render = true;
editor.line-number = "relative"; skip-levels = 1;
editor.soft-wrap.enable = true; };
editor.whitespace.render = { line-number = "relative";
space = "none"; soft-wrap.enable = true;
tab = "all"; whitespace.render = {
newline = "all"; 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, ... }: { pkgs, lib, ... }:
let font = "Rec Mono Duotone"; let font = "Rec Mono Duotone";
in { in {
imports = [ ./extras/kitty/auto-theme.nix ./extras/kitty/nerd-font.nix ];
programs.kitty.enable = true; programs.kitty.enable = true;
# using kitty from homebrew
programs.kitty.package = pkgs.emptyDirectory;
programs.kitty.settings = { programs.kitty.settings = {
font_family = font; font_family = font;
@ -44,9 +47,8 @@ in {
programs.kitty.useSymbolsFromNerdFont = "CaskaydiaCove Nerd Font"; programs.kitty.useSymbolsFromNerdFont = "CaskaydiaCove Nerd Font";
programs.kitty.colors = { programs.kitty.colors = {
enable = true; enable = true;
color-pkg = pkgs.kitty-themes; dark-name = "rose-pine";
dark-name = "themes/rose-pine"; light-name = "rose-pine-dawn";
light-name = "themes/rose-pine-dawn";
}; };
programs.fish.functions.set-term-colors = { programs.fish.functions.set-term-colors = {
body = '' body = ''
@ -58,10 +60,4 @@ in {
''; '';
onVariable = "term_background"; 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, ... }: { { 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 ({ home.packages = builtins.attrValues ({
inherit (pkgs) inherit (pkgs)
# GUI apps # GUI apps
cinny discord-ptb lagrange obsidian slack zoom-us discord-ptb obsidian slack zoom-us
# system tools # system tools
curl wget curl wget
# lightweight session management # `tmux` session alternative
abduco abduco
# archive tool # archive tool
atool atool
# fancy version of `top` with ASCII graphs # `top` alternative with ASCII graphs
bottom bottom
# fancy version of `du` # `ncdu` alternative
diskonaut
# `dig` alternative. dogs _can_ look up
dogdns
# `du` alternative
du-dust du-dust
# fancy version of `ls`, fork of now-unmaintained `exa` # `find` alternative
eza
# fancy version of `find`
fd fd
# wrapper for `ssh` that better at not dropping connections # `ping` with a graph
mosh gping
# fancy version of `ps` # `ps` alternative
procs procs
# pipe progress viewer # pipe progress viewer
pv pv
# command line file encryption # command line file encryption
rage rage
# `sed` alternative for _batch file_ edits
sad
# `sed` alternative for _stream_ edits
sd
# backups for the truly paranoid # backups for the truly paranoid
tarsnap tarsnap
# terminal color support testing # terminal color support testing
@ -67,31 +41,29 @@
unrar unrar
# extract XZ archives # extract XZ archives
xz xz
# `tmux` multiplexing/layout alternative
zellij
# dev tools # dev platforms
# source code line counter
cloc
# command line tools for digitalocean
doctl
# command line tools for fly.io # command line tools for fly.io
flyctl flyctl
# command line tools for netlify
netlify-cli
# dev tools
# session recording
asciinema
# benchmarking tool # benchmarking tool
hyperfine hyperfine
# json processor
jq
# task runner # task runner
just just
# alternative to `git` # source code line counter
pijul tokei
# better version of `grep`
ripgrep
# rust implementation of `tldr`
tealdeer
# reimplementation of `httpie` in rust # reimplementation of `httpie` in rust
xh xh
# useful nix related tools # useful nix related tools
nixfmt nix-prefetch-git nix-tree nix-prefetch-git nix-tree
# adding/managing alternative binary caches hosted by Cachix # adding/managing alternative binary caches hosted by Cachix
cachix cachix
# run software from nixpkgs without installing it # run software from nixpkgs without installing it
@ -103,4 +75,45 @@
# useful macOS CLI commands # useful macOS CLI commands
m-cli; 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 # dark-mode-notify configuration
launchd.agents.dark-mode-notify = launchd.agents.dark-mode-notify =
let logPath = "${config.xdg.stateHome}/dark-mode-notify"; let logPath = "${config.xdg.stateHome}/dark-mode-notify";
@ -10,8 +10,8 @@
StandardErrorPath = "${logPath}/error.log"; StandardErrorPath = "${logPath}/error.log";
StandardOutPath = "${logPath}/out.log"; StandardOutPath = "${logPath}/out.log";
ProgramArguments = [ ProgramArguments = [
"${pkgs.dark-mode-notify}/bin/dark-mode-notify" "${lib.getExe pkgs.dark-mode-notify}"
"${pkgs.fish}/bin/fish" "${lib.getExe pkgs.fish}"
"-c" "-c"
"set-background-to-env DARKMODE" "set-background-to-env DARKMODE"
]; ];

View File

@ -1,4 +1,13 @@
{ config, pkgs, lib, ... }: { { 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 # tarsnap periodic backup configuration
launchd.agents.tarsnap = let launchd.agents.tarsnap = let
logPath = "${config.xdg.stateHome}/tarsnap"; logPath = "${config.xdg.stateHome}/tarsnap";
@ -18,22 +27,13 @@
Label = "com.tarsnap.tarsnap"; Label = "com.tarsnap.tarsnap";
StandardErrorPath = "${logPath}/error.log"; StandardErrorPath = "${logPath}/error.log";
StandardOutPath = "${logPath}/out.log"; StandardOutPath = "${logPath}/out.log";
StartCalendarInterval = [ StartCalendarInterval = [{
{ # every sunday
# every sunday Weekday = 0;
Weekday = 0; # at midnight
# at midnight Hour = 0;
Hour = 0; Minute = 0;
Minute = 0; }];
}
{
# every wednesday
Weekday = 3;
# at noon
Hour = 12;
Minute = 0;
}
];
Program = lib.getExe tarsnapBackup; 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 programs.starship = {
# https://rycee.gitlab.io/home-manager/options.html#opt-programs.starship.enable enable = true;
programs.starship.enable = true; settings = {
battery.display = [{
# Starship settings -------------------------------------------------------------------------- {{{ # display battery information if charge is <= 25%
threshold = 25;
programs.starship.settings = { }];
# See docs here: https://starship.rs/config/ # turn on fish directory truncation
# Symbols config configured in Flake. directory.fish_style_pwd_dir_length = 1;
# number of directories not to truncate
battery.display = [{ directory.truncation_length = 2;
threshold = 25; # because it includes cached memory it's reported as full a lot
} # display battery information if charge is <= 25% memory_usage.disabled = true;
]; };
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
}; };
# }}} # 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 = { flake.nixosModules = {
common.imports = [ ./nix.nix ./caches ]; common.imports = [ ./nix.nix ./caches ];
me = let inherit (config.people) me; home = let inherit (config.users) me;
in { in {
home-manager.users.${me} = { imports = [ self.homeModules.linux ]; }; home-manager.users.${me} = { imports = [ self.homeModules.linux ]; };
users.users.${me} = { users.users.${me} = {
@ -14,7 +14,7 @@
default.imports = [ default.imports = [
self.nixosModules.home-manager self.nixosModules.home-manager
self.nixosModules.me self.nixosModules.home
self.nixosModules.common self.nixosModules.common
./ssh-access.nix ./ssh-access.nix
]; ];

View File

@ -17,14 +17,15 @@
package = pkgs.nixUnstable; package = pkgs.nixUnstable;
nixPath = { nixPath = {
nixpkgs = "${flake.inputs.nixpkgs}"; nixpkgs = "${flake.inputs.nixpkgs}";
darwin = "${flake.inputs.darwin}"; } // lib.optionalAttrs pkgs.stdenv.isDarwin {
darwin = "${flake.inputs.nix-darwin}";
}; };
registry = { registry = {
nixpkgs.flake = flake.inputs.nixpkgs; nixpkgs.flake = flake.inputs.nixpkgs;
self.flake = flake; self.flake = flake.inputs.self;
}; };
settings = { settings = {
max-jobs = "auto"; # TODO: automatic optimizing and gc
experimental-features = [ "nix-command" "flakes" "repl-flake" ]; experimental-features = [ "nix-command" "flakes" "repl-flake" ];
extra-platforms = lib.mkIf (pkgs.system == "aarch64-darwin") [ extra-platforms = lib.mkIf (pkgs.system == "aarch64-darwin") [
"x86_64-darwin" "x86_64-darwin"
@ -33,7 +34,7 @@
# wipe out the registry for purity, cf. https://github.com/MatthewCroughan/nixcfg/commit/ce86bee2755127a4fdaca91e5e037d3fe625cba9 # wipe out the registry for purity, cf. https://github.com/MatthewCroughan/nixcfg/commit/ce86bee2755127a4fdaca91e5e037d3fe625cba9
flake-registry = builtins.toFile "empty-flake-registry.json" flake-registry = builtins.toFile "empty-flake-registry.json"
''{"flakes":[],"version":2}''; ''{"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, ... }: { { flake, ... }: {
# remote access # remote access
users.users = let users.users = let
inherit (flake.config) people; inherit (flake.config.users) me me';
myKeys = people.users.${people.me}.sshKeys; myKeys = me'.sshKeys;
in { in {
root.openssh.authorizedKeys.keys = myKeys; 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.platforms = lib.platforms.darwin;
meta.mainProgram = "dark-mode-notify";
} }

View File

@ -1,17 +1,22 @@
inputs: self: super: { inputs: self: super: {
inherit (inputs) kitty-icon kitty-themes; inherit (inputs) terminal-themes;
dark-mode-notify = self.callPackage ./dark-mode-notify.nix { dark-mode-notify = self.callPackage ./dark-mode-notify.nix {
inherit (inputs) dark-mode-notify-src; 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 // { fishPlugins = super.fishPlugins // {
fisher = { flakePlugins = let
name = "fisher"; srcs =
src = inputs.fisher-src; 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 { ia-writer-family = self.callPackage ./ia-writer-family.nix {
inherit (inputs) ia-writer-family-src; inherit (inputs) ia-writer-family-src;
}; };
recursive-patched = self.callPackage ./recursive-patched.nix { };
yubiswitch = self.callPackage ./yubiswitch.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"; let version = "0.16";
in stdenv.mkDerivation { in stdenv.mkDerivation {
pname = "yubiswitch"; pname = "yubiswitch";
@ -21,4 +21,6 @@ in stdenv.mkDerivation {
runHook postInstall runHook postInstall
''; '';
meta.platforms = lib.platforms.darwin;
} }

View File

@ -1,6 +1,12 @@
{ pkgs, ... }: { { pkgs, ... }: {
environment.systemPackages = [ pkgs.terminal-notifier ]; 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 # manage build users, package, and daemon
nix.configureBuildUsers = true; nix.configureBuildUsers = true;
services.nix-daemon.enable = true; services.nix-daemon.enable = true;

View File

@ -1,4 +1,5 @@
{ pkgs, lib, ... }: { { pkgs, lib, ... }: {
homebrew.casks = [ "itsycal" ];
home-manager.sharedModules = [{ home-manager.sharedModules = [{
launchd.agents.tarsnap.enable = lib.mkForce false; launchd.agents.tarsnap.enable = lib.mkForce false;
home.packages = [ pkgs.yubiswitch ]; 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 let
userSubmodule = lib.types.submodule { userSubmodule = lib.types.submodule {
options = { options = {
@ -17,7 +17,7 @@ let
}; };
}; };
}; };
peopleSubmodule = lib.types.submodule { usersSubmodule = lib.types.submodule {
options = { options = {
users = lib.mkOption { type = lib.types.attrsOf userSubmodule; }; users = lib.mkOption { type = lib.types.attrsOf userSubmodule; };
me = lib.mkOption { me = lib.mkOption {
@ -30,10 +30,21 @@ let
Should be a key into the `users` attribute set. 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 { in {
# TODO: can we hack in an assertion that `me` is a key in `users`? # TODO: can we hack in an assertion that `me` is a key in `users`?
options = { people = lib.mkOption { type = peopleSubmodule; }; }; options = { users = lib.mkOption { type = usersSubmodule; }; };
config = { people = import ./config.nix; }; config = {
users = (import ./config.nix) // {
me' = lib.mkDefault config.users.users.${config.users.me};
};
};
} }