Skip to content

Commit 3fa05c2

Browse files
authored
Merge pull request #35 from yunfachi/feat/extensions
lib: add extensions
2 parents 888e92b + caddd03 commit 3fa05c2

File tree

38 files changed

+1779
-515
lines changed

38 files changed

+1779
-515
lines changed

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ Custom modules allow you to define options and related configurations in a flexi
2323
* **Hosts**: Unique configurations tailored for each machine.
2424
* **Rices**: Customizations that can be applied to all hosts.
2525

26+
### Extensions
27+
Write your own extensions for the Denix or use existing ones that add new functions and modules.
28+
2629
### Unified NixOS, Home Manager, and Nix-Darwin Configurations
2730
Write your NixOS, Home Manager, and Nix-Darwin configurations in a single file*, and Denix will automatically handle the separation for you.
2831

@@ -39,3 +42,9 @@ Hosts and initial modules without rices:
3942
```sh
4043
nix flake init -t github:yunfachi/denix#minimal-no-rices
4144
```
45+
46+
### [extensions-collection](./templates/extensions-collection/)
47+
Flake for creating your own collection of Denix extensions:
48+
```sh
49+
nix flake init -t github:yunfachi/denix#extensions-collection
50+
```

docs/.vitepress/config.mts

Lines changed: 161 additions & 134 deletions
Original file line numberDiff line numberDiff line change
@@ -28,152 +28,179 @@ export default defineConfig({
2828
provider: "local",
2929
}
3030
},
31+
markdown: {
32+
image: {
33+
lazyLoading: true,
34+
},
35+
},
3136
locales: {
3237
root: themeConfigEnglish(),
3338
ru: themeConfigRussian()
3439
}
3540
})
3641

