Compare commits

..

No commits in common. "6e6f41f061cef96f09f0f1624e2da646941d1dda" and "2c0018fdb3577b68d79a49d6b5c5a15460d2d410" have entirely different histories.

52 changed files with 1462 additions and 1492 deletions

View File

@ -16,6 +16,14 @@ $ ./result/sw/bin/darwin-rebuild switch --flake .
main entry point and glue for submodules main entry point and glue for submodules
### default.nix
compatibility for legacy nix tooling, eg `nix-build`
### configs
non-nix configurations
### darwin ### darwin
[nix-darwin](https://github.com/LnL7/nix-darwin) specific configuration [nix-darwin](https://github.com/LnL7/nix-darwin) specific configuration

63
darwin/bootstrap.nix Normal file
View File

@ -0,0 +1,63 @@
{ config, pkgs, lib, ... }: {
# Nix configuration ------------------------------------------------------------------------------
nix.settings = {
trusted-substituters = [
"https://cache.nixos.org/"
"https://cache.iog.io"
"https://nix-community.cachix.org"
"https://mat.cachix.org"
"https://helix.cachix.org"
"https://pre-commit-hooks.cachix.org"
"https://iohk.cachix.org"
];
trusted-public-keys = [
"cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
"mat.cachix.org-1:AHqv9SoBEPKlJX2DDZQnjaMcvBAgpH1j8rw5USYDZno="
"helix.cachix.org-1:ejp9KQpR1FBI2onstMQ34yogDm4OgU2ru6lIwPvuCVs="
"pre-commit-hooks.cachix.org-1:Pkk3Panw5AW24TOv6kz3PvLhlH8puAsJTBbOPmBo7Rc="
"iohk.cachix.org-1:DpRUyj7h7V830dp/i6Nti+NEO2/nhblbov/8MW7Rqoo="
];
trusted-users = [ "@admin" ];
# TODO: remove and replace with a launchd job
# see https://github.com/NixOS/nix/issues/7273
auto-optimise-store = true;
experimental-features = [ "nix-command" "flakes" ];
extra-platforms = lib.mkIf (pkgs.system == "aarch64-darwin") [
"x86_64-darwin"
"aarch64-darwin"
];
};
nix.configureBuildUsers = true;
# Auto upgrade nix package and the daemon service.
services.nix-daemon.enable = true;
# Make Fish the default shell
environment.shells = lib.mkForce
(builtins.attrValues { inherit (pkgs) bashInteractive fish zsh; });
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
end
end
'';
environment.variables.SHELL = "/run/current-system/sw/bin/fish";
environment.loginShell = "/run/current-system/sw/bin/fish";
# Install and setup ZSH to work with nix(-darwin) as well
programs.zsh.enable = true;
# Used for backwards compatibility, please read the changelog before changing.
# $ darwin-rebuild changelog
system.stateVersion = 4;
}

View File

@ -1,22 +0,0 @@
{ self, config, ... }: {
flake.darwinModules = {
home = let inherit (config.users) me;
in {
home-manager.users.${me} = { imports = [ self.homeModules.darwin ]; };
users.users.${me} = {
name = me;
home = "/Users/${me}";
};
};
default.imports = [
self.darwinModules_.home-manager
self.darwinModules.home
self.nixosModules.common
./fish.nix
./fonts.nix
./homebrew.nix
./system-defaults.nix
];
};
}

50
darwin/defaults.nix Normal file
View File

@ -0,0 +1,50 @@
{
system.defaults.NSGlobalDomain = {
AppleInterfaceStyleSwitchesAutomatically = true;
NSAutomaticCapitalizationEnabled = false;
_HIHideMenuBar = false;
};
# Firewall
system.defaults.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;
};
# Finder
system.defaults.finder = {
AppleShowAllExtensions = true;
FXEnableExtensionChangeWarning = true;
};
# Login and lock screen
system.defaults.loginwindow = {
GuestEnabled = false;
DisableConsoleAccess = true;
};
# Spaces
system.defaults.spaces.spans-displays = false;
# Trackpad
system.defaults.trackpad = {
Clicking = true;
TrackpadRightClick = true;
TrackpadThreeFingerDrag = true;
};
}

View File

@ -1,18 +0,0 @@
{ config, pkgs, lib, ... }: {
environment.variables.SHELL = lib.getExe pkgs.fish;
environment.shells = [ pkgs.fish ];
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
'';
};
}

View File

@ -1,15 +0,0 @@
{ pkgs, ... }: {
fonts.fontDir.enable = true;
fonts.fonts = builtins.attrValues {
inherit (pkgs)
borg-sans-mono recursive recursive-patched
# code^
ia-writer-family ibm-plex
# hybrid^
inter source-sans-pro source-serif-pro
# display^
;
};
}

View File

@ -1,10 +0,0 @@
{
homebrew.casks = [
# games
"crossover"
"gog-galaxy"
"origin"
"sony-ps-remote-play"
"steam"
];
}

27
darwin/general.nix Normal file
View File

@ -0,0 +1,27 @@
{ pkgs, ... }:
{
environment.systemPackages = [ pkgs.terminal-notifier ];
# Fonts
fonts.fontDir.enable = true;
fonts.fonts = with pkgs; [
borg-sans-mono
cascadia-code
ia-writer-family
ibm-plex
inter
recursive
source-sans-pro
source-serif-pro
(nerdfonts.override { fonts = [ "CascadiaCode" ]; })
];
# Keyboard
# system.keyboard.enableKeyMapping = true;
# system.keyboard.remapCapsLockToEscape = true;
# Add ability to used TouchID for sudo authentication
security.pam.enableSudoTouchIdAuth = true;
}

View File

@ -1,12 +1,16 @@
{ flake, config, ... }: { { config, pkgs, lib, ... }:
# https://docs.brew.sh/Shell-Completion#configuring-completions-in-fish let
# for some reason if the Fish completions are added at the end of `fish_complete_path` they don't inherit (config.users) primaryUser;
# seem to work, but they do work if added at the start. caskPresent = cask: lib.any (x: x.name == cask) config.homebrew.casks;
programs.fish = { in {
shellInit = '' environment.shellInit = ''
eval "$(${config.homebrew.brewPrefix}/brew shellenv fish)" eval "$(${config.homebrew.brewPrefix}/brew shellenv fish)"
''; '';
interactiveShellInit = ''
# 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" if test -d (brew --prefix)"/share/fish/completions"
set -p fish_complete_path (brew --prefix)/share/fish/completions set -p fish_complete_path (brew --prefix)/share/fish/completions
end end
@ -14,71 +18,93 @@
set -p fish_complete_path (brew --prefix)/share/fish/vendor_completions.d set -p fish_complete_path (brew --prefix)/share/fish/vendor_completions.d
end end
''; '';
};
homebrew = { homebrew.enable = pkgs.lib.homebrew-enabled;
enable = flake.inputs.homebrew-enabled.value; homebrew.onActivation.autoUpdate = true;
onActivation.autoUpdate = true; homebrew.onActivation.upgrade = true;
onActivation.upgrade = true; # TODO: open an issue to have this make backup folders?
onActivation.cleanup = "uninstall"; # homebrew.onActivation.cleanup = "zap";
global.brewfile = true; homebrew.onActivation.cleanup = "uninstall";
homebrew.global.brewfile = true;
taps = [ "homebrew/cask-versions" "homebrew/services" ]; homebrew.taps = [
"homebrew/cask-versions"
"homebrew/services"
"nrlquaker/createzap"
"unisonweb/unison"
];
masApps = { homebrew.masApps = {
Bitwarden = 1352778147; Bitwarden = 1352778147;
"Draw Things" = 6444050820; "Draw Things" = 6444050820;
GrandPerspective = 1111570163; GrandPerspective = 1111570163;
Reeder = 1529448980; Reeder = 1529448980;
Spark = 1176895641;
Tailscale = 1475387142; Tailscale = 1475387142;
Xcode = 497799835; Xcode = 497799835;
}; };
caskArgs.no_quarantine = true; # If an app isn't available in the Mac App Store, or the version in the App Store has
casks = [ # limitiations, e.g., Transmit, install the Homebrew Cask.
# system tools homebrew.caskArgs.no_quarantine = true;
homebrew.casks = [
"alfred" "alfred"
# "bartender" -> dozer "anytype"
"arc"
# "bartender"
# "discord"
"dozer" "dozer"
"firefox"
"hazeover"
"jitsi-meet"
"knockknock" "knockknock"
"krita"
# "lagrange"
"lapce"
"logi-options-plus"
"lulu" "lulu"
"macsvg"
"messenger"
"nova"
# "obsidian"
"orion"
"protonvpn" "protonvpn"
"qflipper"
"rectangle" "rectangle"
"remarkable"
"secretive" "secretive"
"shortcat" "shortcat"
"stay"
"utm"
# "tools for thought"
"anytype"
"obsidian"
# design
"krita"
"macsvg"
# browsers
"arc"
"firefox"
"orion"
# messaging apps
"messenger"
"signal" "signal"
# "slack"
# editors and IDEs "stay"
"lapce" "transmission-remote-gui"
"zed" "utm"
# terminal emulators
"kitty"
"warp"
# peripheral tools
"logi-options-plus"
"qflipper"
"remarkable"
"via" "via"
# "wacom-tablet"
# "zoom"
]; ];
home-manager.users.${primaryUser.username} = let
socket =
"${primaryUser.homeDirectory}/Library/Containers/com.maxgoedjen.Secretive.SecretAgent/Data/socket.ssh";
in lib.mkIf (caskPresent "secretive" && config ? home-manager) {
home.sessionVariables.SSH_AUTH_SOCK = socket;
programs.ssh = {
enable = true;
matchBlocks."*".extraOptions = { IdentityAgent = socket; };
}; };
};
# For cli packages that aren't currently available for macOS in `nixpkgs`.Packages should be
# installed in `../home/programs.nix` whenever possible.
homebrew.brews = [
"ffmpeg"
"fileicon"
"fzf"
"gifsicle"
"netlify-cli"
"tarsnap"
"unison-language"
"yarn"
];
} }

View File

