-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
162 lines (146 loc) · 4.06 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
{
description = "clo4's simple NixOS & nix-darwin configuration";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
nixos-wsl = {
url = "github:nix-community/NixOS-WSL/main";
inputs.nixpkgs.follows = "nixpkgs";
};
darwin = {
url = "github:LnL7/nix-darwin/master";
inputs.nixpkgs.follows = "nixpkgs";
};
home-manager = {
url = "github:nix-community/home-manager/master";
inputs.nixpkgs.follows = "nixpkgs";
};
helix = {
url = "github:helix-editor/helix";
inputs.nixpkgs.follows = "nixpkgs";
};
ghostty.url = "github:clo4/ghostty-hm-module";
fish-tide = {
url = "github:IlanCosman/tide/v6.1.1";
flake = false;
};
# I use tealdeer as a quick reference for some commands, but I want the
# tldr page cache to be managed by my Nix setup instead.
tldr-pages = {
url = "github:tldr-pages/tldr";
flake = false;
};
skyrocket-spoon = {
url = "github:clo4/SkyRocket.spoon";
flake = false;
};
# nix-homebrew allows you to configure homebrew declaratively, so the taps
# can be managed by nix as well. Keeps all versions predictable!
nix-homebrew = {
url = "github:zhaofengli/nix-homebrew";
inputs.nixpkgs.follows = "nixpkgs";
};
homebrew-core = {
url = "github:homebrew/homebrew-core";
flake = false;
};
homebrew-cask = {
url = "github:homebrew/homebrew-cask";
flake = false;
};
homebrew-bundle = {
url = "github:homebrew/homebrew-bundle";
flake = false;
};
};
outputs = inputs @ {
nixpkgs,
nixos-wsl,
home-manager,
darwin,
flake-utils,
ghostty,
nix-homebrew,
homebrew-core,
homebrew-cask,
homebrew-bundle,
...
}: let
# This defines the home-manager config module for a user called robert.
# My config structure assumes that this is the only user I'll want to set
# up, but I'll have to rethink this one day.
home-manager-robert = path: {
home-manager = {
useUserPackages = true;
useGlobalPkgs = true;
users.robert = path;
sharedModules = [
ghostty.homeModules.default
];
extraSpecialArgs = {
inherit inputs;
};
};
};
in
{
darwinConfigurations = {
# Using nix-darwin, configuring the Mac mini itself
macmini = darwin.lib.darwinSystem {
system = "aarch64-darwin";
modules = [
home-manager.darwinModules.default
(home-manager-robert ./systems/macmini/home.nix)
./systems/macmini/host.nix
];
specialArgs = {
inherit inputs;
};
};
};
nixosConfigurations = {
# My virtual machine that I run on my Mac
robert-nixos-utm = nixpkgs.lib.nixosSystem {
system = "aarch64-linux";
modules = [
home-manager.nixosModules.default
(home-manager-robert ./systems/utm/home.nix)
./systems/utm/host.nix
];
specialArgs = {
inherit inputs;
};
};
# My WSL installation
robert-nixos-wsl = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
home-manager.nixosModules.default
nixos-wsl.nixosModules.default
(home-manager-robert ./systems/wsl/home.nix)
./systems/wsl/host.nix
];
specialArgs = {
inherit inputs;
};
};
};
templates = {
untracked-flake = {
path = ./templates/untracked-flake;
description = "Flake to be used with my `mkflake` shell function";
};
};
}
// flake-utils.lib.eachDefaultSystem (system: let
pkgs = nixpkgs.legacyPackages.${system};
in {
formatter = pkgs.alejandra;
devShell = pkgs.mkShell {
packages = with pkgs; [
nil
alejandra
];
};
});
}