-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
executable file
·198 lines (184 loc) · 6 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 = "Nixos config flake";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
nixpkgs-master.url = "github:nixos/nixpkgs/master";
nixos-stable.url = "github:nixos/nixpkgs/nixos-24.05";
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
flake-parts.url = "github:hercules-ci/flake-parts";
nixos-cosmic = {
url = "github:lilyinstarlight/nixos-cosmic";
inputs.nixpkgs.follows = "nixpkgs";
inputs.nixpkgs-stable.follows = "nixos-stable";
};
nix-index-database = {
url = "github:nix-community/nix-index-database";
inputs.nixpkgs.follows = "nixpkgs";
};
# home-manager-unstable = {
# url = "github:nix-community/home-manager";
# inputs.nixpkgs.follows = "nixpkgs-unstable";
# };
# hyprland = {
# url = "git+https://github.com/hyprwm/Hyprland?submodules=1";
# url = "git+https://github.com/hyprwm/Hyprland?ref=refs/heads/main&rev=c5feee1e357f3c3c59ebe406630601c627807963&submodules=1";
# inputs.nixpkgs.follows = "nixpkgs";
# };
fenix = {
url = "github:nix-community/fenix";
inputs.nixpkgs.follows = "nixpkgs";
};
nyaa = {
url = "github:Beastwick18/nyaa";
inputs.nixpkgs.follows = "nixpkgs";
};
nixvim = {
url = "github:nix-community/nixvim";
inputs.nixpkgs.follows = "nixpkgs";
};
chaotic = {
url = "github:chaotic-cx/nyx/nyxpkgs-unstable";
inputs.nixpkgs.follows = "nixpkgs";
inputs.home-manager.follows = "home-manager";
};
stylix = {
url = "github:danth/stylix";
inputs.home-manager.follows = "home-manager";
};
};
outputs = inputs @ {
self,
nixpkgs,
nixpkgs-master,
home-manager,
nixos-stable,
flake-parts,
...
}:
with nixpkgs.lib; let
# overlay-master = final: prev: {
# master = nixpkgs-master.legacyPackages.${prev.system};
# };
# todo remove above
nixpkgsConfig = with inputs; {
config = {
allowUnfree = true;
};
overlays = [
# "pkgs" currently points to unstable
# The following overlay allows you to specify "pkgs.stable" for stable versions
# and "pkgs.master" for versions on master
(
final: prev: let
inherit (prev.stdenv) system;
in {
master = nixpkgs-master.legacyPackages.${system};
stable = nixos-stable.legacyPackages.${system};
}
)
fenix.overlays.default
# Add in custom defined packages in the pkgs directory
# (
# final: prev: { flake = self; } // import ./pkgs final prev
# )
(
final: prev: {
frida-tools = prev.frida-tools.overrideAttrs (old: {
src = prev.fetchPypi {
pname = "frida-tools";
version = "12.3.0";
hash = "sha256-jtxn0a43kv9bLcY1CM3k0kf5K30Ne/FT10ohptWNwEU=";
};
});
}
)
];
};
# sharedOptions = { config, options, ... }: {
# options.myWindowManager = mkOption {
# type = types.enum [ "hyprland" "cosmic" ];
# default = "hyprland";
# description = "Choose which Window Manager to use (hyprland or cosmic)";
# };
# options = {
# # This is where the configuration is applied
# windowManager = config.myWindowManager;
# };
# };
nixosModules = {
user,
host,
}:
with inputs; [
# WM config
# sharedOptions
# Main `nixos` config
(./. + "/hosts/${host}/configuration.nix")
# `home-manager` module
home-manager.nixosModules.home-manager
{
nixpkgs = nixpkgsConfig;
# Pins channels and flake registry to use the same nixpkgs as this flake.
nix.registry = nixpkgs.lib.mapAttrs (_: value: {flake = value;}) inputs;
# `home-manager` config
users.users.${user} = {
home = "/home/${user}";
isNormalUser = true;
group = "${user}";
extraGroups = ["wheel" "wireshark" "docker"];
};
users.groups.${user} = {};
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
backupFileExtension = "backup";
users.${user} = import (./. + "/hosts/${host}/home.nix");
# TODO this is not per-system, this is same for every system rn which is not correct
extraSpecialArgs = {windowManager = "hyprland";};
sharedModules = [
# sharedOptions
# nix-index-database.hmModules.nix-index
nyaa.homeManagerModule
nixvim.homeManagerModules.nixvim
];
};
}
nixos-cosmic.nixosModules.default
nix-index-database.nixosModules.nix-index
chaotic.nixosModules.default
stylix.nixosModules.stylix
];
in
flake-parts.lib.mkFlake {inherit inputs;} {
flake = {
nixosConfigurations = {
mainpc = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = nixosModules {
user = "starnick";
host = "mainpc";
};
specialArgs = {
inherit inputs nixpkgs;
windowManager = "hyprland";
};
};
laptop = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = nixosModules {
user = "starnick";
host = "laptop";
};
specialArgs = {
inherit inputs nixpkgs;
windowManager = "hyprland";
};
};
};
};
systems = ["x86_64-linux"];
};
}