@ -1,47 +0,0 @@
{
system.defaults = {
NSGlobalDomain = {
AppleInterfaceStyleSwitchesAutomatically = true;
NSAutomaticCapitalizationEnabled = false;
_HIHideMenuBar = false;
};
# firewall
alf = {
globalstate = 1;
allowsignedenabled = 1;
allowdownloadsignedenabled = 1;
stealthenabled = 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 = {
AppleShowAllExtensions = true;
FXEnableExtensionChangeWarning = true;
};
loginwindow = {
GuestEnabled = false;
DisableConsoleAccess = true;
};
spaces.spans-displays = false;
trackpad = {
Clicking = true;
TrackpadRightClick = true;
TrackpadThreeFingerDrag = true;
};
};
}

7
default.nix Normal file
View File

@ -0,0 +1,7 @@
# See https://nixos.wiki/wiki/Flakes#Using_flakes_project_from_a_legacy_Nix
(import (let lock = builtins.fromJSON (builtins.readFile ./flake.lock);
in fetchTarball {
url =
"https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz";
sha256 = lock.nodes.flake-compat.locked.narHash;
}) { src = ./.; }).defaultNix

View File

@ -46,119 +46,40 @@
"type": "github" "type": "github"
} }
}, },
"disko": { "darwin": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [
"nixpkgs" "nixpkgs"
] ]
}, },
"locked": { "locked": {
"lastModified": 1698422527, "lastModified": 1696043447,
"narHash": "sha256-SDu3Xg263t3oXIyTaH0buOvFnKIDeZsvKDBtOz+jRbs=", "narHash": "sha256-VbJ1dY5pVH2fX1bS+cT2+4+BYEk4lMHRP0+udu9G6tk=",
"owner": "nix-community", "owner": "lnl7",
"repo": "disko", "repo": "nix-darwin",
"rev": "944d338d24a9d043a3f7461c30ee6cfe4f9cca30", "rev": "792c2e01347cb1b2e7ec84a1ef73453ca86537d8",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "nix-community", "owner": "lnl7",
"repo": "disko", "ref": "master",
"repo": "nix-darwin",
"type": "github" "type": "github"
} }
}, },
"fish-plugin-autopair": { "fisher-src": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1656950411, "lastModified": 1692640630,
"narHash": "sha256-qt3t1iKRRNuiLWiVoiAYOu+9E7jsyECyIqZJ/oRIT1A=", "narHash": "sha256-e8gIaVbuUzTwKtuMPNXBT5STeddYqQegduWBtURLT3M=",
"owner": "jorgebucaran", "owner": "jorgebucaran",
"repo": "autopair.fish", "repo": "fisher",
"rev": "4d1752ff5b39819ab58d7337c69220342e9de0e2", "rev": "2efd33ccd0777ece3f58895a093f32932bd377b6",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "jorgebucaran", "owner": "jorgebucaran",
"repo": "autopair.fish", "repo": "fisher",
"type": "github"
}
},
"fish-plugin-colored-man-pages": {
"flake": false,
"locked": {
"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": "replay.fish",
"rev": "bd8e5b89ec78313538e747f0292fcaf631e87bd2",
"type": "github"
},
"original": {
"owner": "jorgebucaran",
"repo": "replay.fish",
"type": "github" "type": "github"
} }
}, },
@ -194,64 +115,10 @@
"type": "github" "type": "github"
} }
}, },
"flake-parts": {
"inputs": {
"nixpkgs-lib": "nixpkgs-lib"
},
"locked": {
"lastModified": 1698882062,
"narHash": "sha256-HkhafUayIqxXyHH1X8d9RDl1M2CkFgZLjKD3MzabiEo=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "8c9fa2545007b49a5db5f650ae91f227672c3877",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "flake-parts",
"type": "github"
}
},
"flake-parts_2": {
"inputs": {
"nixpkgs-lib": "nixpkgs-lib_2"
},
"locked": {
"lastModified": 1685662779,
"narHash": "sha256-cKDDciXGpMEjP1n6HlzKinN0H+oLmNpgeCTzYnsA2po=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "71fb97f0d875fd4de4994dfb849f2c75e17eb6c3",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "flake-parts",
"type": "github"
}
},
"flake-utils": { "flake-utils": {
"inputs": { "inputs": {
"systems": "systems" "systems": "systems"
}, },
"locked": {
"lastModified": 1689068808,
"narHash": "sha256-6ixXo3wt24N/melDWjq70UuHQLxGV8jZvooRanIHXw0=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "919d646de7be200f3bf08cb76ae1f09402b6f9b4",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils_2": {
"inputs": {
"systems": "systems_2"
},
"locked": { "locked": {
"lastModified": 1694529238, "lastModified": 1694529238,
"narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=", "narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=",
@ -266,16 +133,16 @@
"type": "github" "type": "github"
} }
}, },
"flake-utils_3": { "flake-utils_2": {
"inputs": { "inputs": {
"systems": "systems_3" "systems": "systems_2"
}, },
"locked": { "locked": {
"lastModified": 1685518550, "lastModified": 1689068808,
"narHash": "sha256-o2d0KcvaXzTrPRIo0kOLV0/QXHhDQ5DTi+OxcjO8xqY=", "narHash": "sha256-6ixXo3wt24N/melDWjq70UuHQLxGV8jZvooRanIHXw0=",
"owner": "numtide", "owner": "numtide",
"repo": "flake-utils", "repo": "flake-utils",
"rev": "a1720a10a6cfe8234c0e93907ffe81be440f4cef", "rev": "919d646de7be200f3bf08cb76ae1f09402b6f9b4",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -284,21 +151,6 @@
"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": [
@ -323,18 +175,18 @@
"helix": { "helix": {
"inputs": { "inputs": {
"crane": "crane", "crane": "crane",
"flake-utils": "flake-utils", "flake-utils": "flake-utils_2",
"nixpkgs": [ "nixpkgs": [
"nixpkgs" "nixpkgs"
], ],
"rust-overlay": "rust-overlay" "rust-overlay": "rust-overlay"
}, },
"locked": { "locked": {
"lastModified": 1698790188, "lastModified": 1696255829,
"narHash": "sha256-sAp4RIto3fDjb/HJ4NR3HlHo3J8R7tK4/qSGYkhudUA=", "narHash": "sha256-5XId/8r09qEAyBI8lFq0qpVsEvtdDl6gHkBHmhp/sMA=",
"owner": "helix-editor", "owner": "helix-editor",
"repo": "helix", "repo": "helix",
"rev": "a069b928973aad99b85dffb9d5ade7dae4b58c43", "rev": "7fbfec766c2ce2570ca4160744723813dbdc3019",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -350,11 +202,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1698873617, "lastModified": 1696145345,
"narHash": "sha256-FfGFcfbULwbK1vD+H0rslIOfmy4g8f2hXiPkQG3ZCTk=", "narHash": "sha256-3dM7I/d4751SLPJah0to1WBlWiyzIiuCEUwJqwBdmr4=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "48b0a30202516e25d9885525fbb200a045f23f26", "rev": "6f9b5b83ad1f470b3d11b8a9fe1d5ef68c7d0e30",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -394,92 +246,45 @@
"type": "github" "type": "github"
} }
}, },
"nil": { "kitty-icon": {
"inputs": { "flake": false,
"flake-utils": "flake-utils_2",
"nixpkgs": [
"nixpkgs"
],
"rust-overlay": "rust-overlay_2"
},
"locked": { "locked": {
"lastModified": 1697710615, "lastModified": 1659349637,
"narHash": "sha256-YL63eoy3C/WeDxwctbv9dJBjqBabx8cO7lVTlVn3FVI=", "narHash": "sha256-Vy+iLGnysrJMSLfkaYq15pb/wG4kIbfsXRrPgSc3OFs=",
"owner": "oxalica", "owner": "DinkDonk",
"repo": "nil", "repo": "kitty-icon",
"rev": "bd93024db616a528473a7210d2756c7118155de9", "rev": "269c0f0bd1c792cebc7821f299ce9250ed9bcd67",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "oxalica", "owner": "DinkDonk",
"repo": "nil", "repo": "kitty-icon",
"type": "github" "type": "github"
} }
}, },
"nix-darwin": { "kitty-themes": {
"inputs": { "flake": false,
"nixpkgs": [
"nixpkgs"
]
},
"locked": { "locked": {
"lastModified": 1698429334, "lastModified": 1694832264,
"narHash": "sha256-Gq3+QabboczSu7RMpcy79RSLMSqnySO3wsnHQk4DfbE=", "narHash": "sha256-dhzYTHaaTrbE5k+xEC01Y9jGb+ZmEyvWMb4a2WWKGCw=",
"owner": "lnl7", "owner": "kovidgoyal",
"repo": "nix-darwin", "repo": "kitty-themes",
"rev": "afe83cbc2e673b1f08d32dd0f70df599678ff1e7", "rev": "c9c12d20f83b9536febb21e4b53e176c0ccccb51",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "lnl7", "owner": "kovidgoyal",
"ref": "master", "repo": "kitty-themes",
"repo": "nix-darwin",
"type": "github"
}
},
"nixd": {
"inputs": {
"flake-parts": "flake-parts_2",
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1697038389,
"narHash": "sha256-hbzFPXyQQxJObRdb+CsylUXii29UfFV7866WWgWYs6Y=",
"owner": "nix-community",
"repo": "nixd",
"rev": "29904e121cc775e7caaf4fffa6bc7da09376a43b",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "nixd",
"type": "github"
}
},
"nixos-flake": {
"locked": {
"lastModified": 1698598244,
"narHash": "sha256-YbvPFt+9CbCiqnuS0dTx+P+W1YRCqzhLXen94sef3Kk=",
"owner": "srid",
"repo": "nixos-flake",
"rev": "f6b7757ad88483afca306c9f3bf387887fba7284",
"type": "github"
},
"original": {
"owner": "srid",
"repo": "nixos-flake",
"type": "github" "type": "github"
} }
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1698890957, "lastModified": 1696234590,
"narHash": "sha256-DJ+SppjpPBoJr0Aro9TAcP3sxApCSieY6BYBCoWGUX8=", "narHash": "sha256-mgOzQYTvaTT4bFopVOadlndy2RPwLy60rDjIWOGujwo=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "c082856b850ec60cda9f0a0db2bc7bd8900d708c", "rev": "f902cb49892d300ff15cb237e48aa1cad79d68c3",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -489,54 +294,34 @@
"type": "github" "type": "github"
} }
}, },
"nixpkgs-lib": { "nixpkgs-master": {
"locked": { "locked": {
"dir": "lib", "lastModified": 1696285335,
"lastModified": 1698611440, "narHash": "sha256-dsu/cEULkVLa4u5BEw/ScCsWqN8zTUUk2o02YOb+Y+c=",
"narHash": "sha256-jPjHjrerhYDy3q9+s5EAsuhyhuknNfowY6yt6pjn9pc=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "0cbe9f69c234a7700596e943bfae7ef27a31b735", "rev": "2e8f277e5252b44d8b6f5c3e16335d8d543b50bf",
"type": "github" "type": "github"
}, },
"original": { "original": {
"dir": "lib",
"owner": "NixOS", "owner": "NixOS",
"ref": "nixos-unstable", "ref": "master",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs-lib_2": {
"locked": {
"dir": "lib",
"lastModified": 1685564631,
"narHash": "sha256-8ywr3AkblY4++3lIVxmrWZFzac7+f32ZEhH/A8pNscI=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "4f53efe34b3a8877ac923b9350c874e3dcd5dc0a",
"type": "github"
},
"original": {
"dir": "lib",
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs", "repo": "nixpkgs",
"type": "github" "type": "github"
} }
}, },
"nixpkgs-stable": { "nixpkgs-stable": {
"locked": { "locked": {
"lastModified": 1685801374, "lastModified": 1688392541,
"narHash": "sha256-otaSUoFEMM+LjBI1XL/xGB5ao6IwnZOXc47qhIgJe8U=", "narHash": "sha256-lHrKvEkCPTUO+7tPfjIcb7Trk6k31rz18vkyqmkeJfY=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "c37ca420157f4abc31e26f436c1145f8951ff373", "rev": "ea4c80b39be4c09702b0cb3b42eab59e2ba4f24b",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "NixOS", "owner": "NixOS",
"ref": "nixos-23.05", "ref": "nixpkgs-22.11-darwin",
"repo": "nixpkgs", "repo": "nixpkgs",
"type": "github" "type": "github"
} }
@ -544,19 +329,23 @@
"pre-commit": { "pre-commit": {
"inputs": { "inputs": {
"flake-compat": "flake-compat_2", "flake-compat": "flake-compat_2",
"flake-utils": "flake-utils_3", "flake-utils": [
"flake-utils"
],
"gitignore": "gitignore", "gitignore": "gitignore",
"nixpkgs": [ "nixpkgs": [
"nixpkgs" "nixpkgs"
], ],
"nixpkgs-stable": "nixpkgs-stable" "nixpkgs-stable": [
"nixpkgs-stable"
]
}, },
"locked": { "locked": {
"lastModified": 1698852633, "lastModified": 1696158581,
"narHash": "sha256-Hsc/cCHud8ZXLvmm8pxrXpuaPEeNaaUttaCvtdX/Wug=", "narHash": "sha256-h0vY4E7Lx95lpYQbG2w4QH4yG5wCYOvPJzK93wVQbT0=",
"owner": "cachix", "owner": "cachix",
"repo": "pre-commit-hooks.nix", "repo": "pre-commit-hooks.nix",
"rev": "dec10399e5b56aa95fcd530e0338be72ad6462a0", "rev": "033453f85064ccac434dfd957f95d8457901ecd6",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -568,27 +357,20 @@
"root": { "root": {
"inputs": { "inputs": {
"dark-mode-notify-src": "dark-mode-notify-src", "dark-mode-notify-src": "dark-mode-notify-src",
"disko": "disko", "darwin": "darwin",
"fish-plugin-autopair": "fish-plugin-autopair", "fisher-src": "fisher-src",
"fish-plugin-colored-man-pages": "fish-plugin-colored-man-pages", "flake-utils": "flake-utils",
"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", "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",
"nil": "nil", "kitty-icon": "kitty-icon",
"nix-darwin": "nix-darwin", "kitty-themes": "kitty-themes",
"nixd": "nixd",
"nixos-flake": "nixos-flake",
"nixpkgs": "nixpkgs", "nixpkgs": "nixpkgs",
"nixpkgs-master": "nixpkgs-master",
"nixpkgs-stable": "nixpkgs-stable",
"pre-commit": "pre-commit", "pre-commit": "pre-commit",
"starship-src": "starship-src", "starship-src": "starship-src"
"terminal-themes": "terminal-themes"
} }
}, },
"rust-overlay": { "rust-overlay": {
@ -616,39 +398,14 @@
"type": "github" "type": "github"
} }
}, },
"rust-overlay_2": {
"inputs": {
"flake-utils": [
"nil",
"flake-utils"
],
"nixpkgs": [
"nil",
"nixpkgs"
]
},
"locked": {
"lastModified": 1696817516,
"narHash": "sha256-Xt9OY4Wnk9/vuUfA0OHFtmSlaen5GyiS9msgwOz3okI=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "c0df7f2a856b5ff27a3ce314f6d7aacf5fda546f",
"type": "github"
},
"original": {
"owner": "oxalica",
"repo": "rust-overlay",
"type": "github"
}
},
"starship-src": { "starship-src": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1698919886, "lastModified": 1696143619,
"narHash": "sha256-rV1Sf5MbmHVn8sUEn07STsSdXoPZClTqGp3Tmkvp1+0=", "narHash": "sha256-3YcmrAdrCXU3NZ82swMVL4uhRzM17e9IbLrFeke+6ak=",
"owner": "starship", "owner": "starship",
"repo": "starship", "repo": "starship",
"rev": "6abc83decdf176842985b4daa5b09771c6b93415", "rev": "7e82cb494c540c7a88cf126ec80aeb0f7ce611bc",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -686,37 +443,6 @@
"repo": "default", "repo": "default",
"type": "github" "type": "github"
} }
},
"systems_3": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"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", "root": "root",

326
flake.nix
View File

@ -2,142 +2,254 @@
description = "mat's nix configs"; description = "mat's nix configs";
inputs = { inputs = {
# base inputs # Package sets
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-parts.url = "github:hercules-ci/flake-parts"; nixpkgs-stable.url = "github:NixOS/nixpkgs/nixpkgs-22.11-darwin";
nix-darwin.url = "github:lnl7/nix-darwin/master"; nixpkgs-master.url = "github:NixOS/nixpkgs/master";
nix-darwin.inputs.nixpkgs.follows = "nixpkgs";
# Flake helpers
flake-utils.url = "github:numtide/flake-utils";
# Environment/system management
darwin.url = "github:lnl7/nix-darwin/master";
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: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 # Config "flag" for disabling homebrew
# https://www.mat.services/posts/command-line-flake-arguments/
homebrew-enabled.url = "github:boolean-option/true"; homebrew-enabled.url = "github:boolean-option/true";
# command line text editor # pre-commit and hooks
pre-commit.url = "github:cachix/pre-commit-hooks.nix";
pre-commit.inputs.nixpkgs.follows = "nixpkgs";
pre-commit.inputs.nixpkgs-stable.follows = "nixpkgs-stable";
pre-commit.inputs.flake-utils.follows = "flake-utils";
# Extra sources
helix.url = "github:helix-editor/helix"; helix.url = "github:helix-editor/helix";
helix.inputs.nixpkgs.follows = "nixpkgs"; helix.inputs.nixpkgs.follows = "nixpkgs";
# nix language servers
nil.url = "github:oxalica/nil";
nil.inputs.nixpkgs.follows = "nixpkgs";
nixd.url = "github:nix-community/nixd";
nixd.inputs.nixpkgs.follows = "nixpkgs";
# trigger some action when switching between dark and light mode on macOS
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;
# 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;
kitty-icon.url = "github:DinkDonk/kitty-icon";
# standard kitty terminal themes kitty-icon.flake = false;
terminal-themes.url = "github:mbadolato/iTerm2-Color-Schemes"; kitty-themes.url = "github:kovidgoyal/kitty-themes";
terminal-themes.flake = false; kitty-themes.flake = false;
fisher-src.url = "github:jorgebucaran/fisher";
# shell prompt fisher-src.flake = false;
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-utils, pre-commit, ... }@inputs:
flake-parts.lib.mkFlake { inherit inputs; } { let
systems = [ "aarch64-darwin" "aarch64-linux" ]; # this is a "functor" that takes an option name
imports = [ # this allows for creating identical modules
inputs.nixos-flake.flakeModule # which can be accessed by appropriate paths darwin or home-manager
inputs.pre-commit.flakeModule mkPrimaryUserModule = import ./modules/mk-primary-user-module.nix;
./darwin
./home inherit (inputs.darwin.lib) darwinSystem;
./nixos inherit (inputs.nixpkgs.lib) attrValues makeOverridable optionalAttrs;
./templates
./users # Configuration for `nixpkgs`
]; nixpkgsConfig = {
flake = { config = { allowUnfree = true; };
nixosConfigurations = { overlays = attrValues self.overlays;
# pihole = self.nixos-flake.lib.mkLinuxSystem {
# nixpkgs.hostPlatform = "aarch64-linux";
# imports = [ self.nixosModules.default ./systems/nixos/pihole.nix ];
# };
}; };
darwinConfigurations = { homeStateVersion = "22.05";
matbook = self.nixos-flake.lib.mkMacosSystem {
nixpkgs.hostPlatform = "aarch64-darwin"; primaryUserInfo = {
imports = [ username = "mat";
self.darwinModules.default fullName = "mat ess";
./darwin/games.nix email = "mat@mat.services";
./systems/darwin/m1.nix
];
}; };
yelpbook-m1 = self.nixos-flake.lib.mkMacosSystem { workUserInfo = {
nixpkgs.hostPlatform = "aarch64-darwin"; username = "mess";
users.me = "mess"; fullName = "Matthew Ess";
imports = [ email = "mess@yelp.com";
self.darwinModules.default
./systems/darwin/m1.nix
./systems/darwin/work.nix
];
}; };
};
}; # helper for defining nix-darwin systems
perSystem = { self', pkgs, config, ... }: mkDarwinSystem = { modules ? [ ], homeModules ? [ ], ... }@args:
# formatter for this flake import ./lib/mkDarwinSystem.nix self inputs nixpkgsConfig (args // {
let formatter = pkgs.nixfmt; inherit homeStateVersion;
modules = attrValues self.darwinModules ++ modules;
homeModules = attrValues self.homeManagerModules ++ homeModules;
});
in { in {
# controls which flake inputs are updated by `nix run .#update` # `nix-darwin` configs
nixos-flake.primary-inputs = [ darwinConfigurations = let
# system inputs bootstrap-x86 = makeOverridable darwinSystem {
"nixpkgs" system = "x86_64-darwin";
"flake-parts" modules = [ ./darwin/bootstrap.nix { nixpkgs = nixpkgsConfig; } ];
"nix-darwin" };
"home-manager" in {
"nixos-flake" # Mininal configurations to bootstrap systems
# package inputs inherit bootstrap-x86;
"helix" bootstrap-arm = bootstrap-x86.override { system = "aarch64-darwin"; };
"nil"
"nixd"
];
# pre-commit hook configuration # M1 MBP
pre-commit.settings.hooks = { matbook = mkDarwinSystem {
primaryUser = primaryUserInfo;
modules = [{
networking.computerName = "matbook pro m1";
networking.hostName = "matbook";
networking.knownNetworkServices = [ "Wi-Fi" ];
nix.settings.cores = 2;
nix.settings.max-jobs = 4;
homebrew.casks = [
# games
"gog-galaxy"
"origin"
"sony-ps-remote-play"
"steam"
];
home-manager.sharedModules = [{
programs.ssh.matchBlocks.remarkable = {
hostname = "10.11.99.1";
user = "root";
port = 22;
};
}];
}];
};
yelpbook-m1 = mkDarwinSystem {
primaryUser = workUserInfo;
modules = [
({ pkgs, lib, ... }: {
users.primaryUser = workUserInfo;
networking.knownNetworkServices = [ "Wi-Fi" ];
nix.settings.cores = 2;
nix.settings.max-jobs = 5;
homebrew.casks = [ "itsycal" ];
home-manager.sharedModules = [{
# TODO: how to remove this entirely?
home.file.".tarsnaprc" = lib.mkForce { text = ""; };
launchd.agents.tarsnap.enable = lib.mkForce false;
home.packages = [ pkgs.yubiswitch ];
programs.ssh.matchBlocks.devbox = {
hostname = "csdev6";
forwardAgent = true;
serverAliveInterval = 120;
};
programs.fish.functions.devbox.body = ''
ssh -t devbox "agenttmux attach; or agenttmux new -s yelp"
'';
# vscode is managed externally at work
programs.vscode.enable = lib.mkForce false;
}];
})
];
};
};
# Overlays --------------------------------------------------------------- {{{
overlays = {
# nixpkgs overlays
pkgs-stable = _: prev: {
pkgs-stable = import inputs.nixpkgs-stable {
inherit (prev.stdenv) system;
inherit (nixpkgsConfig) config;
};
};
pkgs-unstable = _: prev: {
pkgs-unstable = import inputs.nixpkgs {
inherit (prev.stdenv) system;
inherit (nixpkgsConfig) config;
};
};
pkgs-master = _: prev: {
pkgs-master = import inputs.nixpkgs-master {
inherit (prev.stdenv) system;
inherit (nixpkgsConfig) config;
};
};
colors = import ./overlays/colors.nix;
# Overlay useful on Macs with Apple Silicon
apple-silicon = _: prev:
optionalAttrs (prev.stdenv.system == "aarch64-darwin") {
# Add access to x86 packages system is running Apple Silicon
pkgs-x86 = import inputs.nixpkgs {
system = "x86_64-darwin";
inherit (nixpkgsConfig) config;
};
};
homebrew-enabled = _: prev:
optionalAttrs prev.stdenv.isDarwin {
lib = prev.lib // {
homebrew-enabled = inputs.homebrew-enabled.value;
};
};
extra-pkgs = import ./pkgs { inherit inputs; };
};
# `nix-darwin` configs and modules
darwinModules = {
# configs
bootstrap = import ./darwin/bootstrap.nix;
defaults = import ./darwin/defaults.nix;
general = import ./darwin/general.nix;
homebrew = import ./darwin/homebrew.nix;
# modules
darwin-primary-user = mkPrimaryUserModule "users";
};
# home manager configurations
homeManagerModules = {
# services
dark-mode-notify-service = import ./home/services/dark-mode-notify.nix;
tarsnap-service = import ./home/services/tarsnap.nix;
# etc
files = import ./home/files.nix;
fish = import ./home/fish.nix;
git = import ./home/git.nix;
helix = import ./home/helix.nix;
kitty = import ./home/kitty.nix;
programs = import ./home/programs.nix;
starship = import ./home/starship.nix;
starship-symbols = import ./home/starship-symbols.nix;
# modules
programs-kakoune-extras =
import ./modules/home/programs/kakoune/extras.nix; # currently unused
programs-helix-extras = import ./modules/home/programs/helix/extras.nix;
programs-kitty-extras = import ./modules/home/programs/kitty/extras.nix;
home-primary-user = mkPrimaryUserModule "home";
};
templates = import ./templates;
} // flake-utils.lib.eachDefaultSystem (system: {
legacyPackages =
import inputs.nixpkgs (nixpkgsConfig // { inherit system; });
checks.pre-commit = pre-commit.lib.${system}.run {
src = ./.;
hooks = {
deadnix.enable = true; deadnix.enable = true;
nil.enable = true; nil.enable = true;
nixfmt.enable = true; nixfmt.enable = true;
statix.enable = true; statix.enable = true;
}; };
};
packages.default = self'.packages.activate; devShells = let pkgs = self.legacyPackages.${system};
devShells.default = pkgs.mkShell { in {
shellHook = '' default = pkgs.mkShell {
${config.pre-commit.installationScript} inherit (self.checks.${system}.pre-commit) shellHook;
echo 1>&2 "\(^^)/ welcome to the flake \(^^)/"
'';
buildInputs = [ formatter ];
};
inherit formatter;
}; };
# TODO: add utility devShells here
}; };
});
} }

View File

@ -1,30 +0,0 @@
{ self, ... }: {
flake.homeModules = {
common = {
home.enableNixpkgsReleaseCheck = true;
home.stateVersion = "22.05";
imports = [
# misc file configuration
./files.nix
# misc program configuration
./programs.nix
# per-program configurations
./fish.nix
./ghostty.nix
./git.nix
./helix.nix
./kitty.nix
./pijul.nix
./ssh.nix
# ./starship-symbols.nix
./starship.nix
];
};
linux.imports = [ self.homeModules.common ];
darwin.imports = [
self.homeModules.common
./services/dark-mode-notify.nix
./services/tarsnap.nix
];
};
}

View File

@ -1,77 +0,0 @@
{ config, pkgs, lib, ... }:
let
cfg = config.programs.kitty;
# helper scripts for changing kitty colors
term-background = pkgs.writeShellScriptBin "term-background" ''
# Accepts the name of a theme file in color-pkg
# 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.colors-path}/"$1".conf &
fi
'';
term-light = pkgs.writeShellScriptBin "term-light" ''
${term-background}/bin/term-background ${cfg.colors.light-name}
'';
term-dark = pkgs.writeShellScriptBin "term-dark" ''
${term-background}/bin/term-background ${cfg.colors.dark-name}
'';
in {
options.programs.kitty = {
colors = {
enable = lib.mkOption {
type = lib.types.bool;
default = false;
description = ''
When enabled, commands <command>term-dark</command> and <command>term-light</command>
will toggle between your dark and a light colors.
There is also <command>term-background</command> which accepts one argument, the name
of the theme.
(Note that the Kitty setting <literal>allow_remote_control = true</literal> is set to
enable this functionality.)
'';
};
colors-path = lib.mkOption {
type = lib.types.path;
default = "${pkgs.terminal-colors}/kitty";
description = "Path from which to load kitty colors.";
};
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 = lib.mkOption {
type = lib.types.str;
default = "dark";
description = "The name to use for the dark colorscheme.";
};
};
};
config = lib.mkIf (cfg.enable && cfg.colors.enable) {
home.packages = [ term-light term-dark term-background ];
programs.kitty.settings = {
allow_remote_control = "yes";
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,26 +0,0 @@
{ config, lib, ... }:
let cfg = config.programs.kitty;
in {
options.programs.kitty = {
useSymbolsFromNerdFont = lib.mkOption {
type = lib.types.str;
default = "";
example = "JetBrainsMono Nerd Font";
description = ''
NerdFont patched fonts frequently suffer from rendering issues in terminals. To mitigate
this, we can use a non-NerdFont with Kitty and use the <literal>symbol_map</literal> setting
to tell Kitty to only use a NerdFont for NerdFont symbols.
Set this option the name of an installed NerdFont (the same name you'd use in the
<literal>font_family</literal> setting), to enable this feature.
'';
};
};
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 +1,23 @@
{ xdg.enable = true; } { config, ... }: {
# Misc configuration files --------------------------------------------------------------------{{{
xdg = { enable = true; };
home.file = {
".pijulconfig".text = ''
[author]
name = "${config.home.primaryUser.username}"
full_name = "${config.home.primaryUser.fullName}"
email = "${config.home.primaryUser.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,14 +1,30 @@
{ pkgs, lib, ... }: { config, pkgs, lib, ... }:
let nixConfigDirectory = "~/dotfiles.nix";
in {
programs.fish = {
enable = true;
# see flake.nix and pkgs/default.nix {
plugins = pkgs.fishPlugins.flakePlugins; # Fish Shell
# https://rycee.gitlab.io/home-manager/options.html#opt-programs.fish.enable
programs.fish.enable = true;
functions = { # Add Fish plugins
# user functions home.packages = builtins.attrValues {
inherit (pkgs.fishPlugins) autopair-fish colored-man-pages done;
};
programs.fish.plugins = [ pkgs.fishPlugins.fisher ];
xdg.configFile."fish/fish_plugins".text = ''
jorgebucaran/replay.fish
americanhanko/fish-spin
joseluisq/gitnow
fishpkg/fish-humanize-duration
oh-my-fish/plugin-bang-bang
matthewess/fish-autovenv
Gazorby/fish-abbreviation-tips
'';
# Fish functions ----------------------------------------------------------------------------- {{{
programs.fish.functions = {
# User functions
mkdcd = { mkdcd = {
argumentNames = [ "target" ]; argumentNames = [ "target" ];
body = '' body = ''
@ -20,6 +36,69 @@ in {
cd $target cd $target
''; '';
}; };
unz = {
argumentNames = [ "target" ];
body = ''
# strip extensions
string match \*.zip $target; and set target (string split -r -m1 . $target)[1]
unzip -d $target $target
'';
};
# Helpers
# 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. 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.
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
case 0
echo "Setting light mode"
set -U term_background light
end
'';
};
# Sets Fish Shell 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";
};
from-dir = { from-dir = {
argumentNames = [ "dir" ]; argumentNames = [ "dir" ];
@ -41,81 +120,23 @@ in {
''; '';
}; };
# TODO: use these to implement !! and .. abbreviations nix-unfree = {
# blocked on additional support for abbr in home-manager argumentNames = [ "cmd" ];
# 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
'';
# 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 = '' body = ''
switch $$env_var env NIX_ALLOW_UNFREE=1 nix $cmd --impure
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 = { # Fish configuration ------------------------------------------------------------------------- {{{
".." = "cd ..";
# Aliases
programs.fish.shellAliases =
let inherit (config.home.primaryUser) nixConfigDirectory;
in {
# Nix related
from-nix = "from-dir ${nixConfigDirectory}";
# darwin-rebuild build # darwin-rebuild build
drb = "from-nix darwin-rebuild build --flake ."; drb = "from-nix darwin-rebuild build --flake .";
# darwin-rebuild switch full # darwin-rebuild switch full
@ -123,57 +144,60 @@ in {
# darwin-rebuild switch (no homebrew) # darwin-rebuild switch (no homebrew)
drs = drs =
"from-nix darwin-rebuild switch --flake . --override-input homebrew-enabled github:boolean-option/false"; "from-nix darwin-rebuild switch --flake . --override-input homebrew-enabled github:boolean-option/false";
# edit darwin-rebuild config in code/codium
drc = "code ${nixConfigDirectory}";
# edit darwin-rebuild config in vim
drv = "vim ${nixConfigDirectory}";
# edit darwin-rebuild config in helix # edit darwin-rebuild config in helix
drh = "darwin-rebuild-edit-with hx"; drh = "darwin-rebuild-edit-with hx";
# edit darwin-rebuild config in zed flakeup = "nix flake update ${nixConfigDirectory}/";
drz = "zed ${nixConfigDirectory}";
nb = "nix build"; nb = "nix build";
nd = "nix develop"; nd = "nix develop";
nf = "nix flake"; nf = "nix flake";
nfc = "nix flake check";
nfi = "nix flake init";
nfs = "nix flake show";
nfu = "nix flake update";
nr = "nix run"; nr = "nix run";
nru = "nix-unfree run";
ns = "nix search nixpkgs"; ns = "nix search nixpkgs";
nsh = "nix shell"; nsh = "nix shell";
nshu = "nix-unfree shell";
nrp = "nix repl --expr '{ pkgs = (import <nixpkgs> { }); }'"; nrp = "nix repl --expr '{ pkgs = (import <nixpkgs> { }); }'";
g = "git"; nrpu =
stage = "git add ."; "nix repl --expr '{ pkgs = (import <nixpkgs> { config.allowUnfree = true; }); }' --impure";
commit = "git commit";
push = "git push"; # Other
} // lib.optionalAttrs pkgs.stdenv.isDarwin { ".." = "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";
tb = "toggle-background"; tb = "toggle-background";
colortest = "${pkgs.terminal-colors}/bin/terminal-colors -o";
} // lib.optionalAttrs pkgs.stdenv.isDarwin {
sb = "set-background-to-macOS"; sb = "set-background-to-macOS";
}; };
shellAliases = { # Configuration that should be above `loginShellInit` and `interactiveShellInit`.
# nix related programs.fish.shellInit = ''
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 set -U fish_term24bit 1
${lib.optionalString pkgs.stdenv.isDarwin "set-background-to-macOS"} ${lib.optionalString pkgs.stdenv.isDarwin "set-background-to-macOS"}
''; '';
interactiveShellInit = '' programs.fish.interactiveShellInit = ''
set -g fish_greeting (set_color red)"( ³)"(set_color yellow)" hello "(set_color blue)"( ³)"(set_color normal) 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 fish_vi_key_bindings
${lib.optionalString pkgs.stdenv.isDarwin "set-shell-colors"} set VIRTUAL_ENV_DISABLE_PROMPT true
bind -M insert ! __history_previous_command
bind -M insert '$' __history_previous_command_arguments
${pkgs.thefuck}/bin/thefuck --alias | source
# Run function to set colors that are dependent on `$term_background` and to register them so
# they are triggered when the relevent event happens or variable changes.
set-shell-colors
''; '';
}; # }}}
home.sessionVariables.VIRTUAL_ENV_DISABLE_PROMPT = "true";
} }

View File

@ -1,32 +0,0 @@
{ 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,32 +1,24 @@
{ flake, ... }: { config, ... }:
let inherit (flake.config.users) me';
in {
programs.git = {
enable = true;
userEmail = me'.email; {
userName = me'.name; # Git
# https://rycee.gitlab.io/home-manager/options.html#opt-programs.git.enable
# Aliases config imported in flake.
programs.git.enable = true;
extraConfig = { programs.git.userEmail = config.home.primaryUser.email;
help.autocorrect = "prompt"; programs.git.userName = config.home.primaryUser.fullName;
init.defaultBranch = "main";
pull.rebase = true;
# recommended by delta programs.git.extraConfig = {
core.editor = "hx";
diff.colorMoved = "default"; diff.colorMoved = "default";
merge.conflictStyle = "diff3"; pull.rebase = true;
init.defaultBranch = "main";
help.autocorrect = "prompt";
}; };
ignores = [ ".DS_Store" ".direnv" "result" ]; programs.git.ignores = [ ".DS_Store" ".direnv" ];
# enhanced diffs # Enhanced diffs
delta = { programs.git.delta.enable = true;
enable = true;
options = {
navigate = true;
line-numbers = true;
side-by-side = true;
};
};
};
} }

View File

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

View File

@ -1,10 +1,40 @@
{ pkgs, lib, ... }: { pkgs, ... }:
let font = "Rec Mono Duotone"; # Let-In --------------------------------------------------------------------------------------- {{{
let
colorsToKitty = colors:
with colors; {
inherit background foreground selection_background selection_foreground
tab_bar_background active_tab_background active_tab_foreground
inactive_tab_background inactive_tab_foreground;
cursor = white;
cursor_text_color = background;
color0 = black;
color8 = black;
color1 = red;
color9 = red;
color2 = green;
color10 = lime;
color3 = yellow;
color11 = orange;
color4 = blue;
color12 = blue;
color5 = magenta;
color13 = magenta;
color6 = cyan;
color14 = cyan;
color7 = white;
color15 = white;
url_color = brightgreen;
};
font = "Rec Mono Duotone";
# }}}
in { in {
imports = [ ./extras/kitty/auto-theme.nix ./extras/kitty/nerd-font.nix ]; # Kitty terminal
# https://sw.kovidgoyal.net/kitty/conf.html
# https://rycee.gitlab.io/home-manager/options.html#opt-programs.kitty.enable
programs.kitty.enable = true; programs.kitty.enable = true;
# using kitty from homebrew
programs.kitty.package = pkgs.emptyDirectory; # General config ----------------------------------------------------------------------------- {{{
programs.kitty.settings = { programs.kitty.settings = {
font_family = font; font_family = font;
@ -15,9 +45,11 @@ in {
adjust_line_height = "120%"; adjust_line_height = "120%";
disable_ligatures = "cursor"; # disable ligatures when cursor is on them disable_ligatures = "cursor"; # disable ligatures when cursor is on them
# Window layout
hide_window_decorations = "titlebar-only"; hide_window_decorations = "titlebar-only";
window_padding_width = "10"; window_padding_width = "10";
# Tab bar
tab_bar_edge = "top"; tab_bar_edge = "top";
tab_bar_style = "powerline"; tab_bar_style = "powerline";
tab_powerline_style = "angled"; tab_powerline_style = "angled";
@ -26,30 +58,25 @@ in {
inactive_tab_font_style = "normal"; inactive_tab_font_style = "normal";
tab_activity_symbol = "💬"; tab_activity_symbol = "💬";
# shell integration is manually enabled for fish # Shell integration manually enabled for fish
shell_integration = "disabled"; shell_integration = "disabled";
} // lib.optionalAttrs pkgs.stdenv.isDarwin { macos_option_as_alt = "both"; };
programs.fish.interactiveShellInit = '' macos_option_as_alt = "both";
# Manually enable shell integration
if set -q KITTY_INSTALLATION_DIR
set --global KITTY_SHELL_INTEGRATION enabled
source "$KITTY_INSTALLATION_DIR/shell-integration/fish/vendor_conf.d/kitty-shell-integration.fish"
set --prepend fish_complete_path "$KITTY_INSTALLATION_DIR/shell-integration/fish/vendor_completions.d"
end
set-term-colors
'';
programs.fish.shellAliases = {
s = "kitty +kitten ssh";
e = "edit-in-kitty";
}; };
programs.kitty.useSymbolsFromNerdFont = "CaskaydiaCove Nerd Font"; programs.kitty.extras.useSymbolsFromNerdFont = "CaskaydiaCove Nerd Font";
programs.kitty.colors = { # }}}
# Colors config ------------------------------------------------------------------------------ {{{
programs.kitty.extras.colors = {
enable = true; enable = true;
dark-name = "rose-pine"; dark = colorsToKitty pkgs.lib.colors.tokyonight.dark;
light-name = "rose-pine-dawn"; light = colorsToKitty pkgs.lib.colors.tokyonight.light;
color-pkg = pkgs.kitty-themes;
dark-name = "themes/rose-pine";
light-name = "themes/rose-pine-dawn";
}; };
programs.fish.functions.set-term-colors = { programs.fish.functions.set-term-colors = {
body = '' body = ''
if test "$term_background" = light if test "$term_background" = light
@ -60,4 +87,26 @@ in {
''; '';
onVariable = "term_background"; onVariable = "term_background";
}; };
programs.fish.interactiveShellInit = ''
# Set term colors based on value of `$term_background` when shell starts up.
set-term-colors
# Manually enable shell integration
if set -q KITTY_INSTALLATION_DIR
set --global KITTY_SHELL_INTEGRATION enabled
source "$KITTY_INSTALLATION_DIR/shell-integration/fish/vendor_conf.d/kitty-shell-integration.fish"
set --prepend fish_complete_path "$KITTY_INSTALLATION_DIR/shell-integration/fish/vendor_completions.d"
end
'';
programs.fish.shellAliases = {
s = "kitty +kitten ssh";
e = "edit-in-kitty";
};
# }}}
# Fix icon config
programs.kitty.extras.fixIcon = {
enable = true;
appPath = "~/Applications/Home\\ Manager\\ Apps/kitty.app";
iconPath = "${pkgs.kitty-icon}/kitty-dark.icns";
};
} }

View File

@ -1,19 +0,0 @@
{ 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,119 +1,110 @@
{ pkgs, lib, ... }: { { pkgs, lib, ... }: {
# Programs + packages with configuration --------------------------------------------------------------- {{{
programs = {
# a nicer cat
# https://rycee.gitlab.io/home-manager/options.html#opt-programs.bat.enable
bat = {
enable = true;
config = { style = "auto"; };
};
# Direnv, load and unload environment variables depending on the current directory.
# https://direnv.net
# https://rycee.gitlab.io/home-manager/options.html#opt-programs.direnv.enable
direnv = {
enable = true;
nix-direnv.enable = true;
};
nix-index = { enable = true; };
nushell = { enable = true; };
ssh = {
enable = true;
matchBlocks."*".extraOptions = lib.optionalAttrs pkgs.stdenv.isDarwin {
UseKeychain = "yes";
AddKeysToAgent = "yes";
};
};
vscode = {
enable = true;
# extensions = [ pijul-vscode ];
};
zoxide = { enable = true; };
};
# }}}
# Other packages ----------------------------------------------------------------------------- {{{
home.packages = builtins.attrValues ({ home.packages = builtins.attrValues ({
inherit (pkgs) inherit (pkgs)
# GUI apps # GUI apps
discord-ptb obsidian slack zoom-us cinny discord-ptb lagrange obsidian slack zoom-us
# system tools # System
curl wget curl wget
# `tmux` session alternative # lightweight session management
abduco abduco
# archive tool # archive tool
atool atool
# `top` alternative with ASCII graphs # fancy version of `top` with ASCII graphs
bottom bottom
# `ncdu` alternative # fancy version of `du`
diskonaut
# `dig` alternative. dogs _can_ look up
dogdns
# `du` alternative
du-dust du-dust
# `find` alternative # fancy version of `ls`, fork of now-unmaintained `exa`
eza
# fancy version of `find`
fd fd
# `ping` with a graph # wrapper for `ssh` that better at not dropping connections
gping mosh
# `ps` alternative # fancy version of `ps`
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
tarsnap
# terminal color support testing # terminal color support testing
terminal-colors terminal-colors
# automatic command line fixes
thefuck
# extract RAR archives # extract RAR archives
unrar unrar
# extract XZ archives # extract XZ archives
xz xz
# `tmux` multiplexing/layout alternative
zellij
# dev platforms # Dev stuff
# 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
# source code line counter # alternative to `git`
tokei pijul
# 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
nix-prefetch-git nix-tree nixfmt 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
comma comma
# nix language servers # nix language server
nil nixd; nil;
} // lib.optionalAttrs pkgs.stdenv.isDarwin { } // lib.optionalAttrs pkgs.stdenv.isDarwin {
inherit (pkgs) inherit (pkgs)
# useful macOS CLI commands # useful macOS CLI commands
m-cli; m-cli
# see /overlays/colors.nix
is-dark-mode;
}); });
# }}}
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,5 +1,6 @@
{ config, pkgs, lib, ... }: { { config, pkgs, ... }: {
# 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";
in { in {
@ -10,11 +11,12 @@
StandardErrorPath = "${logPath}/error.log"; StandardErrorPath = "${logPath}/error.log";
StandardOutPath = "${logPath}/out.log"; StandardOutPath = "${logPath}/out.log";
ProgramArguments = [ ProgramArguments = [
"${lib.getExe pkgs.dark-mode-notify}" "${pkgs.dark-mode-notify}/bin/dark-mode-notify"
"${lib.getExe pkgs.fish}" "${pkgs.fish}/bin/fish"
"-c" "-c"
"set-background-to-env DARKMODE" "set-background-to-env DARKMODE"
]; ];
}; };
}; };
# }}}
} }

View File

@ -1,21 +1,13 @@
{ config, pkgs, lib, ... }: { { config, pkgs, ... }: {
# 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";
tarsnapBackup = pkgs.writeShellScriptBin "tarsnap-backup-helper" '' tarsnapBackup = pkgs.writeShellScriptBin "tarsnap-backup-helper" ''
date=$(date -u +%Y-%m-%dT%H:%M:%SZ) date=$(date -u +%Y-%m-%dT%H:%M:%SZ)
echo echo
echo "Running tarsnap backup for $date" echo "Running tarsnap backup for $date"
${lib.getExe pkgs.tarsnap} -c \ /opt/homebrew/bin/tarsnap -c \
--configfile ${config.home.homeDirectory}/.tarsnaprc \ --configfile ${config.home.homeDirectory}/.tarsnaprc \
--keyfile ${config.xdg.configHome}/tarsnap/write-only.key \ --keyfile ${config.xdg.configHome}/tarsnap/write-only.key \
-f $(uname -n)-$date \ -f $(uname -n)-$date \
@ -27,14 +19,25 @@
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;
}]; }
Program = lib.getExe tarsnapBackup; {
# every wednesday
Weekday = 3;
# at noon
Hour = 12;
Minute = 0;
}
];
Program = "${tarsnapBackup}/bin/tarsnap-backup-helper";
}; };
}; };
# }}}
} }

View File

@ -1,23 +0,0 @@
{ 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,29 +1,22 @@
{ {
programs.starship = { # Starship Prompt
enable = true; # https://rycee.gitlab.io/home-manager/options.html#opt-programs.starship.enable
settings = { programs.starship.enable = true;
# Starship settings -------------------------------------------------------------------------- {{{
programs.starship.settings = {
# See docs here: https://starship.rs/config/
# Symbols config configured in Flake.
battery.display = [{ battery.display = [{
# display battery information if charge is <= 25%
threshold = 25; threshold = 25;
}]; } # display battery information if charge is <= 25%
# turn on fish directory truncation ];
directory.fish_style_pwd_dir_length = 1; directory.fish_style_pwd_dir_length = 1; # turn on fish directory truncation
# number of directories not to truncate directory.truncation_length = 2; # number of directories not to truncate
directory.truncation_length = 2; memory_usage.disabled =
# because it includes cached memory it's reported as full a lot true; # 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
# '';
# };
} }

54
lib/mkDarwinSystem.nix Normal file
View File

@ -0,0 +1,54 @@
# taken from https://github.com/malob/nixpkgs/blob/27e04346555277687a60c0168969b3945c2b25ba/lib/mkDarwinSystem.nix
self: inputs: nixpkgs:
{ primaryUser, system ? "aarch64-darwin"
# `nix-darwin` modules to include
, modules ? [ ]
# Additional `nix-darwin` modules to include, useful when reusing a configuration with
# `lib.makeOverridable`.
, extraModules ? [ ]
# Value for `home-manager`'s `home.stateVersion` option.
, homeStateVersion
# `home-manager` modules to include
, homeModules ? [ ]
# Additional `home-manager` modules to include, useful when reusing a configuration with
# `lib.makeOverridable`.
, extraHomeModules ? [ ] }:
inputs.darwin.lib.darwinSystem {
inherit system;
modules = modules ++ extraModules ++ [
inputs.home-manager.darwinModules.home-manager
({ config, ... }:
let cfg = config.users.primaryUser;
in {
users.primaryUser = primaryUser;
inherit nixpkgs;
# Support legacy workflows that use `<nixpkgs>` etc.
nix.nixPath = {
nixpkgs = "${inputs.nixpkgs}";
darwin = "${inputs.darwin}";
};
# `home-manager` config
users.users.${cfg.username}.home = cfg.homeDirectory;
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.${cfg.username} = {
imports = homeModules ++ extraHomeModules;
home.stateVersion = homeStateVersion;
home.primaryUser = primaryUser;
home.homeDirectory = cfg.homeDirectory;
home.enableNixpkgsReleaseCheck = true;
};
# Make sure nixpkgs#pkg refers to this nixpkgs
nix.registry.nixpkgs.flake = inputs.nixpkgs;
# Add this flake to the registry
nix.registry.my.flake = self;
})
];
}

View File

@ -1,29 +1,32 @@
{ config, pkgs, lib, ... }: { config, lib, pkgs, ... }:
let let
cfg = config.programs.helix; cfg = config.programs.helix;
inherit (cfg) extras;
tomlFormat = pkgs.formats.toml { }; tomlFormat = pkgs.formats.toml { };
inherit (lib) mkIf mkEnableOption mkOption types;
in { in {
options.programs.helix = { options.programs.helix.extras = {
autoTheme.enable = autoTheme.enable =
lib.mkEnableOption "Automatically switch helix theme with night mode"; mkEnableOption "Automatically switch helix theme with night mode";
autoTheme.light = lib.mkOption { autoTheme.light = mkOption {
type = lib.types.str; type = types.str;
description = "Light mode theme"; description = "Light mode theme";
}; };
autoTheme.dark = lib.mkOption { autoTheme.dark = mkOption {
type = lib.types.str; type = types.str;
description = "Dark mode theme"; description = "Dark mode theme";
}; };
}; };
config = lib.mkIf (cfg.enable && cfg.autoTheme.enable) { config = mkIf (cfg.enable && extras.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 = extras.autoTheme.light; });
"helix/dark.toml".source = tomlFormat.generate "helix-autotheme" "helix/dark.toml".source = tomlFormat.generate "helix-autotheme"
(cfg.settings // { theme = cfg.autoTheme.dark; }); (cfg.settings // { theme = extras.autoTheme.dark; });
}; };
programs.fish.functions = { programs.fish.functions = {

View File

@ -0,0 +1,80 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.programs.kakoune.extras;
makeKakouneFace = face: name:
let
mkColor = name:
if hasPrefix "#" name then
"rgb:${substring 1 (-1) name}"
else if hasPrefix "!#" name then
"rgba:${substring 2 (-1) name}"
else
name;
value = if isList name then
concatStringsSep "," (map mkColor name)
else
mkColor name;
in "face global ${face} ${value}";
makeKakouneColors = faces:
concatStringsSep "\n"
([ "# Generated by home-manager" ] ++ mapAttrsToList makeKakouneFace faces);
writeKakouneConfig = file: config:
pkgs.writeText file (makeKakouneColors config);
kakoune-colors = {
light = writeKakouneConfig "light.kak" cfg.colors.light;
dark = writeKakouneConfig "dark.kak" cfg.colors.dark;
};
kak-background = pkgs.writeShellScriptBin "kak-background" ''
for session in $(kak -l); do
kak -c $session -e "colorscheme $1;q"
done
'';
kak-light = pkgs.writeShellScriptBin "kak-light" ''
${kak-background}/bin/kak-background light
'';
kak-dark = pkgs.writeShellScriptBin "kak-dark" ''
${kak-background}/bin/kak-background dark
'';
in {
options.programs.kakoune.extras = {
colors = {
enable = mkEnableOption "Custom kakoune color handling";
dark = mkOption {
type = with types; attrsOf (either str (listOf str));
description = "Kakoune dark colors";
};
light = mkOption {
type = with types; attrsOf (either str (listOf str));
description = "Kakoune light colors";
};
};
};
config = mkIf config.programs.kakoune.enable {
home.packages =
mkIf cfg.colors.enable [ kak-light kak-dark kak-background ];
xdg.configFile."kak/colors/light.kak".source = kakoune-colors.light;
xdg.configFile."kak/colors/dark.kak".source = kakoune-colors.dark;
programs.kakoune.extraConfig = ''
eval %sh{
if is-dark-mode; then
echo "colorscheme dark"
else
echo "colorscheme light"
fi
}
'';
};
}

View File

@ -0,0 +1,165 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.programs.kitty.extras;
# Create a Kitty config string from a Nix set
setToKittyConfig = with generators;
toKeyValue { mkKeyValue = mkKeyValueDefault { } " "; };
# Write a Nix set representing a kitty config into the Nix store
writeKittyConfig = fileName: config:
pkgs.writeTextDir "${fileName}" (setToKittyConfig config);
# Path in Nix store containing light and dark kitty color configs
kitty-colors = pkgs.symlinkJoin {
name = "kitty-colors";
paths = [
(writeKittyConfig "dark.conf" cfg.colors.dark)
(writeKittyConfig "light.conf" cfg.colors.light)
];
};
# Shell scripts for changing Kitty colors
term-background = pkgs.writeShellScriptBin "term-background" ''
# Accepts the name of a theme file in color-pkg
# 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 &
fi
'';
term-light = pkgs.writeShellScriptBin "term-light" ''
${term-background}/bin/term-background ${cfg.colors.light-name}
'';
term-dark = pkgs.writeShellScriptBin "term-dark" ''
${term-background}/bin/term-background ${cfg.colors.dark-name}
'';
in {
options.programs.kitty.extras = {
colors = {
enable = mkOption {
type = types.bool;
default = false;
description = ''
When enabled, commands <command>term-dark</command> and <command>term-light</command> will
toggle between your dark and a light colors.
<command>term-background</command> which accepts one argument (the value of which should
be <literal>dark</literal> or <literal>light</literal>) is also available.
(Note that the Kitty setting <literal>allow_remote_control = true</literal> is set to
enable this functionality.)
'';
};
dark = mkOption {
type = with types; attrsOf str;
description = ''
Kitty color settings for dark background colorscheme.
'';
};
light = mkOption {
type = with types; attrsOf str;
description = ''
Kitty color settings for light background colorscheme.
'';
};
color-pkg = mkOption {
type = types.package;
default = kitty-colors;
description = "Package from which to load kitty colors.";
};
light-name = mkOption {
type = types.str;
default = "light";
description = "The name to use for the light colorscheme.";
};
dark-name = mkOption {
type = types.str;
default = "dark";
description = "The name to use for the dark colorscheme.";
};
};
useSymbolsFromNerdFont = mkOption {
type = types.str;
default = "";
example = "JetBrainsMono Nerd Font";
description = ''
NerdFont patched fonts frequently suffer from rendering issues in terminals. To mitigate
this, we can use a non-NerdFont with Kitty and use the <literal>symbol_map</literal> setting
to tell Kitty to only use a NerdFont for NerdFont symbols.
Set this option the name of an installed NerdFont (the same name you'd use in the
<literal>font_family</literal> setting), to enable this feature.
'';
};
fixIcon = {
enable = mkOption {
type = types.bool;
default = false;
description = ''
When enabled, uses fileicon (should be installed via homebrew) 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 config.programs.kitty.enable {
home.packages =
mkIf cfg.colors.enable [ term-light term-dark term-background ];
home.activation = let fileicon = "/opt/homebrew/bin/fileicon";
in mkIf (pkgs.stdenv.isDarwin && cfg.fixIcon.enable) {
cleanupKittyIcon =
lib.hm.dag.entryBetween [ "darwinApps" ] [ "writeBoundary" ] ''
if ${fileicon} test ${cfg.fixIcon.appPath};
then
$DRY_RUN_CMD sudo ${fileicon} rm ${cfg.fixIcon.appPath}
fi
'';
fixKittyIcon = lib.hm.dag.entryAfter [ "darwinApps" ] ''
$DRY_RUN_CMD sudo ${fileicon} set ${cfg.fixIcon.appPath} ${cfg.fixIcon.iconPath}
'';
};
programs.kitty.settings = optionalAttrs cfg.colors.enable {
allow_remote_control = "yes";
listen_on = "unix:/tmp/mykitty";
} // optionalAttrs (cfg.useSymbolsFromNerdFont != "") {
# 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}";
};
xdg.configFile."kitty/macos-launch-services-cmdline" =
mkIf (pkgs.stdenv.isDarwin && cfg.colors.enable) {
text = "--listen-on unix:/tmp/mykitty";
};
};
}

View File

@ -0,0 +1,24 @@
optionName:
{ config, lib, pkgs, ... }:
let
inherit (lib) mkOption types;
inherit (pkgs.stdenv) isDarwin;
cfg = config.${optionName}.primaryUser;
in {
options.${optionName}.primaryUser = {
username = mkOption { type = types.str; };
fullName = mkOption { type = types.str; };
email = mkOption { type = types.str; };
homeDirectory = mkOption {
type = types.str;
default = let prefix = if isDarwin then "/Users" else "/home";
in "${prefix}/${cfg.username}";
};
nixConfigDirectory = mkOption {
type = types.str;
default = "${cfg.homeDirectory}/dotfiles.nix";
};
};
}

View File

@ -1,16 +0,0 @@
{
nix.settings = {
trusted-substituters = [
"https://cache.nixos.org/"
"https://nix-community.cachix.org"
"https://mat.cachix.org"
"https://helix.cachix.org"
];
trusted-public-keys = [
"cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
"mat.cachix.org-1:AHqv9SoBEPKlJX2DDZQnjaMcvBAgpH1j8rw5USYDZno="
"helix.cachix.org-1:ejp9KQpR1FBI2onstMQ34yogDm4OgU2ru6lIwPvuCVs="
];
};
}

View File

@ -1,22 +0,0 @@
{ self, config, ... }: {
flake.nixosModules = {
common.imports = [ ./nix.nix ./caches ];
home = let inherit (config.users) me;
in {
home-manager.users.${me} = { imports = [ self.homeModules.linux ]; };
users.users.${me} = {
name = me;
home = "/home/${me}";
isNormalUser = true;
};
};
default.imports = [
self.nixosModules.home-manager
self.nixosModules.home
self.nixosModules.common
./ssh-access.nix
];
};
}

View File

@ -1,40 +0,0 @@
{ flake, pkgs, lib, ... }: {
nixpkgs = {
config = {
allowBroken = true;
allowUnfree = true;
allowUnsupportedSystem = true;
};
overlays = [
flake.inputs.helix.overlays.default
flake.inputs.nixd.overlays.default
flake.inputs.nil.overlays.nil
(import ../pkgs flake.inputs)
];
};
nix = {
package = pkgs.nixUnstable;
nixPath = {
nixpkgs = "${flake.inputs.nixpkgs}";
} // lib.optionalAttrs pkgs.stdenv.isDarwin {
darwin = "${flake.inputs.nix-darwin}";
};
registry = {
nixpkgs.flake = flake.inputs.nixpkgs;
self.flake = flake.inputs.self;
};
settings = {
# TODO: automatic optimizing and gc
experimental-features = [ "nix-command" "flakes" "repl-flake" ];
extra-platforms = lib.mkIf (pkgs.system == "aarch64-darwin") [
"x86_64-darwin"
"aarch64-darwin"
];
# 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.users.me "root" "@admin" "@wheel" ];
};
};
}

View File

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

8
overlays/colors.nix Normal file
View File

@ -0,0 +1,8 @@
_final: prev: {
lib = prev.lib // {
colors = { tokyonight = import ./colors/tokyonight.nix; };
};
is-dark-mode = prev.writeShellScriptBin "is-dark-mode" ''
defaults read -g AppleInterfaceStyle &>/dev/null
'';
}

View File

@ -0,0 +1,48 @@
{
dark = {
background = "#1a1b26";
foreground = "#a9b1d6";
selection_background = "#28344a";
selection_foreground = "none";
tab_bar_background = "#101014";
active_tab_background = "#787c99";
active_tab_foreground = "#3d59a1";
inactive_tab_background = "#16161e";
inactive_tab_foreground = "#9aa5ce";
comment = "#565f89";
white = "#c0caf5";
black = "#414868";
red = "#f7768e";
yellow = "#e0af68";
orange = "#ff9e64";
green = "#73daca";
lime = "#2ac3de";
blue = "#7aa2f7";
magenta = "#bb9af7";
cyan = "#7dcfff";
brightgreen = "#9ece6a";
};
light = rec {
background = "#d5d6db";
foreground = white;
selection_background = "#fafbff";
selection_foreground = "none";
tab_bar_background = "#e9e9ed";
active_tab_foreground = "#d4d6e4";
active_tab_background = "#2e7de9";
inactive_tab_foreground = "#8990b3";
inactive_tab_background = "#c4c8da";
comment = "#9699a3";
white = "#343b58";
black = "#0f0f14";
red = "#8c4351";
yellow = "#8f5e15";
orange = white;
green = "#33635c";
lime = "#166775";
blue = "#34548a";
magenta = "#5a4a78";
cyan = "#0f4b6e";
brightgreen = "#485e30";
};
}

23
pkgs/cinny.nix Normal file
View File

@ -0,0 +1,23 @@
{ stdenv, fetchurl, undmg, unzip, version ? "2.2.4", ... }:
stdenv.mkDerivation {
inherit version;
pname = "cinny";
nativeBuildInputs = [ undmg unzip ];
src = fetchurl {
url =
"https://github.com/cinnyapp/cinny-desktop/releases/download/v${version}/Cinny_desktop-x86_64.dmg";
sha256 = "sha256-m8sYA7YjvhqGFuU1L1y7BtndHGd6MpuH+hKzPSukxD0=";
};
sourceRoot = ".";
installPhase = ''
runHook preInstall
mkdir -p $out/Applications
cp -r Cinny.app $out/Applications/Cinny.app
runHook postInstall
'';
}

View File

@ -1,24 +1,19 @@
{ stdenv, lib, xcodeenv, dark-mode-notify-src }: { stdenv, lib, xcodeenv, dark-mode-notify-src, sdkVersion, ... }:
let let
xcode = xcodeenv.composeXcodeWrapper { xcode = xcodeenv.composeXcodeWrapper {
version = "*.*"; version = sdkVersion;
xcodeBaseDir = "/Applications/Xcode.app"; xcodeBaseDir = "/Applications/Xcode.app";
}; };
in stdenv.mkDerivation { in stdenv.mkDerivation {
pname = "dark-mode-notify"; name = "dark-mode-notify";
version = dark-mode-notify-src.shortRev;
src = dark-mode-notify-src; src = dark-mode-notify-src;
buildPhase = '' buildPhase = ''
${xcode}/bin/xcrun swift build -c release --disable-sandbox ${xcode}/bin/xcrun swift build -c release --disable-sandbox
''; '';
installPhase = '' installPhase = ''
mkdir -p $out/bin mkdir -p $out/bin
cp .build/release/dark-mode-notify $out/bin cp .build/release/dark-mode-notify $out/bin
''; '';
meta.platforms = lib.platforms.darwin; meta.platforms = lib.platforms.darwin;
meta.mainProgram = "dark-mode-notify";
} }

View File

@ -1,22 +1,19 @@
inputs: self: super: { { inputs }:
inherit (inputs) terminal-themes; _: prev:
dark-mode-notify = self.callPackage ./dark-mode-notify.nix { {
inherit (inputs) dark-mode-notify-src; inherit (inputs) kitty-icon kitty-themes;
fishPlugins = prev.fishPlugins // {
fisher = {
name = "fisher";
src = inputs.fisher-src;
}; };
# get flake inputs prefixed with fish-plugin- and inject them into fishPlugins as a single list
fishPlugins = super.fishPlugins // {
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 { helix = inputs.helix.packages.${prev.stdenv.system}.default;
inherit (inputs) ia-writer-family-src; } // builtins.mapAttrs (name: extras:
}; prev.callPackage (./. + "/${name}.nix")
recursive-patched = self.callPackage ./recursive-patched.nix { }; ({ "${name}-src" = inputs."${name}-src"; } // extras)) {
yubiswitch = self.callPackage ./yubiswitch.nix { }; cinny = { };
} dark-mode-notify = { sdkVersion = "*.*"; };
ia-writer-family = { };
yubiswitch = { };
}

View File

@ -1,7 +1,8 @@
{ stdenv, lib, ia-writer-family-src }: { ia-writer-family-src, lib, stdenv }:
stdenv.mkDerivation {
pname = "ia-writer-family"; let version = "20181224";
version = ia-writer-family-src.shortRev; in stdenv.mkDerivation {
name = "ia-writer-family-${version}";
src = ia-writer-family-src; src = ia-writer-family-src;
@ -10,9 +11,9 @@ stdenv.mkDerivation {
cp "iA Writer "{Mono,Duo,Quattro}/Variable/*.ttf $out/share/fonts/truetype/ cp "iA Writer "{Mono,Duo,Quattro}/Variable/*.ttf $out/share/fonts/truetype/
''; '';
meta = { meta = with lib; {
description = "iA Writer Typeface Family"; description = "iA Writer Typeface Family";
license = lib.licenses.ofl; license = licenses.ofl;
platforms = lib.platforms.all; platforms = platforms.all;
}; };
} }

View File

@ -1,10 +0,0 @@
{ 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,9 +1,8 @@
{ lib, stdenv, fetchurl, undmg, unzip }: { stdenv, fetchurl, undmg, unzip, version ? "0.12", ... }:
let version = "0.16";
in stdenv.mkDerivation {
pname = "yubiswitch";
inherit version;
stdenv.mkDerivation {
inherit version;
pname = "yubiswitch";
nativeBuildInputs = [ undmg unzip ]; nativeBuildInputs = [ undmg unzip ];
src = fetchurl { src = fetchurl {
url = url =
@ -21,6 +20,4 @@ in stdenv.mkDerivation {
runHook postInstall runHook postInstall
''; '';
meta.platforms = lib.platforms.darwin;
} }

View File

@ -1,20 +0,0 @@
{ 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;
# use TouchID for sudo authentication
security.pam.enableSudoTouchIdAuth = true;
# used for backwards compatibility, please read the changelog before changing
# $ darwin-rebuild changelog
system.stateVersion = 4;
}

View File

@ -1,15 +0,0 @@
{ pkgs, lib, ... }: {
homebrew.casks = [ "itsycal" ];
home-manager.sharedModules = [{
launchd.agents.tarsnap.enable = lib.mkForce false;
home.packages = [ pkgs.yubiswitch ];
programs.ssh.matchBlocks.devbox = {
hostname = "csdev6";
forwardAgent = true;
serverAliveInterval = 120;
};
programs.fish.functions.devbox.body = ''
ssh -t devbox "agenttmux attach; or agenttmux new -s yelp"
'';
}];
}

View File

@ -1,9 +0,0 @@
{ 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,13 +1,13 @@
{ let
flake.templates = { mkTemplates =
builtins.mapAttrs (name: attrs: attrs // { path = ./. + "/${name}"; });
in mkTemplates {
rust = { rust = {
path = ./rust; description = "A rust flake template based on flake.parts";
description = "A rust flake template based on flake.parts and crane";
welcomeText = '' welcomeText = ''
welcome to a new rust project () welcome to a new rust project ()
run `direnv allow` and `cargo init` to start a new project run `direnv allow` and `cargo init` to start a new project
''; '';
}; };
};
} }

View File

@ -5,3 +5,18 @@ Copyright mat ess. All rights reserved.
This software may not be used by anyone, for any reason. This software may not be used by anyone, for any reason.
As far as the law allows, this software comes as is, without any warranty or condition, and no contributor will be liable to anyone for any damages related to this software or this license, under any kind of legal claim. As far as the law allows, this software comes as is, without any warranty or condition, and no contributor will be liable to anyone for any damages related to this software or this license, under any kind of legal claim.
===
this is not a license.
free software as envisioned by rms and gnu has failed to defend the freedom of users.
open source software is a tool for corporate cooption, control, and profit.
software should be written for the benefit of the masses.
if you're still reading this: use, change, or share this code however you want. intellectual property is a farce.
https://asternova.top/LICENSE.txt
https://iliana.fyi/treachery
https://www.boringcactus.com/2021/09/29/anti-license-manifesto.html

View File

@ -1,20 +0,0 @@
{
me = "mat";
users = {
mat = {
name = "mat ess";
email = "mat@mat.services";
sshKeys = [
# secretive
"ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBKTVoMVtHSvosU9SCam4S5RTP0R2V09vqw5Xiuff+x4J7NtUxsBhqIrkPSfJHSbYlBKITX5RFyFBo5mtsTa95v0= mat"
];
};
mess = {
name = "Matthew Ess";
email = "mess@yelp.com";
sshKeys = [
# TODO: work secretive keys
];
};
};
}

View File

@ -1,50 +0,0 @@
{ config, lib, ... }:
let
userSubmodule = lib.types.submodule {
options = {
name = lib.mkOption {
type = lib.types.str;
description = ''
full name
'';
};
email = lib.mkOption { type = lib.types.str; };
sshKeys = lib.mkOption {
type = lib.types.listOf lib.types.str;
description = ''
SSH public keys
'';
};
};
};
usersSubmodule = lib.types.submodule {
options = {
users = lib.mkOption { type = lib.types.attrsOf userSubmodule; };
me = lib.mkOption {
type = lib.types.str;
description = ''
The name of the user that represents me.
Admin user in all contexts.
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 = { users = lib.mkOption { type = usersSubmodule; }; };
config = {
users = (import ./config.nix) // {
me' = lib.mkDefault config.users.users.${config.users.me};
};
};
}