Skip to content

Commit 48fa924

Browse files
committed
feat(repositories): add optional dependencies (#35)
1 parent c06d2a0 commit 48fa924

File tree

4 files changed

+45
-22
lines changed

4 files changed

+45
-22
lines changed

config.toml

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
[[icedos.repositories]]
22
url = "github:icedos/apps"
3+
fetchOptionalDependencies = true
34
modules = [
45
"btop",
56
"celluloid",
@@ -15,6 +16,7 @@ modules = [
1516
"network-manager",
1617
"obs",
1718
"proton-launch",
19+
"reigntweak",
1820
"scx",
1921
"sd-inhibitor",
2022
"steam",
@@ -150,6 +152,7 @@ serviceArgs = "-p 0 -v 3C -f A0"
150152

151153
[[icedos.repositories]]
152154
url = "github:icedos/cosmic"
155+
fetchOptionalDependencies = true
153156

154157
[icedos.desktop.cosmic.wallpaper]
155158
wallpaper = "path:/home/icedborn/Pictures/wallpaper.jpg"
@@ -206,15 +209,6 @@ startupScript = """
206209
zen-social &
207210
"""
208211

209-
[[icedos.repositories]]
210-
url = "github:icedos/desktop"
211-
modules = ["cosmic-greeter"]
212-
213-
[icedos.desktop]
214-
autologinUser = "icedborn"
215-
216-
[icedos.desktop.users.icedborn]
217-
218212
[[icedos.repositories]]
219213
url = "github:icedos/hardware"
220214
modules = [
@@ -291,5 +285,26 @@ url = "github:icedos/users"
291285
[icedos.users.icedborn]
292286
description = "IceDBorn"
293287

288+
[icedos.desktop]
289+
autologinUser = "icedborn"
290+
291+
[icedos.desktop.users.icedborn]
292+
294293
[icedos.system]
295294
version = "23.05"
295+
296+
# [[icedos.system.channels]]
297+
# name = "master"
298+
# url = "github:nixos/nixpkgs/master"
299+
300+
[[icedos.system.channels]]
301+
name = "small"
302+
url = "github:nixos/nixpkgs/nixos-unstable-small"
303+
304+
# [[icedos.system.channels]]
305+
# name = "unstable"
306+
# url = "github:nixos/nixpkgs/nixpkgs-unstable"
307+
308+
# [[icedos.system.channels]]
309+
# name = "stable"
310+
# url = "github:nixos/nixpkgs/nixos-25.05"

lib/genflake.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ in
6060
system = "${system}";
6161
pkgs = nixpkgs.legacyPackages.''${system};
6262
inherit (pkgs) lib;
63-
inherit (lib) fileContents flatten map;
63+
inherit (lib) fileContents map;
6464
6565
inherit (builtins) fromTOML;
6666
inherit ((fromTOML (fileContents ./config.toml))) icedos;

lib/icedos.nix

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ let
213213
length
214214
;
215215

216-
inherit (lib) optional unique;
216+
inherit (lib) optional optionals unique;
217217

218218
getModuleKey = url: name: "${url}/${name}";
219219

@@ -276,16 +276,24 @@ let
276276
# Get deps
277277
innerDeps = flatMap (
278278
mod:
279-
map (
280-
{
281-
url ? newDep.url,
282-
modules ? [ ],
283-
}:
284-
{
285-
url = if (url == "self") then newDep.url else url;
286-
modules = filter (mod: !elem (getModuleKey url mod) allKnownKeys) modules;
287-
}
288-
) (mod.meta.dependencies or [ ])
279+
map
280+
(
281+
{
282+
url ? newDep.url,
283+
modules ? [ ],
284+
}:
285+
{
286+
url = if (url == "self") then newDep.url else url;
287+
modules = filter (mod: !elem (getModuleKey url mod) allKnownKeys) modules;
288+
}
289+
)
290+
(
291+
let
292+
inherit (mod) meta;
293+
in
294+
(meta.dependencies or [ ])
295+
++ optionals (newDep.fetchOptionalDependencies or false) (meta.optionalDependencies or [ ])
296+
)
289297
) newModules;
290298
in
291299
flatten (

modules/options.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ in
3333
};
3434

3535
repositories = mkSubmoduleListOption { } {
36-
name = mkStrOption { };
3736
url = mkStrOption { };
37+
fetchOptionalDependencies = mkBoolOption { };
3838
modules = mkStrListOption { };
3939
};
4040
};

0 commit comments

Comments
 (0)