Skip to content

Commit b4c586e

Browse files
committed
Move to Nix + macOS
1 parent dfff0bc commit b4c586e

File tree

15 files changed

+1042
-704
lines changed

15 files changed

+1042
-704
lines changed

.github/workflows/main.yml

Lines changed: 0 additions & 26 deletions
This file was deleted.

README.md

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,3 @@
11
# dotfiles
22

3-
Pragmatic little scripts without much beauty to them.
4-
They're not tested thoroughly and will fall on their face in most edge cases.
5-
At worst, at least they're written documentation of what to install and/or do when first setting up a new machine.
6-
7-
They're supposed to be idempotent: when changing a setting, just run them again to apply.
8-
Downside is speed, upside is safety and simplicity.
9-
10-
Be warned: they make liberal use of `sudo`, global installations, and piping to `sh`, potentially also with root access.
11-
Not for the faint of heart.
12-
13-
## Usage
14-
15-
Execute the script whose name corresponds to your distribution.
16-
17-
## Context
18-
19-
I used to have these in Ansible, but the overhead and YAML hell of that got too much, in the context of what it is (single-host, rarely-run configuration management).
20-
Keeping it simple (and ugly...) now.
3+
Written with Nix, specific to `nix-darwin` and `home-manager`.

darwin-configuration.nix

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
{ config, pkgs, ... }:
2+
3+
{
4+
# Auto upgrade nix package and the daemon service.
5+
services = {
6+
nix-daemon = {
7+
enable = true;
8+
};
9+
};
10+
11+
nix = {
12+
package = pkgs.nix;
13+
settings = {
14+
"extra-experimental-features" = [ "nix-command" "flakes" ];
15+
};
16+
};
17+
18+
nixpkgs = {
19+
config = {
20+
allowUnfree = true; # VSCode, ...
21+
};
22+
};
23+
24+
programs = {
25+
zsh = {
26+
# Create /etc/zshrc that loads the nix-darwin environment.
27+
# Very important. Only once this is activated do you get a shell with everything set up.
28+
enable = true;
29+
};
30+
31+
bash = {
32+
# Some tools might have `/bin/bash` hard-coded, so help get Nix into those.
33+
enable = true;
34+
};
35+
};
36+
37+
fonts = {
38+
fontDir.enable = true;
39+
40+
fonts = [
41+
(pkgs.nerdfonts.override {
42+
fonts = [
43+
"FiraCode"
44+
];
45+
})
46+
];
47+
};
48+
49+
homebrew = {
50+
enable = true;
51+
52+
casks = [
53+
"calibre"
54+
"discord"
55+
"docker"
56+
"firefox"
57+
"google-chrome"
58+
"joplin"
59+
"linearmouse"
60+
"nextcloud"
61+
"raycast"
62+
"signal"
63+
"vlc"
64+
];
65+
66+
masApps = {
67+
# These are all special snowflakes, and installation might fail here for various
68+
# reasons which can only be resolved in the App Store GUI. It's still convenient
69+
# to have them listed here for reference, and guaranteeing their installation.
70+
"Wireguard" = 1451685025;
71+
"Telegram" = 747648890;
72+
};
73+
};
74+
75+
system = {
76+
# Used for backwards compatibility, please read the changelog before changing.
77+
# $ darwin-rebuild changelog
78+
stateVersion = 4;
79+
80+
activationScripts = {
81+
postUserActivation = {
82+
# https://medium.com/@zmre/nix-darwin-quick-tip-activate-your-preferences-f69942a93236
83+
text = "/System/Library/PrivateFrameworks/SystemAdministration.framework/Resources/activateSettings - u";
84+
};
85+
};
86+
87+
defaults = {
88+
dock = {
89+
autohide = true;
90+
orientation = "left";
91+
show-process-indicators = false;
92+
show-recents = false;
93+
static-only = true;
94+
};
95+
finder = {
96+
AppleShowAllExtensions = true;
97+
AppleShowAllFiles = true;
98+
FXEnableExtensionChangeWarning = false;
99+
ShowPathbar = true;
100+
ShowStatusBar = true;
101+
_FXShowPosixPathInTitle = true;
102+
};
103+
NSGlobalDomain = {
104+
AppleFontSmoothing = 0; # https://www.reddit.com/r/apple/comments/t9qdl1/comment/hzvyq2g/
105+
InitialKeyRepeat = 15; # Delay before keys are repeated
106+
KeyRepeat = 2; # Delay between repeated keystrokes when holding down
107+
};
108+
};
109+
};
110+
}

0 commit comments

Comments
 (0)