37-
function themeConfigEnglish() {return {
38-
label: "English",
39-
lang: "en",
40-
link: "/",
41-
title: "Denix Documentation",
42-
description: "Nix library for creating scalable NixOS, Home Manager, and Nix-Darwin configurations with modules, hosts, and rices",
42+
function themeConfigEnglish() {
43+
return {
44+
label: "English",
45+
lang: "en",
46+
link: "/",
47+
title: "Denix Documentation",
48+
description: "Nix library for creating scalable NixOS, Home Manager, and Nix-Darwin configurations with modules, hosts, and rices",
4349

44-
themeConfig: {
45-
editLink: {
46-
pattern: "https://github.com/yunfachi/denix/edit/master/docs/src/:path",
47-
text: "Edit this page on Github"
48-
},
50+
themeConfig: {
51+
editLink: {
52+
pattern: "https://github.com/yunfachi/denix/edit/master/docs/src/:path",
53+
text: "Edit this page on Github"
54+
},
4955

50-
nav: [
51-
{ text: "Home", link: "/" },
52-
{ text: "Introduction", link: "/getting_started/introduction" }
53-
],
56+
nav: [
57+
{ text: "Home", link: "/" },
58+
{ text: "Introduction", link: "/getting_started/introduction" }
59+
],
5460

55-
sidebar: [
56-
{
57-
text: "Getting Started",
58-
items: [
59-
{ text: "Introduction", link: "/getting_started/introduction" },
60-
{ text: "Initialization", link: "/getting_started/initialization" },
61-
{ text: "First Modules", link: "/getting_started/first_modules" },
62-
{ text: "Transfer to Denix", link: "/getting_started/transfer_to_denix" },
63-
],
64-
},
65-
{
66-
text: "Modules",
67-
items: [
68-
{ text: "Introduction to NixOS Modules", link: "/modules/introduction-nixos" },
69-
{ text: "Introduction", link: "/modules/introduction" },
70-
{ text: "Structure", link: "/modules/structure" },
71-
{ text: "Examples", link: "/modules/examples" }
72-
],
73-
},
74-
{
75-
text: "Options",
76-
items: [
77-
{ text: "Introduction", link: "/options/introduction" },
78-
],
79-
},
80-
{
81-
text: "Hosts",
82-
items: [
83-
{ text: "Introduction", link: "/hosts/introduction" },
84-
{ text: "Structure", link: "/hosts/structure" },
85-
{ text: "Examples", link: "/hosts/examples" }
86-
],
87-
},
88-
{
89-
text: "Configurations (flakes)",
90-
items: [
91-
{ text: "Introduction", link: "/configurations/introduction" },
92-
{ text: "Structure", link: "/configurations/structure" }
93-
],
94-
},
95-
{
96-
text: "Rices",
97-
items: [
98-
{ text: "Introduction", link: "/rices/introduction" },
99-
{ text: "Structure", link: "/rices/structure" },
100-
{ text: "Examples", link: "/rices/examples" }
101-
],
102-
},
103-
{ text: "Common Errors", link: "/troubleshooting" },
104-
{ text: "Real Configurations", link: "/real-configurations" },
105-
],
61+
sidebar: [
62+
{
63+
text: "Getting Started",
64+
items: [
65+
{ text: "Introduction", link: "/getting_started/introduction" },
66+
{ text: "Initialization", link: "/getting_started/initialization" },
67+
{ text: "First Modules", link: "/getting_started/first_modules" },
68+
{ text: "Transfer to Denix", link: "/getting_started/transfer_to_denix" },
69+
],
70+
},
71+
{
72+
text: "Modules",
73+
items: [
74+
{ text: "Introduction to NixOS Modules", link: "/modules/introduction-nixos" },
75+
{ text: "Introduction", link: "/modules/introduction" },
76+
{ text: "Structure", link: "/modules/structure" },
77+
{ text: "Examples", link: "/modules/examples" }
78+
],
79+
},
80+
{
81+
text: "Options",
82+
items: [
83+
{ text: "Introduction", link: "/options/introduction" },
84+
],
85+
},
86+
{
87+
text: "Hosts",
88+
items: [
89+
{ text: "Introduction", link: "/hosts/introduction" },
90+
{ text: "Structure", link: "/hosts/structure" },
91+
{ text: "Examples", link: "/hosts/examples" }
92+
],
93+
},
94+
{
95+
text: "Configurations (flakes)",
96+
items: [
97+
{ text: "Introduction", link: "/configurations/introduction" },
98+
{ text: "Structure", link: "/configurations/structure" }
99+
],
100+
},
101+
{
102+
text: "Extensions",
103+
items: [
104+
{ text: "Introduction", link: "/extensions/introduction" },
105+
{ text: "Structure", link: "/extensions/structure" },
106+
{ text: "Development", link: "/extensions/development" },
107+
{ text: "All Extensions", link: "/extensions/all-extensions" }
108+
],
109+
},
110+
{
111+
text: "Rices",
112+
items: [
113+
{ text: "Introduction", link: "/rices/introduction" },
114+
{ text: "Structure", link: "/rices/structure" },
115+
{ text: "Examples", link: "/rices/examples" }
116+
],
117+
},
118+
{ text: "Common Errors", link: "/troubleshooting" },
119+
{ text: "Real Configurations", link: "/real-configurations" },
120+
],
121+
}
106122
}
107-
}}
123+
}
108124

109-
function themeConfigRussian() {return {
110-
label: "Русский",
111-
lang: "ru",
112-
link: "/ru/",
113-
title: "Denix Документация",
114-
description: "Библиотека Nix для создания масштабируемых конфигураций NixOS, Home Manager и Nix-Darwin с модулями, хостами и райсами",
125+
function themeConfigRussian() {
126+
return {
127+
label: "Русский",
128+
lang: "ru",
129+
link: "/ru/",
130+
title: "Denix Документация",
131+
description: "Библиотека Nix для создания масштабируемых конфигураций NixOS, Home Manager и Nix-Darwin с модулями, хостами и райсами",
115132

116-
themeConfig: {
117-
editLink: {
118-
pattern: "https://github.com/yunfachi/denix/edit/master/docs/src/:path",
119-
text: "Редактировать эту страницу на GitHub"
120-
},
133+
themeConfig: {
134+
editLink: {
135+
pattern: "https://github.com/yunfachi/denix/edit/master/docs/src/:path",
136+
text: "Редактировать эту страницу на GitHub"
137+
},
121138

122-
nav: [
123-
{ text: "Главная", link: "/ru/" },
124-
{ text: "Вступление", link: "/ru/getting_started/introduction" }
125-
],
139+
nav: [
140+
{ text: "Главная", link: "/ru/" },
141+
{ text: "Вступление", link: "/ru/getting_started/introduction" }
142+
],
126143

127-
sidebar: [
128-
{
129-
text: "Начнем",
130-
items: [
131-
{ text: "Вступление", link: "/ru/getting_started/introduction" },
132-
{ text: "Инициализация", link: "/ru/getting_started/initialization" },
133-
{ text: "Первые модули", link: "/ru/getting_started/first_modules" },
134-
{ text: "Перенос на Denix", link: "/ru/getting_started/transfer_to_denix" },
135-
],
136-
},
137-
{
138-
text: "Модули",
139-
items: [
140-
{ text: "Вступление в модули NixOS", link: "/ru/modules/introduction-nixos" },
141-
{ text: "Вступление", link: "/ru/modules/introduction" },
142-
{ text: "Структура", link: "/ru/modules/structure" },
143-
{ text: "Примеры", link: "/ru/modules/examples" },
144-
],
145-
},
146-
{
147-
text: "Опции",
148-
items: [
149-
{ text: "Вступление", link: "/ru/options/introduction" },
150-
],
151-
},
152-
{
153-
text: "Хосты",
154-
items: [
155-
{ text: "Вступление", link: "/ru/hosts/introduction" },
156-
{ text: "Структура", link: "/ru/hosts/structure" },
157-
{ text: "Примеры", link: "/ru/hosts/examples" },
158-
],
159-
},
160-
{
161-
text: "Конфигурации (флейки)",
162-
items: [
163-
{ text: "Вступление", link: "/ru/configurations/introduction" },
164-
{ text: "Структура", link: "/ru/configurations/structure" },
165-
],
166-
},
167-
{
168-
text: "Райсы",
169-
items: [
170-
{ text: "Вступление", link: "/ru/rices/introduction" },
171-
{ text: "Структура", link: "/ru/rices/structure" },
172-
{ text: "Примеры", link: "/ru/rices/examples" },
173-
],
174-
},
175-
{ text: "Распространённые ошибки", link: "/ru/troubleshooting" },
176-
{ text: "Реальные конфигурации", link: "/ru/real-configurations" },
177-
],
144+
sidebar: [
145+
{
146+
text: "Начнем",
147+
items: [
148+
{ text: "Вступление", link: "/ru/getting_started/introduction" },
149+
{ text: "Инициализация", link: "/ru/getting_started/initialization" },
150+
{ text: "Первые модули", link: "/ru/getting_started/first_modules" },
151+
{ text: "Перенос на Denix", link: "/ru/getting_started/transfer_to_denix" },
152+
],
153+
},
154+
{
155+
text: "Модули",
156+
items: [
157+
{ text: "Вступление в модули NixOS", link: "/ru/modules/introduction-nixos" },
158+
{ text: "Вступление", link: "/ru/modules/introduction" },
159+
{ text: "Структура", link: "/ru/modules/structure" },
160+
{ text: "Примеры", link: "/ru/modules/examples" },
161+
],
162+
},
163+
{
164+
text: "Опции",
165+
items: [
166+
{ text: "Вступление", link: "/ru/options/introduction" },
167+
],
168+
},
169+
{
170+
text: "Хосты",
171+
items: [
172+
{ text: "Вступление", link: "/ru/hosts/introduction" },
173+
{ text: "Структура", link: "/ru/hosts/structure" },
174+
{ text: "Примеры", link: "/ru/hosts/examples" },
175+
],
176+
},
177+
{
178+
text: "Конфигурации (флейки)",
179+
items: [
180+
{ text: "Вступление", link: "/ru/configurations/introduction" },
181+
{ text: "Структура", link: "/ru/configurations/structure" },
182+
],
183+
},
184+
{
185+
text: "Расширения",
186+
items: [
187+
{ text: "Вступление", link: "/ru/extensions/introduction" },
188+
{ text: "Структура", link: "/ru/extensions/structure" },
189+
{ text: "Разработка", link: "/ru/extensions/development" },
190+
{ text: "Все расширения", link: "/ru/extensions/all-extensions" }
191+
],
192+
},
193+
{
194+
text: "Райсы",
195+
items: [
196+
{ text: "Вступление", link: "/ru/rices/introduction" },
197+
{ text: "Структура", link: "/ru/rices/structure" },
198+
{ text: "Примеры", link: "/ru/rices/examples" },
199+
],
200+
},
201+
{ text: "Распространённые ошибки", link: "/ru/troubleshooting" },
202+
{ text: "Реальные конфигурации", link: "/ru/real-configurations" },
203+
],
204+
}
178205
}
179-
}}
206+
}

docs/.vitepress/theme/style.css

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,3 +153,6 @@ html:not(.dark) {
153153
--docsearch-primary-color: var(--vp-c-brand-1) !important;
154154
}
155155

156+
.vp-doc .extension-table tr:nth-child(2n) {
157+
background-color: var(--vp-c-bg) !important;
158+
}

docs/src/configurations/introduction.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ Based on this, several usage options are possible:
110110
};
111111
112112
mkConfigurations = moduleSystem:
113-
nixpkgs-unstable.lib.attrsets.mergeAttrsList
113+
nixpkgs-unstable.lib.attrsets.mergeAttrsList
114114
(map (f: f moduleSystem) [
115115
(_mkConfigurations nixpkgs-stable home-manager-stable nix-darwin-stable [./hosts/stable])
116116
(_mkConfigurations nixpkgs-unstable home-manager-unstable nix-darwin-unstable [./hosts/unstable])

docs/src/configurations/structure.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
## Function Arguments {#function-arguments}
44
- `myconfigName` (string): the category for all Denix module options, hosts, and rices. Defaults to `myconfig`; changes are not recommended.
55
- `denixLibName` (string): the name of the Denix library in `specialArgs` (`{denixLibName, ...}: denixLibName.module { ... }`). Defaults to `delib`; changes are not recommended.
6+
- `extensions` (listOf delib.extension): a list of extensions to be applied to the configuration. Defaults to `[]`.
67
- `nixpkgs` (nixpkgs): used to override nixpkgs in your configuration, equivalent to `inputs.denix.inputs.nixpkgs.follows`. Defaults to `inputs.nixpkgs`.
78
- `home-manager` (home-manager): used to override home-manager in your configuration, equivalent to `inputs.denix.inputs.home-manager.follows`. Defaults to `inputs.home-manager`.
89
- `nix-darwin` (nix-darwin): used to override nix-darwin in your configuration, equivalent to `inputs.denix.inputs.nix-darwin.follows`. Defaults to `inputs.nix-darwin`.
@@ -21,6 +22,7 @@
2122
delib.configurations rec {
2223
myconfigName = "myconfig";
2324
denixLibName = "delib";
25+
extensions = with delib.extensions; [];
2426
nixpkgs = inputs.nixpkgs;
2527
home-manager = inputs.home-manager;
2628
nix-darwin = inputs.nix-darwin;

0 commit comments

Comments
 (0)