-
Notifications
You must be signed in to change notification settings - Fork 2
/
darwin-configuration.nix
159 lines (137 loc) · 4.88 KB
/
darwin-configuration.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
{ config, pkgs, ... }:
let
barbq =
let
src = pkgs.fetchFromGitHub {
owner = "bkase";
repo = "barbq";
rev = "c1467af2b1c52423ee32b84e40b25b1902cf0bf2";
sha256 = "1jsfcjnpyj9j1vg5341l4zdww7slqp48l8yh7b5mlkgxmhl3k39m";
};
in
(import "${src}/release.nix").barbq;
in
let
screenshots-folder = "/Users/bkase/screenshots";
in
{
imports = [
./src/yabai/service.nix
./src/dotconfig/c.nix
./src/common.nix
./src/zsh/c.nix
./src/vim/c.nix
];
launchd.user.agents.barbq =
let
script = pkgs.writeScriptBin "statusbar" ''
#!${pkgs.stdenv.shell}
/Users/bkase/yabai/bin/yabai -m rule --add app=Alacritty sticky=on
/Users/bkase/Applications/Nix\ Apps/Alacritty.app/Contents/MacOS/alacritty -o window.dimensions.columns=180 -o window.dimensions.lines=1 -o window.position.x=0 -o window.position.y=0 -e ${barbq}/bin/barbq
'';
in
{
path = [ "/Users/bkase/yabai/bin" "${barbq}/bin" config.environment.systemPath ];
serviceConfig.ProgramArguments = [ "${script}/bin/statusbar" ];
serviceConfig.RunAtLoad = true;
serviceConfig.KeepAlive = true;
};
launchd.user.agents.lorri = {
serviceConfig = {
WorkingDirectory = (builtins.getEnv "HOME");
EnvironmentVariables = { };
KeepAlive = true;
RunAtLoad = true;
StandardOutPath = "/var/tmp/lorri.log";
StandardErrorPath = "/var/tmp/lorri.log";
};
script = ''
source ${config.system.build.setEnvironment}
exec ${pkgs.lorri}/bin/lorri daemon
'';
};
system.activationScripts.postActivation.text = ''
# Regenerate ~/.config files
/etc/dotconfig/bin/generate
# Ensure screenshots folder exists
mkdir -p ${screenshots-folder}
# Regenerate .gitignore
echo "regenerating global .gitignore..."
cat ${./src/gitignore} > ~/.gitignore
git config --global core.excludesfile ~/.gitignore
# Regenerate ~/.vim files
echo "regenerating ~/.vim files..."
mkdir -p ~/.vim
cat ${./src/vim/coc-settings.json} > ~/.vim/coc-settings.json
'';
environment.systemPackages = [
config.programs.vim.package
pkgs.kitty
pkgs.alacritty
barbq
];
environment.extraOutputsToInstall = [ "man" ];
system.defaults.NSGlobalDomain.InitialKeyRepeat = 12;
system.defaults.NSGlobalDomain.KeyRepeat = 1;
system.defaults.NSGlobalDomain."com.apple.swipescrolldirection" = false;
system.defaults.dock.autohide = true;
system.defaults.dock.orientation = "left";
system.defaults.dock.showhidden = true;
system.defaults.dock.mru-spaces = false;
system.defaults.screencapture.location = "${screenshots-folder}";
system.defaults.finder.AppleShowAllExtensions = true;
system.defaults.finder.QuitMenuItem = true;
system.defaults.finder.FXEnableExtensionChangeWarning = false;
system.keyboard.enableKeyMapping = true;
system.keyboard.remapCapsLockToControl = true;
services.skhd.enable = true;
#programs.nix-index.enable = true;
services.nix-daemon.enable = true;
# nix.package = pkgs.nixUnstable;
# SKHD
services.skhd.skhdConfig = builtins.readFile ./src/skhdrc;
environment.variables.LANG = "en_US.UTF-8";
nixpkgs.config.allowUnfree = true;
nixpkgs.overlays = [
(
self: super: {
my_vim_configurable = super.vim_configurable.override {
guiSupport = "no";
};
darwin-zsh-completions = super.runCommandNoCC "darwin-zsh-completions-0.0.0"
{ preferLocalBuild = true; }
''
mkdir -p $out/share/zsh/site-functions
cat <<-'EOF' > $out/share/zsh/site-functions/_darwin-rebuild
#compdef darwin-rebuild
#autoload
_nix-common-options
local -a _1st_arguments
_1st_arguments=(
'switch:Build, activate, and update the current generation'\
'build:Build without activating or updating the current generation'\
'check:Build and run the activation sanity checks'\
'changelog:Show most recent entries in the changelog'\
)
_arguments \
'--list-generations[Print a list of all generations in the active profile]'\
'--rollback[Roll back to the previous configuration]'\
{--switch-generation,-G}'[Activate specified generation]'\
'(--profile-name -p)'{--profile-name,-p}'[Profile to use to track current and previous system configurations]:Profile:_nix_profiles'\
'1:: :->subcmds' && return 0
case $state in
subcmds)
_describe -t commands 'darwin-rebuild subcommands' _1st_arguments
;;
esac
EOF
'';
}
)
];
# Used for backwards compatibility, please read the changelog before changing.
# $ darwin-rebuild changelog
system.stateVersion = 3;
nix.maxJobs = 8;
nix.buildCores = 8;
}