Skip to content

Instantly share code, notes, and snippets.

@polynomialspace
Last active December 9, 2021 09:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save polynomialspace/33ff87a6c6e7dde45a1a05ca3c8bf905 to your computer and use it in GitHub Desktop.
Save polynomialspace/33ff87a6c6e7dde45a1a05ca3c8bf905 to your computer and use it in GitHub Desktop.
darwin-configuration.nix
{ config, pkgs, nixpkgs, ... }:
{
# These don't exist : (
# system.defaults.NSGlobalDomain."com.apple.AppleMultitouchTrackpad.Clicking" = true;
# system.defaults.NSGlobalDomain."com.apple.AppleMultitouchTrackpad.Dragging" = true;
system.defaults.NSGlobalDomain = {
NSAutomaticCapitalizationEnabled = false;
NSAutomaticDashSubstitutionEnabled = false;
NSAutomaticPeriodSubstitutionEnabled = false;
NSAutomaticQuoteSubstitutionEnabled = false;
NSAutomaticSpellingCorrectionEnabled = false;
InitialKeyRepeat = 25;
KeyRepeat = 2;
"com.apple.mouse.tapBehavior" = 1;
"com.apple.trackpad.enableSecondaryClick" = true;
"com.apple.swipescrolldirection" = false;
ApplePressAndHoldEnabled = false;
};
networking.hostName = "m1a";
environment.systemPackages = with pkgs; [
aria
direnv
ffmpeg
git
gnupg
go
hugo
htop
mtr
openconnect
openssh
pinentry_mac
qemu
screen
tmux
wget
yt-dlp
];
# Auto upgrade nix package and the daemon service.
# services.nix-daemon.enable = true;
# nix.package = pkgs.nix;
programs.zsh = {
enable = true;
interactiveShellInit = ''
eval "$(direnv hook zsh)"
alias mpv='/Applications/mpv.app/Contents/MacOS/mpv'
alias youtube-dl='yt-dlp -f '"'"'(bv*+ba/b)'"'"' -S res:1440,fps,+size,+br -N 4 --downloader aria2c'
unsetopt share_history
export PROMPT='%n@%m %~ %# '
export PATH="$PATH:$HOME/bin:$HOME/go/bin"
'';
promptInit = "";
};
# Used for backwards compatibility, please read the changelog before changing. $
# darwin-rebuild changelog
system.stateVersion = 4;
environment.variables = { EDITOR = "vim"; };
# for direnv
nix.extraOptions = ''
keep-outputs = true
keep-derivations = true
'';
# `darwin.network_cmds` pulls in deprecated openssl1.0.2 for some reason, so : )
nixpkgs.overlays = [
(_:
{ callPackage, ... }: {
nettools = callPackage ({ lib, runCommand, ... }:
let
cmds = [
/sbin/ifconfig
/sbin/ping
/sbin/ping6
/sbin/route
/usr/sbin/arp
/usr/sbin/ndp
/usr/sbin/netstat
/usr/sbin/rarpd
/usr/sbin/rtadvd
/usr/sbin/spray
/usr/sbin/traceroute
/usr/sbin/traceroute6
];
in runCommand "nettools-impure" { } ''
BIN=$out/bin
mkdir -p $BIN
${lib.concatStringsSep "\n" (builtins.map (prog: ''
cp ${prog} $BIN/${lib.last (lib.splitString "-" prog)}
'') cmds)}
'') { };
})
];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment