1
0
forked from clan/clan-core

Compare commits

...

339 Commits

Author SHA1 Message Date
0027c46313 Merge pull request 'zerotier-static-peers: use correct exclusion source' (#1548) from kenji/clan-core:modules/fix/static into main
Reviewed-on: clan/clan-core#1548
2024-06-03 21:24:29 +00:00
ca2001040b zerotier-static-peers: use correct exclusion source 2024-06-03 22:53:44 +02:00
d6725100ac Merge pull request 'zerotier-static-peers: add guard condition' (#1547) from kenji/clan-core:modules/add/zerotier-guard into main
Reviewed-on: clan/clan-core#1547
2024-06-03 20:47:03 +00:00
503ce29c84 zerotier-static-peers: add guard condition 2024-06-03 22:42:04 +02:00
87444cd2b8 Merge pull request 'clan: add dyncamic completions for secrets' (#1546) from kenji/clan-core:kenji-clan/secrets-dynamic/add-completion into main
Reviewed-on: clan/clan-core#1546
2024-06-03 19:55:12 +00:00
31eca9e8bc clan: add dyncamic completions for secrets 2024-06-03 21:47:14 +02:00
822afe08b5 Merge pull request 'clan: add dynamic machine completions to clan secrets subcommands' (#1545) from clan/secrets/add-completions into main
Reviewed-on: clan/clan-core#1545
2024-06-03 15:42:37 +00:00
cfb78b0edb clan: add dynamic machine completions to clan secrets subcommands 2024-06-03 17:32:33 +02:00
65fd7d3efe Merge pull request 'clan: add dynamic completion to clan machines show' (#1544) from kenji-clan/machine-show/add-commpletion into main
Reviewed-on: clan/clan-core#1544
2024-06-03 15:15:45 +00:00
e8241fb7c9 clan: add dynamic completion to clan machines show 2024-06-03 17:06:03 +02:00
259d51bdc8 Merge pull request 'clan.static-hosts: excludeHosts should be empty if topLevelDomain is defined.' (#1538) from mrvandalo/clan-core:feature/static-hosts-exclude-nothing-when-tld-is-given into main
Reviewed-on: clan/clan-core#1538
Reviewed-by: kenji <aks.kenji@protonmail.com>
2024-06-03 10:44:41 +00:00
f6fb52afbf clan.static-hosts: excludeHosts should be empty if topLevelDomain is defined. 2024-06-03 10:44:41 +00:00
8089b87bbb Merge pull request 'Revert "clan-cli: cmd.py uses pseudo terminal now. Remove tty.py. Refactor password_store.py to use cmd.py."' (#1543) from lassulus/clan-core:lassulus-HEAD into main 2024-06-03 10:30:50 +00:00
578162425d Revert "clan-cli: cmd.py uses pseudo terminal now. Remove tty.py. Refactor password_store.py to use cmd.py."
This reverts commit ba86b49952.
2024-06-03 12:25:20 +02:00
dbad63f155 Merge pull request 'clan_cli secrets_upload: fix permissions' (#1542) from lassulus/clan-core:lassulus-HEAD into main 2024-06-03 08:58:49 +00:00
da8a733899 clan_cli secrets_upload: fix permissions 2024-06-03 10:52:18 +02:00
8f58f1998d Merge pull request 'Automatic flake update - 2024-06-03T00:00+00:00' (#1540) from flake-update-2024-06-03 into main 2024-06-03 00:05:17 +00:00
Clan Merge Bot
c43fe5187f update flake lock - 2024-06-03T00:00+00:00
Flake lock file updates:

• Updated input 'disko':
    'github:nix-community/disko/10986091e47fb1180620b78438512b294b7e8f67' (2024-05-27)
  → 'github:nix-community/disko/0274af4c92531ebfba4a5bd493251a143bc51f3c' (2024-05-31)
• Updated input 'flake-parts':
    'github:hercules-ci/flake-parts/8dc45382d5206bd292f9c2768b8058a8fd8311d9' (2024-05-16)
  → 'github:hercules-ci/flake-parts/2a55567fcf15b1b1c7ed712a2c6fadaec7412ea8' (2024-06-01)
• Updated input 'nixos-images':
    'github:nix-community/nixos-images/2478833ef8cc6de3d9e331f53b6f3682e425f207' (2024-05-27)
  → 'github:nix-community/nixos-images/47bfb55316e105390dd761e0b6e8e0be09462b67' (2024-05-30)
• Updated input 'nixos-images/nixos-2311':
    'github:NixOS/nixpkgs/0c007b36981bdbd69ccf0c7df30a174e63660667' (2024-05-26)
  → 'github:NixOS/nixpkgs/64e468fd2652105710d86cd2ae3e65a5a6d58dec' (2024-05-29)
• Updated input 'nixpkgs':
    'github:NixOS/nixpkgs/4ae13643e7f2cd4bc6555fce074865d9d14e7c24' (2024-05-28)
  → 'github:NixOS/nixpkgs/6634a0509e9e81e980b129435fbbec518ab246d0' (2024-06-02)
• Updated input 'sops-nix':
    'github:Mic92/sops-nix/962797a8d7f15ed7033031731d0bb77244839960' (2024-05-26)
  → 'github:Mic92/sops-nix/ab2a43b0d21d1d37d4d5726a892f714eaeb4b075' (2024-06-02)
• Updated input 'treefmt-nix':
    'github:numtide/treefmt-nix/2fba33a182602b9d49f0b2440513e5ee091d838b' (2024-05-17)
  → 'github:numtide/treefmt-nix/3eb96ca1ae9edf792a8e0963cc92fddfa5a87706' (2024-06-01)
2024-06-03 00:00:22 +00:00
0993fe45f6 Merge pull request 'clan-cli: cmd.py uses pseudo terminal now. Remove tty.py. Refactor password_store.py to use cmd.py' (#1536) from Qubasa/clan-core:Qubasa-main into main 2024-06-02 14:56:41 +00:00
ba86b49952 clan-cli: cmd.py uses pseudo terminal now. Remove tty.py. Refactor password_store.py to use cmd.py. 2024-06-02 16:52:31 +02:00
0b34c340fc Merge pull request 'clan-cli: Refactor machines/update.py to cmd.run' (#1535) from Qubasa/clan-core:Qubasa-main into main 2024-06-02 08:04:18 +00:00
d513f66170 clan-cli: Refactor machines/update.py to cmd.run 2024-06-02 10:00:23 +02:00
320fb776ea Merge pull request 'clan-cli: Add input arg to cmd.run. Replace subprocess.run in password_store' (#1533) from Qubasa/clan-core:Qubasa-main into main 2024-06-02 07:57:18 +00:00
1a39957dbb clan-cli: Refactor subprocess.run to cmd.run. tea-create-pr: Fix missing fail-on-change for treefmt 2024-06-02 09:53:24 +02:00
b5abe4025a Merge pull request 'docs: Add meta tags for link preview and fix js loading issue.' (#1531) from Qubasa/clan-core:Qubasa-main into main 2024-06-01 20:23:30 +00:00
55f4dcc460 docs: Add meta tags for link preview and fix js loading issue. 2024-06-01 22:19:37 +02:00
ef4a83f739 Merge pull request 'clan-core: add clan meta for ui usage' (#1529) from hsjobeki-main into main
Reviewed-on: clan/clan-core#1529
2024-05-31 16:26:46 +00:00
133f2b705f clan-core: add template to impure tests 2024-05-31 16:26:46 +00:00
83fe58e003 clan-core: add clan meta for ui usage 2024-05-31 16:26:46 +00:00
481f926b17 Merge pull request 'split list machines into show machine command' (#1521) from machines-show into main 2024-05-31 15:00:03 +00:00
788eae432a split list machines into show machine command 2024-05-31 16:56:09 +02:00
b7936c4ed2 Merge pull request 'upgrade nix in development to latest' (#1528) from nix-latest into main 2024-05-31 14:41:21 +00:00
750c8df003 upgrade nix in development to latest
Better error messages!!
2024-05-31 16:37:07 +02:00
276c39aba4 Merge pull request 'Contributing.md: Fix incorrect formating.' (#1527) from Qubasa/clan-core:Qubasa-main into main 2024-05-31 14:02:18 +00:00
90e25eeb76 Contributing.md: Fix incorrect formating. 2024-05-31 15:58:29 +02:00
56676701ae Merge pull request 'clan: add dynamic completions for fact generation services' (#1525) from a-kenji-clan/complete-services into main 2024-05-31 13:25:15 +00:00
bcccf301f0 clan: add dynamic completions for fact generation services 2024-05-31 15:21:07 +02:00
e343ba5635 Merge pull request 'Contributing.md: Explain merge-after-ci for externals.' (#1524) from Qubasa/clan-core:Qubasa-main into main 2024-05-31 12:02:02 +00:00
66fe5ec4fd Contributing.md: Explain merge-after-ci for externals. 2024-05-31 13:58:13 +02:00
f2a884ec30 Merge pull request 'clan: add completion timeout as static' (#1523) from a-kenji-clan/completions into main 2024-05-31 11:10:52 +00:00
d31aa7cf88 clan: add completion timeout as static 2024-05-31 13:06:46 +02:00
9f19a8e605 Merge pull request 'clan: add dynamic completions' (#1522) from a-kenji-clan/cli/init-dynamic-completions into main 2024-05-31 11:00:50 +00:00
23ef39a2d9 clan: add dynamic completions
Add dynamic completion scaffolding to the clan `cli`.
Also add a dynamic completion mechanism for machines for commands that
have machines as their sole argument.

More intricate dynamic completions will be implemented in follow up
PR's.
2024-05-31 12:55:41 +02:00
dda82c49b0 Merge pull request 'tea-create-pr: Add automatic rebase and autostash' (#1518) from Qubasa/clan-core:Qubasa-main into main 2024-05-30 22:03:38 +00:00
c91c90a2a6 tea-create-pr: Add automatic rebase and autostash 2024-05-30 23:59:27 +02:00
5794cdf8fa Merge pull request 'docs: Fix installer wrong indentation' (#1516) from Qubasa/clan-core:Qubasa-main into main 2024-05-30 21:44:41 +00:00
01a4748d6b tea-create-pr: Fix non working assignees label 2024-05-30 23:37:53 +02:00
a8762522c8 tea-create-pr: Better username detection 2024-05-30 23:29:59 +02:00
adef52a938 docs: Fix installer wrong indentation 2024-05-30 22:41:30 +02:00
c8fbf87fc8 Merge pull request 'Change clan favicon to one without text' (#1506) from Qubasa/clan-core:Qubasa-main into main 2024-05-30 20:30:02 +00:00
f63e3618c2 tea-create-pr: Require fork and upstream branch 2024-05-30 22:25:25 +02:00
b18d7bfeac Change clan favicon to one without text 2024-05-30 21:59:48 +02:00
076b98ff00 Merge pull request 'Webview: css font and icon import transformation' (#1501) from hsjobeki-main into main 2024-05-30 16:28:14 +00:00
6999685bba
Webview: css font and icon import transformation 2024-05-30 18:23:49 +02:00
f1c02bbd46 Merge pull request 'Add top level domain option for zerotier machines.' (#1499) from mrvandalo/clan-core:feature/static-host-tld into main
Reviewed-on: clan/clan-core#1499
2024-05-29 18:40:15 +00:00
2caa837537 Add top level domain option for zerotier machines. 2024-05-29 18:40:15 +00:00
e1ddbf226a Merge pull request 'install.sh: improvements' (#1500) from DavHau-install-dev into main 2024-05-29 18:03:50 +00:00
7cb8c114c2 install.sh: improvements
- use either curl or wget
- add to PATH /nix/var/nix/profiles/default/bin
2024-05-29 18:51:34 +02:00
5945630870 Merge pull request 'gui-installer: depend on git + ignore flake config' (#1498) from DavHau-dave into main 2024-05-29 15:48:54 +00:00
ccadac4bb3 gui-installer: depend on git + ignore flake config 2024-05-29 17:42:44 +02:00
15b77f6b8a Merge pull request 'Webview: bootstrap layout' (#1497) from hsjobeki-main into main 2024-05-29 14:45:45 +00:00
9bf76037aa
Webview: bootstrap layout 2024-05-29 16:40:54 +02:00
d0d973b797 Merge pull request 'make config command read-only' (#1319) from config into main
Reviewed-on: clan/clan-core#1319
2024-05-29 11:25:27 +00:00
c1e2bc9ea9 make config command read-only 2024-05-29 13:17:55 +02:00
0eef21e2ef Merge pull request 'Update flakes' (#1492) from pass-nix-options into main 2024-05-29 10:58:19 +00:00
461aa579c2 fmt more stuff 2024-05-29 12:51:43 +02:00
da442c47f6 drop non-compiling wayland-proxy-virtwl 2024-05-29 12:51:18 +02:00
491d37ea67 update flake 2024-05-29 12:51:04 +02:00
7e087d18ee Merge pull request 'fix offline build of flash command' (#1491) from pass-nix-options into main 2024-05-29 10:49:15 +00:00
5c75a6490b fix offline build of flash command 2024-05-29 12:45:50 +02:00
750b6aec59 flash: make configuration more explicit
Injecting nixos configuration and potentially overriding settings a user
made and can cause surprises.
In most cases, users want to just make these option part of their NixOS
configuration and by having the rest in the command line
we make it more explicit what other configuration is being applied.
2024-05-29 12:45:50 +02:00
d138e29a53 Merge pull request 'Consistently pass nix options to underlying tools' (#1488) from pass-nix-options into main 2024-05-29 08:25:53 +00:00
a7febba9c8 Merge pull request 'clan: clarify default backend' (#1490) from a-kenji-cli/facts-clarify into main 2024-05-29 08:23:06 +00:00
f0f97baa65 drop global argparse flags
They get shadowed by subargparser options.
2024-05-29 10:21:35 +02:00
c2dc94507e clan: clarify default backend 2024-05-29 10:17:22 +02:00
7c0aaab463 Merge pull request 'clan: add epilog to facts subcommands' (#1489) from a-kenji-cli/expand-examples into main 2024-05-29 08:15:46 +00:00
5dcac604d1 backup cli: make sure we have a flake 2024-05-29 10:14:14 +02:00
96746b7c98 flash: add write-efi-boot-entries flag 2024-05-29 10:14:14 +02:00
2ae50b7398 allow to override nix options in update/install/flash commands 2024-05-29 10:14:14 +02:00
3c905c5072 clan: add epilog to facts subcommands 2024-05-29 10:10:23 +02:00
5b926f57cc cli: also register common flags in subcommands
When a user runs --help on a subcommand they don't see some options such
as --options or --flake. To fix this we now register all common flags
also in subcommands.
2024-05-29 09:29:49 +02:00
b9788a5dba Merge pull request 'clan/docs.py: remove epilog from the reference overview' (#1487) from a-kenji-cli/docs/reference-overview into main 2024-05-28 18:05:07 +00:00
7078f09872 clan/docs.py: remove epilog from the reference overview 2024-05-28 20:01:48 +02:00
1aa7808c02 Merge pull request 'Update Contributing guide to external developers' (#1484) from Qubasa/clan-core:main into main
Reviewed-on: clan/clan-core#1484
2024-05-28 16:12:11 +00:00
ba8a51101d Update Contributing guide to external developers 2024-05-28 18:06:31 +02:00
de69c970aa Merge pull request 'packaging: package clan gui for many distros' (#1485) from DavHau-dave into main 2024-05-28 15:54:08 +00:00
fe5fa6a85d packaging: package clan gui for many distros 2024-05-28 17:50:32 +02:00
de74febf64 Merge pull request 'packaging: package clan gui for many distros' (#1483) from DavHau-dave into main 2024-05-28 15:37:18 +00:00
3b6483e819 packaging: package clan gui for many distros 2024-05-28 17:33:55 +02:00
dcd6ad0983 Merge pull request 'Docs: fix relative links to git.clan.lol' (#1482) from hsjobeki-main into main 2024-05-28 15:18:45 +00:00
567d979243
Docs: fix relative links to git.clan.lol 2024-05-28 17:14:16 +02:00
c81a8681b0 Merge pull request 'clan/docs.py: add epilog to reference docs' (#1481) from a-kenji-docs/epilog into main 2024-05-28 15:13:57 +00:00
31cde90819 clan/docs.py: add epilog to reference docs
Fixes #1469
2024-05-28 17:08:46 +02:00
a77bf5bf21 Merge pull request 'Docs: use offline fonts' (#1480) from hsjobeki-main into main 2024-05-28 15:05:22 +00:00
4befa80eb8
Docs: use offline fonts 2024-05-28 16:58:59 +02:00
52584662a8 Merge pull request 'Fix typos' (#1477) from a-kenji-fix/typos into main 2024-05-28 13:02:19 +00:00
de147f63e9 Fix typos 2024-05-28 14:58:38 +02:00
96c33dec7a Merge pull request 'consistent rename cLAN -> Clan' (#1475) from rename into main 2024-05-28 11:38:57 +00:00
3c0b5f0867 drop deprecated mdDoc 2024-05-28 13:35:11 +02:00
c252f11c1f Merge pull request 'docs/secrets: improve chapter assigning access' (#1474) from DavHau-dave into main 2024-05-28 11:11:46 +00:00
f1f040397d docs/secrets: improve chapter assigning access
Since we already walk the user through creating a secret in an earlier step, it makes more sense explain first how to add machines/users to an existing secret instead of creating  a new one
2024-05-28 13:08:19 +02:00
418e9937cb Merge pull request 'clan: add descriptions for reference documentation' (#1473) from a-kenji-cli/doc into main 2024-05-28 09:40:50 +00:00
c34664429c clan: add descriptions for reference documentation 2024-05-28 11:37:32 +02:00
6fe5928297 Merge pull request 'clan: add run_no_stdout function suppressing stdout' (#1472) from a-kenji-run_no_stdout into main 2024-05-28 09:17:14 +00:00
eee99730d1 clan: add run_no_stdout function suppressing stdout
Add the `run_no_stdout` function suppressing stdout by default.This
keeps the noise down on most commands, while still
stayingdebuggable.Stdout will be active when the `--debug` flag is
passed to the cli.

Fixes #1443
2024-05-28 11:13:55 +02:00
9394760e3b Merge pull request 'editor: improve nixpkgs option completions' (#1470) from a-kenji-improve/editor into main 2024-05-28 07:38:09 +00:00
a0b0e1a0ac editor: improve nixpkgs option completions 2024-05-28 09:34:57 +02:00
dbaa26ccaa Merge pull request 'clan: machines --help add examples to help output' (#1468) from a-kenji-clan/cli/machines-examples into main 2024-05-27 19:04:30 +00:00
d1591d4485 clan: machines --help add examples to help output 2024-05-27 21:01:05 +02:00
c68a8306ba Merge pull request 'clan: duplicate description field for generation of the reference documentation' (#1467) from a-kenji-clan/cli/add-description into main 2024-05-27 18:32:54 +00:00
ec9f605004 clan: duplicate description field for generation of the reference documentation 2024-05-27 20:29:34 +02:00
e60efea1f7 Merge pull request 'clan: ssh --help add examples' (#1466) from a-kenji-clan/help/ssh into main 2024-05-27 18:18:08 +00:00
efacb7f184 clan: ssh --help add examples
Add examples to the output of `clan ssh --help`.
2024-05-27 20:14:37 +02:00
67275aac63 Merge pull request 'clan: rename cLan to clan' (#1465) from a-kenji-rename-clan into main 2024-05-27 17:56:32 +00:00
a704a05b15 clan: rename cLan to clan 2024-05-27 19:52:51 +02:00
01aafc520d Merge pull request 'consistent rename cLAN -> Clan' (#1464) from rename into main
Reviewed-on: clan/clan-core#1464
2024-05-27 13:58:32 +00:00
c0a54f539a consistent rename cLAN -> Clan 2024-05-27 13:58:32 +00:00
e2d7e6e86c consistent rename cLAN -> Clan 2024-05-27 15:54:17 +02:00
1df4e361f7 Merge pull request 'clan: add examples and description to most help' (#1463) from a-kenji-clan/examples into main 2024-05-27 12:37:22 +00:00
e8bd5ad24b clan: add examples and description to most help
Add examples and description to most toplevel help outputs.
2024-05-27 14:33:58 +02:00
775f993ecc Merge pull request 'clan-cli: Fix nix develop not working in template because of symlink' (#1462) from Qubasa-main into main 2024-05-27 12:05:17 +00:00
0e1478edcd clan-cli: Fix nix develop not working in template because of symlink 2024-05-27 14:00:31 +02:00
bfc1203a8a Merge pull request 'init: vscode .#editor' (#1461) from Qubasa-init/editors into main 2024-05-27 12:00:26 +00:00
2bd8b144b9 init: vscode .#editor 2024-05-27 13:52:54 +02:00
b52b2221b0 Merge pull request 'drop offline in nix shell' (#1459) from fix-mass-rebuilds into main 2024-05-27 11:43:32 +00:00
64adf17368 drop offline in nix shell
Otherwise we become gentoo!
2024-05-27 13:40:11 +02:00
509d8c1dae Merge pull request 'make git-hooks opt-in' (#1453) from git-hooks into main 2024-05-27 10:34:07 +00:00
295de17640 Merge pull request 'docs: secrets: list the main steps of the guide' (#1456) from DavHau-dave into main 2024-05-27 10:05:55 +00:00
b158c2706f docs: secrets: list the main steps of the guide
... so the user has a routh idea about the mein steps
2024-05-27 12:02:29 +02:00
750979c988 Merge pull request 'A Kenji Clan/Cli/Fix Naming' (#1455) from a-kenji-clan/cli/fix-naming into main 2024-05-27 09:54:36 +00:00
6d7849a03c clan: fix description of cli tool 2024-05-27 11:51:25 +02:00
f46fd3ace6 make git-hooks opt-in
pre-commit hook break git commits and are disruptive.
Therefore people that want to enable this feature, should enable it locally instead.
I.e. treefmt will also check untracked files that are not meant for the current commit.
2024-05-27 11:08:17 +02:00
6e9f1515d3 Merge pull request 'clan: facts generate allow regeneration of facts' (#1447) from a-kenji-clan/feat/facts-regenerate-1403 into main 2024-05-26 21:00:38 +00:00
81e0700826 clan: facts generate allow regeneration of facts
Add `--regenerate` flag to `clan facts generate` which allows forcing
the generation of facts, regardless of their current existence.

Examples:
```
clan facts generate [MACHINE] --regenerate
```
or
```
clan facts generate [MACHINE] --service [SERVICE] --regenerate
```
2024-05-26 22:55:48 +02:00
4daf036a3c Merge pull request 'clan: facts generate specific service' (#1446) from a-kenji-feat/clan/facts-generate-service-1395 into main 2024-05-26 19:57:17 +00:00
4faab0a20f clan: facts generate specific service
Add `--service` flag to the `clan` cli which allows specifying a certain
service to be generated.

Example:

```
clan facts generate [MACHINE] --service [SERVICE]
```

Fixes #1395
2024-05-26 21:52:56 +02:00
76622557c4 Merge pull request 'Webview: improve linting & typechecks' (#1445) from hsjobeki-main into main 2024-05-26 16:41:11 +00:00
4c4c94c508
Webview: improve linting & typechecks 2024-05-26 18:37:29 +02:00
b0d5ef01ca Merge pull request 'Api: init response envelop' (#1444) from hsjobeki-feat/api-improvements into main 2024-05-26 16:08:02 +00:00
ab656d5655
API: handle functions with multiple arguments 2024-05-26 18:04:49 +02:00
ed171f0264
Api: init response envelop 2024-05-26 15:57:10 +02:00
270f9d54cb Merge pull request 'clan: fix clan facts list [MACHINE]' (#1442) from a-kenji-fix/clan-facts-list into main 2024-05-26 12:29:37 +00:00
73f486fe13 clan: fix clan facts list [MACHINE]
Fix `clan facts list [MACHINE]`.
The get command returned a dictionary of bytestrings.
We now convert them to strings.
2024-05-26 14:26:08 +02:00
7da6826344 Merge pull request 'api: improve message serialisation' (#1440) from hsjobeki-feat/api-improvements into main 2024-05-26 12:20:11 +00:00
f54c518fd7
api: fix breaking tests 2024-05-26 14:17:17 +02:00
522fd1bcaa
api: convert name casing 2024-05-26 13:54:21 +02:00
be5c3accfe
webview: fix typo 2024-05-26 13:41:07 +02:00
3998efac78
fix: tests 2024-05-26 13:41:05 +02:00
691ae9fb15
api: improve message serialisation 2024-05-26 13:40:47 +02:00
fc8a64ef49 Merge pull request 'Add draft: Git Based Machine Deployment with Clan-Core' (#1439) from Qubasa-main into main 2024-05-25 16:37:39 +00:00
c0f3810e01 Add draft: Git Based Machine Deployment with Clan-Core 2024-05-25 18:34:19 +02:00
39d8cf91cf Merge pull request 'blog: fix typos' (#1436) from a-kenji-fix/typos-1 into main 2024-05-25 10:34:05 +00:00
233b973120 blog: fix typos 2024-05-25 11:57:28 +02:00
f3f2f6df69 Merge pull request 'blog: fix typo on jsonschema post' (#1435) from DavHau-dave into main 2024-05-25 08:41:03 +00:00
ec824becc8 blog: fix typo on jsonschema post 2024-05-25 10:37:56 +02:00
7fbb50fcc8 Merge pull request 'blog: add link for discourse comments' (#1434) from DavHau-dave into main 2024-05-25 07:47:56 +00:00
33695f7470 blog: add link for discourse comments 2024-05-25 09:44:49 +02:00
001ed3283a Merge pull request 'blog: custom slug for jsonschema converter post' (#1433) from DavHau-dave into main 2024-05-25 07:37:54 +00:00
9ae7d4a24b blog: custom slug for jsonschema converter post 2024-05-25 09:34:50 +02:00
e39911d99c Merge pull request 'blog: improve description of jsonschema post' (#1432) from DavHau-dave into main 2024-05-25 07:12:35 +00:00
9c3da78792 blog: improve description of jsonschema post 2024-05-25 09:09:20 +02:00
69ddda24c9 Merge pull request 'blog: add jsonschema blog post' (#1431) from DavHau-dave into main 2024-05-25 07:01:10 +00:00
c6f078fafc blog: add jsonschema blog post 2024-05-25 08:57:57 +02:00
4e3ed011da Merge pull request 'blog: Remove asciinema player' (#1430) from Qubasa-main into main 2024-05-24 15:13:58 +00:00
a71191486c blog: Fix remote url 2024-05-24 17:10:47 +02:00
d3e6276d04 Merge pull request 'blog: Remove asciinema player' (#1429) from Qubasa-main into main 2024-05-24 14:58:52 +00:00
a1e2d1017e blog: Remove asciinema player 2024-05-24 16:57:26 +02:00
114b0b02d0 blog: Remove asciinema player 2024-05-24 16:54:51 +02:00
de3e133981 Merge pull request 'blog: Remove pictures.' (#1428) from Qubasa-main into main 2024-05-24 13:53:28 +00:00
083e30f468 blog: Remove pictures. 2024-05-24 15:50:14 +02:00
d7ef88c67c Merge pull request 'add-pre-commit' (#1413) from fricklerhandwerk/clan-core:add-pre-commit into main
Reviewed-on: clan/clan-core#1413
2024-05-24 12:39:56 +00:00
055b17c01b add pre-commit check
make sure things are sane before they hit CI, re-purposing the existing
treefmt configuration.

this adds a custom installer for pre-commit hooks, which is inspired by
pre-commit.nix[0], but is much more minimal than the underlying
pre-commit[1] and builds on a historic idea[2] from this repository.

[0]: https://github.com/cachix/git-hooks.nix
[1]: https://github.com/pre-commit/pre-commit
[2]: 930923512c
2024-05-24 12:39:56 +00:00
4b07bf363b Merge pull request 'documentation: add keys' (#1426) from a-kenji-add-keys into main 2024-05-24 11:49:09 +00:00
97928801f9 documentation: add keys 2024-05-24 13:46:05 +02:00
fdacfb8ecf Merge pull request 'documenation: use monospace font for code blocks' (#1425) from a-kenji-fix-monospace into main 2024-05-24 11:11:02 +00:00
508a26d68d documenation: use monospace font for code blocks
Use monospace font for code blocks.

Fixes: #1337
2024-05-24 13:08:00 +02:00
8055c21984 Merge pull request 'clan machines list: reduce noise' (#1418) from a-kenji-fix/output-noisy/1115 into main 2024-05-24 10:58:13 +00:00
9bb6ed313f clan machines list: reduce noise
Don't log nix error output by default on `clan machines list`.
Log it, if `--debug` is passed.

Fixes #1115
2024-05-24 12:55:14 +02:00
8c36df77cc Merge pull request 'documentation: improve legibility of command output' (#1423) from a-kenji-fix/lsblk into main 2024-05-24 10:40:34 +00:00
2284b060be documentation: improve legibility of command output
Improve legibility of command output.
2024-05-24 12:37:27 +02:00
491b5d28f2 Merge pull request 'documenation: fix flake-parts what's next section' (#1422) from a-kenji-fix/docs/flake-parts into main 2024-05-24 10:14:55 +00:00
bf212ce9c4 documenation: fix flake-parts what's next section 2024-05-24 12:11:42 +02:00
35be09feaa Merge pull request 'impure-checks: unset CLAN_DIR' (#1420) from a-kenji-fix/env into main 2024-05-24 10:06:10 +00:00
4ee90b4b9f impure-checks: unset CLAN_DIR
Unset `CLAN_DIR` in the impure checks, so that it won't reference the
users configuration.

Fixes #1419
2024-05-24 12:03:11 +02:00
cab69935ef Merge pull request 'lib.jsonschema: parse some more types' (#1417) from DavHau-dave into main 2024-05-23 14:17:56 +00:00
54fcfda43e lib.jsonschema: parse some more types 2024-05-23 16:12:49 +02:00
d137342243 Merge pull request 'modules: init trusted-nix-cache module' (#1414) from a-kenji-add/cache-module into main 2024-05-23 07:32:36 +00:00
3eba6e85cc modules: init trusted-nix-cache module 2024-05-23 09:29:31 +02:00
d395e2abf3 Merge pull request 'flake.nix: change disko back to nix-community' (#1409) from change_disko_input into main 2024-05-22 19:17:48 +00:00
b971156df1 flake.nix: change disko back to nix-community 2024-05-22 21:14:30 +02:00
c885a3fec8 Merge pull request 'Revert "Merge pull request 'add pre-commit-check' (#1369) from fricklerhandwerk/clan-core:add-pre-commit into main"' (#1408) from Qubasa-revert_hooks into main 2024-05-22 12:36:23 +00:00
ae7794dddd Revert "Merge pull request 'add pre-commit-check' (#1369) from fricklerhandwerk/clan-core:add-pre-commit into main"
This reverts commit acaa69e2bf, reversing
changes made to a78f5b2bec.
2024-05-22 14:31:53 +02:00
acaa69e2bf Merge pull request 'add pre-commit-check' (#1369) from fricklerhandwerk/clan-core:add-pre-commit into main
Reviewed-on: clan/clan-core#1369
2024-05-22 11:49:57 +00:00
e37f7e2760 use a custom installer for pre-commit hooks 2024-05-22 11:49:57 +00:00
245b615209 add pre-commit check
make sure things are sane before they hit CI.
this re-purposes the existing treefmt configuration.
2024-05-22 11:49:57 +00:00
a78f5b2bec Merge pull request 'zerotier-static-peers: init module' (#1400) from a-kenji-modules/init/static-zerotier-hosts into main 2024-05-22 10:40:41 +00:00
396caeff39 zerotier-static-peers: init module
Init zerotertier-static-peers module.
This module automatically configures the networkId.
It will automatically accept peers based on their zerotier-ips in the
clan flake.
2024-05-22 12:37:13 +02:00
d5a639104d Merge pull request 'user-password: set prompt to true by default' (#1399) from a-kenji-user-password/on-by-default into main 2024-05-22 10:19:04 +00:00
fb1b428c12 user-password: set prompt to true by default 2024-05-22 12:15:26 +02:00
bfe37c2457 Merge pull request 'modules: static hosts filter nonexistent ip' (#1398) from a-kenji-fix/path-loading into main 2024-05-21 15:28:52 +00:00
39b34d9ff3 modules: static hosts filter nonexistent ip 2024-05-21 17:24:14 +02:00
fd29ed4693 Merge pull request 'zerotier-members: fix joining by member ip' (#1397) from a-kenji-fix/by-ip into main 2024-05-21 14:42:35 +00:00
9db4e5cf2f zerotier-members: fix joining by member ip 2024-05-21 16:39:28 +02:00
e28a02ec73 Merge pull request 'clan ui: setup typed api method' (#1391) from hsjobeki-main into main 2024-05-21 14:06:45 +00:00
c1e7e25641
api: fix typing issues 2024-05-21 16:01:57 +02:00
21104a0465
webview: replace dream2nix by buildNpm from nixpkgs to save inputs 2024-05-21 15:52:20 +02:00
0f53475499 Merge pull request 'documentation: remove references to Icons for introductory material' (#1392) from a-kenji-rm/icon into main 2024-05-21 09:19:51 +00:00
7aa85d8aaf documentation: remove references to Icons for introductory material
The icons are not yet used in this path.
This is unneccessary overhead for new users, with no payoff yet.
2024-05-21 11:16:12 +02:00
e9b0ce6a78
clan ui: add check to build script 2024-05-21 10:09:05 +02:00
d174fbd445
clan ui: move print into log.debug statements 2024-05-20 19:59:50 +02:00
8687801cee
clan ui: setup typed api method 2024-05-20 19:34:49 +02:00
6ebfd29c87 Merge pull request 'clanModule.sshd: Deactivate password auth. Change flake template to every machine having its own disko.nix file.' (#1389) from Qubasa-main into main 2024-05-20 17:14:24 +00:00
c8456f7d68 clanModule.sshd: Deactivate password auth. Change flake template to every machine having its own disko.nix file. 2024-05-20 19:11:12 +02:00
6b03645f7a Merge pull request 'clan-ui: rollback default view until webview is ready' (#1388) from feat/ui into main 2024-05-20 09:11:35 +00:00
2cb7adb377
clan-ui: rollback default view until webview is ready 2024-05-20 11:08:14 +02:00
78ab7ebc7f Merge pull request 'Automatic flake update - 2024-05-20T00:00+00:00' (#1387) from flake-update-2024-05-20 into main 2024-05-20 00:03:44 +00:00
Clan Merge Bot
82a4ecf82b update flake lock - 2024-05-20T00:00+00:00
Flake lock file updates:

• Updated input 'dream2nix':
    'github:nix-community/dream2nix/995e831dac8c2c843f1289d15dfec526cb84afdd' (2024-05-14)
  → 'github:nix-community/dream2nix/f28d1cc6898532ac331a1625628090dc7c5b02e2' (2024-05-19)
• Updated input 'flake-parts':
    'github:hercules-ci/flake-parts/e5d10a24b66c3ea8f150e47dfdb0416ab7c3390e' (2024-05-02)
  → 'github:hercules-ci/flake-parts/8dc45382d5206bd292f9c2768b8058a8fd8311d9' (2024-05-16)
• Updated input 'nixos-generators':
    'github:nix-community/nixos-generators/722b512eb7e6915882f39fff0e4c9dd44f42b77e' (2024-04-22)
  → 'github:nix-community/nixos-generators/a63e0c83dd83fe28cc571b97129e13373436bd82' (2024-05-19)
• Updated input 'nixos-images':
    'github:nix-community/nixos-images/81e709ca1da9c5c31b65cc8f82a97181f78ec076' (2024-05-13)
  → 'github:nix-community/nixos-images/8c9cab8c44434c12dafc465fbf61a710c5bceb08' (2024-05-19)
• Updated input 'nixos-images/nixos-2311':
    'github:NixOS/nixpkgs/6eccabe980dcb2048aab7f97f862fb6d79b98abe' (2024-05-12)
  → 'github:NixOS/nixpkgs/95742536dc6debb5a8b8b78b27001c38f369f1e7' (2024-05-16)
• Updated input 'nixpkgs':
    'github:NixOS/nixpkgs/c029b7f004009923bbfc90bbc31263cd4b08759f' (2024-05-15)
  → 'github:NixOS/nixpkgs/8a2555763c48e2410054de3f52f7310ce3241ec5' (2024-05-19)
• Updated input 'sops-nix':
    'github:Mic92/sops-nix/b6cb5de2ce57acb10ecdaaf9bbd62a5ff24fa02e' (2024-05-12)
  → 'github:Mic92/sops-nix/0bf1808e70ce80046b0cff821c019df2b19aabf5' (2024-05-19)
• Updated input 'treefmt-nix':
    'github:numtide/treefmt-nix/c6aaf729f34a36c445618580a9f95a48f5e4e03f' (2024-04-25)
  → 'github:numtide/treefmt-nix/2fba33a182602b9d49f0b2440513e5ee091d838b' (2024-05-17)
2024-05-20 00:00:21 +00:00
43b56e21b2 Merge pull request 'zerotier-members: allow joining by zerotier ip' (#1386) from a-kenji-main into main 2024-05-19 21:16:24 +00:00
a47c2f3e69 zerotier-members: allow joining by zerotier ip 2024-05-19 23:13:26 +02:00
a34fa4f69b Merge pull request 'init: static-hosts module' (#1385) from a-kenji-init/statix-hosts-module into main 2024-05-19 11:09:54 +00:00
e13217b1c9 Merge pull request 'user-password: fix module path' (#1384) from a-kenji-fix/user-passord-module into main 2024-05-19 11:08:42 +00:00
1e4a3a3eee user-password: fix module path
Fixes #1381
2024-05-19 13:03:47 +02:00
e39d8cb909 init: static-hosts module 2024-05-19 13:01:37 +02:00
7c48730bbb Merge pull request 'clan flash: Use latest kernel with zfs support. bcachefs supported too.' (#1379) from Qubasa-main into main 2024-05-18 21:50:26 +00:00
da5f363bee clan flash: Use latest kernel with zfs support. bcachefs supported too. 2024-05-18 23:47:17 +02:00
24ec74ae37 Merge pull request 'Add bcachefs support. Fix clan flash docu.' (#1378) from Qubasa-main into main 2024-05-18 21:21:14 +00:00
64a98281f0 Add bcachefs support. Fix clan flash docu. 2024-05-18 23:18:02 +02:00
5863ddca0e Merge pull request 'init webview: add webview ui and list machine as api example' (#1365) from feat/ui into main
Reviewed-on: clan/clan-core#1365
2024-05-18 14:14:12 +00:00
5de3ab88e9 devShell: fallback for darwin 2024-05-18 14:14:12 +00:00
4cfc335e2c fix: segfault gtk when using webkit 2024-05-18 14:14:12 +00:00
e25bd69c68 clan ui: override webkitgtk unbroken on darwin. 2024-05-18 14:14:12 +00:00
fe17f9e1a1 clan ui: integrate webview ui into clan-mananger-gtk 2024-05-18 14:14:12 +00:00
7980f13bed add webview threaded api 2024-05-18 14:14:12 +00:00
fef16a84a9 init webview: add webview ui and list machine as api example 2024-05-18 14:14:12 +00:00
97a1d8b52a Merge pull request 'Change favicon. Add socials. Add RSS link.' (#1372) from Qubasa-main into main 2024-05-17 14:10:22 +00:00
f9b32cbd09 Change favicon. Add socials. Add RSS link. 2024-05-17 16:07:14 +02:00
4d66f2a14c Merge pull request 'readme: Update matrix link' (#1371) from Qubasa-main into main 2024-05-16 18:42:35 +00:00
473c236214 Fix rss plugin warning 2024-05-16 20:39:39 +02:00
eeaf1c84a9 Add profile picture for W 2024-05-16 19:43:55 +02:00
f6efd11eae Working dark theme switcher 2024-05-16 19:32:05 +02:00
8762ee4420 Migrated blog to mkdocs 2024-05-16 15:08:24 +02:00
0568608be6 readme: Update matrix link 2024-05-15 23:00:08 +02:00
a0194f34d2 Merge pull request 'ssh-flash & documentation' (#1350) from ssh-flash into main 2024-05-15 20:58:02 +00:00
b3297532ad nix flake update & disable checks.flash-installer 2024-05-15 22:54:38 +02:00
cd915e171f template: Throw error on missing ssh pub key 2024-05-14 18:29:04 +02:00
1e94bf02da Add nix flake check remark to docu 2024-05-14 18:20:56 +02:00
1c2781267b Add clan flash documentation. 2024-05-14 16:13:50 +02:00
ac8162a08d Fix doc build error 2024-05-14 15:41:15 +02:00
1476619515 Renamed machines.md to deploy.md 2024-05-14 15:41:15 +02:00
8288048682 Renamed machines.md to deploy.md 2024-05-14 15:41:15 +02:00
fd41badbc6 Add --no-reboot flag to clan machine install 2024-05-14 15:41:15 +02:00
d574faf253 Heavily improve documentation and flake template 2024-05-14 15:41:15 +02:00
81522c96e5 Fix missing efi and x64 support in template 2024-05-14 15:41:15 +02:00
e668a7f536 Fix build error 2024-05-14 15:41:15 +02:00
3293ac0c14 fix get_keymap_and_locale 2024-05-14 15:41:15 +02:00
be841cdec2 Removed ssh password login 2024-05-14 15:41:15 +02:00
49e39ec505 Add keymap and language detection 2024-05-14 15:41:15 +02:00
c25f7934ba clan flash: Copied network-status from nixos-images into installer 2024-05-14 15:41:15 +02:00
4f6d25160f Add --ssh-pubkey FILE argument 2024-05-14 15:41:15 +02:00
0bf9a566eb Merge pull request 'clan-cli(docs): modularize in preparation for manpage generation' (#1361) from a-kenji-docs/modularize into main 2024-05-14 10:21:44 +00:00
148a0c90cc clan-cli(docs): modularize in preparation for manpage generation 2024-05-14 12:18:37 +02:00
789bf3d0c8 Merge pull request 'docs: remove linenums from every code block' (#1360) from a-kenji-docs-patch-8 into main 2024-05-14 09:39:14 +00:00
59c558ffc6 docs: remove linenums from every code block
Remove linenums from every single code block.
Makes site considerably less busy and easier to read.
2024-05-14 11:32:30 +02:00
c5e62074a6 Merge pull request 'docs: user-password add admonition' (#1359) from a-kenji-docs/fix into main 2024-05-14 09:31:53 +00:00
9999379f81 docs: user-password add admonition 2024-05-14 11:29:07 +02:00
dd1cfe3834 Merge pull request 'modules: init user-password' (#1358) from a-kenji-modules/init/user-password into main 2024-05-14 08:58:37 +00:00
cd0b360b49 modules: init user-password
Init a user-password module, that allows setting the password for a
single user.

fixes #1351
2024-05-14 10:55:43 +02:00
8c0fb90c1a Merge pull request 'Reorder getting started documentation' (#1345) from Qubasa-main into main 2024-05-10 21:02:33 +00:00
86ae7cbbfb Reorder getting started documentation 2024-05-10 22:59:45 +02:00
fdf63fd605 Merge pull request 'Fix template. Improve docu. Add disko as default imported module.' (#1342) from Qubasa-main into main 2024-05-10 13:42:12 +00:00
82fa89b57e Fix template. Improve docu. Add disko as default imported module. 2024-05-10 15:39:46 +02:00
cad492e830 Merge pull request 'fix docs .envrc watch_file' (#1339) from Qubasa-main into main 2024-05-09 13:05:34 +00:00
2abd5bbe37 fix docs .envrc watch_file 2024-05-09 15:00:03 +02:00
aad130166f Merge pull request 'hsjobeki-main' (#1332) from hsjobeki-main into main 2024-05-08 10:30:16 +00:00
3e9a1ea68f
vm-manager: hide hidden vm log info 2024-05-08 12:27:16 +02:00
2acd06c9fa
docs: add faq page 2024-05-08 12:23:04 +02:00
f45d3385c2 Merge pull request 'template: fix disko devices' (#1328) from a-kenji-docs-patch-7 into main 2024-05-07 20:48:50 +00:00
23c9291912 template: fix disko devices 2024-05-07 22:46:15 +02:00
1893ebef19 Merge pull request 'docs: simplify hardware-configuration' (#1326) from a-kenji-docs-patch-5 into main 2024-05-07 19:40:06 +00:00
fd00a941dc docs: simplify hardware-configuration 2024-05-07 21:37:25 +02:00
9ab5a9507d Merge pull request 'docs: add tip for wlan configuration' (#1325) from a-kenji-docs-patch-4 into main 2024-05-07 19:29:11 +00:00
1a4c20e49e add: tip 2024-05-07 21:26:15 +02:00
f138e59da8 Merge pull request 'docs: add reference to the help page' (#1324) from a-kenji-docs-patch-3 into main 2024-05-07 18:47:50 +00:00
ddd9318ea1 docs: add reference to the help page 2024-05-07 20:45:09 +02:00
aee2fdcffa Merge pull request 'docs: improve getting started prerequisite docs' (#1322) from a-kenji-docs-patch-2 into main 2024-05-07 13:48:22 +00:00
d1b810dfad docs: improve getting started prerequisite docs 2024-05-07 15:45:38 +02:00
4dede0ee5c Merge pull request 'docs: add link to cli reference' (#1321) from a-kenji-improve/docs into main 2024-05-07 13:37:40 +00:00
3506d6ba0d docs: add link to cli reference 2024-05-07 15:34:56 +02:00
f2a3415e2c Merge pull request 'clan-cli: add --json and --png flags to machine install' (#1320) from a-kenji-feat/clan-install-json into main 2024-05-07 12:52:21 +00:00
2e821c4525 clan-cli: add --json and --png flags to machine install
Allow using `clan machines [machine] install` in conjunction with the
`--json` and `--png` flags.

Fixes #1180
2024-05-07 14:47:13 +02:00
bbba7e9087 Merge pull request 'disko module: add default for singleDiskExt4' (#1300) from hsjobeki-main into main 2024-05-07 11:29:19 +00:00
15dd4ea25f
cli-docs: add automatic markdown cli docs 2024-05-07 13:26:33 +02:00
5a6eeda125
disko module: add default for singleDiskExt4 2024-05-07 13:11:04 +02:00
f8e08a610e Merge pull request 'Add jsonschema test case' (#1309) from Qubasa-main into main 2024-05-04 12:14:07 +00:00
fc7f544199 Fix invalid jsonschema testcase 2024-05-04 14:11:28 +02:00
8aaa95737a Merge pull request 'ci: Change from deploy on pull_request to deploy on main push' (#1313) from Qubasa-autodeploy into main
Reviewed-on: clan/clan-core#1313
2024-05-04 11:42:45 +00:00
7dedae9920 ci: Change from deploy on pull_request to deploy on main push 2024-05-04 13:42:16 +02:00
01e5b02633 Merge pull request 'ci: Change from deploy on pull_request to deploy on main push' (#1312) from Qubasa-autodeploy into main 2024-05-04 11:40:49 +00:00
f4de3ac83d ci: Change from deploy on pull_request to deploy on main push 2024-05-04 13:37:56 +02:00
9e65cf2b5b Merge pull request 'gitea_action: Add docs.clan.lol auto deploy' (#1311) from Qubasa-autodeploy into main 2024-05-04 11:34:28 +00:00
8134583641 Remove print of priv key in ci 2024-05-04 13:31:30 +02:00
5d8ee29ed4 Merge branch 'fix_secrets' into autodeploy 2024-05-04 13:12:17 +02:00
d9ce211d1a secrets: Fix test failure through flake update 2024-05-04 13:11:37 +02:00
9ec8b71765 moonlight-sunshine-accept: Fix formatting error 2024-05-03 20:38:53 +02:00
4fef9c3652 gitea_action: Add docs.clan.lol auto deploy 2024-05-03 20:34:27 +02:00
393ed517e2 jsonschema: Filter out 'invisible' options, that are there to throw errors on define 2024-05-03 19:40:42 +02:00
159198b81a Add jsonschema test case 2024-05-03 19:40:42 +02:00
Clan Merge Bot
83ea2312a1 update flake lock - 2024-04-29T00:00+00:00
Flake lock file updates:

• Updated input 'disko':
    'github:nix-community/disko/0a17298c0d96190ef3be729d594ba202b9c53beb' (2024-04-05)
  → 'github:nix-community/disko/285e26465a0bae510897ca04da26ce6307c652b4' (2024-04-26)
• Updated input 'nixos-generators':
    'github:nix-community/nixos-generators/0c15e76bed5432d7775a22e8d22059511f59d23a' (2024-04-04)
  → 'github:nix-community/nixos-generators/722b512eb7e6915882f39fff0e4c9dd44f42b77e' (2024-04-22)
• Updated input 'nixos-generators/nixlib':
    'github:nix-community/nixpkgs.lib/90b1a963ff84dc532db92f678296ff2499a60a87' (2024-03-31)
  → 'github:nix-community/nixpkgs.lib/3c62b6a12571c9a7f65ab037173ee153d539905f' (2024-04-07)
• Updated input 'nixpkgs':
    'github:NixOS/nixpkgs/298edc8f1e0dfffce67f50375c9f5952e04a6d02' (2024-04-07)
  → 'github:NixOS/nixpkgs/30ddacc06345a478f9528fa29e2c8857b90381b2' (2024-04-28)
• Updated input 'sops-nix':
    'github:Mic92/sops-nix/39191e8e6265b106c9a2ba0cfd3a4dafe98a31c6' (2024-04-07)
  → 'github:Mic92/sops-nix/f1b0adc27265274e3b0c9b872a8f476a098679bd' (2024-04-23)
• Updated input 'treefmt-nix':
    'github:numtide/treefmt-nix/49dc4a92b02b8e68798abd99184f228243b6e3ac' (2024-04-01)
  → 'github:numtide/treefmt-nix/c6aaf729f34a36c445618580a9f95a48f5e4e03f' (2024-04-25)
2024-05-03 10:31:23 +00:00
022a55639f Merge pull request 'rename everything to Clan' (#1301) from ci into main
Reviewed-on: clan/clan-core#1301
2024-05-03 09:47:55 +00:00
6f2430b191 deprecate gitea nix builds 2024-05-03 11:45:02 +02:00
6236defde6 rename everything to Clan 2024-05-03 11:45:02 +02:00
9a8a5f4c00 Merge pull request 'Throw error on missing clanModule description or if description too long. Add xfce description.' (#1306) from Qubasa-main into main 2024-05-02 16:00:32 +00:00
6908527ebd Throw error on missing clanModule description or if description too long. Add xfce description. 2024-05-02 17:53:27 +02:00
d013ef20da Merge pull request 'Require README.md for every clan module' (#1302) from Qubasa-main into main 2024-05-02 15:03:59 +00:00
570f04ecdc Fix zt-tcp-relay 2024-05-02 16:59:17 +02:00
3a9a7eedf9 Remove unreferenced clan modules 2024-05-02 16:34:25 +02:00
ee552d3020 Move vm clanModules to lib 2024-05-02 16:34:25 +02:00
b95d95554a Add description field to function-schema 2024-05-02 16:34:25 +02:00
a09e680fa0 Require README.md for every clan module 2024-05-02 16:34:25 +02:00
853d8221c0 Merge pull request 'qga: add argument 'check'' (#1303) from DavHau-dave into main 2024-05-02 13:13:12 +00:00
43c799c3d0 qga: add argument 'check' 2024-05-02 15:03:22 +02:00
f231f1e0c7 Merge pull request 'check jsonschema comaptibility for all clan modules' (#1280) from schema into main 2024-05-01 21:18:33 +00:00
a48df5b993 Add package function-schema and module-schema. Add check for module jsonschema. 2024-05-01 23:16:17 +02:00
e08342a6f3 Merge pull request 'template: remove invalid enable option for zerotier' (#1299) from hsjobeki-main into main 2024-04-30 17:41:46 +00:00
e0f56c3c6b
template: remove invalid enable option for zerotier 2024-04-30 19:37:03 +02:00
64c5a81f74 Merge pull request 'template: use disko module direcly' (#1298) from hsjobeki-main into main 2024-04-30 17:23:08 +00:00
56fad0fd4a
template: use disko module direcly 2024-04-30 19:16:13 +02:00
3dce5d2f95 Merge pull request 'add cli docs generator' (#1297) from hsjobeki-main into main 2024-04-30 17:11:37 +00:00
bfe4f2c8f4
add cli docs generator 2024-04-30 19:01:53 +02:00
1051367ca4
add cli docs generator 2024-04-30 18:53:00 +02:00
480bb396ed Merge pull request 'Fix reading secret from pipe' (#1296) from error-handling into main
Reviewed-on: clan/clan-core#1296
2024-04-30 14:54:24 +00:00
b5653c169b sops: fix setting secret from pipe 2024-04-30 14:04:49 +02:00
5606101ce8 sops: also log content type on error 2024-04-30 13:56:07 +02:00
3da4117702 Merge pull request 'clan-cli: add CLAN_DIR environment variable' (#1283) from a-kenji-feat/clan-dir into main 2024-04-30 10:08:13 +00:00
f383c6f82d clan-cli: add CLAN_DIR environment variable
Add the `CLAN_DIR` environment variable.
With this the user can specify the location of the clan.
2024-04-30 12:00:47 +02:00
af86980192 Merge pull request 'clanCore: remove repl-flake as it is now stable' (#1278) from lassulus-HEAD into main 2024-04-27 14:37:25 +00:00
c681cc0998 clanCore: remove repl-flake as it is now stable 2024-04-27 16:28:23 +02:00
0804e5e415 Merge pull request 'clan(help): standardise on machine capitalisation' (#1276) from a-kenji-clan-help/standardize into main 2024-04-26 10:14:35 +00:00
95f93d8800 clan(help): standardise on machine capitalisation 2024-04-26 12:07:09 +02:00
219 changed files with 10730 additions and 1272 deletions

View File

@ -5,11 +5,6 @@ on:
branches:
- main
jobs:
checks:
runs-on: nix
steps:
- uses: actions/checkout@v3
- run: nix run --refresh github:Mic92/nix-fast-build -- --no-nom --eval-workers 10
checks-impure:
runs-on: nix
steps:

View File

@ -0,0 +1,13 @@
name: deploy
on:
push:
branches:
- main
jobs:
deploy-docs:
runs-on: nix
steps:
- uses: actions/checkout@v3
- run: nix run .#deploy-docs
env:
SSH_HOMEPAGE_KEY: ${{ secrets.SSH_HOMEPAGE_KEY }}

8
.gitignore vendored
View File

@ -13,6 +13,9 @@ nixos.qcow2
**/*.glade~
/docs/out
# dream2nix
.dream2nix
# python
__pycache__
.coverage
@ -28,3 +31,8 @@ build
build-dir
repo
.env
# node
node_modules
dist
.webui

View File

@ -1,4 +1,4 @@
# Contributing to cLAN
# Contributing to Clan
## Live-reloading documentation

View File

@ -1,6 +1,6 @@
# cLAN Core Repository
# Clan Core Repository
Welcome to the cLAN Core Repository, the heart of the [clan.lol](https://clan.lol/) project! This monorepo is the foundation of Clan, a revolutionary open-source project aimed at restoring fun, freedom, and functionality to computing. Here, you'll find all the essential packages, NixOS modules, CLI tools, and tests needed to contribute to and work with the cLAN project. Clan leverages the Nix system to ensure reliability, security, and seamless management of digital environments, putting the power back into the hands of users.
Welcome to the Clan Core Repository, the heart of the [clan.lol](https://clan.lol/) project! This monorepo is the foundation of Clan, a revolutionary open-source project aimed at restoring fun, freedom, and functionality to computing. Here, you'll find all the essential packages, NixOS modules, CLI tools, and tests needed to contribute to and work with the Clan project. Clan leverages the Nix system to ensure reliability, security, and seamless management of digital environments, putting the power back into the hands of users.
## Why Clan?
@ -14,11 +14,11 @@ Our mission is simple: to democratize computing by providing tools that empower
- **Robust Backup Management:** Long-term, self-hosted data preservation.
- **Intuitive Secret Management:** Simplified encryption and password management processes.
## Getting Started with cLAN
## Getting Started with Clan
If you're new to cLAN and eager to dive in, start with our quickstart guide and explore the core functionalities that Clan offers:
If you're new to Clan and eager to dive in, start with our quickstart guide and explore the core functionalities that Clan offers:
- **Quickstart Guide**: Check out [getting started](https://docs.clan.lol/#starting-with-a-new-clan-project)<!-- [docs/site/index.md](docs/site/index.md) --> to get up and running with cLAN in no time.
- **Quickstart Guide**: Check out [getting started](https://docs.clan.lol/#starting-with-a-new-clan-project)<!-- [docs/site/index.md](docs/site/index.md) --> to get up and running with Clan in no time.
### Managing Secrets
@ -26,7 +26,7 @@ In the Clan ecosystem, security is paramount. Learn how to handle secrets effect
- **Secrets Management**: Securely manage secrets by consulting [secrets](https://docs.clan.lol/getting-started/secrets/)<!-- [secrets.md](docs/site/getting-started/secrets.md) -->.
### Contributing to cLAN
### Contributing to Clan
The Clan project thrives on community contributions. We welcome everyone to contribute and collaborate:
@ -34,12 +34,12 @@ The Clan project thrives on community contributions. We welcome everyone to cont
## Join the Revolution
Clan is more than a tool; it's a movement towards a better digital future. By contributing to the cLAN project, you're part of changing technology for the better, together.
Clan is more than a tool; it's a movement towards a better digital future. By contributing to the Clan project, you're part of changing technology for the better, together.
### Community and Support
Connect with us and the Clan community for support and discussion:
- [Matrix channel](https://matrix.to/#/!djzOHBBBHnwQkgNgdV:matrix.org?via=blog.clan.lol) for live discussions.
- [Matrix channel](https://matrix.to/#/#clan:lassul.us) for live discussions.
- IRC bridges (coming soon) for real-time chat support.

View File

@ -145,14 +145,14 @@
machine.succeed("echo testing > /var/test-backups/somefile")
# create
machine.succeed("clan --debug --flake ${self} backups create test-backup")
machine.succeed("clan backups create --debug --flake ${self} test-backup")
machine.wait_until_succeeds("! systemctl is-active borgbackup-job-test-backup >&2")
machine.succeed("test -f /run/mount-external-disk")
machine.succeed("test -f /run/unmount-external-disk")
# list
backup_id = json.loads(machine.succeed("borg-job-test-backup list --json"))["archives"][0]["archive"]
out = machine.succeed("clan --debug --flake ${self} backups list test-backup").strip()
out = machine.succeed("clan backups list --debug --flake ${self} test-backup").strip()
print(out)
assert backup_id in out, f"backup {backup_id} not found in {out}"
localbackup_id = "hdd::/mnt/external-disk/snapshot.0"
@ -160,14 +160,14 @@
## borgbackup restore
machine.succeed("rm -f /var/test-backups/somefile")
machine.succeed(f"clan --debug --flake ${self} backups restore test-backup borgbackup 'test-backup::borg@machine:.::{backup_id}' >&2")
machine.succeed(f"clan backups restore --debug --flake ${self} test-backup borgbackup 'test-backup::borg@machine:.::{backup_id}' >&2")
assert machine.succeed("cat /var/test-backups/somefile").strip() == "testing", "restore failed"
machine.succeed("test -f /var/test-service/pre-restore-command")
machine.succeed("test -f /var/test-service/post-restore-command")
## localbackup restore
machine.succeed("rm -f /var/test-backups/somefile /var/test-service/{pre,post}-restore-command")
machine.succeed(f"clan --debug --flake ${self} backups restore test-backup localbackup '{localbackup_id}' >&2")
machine.succeed(f"clan backups restore --debug --flake ${self} test-backup localbackup '{localbackup_id}' >&2")
assert machine.succeed("cat /var/test-backups/somefile").strip() == "testing", "restore failed"
machine.succeed("test -f /var/test-service/pre-restore-command")
machine.succeed("test -f /var/test-service/post-restore-command")

View File

@ -46,7 +46,6 @@
syncthing = import ./syncthing nixosTestArgs;
wayland-proxy-virtwl = import ./wayland-proxy-virtwl nixosTestArgs;
};
schemaTests = pkgs.callPackages ./schemas.nix { inherit self; };
flakeOutputs =
lib.mapAttrs' (
@ -58,7 +57,7 @@
self'.legacyPackages.homeConfigurations or { }
);
in
{ inherit renderClanOptions; } // nixosTests // schemaTests // flakeOutputs;
{ inherit renderClanOptions; } // nixosTests // flakeOutputs;
legacyPackages = {
nixosTests =
let

View File

@ -9,16 +9,16 @@
}:
let
dependencies = [
self
pkgs.stdenv.drvPath
pkgs.disko
self.clanInternals.machines.${pkgs.hostPlatform.system}.test_install_machine.config.system.build.toplevel
self.clanInternals.machines.${pkgs.hostPlatform.system}.test_install_machine.config.system.build.diskoScript
self.clanInternals.machines.${pkgs.hostPlatform.system}.test_install_machine.config.system.build.diskoScript.drvPath
self.clanInternals.machines.${pkgs.hostPlatform.system}.test_install_machine.config.system.clan.deployment.file
self.inputs.nixpkgs.legacyPackages.${pkgs.hostPlatform.system}.disko
] ++ builtins.map (i: i.outPath) (builtins.attrValues self.inputs);
closureInfo = pkgs.closureInfo { rootPaths = dependencies; };
in
{
# Currently disabled...
checks = pkgs.lib.mkIf (pkgs.stdenv.isLinux) {
flash = (import ../lib/test-base.nix) {
name = "flash";
@ -41,7 +41,8 @@
};
testScript = ''
start_all()
machine.succeed("clan --flake ${../..} flash --debug --yes --disk main /dev/vdb test_install_machine")
machine.succeed("clan flash --debug --flake ${../..} --yes --disk main /dev/vdb test_install_machine")
'';
} { inherit pkgs self; };
};

View File

@ -7,6 +7,8 @@
#!${pkgs.bash}/bin/bash
set -euo pipefail
unset CLAN_DIR
export PATH="${
lib.makeBinPath [
pkgs.gitMinimal

View File

@ -2,8 +2,8 @@
{
clan.machines.test_install_machine = {
clan.networking.targetHost = "test_install_machine";
fileSystems."/".device = lib.mkDefault "/dev/null";
boot.loader.grub.device = lib.mkDefault "/dev/null";
fileSystems."/".device = lib.mkDefault "/dev/vdb";
boot.loader.grub.device = lib.mkDefault "/dev/vdb";
imports = [ self.nixosModules.test_install_machine ];
};
@ -12,11 +12,11 @@
{ lib, modulesPath, ... }:
{
imports = [
self.clanModules.diskLayouts
self.clanModules.disk-layouts
(modulesPath + "/testing/test-instrumentation.nix") # we need these 2 modules always to be able to run the tests
(modulesPath + "/profiles/qemu-guest.nix")
];
clan.diskLayouts.singleDiskExt4.device = "/dev/vdb";
clan.disk-layouts.singleDiskExt4.device = "/dev/vdb";
environment.etc."install-successful".text = "ok";
@ -98,7 +98,7 @@
client.succeed("${pkgs.coreutils}/bin/install -Dm 600 ${../lib/ssh/privkey} /root/.ssh/id_ed25519")
client.wait_until_succeeds("ssh -o StrictHostKeyChecking=accept-new -v root@target hostname")
client.succeed("clan --debug --flake ${../..} machines install --yes test_install_machine root@target >&2")
client.succeed("clan machines install --debug --flake ${../..} --yes test_install_machine root@target >&2")
try:
target.shutdown()
except BrokenPipeError:

View File

@ -10,6 +10,7 @@ in
hostPkgs = pkgs;
# speed-up evaluation
defaults = {
nix.package = pkgs.nixVersions.latest;
documentation.enable = lib.mkDefault false;
boot.isContainer = true;

View File

@ -10,6 +10,7 @@ in
defaults = {
documentation.enable = lib.mkDefault false;
nix.settings.min-free = 0;
nix.package = pkgs.nixVersions.latest;
};
# to accept external dependencies such as disko

View File

@ -1,48 +0,0 @@
{
self,
runCommand,
check-jsonschema,
pkgs,
lib,
...
}:
let
clanModules.clanCore = self.nixosModules.clanCore;
baseModule = {
imports = (import (pkgs.path + "/nixos/modules/module-list.nix")) ++ [
{
nixpkgs.hostPlatform = "x86_64-linux";
clanCore.clanName = "dummy";
}
];
};
optionsFromModule =
module:
let
evaled = lib.evalModules {
modules = [
module
baseModule
];
};
in
evaled.options.clan;
clanModuleSchemas = lib.mapAttrs (
_: module: self.lib.jsonschema.parseOptions (optionsFromModule module)
) clanModules;
mkTest =
name: schema:
runCommand "schema-${name}" { } ''
${check-jsonschema}/bin/check-jsonschema \
--check-metaschema ${builtins.toFile "schema-${name}" (builtins.toJSON schema)}
touch $out
'';
in
lib.mapAttrs' (name: schema: {
name = "schema-${name}";
value = mkTest name schema;
}) clanModuleSchemas

View File

@ -4,10 +4,11 @@
nodes.machine =
{ self, config, ... }:
{
environment.etc."privkey.age".source = ./key.age;
imports = [ (self.nixosModules.clanCore) ];
environment.etc."secret".source = config.sops.secrets.secret.path;
environment.etc."group-secret".source = config.sops.secrets.group-secret.path;
sops.age.keyFile = ./key.age;
sops.age.keyFile = "/etc/privkey.age";
clanCore.clanDir = "${./.}";
clanCore.machineName = "machine";

View File

@ -0,0 +1,2 @@
Efficient, deduplicating backup program with optional compression and secure encryption.
---

View File

@ -1,4 +1,5 @@
Email-based instant messaging for Desktop.
---
!!! warning "Under construction"

View File

@ -0,0 +1,2 @@
Automatically format a disk drive on clan installation
---

View File

@ -1,6 +1,6 @@
{ config, lib, ... }:
{
options.clan.diskLayouts.singleDiskExt4 = {
options.clan.disk-layouts.singleDiskExt4 = {
device = lib.mkOption {
type = lib.types.str;
example = "/dev/disk/by-id/ata-Samsung_SSD_850_EVO_250GB_S21PNXAGB12345";
@ -13,13 +13,14 @@
disk = {
main = {
type = "disk";
device = config.clan.diskLayouts.singleDiskExt4.device;
device = config.clan.disk-layouts.singleDiskExt4.device;
content = {
type = "gpt";
partitions = {
boot = {
size = "1M";
type = "EF02"; # for grub MBR
priority = 1;
};
ESP = {
size = "512M";

View File

@ -0,0 +1,2 @@
A modern IRC server
---

View File

@ -1,29 +1,26 @@
{ inputs, ... }:
{ ... }:
{
flake.clanModules = {
diskLayouts = {
imports = [
./diskLayouts.nix
inputs.disko.nixosModules.default
];
disk-layouts = {
imports = [ ./disk-layouts ];
};
borgbackup = ./borgbackup.nix;
ergochat = ./ergochat.nix;
borgbackup = ./borgbackup;
deltachat = ./deltachat;
graphical = ./graphical.nix;
localbackup = ./localbackup.nix;
localsend = ./localsend.nix;
matrix-synapse = ./matrix-synapse.nix;
moonlight = ./moonlight.nix;
sshd = ./sshd.nix;
sunshine = ./sunshine.nix;
syncthing = ./syncthing;
ergochat = ./ergochat;
localbackup = ./localbackup;
localsend = ./localsend;
matrix-synapse = ./matrix-synapse;
moonlight = ./moonlight;
root-password = ./root-password;
thelounge = ./thelounge.nix;
vm-user = ./vm-user.nix;
waypipe = ./waypipe.nix;
xfce = ./xfce.nix;
xfce-vm = ./xfce-vm.nix;
zt-tcp-relay = ./zt-tcp-relay.nix;
sshd = ./sshd;
sunshine = ./sunshine;
static-hosts = ./static-hosts;
syncthing = ./syncthing;
thelounge = ./thelounge;
trusted-nix-caches = ./trusted-nix-caches;
user-password = ./user-password;
xfce = ./xfce;
zerotier-static-peers = ./zerotier-static-peers;
zt-tcp-relay = ./zt-tcp-relay;
};
}

View File

@ -1 +0,0 @@
_: { fonts.enableDefaultPackages = true; }

View File

@ -0,0 +1,2 @@
Automatically backups current machine to local directory.
---

View File

@ -0,0 +1,2 @@
Securely sharing files and messages over a local network without internet connectivity.
---

View File

@ -9,7 +9,7 @@
# - cli frontend: https://github.com/localsend/localsend/issues/11
# - ipv6 support: https://github.com/localsend/localsend/issues/549
options.clan.localsend = {
enable = lib.mkEnableOption (lib.mdDoc "enable the localsend module");
enable = lib.mkEnableOption "enable the localsend module";
defaultLocation = lib.mkOption {
type = lib.types.str;
description = "The default download location";

View File

@ -0,0 +1,2 @@
A federated messaging server with end-to-end encryption.
---

View File

@ -0,0 +1,2 @@
A desktop streaming client optimized for remote gaming and synchronized movie viewing.
---

View File

@ -1,6 +1,5 @@
Creates a root-password
!!! tip "This module sets the password for the root user (automatically)."
Automatically generates and configures a password for the root user.
---
After the system was installed/deployed the following command can be used to display the root-password:
@ -8,6 +7,5 @@ After the system was installed/deployed the following command can be used to dis
clan secrets get {machine_name}-password
```
---
See also: [Facts / Secrets](../../getting-started/secrets.md)

View File

@ -0,0 +1,2 @@
Enables secure remote access to the machine over ssh
---

View File

@ -1,6 +1,7 @@
{ config, pkgs, ... }:
{
services.openssh.enable = true;
services.openssh.settings.PasswordAuthentication = false;
services.openssh.hostKeys = [
{

View File

@ -0,0 +1,2 @@
Statically configure the host names of machines based on their respective zerotier-ip.
---

View File

@ -0,0 +1,44 @@
{ lib, config, ... }:
{
options.clan.static-hosts = {
excludeHosts = lib.mkOption {
type = lib.types.listOf lib.types.str;
default =
if config.clan.static-hosts.topLevelDomain != "" then [ ] else [ config.clanCore.machineName ];
description = "Hosts that should be excluded";
};
topLevelDomain = lib.mkOption {
type = lib.types.str;
default = "";
description = "Top level domain to reach hosts";
};
};
config.networking.hosts =
let
clanDir = config.clanCore.clanDir;
machineDir = clanDir + "/machines/";
zerotierIpMachinePath = machines: machineDir + machines + "/facts/zerotier-ip";
machines = builtins.readDir machineDir;
filteredMachines = lib.filterAttrs (
name: _: !(lib.elem name config.clan.static-hosts.excludeHosts)
) machines;
in
lib.filterAttrs (_: value: value != null) (
lib.mapAttrs' (
machine: _:
let
path = zerotierIpMachinePath machine;
in
if builtins.pathExists path then
lib.nameValuePair (builtins.readFile path) (
if (config.clan.static-hosts.topLevelDomain == "") then
[ machine ]
else
[ "${machine}.${config.clan.static-hosts.topLevelDomain}" ]
)
else
null
) filteredMachines
);
}

View File

@ -0,0 +1,2 @@
A desktop streaming server optimized for remote gaming and synchronized movie viewing.
---

View File

@ -1,7 +1,5 @@
Syncthing is a free, open-source file synchronization application designed to allow users to synchronize files between multiple devices over the internet or local networks securely and privately.
It is an alternative to cloud-based file sharing services.
A secure, file synchronization app for devices over networks, offering a private alternative to cloud services.
---
## Usage
We recommend configuring this module as an sync-service through the provided options. Although it provides a Web GUI through which more usage scenarios are supported.

View File

@ -34,6 +34,10 @@
'';
type = lib.types.listOf lib.types.str;
default = [ ];
example = [
"folder1"
"folder2"
];
};
};

View File

@ -0,0 +1,2 @@
Modern web IRC client
---

View File

@ -0,0 +1,2 @@
This module sets the `clan.lol` and `nix-community` cache up as a trusted cache.
----

View File

@ -0,0 +1,10 @@
{
nix.settings.trusted-substituters = [
"https://cache.clan.lol"
"https://nix-community.cachix.org"
];
nix.settings.trusted-public-keys = [
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
"cache.clan.lol-1:3KztgSAB5R1M+Dz7vzkBGzXdodizbgLXGXKXlcQLA28="
];
}

View File

@ -0,0 +1,18 @@
Automatically generates and configures a password for the specified user account.
---
If setting the option prompt to true, the user will be prompted to type in their desired password.
!!! Note
This module will set `mutableUsers` to `false`, meaning you can not manage user passwords through `passwd` anymore.
After the system was installed/deployed the following command can be used to display the user-password:
```bash
clan secrets get {machine_name}-user-password
```
See also: [Facts / Secrets](../../getting-started/secrets.md)
To regenerate the password, delete the password files in the clan directory and redeploy the machine.

View File

@ -0,0 +1,49 @@
{
pkgs,
config,
lib,
...
}:
{
options.clan.user-password = {
user = lib.mkOption {
type = lib.types.str;
example = "alice";
description = "The user the password should be generated for.";
};
prompt = lib.mkOption {
type = lib.types.bool;
default = true;
example = false;
description = "Whether the user should be prompted.";
};
};
config = {
users.mutableUsers = false;
users.users.${config.clan.user-password.user}.hashedPasswordFile =
config.clanCore.facts.services.user-password.secret.user-password-hash.path;
sops.secrets."${config.clanCore.machineName}-user-password-hash".neededForUsers = true;
clanCore.facts.services.user-password = {
secret.user-password = { };
secret.user-password-hash = { };
generator.prompt = (
lib.mkIf config.clan.user-password.prompt "Set the password for your $user: ${config.clan.user-password.user}.
You can autogenerate a password, if you leave this prompt blank."
);
generator.path = with pkgs; [
coreutils
xkcdpass
mkpasswd
];
generator.script = ''
if [[ -n $prompt_value ]]; then
echo $prompt_value > $secrets/user-password
else
xkcdpass --numwords 3 --delimiter - --count 1 > $secrets/user-password
fi
cat $secrets/user-password | mkpasswd -s -m sha-512 > $secrets/user-password-hash
'';
};
};
}

View File

@ -1,20 +0,0 @@
{
security = {
sudo.wheelNeedsPassword = false;
polkit.enable = true;
rtkit.enable = true;
};
users.users.user = {
isNormalUser = true;
createHome = true;
uid = 1000;
initialHashedPassword = "";
extraGroups = [
"wheel"
"video"
"render"
];
shell = "/run/current-system/sw/bin/bash";
};
}

View File

@ -1,15 +0,0 @@
{
imports = [
./vm-user.nix
./graphical.nix
];
services.xserver = {
enable = true;
displayManager.autoLogin.enable = true;
displayManager.autoLogin.user = "user";
desktopManager.xfce.enable = true;
desktopManager.xfce.enableScreensaver = false;
xkb.layout = "us";
};
}

View File

@ -0,0 +1,2 @@
A lightweight desktop manager
---

View File

@ -0,0 +1,5 @@
Statically configure the `zerotier` peers of a clan network.
---
Statically configure the `zerotier` peers of a clan network.
Requires a machine, that is the zerotier controller configured in the network.

View File

@ -0,0 +1,71 @@
{
lib,
config,
pkgs,
inputs,
...
}:
let
clanDir = config.clanCore.clanDir;
machineDir = clanDir + "/machines/";
machinesFileSet = builtins.readDir machineDir;
machines = lib.mapAttrsToList (name: _: name) machinesFileSet;
zerotierNetworkIdPath = machines: machineDir + machines + "/facts/zerotier-network-id";
networkIdsUnchecked = builtins.map (
machine:
let
fullPath = zerotierNetworkIdPath machine;
in
if builtins.pathExists fullPath then builtins.readFile fullPath else null
) machines;
networkIds = lib.filter (machine: machine != null) networkIdsUnchecked;
networkId = if builtins.length networkIds == 0 then null else builtins.elemAt networkIds 0;
in
#TODO:trace on multiple found network-ids
#TODO:trace on no single found networkId
{
options.clan.zerotier-static-peers = {
excludeHosts = lib.mkOption {
type = lib.types.listOf lib.types.str;
default = [ config.clanCore.machineName ];
description = "Hosts that should be excluded";
};
};
config.systemd.services.zerotier-static-peers-autoaccept =
let
machines = builtins.readDir machineDir;
zerotierIpMachinePath = machines: machineDir + machines + "/facts/zerotier-ip";
filteredMachines = lib.filterAttrs (
name: _: !(lib.elem name config.clan.zerotier-static-peers.excludeHosts)
) machines;
hosts = lib.mapAttrsToList (host: _: host) (
lib.mapAttrs' (
machine: _:
let
fullPath = zerotierIpMachinePath machine;
in
if builtins.pathExists fullPath then
lib.nameValuePair (builtins.readFile fullPath) [ machine ]
else
null
) filteredMachines
);
in
lib.mkIf (config.clan.networking.zerotier.controller.enable) {
wantedBy = [ "multi-user.target" ];
after = [ "zerotierone.service" ];
path = [ pkgs.zerotierone ];
serviceConfig.ExecStart = pkgs.writeScript "static-zerotier-peers-autoaccept" ''
#!/bin/sh
${lib.concatMapStringsSep "\n" (host: ''
${
inputs.clan-core.packages.${pkgs.system}.zerotier-members
}/bin/zerotier-members allow --member-ip ${host}
'') hosts}
'';
};
config.clan.networking.zerotier.networkId = lib.mkDefault networkId;
}

View File

@ -0,0 +1,2 @@
Enable ZeroTier VPN over TCP for networks where UDP is blocked.
---

View File

@ -20,7 +20,7 @@
after = [ "network.target" ];
serviceConfig = {
ExecStart = "${
pkgs.callPackage ../pkgs/zt-tcp-relay { }
pkgs.callPackage ../../pkgs/zt-tcp-relay { }
}/bin/zt-tcp-relay --listen [::]:${builtins.toString config.clan.zt-tcp-relay.port}";
Restart = "always";
RestartSec = "5";

View File

@ -1,3 +1,4 @@
{ ... }:
{
perSystem =
{
@ -26,7 +27,8 @@
packages = [
select-shell
pkgs.tea
pkgs.nix
# Better error messages than nix 2.18
pkgs.nixVersions.latest
self'.packages.tea-create-pr
self'.packages.merge-after-ci
self'.packages.pending-reviews
@ -34,9 +36,6 @@
config.treefmt.build.wrapper
];
shellHook = ''
# no longer used
rm -f "$(git rev-parse --show-toplevel)/.git/hooks/pre-commit"
echo -e "${ansiEscapes.green}switch to another dev-shell using: select-shell${ansiEscapes.reset}"
'';
};

View File

@ -1,6 +1,6 @@
source_up
watch_file $(find ./nix -name "*.nix" -printf '"%p" ')
watch_file $(find ./nix -name "*.nix" -printf '%p ')
# Because we depend on nixpkgs sources, uploading to builders takes a long time
use flake .#docs --builders ''

4
docs/.gitignore vendored
View File

@ -1 +1,3 @@
/site/reference
/site/reference
/site/static/Roboto-Regular.ttf
/site/static/FiraCode-VF.ttf

View File

@ -15,92 +15,124 @@ Let's get your development environment up and running:
1. **Install Nix Package Manager**:
- You can install the Nix package manager by either [downloading the Nix installer](https://github.com/DeterminateSystems/nix-installer/releases) or running this command:
```bash
curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install
```
- You can install the Nix package manager by either [downloading the Nix installer](https://github.com/DeterminateSystems/nix-installer/releases) or running this command:
```bash
curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install
```
2. **Install direnv**:
- Download the direnv package from [here](https://direnv.net/docs/installation.html) or run the following command:
```bash
curl -sfL https://direnv.net/install.sh | bash
```
- To automatically setup a devshell on entering the directory
```bash
nix profile install nixpkgs#nix-direnv-flakes
```
3. **Add direnv to your shell**:
- Direnv needs to [hook into your shell](https://direnv.net/docs/hook.html) to work.
You can do this by executing following command. The example below will setup direnv for `zsh` and `bash`
- Direnv needs to [hook into your shell](https://direnv.net/docs/hook.html) to work.
You can do this by executing following command. The example below will setup direnv for `zsh` and `bash`
```bash
echo 'eval "$(direnv hook zsh)"' >> ~/.zshrc && echo 'eval "$(direnv hook bash)"' >> ~/.bashrc && eval "$SHELL"
```
4. **Clone the Repository and Navigate**:
- Clone this repository and navigate to it.
5. **Allow .envrc**:
- When you enter the directory, you'll receive an error message like this:
```bash
direnv: error .envrc is blocked. Run `direnv allow` to approve its content
```
- Execute `direnv allow` to automatically execute the shell script `.envrc` when entering the directory.
# Setting Up Your Git Workflow
Let's set up your Git workflow to collaborate effectively:
1. **Register Your Gitea Account Locally**:
- Execute the following command to add your Gitea account locally:
```bash
tea login add
```
- Fill out the prompt as follows:
- URL of Gitea instance: `https://git.clan.lol`
- Name of new Login [gitea.gchq.icu]: `gitea.gchq.icu:7171`
- Do you have an access token? No
- Username: YourUsername
- Password: YourPassword
- Set Optional settings: No
2. **Git Workflow**:
1. Add your changes to Git using `git add <file1> <file2>`.
2. Run `nix fmt` to lint your files.
3. Commit your changes with a descriptive message: `git commit -a -m "My descriptive commit message"`.
4. Make sure your branch has the latest changes from upstream by executing:
```bash
git fetch && git rebase origin/main --autostash
echo 'eval "$(direnv hook zsh)"' >> ~/.zshrc && echo 'eval "$(direnv hook bash)"' >> ~/.bashrc && eval "$SHELL"
```
5. Use `git status` to check for merge conflicts.
6. If conflicts exist, resolve them. Here's a tutorial for resolving conflicts in [VSCode](https://code.visualstudio.com/docs/sourcecontrol/overview#_merge-conflicts).
7. After resolving conflicts, execute `git merge --continue` and repeat step 5 until there are no conflicts.
3. **Create a Pull Request**:
4. **Create a Gitea Account**:
- Register an account on https://git.clan.lol
- Fork the [clan-core](https://git.clan.lol/clan/clan-core) repository
- Clone the repository and navigate to it
- Add a new remote called upstream:
```bash
git remote add upstream gitea@git.clan.lol:clan/clan-core.git
```
- To automatically open a pull request that gets merged if all tests pass, execute:
```bash
merge-after-ci
```
5. **Register Your Gitea Account Locally**:
4. **Review Your Pull Request**:
- Execute the following command to add your Gitea account locally:
```bash
tea login add
```
- Fill out the prompt as follows:
- URL of Gitea instance: `https://git.clan.lol`
- Name of new Login [git.clan.lol]:
- Do you have an access token? No
- Username: YourUsername
- Password: YourPassword
- Set Optional settings: No
- Visit https://git.clan.lol and go to the project page. Check under "Pull Requests" for any issues with your pull request.
5. **Push Your Changes**:
- If there are issues, fix them and redo step 2. Afterward, execute:
```bash
git push origin HEAD:YourUsername-main
```
- This will directly push to your open pull request.
6. **Allow .envrc**:
- When you enter the directory, you'll receive an error message like this:
```bash
direnv: error .envrc is blocked. Run `direnv allow` to approve its content
```
- Execute `direnv allow` to automatically execute the shell script `.envrc` when entering the directory.
7. **(Optional) Install Git Hooks**:
- To syntax check your code you can run:
```bash
nix fmt
```
- To make this automatic install the git hooks
```bash
./scripts/pre-commit
```
8. **Open a Pull Request**:
- To automatically open up a pull request you can use our tool called:
```
merge-after-ci --reviewers Mic92 Lassulus Qubasa
```
# Debugging
Here are some methods for debugging and testing the clan-cli:
## See all possible packages and tests
To quickly show all possible packages and tests execute:
```bash
nix flake show --system no-eval
```
Under `checks` you will find all tests that are executed in our CI. Under `packages` you find all our projects.
```
git+file:///home/lhebendanz/Projects/clan-core
├───apps
│ └───x86_64-linux
│ ├───install-vm: app
│ └───install-vm-nogui: app
├───checks
│ └───x86_64-linux
│ ├───borgbackup omitted (use '--all-systems' to show)
│ ├───check-for-breakpoints omitted (use '--all-systems' to show)
│ ├───clan-dep-age omitted (use '--all-systems' to show)
│ ├───clan-dep-bash omitted (use '--all-systems' to show)
│ ├───clan-dep-e2fsprogs omitted (use '--all-systems' to show)
│ ├───clan-dep-fakeroot omitted (use '--all-systems' to show)
│ ├───clan-dep-git omitted (use '--all-systems' to show)
│ ├───clan-dep-nix omitted (use '--all-systems' to show)
│ ├───clan-dep-openssh omitted (use '--all-systems' to show)
│ ├───"clan-dep-python3.11-mypy" omitted (use '--all-systems' to show)
├───packages
│ └───x86_64-linux
│ ├───clan-cli omitted (use '--all-systems' to show)
│ ├───clan-cli-docs omitted (use '--all-systems' to show)
│ ├───clan-ts-api omitted (use '--all-systems' to show)
│ ├───clan-vm-manager omitted (use '--all-systems' to show)
│ ├───default omitted (use '--all-systems' to show)
│ ├───deploy-docs omitted (use '--all-systems' to show)
│ ├───docs omitted (use '--all-systems' to show)
│ ├───editor omitted (use '--all-systems' to show)
└───templates
├───default: template: Initialize a new clan flake
└───new-clan: template: Initialize a new clan flake
```
You can execute every test separately by following the tree path `nix build .#checks.x86_64-linux.clan-pytest` for example.
## Test Locally in Devshell with Breakpoints
To test the cli locally in a development environment and set breakpoints for debugging, follow these steps:
@ -150,12 +182,14 @@ If you need to inspect the Nix sandbox while running tests, follow these steps:
2. Use `cntr` and `psgrep` to attach to the Nix sandbox. This allows you to interactively debug your code while it's paused. For example:
```bash
cntr exec -w your_sandbox_name
psgrep -a -x your_python_process_name
cntr attach <container id, container name or process id>
```
Or you can also use the [nix breakpoint hook](https://nixos.org/manual/nixpkgs/stable/#breakpointhook)
# Standards
Every new module name should be in kebab-case.
Every fact definition, where possible should be in kebab-case.
- Every new module name should be in kebab-case.
- Every fact definition, where possible should be in kebab-case.

View File

@ -20,11 +20,11 @@ There are several reasons for choosing to self-host. These can include:
Alice wants to self-host a mumble server for her family.
- She visits to the cLAN website, and follows the instructions on how to install cLAN-OS on her server.
- Alice logs into a terminal on her server via SSH (alternatively uses cLAN GUI app)
- Using the cLAN CLI or GUI tool, alice creates a new private network for her family (VPN)
- Alice now browses a list of curated cLAN modules and finds a module for mumble.
- She adds this module to her network using the cLAN tool.
- She visits to the Clan website, and follows the instructions on how to install Clan-OS on her server.
- Alice logs into a terminal on her server via SSH (alternatively uses Clan GUI app)
- Using the Clan CLI or GUI tool, alice creates a new private network for her family (VPN)
- Alice now browses a list of curated Clan modules and finds a module for mumble.
- She adds this module to her network using the Clan tool.
- After that, she uses the clan tool to invite her family members to her network
- Other family members join the private network via the invitation.
- By accepting the invitation, other members automatically install all required software to interact with the network on their machine.
@ -33,7 +33,7 @@ Alice wants to self-host a mumble server for her family.
Alice wants to add a photos app to her private network
- She uses the clan CLI or GUI tool to manage her existing private cLAN family network
- She uses the clan CLI or GUI tool to manage her existing private Clan family network
- She discovers a module for photoprism, and adds it to her server using the tool
- Other members who are already part of her network, will receive a notification that an update is required to their environment
- After accepting, all new software and services to interact with the new photoprism service will be installed automatically.

View File

@ -1,4 +1,4 @@
# Joining a cLAN network
# Joining a Clan network
## General Description
@ -8,13 +8,13 @@ Joining a self-hosted infrastructure involves connecting to a network, server, o
### Story 1: Joining a private network
Alice' son Bob has never heard of cLAN, but receives an invitation URL from Alice who already set up private cLAN network for her family.
Alice' son Bob has never heard of Clan, but receives an invitation URL from Alice who already set up private Clan network for her family.
Bob opens the invitation link and lands on the cLAN website. He quickly learns about what cLAN is and can see that the invitation is for a private network of his family that hosts a number of services, like a private voice chat and a photo sharing platform.
Bob opens the invitation link and lands on the Clan website. He quickly learns about what Clan is and can see that the invitation is for a private network of his family that hosts a number of services, like a private voice chat and a photo sharing platform.
Bob decides to join the network and follows the instructions to install the cLAN tool on his computer.
Bob decides to join the network and follows the instructions to install the Clan tool on his computer.
Feeding the invitation link to the cLAN tool, bob registers his machine with the network.
Feeding the invitation link to the Clan tool, bob registers his machine with the network.
All programs required to interact with the network will be installed and configured automatically and securely.
@ -22,7 +22,7 @@ Optionally, bob can customize the configuration of these programs through a simp
### Story 2: Receiving breaking changes
The cLAN family network which Bob is part of received an update.
The Clan family network which Bob is part of received an update.
The existing photo sharing service has been removed and replaced with another alternative service. The new photo sharing service requires a different client app to view and upload photos.
@ -30,7 +30,7 @@ Bob accepts the update. Now his environment will be updated. The old client soft
Because Bob has customized the previous photo viewing app, he is notified that this customization is no longer valid, as the software has been removed (deprecation message).l
Optionally, Bob can now customize the new photo viewing software through his cLAN configuration app or via a config file.
Optionally, Bob can now customize the new photo viewing software through his Clan configuration app or via a config file.
## Challenges

View File

@ -1,10 +1,10 @@
# cLAN module maintaining
# Clan module maintaining
## General Description
cLAN modules are pieces of software that can be used by admins to build a private or public infrastructure.
Clan modules are pieces of software that can be used by admins to build a private or public infrastructure.
cLAN modules should have the following properties:
Clan modules should have the following properties:
1. Documented: It should be clear what the module does and how to use it.
1. Self contained: A module should be usable as is. If it requires any other software or settings, those should be delivered with the module itself.

41
docs/main.py Normal file
View File

@ -0,0 +1,41 @@
from typing import Any
def define_env(env: Any) -> None:
static_dir = "/static/"
video_dir = "https://clan.lol/" + "videos/"
asciinema_dir = static_dir + "asciinema-player/"
@env.macro
def video(name: str) -> str:
return f"""<video loop muted autoplay id="{name}">
<source src={video_dir + name} type="video/webm">
Your browser does not support the video tag.
</video>"""
@env.macro
def asciinema(name: str) -> str:
return f"""<div id="{name}">
<script>
// Function to load the script and then create the Asciinema player
function loadAsciinemaPlayer() {{
var script = document.createElement('script');
script.src = "{asciinema_dir}/asciinema-player.min.js";
script.onload = function() {{
AsciinemaPlayer.create('{video_dir + name}', document.getElementById("{name}"), {{
loop: true,
autoPlay: true,
controls: false,
speed: 1.5,
theme: "solarized-light"
}});
}};
document.head.appendChild(script);
}}
// Load the Asciinema player script
loadAsciinemaPlayer();
</script>
<link rel="stylesheet" type="text/css" href="{asciinema_dir}/asciinema-player.css" />
</div>"""

View File

@ -1,4 +1,4 @@
site_name: cLAN documentation
site_name: Clan Documentation
site_url: https://docs.clan.lol
repo_url: https://git.clan.lol/clan/clan-core/
repo_name: clan-core
@ -13,6 +13,7 @@ markdown_extensions:
- admonition
- attr_list
- footnotes
- md_in_html
- meta
- plantuml_markdown
- pymdownx.emoji:
@ -26,6 +27,8 @@ markdown_extensions:
- pymdownx.details
- pymdownx.highlight:
use_pygments: true
anchor_linenums: true
- pymdownx.keys
- toc:
title: On this page
@ -35,29 +38,23 @@ exclude_docs: |
/drafts/
nav:
- Blog:
- blog/index.md
- Getting started:
- index.md
- Configure: getting-started/configure.md
- Deploy Machine: getting-started/machines.md
- Installer: getting-started/installer.md
- Setup Networking: getting-started/networking.md
- Provision Secrets & Passwords: getting-started/secrets.md
- Configure: getting-started/configure.md
- Secrets & Facts: getting-started/secrets.md
- Deploy Machine: getting-started/deploy.md
- Mesh VPN: getting-started/mesh-vpn.md
- Backup & Restore: getting-started/backups.md
- Flake-parts: getting-started/flake-parts.md
- Templates: templates/index.md
- Reference:
- clan-core:
- reference/clan-core/index.md
- reference/clan-core/backups.md
- reference/clan-core/facts.md
- reference/clan-core/sops.md
- reference/clan-core/state.md
- clanModules:
- Modules:
- Clan Modules:
- reference/clanModules/borgbackup.md
- reference/clanModules/deltachat.md
- reference/clanModules/diskLayouts.md
- reference/clanModules/disk-layouts.md
- reference/clanModules/ergochat.md
- reference/clanModules/graphical.md
- reference/clanModules/localbackup.md
- reference/clanModules/localsend.md
- reference/clanModules/matrix-synapse.md
@ -66,27 +63,50 @@ nav:
- reference/clanModules/sshd.md
- reference/clanModules/sunshine.md
- reference/clanModules/syncthing.md
- reference/clanModules/static-hosts.md
- reference/clanModules/thelounge.md
- reference/clanModules/vm-user.md
- reference/clanModules/waypipe.md
- reference/clanModules/xfce-vm.md
- reference/clanModules/trusted-nix-caches.md
- reference/clanModules/user-password.md
- reference/clanModules/xfce.md
- reference/clanModules/zerotier-static-peers.md
- reference/clanModules/zt-tcp-relay.md
- CLI:
- reference/cli/index.md
- reference/cli/backups.md
- reference/cli/config.md
- reference/cli/facts.md
- reference/cli/flakes.md
- reference/cli/flash.md
- reference/cli/history.md
- reference/cli/machines.md
- reference/cli/secrets.md
- reference/cli/ssh.md
- reference/cli/vms.md
- Clan Core:
- reference/clan-core/index.md
- reference/clan-core/backups.md
- reference/clan-core/facts.md
- reference/clan-core/sops.md
- reference/clan-core/state.md
- Contributing: contributing/contributing.md
docs_dir: site
site_dir: out
theme:
logo: static/logo.png
font: false
logo: https://clan.lol/static/logo/clan-white.png
favicon: https://clan.lol/static/dark-favicon/128x128.png
name: material
features:
- navigation.instant
- navigation.tabs
- content.code.annotate
- content.code.copy
- content.tabs.link
icon:
repo: fontawesome/brands/git
repo: fontawesome/brands/git-alt
custom_dir: overrides
palette:
# Palette toggle for light mode
@ -107,5 +127,33 @@ theme:
icon: material/weather-sunny
name: Switch to light mode
extra_css:
- static/extra.css
extra:
social:
- icon: fontawesome/regular/comment
link: https://matrix.to/#/#clan:lassul.us
- icon: fontawesome/brands/gitlab
link: https://git.clan.lol/clan/clan-core
- icon: fontawesome/brands/github
link: https://github.com/clan-lol/clan-core
- icon: fontawesome/solid/rss
link: /feed_rss_created.xml
plugins:
- search
- blog
- macros
- rss:
match_path: blog/posts/.*
use_git: false
date_from_meta:
as_creation: "date"
as_update: "date"
datetime_format: "%Y-%m-%d %H:%M"
default_timezone: Europe/Paris
default_time: "17:18"
categories:
- categories
- tags

View File

@ -1,4 +1,13 @@
{ pkgs, module-docs, ... }:
{
pkgs,
module-docs,
clan-cli-docs,
asciinema-player-js,
asciinema-player-css,
roboto,
fira-code,
...
}:
let
uml-c4 = pkgs.python3Packages.plantuml-markdown.override { plantuml = pkgs.plantuml-c4; };
in
@ -15,11 +24,21 @@ pkgs.stdenv.mkDerivation {
++ (with pkgs.python3Packages; [
mkdocs
mkdocs-material
mkdocs-rss-plugin
mkdocs-macros
]);
configurePhase = ''
mkdir -p ./site/reference
mkdir -p ./site/reference/cli
cp -af ${module-docs}/* ./site/reference/
cp -af ${clan-cli-docs}/* ./site/reference/cli/
mkdir -p ./site/static/asciinema-player
ln -snf ${asciinema-player-js} ./site/static/asciinema-player/asciinema-player.min.js
ln -snf ${asciinema-player-css} ./site/static/asciinema-player/asciinema-player.css
# Link to fonts
ln -snf ${roboto}/share/fonts/truetype/Roboto-Regular.ttf ./site/static/
ln -snf ${fira-code}/share/fonts/truetype/FiraCode-VF.ttf ./site/static/
'';
buildPhase = ''

View File

@ -8,7 +8,7 @@
}:
writeShellScriptBin "deploy-docs" ''
set -eux -o pipefail
set -eu -o pipefail
export PATH="${
lib.makeBinPath [
coreutils
@ -17,6 +17,12 @@ writeShellScriptBin "deploy-docs" ''
]
}"
#########################################
# #
# DO NOT PRINT THE SSH KEY TO THE LOGS #
# #
#########################################
set +x
if [ -n "''${SSH_HOMEPAGE_KEY:-}" ]; then
echo "$SSH_HOMEPAGE_KEY" > ./ssh_key
chmod 600 ./ssh_key
@ -24,6 +30,13 @@ writeShellScriptBin "deploy-docs" ''
else
sshExtraArgs=
fi
set -x
###########################
# #
# END OF DANGER ZONE #
# #
###########################
rsync \
-e "ssh -o StrictHostKeyChecking=no $sshExtraArgs" \

View File

@ -40,6 +40,15 @@
mypy --strict $out
'';
asciinema-player-js = pkgs.fetchurl {
url = "https://github.com/asciinema/asciinema-player/releases/download/v3.7.0/asciinema-player.min.js";
sha256 = "sha256-Ymco/+FinDr5YOrV72ehclpp4amrczjo5EU3jfr/zxs=";
};
asciinema-player-css = pkgs.fetchurl {
url = "https://github.com/asciinema/asciinema-player/releases/download/v3.7.0/asciinema-player.css";
sha256 = "sha256-GZMeZFFGvP5GMqqh516mjJKfQaiJ6bL38bSYOXkaohc=";
};
module-docs = pkgs.runCommand "rendered" { nativeBuildInputs = [ pkgs.python3 ]; } ''
export CLAN_CORE=${jsonDocs.clanCore}/share/doc/nixos/options.json
# A file that contains the links to all clanModule docs
@ -54,19 +63,21 @@
in
{
devShells.docs = pkgs.callPackage ./shell.nix {
inherit (self'.packages) docs;
inherit (self'.packages) docs clan-cli-docs;
inherit module-docs;
inherit asciinema-player-js;
inherit asciinema-player-css;
};
packages = {
docs = pkgs.python3.pkgs.callPackage ./default.nix {
inherit (self'.packages) clan-cli-docs;
inherit (inputs) nixpkgs;
inherit module-docs;
inherit asciinema-player-js;
inherit asciinema-player-css;
};
deploy-docs = pkgs.callPackage ./deploy-docs.nix { inherit (config.packages) docs; };
inherit module-docs;
};
legacyPackages = {
foo = jsonDocs;
};
};
}

View File

@ -38,20 +38,7 @@ let
) clanModules;
clanModulesReadmes = builtins.mapAttrs (
module_name: _module:
let
readme = "${self}/clanModules/${module_name}/README.md";
readmeContents =
if
builtins.trace "Trying to get Module README.md for ${module_name} from ${readme}"
# TODO: Edge cases
(builtins.pathExists readme)
then
(builtins.readFile readme)
else
null;
in
readmeContents
module_name: _module: self.lib.modules.getReadme module_name
) clanModules;
# clanCore docs

View File

@ -40,13 +40,14 @@ def sanitize(text: str) -> str:
return text.replace(">", "\\>")
def replace_store_path(text: str) -> Path:
def replace_store_path(text: str) -> tuple[str, str]:
res = text
if text.startswith("/nix/store/"):
res = "https://git.clan.lol/clan/clan-core/src/branch/main/" + str(
Path(*Path(text).parts[4:])
)
return Path(res)
name = Path(res).name
return (res, name)
def render_option_header(name: str) -> str:
@ -74,7 +75,7 @@ def render_option(name: str, option: dict[str, Any], level: int = 3) -> str:
read_only = option.get("readOnly")
res = f"""
{"#" * level} {sanitize(name)} {{#{sanitize(name)}}}
{"#" * level} {sanitize(name)}
{"Readonly" if read_only else ""}
{option.get("description", "No description available.")}
@ -108,9 +109,10 @@ def render_option(name: str, option: dict[str, Any], level: int = 3) -> str:
"""
decls = option.get("declarations", [])
source_path = replace_store_path(decls[0])
source_path, name = replace_store_path(decls[0])
print(source_path, name)
res += f"""
:simple-git: [{source_path.name}]({source_path})
:simple-git: [{name}]({source_path})
"""
res += "\n"
@ -160,7 +162,7 @@ def produce_clan_core_docs() -> None:
for option_name, info in options.items():
outfile = f"{module_name}/index.md"
# Create seperate files for nested options
# Create separate files for nested options
if len(option_name.split(".")) <= 2:
# i.e. clan-core.clanDir
output = core_outputs.get(

View File

@ -2,15 +2,30 @@
docs,
pkgs,
module-docs,
clan-cli-docs,
asciinema-player-js,
asciinema-player-css,
roboto,
fira-code,
...
}:
pkgs.mkShell {
inputsFrom = [ docs ];
shellHook = ''
mkdir -p ./site/reference
mkdir -p ./site/reference/cli
cp -af ${module-docs}/* ./site/reference/
cp -af ${clan-cli-docs}/* ./site/reference/cli/
chmod +w ./site/reference/*
echo "Generated API documentation in './site/reference/' "
mkdir -p ./site/static/asciinema-player
ln -snf ${asciinema-player-js} ./site/static/asciinema-player/asciinema-player.min.js
ln -snf ${asciinema-player-css} ./site/static/asciinema-player/asciinema-player.css
# Link to fonts
ln -snf ${roboto}/share/fonts/truetype/Roboto-Regular.ttf ./site/static/
ln -snf ${fira-code}/share/fonts/truetype/FiraCode-VF.ttf ./site/static/
'';
}

12
docs/overrides/main.html Normal file
View File

@ -0,0 +1,12 @@
{% extends "base.html" %}
{% block extrahead %}
<meta property="og:title" content="Clan - Documentation, Blog & Getting Started Guide" />
<meta property="og:description" content="Documentation for Clan. The peer-to-peer machine deployment framework." />
<meta property="og:image" content="https://clan.lol/static/dark-favicon/128x128.png" />
<meta property="og:url" content="https://docs.clan.lol" />
<meta property="og:type" content="website" />
<meta property="og:site_name" content="Clan" />
<meta property="og:locale" content="en_US" />
{% endblock %}

View File

@ -0,0 +1,26 @@
authors:
DavHau:
name: "DavHau"
description: "Core Developer"
avatar: "https://clan.lol/static/profiles/davhau.jpg"
url: "https://DavHau.com"
Lassulus:
name: "Lassulus"
description: "Core Developer"
avatar: "https://clan.lol/static/profiles/lassulus.jpg"
url: "https://http://lassul.us/"
Mic92:
name: "Mic92"
description: "Core Developer"
avatar: "https://clan.lol/static/profiles/mic92.jpg"
url: "https://thalheim.io"
W:
name: "W"
description: "Founder of Clan"
avatar: "https://clan.lol/static/profiles/w_profile.webp"
url: ""
Qubasa:
name: "Qubasa"
description: "Core Developer"
avatar: "https://clan.lol/static/profiles/qubasa.png"
url: "https://github.com/Qubasa"

2
docs/site/blog/index.md Normal file
View File

@ -0,0 +1,2 @@
# Blog

View File

@ -0,0 +1,72 @@
---
title: "Introducing Clan: Full-Stack Computing Redefined"
description: "Introducing Clan, a new model for a decentralized network, designed to provide families, smaller groups, and small businesses a platform thats private, secure, and user-friendly."
authors:
- W
- Qubasa
date: 2024-03-19
---
In a digital age where users are guided increasingly toward submission and dependence, Clan reclaims computing and networking from the ground up.
Clan enables users to build any system from a git repository, automate secret handling, and join devices in a secure darknet. This control extends beyond applications to communication protocols and the operating system itself, putting you fully in charge of your own digital environment.
## Why We're Building Clan
Our mission is simple: to restore fun, freedom, and functionality to computing as an open source project. We believe in building tools that empower users, foster innovation, and challenge the limitations imposed by outdated paradigms. Clan, in its essence, is an open source endeavor; it's our contribution to a future where technology serves humanity, not the other way around.
## How Clan Changes the Game
Clan embodies a new philosophy in system, application, and network design. It enables seamless, secure communication across devices, simplifies software distribution and updates, and offers both public and private network configurations. Here are some of the ways it accomplishes this:
- **Nix as a Foundation:** Imagine a safety net for your computer's operating system, one that lets you make changes or updates without the fear of causing a crash or losing data. Nix simplifies the complexities of system design, ensuring that updates are safe and systems are more reliable.
- **Simplified System Deployment:** Building and managing a computer system, from the operating system to the software you use, often feels like putting together a complex puzzle. With Clan, the puzzle pieces are replaced by a set of building blocks. Leveraging the power of Nix and Clan's innovative toolkit, anyone from tech-savvy administrators to everyday users can create and maintain what we call "full-stack systems" (everything your computer needs to run smoothly).
- **A Leap in Connectivity:** Imagine if you could create private, secure pathways between your devices, bypassing the noisy and often insecure internet. Clan makes this possible through something called "overlay networks." These networks are like private tunnels, allowing your devices to talk to each other securely and directly. With Clan's built-in overlay networks and automatically configured services, connecting your devices becomes seamless, secure, and hassle-free.
- **Security Through Separation:** Clan employs sandboxing and virtual machines, a technology that runs code in isolated environments - so even if you explore new Clans, your system remains protected from potential threats.
- **Reliable:** With Clan, your data and services are preserved for the long haul. We focus on self-hosted backups and integration with the [Fediverse](https://de.wikipedia.org/wiki/Fediverse), a network of interconnected, independent online communities, so your digital life remains uninterrupted and under your control.
## A Glimpse at Clan's Features
- **Social Scaling:** Choose between creating a private sanctuary for your closest contacts, a dynamic space for a self-contained community, or embracing the open web with public Clans anyone can join.
{{ video(name="show_join.webm")}}
- **Seamless VM Integration:** Applications running in virtual machines can appear and behave as if they're part of your main operating system — a blend of power and simplicity.
{{ video(name="show_run.webm")}}
- **Robust Backup Management:** Keep your data safe _forever_ - never worry about cloud services disappearing in 10 years.
{{ asciinema(name="backups.cast") }}
- **Intuitive Secret Management:** Clan simplifies digital security by automating the creation and management of encryption keys and passwords for your services.
{{ asciinema(name="secrets.cast") }}
- **Remote Install:** Set up and manage Clan systems anywhere in the world with just a QR scan or SSH access, making remote installations as easy as snapping a photo or sharing a link.
{{ asciinema(name="nixos-install.cast") }}
## Who Stands to Benefit?
Clan is for anyone and everyone who believes in the power of open source technology to connect, empower, and protect. From system administrators to less tech-savvy individuals, small business owners to privacy-conscious users, Clan offers something for everyone — a way to reclaim control and redefine how we interact with technology.
## Join the Revolution
Ready to control your digital world? Clan is more than a tool—it's a movement. Secure your data, manage your systems easily, or connect with others how you like. Start with Clan for a better digital future.
Connect with us on our [Matrix channel at clan.lol](https://matrix.to/#/#clan:lassul.us) or through our IRC bridges (coming soon).
Want to see the code? Check it out [on our Gitea](https://git.clan.lol/clan/clan-core) or [on GitHub](https://github.com/clan-lol/clan-core).
Or follow our [RSS feed](https://docs.clan.lol/feed_rss_created.xml)!
Join us and be part of changing technology for the better, together.

View File

@ -0,0 +1,194 @@
---
title: "Dev Report: Introducing the NixOS to JSON Schema Converter"
description: "Discover our new library designed to extract JSON schema interfaces from NixOS modules, streamlining frontend development"
authors:
- DavHau
date: 2024-05-25
slug: jsonschema-converter
---
## Overview
Weve developed a new library designed to extract interfaces from NixOS modules and convert them into JSON schemas, paving the way for effortless GUI generation. This blog post outlines the motivations behind this development, demonstrates the capabilities of the library, and guides you through leveraging it to create GUIs seamlessly.
## Motivation
In recent months, our team has been exploring various graphical user interfaces (GUIs) to streamline NixOS machine configuration. While our opinionated Clan modules simplify NixOS configurations, there's a need to configure these modules from diverse frontends, such as:
- Command-line interfaces (CLIs)
- Web-based UIs
- Desktop applications
- Mobile applications
- Large Language Models (LLMs)
Given this need, a universal format like JSON is a natural choice. It is already possible as of now, to import json based NixOS configurations, as illustrated below:
`configuration.json`:
```json
{ "networking": { "hostName": "my-machine" } }
```
This configuration can be then imported inside a classic NixOS config:
```nix
{config, lib, pkgs, ...}: {
imports = [
(lib.importJSON ./configuration.json)
];
}
```
This straightforward approach allows us to build a frontend that generates JSON, enabling the configuration of NixOS machines. But, two critical questions arise:
1. How does the frontend learn about existing configuration options?
2. How can it verify user input without running Nix?
Introducing [JSON schema](https://json-schema.org/), a widely supported standard that defines interfaces in JSON and validates input against them.
Example schema for `networking.hostName`:
```json
{
"type": "object",
"properties": {
"networking": {
"type": "object",
"properties": {
"hostName": {
"type": "string",
"pattern": "^$|^[a-z0-9]([a-z0-9_-]{0,61}[a-z0-9])?$"
}
}
}
}
}
```
## Client-Side Input Validation
Validating input against JSON schemas is both efficient and well-supported across numerous programming languages. Using JSON schema validators, you can accurately check configurations like our `configuration.json`.
Validation example:
```shell
$ nix-shell -p check-jsonschema
$ jsonschema -o pretty ./schema.json -i ./configuration.json
===[SUCCESS]===(./configuration.json)===
```
In case of invalid input, schema validators provide explicit error messages:
```shell
$ echo '{ "networking": { "hostName": "my/machine" } }' > configuration.json
$ jsonschema -o pretty ./schema.json -i ./configuration.json
===[ValidationError]===(./configuration.json)===
'my/machine' does not match '^$|^[a-z0-9]([a-z0-9_-]{0,61}[a-z0-9])?$'
Failed validating 'pattern' in schema['properties']['networking']['properties']['hostName']:
{'pattern': '^$|^[a-z0-9]([a-z0-9_-]{0,61}[a-z0-9])?$',
'type': 'string'}
On instance['networking']['hostName']:
'my/machine'
```
## Automatic GUI Generation
Certain libraries facilitate straightforward GUI generation from JSON schemas. For instance, the [react-jsonschema-form playground](https://rjsf-team.github.io/react-jsonschema-form/) auto-generates a form for any given schema.
## NixOS Module to JSON Schema Converter
To enable the development of responsive frontends, our library allows the extraction of interfaces from NixOS modules to JSON schemas. Open-sourced for community collaboration, this library supports building sophisticated user interfaces for NixOS.
Heres a preview of our library's functions exposed through the [clan-core](https://git.clan.lol/clan/clan-core) flake:
- `lib.jsonschema.parseModule` - Generates a schema for a NixOS module.
- `lib.jsonschema.parseOption` - Generates a schema for a single NixOS option.
- `lib.jsonschema.parseOptions` - Generates a schema from an attrset of NixOS options.
Example:
`module.nix`:
```nix
{lib, config, pkgs, ...}: {
# a simple service with two options
options.services.example-web-service = {
enable = lib.mkEnableOption "Example web service";
port = lib.mkOption {
type = lib.types.int;
description = "Port used to serve the content";
};
};
}
```
Converted, using the `parseModule` function:
```shell
$ cd clan-core
$ nix eval --json --impure --expr \
'(import ./lib/jsonschema {}).parseModule ./module.nix' | jq | head
{
"properties": {
"services": {
"properties": {
"example-web-service": {
"properties": {
"enable": {
"default": false,
"description": "Whether to enable Example web service.",
"examples": [
...
```
This utility can also generate interfaces for existing NixOS modules or options.
## GUI for NGINX in Under a Minute
Creating a prototype GUI for the NGINX module using our library and [react-jsonschema-form playground](https://rjsf-team.github.io/react-jsonschema-form/) can be done quickly:
1. Export all NGINX options into a JSON schema using a Nix expression:
```nix
# export.nix
let
pkgs = import <nixpkgs> {};
clan-core = builtins.getFlake "git+https://git.clan.lol/clan/clan-core";
options = (pkgs.nixos {}).options.services.nginx;
in
clan-core.lib.jsonschema.parseOption options
```
2. Write the schema into a file:
```shell
$ nix eval --json -f ./export.nix | jq > nginx.json
```
3. Open the [react-jsonschema-form playground](https://rjsf-team.github.io/react-jsonschema-form/), select `Blank` and paste the `nginx.json` contents.
This provides a quick look at a potential GUI (screenshot is cropped).
![Image title](https://clan.lol/static/blog-post-jsonschema/nginx-gui.jpg)
## Limitations
### Laziness
JSON schema mandates the declaration of all required fields upfront, which might be configured implicitly or remain unused. For instance, `services.nginx.virtualHosts.<name>.sslCertificate` must be specified even if SSL isnt enabled.
### Limited Types
Certain NixOS module types, like `types.functionTo` and `types.package`, do not map straightforwardly to JSON. For full compatibility, adjustments to NixOS modules might be necessary, such as substituting `listOf package` with `listOf str`.
### Parsing NixOS Modules
Currently, our converter relies on the `options` attribute of evaluated NixOS modules, extracting information from the `type.name` attribute, which is suboptimal. Enhanced introspection capabilities within the NixOS module system would be beneficial.
## Future Prospects
We hope these experiments inspire the community, encourage contributions and further development in this space. Share your ideas and contributions through our issue tracker or matrix channel!
## Links
- [Comments on NixOS Discourse](https://discourse.nixos.org/t/introducing-the-nixos-to-json-schema-converter/45948)
- [Source Code of the JSON Schema Library](https://git.clan.lol/clan/clan-core/src/branch/main/lib/jsonschema)
- [Our Issue Tracker](https://git.clan.lol/clan/clan-core/issues)
- [Our Matrix Channel](https://matrix.to/#/#clan:lassul.us)
- [react-jsonschema-form Playground](https://rjsf-team.github.io/react-jsonschema-form/)

View File

@ -0,0 +1,13 @@
---
title: "New documentation site and weekly new meetup"
authors:
- Lassulus
- Mic92
date: 2024-04-16
---
Last week, we added a new documentation hub for clan at [docs.clan.lol](https://docs.clan.lol).
We are still working on improving the installation procedures, so stay tuned.
We now have weekly office hours where people are invited to hangout and ask questions.
They are every Wednesday 15:30 UTC (17:30 CEST) in our [jitsi](https://jitsi.lassul.us/clan.lol).
Otherwise drop by in our [matrix channel](https://matrix.to/#/#clan:lassul.us).

View File

@ -0,0 +1,63 @@
---
title: "Git Based Machine Deployment with Clan-Core"
description: ""
authors:
- Qubasa
date: 2024-05-25
---
## Revolutionizing Server Management
In the world of server management, countless tools claim to offer seamless deployment of multiple machines. Yet, many fall short, leaving server admins and self-hosting enthusiasts grappling with complexity. Enter the Clan-Core Framework—a groundbreaking all in one solution designed to transform decentralized self-hosting into an effortless and scalable endeavor.
### The Power of Clan-Core
Imagine having the power to manage your servers with unparalleled ease, scaling your IT infrastructure like never before. Clan-Core empowers you to do just that. At its core, Clan-Core leverages a single Git repository to define everything about your machines. This central repository utilizes Nix or JSON files to specify configurations, including disk formatting, ensuring a streamlined and unified approach.
### Simplified Deployment Process
With Clan-Core, the cumbersome task of bootstrapping a specific ISO is a thing of the past. All you need is SSH access to your Linux server. Clan-Core allows you to overwrite any existing Linux distribution live over SSH, eliminating time-consuming setup processes. This capability means you can deploy updates or new configurations swiftly and efficiently, maximizing uptime and minimizing hassle.
### Secure and Efficient Secret Management
Security is paramount in server management, and Clan-Core takes it seriously. Passwords and other sensitive information are encrypted within the Git repository, automatically decrypted during deployment. This not only ensures the safety of your secrets but also simplifies their management. Clan-Core supports sharing secrets with other admins, fostering collaboration and maintaining reproducibillity and security without sacrificing convenience.
### Services as Apps
Setting up a service can be quite difficult. Many server adjustments need to be made, from setting up a database to adjusting webserver configurations and generating the correct private keys. However, Clan-Core aims to make setting up a service as easy as installing an application. Through Clan-Core's Module system, everything down to secrets can be automatically set up. This transforms the often daunting task of service setup into a smooth, automated process, making it accessible to all.
### Decentralized Mesh VPN
Building on these features is a self-configuring decentralized mesh VPN that interconnects all your machines into a private darknet. This ensures that sensitive services, which might have too much attack surface to be hosted on the public internet, can still be made available privately without the need to worry about potential system compromise. By creating a secure, private network, Clan-Core offers an additional layer of protection for your most critical services.
### Decentralized Domain Name System
Current DNS implementations are distributed but not truly decentralized. For Clan-Core, we implemented our own truly decentralized DNS module. This module uses simple flooding and caching algorithms to discover available domains inside the darknet. This approach ensures that your internal domain name system is robust, reliable, and independent of external control, enhancing the resilience and security of your infrastructure.
### A New Era of Decentralized Self-Hosting
Clan-Core is more than just a tool; it's a paradigm shift in server management. By consolidating machine definitions, secrets and network configuration, into a single, secure repository, it transforms how you manage and scale your infrastructure. Whether you're a seasoned server admin or a self-hosting enthusiast, Clan-Core offers a powerful, user-friendly solution to take your capabilities to the next level.
### Key Features of Clan-Core:
- **Unified Git Repository**: All machine configurations and secrets stored in a single repository.
- **Live Overwrites**: Deploy configurations over existing Linux distributions via SSH.
- **Automated Service Setup**: Easily set up services with Clan-Core's Module system.
- **Decentralized Mesh VPN**: Securely interconnect all machines into a private darknet.
- **Decentralized DNS**: Robust, independent DNS using flooding and caching algorithms.
- **Automated Secret Management**: Encrypted secrets that are automatically decrypted during deployment.
- **Collaboration Support**: Share secrets securely with other admins.
## Clan-Cores Future
Our vision for Clan-Core extends far beyond being just another deployment tool. Clan-Core is a framework we've developed to achieve something much greater. We want to put the "personal" back into "personal computing." Our goal is for everyday users to fully customize their phones or laptops and create truly private spaces for friends and family.
Our first major step is to develop a Graphical User Interface (GUI) that makes configuring all this possible. Initial tests have shown that AI can be leveraged as an alternative to traditional GUIs. This paves the way for a future where people can simply talk to their computers, and they will configure themselves according to the users' wishes.
By adopting Clan, you're not just embracing a tool—you're joining a movement towards a more efficient, secure, and scalable approach to server management. Join us and revolutionize your IT infrastructure today.

View File

@ -5,10 +5,6 @@
In the `flake.nix` file:
- [x] set a unique `clanName`.
- [ ] set `clanIcon` (optional)
- [ ] Set `machineIcon` per machine (optional)
These icons will be used by our future GUI.
=== "**buildClan**"
@ -16,16 +12,12 @@ These icons will be used by our future GUI.
buildClan {
# Set a unique name
clanName = "Lobsters";
# Optional, a path to an image file
clanIcon = ./path/to/file;
# Should usually point to the directory of flake.nix
directory = ./.;
machines = {
jon = {
# ...
# Optional, a path to an image file
clanCore.machineIcon = ./path/to/file;
};
# ...
}
@ -40,14 +32,10 @@ These icons will be used by our future GUI.
clan = {
# Set a unique name
clanName = "Lobsters";
# Optional, a path to an image file
clanIcon = ./path/to/file;
machines = {
jon = {
# ...
# Optional, a path to an image file
clanCore.machineIcon = ./path/to/file;
};
# ...
}
@ -63,12 +51,15 @@ Adding or configuring a new machine requires two simple steps:
1. Find the remote disk id by executing:
```bash title="setup computer"
ssh root@<target-computer> lsblk --output NAME,ID-LINK,FSTYPE,SIZE,MOUNTPOINT
ssh root@flash-installer.local lsblk --output NAME,ID-LINK,FSTYPE,SIZE,MOUNTPOINT
```
!!! Note
Replace `flash-installer.local` with the IP address of the machine if you don't have the avahi service running which resolves mDNS local domains.
Which should show something like:
```bash
```{.shellSession hl_lines="6" .no-copy}
NAME ID-LINK FSTYPE SIZE MOUNTPOINT
sda usb-ST_16GB_AA6271026J1000000509-0:0 14.9G
├─sda1 usb-ST_16GB_AA6271026J1000000509-0:0-part1 1M
@ -84,76 +75,113 @@ Adding or configuring a new machine requires two simple steps:
=== "**buildClan**"
```nix title="clan-core.lib.buildClan"
```nix title="clan-core.lib.buildClan" hl_lines="18 23"
buildClan {
# ...
machines = {
"jon" = {
imports = [
# ...
./modules/disko.nix
./machines/jon/configuration.nix
];
# ...
# Change this to the correct ip-address or hostname
# The hostname is the machine name by default
clan.networking.targetHost = pkgs.lib.mkDefault "root@<hostname>"
clan.networking.targetHost = pkgs.lib.mkDefault "root@jon"
# Change this to the ID-LINK of the desired disk shown by 'lsblk'
clan.diskLayouts.singleDiskExt4 = {
disko.devices.disk.main = {
device = "/dev/disk/by-id/__CHANGE_ME__";
}
# e.g. > cat ~/.ssh/id_ed25519.pub
users.users.root.openssh.authorizedKeys.keys = [
"<YOUR SSH_KEY>"
];
# ...
};
};
};
}
```
=== "**flakeParts**"
```nix title="clan-core.flakeModules.default"
```nix title="clan-core.flakeModules.default" hl_lines="18 23"
clan = {
# ...
machines = {
"jon" = {
imports = [
# ...
./modules/disko.nix
./machines/jon/configuration.nix
];
# ...
# Change this to the correct ip-address or hostname
# The hostname is the machine name by default
clan.networking.targetHost = pkgs.lib.mkDefault "root@<hostname>"
clan.networking.targetHost = pkgs.lib.mkDefault "root@jon"
# Change this to the ID-LINK of the desired disk shown by 'lsblk'
clan.diskLayouts.singleDiskExt4 = {
disko.devices.disk.main = {
device = "/dev/disk/by-id/__CHANGE_ME__";
}
# e.g. > cat ~/.ssh/id_ed25519.pub
users.users.root.openssh.authorizedKeys.keys = [
"__YOUR_SSH_KEY__"
];
# ...
};
};
};
};
```
### Step 2. Detect hardware specific drivers
1. Generate a `hardware-configuration.nix` for your target computer
!!! Info "Replace `__CHANGE_ME__` with the appropriate identifier, such as `nvme-eui.e8238fa6bf530001001b448b4aec2929`"
!!! Info "Replace `__YOUR_SSH_KEY__` with your personal key, like `ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILoMI0NC5eT9pHlQExrvR5ASV3iW9+BXwhfchq0smXUJ jon@jon-desktop`"
```bash
ssh root@<target-computer> nixos-generate-config --no-filesystems --show-hardware-config > hardware-configuration.nix
```
These steps will allow you to update your machine later.
2. Move the generated file to `machines/jon/hardware-configuration.nix`.
### Step 2: Detect Drivers
### Initialize the facts
Generate the `hardware-configuration.nix` file for your machine by executing the following command:
!!! Info
**All facts are automatically initialized.**
```bash
ssh root@flash-installer.local nixos-generate-config --no-filesystems --show-hardware-config > machines/jon/hardware-configuration.nix
```
This command connects to `flash-installer.local` as `root`, runs `nixos-generate-config` to detect hardware configurations (excluding filesystems), and writes them to `machines/jon/hardware-configuration.nix`.
### Step 3: Custom Disk Formatting
In `./modules/disko.nix`, a simple `ext4` disk partitioning scheme is defined for the Disko module. For more complex disk partitioning setups, refer to the [Disko examples](https://github.com/nix-community/disko/tree/master/example).
### Step 4: Custom Configuration
Modify `./machines/jon/configuration.nix` to personalize the system settings according to your requirements.
### Step 5: Check Configuration
Validate your configuration by running:
```bash
nix flake check
```
This command helps ensure that your system configuration is correct and free from errors.
!!! Note
Integrate this step into your [Continuous Integration](https://en.wikipedia.org/wiki/Continuous_integration) workflow to ensure that only valid Nix configurations are merged into your codebase. This practice helps maintain system stability and reduces integration issues.
If you need additional help see our [facts chapter](./secrets.md)
---
## Whats next?
- [Deploying](machines.md): Deploying a Machine configuration
- [Secrets](secrets.md): Learn about secrets and facts
- [Secrets & Facts](secrets.md): Setting up secrets with nix-sops
---

View File

@ -0,0 +1,231 @@
# Deploy Machine
Integrating a new machine into your Clan environment is an easy yet flexible process, allowing for a straight forward management of multiple NixOS configurations.
We'll walk you through adding a new computer to your Clan.
## Installing a New Machine
Clan CLI, in conjunction with [nixos-anywhere](https://github.com/nix-community/nixos-anywhere), provides a seamless method for installing NixOS on various machines.
This process involves preparing a suitable hardware and disk partitioning configuration and ensuring the target machine is accessible via SSH.
### Step 0. Prerequisites
=== "**Physical Hardware**"
- [x] **Two Computers**: You need one computer that you're getting ready (we'll call this the Target Computer) and another one to set it up from (we'll call this the Setup Computer). Make sure both can talk to each other over the network using SSH.
- [x] **Machine configuration**: See our basic [configuration guide](./configure.md)
- [x] **Initialized secrets**: See [secrets](secrets.md) for how to initialize your secrets.
- [x] **USB Flash Drive**: See [Clan Installer](installer.md)
!!! Steps
1. Create a NixOS installer image and transfer it to a bootable USB drive as described in the [installer](./installer.md).
2. Boot the target machine and connect it to a network that makes it reachable from your setup computer.
=== "**Remote Machines**"
- [x] **Two Computers**: You need one computer that you're getting ready (we'll call this the Target Computer) and another one to set it up from (we'll call this the Setup Computer). Make sure both can talk to each other over the network using SSH.
- [x] **Machine configuration**: See our basic [configuration guide](./configure.md)
- [x] **Initialized secrets**: See [secrets](secrets.md) for how to initialize your secrets.
!!! Steps
- Any cloud machine if it is reachable via SSH and supports `kexec`.
### Step 1. Deploy the machine
**Finally deployment time!** Use the following command to build and deploy the image via SSH onto your machine.
=== "**Image Installer**"
This method makes use of the image installers of [nixos-images](https://github.com/nix-community/nixos-images).
See how to prepare the installer for use [here](./installer.md).
The installer will randomly generate a password and local addresses on boot, then run ssh with these preconfigured.
The installer shows it's deployment relevant information in two formats, a text form, as well as a QR code.
This is an example of the booted installer.
```{ .bash .annotate .no-copy .nohighlight}
┌─────────────────────────────────────────────────────────────────────────────────────┐
│ ┌───────────────────────────┐ │
│ │███████████████████████████│ # This is the QR Code (1) │
│ │██ ▄▄▄▄▄ █▀▄█▀█▀▄█ ▄▄▄▄▄ ██│ │
│ │██ █ █ █▀▄▄▄█ ▀█ █ █ ██│ │
│ │██ █▄▄▄█ █▀▄ ▀▄▄▄█ █▄▄▄█ ██│ │
│ │██▄▄▄▄▄▄▄█▄▀ ▀▄▀▄█▄▄▄▄▄▄▄██│ │
│ │███▀▀▀ █▄▄█ ▀▄ ▄▀▄█ ███│ │
│ │██▄██▄▄█▄▄▀▀██▄▀ ▄▄▄ ▄▀█▀██│ │
│ │██ ▄▄▄▄▄ █▄▄▄▄ █ █▄█ █▀ ███│ │
│ │██ █ █ █ █ █ ▄▄▄ ▄▀▀ ██│ │
│ │██ █▄▄▄█ █ ▄ ▄ ▄ ▀█ ▄███│ │
│ │██▄▄▄▄▄▄▄█▄▄▄▄▄▄█▄▄▄▄▄█▄███│ │
│ │███████████████████████████│ │
│ └───────────────────────────┘ │
│ ┌─────────────────────────────────────────────────────────────────────────────────┐ │
│ │Root password: cheesy-capital-unwell # password (2) │ │
│ │Local network addresses: │ │
│ │enp1s0 UP 192.168.178.169/24 metric 1024 fe80::21e:6ff:fe45:3c92/64 │ │
│ │enp2s0 DOWN │ │
│ │wlan0 DOWN # connect to wlan (3) │ │
│ │Onion address: 6evxy5yhzytwpnhc2vpscrbti3iktxdhpnf6yim6bbs25p4v6beemzyd.onion │ │
│ │Multicast DNS: nixos-installer.local │ │
│ └─────────────────────────────────────────────────────────────────────────────────┘ │
│ Press 'Ctrl-C' for console access │
│ │
└─────────────────────────────────────────────────────────────────────────────────────┘
```
1. This is not an actual QR code, because it is displayed rather poorly on text sites.
This would be the actual content of this specific QR code prettified:
```json
{
"pass": "cheesy-capital-unwell",
"tor": "6evxy5yhzytwpnhc2vpscrbti3iktxdhpnf6yim6bbs25p4v6beemzyd.onion",
"addrs": [
"2001:9e8:347:ca00:21e:6ff:fe45:3c92"
]
}
```
To generate the actual QR code, that would be displayed use:
```shellSession
echo '{"pass":"cheesy-capital-unwell","tor":"6evxy5yhzytwpnhc2vpscrbti3iktxdhpnf6yim6bbs25p4v6beemzyd.onion","addrs":["2001:9e8:347:ca00:21e:6ff:fe45:3c92"]}' | nix run nixpkgs#qrencode -- -s 2 -m 2 -t utf8
```
2. The root password for the installer medium.
This password is autogenerated and meant to be easily typeable.
3. See how to connect the installer medium to wlan [here](./installer.md#optional-connect-to-wifi).
4. :man_raising_hand: I'm a code annotation! I can contain `code`, __formatted
text__, images, ... basically anything that can be written in Markdown.
!!!tip
For easy sharing of deployment information via QR code, we highly recommend using [KDE Connect](https://apps.kde.org/de/kdeconnect/).
There are two ways to deploy your machine:
1. **SSH with Password Authentication**
Run the following command to install using SSH:
```bash
clan machines install [MACHINE] flash-installer.local
```
2. **Scanning a QR Code for Installation Details**
You can input the information by following one of these methods:
- **Using a JSON String or File Path:**
Provide the path to a JSON string or input the string directly:
```terminal
clan machines install [MACHINE] --json [JSON]
```
- **Using an Image Containing the QR Code:**
Provide the path to an image file containing the relevant QR code:
```terminal
clan machines install [MACHINE] --png [PATH]
```
=== "**SSH access**"
Replace `<target_host>` with the **target computers' ip address**:
```bash
clan machines install [MACHINE] <target_host>
```
If you are using our template `[MACHINE]` would be `jon`
!!! success
Your machine is all set up. 🎉 🚀
## Update Your Machines
Clan CLI enables you to remotely update your machines over SSH. This requires setting up a target address for each target machine.
### Setting the Target Host
Replace `root@jon` with the actual hostname or IP address of your target machine:
```{.nix hl_lines="9" .no-copy}
buildClan {
# ...
machines = {
# "jon" will be the hostname of the machine
"jon" = {
# Set this for clan commands use ssh i.e. `clan machines update`
# If you change the hostname, you need to update this line to root@<new-hostname>
# This only works however if you have avahi running on your admin machine else use IP
clan.networking.targetHost = pkgs.lib.mkDefault "root@jon";
};
};
};
```
!!! warning
The use of `root@` in the target address implies SSH access as the `root` user.
Ensure that the root login is secured and only used when necessary.
### Updating Machine Configurations
Execute the following command to update the specified machine:
```bash
clan machines update jon
```
You can also update all configured machines simultaneously by omitting the machine name:
```bash
clan machines update
```
### Setting a Build Host
If the machine does not have enough resources to run the NixOS evaluation or build itself,
it is also possible to specify a build host instead.
During an update, the cli will ssh into the build host and run `nixos-rebuild` from there.
```{.nix hl_lines="5" .no-copy}
buildClan {
# ...
machines = {
"jon" = {
clan.networking.buildHost = "root@<host_or_ip>";
};
};
};
```
### Excluding a machine from `clan machine update`
To exclude machines from being updated when running `clan machines update` without any machines specified,
one can set the `clan.deployment.requireExplicitUpdate` option to true:
```{.nix hl_lines="5" .no-copy}
buildClan {
# ...
machines = {
"jon" = {
clan.deployment.requireExplicitUpdate = true;
};
};
};
```
This is useful for machines that are not always online or are not part of the regular update cycle.
---
## What's next ?
- [**Mesh VPN**](./mesh-vpn.md): Configuring a secure mesh network.
---

View File

@ -69,16 +69,16 @@ Below is a guide on how to structure this in your flake.nix:
jon = {
imports = [
./machines/jon/configuration.nix
./modules/disko.nix
# ... more modules
];
nixpkgs.hostPlatform = "x86_64-linux";
clanCore.machineIcon = null; # Optional, a path to an image file
# Set this for clan commands use ssh i.e. `clan machines update`
clan.networking.targetHost = pkgs.lib.mkDefault "root@jon";
# remote> lsblk --output NAME,ID-LINK,FSTYPE,SIZE,MOUNTPOINT
clan.diskLayouts.singleDiskExt4 = {
disko.devices.disk.main = {
device = "/dev/disk/by-id/nvme-eui.e8238fa6bf530001001b448b4aec2929";
};
@ -94,9 +94,4 @@ Below is a guide on how to structure this in your flake.nix:
For detailed information about configuring `flake-parts` and the available options within Clan,
refer to the Clan module documentation located [here](https://git.clan.lol/clan/clan-core/src/branch/main/flakeModules/clan.nix).
## Whats next?
- [Configure Machines](configure.md): Customize machine configuration
- [Deploying](machines.md): Deploying a Machine configuration
---

View File

@ -1,10 +1,11 @@
# Installer
We offer a dedicated installer to assist remote installations.
Our installer image simplifies the process of performing remote installations.
In this tutorial we will guide you through building and flashing it to a bootable USB drive.
Follow our step-by-step guide to create and transfer this image onto a bootable USB drive.
## Creating and Using the **Clan Installer**
!!! info
If you already have a NixOS machine you can ssh into (in the cloud for example) you can skip this chapter and go directly to [Configure Machines](configure.md).
### Step 0. Prerequisites
@ -21,7 +22,7 @@ In this tutorial we will guide you through building and flashing it to a bootabl
lsblk
```
```{.console, .no-copy}
```{.shellSession hl_lines="2" .no-copy}
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
sdb 8:0 1 117,2G 0 disk
└─sdb1 8:1 1 117,2G 0 part /run/media/qubasa/INTENSO
@ -38,28 +39,53 @@ In this tutorial we will guide you through building and flashing it to a bootabl
```shellSession
sudo umount /dev/sdb1
```
=== "**Linux OS**"
### Step 2. Flash Custom Installer
### Step 2. Download the Installer
Using clan flash enables the inclusion of ssh public keys.
It also allows to set language and keymap currently in the installer image.
```shellSession
wget https://github.com/nix-community/nixos-images/releases/download/nixos-unstable/nixos-installer-x86_64-linux.iso
```
```bash
clan flash --flake git+https://git.clan.lol/clan/clan-core \
--ssh-pubkey $HOME/.ssh/id_ed25519.pub \
--keymap en \
--language en \
--disk main /dev/sd<X> \
flash-installer
```
### Step 3. Flash the Installer to the USB Drive
The `--ssh-pubkey`, `--language` and `--keymap` are optional.
Replace `$HOME/.ssh/id_ed25519.pub` with a path to your SSH public key.
If you do not have an ssh key yet, you can generate one with `ssh-keygen -t ed25519` command.
!!! Danger "Specifying the wrong device can lead to unrecoverable data loss."
!!! Danger "Specifying the wrong device can lead to unrecoverable data loss."
The `dd` utility will erase the disk. Make sure to specify the correct device (`of=...`)
The `clan flash` utility will erase the disk. Make sure to specify the correct device
For example if the USB device is `sdb` use `of=/dev/sdb`.
Use the `dd` utility to write the NixOS installer image to your USB drive:
=== "**Other OS**"
### Step 2. Download Generic Installer
```shellSession
sudo dd bs=4M conv=fsync oflag=direct status=progress if=./nixos-installer-x86_64-linux.iso of=/dev/sd<X>
```
```shellSession
wget https://github.com/nix-community/nixos-images/releases/download/nixos-unstable/nixos-installer-x86_64-linux.iso
```
### Step 3. Flash the Installer to the USB Drive
!!! Danger "Specifying the wrong device can lead to unrecoverable data loss."
The `dd` utility will erase the disk. Make sure to specify the correct device (`of=...`)
For example if the USB device is `sdb` use `of=/dev/sdb`.
Use the `dd` utility to write the NixOS installer image to your USB drive:
```shellSession
sudo dd bs=4M conv=fsync oflag=direct status=progress if=./nixos-installer-x86_64-linux.iso of=/dev/sd<X>
```
### Step 4. Boot and Connect to your network
@ -89,17 +115,6 @@ Select `NixOS` to boot into the clan installer.
For deploying your configuration the machine needs to be connected via LAN (recommended).
For connecting via Wifi, please consult the [guide below](#optional-connect-to-wifi).
---
## Whats next?
- [Configure Machines](configure.md): Customize machine configuration
- [Deploying](machines.md): Deploying a Machine configuration
- [WiFi](#optional-connect-to-wifi): Guide for connecting to Wifi.
---
## (Optional) Connect to Wifi
@ -117,9 +132,10 @@ This will enter `iwd`
Now run the following command to connect to your Wifi:
```shellSession
```{.shellSession .no-copy}
# Identify your network device.
device list
# Replace 'wlan0' with your wireless device name
# Find your Wifi SSID.
station wlan0 scan
@ -141,9 +157,17 @@ Connected network FRITZ!Box (Your router device)
IPv4 address 192.168.188.50 (Your new local ip)
```
Press `ctrl-d` to exit `IWD`.
Press ++ctrl+d++ to exit `IWD`.
!!! Important
Press `ctrl-d` **again** to update the displayed QR code and connection information.
Press ++ctrl+d++ **again** to update the displayed QR code and connection information.
You're all set up
---
## Whats next?
- [Configure Machines](configure.md): Customize machine configuration
---

View File

@ -1,125 +0,0 @@
# Deploy Machine
Integrating a new machine into your Clan environment is an easy yet flexible process, allowing for a straight forward management of multiple NixOS configurations.
We'll walk you through adding a new computer to your Clan.
## Installing a New Machine
Clan CLI, in conjunction with [nixos-anywhere](https://github.com/nix-community/nixos-anywhere), provides a seamless method for installing NixOS on various machines.
This process involves preparing a suitable hardware and disk partitioning configuration and ensuring the target machine is accessible via SSH.
### Step 0. Prerequisites
=== "**Physical Hardware**"
- [x] **Two Computers**: You need one computer that you're getting ready (we'll call this the Target Computer) and another one to set it up from (we'll call this the Setup Computer). Make sure both can talk to each other over the network using SSH.
- [x] **Machine configuration**: See our basic [configuration guide](./configure.md)
- [x] **Initialized secrets**: See [secrets](secrets.md) for how to initialize your secrets.
- [x] **USB Flash Drive**: See [Clan Installer](installer.md)
!!! Steps
1. Create a NixOS installer image and transfer it to a bootable USB drive as described in the [installer](./installer.md).
2. Boot the target machine and connect it to a network that makes it reachable from your setup computer.
=== "**Baremetal Machines**"
- [x] **Two Computers**: You need one computer that you're getting ready (we'll call this the Target Computer) and another one to set it up from (we'll call this the Setup Computer). Make sure both can talk to each other over the network using SSH.
- [x] **Machine configuration**: See our basic [configuration guide](./configure.md)
- [x] **Initialized secrets**: See [secrets](secrets.md) for how to initialize your secrets.
!!! Steps
- Any cloud machine if it is reachable via SSH and supports `kexec`.
Confirm the machine is reachable via SSH from your setup computer.
```bash
ssh root@<your_target_machine_ip>
```
### Step 1. Deploy the machine
**Finally deployment time!** Use the following command to build and deploy the image via SSH onto your machine.
Replace `<target_host>` with the **target computers' ip address**:
```bash
clan machines install my-machine <target_host>
```
> Note: This may take a while for building and for the file transfer.
!!! success
Your machine is all set up. 🎉 🚀
---
## What's next ?
- [**Update a Machine**](#update-your-machines): Learn how to update an existing machine?
- [**Configure a Private Network**](./networking.md): Configuring a secure mesh network.
---
## Update Your Machines
Clan CLI enables you to remotely update your machines over SSH. This requires setting up a target address for each target machine.
### Setting the Target Host
Replace `host_or_ip` with the actual hostname or IP address of your target machine:
```bash
clan config --machine my-machine clan.networking.targetHost root@host_or_ip
```
!!! warning
The use of `root@` in the target address implies SSH access as the `root` user.
Ensure that the root login is secured and only used when necessary.
### Updating Machine Configurations
Execute the following command to update the specified machine:
```bash
clan machines update my-machine
```
You can also update all configured machines simultaneously by omitting the machine name:
```bash
clan machines update
```
### Setting a Build Host
If the machine does not have enough resources to run the NixOS evaluation or build itself,
it is also possible to specify a build host instead.
During an update, the cli will ssh into the build host and run `nixos-rebuild` from there.
```bash
clan config --machine my-machine clan.networking.buildHost root@host_or_ip
```
### Excluding a machine from `clan machine update`
To exclude machines from being updated when running `clan machines update` without any machines specified,
one can set the `clan.deployment.requireExplicitUpdate` option to true:
```bash
clan config --machine my-machine clan.deployment.requireExplicitUpdate true
```
This is useful for machines that are not always online or are not part of the regular update cycle.
---
# TODO:
* TODO: How to join others people zerotier
* `services.zerotier.joinNetworks = [ "network-id" ]`
* Controller needs to approve over webinterface or cli

View File

@ -1,4 +1,4 @@
# Overlay Networks
# Mesh VPN
This guide provides detailed instructions for configuring
[ZeroTier VPN](https://zerotier.com) within Clan. Follow the
@ -9,7 +9,7 @@ include a new machine into the VPN.
By default all machines within one clan are connected via a chosen network technology.
```
```{.no-copy}
Clan
Node A
<-> (zerotier / mycelium / ...)
@ -36,7 +36,7 @@ peers. Once addresses are allocated, the controller's continuous operation is no
```
3. **Update the Controller Machine**: Execute the following:
```bash
$ clan machines update <CONTROLLER>
clan machines update <CONTROLLER>
```
Your machine is now operational as the VPN controller.

View File

@ -4,13 +4,15 @@ Clan enables encryption of secrets (such as passwords & keys) ensuring security
Clan utilizes the [sops](https://github.com/getsops/sops) format and integrates with [sops-nix](https://github.com/Mic92/sops-nix) on NixOS machines.
This documentation will guide you through managing secrets with the Clan CLI
This guide will walk you through:
## Initializing Secrets (Quickstart)
- **Creating a Keypair for Your User**: Learn how to generate a keypair for $USER to securely control all secrets.
- **Creating Your First Secret**: Step-by-step instructions on creating your initial secret.
- **Assigning Machine Access to the Secret**: Understand how to grant a machine access to the newly created secret.
### Create Your Master Keypair
## Create Your Admin Keypair
To get started, you'll need to create **Your master keypair**.
To get started, you'll need to create **Your admin keypair**.
!!! info
Don't worry — if you've already made one before, this step won't change or overwrite it.
@ -30,7 +32,7 @@ Also add your age public key to the repository with 'clan secrets users add YOUR
!!! warning
Make sure to keep a safe backup of the private key you've just created.
If it's lost, you won't be able to get to your secrets anymore because they all need the master key to be unlocked.
If it's lost, you won't be able to get to your secrets anymore because they all need the admin key to be unlocked.
!!! note
It's safe to add any secrets created by the clan CLI and placed in your repository to version control systems like `git`.
@ -38,11 +40,10 @@ Also add your age public key to the repository with 'clan secrets users add YOUR
### Add Your Public Key
```bash
clan secrets users add <your_username> <your_public_key>
clan secrets users add $USER <your_public_key>
```
!!! note
Choose the same username as on your Setup/Source Machine that you use to control the deployment with.
It's best to choose the same username as on your Setup/Admin Machine that you use to control the deployment with.
Once run this will create the following files:
@ -52,17 +53,146 @@ sops/
└── <your_username>/
└── key.json
```
If you followed the quickstart tutorial all necessary secrets are initialized at this point.
---
> If you followed the quickstart tutorial all necessary secrets are initialized at this point.
## Whats next?
- Continue with [deploying machines](./machines.md)
- Learn about the [basics concept](#concept) of clan secrets
- [Deployment](deploy.md): How to remotely deploy your machine
---
## Concept
## More on Secrets
If you want to know more about how to save and share passwords in your clan read further!
### Adding a Secret
```shellSession
clan secrets set mysecret
Paste your secret:
```
### Retrieving a Stored Secret
```bash
clan secrets get mysecret
```
### List all Secrets
```bash
clan secrets list
```
### NixOS integration
A NixOS machine will automatically import all secrets that are encrypted for the
current machine. At runtime it will use the host key to decrypt all secrets into
an in-memory, non-persistent filesystem using [sops-nix](https://github.com/Mic92/sops-nix).
In your nixos configuration you can get a path to secrets like this `config.sops.secrets.<name>.path`. For example:
```nix
{ config, ...}: {
sops.secrets.my-password.neededForUsers = true;
users.users.mic92 = {
isNormalUser = true;
passwordFile = config.sops.secrets.my-password.path;
};
}
```
### Assigning Access
When using `clan secrets set <secret>` without arguments, secrets are encrypted for the key of the user named like your current $USER.
To add machines/users to an existing secret use:
```bash
clan secrets machines add-secret <machine_name> <secret_name>
```
Alternatively specify users and machines while creating a secret:
```bash
clan secrets set --machine <machine1> --machine <machine2> --user <user1> --user <user2> <secret_name>
```
## Advanced
In this section we go into more advanced secret management topics.
### Groups
Clan CLI makes it easy to manage access by allowing you to create groups.
All users within a group inherit access to all secrets of the group.
This feature eases the process of handling permissions for multiple users.
Here's how to get started:
1. **Creating Groups**:
Assign users to a new group, e.g., `admins`:
```bash
clan secrets groups add admins <username>
```
2. **Listing Groups**:
```bash
clan secrets groups list
```
3. **Assigning Secrets to Groups**:
```bash
clan secrets groups add-secret <group_name> <secret_name>
```
### Adding Machine Keys
New machines in Clan come with age keys stored in `./sops/machines/<machine_name>`. To list these machines:
```bash
clan secrets machines list
```
For existing machines, add their keys:
```bash
clan secrets machines add <machine_name> <age_key>
```
To fetch an age key from an SSH host key:
```bash
ssh-keyscan <domain_name> | nix shell nixpkgs#ssh-to-age -c ssh-to-age
```
### Migration: Importing existing sops-based keys / sops-nix
`clan secrets` stores each secret in a single file, whereas [sops](https://github.com/Mic92/sops-nix) commonly allows to put all secrets in a yaml or json document.
If you already happened to use sops-nix, you can migrate by using the `clan secrets import-sops` command by importing these files:
```bash
% clan secrets import-sops --prefix matchbox- --group admins --machine matchbox nixos/matchbox/secrets/secrets.yaml
```
This will create secrets for each secret found in `nixos/matchbox/secrets/secrets.yaml` in a `./sops` folder of your repository.
Each member of the group `admins` in this case will be able to decrypt the secrets with their respective key.
Since our clan secret module will auto-import secrets that are encrypted for a particular nixos machine,
you can now remove `sops.secrets.<secrets> = { };` unless you need to specify more options for the secret like owner/group of the secret file.
## Indepth Explanation
The secrets system conceptually knows two different entities:
@ -118,9 +248,6 @@ Rel_R(secret, machine, "Decrypt", "", "machine privkey" )
@enduml
```
### Groups
It is possible to create semantic groups to make access control more convenient.
#### User groups
@ -182,146 +309,16 @@ Rel(secret, c1, "Decrypt", "", "Both machine A or B can decrypt using their priv
<!-- TODO: See also [Groups Reference](#groups-reference) -->
---
## 2. Adding Machine Keys
New machines in Clan come with age keys stored in `./sops/machines/<machine_name>`. To list these machines:
```bash
$ clan secrets machines list
```
For existing machines, add their keys:
```bash
$ clan secrets machines add <machine_name> <age_key>
```
### Advanced
To fetch an age key from an SSH host key:
```bash
$ ssh-keyscan <domain_name> | nix shell nixpkgs#ssh-to-age -c ssh-to-age
```
## 3. Assigning Access
By default, secrets are encrypted for your key. To specify which users and machines can access a secret:
```bash
$ clan secrets set --machine <machine1> --machine <machine2> --user <user1> --user <user2> <secret_name>
```
You can add machines/users to existing secrets without modifying the secret:
```bash
$ clan secrets machines add-secret <machine_name> <secret_name>
```
## 4. Adding Secrets
```bash
$ clan secrets set mysecret
Paste your secret:
```
!!! note
As you type your secret won't be displayed. Press Enter to save the secret.
## 5. Retrieving Stored Secrets
```bash
$ clan secrets get mysecret
```
### List all Secrets
```bash
$ clan secrets list
```
## 6. Groups
Clan CLI makes it easy to manage access by allowing you to create groups.
All users within a group inherit access to all secrets of the group.
This feature eases the process of handling permissions for multiple users.
Here's how to get started:
1. **Creating Groups**:
Assign users to a new group, e.g., `admins`:
```bash
$ clan secrets groups add admins <username>
```
2. **Listing Groups**:
```bash
$ clan secrets groups list
```
3. **Assigning Secrets to Groups**:
```bash
$ clan secrets groups add-secret <group_name> <secret_name>
```
## Further
Secrets in the repository follow this structure:
```{.console, .no-copy}
sops/
├── secrets/
│ └── <secret_name>/
│ ├── secret
│ └── users/
│ └── <your_username>/
```
The content of the secret is stored encrypted inside the `secret` file under `mysecret`.
By default, secrets are encrypted with your key to ensure readability.
### NixOS integration
A NixOS machine will automatically import all secrets that are encrypted for the
current machine. At runtime it will use the host key to decrypt all secrets into
an in-memory, non-persistent filesystem using [sops-nix](https://github.com/Mic92/sops-nix).
In your nixos configuration you can get a path to secrets like this `config.sops.secrets.<name>.path`. For example:
```nix
{ config, ...}: {
sops.secrets.my-password.neededForUsers = true;
users.users.mic92 = {
isNormalUser = true;
passwordFile = config.sops.secrets.my-password.path;
};
}
```
See the [readme](https://github.com/Mic92/sops-nix) of sops-nix for more
examples.
### Migration: Importing existing sops-based keys / sops-nix
`clan secrets` stores each secret in a single file, whereas [sops](https://github.com/Mic92/sops-nix) commonly allows to put all secrets in a yaml or json document.
---
If you already happened to use sops-nix, you can migrate by using the `clan secrets import-sops` command by importing these files:
## Whats next?
```bash
% clan secrets import-sops --prefix matchbox- --group admins --machine matchbox nixos/matchbox/secrets/secrets.yaml
```
- [Deployment](deploy.md): How to remotely deploy your machine
This will create secrets for each secret found in `nixos/matchbox/secrets/secrets.yaml` in a `./sops` folder of your repository.
Each member of the group `admins` in this case will be able to decrypt the secrets with their respective key.
Since our clan secret module will auto-import secrets that are encrypted for a particular nixos machine,
you can now remove `sops.secrets.<secrets> = { };` unless you need to specify more options for the secret like owner/group of the secret file.
---

View File

@ -1,44 +1,31 @@
# Getting Started
# Setup
Welcome to your simple guide on starting a new Clan project.
## What's Inside
We've put together a straightforward guide to help you out:
- [**Starting with a New Clan Project**](#starting-with-a-new-clan-project): Create a new Clan from scratch.
- [**Integrating Clan using Flake-Parts**](getting-started/flake-parts.md)
---
## **Starting with a New Clan Project**
Create your own clan with these initial steps.
Create your own clan with these initial steps and manage a fleet of machines with one single testable git repository!
### Prerequisites
#### Linux
=== "**Linux**"
Clan depends on nix installed on your system. Run the following command to install nix.
Clan depends on nix installed on your system. Run the following command to install nix.
```bash
curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install
```
```bash
curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install
```
#### NixOS
=== "**NixOS**"
If you run NixOS the `nix` binary is already installed.
If you run NixOS the `nix` binary is already installed.
You will also need to enable the `flakes` and `nix-commands` experimental features.
You will also need to enable the `flakes` and `nix-commands` experimental features.
```bash
# /etc/nix/nix.conf or ~/.config/nix/nix.conf
experimental-features = nix-command flakes
```
```bash
# /etc/nix/nix.conf or ~/.config/nix/nix.conf
experimental-features = nix-command flakes
```
#### Other
=== "**Other**"
Clan doesn't offer dedicated support for other operating systems yet.
Clan doesn't offer dedicated support for other operating systems yet.
### Step 1: Add Clan CLI to Your Shell
@ -48,6 +35,13 @@ Add the Clan CLI into your development workflow:
nix shell git+https://git.clan.lol/clan/clan-core#clan-cli
```
You can find reference documentation for the `clan` cli program [here](./reference/cli/index.md).
Alternatively you can check out the help pages directly:
```terminalSession
clan --help
```
### Step 2: Initialize Your Project
Set the foundation of your Clan project by initializing it as follows:
@ -57,6 +51,7 @@ clan flakes create my-clan
```
This command creates the `flake.nix` and `.clan-flake` files for your project.
It will also generate files from a default template, to help show general clan usage patterns.
### Step 3: Verify the Project Structure
@ -102,12 +97,6 @@ sara
### What's Next?
- [**Machine Configuration**](getting-started/configure.md): Declare behavior and configuration of machines.
- [**Deploy Machines**](getting-started/machines.md): Learn how to deploy to any remote machine.
- [**Installer**](getting-started/installer.md): Setting up new computers remotely is easy with an USB stick.
- [**Check out our Templates**](templates/index.md)
---

View File

@ -0,0 +1 @@
/nix/store/8y5h98wk5p94mv1wyb2c4gkrr7bswd19-asciinema-player.css

View File

@ -0,0 +1 @@
/nix/store/w0i3f9qzn9n6jmfnfgiw5wnab2f9ssdw-asciinema-player.min.js

View File

@ -0,0 +1,13 @@
@font-face {
font-family: "Roboto";
src: url(./Roboto-Regular.ttf) format('truetype');
}
@font-face {
font-family: "Fira Code";
src: url(./FiraCode-VF.ttf) format('truetype');
}
:root {
--md-text-font: "Roboto";
--md-code-font: "Fira Code";
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

View File

@ -1,24 +0,0 @@
# Templates
We provide some starting templates you can easily use one of those via `nix flakes`.
They showcase best practices and guide you through setting up and using Clan's modules
I.e. To use the `new-clan` template run the following command:
```bash
nix flake init -t git+https://git.clan.lol/clan/clan-core#new-clan
```
## Available Templates
We offer the following templates:
To initialize a clan with one of those run:
```bash
nix flake init -t git+https://git.clan.lol/clan/clan-core#[TEMPLATE_NAME]
```
Substitute `[TEMPLATE_NAME]` with the name of the template.
- **new-clan**: Perfect for beginners, this template shows you how to link two machines in a basic setup.

View File

@ -7,11 +7,11 @@
]
},
"locked": {
"lastModified": 1712356478,
"narHash": "sha256-kTcEtrQIRnexu5lAbLsmUcfR2CrmsACF1s3ZFw1NEVA=",
"lastModified": 1717177033,
"narHash": "sha256-G3CZJafCO8WDy3dyA2EhpUJEmzd5gMJ2IdItAg0Hijw=",
"owner": "nix-community",
"repo": "disko",
"rev": "0a17298c0d96190ef3be729d594ba202b9c53beb",
"rev": "0274af4c92531ebfba4a5bd493251a143bc51f3c",
"type": "github"
},
"original": {
@ -27,11 +27,11 @@
]
},
"locked": {
"lastModified": 1712014858,
"narHash": "sha256-sB4SWl2lX95bExY2gMFG5HIzvva5AVMJd4Igm+GpZNw=",
"lastModified": 1717285511,
"narHash": "sha256-iKzJcpdXih14qYVcZ9QC9XuZYnPc6T8YImb6dX166kw=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "9126214d0a59633752a136528f5f3b9aa8565b7d",
"rev": "2a55567fcf15b1b1c7ed712a2c6fadaec7412ea8",
"type": "github"
},
"original": {
@ -42,11 +42,11 @@
},
"nixlib": {
"locked": {
"lastModified": 1711846064,
"narHash": "sha256-cqfX0QJNEnge3a77VnytM0Q6QZZ0DziFXt6tSCV8ZSc=",
"lastModified": 1712450863,
"narHash": "sha256-K6IkdtMtq9xktmYPj0uaYc8NsIqHuaAoRBaMgu9Fvrw=",
"owner": "nix-community",
"repo": "nixpkgs.lib",
"rev": "90b1a963ff84dc532db92f678296ff2499a60a87",
"rev": "3c62b6a12571c9a7f65ab037173ee153d539905f",
"type": "github"
},
"original": {
@ -55,6 +55,22 @@
"type": "github"
}
},
"nixos-2311": {
"locked": {
"lastModified": 1717017538,
"narHash": "sha256-S5kltvDDfNQM3xx9XcvzKEOyN2qk8Sa+aSOLqZ+1Ujc=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "64e468fd2652105710d86cd2ae3e65a5a6d58dec",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "release-23.11",
"repo": "nixpkgs",
"type": "github"
}
},
"nixos-generators": {
"inputs": {
"nixlib": "nixlib",
@ -63,11 +79,11 @@
]
},
"locked": {
"lastModified": 1712191720,
"narHash": "sha256-xXtSSnVHURHsxLQO30dzCKW5NJVGV/umdQPmFjPFMVA=",
"lastModified": 1716210724,
"narHash": "sha256-iqQa3omRcHGpWb1ds75jS9ruA5R39FTmAkeR3J+ve1w=",
"owner": "nix-community",
"repo": "nixos-generators",
"rev": "0c15e76bed5432d7775a22e8d22059511f59d23a",
"rev": "d14b286322c7f4f897ca4b1726ce38cb68596c94",
"type": "github"
},
"original": {
@ -76,13 +92,34 @@
"type": "github"
}
},
"nixos-images": {
"inputs": {
"nixos-2311": "nixos-2311",
"nixos-unstable": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1717040312,
"narHash": "sha256-yI/en4IxuCEClIUpIs3QTyYCCtmSPLOhwLJclfNwdeg=",
"owner": "nix-community",
"repo": "nixos-images",
"rev": "47bfb55316e105390dd761e0b6e8e0be09462b67",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "nixos-images",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1712468661,
"narHash": "sha256-n2gVVBs+rV+HzPv/N3QQv5cdAXqSkjmaObvfeMqnw2c=",
"lastModified": 1717298511,
"narHash": "sha256-9sXuJn/nL+9ImeYtlspTvjt83z1wIgU+9AwfNbnq+tI=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "298edc8f1e0dfffce67f50375c9f5952e04a6d02",
"rev": "6634a0509e9e81e980b129435fbbec518ab246d0",
"type": "github"
},
"original": {
@ -97,6 +134,7 @@
"disko": "disko",
"flake-parts": "flake-parts",
"nixos-generators": "nixos-generators",
"nixos-images": "nixos-images",
"nixpkgs": "nixpkgs",
"sops-nix": "sops-nix",
"treefmt-nix": "treefmt-nix"
@ -110,11 +148,11 @@
"nixpkgs-stable": []
},
"locked": {
"lastModified": 1712458908,
"narHash": "sha256-DMgBS+jNHDg8z3g9GkwqL8xTKXCRQ/0FGsAyrniVonc=",
"lastModified": 1717297459,
"narHash": "sha256-cZC2f68w5UrJ1f+2NWGV9Gx0dEYmxwomWN2B0lx0QRA=",
"owner": "Mic92",
"repo": "sops-nix",
"rev": "39191e8e6265b106c9a2ba0cfd3a4dafe98a31c6",
"rev": "ab2a43b0d21d1d37d4d5726a892f714eaeb4b075",
"type": "github"
},
"original": {
@ -130,11 +168,11 @@
]
},
"locked": {
"lastModified": 1711963903,
"narHash": "sha256-N3QDhoaX+paWXHbEXZapqd1r95mdshxToGowtjtYkGI=",
"lastModified": 1717278143,
"narHash": "sha256-u10aDdYrpiGOLoxzY/mJ9llST9yO8Q7K/UlROoNxzDw=",
"owner": "numtide",
"repo": "treefmt-nix",
"rev": "49dc4a92b02b8e68798abd99184f228243b6e3ac",
"rev": "3eb96ca1ae9edf792a8e0963cc92fddfa5a87706",
"type": "github"
},
"original": {

View File

@ -8,7 +8,6 @@
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable-small";
disko.url = "github:nix-community/disko";
disko.inputs.nixpkgs.follows = "nixpkgs";
sops-nix.url = "github:Mic92/sops-nix";
@ -16,6 +15,8 @@
sops-nix.inputs.nixpkgs-stable.follows = "";
nixos-generators.url = "github:nix-community/nixos-generators";
nixos-generators.inputs.nixpkgs.follows = "nixpkgs";
nixos-images.url = "github:nix-community/nixos-images";
nixos-images.inputs.nixos-unstable.follows = "nixpkgs";
flake-parts.url = "github:hercules-ci/flake-parts";
flake-parts.inputs.nixpkgs-lib.follows = "nixpkgs";
treefmt-nix.url = "github:numtide/treefmt-nix";
@ -23,10 +24,14 @@
};
outputs =
inputs@{ flake-parts, ... }:
inputs@{ flake-parts, self, ... }:
flake-parts.lib.mkFlake { inherit inputs; } (
{ ... }:
{
clan = {
# meta.name = "clan-core";
directory = self;
};
systems = [
"x86_64-linux"
"aarch64-linux"

View File

@ -17,6 +17,33 @@ let
cfg = config.clan;
in
{
imports = [
# TODO: figure out how to print the deprecation warning
# "${inputs.nixpkgs}/nixos/modules/misc/assertions.nix"
(lib.mkRenamedOptionModule
[
"clan"
"clanName"
]
[
"clan"
"meta"
"name"
]
)
(lib.mkRenamedOptionModule
[
"clan"
"clanIcon"
]
[
"clan"
"meta"
"icon"
]
)
];
options.clan = {
directory = mkOption {
type = types.path;
@ -33,15 +60,27 @@ in
default = { };
description = "Allows to include machine-specific modules i.e. machines.\${name} = { ... }";
};
clanName = mkOption {
type = types.str;
description = "Needs to be (globally) unique, as this determines the folder name where the flake gets downloaded to.";
};
clanIcon = mkOption {
type = types.nullOr types.path;
default = null;
description = "A path to an icon to be used for the clan, should be the same for all machines";
# Checks are performed in 'buildClan'
# Not everyone uses flake-parts
meta = {
name = lib.mkOption {
type = types.nullOr types.str;
default = null;
description = "Needs to be (globally) unique, as this determines the folder name where the flake gets downloaded to.";
};
icon = mkOption {
type = types.nullOr types.path;
default = null;
description = "A path to an icon to be used for the clan in the GUI";
};
description = mkOption {
type = types.nullOr types.str;
default = null;
description = "A short description of the clan";
};
};
pkgsForSystem = mkOption {
type = types.functionTo types.raw;
default = _system: null;
@ -52,6 +91,7 @@ in
clanInternals = lib.mkOption {
type = lib.types.submodule {
options = {
meta = lib.mkOption { type = lib.types.attrsOf lib.types.unspecified; };
all-machines-json = lib.mkOption { type = lib.types.attrsOf lib.types.unspecified; };
machines = lib.mkOption { type = lib.types.attrsOf (lib.types.attrsOf lib.types.unspecified); };
machinesFunc = lib.mkOption { type = lib.types.attrsOf (lib.types.attrsOf lib.types.unspecified); };
@ -65,9 +105,8 @@ in
directory
specialArgs
machines
clanName
clanIcon
pkgsForSystem
meta
;
};
};

View File

@ -11,7 +11,9 @@
treefmt.programs.mypy.directories = {
"pkgs/clan-cli".extraPythonPackages = self'.packages.clan-cli.testDependencies;
"pkgs/clan-vm-manager".extraPythonPackages =
self'.packages.clan-vm-manager.externalTestDeps ++ self'.packages.clan-cli.testDependencies;
# clan-vm-manager currently only exists on linux
(self'.packages.clan-vm-manager.externalTestDeps or [ ])
++ self'.packages.clan-cli.testDependencies;
};
treefmt.settings.formatter.nix = {

View File

@ -7,16 +7,58 @@
directory, # The directory containing the machines subdirectory
specialArgs ? { }, # Extra arguments to pass to nixosSystem i.e. useful to make self available
machines ? { }, # allows to include machine-specific modules i.e. machines.${name} = { ... }
clanName, # Needs to be (globally) unique, as this determines the folder name where the flake gets downloaded to.
# DEPRECATED: use meta.name instead
clanName ? null, # Needs to be (globally) unique, as this determines the folder name where the flake gets downloaded to.
# DEPRECATED: use meta.icon instead
clanIcon ? null, # A path to an icon to be used for the clan, should be the same for all machines
meta ? { }, # A set containing clan meta: name :: string, icon :: string, description :: string
pkgsForSystem ? (_system: null), # A map from arch to pkgs, if specified this nixpkgs will be only imported once for each system.
# This improves performance, but all nipxkgs.* options will be ignored.
}:
let
deprecationWarnings = [
(lib.warnIf (
clanName != null
) "clanName is deprecated, please use meta.name instead. ${clanName}" null)
(lib.warnIf (clanIcon != null) "clanIcon is deprecated, please use meta.icon instead" null)
];
machinesDirs = lib.optionalAttrs (builtins.pathExists "${directory}/machines") (
builtins.readDir (directory + /machines)
);
mergedMeta =
let
metaFromFile =
if (builtins.pathExists "${directory}/clan/meta.json") then
let
settings = builtins.fromJSON (builtins.readFile "${directory}/clan/meta.json");
in
settings
else
{ };
legacyMeta = lib.filterAttrs (_: v: v != null) {
name = clanName;
icon = clanIcon;
};
optionsMeta = lib.filterAttrs (_: v: v != null) meta;
warnings =
builtins.map (
name:
if
metaFromFile.${name} or null != optionsMeta.${name} or null && optionsMeta.${name} or null != null
then
lib.warn "meta.${name} is set in different places. (exlicit option meta.${name} overrides ${directory}/clan/meta.json)" null
else
null
) (builtins.attrNames metaFromFile)
++ [ (if (res.name or null == null) then (throw "meta.name should be set") else null) ];
res = metaFromFile // legacyMeta // optionsMeta;
in
# Print out warnings before returning the merged result
builtins.deepSeq warnings res;
machineSettings =
machineName:
# CLAN_MACHINE_SETTINGS_FILE allows to override the settings file temporarily
@ -58,11 +100,15 @@ let
(machines.${name} or { })
(
{
networking.hostName = lib.mkDefault name;
clanCore.clanName = clanName;
clanCore.clanIcon = clanIcon;
# Settings
clanCore.clanDir = directory;
# Inherited from clan wide settings
clanCore.clanName = meta.name or clanName;
clanCore.clanIcon = meta.icon or clanIcon;
# Machine specific settings
clanCore.machineName = name;
networking.hostName = lib.mkDefault name;
nixpkgs.hostPlatform = lib.mkDefault system;
# speeds up nix commands by using the nixpkgs from the host system (especially useful in VMs)
@ -127,10 +173,15 @@ let
) supportedSystems
);
in
{
builtins.deepSeq deprecationWarnings {
inherit nixosConfigurations;
clanInternals = {
# Evaluated clan meta
# Merged /clan/meta.json with overrides from buildClan
meta = mergedMeta;
# machine specifics
machines = configsPerSystem;
machinesFunc = configsFuncPerSystem;
all-machines-json = lib.mapAttrs (

View File

@ -6,6 +6,6 @@
}:
{
jsonschema = import ./jsonschema { inherit lib; };
modules = import ./description.nix { inherit clan-core lib; };
buildClan = import ./build-clan { inherit clan-core lib nixpkgs; };
}

33
lib/description.nix Normal file
View File

@ -0,0 +1,33 @@
{ lib, clan-core, ... }:
rec {
getReadme =
modulename:
let
readme = "${clan-core}/clanModules/${modulename}/README.md";
readmeContents =
if (builtins.pathExists readme) then
(builtins.readFile readme)
else
throw "No README.md found for module ${modulename}";
in
readmeContents;
getShortDescription =
modulename:
let
content = (getReadme modulename);
parts = lib.splitString "---" content;
description = builtins.head parts;
number_of_newlines = builtins.length (lib.splitString "\n" description);
in
if (builtins.length parts) > 1 then
if number_of_newlines > 4 then
throw "Short description in README.md for module ${modulename} is too long. Max 3 newlines."
else if number_of_newlines <= 1 then
throw "Missing short description in README.md for module ${modulename}."
else
description
else
throw "Short description delimiter `---` not found in README.md for module ${modulename}";
}

View File

@ -17,12 +17,18 @@ let
location: ${lib.concatStringsSep "." option.loc}
'';
isExcludedOption = option: (lib.elem (option.type.name or null) excludedTypes);
# Exclude the option if its type is in the excludedTypes list
# or if the option has a defaultText attribute
isExcludedOption =
option: ((lib.elem (option.type.name or null) excludedTypes) || (option ? defaultText));
filterExcluded = lib.filter (opt: !isExcludedOption opt);
filterExcludedAttrs = lib.filterAttrs (_name: opt: !isExcludedOption opt);
# Filter out options where the visible attribute is set to false
filterInvisibleOpts = lib.filterAttrs (_name: opt: opt.visible or true);
allBasicTypes = [
"boolean"
"integer"
@ -47,7 +53,7 @@ rec {
parseOptions =
options':
let
options = filterExcludedAttrs (clean options');
options = filterInvisibleOpts (filterExcludedAttrs (clean options'));
# parse options to jsonschema properties
properties = lib.mapAttrs (_name: option: parseOption option) options;
# TODO: figure out how to handle if prop.anyOf is used
@ -67,33 +73,37 @@ rec {
option:
let
default = lib.optionalAttrs (option ? default) { inherit (option) default; };
example = lib.optionalAttrs (option ? example) {
examples =
if (builtins.typeOf option.example) == "list" then option.example else [ option.example ];
};
description = lib.optionalAttrs (option ? description) {
description = option.description.text or option.description;
};
in
# either type
# TODO: if all nested optiosn are excluded, the parent sould be excluded too
# TODO: if all nested options are excluded, the parent should be excluded too
if
option.type.name or null == "either"
option.type.name or null == "either" || option.type.name or null == "coercedTo"
# return jsonschema property definition for either
then
let
optionsList' = [
{
type = option.type.nestedTypes.left;
type = option.type.nestedTypes.left or option.type.nestedTypes.coercedType;
_type = "option";
loc = option.loc;
}
{
type = option.type.nestedTypes.right;
type = option.type.nestedTypes.right or option.type.nestedTypes.finalType;
_type = "option";
loc = option.loc;
}
];
optionsList = filterExcluded optionsList';
in
default // description // { anyOf = map parseOption optionsList; }
default // example // description // { anyOf = map parseOption optionsList; }
# handle nested options (not a submodule)
else if !option ? _type then
@ -116,6 +126,7 @@ rec {
};
in
default
// example
// description
// {
anyOf = [
@ -128,63 +139,86 @@ rec {
option.type.name == "bool"
# return jsonschema property definition for bool
then
default // description // { type = "boolean"; }
default // example // description // { type = "boolean"; }
# parse float
else if
option.type.name == "float"
# return jsonschema property definition for float
then
default // description // { type = "number"; }
default // example // description // { type = "number"; }
# parse int
else if
(option.type.name == "int" || option.type.name == "positiveInt")
# return jsonschema property definition for int
then
default // description // { type = "integer"; }
default // example // description // { type = "integer"; }
# TODO: Add support for intMatching in jsonschema
# parse port type aka. "unsignedInt16"
else if
option.type.name == "unsignedInt16"
|| option.type.name == "unsignedInt"
|| option.type.name == "pkcs11"
|| option.type.name == "intBetween"
then
default // example // description // { type = "integer"; }
# parse string
# TODO: parse more precise string types
else if
option.type.name == "str"
|| option.type.name == "singleLineStr"
|| option.type.name == "passwdEntry str"
|| option.type.name == "passwdEntry path"
# return jsonschema property definition for string
then
default // description // { type = "string"; }
default // example // description // { type = "string"; }
# TODO: Add support for stringMatching in jsonschema
# parse stringMatching
else if lib.strings.hasPrefix "strMatching" option.type.name then
default // example // description // { type = "string"; }
# TODO: Add support for separatedString in jsonschema
else if lib.strings.hasPrefix "separatedString" option.type.name then
default // example // description // { type = "string"; }
# parse string
else if
option.type.name == "path"
# return jsonschema property definition for path
then
default // description // { type = "string"; }
default // example // description // { type = "string"; }
# parse anything
else if
option.type.name == "anything"
# return jsonschema property definition for anything
then
default // description // { type = allBasicTypes; }
default // example // description // { type = allBasicTypes; }
# parse unspecified
else if
option.type.name == "unspecified"
# return jsonschema property definition for unspecified
then
default // description // { type = allBasicTypes; }
default // example // description // { type = allBasicTypes; }
# parse raw
else if
option.type.name == "raw"
# return jsonschema property definition for raw
then
default // description // { type = allBasicTypes; }
default // example // description // { type = allBasicTypes; }
# parse enum
else if
option.type.name == "enum"
# return jsonschema property definition for enum
then
default // description // { enum = option.type.functor.payload; }
default // example // description // { enum = option.type.functor.payload; }
# parse listOf submodule
else if
@ -192,6 +226,7 @@ rec {
# return jsonschema property definition for listOf submodule
then
default
// example
// description
// {
type = "array";
@ -211,6 +246,7 @@ rec {
};
in
default
// example
// description
// {
type = "array";
@ -222,7 +258,7 @@ rec {
(option.type.name == "listOf") && (option.type.functor.wrapped.name == "unspecified")
# return jsonschema property definition for list
then
default // description // { type = "array"; }
default // example // description // { type = "array"; }
# parse attrsOf submodule
else if
@ -230,6 +266,7 @@ rec {
# return jsonschema property definition for attrsOf submodule
then
default
// example
// description
// {
type = "object";
@ -242,6 +279,7 @@ rec {
# return jsonschema property definition for attrs
then
default
// example
// description
// {
type = "object";
@ -262,6 +300,7 @@ rec {
};
in
default
// example
// description
// {
type = "object";

View File

@ -10,5 +10,11 @@
},
"services": {
"opt": "this option doesn't make sense"
},
"destinations": {
"test-backup": {
"name": "John Doe",
"repo": "test-backup"
}
}
}

View File

@ -50,5 +50,26 @@
];
description = "A list of enabled kernel modules";
};
destinations = lib.mkOption {
type = lib.types.attrsOf (
lib.types.submodule (
{ name, ... }:
{
options = {
name = lib.mkOption {
type = lib.types.strMatching "^[a-zA-Z0-9._-]+$";
default = name;
description = "the name of the backup job";
};
repo = lib.mkOption {
type = lib.types.str;
description = "the borgbackup repository to backup to";
};
};
}
)
);
default = { };
};
};
}

View File

@ -45,6 +45,27 @@
"description": "A submodule option"
}
}
},
"destinations": {
"additionalProperties": {
"properties": {
"name": {
"default": "name",
"description": "the name of the backup job",
"type": "string"
},
"repo": {
"description": "the borgbackup repository to backup to",
"type": "string"
}
},
"required": [
"repo"
],
"type": "object"
},
"default": {},
"type": "object"
}
}
}

Some files were not shown because too many files have changed in this diff Show More