|
| 1 | +{ callPackage, lib, ... }: |
| 2 | +let |
| 3 | + spicePkgs = callPackage ../pkgs { }; |
| 4 | +in |
1 | 5 | {
|
2 |
| - callPackage, |
3 |
| - lib, |
4 |
| - ... |
5 |
| -}: let |
6 |
| - spicePkgs = callPackage ../pkgs {}; |
7 |
| -in { |
8 |
| - types = callPackage ./types.nix {}; |
| 6 | + types = callPackage ./types.nix { }; |
9 | 7 |
|
10 | 8 | createXpuiINI = lib.generators.toINI {
|
11 | 9 | # specifies how to format a key/value pair
|
12 |
| - mkKeyValue = |
13 |
| - lib.generators.mkKeyValueDefault |
14 |
| - { |
15 |
| - # specifies the generated string for a subset of nix values |
16 |
| - mkValueString = v: |
17 |
| - if v == true |
18 |
| - then "1" |
19 |
| - else if v == false |
20 |
| - then "0" |
21 |
| - # else if isString v then ''"${v}"'' |
22 |
| - # and delegates all other values to the default generator |
23 |
| - else lib.generators.mkValueStringDefault {} v; |
24 |
| - } "="; |
| 10 | + mkKeyValue = lib.generators.mkKeyValueDefault { |
| 11 | + # specifies the generated string for a subset of nix values |
| 12 | + mkValueString = |
| 13 | + v: |
| 14 | + if v == true then |
| 15 | + "1" |
| 16 | + else if v == false then |
| 17 | + "0" |
| 18 | + # else if isString v then ''"${v}"'' |
| 19 | + # and delegates all other values to the default generator |
| 20 | + else |
| 21 | + lib.generators.mkValueStringDefault { } v; |
| 22 | + } "="; |
25 | 23 | };
|
26 | 24 |
|
27 |
| - spicetifyBuilder = callPackage ./spicetify-builder.nix {}; |
| 25 | + spicetifyBuilder = callPackage ./spicetify-builder.nix { }; |
28 | 26 |
|
29 |
| - xpuiBuilder = callPackage ./xpui-builder.nix {}; |
| 27 | + xpuiBuilder = callPackage ./xpui-builder.nix { }; |
30 | 28 |
|
31 |
| - getThemePath = theme: |
32 |
| - if (builtins.hasAttr "appendName" theme) |
33 |
| - then |
34 |
| - ( |
35 |
| - if theme.appendName |
36 |
| - then "${theme.src}/${theme.name}" |
37 |
| - else theme.src |
38 |
| - ) |
39 |
| - else theme.src; |
| 29 | + getThemePath = |
| 30 | + theme: |
| 31 | + if (builtins.hasAttr "appendName" theme) then |
| 32 | + (if theme.appendName then "${theme.src}/${theme.name}" else theme.src) |
| 33 | + else |
| 34 | + theme.src; |
40 | 35 |
|
41 | 36 | # same thing but if its a string it looks it up in the default pkgs
|
42 |
| - getTheme = theme: |
43 |
| - if builtins.typeOf theme == "string" |
44 |
| - then |
| 37 | + getTheme = |
| 38 | + theme: |
| 39 | + if builtins.typeOf theme == "string" then |
45 | 40 | (
|
46 |
| - if builtins.hasAttr theme spicePkgs.themes |
47 |
| - then |
48 |
| - (lib.trivial.warn |
49 |
| - '' |
50 |
| - Using a string like so: |
51 |
| - programs.spicetify.theme = "${theme}"; |
52 |
| - is deprecated. Please use the following format: |
53 |
| - programs.spicetify.theme = let |
54 |
| - spicePkgs = spicetify-nix.packages.${"$\{pkgs.system}"}.default; |
55 |
| - in |
56 |
| - spicePkgs.themes.${theme}; |
57 |
| - '' |
58 |
| - spicePkgs.themes.${theme}) |
59 |
| - else throw "Unknown theme ${theme}. Try using the lib.theme type instead of a string." |
| 41 | + if builtins.hasAttr theme spicePkgs.themes then |
| 42 | + (lib.trivial.warn '' |
| 43 | + Using a string like so: |
| 44 | + programs.spicetify.theme = "${theme}"; |
| 45 | + is deprecated. Please use the following format: |
| 46 | + programs.spicetify.theme = let |
| 47 | + spicePkgs = spicetify-nix.packages.${"$\{pkgs.system}"}.default; |
| 48 | + in |
| 49 | + spicePkgs.themes.${theme}; |
| 50 | + '' spicePkgs.themes.${theme}) |
| 51 | + else |
| 52 | + throw "Unknown theme ${theme}. Try using the lib.theme type instead of a string." |
60 | 53 | )
|
61 |
| - else if theme == null |
62 |
| - then |
63 |
| - lib.trivial.warn |
64 |
| - "spicetify: null theme passed to getTheme, assuming official.Default" |
65 |
| - spicePkgs.themes.official.Default |
66 |
| - else theme; |
| 54 | + else if theme == null then |
| 55 | + lib.trivial.warn "spicetify: null theme passed to getTheme, assuming official.Default" spicePkgs.themes.official.Default |
| 56 | + else |
| 57 | + theme; |
67 | 58 |
|
68 |
| - getExtension = ext: |
69 |
| - if builtins.typeOf ext == "string" |
70 |
| - then |
| 59 | + getExtension = |
| 60 | + ext: |
| 61 | + if builtins.typeOf ext == "string" then |
71 | 62 | (
|
72 |
| - if builtins.hasAttr ext spicePkgs.extensions |
73 |
| - then |
74 |
| - (lib.trivial.warn |
75 |
| - '' |
76 |
| - Using a string like so: |
77 |
| - programs.spicetify.enabledExtensions = [ "${ext}" ]; |
78 |
| - is deprecated. Please use the following format: |
79 |
| - programs.spicetify.enabledExtensions = let |
80 |
| - spicePkgs = spicetify-nix.packages.${"$\{pkgs.system}"}.default; |
81 |
| - in |
82 |
| - with spicePkgs.extensions [ ${spicePkgs.extensions._lib.sanitizeName ext} ]; |
83 |
| - '' |
84 |
| - spicePkgs.extensions.${ext}) |
85 |
| - else throw "Unknown extension ${ext}. Try using the lib.extension type instead of a string." |
| 63 | + if builtins.hasAttr ext spicePkgs.extensions then |
| 64 | + (lib.trivial.warn '' |
| 65 | + Using a string like so: |
| 66 | + programs.spicetify.enabledExtensions = [ "${ext}" ]; |
| 67 | + is deprecated. Please use the following format: |
| 68 | + programs.spicetify.enabledExtensions = let |
| 69 | + spicePkgs = spicetify-nix.packages.${"$\{pkgs.system}"}.default; |
| 70 | + in |
| 71 | + with spicePkgs.extensions [ ${spicePkgs.extensions._lib.sanitizeName ext} ]; |
| 72 | + '' spicePkgs.extensions.${ext}) |
| 73 | + else |
| 74 | + throw "Unknown extension ${ext}. Try using the lib.extension type instead of a string." |
86 | 75 | )
|
87 |
| - else ext; |
| 76 | + else |
| 77 | + ext; |
88 | 78 |
|
89 |
| - getApp = app: |
90 |
| - if builtins.typeOf app == "string" |
91 |
| - then |
| 79 | + getApp = |
| 80 | + app: |
| 81 | + if builtins.typeOf app == "string" then |
92 | 82 | (
|
93 |
| - if builtins.hasAttr app spicePkgs.apps |
94 |
| - then |
95 |
| - ( |
96 |
| - lib.trivial.warn |
97 |
| - '' |
98 |
| - Using a string like so: |
99 |
| - programs.spicetify.enabledCustomApps = [ "${app}" ]; |
100 |
| - is deprecated. Please use the following format: |
101 |
| - programs.spicetify.enabledCustomApps = let |
102 |
| - spicePkgs = spicetify-nix.packages.${"$\{pkgs.system}"}.default; |
103 |
| - in |
104 |
| - with spicePkgs.apps [ ${app} ]; |
105 |
| - '' |
106 |
| - spicePkgs.apps.${app} |
107 |
| - ) |
108 |
| - else throw "Unknown CustomApp ${app}. Try using the lib.app type instead of a string." |
| 83 | + if builtins.hasAttr app spicePkgs.apps then |
| 84 | + (lib.trivial.warn '' |
| 85 | + Using a string like so: |
| 86 | + programs.spicetify.enabledCustomApps = [ "${app}" ]; |
| 87 | + is deprecated. Please use the following format: |
| 88 | + programs.spicetify.enabledCustomApps = let |
| 89 | + spicePkgs = spicetify-nix.packages.${"$\{pkgs.system}"}.default; |
| 90 | + in |
| 91 | + with spicePkgs.apps [ ${app} ]; |
| 92 | + '' spicePkgs.apps.${app}) |
| 93 | + else |
| 94 | + throw "Unknown CustomApp ${app}. Try using the lib.app type instead of a string." |
109 | 95 | )
|
110 |
| - else app; |
| 96 | + else |
| 97 | + app; |
111 | 98 | }
|
0 commit comments