-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
226 lines (214 loc) Β· 8.91 KB
/
flake.nix
File metadata and controls
226 lines (214 loc) Β· 8.91 KB
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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
{
description = "Dotfiles with Nix flakes and nix-darwin";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
fenix.url = "github:nix-community/fenix";
nix-darwin = {
url = "github:nix-darwin/nix-darwin";
inputs.nixpkgs.follows = "nixpkgs";
};
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, fenix, nix-darwin, home-manager, flake-utils }:
let
username = "thexuh";
system = "aarch64-darwin";
in
{
darwinConfigurations."darwin-system" = nix-darwin.lib.darwinSystem {
inherit system;
specialArgs = { inherit username fenix; };
modules = [
./darwin-configuration.nix
home-manager.darwinModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.backupFileExtension = "backup";
home-manager.users.${username} = import ./home.nix;
}
];
};
} //
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
config.allowUnfree = true;
};
inherit (pkgs) lib stdenv;
in
{
devShells.default = pkgs.mkShell {
buildInputs = with pkgs; [
python312
nodejs_22
go
rustup
cargo
fd
fzf
neofetch
ripgrep
bat
eza
direnv
git
stow
tmux
vim
neovim
zsh
uv
jq
yq-go
gh
oh-my-posh
luarocks
bun
nodePackages.pnpm
nerd-fonts.fira-code
nerd-fonts.hack
nerd-fonts.jetbrains-mono
nerd-fonts.roboto-mono
nerd-fonts.noto
nerd-fonts.overpass
nerd-fonts.bitstream-vera-sans-mono
nerd-fonts.droid-sans-mono
] ++ lib.optionals stdenv.hostPlatform.isDarwin [
mkalias
alacritty
wezterm
kitty
];
shellHook = ''
export EDITOR=vim
export TERMINAL=alacritty
export PAGER=less
export GOPATH=$HOME/go
export GOBIN=$HOME/go/bin
export GREP_COLORS='mt=1;35;40'
export HISTFILE=~/.zsh_history
export SAVEHIST=10000
export HISTSIZE=25000
export HISTTIMEFORMAT="[%F %T] "
export FZF_DEFAULT_COMMAND="fd --hidden --strip-cwd-prefix --exclude .git"
export FZF_CTRL_T_COMMAND="fd --hidden --strip-cwd-prefix --exclude .git"
export FZF_ALT_C_COMMAND="fd --type=d --hidden --strip-cwd-prefix --exclude .git"
if [ ! -f "$HOME/.dotfiles-installed" ]; then
echo "π Installing dotfiles with stow..."
${pkgs.stow}/bin/stow -d "$PWD" -t "$HOME" \
direnv dbt emacs bash config git tmux vim zsh ohmyposh kanata wezterm \
2>/dev/null || true
touch "$HOME/.dotfiles-installed"
echo "β
Dotfiles installed!"
fi
if [ ! -f "$HOME/.fonts-installed" ]; then
echo "π€ Installing Nerd Fonts..."
FONTS="${pkgs.nerd-fonts.fira-code} ${pkgs.nerd-fonts.hack} ${pkgs.nerd-fonts.jetbrains-mono} ${pkgs.nerd-fonts.roboto-mono} ${pkgs.nerd-fonts.noto} ${pkgs.nerd-fonts.overpass} ${pkgs.nerd-fonts.bitstream-vera-sans-mono} ${pkgs.nerd-fonts.droid-sans-mono}"
if [ "$(uname)" = "Darwin" ]; then
mkdir -p "$HOME/Library/Fonts"
for font_pkg in $FONTS; do
find "$font_pkg/share/fonts" -type f \( -name "*.ttf" -o -name "*.otf" \) -exec ln -sf {} "$HOME/Library/Fonts/" \; 2>/dev/null || true
done
else
mkdir -p "$HOME/.local/share/fonts"
for font_pkg in $FONTS; do
find "$font_pkg/share/fonts" -type f \( -name "*.ttf" -o -name "*.otf" \) -exec ln -sf {} "$HOME/.local/share/fonts/" \; 2>/dev/null || true
done
fc-cache -f 2>/dev/null || true
fi
touch "$HOME/.fonts-installed"
echo "β
Fonts installed!"
fi
if [ "$(uname)" = "Darwin" ] && [ ! -f "$HOME/.apps-installed" ]; then
echo "π± Installing macOS applications..."
rm -rf "$HOME/Applications/Nix Apps"
mkdir -p "$HOME/Applications/Nix Apps"
${lib.optionalString stdenv.hostPlatform.isDarwin ''
for app in ${pkgs.alacritty}/Applications/*.app ${pkgs.wezterm}/Applications/*.app ${pkgs.kitty}/Applications/*.app ${pkgs.ice-bar}/Applications/*.app; do
if [ -d "$app" ]; then
app_name=$(basename "$app")
echo " Creating alias for $app_name"
${pkgs.mkalias}/bin/mkalias "$app" "$HOME/Applications/Nix Apps/$app_name"
fi
done
''}
touch "$HOME/.apps-installed"
echo "β
Applications installed in ~/Applications/Nix Apps/"
echo " Apps should now be searchable in Spotlight!"
fi
echo "π Nix development environment activated!"
echo "π¦ Tools: python, node, go, rust, and more..."
'';
};
packages = {
install = pkgs.writeShellScriptBin "install-dotfiles" ''
echo "π Installing dotfiles..."
${pkgs.stow}/bin/stow -d "$PWD" -t "$HOME" \
direnv dbt emacs bash config git tmux vim zsh ohmyposh kanata wezterm
touch "$HOME/.dotfiles-installed"
echo "β
Dotfiles installed!"
'';
reinstall = pkgs.writeShellScriptBin "reinstall-dotfiles" ''
echo "π Reinstalling dotfiles..."
rm -f "$HOME/.dotfiles-installed"
${pkgs.stow}/bin/stow -R -d "$PWD" -t "$HOME" \
direnv dbt emacs bash config git tmux vim zsh ohmyposh kanata wezterm
touch "$HOME/.dotfiles-installed"
echo "β
Dotfiles reinstalled!"
'';
uninstall = pkgs.writeShellScriptBin "uninstall-dotfiles" ''
echo "ποΈ Uninstalling dotfiles..."
${pkgs.stow}/bin/stow -D -d "$PWD" -t "$HOME" \
direnv dbt emacs bash config git tmux vim zsh ohmyposh kanata wezterm
rm -f "$HOME/.dotfiles-installed"
echo "β
Dotfiles uninstalled!"
'';
install-fonts = pkgs.writeShellScriptBin "install-fonts" ''
echo "π€ Installing Nerd Fonts..."
FONTS="${pkgs.nerd-fonts.fira-code} ${pkgs.nerd-fonts.hack} ${pkgs.nerd-fonts.jetbrains-mono} ${pkgs.nerd-fonts.roboto-mono} ${pkgs.nerd-fonts.noto} ${pkgs.nerd-fonts.overpass} ${pkgs.nerd-fonts.bitstream-vera-sans-mono} ${pkgs.nerd-fonts.droid-sans-mono}"
if [ "$(uname)" = "Darwin" ]; then
mkdir -p "$HOME/Library/Fonts"
for font_pkg in $FONTS; do
find "$font_pkg/share/fonts" -type f \( -name "*.ttf" -o -name "*.otf" \) -exec ln -sf {} "$HOME/Library/Fonts/" \; 2>/dev/null || true
done
else
mkdir -p "$HOME/.local/share/fonts"
for font_pkg in $FONTS; do
find "$font_pkg/share/fonts" -type f \( -name "*.ttf" -o -name "*.otf" \) -exec ln -sf {} "$HOME/.local/share/fonts/" \; 2>/dev/null || true
done
fc-cache -f 2>/dev/null || true
fi
touch "$HOME/.fonts-installed"
echo "β
Fonts installed!"
'';
install-apps = pkgs.writeShellScriptBin "install-apps" ''
if [ "$(uname)" != "Darwin" ]; then
echo "β οΈ This command is only for macOS"
exit 1
fi
echo "π± Installing macOS applications..."
rm -rf "$HOME/Applications/Nix Apps"
mkdir -p "$HOME/Applications/Nix Apps"
${lib.optionalString stdenv.hostPlatform.isDarwin ''
for app in ${pkgs.alacritty}/Applications/*.app ${pkgs.wezterm}/Applications/*.app ${pkgs.kitty}/Applications/*.app ${pkgs.ice-bar}/Applications/*.app; do
if [ -d "$app" ]; then
app_name=$(basename "$app")
echo " Creating alias for $app_name"
${pkgs.mkalias}/bin/mkalias "$app" "$HOME/Applications/Nix Apps/$app_name"
fi
done
''}
touch "$HOME/.apps-installed"
echo "β
Applications installed in ~/Applications/Nix Apps/"
echo " Apps should now be searchable in Spotlight!"
'';
};
}
);
}