-
Notifications
You must be signed in to change notification settings - Fork 4
/
flake.nix
163 lines (160 loc) · 4.83 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
{
description = "My NixOS configuration: A Mix of Nix and Max";
inputs = {
nixos.url = "github:NixOS/nixpkgs/nixos-24.11";
nixos-unstable.url = "github:NixOS/nixpkgs/nixos-unstable";
nixos-hardware.url = "github:NixOS/nixos-hardware";
nixpkgs-darwin.url = "github:NixOS/nixpkgs/nixpkgs-24.11-darwin";
nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
darwin.url = "github:lnl7/nix-darwin/master";
darwin.inputs.nixpkgs.follows = "nixpkgs-darwin";
disko.url = "github:nix-community/disko/v1.9.0";
disko.inputs.nixpkgs.follows = "nixos";
home-manager.url = "github:nix-community/home-manager/release-24.11";
home-manager.inputs.nixpkgs.follows = "nixos";
base16-alacritty = {
url = "github:tinted-theming/base16-alacritty";
flake = false;
};
base16-fzf = {
url = "github:tinted-theming/base16-fzf";
flake = false;
};
base16-shell = {
url = "github:tinted-theming/base16-shell";
flake = false;
};
oh-my-tmux = {
url = "github:gpakosz/.tmux";
flake = false;
};
oh-my-zsh = {
url = "github:ohmyzsh/ohmyzsh";
flake = false;
};
zsh-completions-src = {
url = "github:zsh-users/zsh-completions";
flake = false;
};
};
outputs =
{
nixos,
nixos-unstable,
nixos-hardware,
nixpkgs-darwin,
nixpkgs-unstable,
darwin,
disko,
home-manager,
zsh-completions-src,
...
}@attrs:
let
overlayPkgs = final: prev: {
zsh-completions = (
prev.zsh-completions.overrideAttrs {
version = "HEAD";
src = zsh-completions-src;
installPhase = ''
functions=(
_direnv
_golang
_grpcurl
_node
_pre-commit
_ts-node
_tsc
_yarn
)
install -D --target-directory=$out/share/zsh/site-functions "''${functions[@]/#/src/}"
'';
}
);
};
overlayNixOSUnstable = final: prev: {
unstable = nixos-unstable.legacyPackages.${prev.system};
};
overlayNixpkgsUnstable = final: prev: {
unstable = nixpkgs-unstable.legacyPackages.${prev.system};
};
baseModules = [
{
nixpkgs.overlays = [
overlayNixOSUnstable
overlayPkgs
];
}
./nix/nixos.nix
disko.nixosModules.disko
# Disable Disko config as it uses device names, we prefer the robustness of UUIDs.
{
disko = {
enableConfig = false;
rootMountPoint = "/mnt";
};
}
home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = false;
home-manager.users.maxime = import ./nix/home.nix;
home-manager.extraSpecialArgs = attrs;
}
];
in
{
nixosConfigurations = {
BRUNETM-X1 = nixos.lib.nixosSystem {
system = "x86_64-linux";
modules = baseModules ++ [
nixos-hardware.nixosModules.lenovo-thinkpad-x1-9th-gen
./nix/hosts/BRUNETM-X1
];
};
BRUNETM-X230 = nixos.lib.nixosSystem {
system = "x86_64-linux";
modules = baseModules ++ [
nixos-hardware.nixosModules.common-pc-laptop-ssd
nixos-hardware.nixosModules.lenovo-thinkpad-x230
./nix/hosts/BRUNETM-X230
];
};
virtualbox = nixos.lib.nixosSystem {
system = "x86_64-linux";
modules = baseModules ++ [
./nix/hosts/virtualbox
];
};
};
darwinConfigurations = {
Maxime-Brunet = darwin.lib.darwinSystem {
system = "aarch64-darwin";
modules = [
{
# Equivalent to https://nixos.org/manual/nixos/stable/options#opt-nixpkgs.flake.setNixPath
nix.nixPath = nixpkgs-darwin.lib.mkForce [ "nixpkgs=flake:nixpkgs" ];
# Equivalent to https://nixos.org/manual/nixos/stable/options#opt-nixpkgs.flake.setFlakeRegistry
nix.registry.nixpkgs.to = {
type = "path";
path = nixpkgs-darwin.outPath;
};
nixpkgs.overlays = [
overlayNixpkgsUnstable
overlayPkgs
];
}
./nix/darwin.nix
./nix/hosts/Maxime-Brunet
home-manager.darwinModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = false;
home-manager.users.maxime = import ./nix/home.nix;
home-manager.extraSpecialArgs = attrs;
}
];
};
};
};
}