-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
175 lines (175 loc) · 5.27 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
{
inputs = {
# Latest stable release of nixos
nixos-stable = {
url = "github:nixos/nixpkgs/nixos-24.05";
};
# Rolling release of nixos
nixos-unstable = {
url = "github:nixos/nixpkgs/nixos-unstable";
};
# Rolling release of home-manager
home-manager-unstable = {
url = "github:nix-community/home-manager/master";
inputs.nixpkgs.follows = "nixos-unstable";
};
# AWS VPN Client
awsvpnclient = {
url = "github:ymatsiuk/awsvpnclient/56ca114e3f7fe4db9d745a0ab8ed70c6bd803a8f";
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
};
# Colortest, for testing terminal colors
colortest = {
url = "./pkgs/colortest";
inputs.nixpkgs.follows = "nixos-stable";
};
# gh-copilot
gh-copilot = {
url = "./pkgs/gh-copilot";
inputs.nixpkgs.follows = "nixos-stable";
};
# Latest version with plasma that works with HDR + sunshine
nixos-plasma = {
url = "github:nixos/nixpkgs/8d5bdaf3a45a6e42a23ff476ba478731752c7f95";
};
};
outputs = {
nixos-stable,
nixos-unstable,
nixos-plasma,
home-manager-unstable,
awsvpnclient,
colortest,
gh-copilot,
...
}: let
system = "x86_64-linux";
stable = import nixos-stable nixpkgs-args;
unstable = import nixos-unstable nixpkgs-args;
nixpkgs-args = {
inherit system;
config.allowUnfree = true;
};
# Home-manager configuration.
defaultHomeManagerUserConfig = {
username = "dlevym";
work = false;
modules = {
neovim = {
enable = true;
};
gui = {
enable = true;
};
python = {
enable = true;
};
nodejs = {
enable = true;
};
golang = {
enable = true;
};
rust = {
enable = true;
};
cli = {
enable = true;
git = {
userEmail = "[email protected]";
gh = {
extraExtensions = [
gh-copilot.packages."${system}".gh-copilot
];
};
};
};
};
};
defaultSpecialArgs = {
inherit stable;
inherit unstable;
userConfig = defaultHomeManagerUserConfig;
};
mergeWithDefaultSpecialArgs = customConfig: nixos-unstable.lib.attrsets.recursiveUpdate defaultSpecialArgs customConfig;
addHostConfiguration = hostname: additionalModules:
nixos-unstable.lib.nixosSystem {
inherit system;
modules =
[
home-manager-unstable.nixosModules.home-manager
./hosts/${hostname}
./common
./cachix.nix
{
environment.systemPackages = [
# Colortest, for testing terminal colors
colortest.packages."${system}".colortest
];
networking.hostName = hostname;
home-manager.extraSpecialArgs = nixos-unstable.lib.mkDefault defaultSpecialArgs;
}
{
# Common NIX_PATH, by default we are on unstable
nix.nixPath = [
"nixpkgs=${nixos-unstable}"
];
}
{
nixpkgs.overlays = [
(final: prev: {
brave = stable.brave.override {
commandLineArgs = "--gtk-version=4";
};
})
];
}
]
++ nixos-unstable.lib.optionals (builtins.isList additionalModules) additionalModules;
specialArgs = defaultSpecialArgs;
};
in {
imports = [
./cachix.nix
];
# Refactor to use flake-parts or flake-utils
nixosConfigurations = {
dellXps15 = addHostConfiguration "dellXps15" [];
nyx15v2 = addHostConfiguration "nyx15v2" [];
inspirion = addHostConfiguration "inspirion" [
{
environment.systemPackages = [
# AWS VPN Client
awsvpnclient.packages."${system}".awsvpnclient
];
# NOTE Through `userConfig`, we can configure the home-manager modules.
home-manager.extraSpecialArgs = nixos-unstable.lib.mkForce (mergeWithDefaultSpecialArgs {
userConfig = {
work = true;
modules = {
cli.git.userEmail = "[email protected]";
rust.enable = false;
};
};
});
}
];
bootse = addHostConfiguration "bootse" [
{
home-manager.extraSpecialArgs = defaultSpecialArgs;
# HACK Unfortunately, version of plasma > 6.2.0 breaks my sunshine HDR setup
# see https://github.com/LizardByte/Sunshine/issues/3298
# see https://github.com/LizardByte/Sunshine/issues/3327
# Until these are resolved, we need to pin 6.2.0 on the system.
nixpkgs.overlays = [
(self: super: {
kdePackages = super.kdePackages // (import nixos-plasma nixpkgs-args).kdePackages;
})
];
}
];
};
# TODO Have a configuration that is only `home-manager`, meant for systems that may or may not be `NIXOS`
# See https://nix-community.github.io/home-manager/index.xhtml#sec-flakes-standalone
};
}