-
-
Notifications
You must be signed in to change notification settings - Fork 7
/
flake.nix
198 lines (191 loc) · 5.94 KB
/
flake.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
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
{
description = "caarlos0's nixos, nix-darwin, and home-manager configs";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
nur.url = "github:nix-community/NUR";
caarlos0-nur.url = "github:caarlos0/nur";
charmbracelet-nur.url = "github:charmbracelet/nur";
goreleaser-nur.url = "github:goreleaser/nur";
# neovim-nightly.url = "github:nix-community/neovim-nightly-overlay";
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
nix-index-database = {
url = "github:Mic92/nix-index-database";
inputs.nixpkgs.follows = "nixpkgs";
};
darwin = {
url = "github:lnl7/nix-darwin";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs =
{
nur,
# , neovim-nightly
caarlos0-nur,
charmbracelet-nur,
goreleaser-nur,
darwin,
home-manager,
nix-index-database,
nixpkgs,
...
}:
let
overlays = [
# inputs.neovim-nightly.overlay
(final: prev: {
nur = import nur {
nurpkgs = prev;
pkgs = prev;
repoOverrides = {
caarlos0 = import caarlos0-nur { pkgs = prev; };
charmbracelet = import charmbracelet-nur { pkgs = prev; };
goreleaser = import goreleaser-nur { pkgs = prev; };
};
};
})
];
forAllSystems = nixpkgs.lib.genAttrs nixpkgs.lib.platforms.unix;
nixpkgsFor = forAllSystems (
system:
import nixpkgs {
inherit system;
overlays = overlays;
}
);
in
{
nixosConfigurations = {
media = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
{ nixpkgs.overlays = overlays; }
./machines/media
home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.carlos = {
imports = [
./modules/home.nix
./modules/nixos.nix
./modules/shell.nix
];
};
}
];
};
darkstar = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
{ nixpkgs.overlays = overlays; }
./machines/darkstar
home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.backupFileExtension = "bkp";
home-manager.users.carlos = {
imports = [
./modules/home.nix
./modules/nixos.nix
./modules/pkgs.nix
./modules/editorconfig.nix
./modules/yamllint.nix
./modules/go.nix
./modules/fzf.nix
./modules/tmux
./modules/neovim
./modules/git
./modules/gh
./modules/top
./modules/shell.nix
./modules/ssh
./modules/charm.nix
nix-index-database.hmModules.nix-index
];
};
}
];
};
};
darwinConfigurations = {
darkmatter = darwin.lib.darwinSystem {
system = "aarch64-darwin";
modules = [
{ nixpkgs.overlays = overlays; }
./machines/darkmatter
home-manager.darwinModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = false;
home-manager.users.carlos = {
# programs.neovim.package = neovim-nightly.packages.aarch64-darwin.default;
imports = [
./modules/home.nix
./modules/darwin
./modules/pkgs.nix
./modules/editorconfig.nix
./modules/yamllint.nix
./modules/go.nix
./modules/fzf.nix
./modules/ghostty
./modules/rio
./modules/tmux
./modules/neovim
./modules/git
./modules/gh
./modules/top
./modules/shell.nix
./modules/ssh
./modules/charm.nix
./modules/hammerspoon
caarlos0-nur.homeManagerModules.default
# ./modules/yubikey.nix
nix-index-database.hmModules.nix-index
];
};
}
];
};
};
devShells = forAllSystems (
system:
let
pkgs = nixpkgsFor.${system};
in
{
default = pkgs.mkShellNoCC {
buildInputs = with pkgs; [
(writeScriptBin "dot-clean" ''
nix-collect-garbage -d --delete-older-than 30d
'')
(writeScriptBin "dot-release" ''
git tag -m "$(date +%Y.%m.%d)" "$(date +%Y.%m.%d)"
git push --tags
goreleaser release --clean
'')
(writeScriptBin "dot-sync" ''
git pull --rebase origin main
nix flake update
dot-clean
dot-apply
'')
(writeScriptBin "dot-apply" ''
if test $(uname -s) == "Linux"; then
sudo nixos-rebuild switch --flake .#
fi
if test $(uname -s) == "Darwin"; then
nix build "./#darwinConfigurations.$(hostname | cut -f1 -d'.').system"
./result/sw/bin/darwin-rebuild switch --flake .
fi
'')
];
};
}
);
};
}