forked from IceDBorn/IceDOS
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgenflake.nix
172 lines (151 loc) · 4.59 KB
/
genflake.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
let
lib = import <nixpkgs/lib>;
inherit (lib) attrNames concatImapStrings filter;
cfg = (import ./options.nix { inherit lib; }).config.icedos;
users = filter (user: cfg.system.users.${user}.enable == true) (attrNames cfg.system.users);
steam-session = cfg.applications.steam.session.enable;
hyprland = cfg.desktop.hyprland.enable;
switch-emulators = cfg.applications.emulators.switch;
server = cfg.hardware.devices.server.enable;
in
{
flake.nix = ''
{
inputs = {
# Update channels
chaotic.url = "github:chaotic-cx/nyx/nyxpkgs-unstable";
nixpkgs = {
url = "github:NixOS/nixpkgs/nixos-unstable";
follows = "chaotic/nixpkgs";
};
# Modules
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
nerivations = {
url = "github:icedborn/nerivations";
inputs.nixpkgs.follows = "nixpkgs";
};
${
if (steam-session) then
''
steam-session = {
url = "github:Jovian-Experiments/Jovian-NixOS";
follows = "chaotic/jovian";
};
''
else
""
}
# Apps
${
if (hyprland) then
''
hyprland.url = "git+https://github.com/hyprwm/Hyprland?submodules=1";
hyprland-plugins = {
url = "github:hyprwm/hyprland-plugins";
inputs.hyprland.follows = "hyprland";
};
''
else
""
}
phps = {
url = "github:fossar/nix-phps/5c2a9bf0246b7f38b7ca737f0f1f36d5b45ae15a";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/b73c2221a46c13557b1b3be9c2070cc42cf01eb3";
};
pipewire-screenaudio = {
url = "github:IceDBorn/pipewire-screenaudio";
inputs.nixpkgs.follows = "nixpkgs";
};
shell-in-netns = {
url = "github:jim3692/shell-in-netns";
inputs.nixpkgs.follows = "nixpkgs";
};
${
if (switch-emulators) then
''
switch-emulators = {
url = "git+https:///codeberg.org/K900/yuzu-flake";
inputs.nixpkgs.follows = "nixpkgs";
};
''
else
""
}
};
outputs =
{
self,
chaotic,
nixpkgs,
home-manager,
nerivations,
phps,
pipewire-screenaudio,
shell-in-netns,
${if (steam-session) then ''steam-session,'' else ""}
${if (hyprland) then ''hyprland,hyprland-plugins,'' else ""}
${if (switch-emulators) then ''switch-emulators,'' else ""}
}@inputs:
{
nixosConfigurations.''${nixpkgs.lib.fileContents "/etc/hostname"} = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
specialArgs = {
inherit inputs;
};
modules = [
# Read configuration location
(
{ lib, ... }:
let
inherit (lib) mkOption types fileContents;
in
{
options.icedos.configurationLocation = mkOption {
type = types.str;
default = fileContents "/tmp/configuration-location";
};
}
)
# Internal modules
./modules.nix
# External modules
chaotic.nixosModules.default
home-manager.nixosModules.home-manager
nerivations.nixosModules.default
${
if (!server && steam-session) then
''
steam-session.nixosModules.default
./system/desktop/steam-session.nix
''
else
""
}
${
if (!server && hyprland) then
''
hyprland.nixosModules.default
./system/desktop/hyprland
''
else
""
}
${
if (!server) then
''
./system/desktop
./system/desktop/gnome
''
else
""
}
${concatImapStrings (i: user: "./system/applications/users/${user}\n") users}
];
};
};
}
'';
}