Compare commits

..

768 Commits

Author SHA1 Message Date
DavHau
af692321f1 vars: add test for deployment 2024-08-04 15:33:16 +07:00
clan-bot
1397beb95e Merge pull request 'clan-cli/vms: add option --publish to forward ports from host to guest' (#1847) from DavHau/clan-core:DavHau-vars into main 2024-08-04 08:32:02 +00:00
DavHau
9381d78feb clan-cli/vms: add option --publish to forward ports from host to guest 2024-08-04 15:28:51 +07:00
clan-bot
0fdfbf99e6 Merge pull request 'tests: improve testing framework for impure vm tests' (#1846) from DavHau/clan-core:DavHau-vars into main 2024-08-04 06:43:44 +00:00
DavHau
b2646aa0fe tests: improve testing framework for impure vm tests
Also fix computet sops secret paths for vars
2024-08-04 13:40:12 +07:00
clan-bot
b93aa1896e Merge pull request 'build-clan: fix specialArgs not passed' (#1845) from DavHau/clan-core:DavHau-dave into main 2024-08-04 06:10:37 +00:00
DavHau
d7475bef37 build-clan: fix specialArgs not passed 2024-08-04 13:06:51 +07:00
clan-bot
a9f0e90d12 Merge pull request 'devshell: remove dependency on clan-cli' (#1844) from DavHau/clan-core:DavHau-vars into main 2024-08-03 15:42:27 +00:00
DavHau
c5b8948509 devshell: remove dependency on clan-cli
This stops the devshell from being re-built constantly, when the source code changes.

Based on a new feature in treefmt-nix: https://github.com/numtide/treefmt-nix/pull/208
2024-08-03 22:37:03 +07:00
clan-bot
337a2ea883 Merge pull request 'Add build-clan module' (#1843) from hsjobeki/clan-core:hsjobeki-flake-parts into main 2024-08-03 11:38:18 +00:00
Johannes Kirschbauer
15ba9b8bfb Fix: type test 2024-08-03 13:14:08 +02:00
Johannes Kirschbauer
91397adbfc Fix: regression list_machines. Split into multiple functions
list_inventory_machines, list_nixos_machine, list_sops_machines
The caller of the function should specify which machines they wants to see
2024-08-03 12:43:35 +02:00
Johannes Kirschbauer
79e15bff24 Add: legacy support for implicitly creating machines through creating a directory
This will be deprecated as soon as the tests dont rely on this behavior anymore
2024-08-03 12:05:09 +02:00
Johannes Kirschbauer
5d12154f96 Forward clan name for vm test compatibility 2024-08-03 12:05:09 +02:00
Johannes Kirschbauer
ac6b7f84e0 Fix wrong unit tests 2024-08-03 12:05:09 +02:00
Johannes Kirschbauer
ef58bea020 Fix wrong default for imports 2024-08-03 12:05:09 +02:00
Johannes Kirschbauer
d51508656f Add flake-parts module 2024-08-03 12:05:09 +02:00
Johannes Kirschbauer
8fd09b8403 Add build-clan module 2024-08-03 12:05:09 +02:00
clan-bot
f6daaf79a7 Merge pull request 'vars: simplify tests' (#1842) from DavHau/clan-core:DavHau-vars into main 2024-08-03 08:51:39 +00:00
DavHau
d3542cf1c8 vars: simplify tests 2024-08-03 15:47:35 +07:00
clan-bot
844c219348 Merge pull request 'vars: introduce share flag' (#1841) from DavHau/clan-core:DavHau-vars into main 2024-08-03 08:33:38 +00:00
DavHau
8086f70b79 clan-cli/tests: improve test helpers for VMs 2024-08-03 15:26:53 +07:00
DavHau
cc9c828598 vars: introduce share flag 2024-08-03 15:26:53 +07:00
clan-bot
a40ddd2b24 Merge pull request 'clan-app: Finish flash view. clan-cli: Flash cli now verifies if language and keymap are valid. formatter.nix: Add deno as formatter' (#1839) from Qubasa/clan-core:Qubasa-Qubasa-main into main 2024-08-02 17:02:32 +00:00
Qubasa
58a36a5c12 formatter.nix: Add prettier 2024-08-02 18:56:53 +02:00
Qubasa
f1d124dabd clan-app: Finish flash view. clan-cli: Flash cli now verifies if language and keymap are valid. 2024-08-02 17:51:45 +02:00
kenji
e2bdf22f78 Merge pull request 'formatter: remove broken vale configuration' (#1835) from kenji/clan-core:clan/rm-broken-vale into main
Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/1835
Reviewed-by: Luis Hebendanz <consulting@qube.email>
2024-07-31 17:04:54 +00:00
a-kenji
c7c6012bcc formatter: remove broken vale configuration
Removes the broken and uncommented value configuration for vale.

While vale can be a valuable tool, we need a working configuration if we
want to use it. Keeping a broken configuration on main is not a
sustainable model.

We can fix it and reintroduce it cleanly at a later stage.
2024-07-31 18:42:16 +02:00
Mic92
b3af929490 Merge pull request 'clan: remove config subcommand' (#1828) from kenji/clan-core:clan/remove-config into main
Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/1828
2024-07-31 16:35:36 +00:00
a-kenji
a465ad8638 clan: remove config subcommand
This removes the `config` subcommand from the cli and the documentation
to keep the api surface small.

While this functionality was convenient it doesn't need to be surfaced
by the clan cli.

The remaining `config` python module should be ported to the `clan-app`
in a follow up pr. Because the functionality is currently only used by
the `clan-app`.
Ideally together with: #1830.
2024-07-31 16:35:36 +00:00
clan-bot
26edcb8562 Merge pull request 'Deserializer: add Literal; Annotated fields' (#1833) from hsjobeki/clan-core:hsjobeki-main into main 2024-07-31 11:06:48 +00:00
Johannes Kirschbauer
6c5f9ca6db Deserializer: add Literal; Annotated fields 2024-07-31 13:00:28 +02:00
clan-bot
0894ee95c8 Merge pull request 'Deserializer: replace pydantic' (#1826) from hsjobeki/clan-core:hsjobeki-main into main 2024-07-30 12:36:08 +00:00
kenji
350d565ddd Merge pull request 'clan: remove flatpak check' (#1831) from kenji/clan-core:clan/rm-flatpak into main
Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/1831
2024-07-30 12:34:19 +00:00
Johannes Kirschbauer
4b2d1b7923 Deserializer: add Nullable fields 2024-07-30 14:26:13 +02:00
a-kenji
acb5560de8 clan: remove flatpak check
This check logs, if the cli is started inside a flatpak environment.
2024-07-30 14:21:15 +02:00
kenji
2d4cd0c9be Merge pull request 'merge-after-ci: use nix fmt' (#1823) from kenji/clan-core:feat/merge-after-ci into main
Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/1823
2024-07-30 11:43:40 +00:00
a-kenji
d360cf86cb merge-after-ci: use nix fmt
Use `nix fmt` instead of `treefmt` directly, since `treefmt` depends on
the cached devshell. This can lead to confusing errors.
2024-07-30 11:43:40 +00:00
kenji
f11ddf92e9 Merge pull request 'checks/mumble: improve dependency closure' (#1827) from kenji/clan-core:mumble-improve-closure into main
Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/1827
2024-07-30 11:40:13 +00:00
a-kenji
9f6f754606 checks/mumble: improve dependency closure 2024-07-30 13:11:50 +02:00
kenji
03f87b24d3 Merge pull request 'clan/secrets: improve naming of secret key' (#1825) from kenji/clan-core:kenji-cli-change-wording into main
Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/1825
Reviewed-by: Mic92 <joerg@thalheim.io>
2024-07-30 10:58:45 +00:00
a-kenji
ccdfd0c6fc clan/secrets: improve naming of secret key
Change the secret key help wording to: `secret-name`,
to convey that it is the key and not the value.

Fixes: #1696
2024-07-30 12:54:22 +02:00
Johannes Kirschbauer
e21bfbc257 Deserializer: replace pydantic 2024-07-30 12:26:16 +02:00
kenji
f3c909b563 Merge pull request 'gitignore: add .nixos-test-history' (#1822) from kenji/clan-core:kenji-git/add-nixos-test into main
Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/1822
2024-07-30 09:27:30 +00:00
a-kenji
b357b545d3 gitignore: add .nixos-test-history
Add the artifacts created by nixos tests to gitignore.
2024-07-30 09:27:30 +00:00
kenji
915b2fbe73 Merge pull request 'mumble: init clan-module' (#1821) from kenji/clan-core:init/mumble-module into main
Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/1821
2024-07-30 09:21:00 +00:00
a-kenji
13c70168a4 mumble: init clan-module
This adds the `mumble` clan-module.

This allows for voice chatting in a true peer-to-peer network.
Every machine that has the module enabled is a potential host and
client - every participant has the same role.

It doesn't matter who in the network is online - as long as one of the
machines is up, one server is up and people can start their voice chat.
2024-07-30 10:55:08 +02:00
Mic92
99a87a6120 Merge pull request 'better visual seperation between flake/non-flake version' (#1817) from facter into main
Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/1817
2024-07-29 15:56:51 +00:00
Jörg Thalheim
c037ec2eeb better visual seperation between flake/non-flake version 2024-07-29 15:56:51 +00:00
Mic92
65c03ecf96 Merge pull request 'blog: grammar fixes for introducing nixos-facter' (#1820) from brianmcgee/clan-core:fix/blog-nixos-facter-grammmer into main
Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/1820
2024-07-29 15:56:37 +00:00
Brian McGee
d04d5b2c3b blog: grammar fixes for introducing nixos-facter 2024-07-29 16:51:00 +01:00
clan-bot
ded91c308a Merge pull request 'clan-vm-manager: Fix regression' (#1818) from Qubasa/clan-core:Qubasa-main into main 2024-07-29 15:37:02 +00:00
Qubasa
0dcc9f903b clan-vm-manager: Fix regression 2024-07-29 17:33:46 +02:00
clan-bot
35e5ad513d Merge pull request 'Clan-app: edit clan, memoize active clan' (#1819) from hsjobeki/clan-core:hsjobeki-main into main 2024-07-29 15:10:00 +00:00
Johannes Kirschbauer
6a13cb80cb Clan-app: edit clan, memoize active clan 2024-07-29 17:06:11 +02:00
clan-bot
d80488f786 Merge pull request 'nixos-facter: smaller fixes' (#1816) from facter into main 2024-07-29 13:59:51 +00:00
Jörg Thalheim
2f07e47926 nixos-facter: smaller fixes 2024-07-29 15:53:50 +02:00
Mic92
034593f742 Merge pull request 'blog: introducing nixos-facter' (#1786) from brianmcgee/clan-core:blog/nixos-facter into main
Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/1786
2024-07-29 13:47:00 +00:00
Jörg Thalheim
2f9945bec5 disko fixup 2024-07-29 15:43:07 +02:00
Brian McGee
94f65d3118 blog: introducing nixos-facter 2024-07-29 13:24:37 +00:00
DavHau
2155675fc6 vars: fix bug when computing taarget path for sops 2024-07-29 12:09:59 +00:00
clan-bot
3da42e698b Merge pull request 'shell.nix: remove dependency in shell.nix on webui' (#1815) from Qubasa/clan-core:Qubasa-main into main 2024-07-29 12:07:27 +00:00
Qubasa
21f7a3c269 shell.nix: remove dependency in shell.nix on webui 2024-07-29 13:52:11 +02:00
clan-bot
aaa8411d89 Merge pull request 'vars/sops: fix loading of vars from directory structure' (#1813) from DavHau/clan-core:DavHau-vars into main 2024-07-29 11:05:29 +00:00
DavHau
a5065a1936 vars/sops: fix loading of vars from directory structure 2024-07-29 18:01:26 +07:00
clan-bot
7b053abb13 Merge pull request 'Clan-app: example disk view' (#1812) from hsjobeki/clan-core:hsjobeki-main into main 2024-07-29 09:55:21 +00:00
Johannes Kirschbauer
d11e725a80 Clan-app: example disk view 2024-07-29 11:49:55 +02:00
clan-bot
5223506e29 Merge pull request 'Serializer: use alias, make it configurable for different use cases' (#1811) from hsjobeki/clan-core:hsjobeki-main into main 2024-07-29 07:04:44 +00:00
Johannes Kirschbauer
3e5ceb0eeb Serializer: use alias, make it configurable for different use cases 2024-07-29 09:01:06 +02:00
clan-bot
a958532766 Merge pull request 'Serde: add unit tests for all serialization and deserialization logic' (#1809) from hsjobeki/clan-core:hsjobeki-main into main 2024-07-26 13:27:00 +00:00
Johannes Kirschbauer
b015f1f123 PropagatedBuild inputs workaround 2024-07-26 15:23:25 +02:00
Johannes Kirschbauer
c648e647bf Serde: add unit tests for all serialization and deserialization logic 2024-07-26 14:23:41 +02:00
clan-bot
2b6a5f8385 Merge pull request 'Clan-app: add dependencies; floating-ui; eslint-query' (#1808) from hsjobeki/clan-core:hsjobeki-main into main 2024-07-25 12:29:16 +00:00
Johannes Kirschbauer
53d7c2507e Clan-app: add popover - remove clan confirm 2024-07-25 13:11:50 +02:00
Johannes Kirschbauer
7783f17425 Clan-app: add dependencies; floating-ui; eslint-query 2024-07-25 13:09:18 +02:00
clan-bot
8dc02474fc Merge pull request 'Update documentation' (#1807) from joerg-ci into main 2024-07-24 18:36:15 +00:00
Jörg Thalheim
16e87c52e9 docs/setup: recommends nixos configuration for nixos users 2024-07-24 20:28:50 +02:00
Jörg Thalheim
5e16de17a3 docs/setup: also mention experimental option in case someone already has nix installed 2024-07-24 20:28:46 +02:00
Jörg Thalheim
eded0a62b0 CONTRIBUTING: mention browser 2024-07-24 20:28:35 +02:00
clan-bot
777962003f Merge pull request 'fix error message when removing secrets' (#1806) from Mic92-main into main 2024-07-24 18:27:19 +00:00
Jörg Thalheim
3583c25c67 fix error message when removing secrets 2024-07-24 20:21:10 +02:00
clan-bot
2532e93667 Merge pull request 'remove 'Extra config:' warning' (#1805) from Mic92-main into main 2024-07-24 18:10:50 +00:00
Jörg Thalheim
a6f4d6fbf0 remove 'Extra config:' warning 2024-07-24 20:04:31 +02:00
clan-bot
6a8bb1be8d Merge pull request 'Clan-app: devshell add schemas for gtk4; gsettings' (#1803) from hsjobeki/clan-core:hsjobeki-main into main 2024-07-24 16:31:47 +00:00
Johannes Kirschbauer
fe10c5fbd6 Clan-app: show clan details for each registered clan 2024-07-24 18:26:26 +02:00
Johannes Kirschbauer
ef973ff475 Clan-app: devshell add schemas for gtk4; gsettings 2024-07-24 18:26:26 +02:00
clan-bot
eeb35a26db Merge pull request 'vars/sops: store secrets in /sops/vars' (#1802) from DavHau/clan-core:DavHau-vars into main 2024-07-24 11:48:31 +00:00
DavHau
9996f5596c vars/sops: store secrets in /sops/vars 2024-07-24 18:42:50 +07:00
clan-bot
8020010fcf Merge pull request 'Inventory improvements' (#1795) from hsjobeki/clan-core:hsjobeki-main into main 2024-07-24 11:23:16 +00:00
clan-bot
122ce665ed Merge pull request 'sops/refactor: lay groundwork for secrets with arbitrary paths' (#1801) from DavHau/clan-core:DavHau-vars into main 2024-07-24 11:16:01 +00:00
Johannes Kirschbauer
1d51ae5c85 Fix unit tests 2024-07-24 13:15:08 +02:00
DavHau
ac5d421f84 sops/refactor: lay groundwork for secrets with arbitrary paths 2024-07-24 18:12:19 +07:00
clan-bot
63970defc0 Merge pull request 'secrets: refactor parameter naming' (#1800) from DavHau/clan-core:DavHau-vars into main 2024-07-24 10:55:42 +00:00
DavHau
0222ebf482 secrets: refactor parameter naming 2024-07-24 17:50:03 +07:00
clan-bot
7a8d458581 Merge pull request 'flake.nix: remove unnecessary newline' (#1799) from DavHau/clan-core:DavHau-vars into main 2024-07-24 10:41:13 +00:00
DavHau
14b88fe695 flake.nix: remove unnecessary newline 2024-07-24 17:35:55 +07:00
clan-bot
794285aa77 Merge pull request 'tests/generate_flake: support inventory argument' (#1798) from DavHau/clan-core:DavHau-vars into main 2024-07-24 10:10:03 +00:00
DavHau
bf5cc8c215 tests/generate_flake: support inventory argument 2024-07-24 17:06:42 +07:00
clan-bot
4d25118853 Merge pull request 'Add clan.borgbackup.exclude.' (#1790) from inventory-fixes into main 2024-07-24 08:40:54 +00:00
Johannes Kirschbauer
c8407e2052 Python Inventory classes: Auto-update 2024-07-24 10:37:19 +02:00
Johannes Kirschbauer
5b4105b4d8 Fix minimal template 2024-07-24 10:34:11 +02:00
Johannes Kirschbauer
d38983c784 Create machine: init view with api 2024-07-24 10:34:11 +02:00
Johannes Kirschbauer
f787acdaa4 CLI: fix flakeId url interpretation 2024-07-24 10:34:11 +02:00
Johannes Kirschbauer
580cc12671 cli: Disable pre-commit hooks for cli commands 2024-07-24 10:34:10 +02:00
Johannes Kirschbauer
679fd914e0 Inventory: add load_eval method 2024-07-24 10:34:10 +02:00
Johannes Kirschbauer
c6466f070e Fix: hostPlatform not hostSystem 2024-07-24 10:34:10 +02:00
clan-bot
a294c6d454 Merge pull request 'clan-vm-manager, clan-app: Make executable icon work in process overview' (#1797) from Qubasa/clan-core:Qubasa-main into main 2024-07-23 12:15:51 +00:00
Qubasa
4193d9e9a9 clan-vm-manager, clan-app: Make executable icon work in process overview 2024-07-23 14:12:45 +02:00
clan-bot
bb9da50d45 Merge pull request 'clan-vm-manager: Fix waypipe regression in nix code' (#1793) from Qubasa/clan-core:Qubasa-main into main 2024-07-23 11:24:05 +00:00
clan-bot
b1af97f2a5 Merge pull request 'clan-cli/secrets: refactor: rename secret -> secret_path' (#1796) from DavHau/clan-core:DavHau-vars into main 2024-07-23 11:24:05 +00:00
Qubasa
c6a0cd9398 clan-vm-manager: Fix waypipe regression in nix code 2024-07-23 13:20:02 +02:00
DavHau
00f7a6300b clan-cli/secrets: refactor: rename secret -> secret_path 2024-07-23 18:18:32 +07:00
clan-bot
aec1238f20 Merge pull request 'vars: add support for password-store' (#1794) from DavHau/clan-core:DavHau-vars into main 2024-07-23 07:59:50 +00:00
DavHau
5bd20fcf2c vars: add support for password-store 2024-07-23 14:54:18 +07:00
clan-bot
9127dc3358 Merge pull request 'vars: implement prompts' (#1792) from DavHau/clan-core:DavHau-vars into main 2024-07-22 13:46:39 +00:00
DavHau
9ff076aec1 vars: implement prompts 2024-07-22 20:40:12 +07:00
clan-bot
72019d6bcb Merge pull request 'Automatic flake update - 2024-07-22T00:00+00:00' (#1791) from flake-update-2024-07-22 into main 2024-07-22 00:06:51 +00:00
Clan Merge Bot
249a18a734 update flake lock - 2024-07-22T00:00+00:00
Flake lock file updates:

• Updated input 'disko':
    'github:nix-community/disko/786965e1b1ed3fd2018d78399984f461e2a44689' (2024-07-11)
  → 'github:nix-community/disko/bec6e3cde912b8acb915fecdc509eda7c973fb42' (2024-07-19)
• Updated input 'nixos-images':
    'github:nix-community/nixos-images/5eddae0afbcfd4283af5d6676d08ad059ca04b70' (2024-07-11)
  → 'github:nix-community/nixos-images/accee005735844d57b411d9969c5d0aabc6a55f6' (2024-07-21)
• Updated input 'nixpkgs':
    'github:NixOS/nixpkgs/0af9d835c27984b3265145f8e3cbc6c153479196' (2024-07-14)
  → 'github:NixOS/nixpkgs/4cc8b29327bed3d52b40041f810f49734298af46' (2024-07-21)
• Updated input 'sops-nix':
    'github:Mic92/sops-nix/0703ba03fd9c1665f8ab68cc3487302475164617' (2024-07-14)
  → 'github:Mic92/sops-nix/909e8cfb60d83321d85c8d17209d733658a21c95' (2024-07-21)
• Updated input 'treefmt-nix':
    'github:numtide/treefmt-nix/b92afa1501ac73f1d745526adc4f89b527595f14' (2024-07-14)
  → 'github:numtide/treefmt-nix/888bfb10a9b091d9ed2f5f8064de8d488f7b7c97' (2024-07-20)
2024-07-22 00:00:22 +00:00
Jörg Thalheim
00bad3d614 borgbackup: add exclude option 2024-07-21 19:08:26 +02:00
Jörg Thalheim
ed5dd02879 also fix user-password with password-store 2024-07-21 18:21:37 +02:00
clan-bot
6c7e9bafea Merge pull request 'root-password: fix password-store support' (#1789) from inventory-fixes into main 2024-07-21 16:14:47 +00:00
Jörg Thalheim
a1a36606e4 cleanup deprecated facts options 2024-07-21 18:11:30 +02:00
Jörg Thalheim
3d12aabf0c test_flake_with_core_and_pass: don't use deprecated options 2024-07-21 18:03:51 +02:00
Jörg Thalheim
e79e199c9a root-password: fix password-store support 2024-07-21 17:59:11 +02:00
clan-bot
1db0321163 Merge pull request 'Clan create fixes' (#1788) from inventory-fixes into main 2024-07-21 15:05:13 +00:00
Jörg Thalheim
d356a63d6c improve lsblk instructions 2024-07-21 16:39:01 +02:00
Jörg Thalheim
824c5d3f80 flake/create: fix "directory does not exist" error 2024-07-21 16:00:35 +02:00
Jörg Thalheim
563ead4652 only set git author / email when no one is set globally 2024-07-21 16:00:35 +02:00
Jörg Thalheim
79a6ad2715 drop binary cache from flake
This generates warnings for users of the CLI and confuses them.
In our CI systems we can just provide our binary cache.
2024-07-21 15:27:31 +02:00
Jörg Thalheim
2516f38c37 remove deprecated adwaita-icon-theme 2024-07-21 15:26:37 +02:00
clan-bot
f3c9c379e6 Merge pull request 'Reapply "clan.core: rename clan.{deployment,networking} -> clan.core.{deployment,networking}"' (#1787) from Qubasa/clan-core:Qubasa-main into main 2024-07-19 20:23:25 +00:00
Qubasa
3546586dde fixup! fixup! fixup! clan-vm-manager: Restore to known good version 2024-07-19 22:20:12 +02:00
Qubasa
aa792fedfd fixup! fixup! clan-vm-manager: Restore to known good version 2024-07-19 22:12:29 +02:00
Qubasa
f1182af5a1 fixup! clan-vm-manager: Restore to known good version 2024-07-19 22:12:17 +02:00
Qubasa
728f8f5758 clan-vm-manager: Restore to known good version 2024-07-19 22:07:34 +02:00
DavHau
1cb69cb5fc Reapply "clan.core: rename clan.{deployment,networking} -> clan.core.{deployment,networking}"
This reverts commit 9778444706.

workaround upstream bug: https://github.com/NixOS/nixpkgs/issues/324802
2024-07-19 22:07:34 +02:00
clan-bot
f66b809866 Merge pull request 'Classgen: refactor functions' (#1785) from hsjobeki/clan-core:hsjobeki-main into main 2024-07-19 16:52:37 +00:00
Johannes Kirschbauer
6d441a1494 Classgen: make type order predictable 2024-07-19 18:49:16 +02:00
Johannes Kirschbauer
5c18f67fed Classgen: refactor functions 2024-07-19 18:20:22 +02:00
clan-bot
a7e3fd431d Merge pull request 'Classgen: add error reporting and combine common classes' (#1784) from hsjobeki/clan-core:hsjobeki-main into main 2024-07-19 11:07:06 +00:00
Johannes Kirschbauer
3435db68c8 Classgen: add error reporting and combine common classes 2024-07-19 13:03:38 +02:00
clan-bot
f00ddcad10 Merge pull request 'Docs: explain inventory imports' (#1783) from hsjobeki/clan-core:hsjobeki-rearrange-docs-front into main 2024-07-19 09:29:59 +00:00
Johannes Kirschbauer
988ed9dccd Docs: explain inventory imports 2024-07-19 11:26:34 +02:00
clan-bot
aab6a45cda Merge pull request 'Docs: remove generated inventory.md from git index' (#1782) from hsjobeki/clan-core:hsjobeki-rearrange-docs-front into main 2024-07-19 09:20:32 +00:00
Johannes Kirschbauer
afa0984b57 Docs: remove generated inventory.md from git index 2024-07-19 11:17:08 +02:00
clan-bot
ee65d3918b Merge pull request 'docs: add reference index pages' (#1781) from hsjobeki/clan-core:rearrange-docs-front into main 2024-07-19 09:11:33 +00:00
Johannes Kirschbauer
67b76c8ced Docs: generate api docs for inventory 2024-07-19 11:07:47 +02:00
Valentin Gagarin
13b8b949f9 docs: add reference index pages
- add index pages for each reference documentation category
- move concepts pages into the reference hierarchy
- render clanModules overview page in the style of the CLI overview
2024-07-19 10:27:04 +02:00
clan-bot
3a3f8e0756 Merge pull request 'Init: Autogenerate classes from nix interfaces' (#1778) from hsjobeki/clan-core:hsjobeki-main into main 2024-07-19 07:58:57 +00:00
Johannes Kirschbauer
6d49f5c926 Commit generated code otherwise CI cannot check types 2024-07-19 09:52:14 +02:00
Johannes Kirschbauer
c92ee71d42 Jsonschema: fix tests 2024-07-18 22:04:11 +02:00
Johannes Kirschbauer
07965598f5 Classgen: add mapped keys and more stuff 2024-07-18 21:58:36 +02:00
Johannes Kirschbauer
7e84eaa4b3 Init: Autogenerate classes from nix interfaces 2024-07-18 19:14:12 +02:00
clan-bot
fd0ebc7ec0 Merge pull request 'clan: Fix treefmt not applying mypy lints on clan_cli and clan_app' (#1777) from Qubasa/clan-core:Qubasa-main into main 2024-07-17 19:54:20 +00:00
Qubasa
8ad7c2b89a clan: Fix treefmt not applying mypy lints on clan_cli and clan_app 2024-07-17 21:50:52 +02:00
clan-bot
75f34bdf50 Merge pull request 'tea-create-pr: disable treefmt cache' (#1776) from Qubasa/clan-core:Qubasa-main into main 2024-07-17 16:30:45 +00:00
Qubasa
2018a79fc2 tea-create-pr: disable treefmt cache 2024-07-17 18:27:29 +02:00
clan-bot
76cad49446 Merge pull request 'borgbackup/server: warning if a machine does not have a secret generated yet.' (#1775) from inventory-fixes into main 2024-07-17 14:03:10 +00:00
Jörg Thalheim
d51bf05821 borgbackup/server: warning if a machine does not have a secret generated yet. 2024-07-17 16:00:07 +02:00
Mic92
5814e9790f Merge pull request 'Revert "clan-cli: deprecate nix_shell() in favor of run_cmd()"' (#1774) from fix-deployment into main
Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/1774
2024-07-17 12:31:48 +00:00
Jörg Thalheim
0d6e2539e3 Revert "clan-cli: deprecate nix_shell() in favor of run_cmd()"
This reverts commit 37e6ca7a30.
2024-07-17 14:04:49 +02:00
clan-bot
55fc9dd00d Merge pull request 'clan-app: Improve install-desktop.sh and add new desktop icons' (#1773) from Qubasa/clan-core:Qubasa-main into main 2024-07-17 11:27:59 +00:00
clan-bot
47833067e5 Merge pull request 'Init: classgenerator' (#1772) from hsjobeki/clan-core:hsjobeki-main into main 2024-07-17 11:24:50 +00:00
Qubasa
8f74a2d1de clan-app: Improve install-desktop.sh and add new desktop icons 2024-07-17 13:24:44 +02:00
Johannes Kirschbauer
3706b6b80c Fix: api 2024-07-17 13:21:43 +02:00
Johannes Kirschbauer
9c61182bc9 Init: classgenerator 2024-07-17 13:21:43 +02:00
clan-bot
f317495e80 Merge pull request 'Inventory: init: deployment info for machines' (#1767) from hsjobeki/clan-core:hsjobeki-main into main 2024-07-17 10:18:50 +00:00
Johannes Kirschbauer
69874a2405 Fix eval tests 2024-07-17 12:12:42 +02:00
Johannes Kirschbauer
076a5cad89 Unit tests: fix template test - override the input in the flake template 2024-07-17 12:06:23 +02:00
clan-bot
af04e513a0 Merge pull request 'vars: implement dependencies' (#1771) from DavHau/clan-core:DavHau-vars into main 2024-07-17 09:45:41 +00:00
DavHau
117843021e vars: implement dependencies 2024-07-17 16:42:16 +07:00
Johannes Kirschbauer
24b3674983 Inventory: fix dataclasses discrepancy once more 2024-07-17 11:39:18 +02:00
Johannes Kirschbauer
0bfba72739 Inventory: fix options 2024-07-17 10:55:46 +02:00
Johannes Kirschbauer
ef18d60286 Inventory: extend python dataclasses by schema changes 2024-07-17 10:09:58 +02:00
Johannes Kirschbauer
7e21428548 Inventory: extend model by deployment info 2024-07-17 10:09:58 +02:00
Johannes Kirschbauer
ac95878ead Inventory: init: deployment info for machines 2024-07-17 10:07:57 +02:00
clan-bot
2947f64f3a Merge pull request 'clan-app: Add automatic debug console in debug mode' (#1770) from Qubasa/clan-core:Qubasa-main into main 2024-07-16 19:04:40 +00:00
Qubasa
dfb1f18e2d clan-app: Add automatic debug console in debug mode 2024-07-16 21:01:35 +02:00
clan-bot
7e97141687 Merge pull request 'clan-app: Add threaded api execution by default' (#1769) from Qubasa/clan-core:Qubasa-main into main 2024-07-16 18:48:06 +00:00
Qubasa
bfe952d910 clan-app: Add threaded api execution by default 2024-07-16 20:44:48 +02:00
clan-bot
fa4e083352 Merge pull request 'clan-app: WebExecutor now mirrors jsonschema api types generically' (#1768) from Qubasa/clan-core:Qubasa-main into main 2024-07-16 14:38:17 +00:00
Qubasa
ccece77680 clan-app: WebExecutor now mirrors jsonschema api types generically 2024-07-16 16:34:59 +02:00
clan-bot
be4f90eca1 Merge pull request 'cli: add programms to allowed list' (#1765) from hsjobeki/clan-core:hsjobeki-main into main 2024-07-16 11:52:56 +00:00
Johannes Kirschbauer
54dcbfae01 cli: add programms to allowed list 2024-07-16 13:49:16 +02:00
clan-bot
14bb11d702 Merge pull request 'vars: add test for multiple machines' (#1763) from DavHau/clan-core:DavHau-vars into main 2024-07-16 11:38:31 +00:00
DavHau
d700f651b4 vars: add test for multiple machines 2024-07-16 18:35:13 +07:00
clan-bot
91c2ad8974 Merge pull request 'clan-app: Improve method_name argument' (#1764) from Qubasa/clan-core:Qubasa-main into main 2024-07-16 10:24:04 +00:00
Qubasa
c115e9b0db clan-app: Improve method_name argument 2024-07-16 12:16:52 +02:00
clan-bot
8a092cfed4 Merge pull request 'API: async signal integration migration' (#1762) from hsjobeki/clan-core:hsjobeki-main into main 2024-07-16 09:37:25 +00:00
Johannes Kirschbauer
cc238ecc60 API: async signal integration migration 2024-07-16 11:28:20 +02:00
clan-bot
08cd44ea03 Merge pull request 'Inventory: add global imports' (#1749) from inventory-config into main 2024-07-16 08:45:00 +00:00
Johannes Kirschbauer
a2c3c09564 Inventory: migrate failure test message 2024-07-16 10:33:24 +02:00
clan-bot
645bd98c3a Merge pull request 'clan-cli: deprecate nix_shell() in favor of run_cmd()' (#1760) from DavHau/clan-core:DavHau-vars into main 2024-07-16 07:06:34 +00:00
DavHau
37e6ca7a30 clan-cli: deprecate nix_shell() in favor of run_cmd() 2024-07-16 14:03:17 +07:00
clan-bot
c9de01b9d0 Merge pull request 'impure-checks: improve performance by disabling dynamic deps' (#1736) from DavHau/clan-core:DavHau-vars into main 2024-07-16 05:46:07 +00:00
DavHau
0e335f7ecc impure-checks: improve performance by disabling dynamic deps 2024-07-16 12:42:45 +07:00
clan-bot
495a7a4289 Merge pull request 'Webview: migrate create clan form to async api' (#1757) from hsjobeki/clan-core:hsjobeki-main into main 2024-07-15 18:44:32 +00:00
Jörg Thalheim
5c0b482431 wip: debug 2024-07-15 20:41:27 +02:00
Jörg Thalheim
7c83c89643 inventory: better error message if tags are not found 2024-07-15 20:41:27 +02:00
Jörg Thalheim
2eeab7f556 inventory: don't check if tag is used in inventory
this doesn't work with flake-parts
2024-07-15 20:41:27 +02:00
Jörg Thalheim
f8a7f0ecb1 vars: remove deprecated nixos options 2024-07-15 20:41:27 +02:00
Johannes Kirschbauer
7b18caca9b Inventory: fix tests 2024-07-15 20:41:27 +02:00
Johannes Kirschbauer
9afed2295d Inventory: add global imports 2024-07-15 20:41:27 +02:00
Johannes Kirschbauer
ce387482bb Webview: flash view 2024-07-15 20:40:29 +02:00
Johannes Kirschbauer
e4b11a6dc1 Webview: migrate create clan form to async api 2024-07-15 20:40:29 +02:00
clan-bot
c80e2538c4 Merge pull request 'Webview: add solid-query for improved resource fetching & caching' (#1755) from hsjobeki/clan-core:hsjobeki-main into main 2024-07-15 17:53:54 +00:00
clan-bot
4afad03fe9 Merge pull request 'clan-app: Remove vm-manager from codebase' (#1754) from Qubasa/clan-core:Qubasa-fix_clan_app into main 2024-07-15 17:52:14 +00:00
Qubasa
cd48b8df0c clan-app: Fix mypy lints and add GenericFnRuntime 2024-07-15 19:48:20 +02:00
Johannes Kirschbauer
729e893820 Webview: add solid-query for improved resource fetching & caching 2024-07-15 19:41:01 +02:00
Qubasa
25fea331d0 clan-app: Add Webview to python async backend 2024-07-15 19:24:38 +02:00
Qubasa
bb9058f5ef clan-app: Remove vm-manager from codebase 2024-07-15 19:24:38 +02:00
clan-bot
aa286e4e63 Merge pull request 'Inventory: only apply if settings.json exists' (#1753) from hsjobeki/clan-core:hsjobeki-main into main 2024-07-15 17:18:20 +00:00
Johannes Kirschbauer
914d50a1c5 Inventory: only apply if settings.json exists 2024-07-15 19:14:45 +02:00
clan-bot
a76221da33 Merge pull request 'flake-parts: expose inventory' (#1752) from flake-parts into main 2024-07-15 15:21:15 +00:00
Jörg Thalheim
fabea318d9 flake-parts: expose inventory 2024-07-15 17:17:14 +02:00
Mic92
094631350d Merge pull request 'flake-parts-template' (#1751) from flake-parts-template into main
Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/1751
2024-07-15 15:02:36 +00:00
Jörg Thalheim
beded7c21f add flake-parts template 2024-07-15 15:02:36 +00:00
clan-bot
3e3b9fbbb8 Merge pull request 'switch to nixfmt from nixpkgs-fmt' (#1750) from Mic92-flake-parts-template into main 2024-07-15 14:52:42 +00:00
Jörg Thalheim
a54dc76af1 switch to nixfmt from nixpkgs-fmt 2024-07-15 16:47:54 +02:00
clan-bot
ec38945c6d Merge pull request 'templates/new-clan: share disko configuration between machines' (#1748) from flake-parts-template into main 2024-07-15 14:43:28 +00:00
Jörg Thalheim
44330ddcff templates/new-clan: share disko configuration between machines 2024-07-15 16:39:23 +02:00
clan-bot
c0d0b01324 Merge pull request 'templates/new-clan: share disko configuration between machines' (#1747) from flake-parts-template into main 2024-07-15 14:21:52 +00:00
Jörg Thalheim
e8119880f3 templates/new-clan: share disko configuration between machines 2024-07-15 16:17:05 +02:00
Mic92
8bafa7e43d Merge pull request 'inventory-config' (#1746) from inventory-config into main
Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/1746
2024-07-15 14:16:39 +00:00
Johannes Kirschbauer
5a4a7e6694 Inventory: fix roles config 2024-07-15 15:59:59 +02:00
Jörg Thalheim
7e3881d618 inventory: allow per role configuration 2024-07-15 13:43:43 +02:00
Jörg Thalheim
0aac83b8c5 webview: restrict what links can be browsed 2024-07-15 12:54:49 +02:00
Jörg Thalheim
0bb5000f2a docs/clan-app: add missing npm install 2024-07-15 12:52:28 +02:00
clan-bot
82ec1f8d10 Merge pull request 'docs: fix flash example' (#1745) from joerg-ci into main 2024-07-15 09:57:10 +00:00
Jörg Thalheim
d4b0f3bed4 docs: fix flash example 2024-07-15 11:53:25 +02:00
Luis Hebendanz
f863be3412 Merge pull request 'docs: move blog to end of navigation' (#1744) from fricklerhandwerk/clan-core:move-blog-nav into main
Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/1744
2024-07-15 09:17:55 +00:00
Valentin Gagarin
11bb60fc80 docs: move blog to end of navigation
documentation users will be here primarily because of onboarding tutorials and
reference documentation.
2024-07-15 11:03:14 +02:00
clan-bot
a97960cb41 Merge pull request 'Automatic flake update - 2024-07-15T00:00+00:00' (#1742) from flake-update-2024-07-15 into main 2024-07-15 00:07:45 +00:00
Clan Merge Bot
191f435539 update flake lock - 2024-07-15T00:00+00:00
Flake lock file updates:

• Updated input 'disko':
    'github:nix-community/disko/64679cd7f318c9b6595902b47d4585b1d51d5f9e' (2024-07-04)
  → 'github:nix-community/disko/786965e1b1ed3fd2018d78399984f461e2a44689' (2024-07-11)
• Updated input 'nixos-images':
    'github:nix-community/nixos-images/f8650460d37d9d1820a93ebb7f0db5b6c3621946' (2024-07-04)
  → 'github:nix-community/nixos-images/5eddae0afbcfd4283af5d6676d08ad059ca04b70' (2024-07-11)
• Updated input 'nixpkgs':
    'github:NixOS/nixpkgs/60a94e515488e335bd5bce096431d490486915e3' (2024-07-07)
  → 'github:NixOS/nixpkgs/0af9d835c27984b3265145f8e3cbc6c153479196' (2024-07-14)
• Updated input 'sops-nix':
    'github:Mic92/sops-nix/c184aca4db5d71c3db0c8cbfcaaec337a5d065ea' (2024-07-07)
  → 'github:Mic92/sops-nix/0703ba03fd9c1665f8ab68cc3487302475164617' (2024-07-14)
• Updated input 'treefmt-nix':
    'github:numtide/treefmt-nix/6fc8bded78715cdd43a3278a14ded226eb3a239e' (2024-07-08)
  → 'github:numtide/treefmt-nix/b92afa1501ac73f1d745526adc4f89b527595f14' (2024-07-14)
2024-07-15 00:00:23 +00:00
clan-bot
898fa5579c Merge pull request 'Doc: write inventory documentation' (#1741) from hsjobeki/clan-core:hsjobeki-main into main 2024-07-14 14:46:12 +00:00
Johannes Kirschbauer
f2320e907f Doc: write inventory documentation 2024-07-14 16:42:27 +02:00
clan-bot
a1c74c4a10 Merge pull request 'Json-schema: extend interface by header to allow schema spec and arbitrary extensions' (#1740) from hsjobeki/clan-core:hsjobeki-main into main 2024-07-14 13:06:08 +00:00
Johannes Kirschbauer
ad321976ff Fix schema test 2024-07-14 15:02:32 +02:00
Johannes Kirschbauer
7bbe63a525 Fix schema test 2024-07-14 13:38:43 +02:00
Johannes Kirschbauer
6d1af2f6b3 Inventory: fix narrow pattern 2024-07-14 13:34:50 +02:00
Johannes Kirschbauer
425590ae12 Remove unneeded special args 2024-07-14 13:31:58 +02:00
Johannes Kirschbauer
e54101165f Inventory: generate exact schema for validation & documentation 2024-07-14 13:30:02 +02:00
Johannes Kirschbauer
3034b9ef92 Json-schema: extend interface by header to allow schema spec and arbitrary extensions 2024-07-14 13:29:19 +02:00
clan-bot
b01d12dd26 Merge pull request 'clan-cli: Fix missing allowed-programs.json in package' (#1739) from Qubasa/clan-core:Qubasa-main into main 2024-07-14 11:12:27 +00:00
Qubasa
bdbf8a8da0 clan-cli: Fix missing allowed-programs.json in package 2024-07-14 13:07:24 +02:00
clan-bot
2a4a3f42cd Merge pull request 'sshd: remove cve workaround again' (#1738) from Mic92-debug-facts into main 2024-07-13 06:24:08 +00:00
Jörg Thalheim
01343788d7 sshd: remove cve workaround again 2024-07-13 08:19:09 +02:00
clan-bot
0bbab94841 Merge pull request 'Webview: add clanList edit' (#1737) from hsjobeki/clan-core:hsjobeki-main into main 2024-07-11 16:49:04 +00:00
Johannes Kirschbauer
ba8a9c7565 Webview: add clanList edit 2024-07-11 18:45:35 +02:00
clan-bot
3736f492d3 Merge pull request 'Clan create: migrate to inventory' (#1732) from hsjobeki/clan-core:hsjobeki-main into main 2024-07-11 15:09:24 +00:00
Johannes Kirschbauer
b324e1a4f4 Fix some type issues 2024-07-11 17:05:57 +02:00
Johannes Kirschbauer
af4e843131 Webview: add welcome workflow 2024-07-11 16:39:06 +02:00
Johannes Kirschbauer
ac413a4d13 Webview: Add async method handling 2024-07-11 16:39:06 +02:00
Johannes Kirschbauer
1e4a761c53 Clan create: add template url field 2024-07-11 16:39:06 +02:00
Johannes Kirschbauer
060f020d83 Webview: add feeback for clan create workflow 2024-07-11 16:39:06 +02:00
Johannes Kirschbauer
8077053100 Webview: improve error debug abilities 2024-07-11 16:39:06 +02:00
Johannes Kirschbauer
d2e94b8188 API: improve json serialization 2024-07-11 16:39:06 +02:00
Johannes Kirschbauer
dfec6afd6b Clan create: migrate to inventory 2024-07-11 16:39:06 +02:00
clan-bot
1a125cc9e7 Merge pull request 'vars: implement sops.defaultGroups' (#1735) from DavHau/clan-core:DavHau-vars into main 2024-07-11 11:43:13 +00:00
DavHau
9988fb744c vars: implement sops.defaultGroups 2024-07-11 18:39:29 +07:00
clan-bot
7055b352d4 Merge pull request 'clan-cli: improve runtime dependency management' (#1733) from DavHau/clan-core:DavHau-vars into main 2024-07-11 08:38:27 +00:00
DavHau
75b969b1ad clan-cli: improve runtime dependency management
Many dependencies of clan-cli  are currently dynamically loaded via nix-shell on each execution.
This is nice, as it reduces the initial closure size of clan, but the overhead introduced by nix-shell piles up quickly, as some commands shell out many times during their lifetime. For example, when adding a secret git is called 10+ times.

This reduces the time of a test which adds a secret from around 50 seconds to 15 seconds.

- add run_cmd() as an alternative to nix_shell()
- introduce the concept of static dependencies which do not need to go through nix-shell
- static dependencies are defined at build time and included into the wrapper for clan-cli
- add package: clan-cli-full which statically ships all required dependencies

TODO: deprecate nix_shell() in favor of run_cmd()
2024-07-11 15:34:41 +07:00
clan-bot
5909d546fb Merge pull request 'vars: implement secret generation' (#1731) from DavHau/clan-core:DavHau-vars into main 2024-07-11 04:42:28 +00:00
DavHau
d21926db47 vars: implement secret generation 2024-07-11 11:37:17 +07:00
clan-bot
b066c3633a Merge pull request 'clan-cli: simplify cli helper' (#1726) from DavHau/clan-core:DavHau-dave into main 2024-07-10 11:18:48 +00:00
DavHau
e7908c2af5 clan-cli: simplify cli helper 2024-07-10 18:14:06 +07:00
clan-bot
8498b71f0f Merge pull request 'UI: improve open clan from directory & list machines' (#1728) from hsjobeki/clan-core:hsjobeki-feat/clan-init into main 2024-07-10 09:15:58 +00:00
Johannes Kirschbauer
4e9778f7d6 UI: improve open clan from directory & list machines 2024-07-10 11:08:03 +02:00
clan-bot
61765fb2d2 Merge pull request 'UI: init flash poc' (#1727) from hsjobeki/clan-core:hsjobeki-feat/clan-init into main 2024-07-10 09:07:09 +00:00
Johannes Kirschbauer
10bae7dcb0 UI: init flash poc 2024-07-10 09:43:18 +02:00
clan-bot
0a98bd6cc7 Merge pull request 'clan-app: Add webview hot-reloading' (#1724) from Qubasa/clan-core:Qubasa-main into main 2024-07-09 14:00:10 +00:00
Qubasa
d917144819 fixup! clan-app: Add webview hot-reloading 2024-07-09 15:55:22 +02:00
Qubasa
444be70796 clan-app: Add webview hot-reloading 2024-07-09 15:39:33 +02:00
clan-bot
668b4a0a9c Merge pull request 'lib.readFact: fix argument order' (#1723) from Mic92-debug-facts into main 2024-07-09 13:28:22 +00:00
Jörg Thalheim
6a2e24e7ff lib.readFact: fix argument order 2024-07-09 15:23:26 +02:00
clan-bot
b76d5ce46b Merge pull request 'lib.facts: assume clanDir instead of machines prefix' (#1722) from Mic92-main into main 2024-07-09 13:09:49 +00:00
Jörg Thalheim
872a5fdc80 lib.facts: assume clanDir instead of machines prefix 2024-07-09 15:05:00 +02:00
clan-bot
338ea1217c Merge pull request 'lib.readFact: change order of arguments' (#1721) from Mic92-main into main 2024-07-09 12:59:48 +00:00
Jörg Thalheim
a24c183ec5 lib.readFact: change order of arguments 2024-07-09 14:44:35 +02:00
Jörg Thalheim
6c91cff672 better project root hint 2024-07-09 13:49:42 +02:00
clan-bot
bb78eff301 Merge pull request 'lib/facts: rename machineDir -> clanDir' (#1720) from Mic92-main into main 2024-07-09 11:05:46 +00:00
Jörg Thalheim
9c8d993342 rename machineDir -> clanDir 2024-07-09 13:00:34 +02:00
clan-bot
455db8f37d Merge pull request 'Reapply "clan.core: rename clan.{deployment,networking} -> clan.core.{deployment,networking}"' (#1712) from DavHau/clan-core:DavHau-dave into main 2024-07-09 09:52:52 +00:00
clan-bot
59e56ac949 Merge pull request 'improve error message for removed settings.json' (#1719) from Mic92-main into main 2024-07-09 09:52:01 +00:00
Jörg Thalheim
00dbdaf071 improve error message for removed settings.json 2024-07-09 11:44:29 +02:00
Mic92
3e6c41593d Merge branch 'main' into DavHau-dave 2024-07-09 09:33:11 +00:00
clan-bot
9fe0c07eb4 Merge pull request 'vars: init' (#1718) from DavHau/clan-core:DavHau-vars into main 2024-07-09 07:31:31 +00:00
DavHau
3447a98bee vars: implement generating public variables via in_repo 2024-07-09 14:26:56 +07:00
DavHau
26ff2beea9 clan-cli: add vars command 2024-07-09 12:42:29 +07:00
DavHau
9ff0045698 WIP: vars: copy python code from facts 2024-07-09 12:42:29 +07:00
clan-bot
d62f221309 Merge pull request 'Automatic flake update - 2024-07-08T00:00+00:00' (#1715) from flake-update-2024-07-08 into main 2024-07-08 14:35:02 +00:00
Jörg Thalheim
e1b7805aef fix new linter issues 2024-07-08 16:30:15 +02:00
Jörg Thalheim
83371fca47 quote .envrc 2024-07-08 16:25:16 +02:00
Jörg Thalheim
4f2f663b3b reformat script-writers with nixfmt 2024-07-08 16:24:34 +02:00
Jörg Thalheim
f62c30f81d fix shellcheck warnings 2024-07-08 16:24:34 +02:00
Jörg Thalheim
9e6d5124ad add shellcheck hints to all envrc files 2024-07-08 16:24:34 +02:00
Jörg Thalheim
29616a8b5d fix mkdocs-rss-plugin deps 2024-07-08 16:24:34 +02:00
Jörg Thalheim
b4a0f8484d remove nixos-generators 2024-07-08 16:24:34 +02:00
Jörg Thalheim
d4917cd4ab remove obsolete iso installer
This is now part of nixos-images
2024-07-08 16:24:34 +02:00
Jörg Thalheim
bd8515fa59 treefmt: upgrade nixfmt options 2024-07-08 16:24:34 +02:00
Jörg Thalheim
50a2b90d66 gnome.adwaita-icon-theme -> adwaita-icon-theme 2024-07-08 15:59:54 +02:00
Jörg Thalheim
487b7330ab matrix-synapse: remove obsolete patches 2024-07-08 15:59:54 +02:00
Clan Merge Bot
a55bf3044d update flake lock - 2024-07-08T00:00+00:00
Flake lock file updates:

• Updated input 'disko':
    'github:nix-community/disko/e1174d991944a01eaaa04bc59c6281edca4c0e6e' (2024-06-20)
  → 'github:nix-community/disko/64679cd7f318c9b6595902b47d4585b1d51d5f9e' (2024-07-04)
• Updated input 'flake-parts':
    'github:hercules-ci/flake-parts/2a55567fcf15b1b1c7ed712a2c6fadaec7412ea8' (2024-06-01)
  → 'github:hercules-ci/flake-parts/9227223f6d922fee3c7b190b2cc238a99527bbb7' (2024-07-03)
• Updated input 'nixos-generators':
    'github:nix-community/nixos-generators/35c20ba421dfa5059e20e0ef2343c875372bdcf3' (2024-06-10)
  → 'github:nix-community/nixos-generators/168b220231a70e47cc1f0919048fa5914415fb18' (2024-07-04)
• Updated input 'nixos-images':
    'github:nix-community/nixos-images/c1e6a5f7b08f1c9993de1cfc5f15f838bf783b88' (2024-06-20)
  → 'github:nix-community/nixos-images/f8650460d37d9d1820a93ebb7f0db5b6c3621946' (2024-07-04)
• Updated input 'nixpkgs':
    'github:NixOS/nixpkgs/3664857c48feacb35770c00abfdc671e55849be5' (2024-06-27)
  → 'github:NixOS/nixpkgs/60a94e515488e335bd5bce096431d490486915e3' (2024-07-07)
• Updated input 'sops-nix':
    'github:Mic92/sops-nix/5e2e9421e9ed2b918be0a441c4535cfa45e04811' (2024-06-23)
  → 'github:Mic92/sops-nix/c184aca4db5d71c3db0c8cbfcaaec337a5d065ea' (2024-07-07)
• Updated input 'treefmt-nix':
    'github:numtide/treefmt-nix/68eb1dc333ce82d0ab0c0357363ea17c31ea1f81' (2024-06-16)
  → 'github:numtide/treefmt-nix/e1d7bd5ec6fc389eb3a90e232c4150338bf6a508' (2024-07-07)
2024-07-08 15:59:54 +02:00
kenji
7ad5b63cb6 Merge pull request 'zerotier-static-peers: add external devices' (#1698) from kenji/clan-core:zerotier-static/add-external into main
Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/1698
2024-07-08 07:40:09 +00:00
a-kenji
8e3a265ce9 zerotier-static-peers: add external devices
Allow the `zerotier-auto-accept` service to add external devices through
their respective `zerotierID`, or their `zerotierIP` in a stateless way.

This is useful to either add mobile phones, that can't be managed
through clan yet, or to add devices of other peoples clans, to connect
them together.
2024-07-08 07:40:09 +00:00
clan-bot
770a2c3e1e Merge pull request 'API: extensions & tests' (#1699) from hsjobeki/clan-core:hsjobeki-main into main 2024-07-06 16:01:27 +00:00
Johannes Kirschbauer
04ef8d824e Inventory spec: make system optional 2024-07-06 17:56:22 +02:00
Johannes Kirschbauer
2ebc0902c1 Test: fixup 2024-07-06 17:51:46 +02:00
Johannes Kirschbauer
a7b7cc888b Test: ensure type inference runs on all dataclasses 2024-07-06 17:22:47 +02:00
Johannes Kirschbauer
cb13ddb464 API Types: treat '_*' as private fields and dont inspect them 2024-07-06 17:22:47 +02:00
Johannes Kirschbauer
d8ff8b042f Doc: add conceptual documentation 2024-07-06 17:22:47 +02:00
Johannes Kirschbauer
9eb00df6b7 buildClan: autoimport configuration.nix & hardware-configuration.nix 2024-07-06 17:22:47 +02:00
DavHau
4cde2d96be Reapply "clan.core: rename clan.{deployment,networking} -> clan.core.{deployment,networking}"
This reverts commit 9778444706.

workaround upstream bug: https://github.com/NixOS/nixpkgs/issues/324802
2024-07-05 19:29:01 +07:00
Mic92
fb38516a86 Merge pull request 'Revert "clan.core: rename clan.{deployment,networking} -> clan.core.{deployment,networking}"' (#1710) from revert-broken-migration into main
Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/1710
2024-07-05 09:48:24 +00:00
clan-bot
e5c692f0cf Merge pull request 'clan-cli tests: remove dynamic inclusion of helpers module' (#1711) from DavHau/clan-core:DavHau-dave into main 2024-07-05 09:43:19 +00:00
DavHau
0367fc1e90 clan-cli tests: remove dynamic inclusion of helpers module
Dynamically extending the python path at runtime is bad for developer experience, as this is not understood by the text editor and therefore jump to definition etc. does not work.

-> Better to remove the dynamic inclusion and force developers to specify the import correctly.
2024-07-05 16:38:22 +07:00
Jörg Thalheim
9778444706 Revert "clan.core: rename clan.{deployment,networking} -> clan.core.{deployment,networking}"
This reverts commit afbd4a984d.

The old configuration cannot be updated like this:

eve] error:
[eve]        … while calling the 'head' builtin
[eve]          at /nix/store/5b0hl2dnvr1sawqlkwmsnaiyqz00d34h-source/lib/attrsets.nix:1575:11:
[eve]          1574|         || pred here (elemAt values 1) (head values) then
[eve]          1575|           head values
[eve]              |           ^
[eve]          1576|         else
[eve]
[eve]        … while evaluating the attribute 'value'
[eve]          at /nix/store/5b0hl2dnvr1sawqlkwmsnaiyqz00d34h-source/lib/modules.nix:809:9:
[eve]           808|     in warnDeprecation opt //
[eve]           809|       { value = builtins.addErrorContext "while evaluating the option `${showOption loc}':" value;
[eve]              |         ^
[eve]           810|         inherit (res.defsFinal') highestPrio;
[eve]
[eve]        … while evaluating the option `system.build.toplevel':
[eve]
[eve]        … while evaluating definitions from `/nix/store/5b0hl2dnvr1sawqlkwmsnaiyqz00d34h-source/nixos/modules/system/activation/top-level.nix':
[eve]
[eve]        … while evaluating the option `assertions':
[eve]
[eve]        … while evaluating definitions from `/nix/store/5b0hl2dnvr1sawqlkwmsnaiyqz00d34h-source/nixos/modules/system/boot/systemd.nix':
[eve]
[eve]        … while evaluating the option `systemd.services':
[eve]
[eve]        … while evaluating definitions from `/nix/store/kpzcdgndym0qm1w490mjvk9c2qmz03h5-source/nixosModules/clanCore/zerotier':
[eve]
[eve]        … while evaluating the option `clan.core.networking.zerotier.networkId':
[eve]
[eve]        (stack trace truncated; use '--show-trace' to show the full, detailed trace)
[eve]
[eve]        error: A definition for option `clan.core.networking.zerotier.networkId' is not of type `null or string'. Definition values:
[eve]        - In `/nix/store/kpzcdgndym0qm1w490mjvk9c2qmz03h5-source/nixosModules/clanCore/networking.nix':
[eve]            {
[eve]              _type = "override";
[eve]              content = "267efd4a15b69623";
[eve]              priorit
2024-07-05 11:16:05 +02:00
clan-bot
4c6c5b86ad Merge pull request 'fixtures_flakes.py: remove dead code' (#1709) from DavHau/clan-core:DavHau-dave into main 2024-07-05 09:00:41 +00:00
DavHau
f37379908c fixtures_flakes.py: remove dead code 2024-07-05 15:55:52 +07:00
clan-bot
8a4b96c9c9 Merge pull request 'devShells: make all shells inherit from default shell' (#1708) from DavHau/clan-core:DavHau-dave into main 2024-07-05 08:06:19 +00:00
DavHau
802f047341 devShells: make all shells inherit from default shell
Currently, important tools from the default shell are lost as soon as select-shell is used to switch to another shell. select-shell itself, for example is missing, which makes it impossible to switch back to another shell.
2024-07-05 15:01:25 +07:00
clan-bot
a89b301425 Merge pull request 'clan.core: rename clan.{deployment,networking} -> clan.core.{deployment,networking}' (#1706) from DavHau/clan-core:DavHau-rename-clanCore into main 2024-07-04 10:09:17 +00:00
DavHau
afbd4a984d clan.core: rename clan.{deployment,networking} -> clan.core.{deployment,networking} 2024-07-04 17:05:37 +07:00
clan-bot
737cf9412c Merge pull request 'vars: add generator.runtimeInputs' (#1705) from DavHau/clan-core:DavHau-dave into main 2024-07-04 06:45:32 +00:00
DavHau
32f3b3a309 vars: add generator.runtimeInputs 2024-07-04 13:42:25 +07:00
clan-bot
d9c8079eae Merge pull request 'reference docs: add missing description fields and enforce it from now on' (#1704) from DavHau/clan-core:DavHau-dave into main 2024-07-04 06:38:15 +00:00
DavHau
208021ee1c reference docs: add missing description fields and enforce it from now on 2024-07-04 13:34:55 +07:00
clan-bot
0a4abd0e46 Merge pull request 'vars: import by default & fix option rendering' (#1690) from DavHau/clan-core:DavHau-dave into main 2024-07-04 06:15:50 +00:00
DavHau
85a9d82132 vars: import by default & fix option rendering 2024-07-04 13:12:29 +07:00
clan-bot
61adaf0bdd Merge pull request 'facts: mention prompt_value in docs for generator.scripts' (#1703) from DavHau/clan-core:DavHau-facts-docs into main 2024-07-04 06:03:34 +00:00
DavHau
a31e70b2ec facts: mention prompt_value in docs for generator.scripts 2024-07-04 12:59:49 +07:00
clan-bot
3eb445cd0e Merge pull request 'move FlakeId to flake id' (#1701) from refactor-machine into main 2024-07-03 16:37:44 +00:00
Jörg Thalheim
d9c5f16e05 add assertion if FlakeId has wrong value 2024-07-03 18:28:55 +02:00
Jörg Thalheim
c44a99e304 don't catch all exceptions when generating facts 2024-07-03 18:28:55 +02:00
Jörg Thalheim
5b606c035f move FlakeId to flake id
move FlakeId to flake id
2024-07-03 18:28:55 +02:00
clan-bot
0c12157c61 Merge pull request 'matrix-bot: Add data directory to gitignore' (#1702) from Qubasa/clan-core:Qubasa-matrix-bot into main 2024-07-03 15:37:33 +00:00
Qubasa
0ee79a5fab matrix-bot: Move it to clan-infra 2024-07-03 17:33:42 +02:00
Qubasa
093da22577 matrix-bot: Add data directory to gitignore 2024-07-03 17:33:42 +02:00
clan-bot
fa41f94ae7 Merge pull request 'matrix-bot: Fix incorrect caching of already pinged maintainers' (#1700) from Qubasa/clan-core:Qubasa-matrix-bot into main 2024-07-03 12:27:02 +00:00
Qubasa
c33b3b4807 matrix-bot: Fix incorrect caching of already pinged maintainers 2024-07-03 14:23:43 +02:00
clan-bot
044cf3923e Merge pull request 'refactor-machine' (#1691) from refactor-machine into main 2024-07-03 10:48:09 +00:00
clan-bot
7050dcc37f Merge pull request 'clanModules: init packages' (#1697) from hsjobeki/clan-core:hsjobeki-main into main 2024-07-03 10:35:03 +00:00
Jörg Thalheim
b4698528ef make machine class now a dataclass 2024-07-03 12:34:43 +02:00
Johannes Kirschbauer
dc583ece4f clanModules: init packages 2024-07-03 12:31:53 +02:00
clan-bot
1dd4db0034 Merge pull request 'Init single disk' (#1694) from hsjobeki/clan-core:hsjobeki-main into main 2024-07-03 10:00:28 +00:00
Johannes Kirschbauer
fc31d1aae7 Fix frontmatter of module 2024-07-03 11:57:15 +02:00
Johannes Kirschbauer
186784d0fd clanModules: init single disk 2024-07-03 11:05:00 +02:00
clan-bot
be4628d235 Merge pull request 'matrix-bot: Init git commit summarizer' (#1693) from Qubasa/clan-core:Qubasa-matrix-bot into main 2024-07-02 17:54:05 +00:00
Qubasa
53c4195932 matrix-bot: Working timer
matrix-bot: Working timer 2

matrix-bot: nix fmt
2024-07-02 19:49:41 +02:00
Qubasa
f6e77f3c1b matrix-bot: Working openai integration 2024-07-02 19:47:38 +02:00
Qubasa
7a888fbbae matrix-bot: Working private room join and better message 2024-07-02 19:47:38 +02:00
Qubasa
c26b7e0a0a matrix-bot: Init working sending and receiving
matrix-bot: Code cleanup

matrix-bot: Code cleanup#

matrix-bot: Code cleanup#

matrix-bot: Ping on review neede

Add .gitignore

Working user ping
2024-07-02 19:47:36 +02:00
Qubasa
ef9b733631 matrix-bot: Add argparse
add mautrix
2024-07-02 19:47:21 +02:00
Qubasa
881196188c matrix-bot: Init git commit summarizer 2024-07-02 19:43:42 +02:00
clan-bot
a666a6b126 Merge pull request 'API: tests for module instance update' (#1692) from hsjobeki/clan-core:hsjobeki-main into main 2024-07-02 14:12:28 +00:00
Johannes Kirschbauer
d6493ed64d API: tests for module instance update 2024-07-02 16:09:13 +02:00
kenji
129db95426 Merge pull request 'add: lib/facts.nix' (#1681) from kenji/clan-core:feature/clanLib into main
Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/1681
2024-07-02 11:34:26 +00:00
a-kenji
1a969d884e lib: add fact loaders to clan lib 2024-07-02 11:34:26 +00:00
Ingolf Wagner
f228239834 add lib/facts.nix 2024-07-02 11:34:26 +00:00
kenji
6e15140583 Merge pull request 'zerotier-static/halalify-all' (#1689) from kenji/clan-core:zerotier-static/halalify-all into main
Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/1689
2024-07-02 11:18:11 +00:00
a-kenji
975d4487bf zerotier-static: halalify all packages 2024-07-02 13:14:26 +02:00
Jörg Thalheim
cc583dd79e simplify clan uri further 2024-07-02 12:52:10 +02:00
clan-bot
6b70792cae Merge pull request 'remove unused multi machine clan urls' (#1687) from Mic92-main into main 2024-07-02 10:26:14 +00:00
kenji
5467f0256a Merge pull request 'zerotier-peers: use halalified package' (#1686) from kenji/clan-core:zerotier-static/halalify into main
Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/1686
2024-07-02 10:24:07 +00:00
a-kenji
88cd52fd0f zerotier-peers: use halalified package 2024-07-02 10:24:07 +00:00
Jörg Thalheim
e637394370 remove unused multi machine clan urls 2024-07-02 12:20:30 +02:00
clan-bot
c4bbdb2212 Merge pull request 'API: add performance constraints' (#1685) from hsjobeki/clan-core:hsjobeki-main into main 2024-07-02 10:18:54 +00:00
Johannes Kirschbauer
d93deacb4b API: remove performance constraints 2024-07-02 12:15:37 +02:00
Johannes Kirschbauer
16c9aa99a9 API: add performance constraints 2024-07-02 12:07:45 +02:00
clan-bot
1448e593e9 Merge pull request 'machines/machines: drop unused qmp wrapper' (#1683) from Mic92-main into main 2024-07-02 10:01:43 +00:00
Jörg Thalheim
815bb336be remove unused MachineParams 2024-07-02 11:57:39 +02:00
clan-bot
4bdcc4dd5e Merge pull request 'api: clan Modules add readme content' (#1684) from hsjobeki/clan-core:hsjobeki-main into main 2024-07-02 09:49:23 +00:00
Johannes Kirschbauer
5ab22d043d api: clan Modules add readme content 2024-07-02 11:45:48 +02:00
Jörg Thalheim
47010f458c machines/machines: drop unused qmp wrapper 2024-07-02 11:42:02 +02:00
clan-bot
58b9e5e66e Merge pull request 'vars: add generators.<name>.finalScript' (#1682) from DavHau/clan-core:DavHau-dave into main 2024-07-02 09:41:22 +00:00
DavHau
a7d1ea455b vars: add generators.<name>.finalScript 2024-07-02 16:37:31 +07:00
clan-bot
f37d0c746d Merge pull request 'API: migrate add machine to inventory' (#1676) from hsjobeki/clan-core:hsjobeki-main into main 2024-07-02 09:25:01 +00:00
Johannes Kirschbauer
1b7369cf0d Fix test 2024-07-02 11:21:52 +02:00
Johannes Kirschbauer
f7c80834cb Inventory persistence improves error resistance 2024-07-02 11:16:54 +02:00
Johannes Kirschbauer
9f484c1d39 API: migrate machines delete and list to inventory 2024-07-02 11:07:11 +02:00
kenji
b73b8fef77 Merge pull request 'clan: implement OSC8 hyperlinks for help output' (#1680) from kenji/clan-core:clan/hyperlink into main
Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/1680
2024-07-02 08:55:01 +00:00
a-kenji
d9ba61c30a clan: implement OSC8 hyperlinks for help output
The name of the terminal help output stays the same to keep
compatibility with legacy terminal implementations.
2024-07-02 08:55:01 +00:00
clan-bot
33ea53ee8f Merge pull request 'drop duplicate empty template' (#1678) from Mic92-main into main 2024-07-02 08:47:59 +00:00
clan-bot
7c3e7dab60 Merge pull request 'secrets: add settings, generator submodules, improve tests' (#1679) from DavHau/clan-core:DavHau-dave into main 2024-07-02 08:42:12 +00:00
Jörg Thalheim
d27e474b66 drop duplicate empty template 2024-07-02 10:41:55 +02:00
DavHau
d3f31acc5c secrets: add settings, generator submodules, improve tests 2024-07-02 15:38:46 +07:00
clan-bot
1172acdc04 Merge pull request 'Davhau Dave' (#1677) from DavHau/clan-core:DavHau-dave into main 2024-07-02 06:58:28 +00:00
DavHau
3a0f591c8c vars: simplify eval tests by using submodule directly 2024-07-02 13:55:00 +07:00
Johannes Kirschbauer
df934334a2 API: migrate add machine to inventory 2024-07-01 21:55:42 +02:00
clan-bot
d8380ebb98 Merge pull request 'Inventory: add system and sample machine' (#1675) from hsjobeki/clan-core:hsjobeki-main into main 2024-07-01 19:42:14 +00:00
Johannes Kirschbauer
41f46848b9 Inventory: add missing settings to build the test machine 2024-07-01 21:38:50 +02:00
Johannes Kirschbauer
c678608105 Inventory: add system and sample machine 2024-07-01 21:25:02 +02:00
clan-bot
e7ba8dbe15 Merge pull request 'sshd: workaround for CVE-2024-6387' (#1674) from openssh-cve-workaround into main 2024-07-01 12:04:54 +00:00
Jörg Thalheim
cfc09ca270 sshd: workaround for CVE-2024-6387 2024-07-01 14:01:40 +02:00
clan-bot
0f95bfd279 Merge pull request 'fix secret generation on macos' (#1669) from fix-macos-deploy into main 2024-06-30 06:25:39 +00:00
clan-bot
b5a04debf5 Merge pull request 'Various cleanups' (#1670) from Mic92-main into main 2024-06-30 06:24:51 +00:00
Jörg Thalheim
498f2c02be formatter/vale: exclude lib
Fixes ci
2024-06-30 08:19:55 +02:00
Jörg Thalheim
92669a0d59 nixos-generators: drop nixlib copy 2024-06-30 08:13:24 +02:00
Jörg Thalheim
0ead3b477f buildClan: improve deprecation error message of clanName
Printing the clanName in my case was actually more confusing then
helpful. Also mention what function needs to be updated.
2024-06-30 08:08:22 +02:00
Luis Hebendanz
05380828c6 Merge pull request 'add Vale for prose linting' (#1370) from fricklerhandwerk/clan-core:add-vale into main
Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/1370
2024-06-29 09:08:49 +00:00
Valentin Gagarin
fca586ff21 fix spelling in README 2024-06-29 09:08:49 +00:00
Valentin Gagarin
d40563ea9f add Vale for prose linting 2024-06-29 09:08:49 +00:00
Jörg Thalheim
2e2358d850 introduce minifakeroot that also works on macos 2024-06-27 18:53:10 +02:00
Jörg Thalheim
bae0a888c9 make bubblewrap in fact generation optional 2024-06-27 18:23:05 +02:00
clan-bot
8f0e537d34 Merge pull request 'vars: init' (#1668) from DavHau/clan-core:DavHau-dave into main 2024-06-27 14:13:38 +00:00
DavHau
5668bc561d vars: init
- init eval tests
- init basic interface
2024-06-27 21:09:55 +07:00
clan-bot
d4f2f7944c Merge pull request 'update nixpkgs for new nix-unit' (#1667) from DavHau/clan-core:DavHau-dave into main 2024-06-27 12:13:34 +00:00
DavHau
60076ef492 update nixpkgs for new nix-unit 2024-06-27 19:09:58 +07:00
clan-bot
bc0e727bd7 Merge pull request 'api: add endpoint machine_schema' (#1666) from DavHau/clan-core:DavHau-dave into main 2024-06-27 10:02:11 +00:00
DavHau
ea87166e44 api: add endpoint machine_schema 2024-06-27 16:58:37 +07:00
clan-bot
27b0d18f0d Merge pull request 'Add toml frontmatter description to jsonschema' (#1664) from hsjobeki/clan-core:hsjobeki-main into main 2024-06-26 15:22:48 +00:00
Johannes Kirschbauer
1628fdeaee Inventory: add eval tests 2024-06-26 17:19:19 +02:00
Johannes Kirschbauer
2535fdcb12 Inventory: restructure folders 2024-06-26 15:19:40 +02:00
Johannes Kirschbauer
3777a4cf02 Add toml frontmatter description to jsonschema 2024-06-26 15:10:36 +02:00
clan-bot
cecd6011d6 Merge pull request 'flake.lock: update nixpkgs' (#1663) from hsjobeki/clan-core:hsjobeki-main into main 2024-06-26 09:49:40 +00:00
Johannes Kirschbauer
3e001a2809 flake.lock: update nixpkgs 2024-06-26 11:45:40 +02:00
kenji
1a8abaa2ac Merge pull request 'clan: state add information about the backup command hooks to the help' (#1661) from kenji/clan-core:clan/improve-description into main
Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/1661
2024-06-26 08:46:02 +00:00
a-kenji
fa37d528b3 clan: state add information about the backup command hooks to the help 2024-06-26 08:46:02 +00:00
clan-bot
09f7cd7e12 Merge pull request 'ClanModules: Add docs and api to retrieve metadata' (#1662) from hsjobeki/clan-core:hsjobeki-main into main 2024-06-25 19:43:22 +00:00
Johannes Kirschbauer
66d67b18d7 remove module description from json schema 2024-06-25 21:40:04 +02:00
Johannes Kirschbauer
fe21d2edb9 API: add clanModules list and details test 2024-06-25 21:31:44 +02:00
Johannes Kirschbauer
74dd48320e ClanModules: Add docs and api to retrieve metadata 2024-06-25 21:17:42 +02:00
Johannes Kirschbauer
9b0e2a87e8 ClanModules: Add docs and api to retrieve metadata 2024-06-25 21:17:01 +02:00
clan-bot
4022c13b31 Merge pull request 'Docs: rename clanName to just name' (#1660) from hsjobeki/clan-core:hsjobeki-main into main 2024-06-25 12:25:27 +00:00
hsjobeki
25db02368a Merge pull request 'Inventory: init first implementation' (#1638) from hsjobeki/clan-core:wip/inventory into main
Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/1638
2024-06-25 12:23:29 +00:00
Johannes Kirschbauer
db951f1d9e buildClan: bugfixing 2024-06-25 12:23:29 +00:00
Johannes Kirschbauer
d03422d004 test: increase timeout 2024-06-25 12:23:29 +00:00
Johannes Kirschbauer
4fb15d8733 Add machinesDirs with default 2024-06-25 12:23:29 +00:00
Johannes Kirschbauer
c0293b889c Add machinesDirs with default 2024-06-25 12:23:29 +00:00
Johannes Kirschbauer
26c655ff3c Add settings.json back 2024-06-25 12:23:29 +00:00
Johannes Kirschbauer
712ed3f738 Docs: add inventory module docs 2024-06-25 12:23:29 +00:00
Johannes Kirschbauer
e6c78054c4 Template: make inventory disabled by default 2024-06-25 12:23:29 +00:00
Johannes Kirschbauer
7f674e6f63 Remove useless settings.json 2024-06-25 12:23:29 +00:00
Johannes Kirschbauer
3aa7a6ee69 Inventory: move to lib.inventory 2024-06-25 12:23:29 +00:00
Johannes Kirschbauer
6378a96b4d Template: use inventory 2024-06-25 12:23:29 +00:00
Johannes Kirschbauer
b74590f381 Inventory: simplify build-clan interface 2024-06-25 12:23:29 +00:00
Johannes Kirschbauer
2f8b782a1f Inventory: init module merge & validation logic for inventory 2024-06-25 12:23:29 +00:00
Johannes Kirschbauer
c89080deb4 Extend build-clan interface 2024-06-25 12:23:29 +00:00
Johannes Kirschbauer
e44b07df66 inventory: rename clan.services 2024-06-25 12:23:29 +00:00
Johannes Kirschbauer
afca7ae0cc update inventory implementation 2024-06-25 12:23:29 +00:00
Johannes Kirschbauer
3a9c56deb2 readme improvements 2024-06-25 12:23:29 +00:00
Johannes Kirschbauer
5f72778ade schema improvements 2024-06-25 12:23:29 +00:00
Johannes Kirschbauer
d934b67c72 Inventory: implement borgbackup 2024-06-25 12:23:29 +00:00
Johannes Kirschbauer
241cca5b70 Docs: rename clanName to just name 2024-06-25 14:21:53 +02:00
clan-bot
39ec23bd31 Merge pull request 'clan-cli: Better env jailing in temporary_home' (#1659) from Qubasa/clan-core:Qubasa-main into main 2024-06-25 10:06:55 +00:00
Qubasa
62839b6fa0 clan-cli: Better env jailing in temporary_home 2024-06-25 12:03:44 +02:00
kenji
5ae8ccbbdd Merge pull request 'clan: state list improve formatting' (#1658) from kenji/clan-core:clan/state-list-improve into main
Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/1658
2024-06-25 09:56:29 +00:00
a-kenji
af2ffb7e5e clan: state list improve formatting 2024-06-25 11:50:19 +02:00
kenji
d1f2679c45 Merge pull request 'cli: add command to list state' (#1657) from kenji/clan-core:cli/state-list into main
Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/1657
2024-06-25 09:34:31 +00:00
a-kenji
3bcaeda737 cli: add command to list state
Add a subcommand to list configured state for a specific machine.

Example:
```
$ clan state list [MACHINE]
```
2024-06-25 09:34:31 +00:00
kenji
4983c6d302 Merge pull request 'blog: fix typos in backup blog' (#1656) from kenji/clan-core:blog-backups-fix-typo into main
Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/1656
2024-06-25 09:02:52 +00:00
a-kenji
63e6aaf1fe blog: fix typos in backup blog 2024-06-25 09:02:52 +00:00
kenji
b2332e796e Merge pull request 'clan: ssh fix typos' (#1655) from kenji/clan-core:fix-typo into main
Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/1655
2024-06-25 08:50:36 +00:00
a-kenji
cd8ec83881 clan: ssh fix typos 2024-06-25 10:32:05 +02:00
clan-bot
7ef86e99dc Merge pull request 'clan-cli: Acutally test SecretStore for age and password-store.' (#1654) from Qubasa/clan-core:Qubasa-main into main 2024-06-24 19:45:06 +00:00
Qubasa
70ca824e88 clan-cli: Acutally test SecretStore for age and password-store. 2024-06-24 21:41:16 +02:00
clan-bot
690a1fe64c Merge pull request 'clan-cli: Fix user-password without user-prompt. Remove newlines from user-password and root-password. Improve test_generate_secret' (#1653) from Qubasa/clan-core:Qubasa-main into main 2024-06-24 18:11:26 +00:00
Qubasa
38c0233496 clan-cli: Fix user-password without user-prompt. Remove newlines from user-password and root-password. Improve test_generate_secret 2024-06-24 20:08:02 +02:00
clan-bot
ff1863f37e Merge pull request 'clan-cli: Add validity check for ssh' (#1652) from Qubasa/clan-core:Qubasa-test_secrets into main 2024-06-24 17:26:34 +00:00
Qubasa
eac869dde5 Fix run_vm test
nix fmt
2024-06-24 19:23:16 +02:00
Qubasa
88f97bd2b6 Fixed Contributing.md guide 2024-06-24 19:22:24 +02:00
Qubasa
fdd7ac7bbf Add repro-hook to .gitignore 2024-06-24 19:22:24 +02:00
Qubasa
8038a9b488 clan-cli: Add validity check for ssh
stash
2024-06-24 19:22:19 +02:00
clan-bot
37311f8145 Merge pull request 'Inventory: add concrete use-case examples' (#1650) from hsjobeki/clan-core:hsjobeki-main into main 2024-06-24 14:03:46 +00:00
Johannes Kirschbauer
d7dc66da03 Json-schema tests: add schema specifier to test 2024-06-24 16:00:46 +02:00
Johannes Kirschbauer
51154c1d54 schema improvements: add additionalProperties: false to ensure closed types 2024-06-24 15:55:48 +02:00
Johannes Kirschbauer
13c3169b41 lib: eval clan module as lib function 2024-06-24 15:47:25 +02:00
clan-bot
fd62efc745 Merge pull request 'dev report: backup' (#1651) from matrix into main 2024-06-24 13:08:51 +00:00
Jörg Thalheim
5575c5d214 first draft of the backup article 2024-06-24 15:05:37 +02:00
Johannes Kirschbauer
294c5548b9 Inventory: add concrete use-case examples 2024-06-24 14:35:41 +02:00
clan-bot
fd9ad38900 Merge pull request 'Automatic flake update - 2024-06-24T00:00+00:00' (#1648) from flake-update-2024-06-24 into main 2024-06-24 00:06:47 +00:00
Clan Merge Bot
21e9945c97 update flake lock - 2024-06-24T00:00+00:00
Flake lock file updates:

• Updated input 'disko':
    'github:nix-community/disko/1bbdb06f14e2621290b250e631cf3d8948e4d19b' (2024-06-09)
  → 'github:nix-community/disko/e1174d991944a01eaaa04bc59c6281edca4c0e6e' (2024-06-20)
• Updated input 'nixos-generators':
    'github:nix-community/nixos-generators/d14b286322c7f4f897ca4b1726ce38cb68596c94' (2024-05-20)
  → 'github:nix-community/nixos-generators/35c20ba421dfa5059e20e0ef2343c875372bdcf3' (2024-06-10)
• Updated input 'nixos-images':
    'github:nix-community/nixos-images/72771bd35f4e19e32d6f652528483b5e07fc317b' (2024-06-07)
  → 'github:nix-community/nixos-images/c1e6a5f7b08f1c9993de1cfc5f15f838bf783b88' (2024-06-20)
• Updated input 'nixpkgs':
    'github:NixOS/nixpkgs/7d916e720af6b2ca355e4d0cfb8e4f742c172239' (2024-06-09)
  → 'github:NixOS/nixpkgs/084f8df2f3ff80cdec6f515931036f63c5d2f36c' (2024-06-23)
• Updated input 'sops-nix':
    'github:Mic92/sops-nix/f0922ad001829b400f0160ba85b47d252fa3d925' (2024-06-09)
  → 'github:Mic92/sops-nix/5e2e9421e9ed2b918be0a441c4535cfa45e04811' (2024-06-23)
• Updated input 'treefmt-nix':
    'github:numtide/treefmt-nix/4fc1c45a5f50169f9f29f6a98a438fb910b834ed' (2024-06-08)
  → 'github:numtide/treefmt-nix/68eb1dc333ce82d0ab0c0357363ea17c31ea1f81' (2024-06-16)
2024-06-24 00:00:22 +00:00
clan-bot
f4283982b3 Merge pull request 'fix fake-etc build on machines without sandbox' (#1645) from fix-macos-deploy into main 2024-06-21 15:05:45 +00:00
Jörg Thalheim
6086f27263 fix fake-etc build on machines without sandbox
If we have no sandbox enabled or on macos with sandbox enabled, /etc
contains a lot more files than we actually want.
Instead of copying some random files, we now just create those files
ourself.
2024-06-21 17:01:40 +02:00
clan-bot
0dfa1d969f Merge pull request 'clan-cli: Add validity check for age key generation' (#1642) from Qubasa/clan-core:Qubasa-main into main 2024-06-21 13:18:34 +00:00
Qubasa
1ff58adcef clan-cli: Add validity check for age key generation 2024-06-21 15:07:53 +02:00
clan-bot
641ec7e097 Merge pull request 'clan-cli: Disable stack trace on KeyboardInterrupt' (#1641) from Qubasa/clan-core:Qubasa-main into main 2024-06-21 11:14:47 +00:00
Qubasa
8ee33950e6 clan-cli: Disable stack trace on KeyboardInterrupt 2024-06-21 13:11:33 +02:00
clan-bot
b3123b150f Merge pull request 'clan.core.state: wrap all commands in shell scripts' (#1639) from refactor-state into main 2024-06-20 16:20:31 +00:00
Jörg Thalheim
20b952b4cd fix dropping non-existing database 2024-06-19 18:00:51 +02:00
Jörg Thalheim
aa5ccfb8bd clanCore -> clan.core 2024-06-19 17:55:59 +02:00
Jörg Thalheim
ef9ed1ebea clan.core.state: wrap all commands in shell scripts
Otherwise we cannot execute them via ssh and also have nix store
dependencies.
2024-06-19 17:54:46 +02:00
Jörg Thalheim
117aed49e3 postgresql: don't prepend postgresql- for states 2024-06-19 17:38:31 +02:00
clan-bot
9bbf7f668a Merge pull request 'Inventory: add concrete use-case examples' (#1636) from hsjobeki/clan-core:hsjobeki-main into main 2024-06-19 11:08:04 +00:00
Johannes Kirschbauer
afdfa6181b Inventory: add concrete use-case examples 2024-06-19 13:04:10 +02:00
clan-bot
6c11e0ced7 Merge pull request 'UI: display block devices' (#1635) from hsjobeki/clan-core:hsjobeki-main into main 2024-06-19 09:39:41 +00:00
Johannes Kirschbauer
399ce2e35c UI: display block devices 2024-06-19 11:36:19 +02:00
clan-bot
e575c2e769 Merge pull request 'UI: display known network hosts' (#1633) from hsjobeki/clan-core:hsjobeki-main into main 2024-06-19 09:11:01 +00:00
Johannes Kirschbauer
56b2347a30 UI: display known network hosts 2024-06-19 11:07:45 +02:00
clan-bot
70954acf3d Merge pull request 'Inventory: init draft ideas' (#1632) from hsjobeki/clan-core:hsjobeki-inventory into main 2024-06-19 07:50:12 +00:00
Johannes Kirschbauer
13aa60529f Inventory: init draft ideas 2024-06-19 09:47:13 +02:00
Johannes Kirschbauer
7474f01193 Inventory: init draft ideas 2024-06-19 09:40:23 +02:00
clan-bot
bd9883baaf Merge pull request 'refactor: rename clanCore -> clan.core' (#1629) from DavHau/clan-core:DavHau-rename-clanCore into main 2024-06-18 11:35:57 +00:00
DavHau
313db5643f refactor: rename clanCore -> clan.core 2024-06-18 18:32:40 +07:00
clan-bot
93a6d7a476 Merge pull request 'update matrix address' (#1631) from new-matrix-address into main 2024-06-17 13:32:07 +00:00
Jörg Thalheim
d221d90972 update matrix address 2024-06-17 15:26:23 +02:00
clan-bot
30fd5dcfb8 Merge pull request 'matrix-synapse: restart service on restore' (#1630) from clan-name into main 2024-06-17 12:30:03 +00:00
Jörg Thalheim
c79680344d fix restore if database does not exists 2024-06-17 14:21:45 +02:00
Jörg Thalheim
ad544a7d24 matrix-synapse: restart service on restore 2024-06-17 14:21:45 +02:00
clan-bot
1cd606b879 Merge pull request 'fix: remove IFD in nix flake show' (#1628) from DavHau/clan-core:DavHau-dave into main 2024-06-17 08:09:39 +00:00
DavHau
39f74c0f52 fix: remove IFD in nix flake show 2024-06-17 15:06:25 +07:00
clan-bot
8feea28a19 Merge pull request 'API: init methods: hw_generate, dns discovery' (#1626) from hsjobeki/clan-core:hsjobeki-main into main 2024-06-16 14:32:42 +00:00
Johannes Kirschbauer
b73246bdfd API: init methods: hw_generate, dns discovery 2024-06-16 16:29:18 +02:00
clan-bot
36a418b6ac Merge pull request 'Docs: update machine hardware config instructions' (#1625) from hsjobeki/clan-core:hsjobeki-main into main 2024-06-15 20:30:50 +00:00
Johannes Kirschbauer
43e8804eb4 Docs: update machine hardware config instructions 2024-06-15 22:27:46 +02:00
clan-bot
8790e5a0eb Merge pull request 'CLI: init hw-generate command' (#1624) from hsjobeki/clan-core:hsjobeki-main into main 2024-06-15 19:35:56 +00:00
Johannes Kirschbauer
5e39514251 CLI: init hw-generate command 2024-06-15 21:31:23 +02:00
clan-bot
b28950f310 Merge pull request 'API: init op_key, improve seralisation & signature typing' (#1622) from hsjobeki/clan-core:hsjobeki-main into main 2024-06-15 09:38:29 +00:00
Johannes Kirschbauer
3ebee252aa Webview: init machine details 2024-06-15 11:35:15 +02:00
Johannes Kirschbauer
720fb4af63 Webview: minor improvements 2024-06-15 11:34:54 +02:00
Johannes Kirschbauer
af19950dfa Webview: init global state for current clan path 2024-06-15 11:34:20 +02:00
Johannes Kirschbauer
149be249fa Webview: init api event registry 2024-06-15 11:33:53 +02:00
Johannes Kirschbauer
0cf86806b2 API: mock echo op_key 2024-06-15 11:32:42 +02:00
Johannes Kirschbauer
cb847cab82 API: init op_key, improve seralisation & signature typing 2024-06-15 11:32:09 +02:00
clan-bot
a89fd31844 Merge pull request 'matrix-synapse: user creation fixes' (#1620) from matrix into main 2024-06-14 09:36:41 +00:00
Jörg Thalheim
870948306d postgres: handle restores without associated systemd service 2024-06-14 11:29:59 +02:00
Jörg Thalheim
ec49d1f844 container-driver: source nixos environment variables in test commands 2024-06-14 11:27:06 +02:00
Jörg Thalheim
e3d84a5daf matrix-synapse: use upstream patch to create users declarativly 2024-06-14 11:27:06 +02:00
Jörg Thalheim
79b5ad0754 matrix-synapse: use registration_shared_secret_path instead 2024-06-14 11:18:09 +02:00
Jörg Thalheim
24b0d72d96 matrix-synapse: fix user check 2024-06-14 11:18:09 +02:00
Jörg Thalheim
084cd8751f postgresql: move postRestoreCommand to a dedicated command
We need to call this command from the cli
2024-06-14 11:18:09 +02:00
kenji
3d77e0a3a9 Merge pull request 'fix: outside of direnv clan-li warns show-config deprecated' (#1619) from samrose/clan-core:sam/show-config into main
Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/1619
Reviewed-by: kenji <aks.kenji@protonmail.com>
2024-06-14 08:10:29 +00:00
samrose
06bbae6d14 fix: trying run_no_stdout with original show-config 2024-06-13 18:44:50 -04:00
samrose
5f22493361 fix: formatting cli command correctly 2024-06-13 12:59:26 -04:00
samrose
56a4caf39b fix: outside of direnv clan-li warns this is going to be deprecated 2024-06-13 12:44:48 -04:00
clan-bot
83056f743d Merge pull request 'API: init icon resolve' (#1616) from hsjobeki/clan-core:hsjobeki-main into main 2024-06-12 11:24:45 +00:00
Johannes Kirschbauer
6743ff96a9 API: init icon resolve 2024-06-12 13:21:39 +02:00
clan-bot
1f3c4f4ac3 Merge pull request 'vm.nix: fix typo in comment' (#1611) from DavHau/clan-core:DavHau-dave into main 2024-06-11 21:49:18 +00:00
DavHau
7766829fb1 vm.nix: fix typo in comment 2024-06-11 14:44:08 -07:00
clan-bot
175b219246 Merge pull request 'API: improve type & class construction' (#1610) from hsjobeki/clan-core:hsjobeki-main into main 2024-06-11 17:23:42 +00:00
Johannes Kirschbauer
48aee84547 Webview: add form handling for create clan 2024-06-11 19:20:40 +02:00
Johannes Kirschbauer
d587b326b5 API: improve type & class construction 2024-06-11 19:20:40 +02:00
clan-bot
ac099d9e6f Merge pull request 'Webview/API: init open clan workflow' (#1609) from hsjobeki/clan-core:hsjobeki-main into main 2024-06-11 14:31:51 +00:00
Johannes Kirschbauer
913ab4627c Webview: init 'open clan' workflow 2024-06-11 16:28:02 +02:00
clan-bot
be868ee107 Merge pull request 'matrix-synapse: add missing xkcdpass to password generator' (#1608) from matrix into main 2024-06-11 13:44:08 +00:00
Jörg Thalheim
36b1bb65af matrix-synapse: add missing xkcdpass to password generator 2024-06-11 15:40:58 +02:00
Mic92
4a752bb951 Merge pull request 'matrix-synapse: drop drop security.wrappers' (#1607) from nixos-images-input into main
Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/1607
2024-06-11 13:32:58 +00:00
Jörg Thalheim
3dabb4e89a matrix-synapse: drop drop security.wrappers
This was debug code and not meant for production.
2024-06-11 13:32:58 +00:00
clan-bot
e2474f4e66 Merge pull request 'matrix-synapse: don't require to set default users' (#1606) from Mic92-nixos-images-input into main 2024-06-11 13:18:37 +00:00
clan-bot
f4ee0b0387 Merge pull request 'drop nixos-stable' (#1605) from nixos-images-input into main 2024-06-11 13:13:48 +00:00
Jörg Thalheim
5df1f9f9d2 matrix-synapse: don't require to set default users 2024-06-11 15:12:41 +02:00
Jörg Thalheim
3368255473 drop nixos-stable 2024-06-11 15:03:57 +02:00
clan-bot
1cbb2d6aa4 Merge pull request 'matrix-synapse: add automatic user creation' (#1603) from synapse into main 2024-06-11 11:22:32 +00:00
Jörg Thalheim
bc0e0088a0 matrix-synapse: add automatic user creation 2024-06-11 13:19:18 +02:00
clan-bot
a6a9f763db Merge pull request 'api: refactor create flake into create clan' (#1602) from hsjobeki/clan-core:hsjobeki-main into main 2024-06-11 10:15:44 +00:00
Johannes Kirschbauer
8dcb009e5b api: refactor create flake into create clan 2024-06-11 12:11:29 +02:00
kenji
9f0f44b470 Merge pull request 'borbackup: set IdentitiesOnly=Yes' (#1601) from kenji/clan-core:identities into main
Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/1601
2024-06-10 14:09:14 +00:00
a-kenji
67aa84760d borbackup: set IdentitiesOnly=Yes
Since `borgbackup` is run as root user it might try other ssh keys.
2024-06-10 14:09:14 +00:00
clan-bot
b05c937151 Merge pull request 'backups: extend tests to also check state.preBackupCommand' (#1600) from synapse into main 2024-06-10 14:01:53 +00:00
Jörg Thalheim
3322bbd681 backups: extend tests to also check state.preBackupCommand 2024-06-10 15:57:41 +02:00
clan-bot
a1acf0b05d Merge pull request 'Expand backup and restore capabilities w.r.t. postgresql.' (#1582) from synapse into main 2024-06-10 13:24:08 +00:00
Jörg Thalheim
66bdc61e3d borgbackup: move preBackupScript to a different systemd context 2024-06-10 15:17:46 +02:00
clan-bot
dd2bd2f989 Merge pull request 'test: extend minimal flake test with verification' (#1599) from DavHau/clan-core:DavHau-dave into main 2024-06-10 05:24:17 +00:00
DavHau
6f18a5de92 test: extend minimal flake test with verification 2024-06-09 22:19:38 -07:00
clan-bot
1d542d4396 Merge pull request 'tests: add test for creating machine on minimal clan' (#1596) from DavHau/clan-core:DavHau-dave into main 2024-06-10 04:58:02 +00:00
DavHau
07fb01d9db tests: add test for creating machine on minimal clan 2024-06-09 21:54:04 -07:00
clan-bot
8a5d4a0f8f Merge pull request 'Automatic flake update - 2024-06-10T00:00+00:00' (#1598) from flake-update-2024-06-10 into main 2024-06-10 00:05:18 +00:00
Clan Merge Bot
48069f99cd update flake lock - 2024-06-10T00:00+00:00
Flake lock file updates:

• Updated input 'disko':
    'github:nix-community/disko/0274af4c92531ebfba4a5bd493251a143bc51f3c' (2024-05-31)
  → 'github:nix-community/disko/1bbdb06f14e2621290b250e631cf3d8948e4d19b' (2024-06-09)
• Updated input 'nixos-images':
    'github:nix-community/nixos-images/47bfb55316e105390dd761e0b6e8e0be09462b67' (2024-05-30)
  → 'github:nix-community/nixos-images/72771bd35f4e19e32d6f652528483b5e07fc317b' (2024-06-07)
• Removed input 'nixos-images/nixos-2311'
• Added input 'nixos-images/nixos-stable':
    'github:NixOS/nixpkgs/0b8e7a1ae5a94da2e1ee3f3030a32020f6254105' (2024-06-05)
• Updated input 'nixpkgs':
    'github:NixOS/nixpkgs/6634a0509e9e81e980b129435fbbec518ab246d0' (2024-06-02)
  → 'github:NixOS/nixpkgs/7d916e720af6b2ca355e4d0cfb8e4f742c172239' (2024-06-09)
• Updated input 'sops-nix':
    'github:Mic92/sops-nix/ab2a43b0d21d1d37d4d5726a892f714eaeb4b075' (2024-06-02)
  → 'github:Mic92/sops-nix/f0922ad001829b400f0160ba85b47d252fa3d925' (2024-06-09)
• Updated input 'treefmt-nix':
    'github:numtide/treefmt-nix/3eb96ca1ae9edf792a8e0963cc92fddfa5a87706' (2024-06-01)
  → 'github:numtide/treefmt-nix/4fc1c45a5f50169f9f29f6a98a438fb910b834ed' (2024-06-08)
2024-06-10 00:00:22 +00:00
kenji
1eaf6cec39 Merge pull request 'gui-installer: fix maintainer name' (#1597) from kenji/clan-core:fix-name into main
Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/1597
2024-06-09 12:49:14 +00:00
a-kenji
f0c9de9e50 gui-installer: fix maintainer name 2024-06-09 14:28:54 +02:00
clan-bot
ef42bcc525 Merge pull request 'templates: add minimal clan flake template for (G)UI' (#1595) from DavHau/clan-core:DavHau-dave into main 2024-06-09 00:05:02 +00:00
DavHau
e7995ad344 templates: add minimal clan flake template for (G)UI 2024-06-08 17:00:18 -07:00
clan-bot
6e3c2506c9 Merge pull request 'Clan-cli/show: more detailed description' (#1594) from hsjobeki/clan-core:hsjobeki-main into main 2024-06-08 16:28:36 +00:00
Johannes Kirschbauer
5473e2733c Clan-cli/show: more detailed description 2024-06-08 18:24:54 +02:00
clan-bot
006a7044f1 Merge pull request 'Webview: add solid-toast feeback system' (#1593) from hsjobeki/clan-core:hsjobeki-main into main 2024-06-08 16:17:59 +00:00
Johannes Kirschbauer
c647197b8c Webview: add solid-toast feeback system 2024-06-08 18:14:15 +02:00
clan-bot
62735ebfe2 Merge pull request 'API: add show clan to retrieve the buildClan meta' (#1592) from hsjobeki/clan-core:hsjobeki-main into main 2024-06-08 16:11:43 +00:00
Johannes Kirschbauer
8ff00fd8fe API: include show into docs 2024-06-08 18:07:41 +02:00
Johannes Kirschbauer
bd586575b3 API: add show clan to retrieve the buildClan meta 2024-06-08 17:53:17 +02:00
clan-bot
f14f7368d7 Merge pull request 'API: add abstract open_file method, implement open_file' (#1591) from hsjobeki/clan-core:hsjobeki-main into main 2024-06-08 15:09:35 +00:00
Johannes Kirschbauer
6adcd1fdf2 API: add abstract open_file method, implement open_file 2024-06-08 17:04:56 +02:00
clan-bot
6e99beb335 Merge pull request 'UI: add open clan button' (#1590) from hsjobeki/clan-core:hsjobeki-main into main 2024-06-08 13:28:18 +00:00
Johannes Kirschbauer
6689d45a4f UI: add open clan button 2024-06-08 15:24:18 +02:00
clan-bot
6d82a5851b Merge pull request 'api: list files' (#1589) from hsjobeki/clan-core:hsjobeki-main into main 2024-06-08 13:05:52 +00:00
Johannes Kirschbauer
337ba1f8f6 api: list files 2024-06-08 15:01:53 +02:00
kenji
bf7b148592 Merge pull request 'clan: fix backup provider completions' (#1587) from kenji/clan-core:clan-complete-providers into main
Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/1587
2024-06-07 19:16:13 +00:00
a-kenji
a7f724a804 clan: fix backup provider completions 2024-06-07 19:16:13 +00:00
clan-bot
7c06b65def Merge pull request 'gui-installer: calculate bugfix version from lastModifiedDate' (#1588) from DavHau/clan-core:DavHau-dave into main 2024-06-07 18:39:28 +00:00
DavHau
7286c7250c gui-installer: calculate bugfix version from lastModifiedDate 2024-06-07 11:35:25 -07:00
kenji
4e841d3087 Merge pull request 'clan: remove very obvious comments' (#1586) from kenji/clan-core:clan/package/clean into main
Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/1586
2024-06-07 13:20:23 +00:00
a-kenji
2ce704dd40 clan: remove very obvious comments
Remove some very obvious comments as to not lose meaning of the
comments.

We want comments that convey non-obvious behavior so they will be
actually read.
2024-06-07 14:45:53 +02:00
kenji
6279610691 Merge pull request 'syncthing: automatically add zt network ip to devices' (#1585) from kenji/clan-core:syncthing/add-ip into main
Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/1585
2024-06-07 12:33:09 +00:00
a-kenji
297d53dac8 syncthing: automatically add zt network ip to devices 2024-06-07 14:25:21 +02:00
kenji
6f1300f819 Merge pull request 'clan: install shell completions for zsh' (#1584) from kenji/clan-core:enable-zsh-completions into main
Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/1584
2024-06-07 07:57:40 +00:00
a-kenji
02a015a1b6 clan: install shell completions for zsh 2024-06-06 23:20:54 +02:00
Jörg Thalheim
5c11a30b46 backup: add a way to stop services before restoring a state. 2024-06-06 17:30:35 +02:00
Jörg Thalheim
0dc3b9f056 postgresql: add backup and restore 2024-06-06 14:28:50 +02:00
Jörg Thalheim
c0d8aaf73a postgresql: add new method to create users and databases 2024-06-06 14:07:56 +02:00
Jörg Thalheim
2a0019457d matrix-synapse: create with utf-8 encoding 2024-06-06 14:07:56 +02:00
Jörg Thalheim
6dec2a9222 add postgresql backup hooks 2024-06-06 13:27:30 +02:00
Jörg Thalheim
f71295e640 fix running cli without arguments 2024-06-06 13:27:30 +02:00
Jörg Thalheim
c1aedc5bb8 matrix-enable: drop enable option 2024-06-06 13:27:30 +02:00
Jörg Thalheim
d6a9f6d3f9 change clan url to gitea archive url 2024-06-06 11:11:48 +02:00
Jörg Thalheim
ba6840d978 matrix-synapse: create database with right collation also when postgresql already exists #1108 2024-06-06 11:11:48 +02:00
kenji
86b08258dd Merge pull request 'syncthing-remove-newline' (#1581) from kenji/clan-core:syncthing-remove-newline into main
Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/1581
2024-06-06 08:34:08 +00:00
a-kenji
9ccff4ab2e syncthing: remove trailing newline 2024-06-06 08:34:08 +00:00
kenji
cf310be1c8 Merge pull request 'syncthing: update facts to new system' (#1580) from kenji/clan-core:syncthing/update into main
Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/1580
2024-06-06 08:21:31 +00:00
a-kenji
d8e80bb0c8 syncthing: update facts to new system 2024-06-06 08:21:31 +00:00
kenji
9206182e15 Merge pull request 'modules/syncthing-static-peers: init' (#1579) from kenji/clan-core:init/static-syncthing into main
Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/1579
2024-06-06 08:01:09 +00:00
a-kenji
d25eaa48d0 modules/syncthing-static-peers: init 2024-06-06 09:55:57 +02:00
kenji
5a2c91959a Merge pull request 'borbackup-static: impl' (#1577) from kenji/clan-core:modules/init/borbackup-static-impl into main
Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/1577
2024-06-05 21:17:24 +00:00
a-kenji
193d54153d borbackup-static: impl
Implements sane defaults implementing borgbackup

Fixes: #1551
2024-06-05 21:17:24 +00:00
kenji
510634bc04 Merge pull request 'zerotier-static-peers: filter out non existing Ip' (#1576) from kenji/clan-core:fix/static-zerotier into main
Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/1576
2024-06-05 17:52:59 +00:00
a-kenji
954f1fe605 zerotier-static-peers: filter out non existing Ip 2024-06-05 19:46:55 +02:00
kenji
764b53275f Merge pull request 'static-hosts: filter out non existing Ip's' (#1574) from kenji/clan-core:static-hosts-fix into main
Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/1574
2024-06-05 15:32:57 +00:00
a-kenji
44fc1be270 static-hosts: filter out non existing Ip's 2024-06-05 17:28:35 +02:00
clan-bot
5ef170020d Merge pull request 'clan-cli: Fix passwordstore clan facts generate requiring CTRL+D for every secret' (#1573) from Qubasa/clan-core:Qubasa-main into main 2024-06-05 12:37:02 +00:00
Qubasa
5f7099fc89 clan-cli: Fix passwordstore clan facts generate requiring CTRL+D for every secret 2024-06-05 14:31:45 +02:00
clan-bot
fe08fef015 Merge pull request 'clan-cli: temporary_home, set XDG_RUNTIME_DIR' (#1571) from Qubasa/clan-core:Qubasa-main into main 2024-06-05 11:39:14 +00:00
kenji
edb744f654 Merge pull request 'clan: improve machine completions' (#1572) from kenji/clan-core:clan/dynamic-completions into main
Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/1572
2024-06-05 11:38:50 +00:00
Qubasa
5ff5b46896 clan-cli: temporary_home, set XDG_RUNTIME_DIR 2024-06-05 13:34:17 +02:00
a-kenji
49e67ac46c clan: improve machine completions
In recent nix versions the `nix flake show` command busts the eval
cache, which made the function that used to be faster, slower.

On benchmarks the completion was around 180-200ms.
2024-06-05 13:32:23 +02:00
clan-bot
5024973896 Merge pull request 'Hsjobeki Main' (#1570) from hsjobeki/clan-core:hsjobeki-main into main 2024-06-05 10:14:53 +00:00
Johannes Kirschbauer
7dce6ad6c4 clan-app: switch default view to webui 2024-06-05 12:10:26 +02:00
clan-bot
779229a907 Merge pull request 'clan-app: rename clan-vm-manager' (#1569) from hsjobeki/clan-core:hsjobeki-main into main 2024-06-05 09:41:05 +00:00
kenji
af23ed027a Merge pull request 'clan: fix backup description' (#1567) from kenji/clan-core:clan/fix/backup-description into main
Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/1567
2024-06-05 09:40:01 +00:00
Johannes Kirschbauer
06412865bb clan-app: rename clan-vm-manager 2024-06-05 11:36:02 +02:00
a-kenji
fab311b53a clan: fix backup description 2024-06-05 11:35:04 +02:00
clan-bot
bc602dbf3c Merge pull request 'clan-app: Rename clan-vm-manager to clan-app.' (#1566) from hsjobeki/clan-core:hsjobeki-main into main 2024-06-05 09:31:22 +00:00
Johannes Kirschbauer
0fb207bb59 clan-app: rename clan-vm-manager 2024-06-05 11:24:59 +02:00
kenji
c751bc78d8 Merge pull request 'clan: add dynamic completions to clan backups' (#1565) from kenji/clan-core:clan/backups/dynamic-completions into main
Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/1565
2024-06-05 09:23:02 +00:00
a-kenji
c9038ad0b3 clan: add dynamic completions to clan backups providers 2024-06-05 09:23:02 +00:00
a-kenji
b4699cd8a3 clan: add dynamic completion function for backup providers 2024-06-05 09:23:02 +00:00
clan-bot
d0a87d8e3c Merge pull request 'web-ui: init type API checks' (#1564) from hsjobeki/clan-core:hsjobeki-main into main 2024-06-05 09:11:44 +00:00
Johannes Kirschbauer
78dbabf901 web-ui: init type API checks 2024-06-05 11:07:55 +02:00
clan-bot
ad771ae6a0 Merge pull request 'web-ui: remove type test method' (#1563) from hsjobeki/clan-core:hsjobeki-main into main 2024-06-05 07:58:08 +00:00
Johannes Kirschbauer
92bc2962b8 web-ui: remove type test method 2024-06-05 09:54:17 +02:00
clan-bot
836754d7ad Merge pull request 'hsjobeki-main' (#1562) from hsjobeki-main into main 2024-06-05 07:52:38 +00:00
Johannes Kirschbauer
6576290160 clan-api: wrap all api responses with error/success envelop type 2024-06-05 09:46:48 +02:00
Johannes Kirschbauer
db88e63148 clan-cli: create flake refactor to create clan 2024-06-05 09:45:47 +02:00
Johannes Kirschbauer
f2d2102127 clan-cli: refactor CmdOut to serializable dataclass 2024-06-05 09:44:44 +02:00
Johannes Kirschbauer
b9bf453731 clan-api: add support for generic types & annotated types 2024-06-05 09:43:45 +02:00
clan-bot
fb98247a8d Merge pull request 'demo.sh: fix tags' (#1561) from DavHau/clan-core:DavHau-dave into main 2024-06-04 22:27:39 +00:00
DavHau
4bd927cbcf demo.sh: fix tags 2024-06-04 15:23:39 -07:00
kenji
3725d5703e Merge pull request 'documentation(backups): make exampe more robust' (#1560) from kenji/clan-core:improve/backup-docs into main
Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/1560
2024-06-04 15:17:29 +00:00
a-kenji
bf0cc19c8f documentation(backups): make exampe more robust 2024-06-04 17:09:26 +02:00
kenji
8af137545f Merge pull request 'borgbackup: fixes error when specifying multiple backup directories' (#1559) from kenji/clan-core:improve/backup-docs into main
Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/1559
2024-06-04 14:54:39 +00:00
a-kenji
3d71ebcc5f borgbackup: try to fix 2024-06-04 16:27:53 +02:00
kenji
c6fcb833b3 Merge pull request 'clan/improve/dynamic-completions-config' (#1558) from kenji/clan-core:clan/improve/dynamic-completions-config into main
Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/1558
2024-06-04 13:57:18 +00:00
a-kenji
c926f23c09 clan: add dynamic completions to clan vms inspect 2024-06-04 15:50:50 +02:00
a-kenji
21ac1f7204 clan: add dynamic completions to clan vms run 2024-06-04 15:48:12 +02:00
a-kenji
05ff7bd261 clan: add dynamic completions to clan config 2024-06-04 15:44:39 +02:00
kenji
b2109351ff Merge pull request 'clan/improve/dynamic-completions' (#1557) from kenji/clan-core:clan/improve/dynamic-completions into main
Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/1557
2024-06-04 13:28:09 +00:00
a-kenji
0bd13727de clan: add dynamic-completions to clan secrets set 2024-06-04 15:21:00 +02:00
a-kenji
e1d6d04b48 clan: add dynamic completions to clan secrets machines 2024-06-04 15:02:35 +02:00
a-kenji
9dbbb6f2f6 clan: add dynamic completions for clan secrets import-sops 2024-06-04 13:40:24 +02:00
kenji
836170e5b6 Merge pull request 'clan: add dynamic completions to clan secrets {users,groups} and add completion functions' (#1556) from kenji/clan-core:add/completion/to-groups into main
Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/1556
2024-06-04 11:35:42 +00:00
a-kenji
d4fabff7f4 clan: add dynamic completions for secret groups 2024-06-04 13:30:38 +02:00
a-kenji
b21bef0b98 clan: add dynamic completions for clan secrets users 2024-06-04 13:30:38 +02:00
a-kenji
533ed97fc1 clan: add dynamic completion for clan secret groups 2024-06-04 13:30:38 +02:00
a-kenji
e7e5a1ded8 clan: add completion function for clan users 2024-06-04 13:30:11 +02:00
a-kenji
4e95030e55 clan: clan secrets groups add machine completions 2024-06-04 13:30:11 +02:00
kenji
b331a8c730 Merge pull request 'clan: fix help message' (#1553) from kenji/clan-core:add/completion/groups into main
Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/1553
2024-06-04 10:28:34 +00:00
a-kenji
2923051a12 clan: fix help message 2024-06-04 10:28:34 +00:00
kenji
fe96137c56 Merge pull request 'clan: add more machine completion functions to secrets' (#1552) from kenji/clan-core:add/completion/secret-subcommands into main
Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/1552
2024-06-04 09:30:02 +00:00
a-kenji
addc4de735 clan: add more machine completion functions to secrets 2024-06-04 11:07:24 +02:00
clan-bot
2460ba9b67 Merge pull request 'demo.sh: fix tag' (#1550) from DavHau/clan-core:DavHau-dave into main 2024-06-04 05:00:07 +00:00
DavHau
62be27ec62 demo.sh: fix tag 2024-06-03 21:55:09 -07:00
clan-bot
8515d41fe3 Merge pull request 'distro-packages: add test for deb installation' (#1549) from DavHau/clan-core:DavHau-dave into main 2024-06-04 04:17:21 +00:00
DavHau
d4d69d6990 distro-packages: add test for deb installation 2024-06-04 06:09:58 +02:00
kenji
0027c46313 Merge pull request 'zerotier-static-peers: use correct exclusion source' (#1548) from kenji/clan-core:modules/fix/static into main
Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/1548
2024-06-03 21:24:29 +00:00
a-kenji
ca2001040b zerotier-static-peers: use correct exclusion source 2024-06-03 22:53:44 +02:00
kenji
d6725100ac Merge pull request 'zerotier-static-peers: add guard condition' (#1547) from kenji/clan-core:modules/add/zerotier-guard into main
Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/1547
2024-06-03 20:47:03 +00:00
a-kenji
503ce29c84 zerotier-static-peers: add guard condition 2024-06-03 22:42:04 +02:00
kenji
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: https://git.clan.lol/clan/clan-core/pulls/1546
2024-06-03 19:55:12 +00:00
a-kenji
31eca9e8bc clan: add dyncamic completions for secrets 2024-06-03 21:47:14 +02:00
kenji
822afe08b5 Merge pull request 'clan: add dynamic machine completions to clan secrets subcommands' (#1545) from clan/secrets/add-completions into main
Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/1545
2024-06-03 15:42:37 +00:00
a-kenji
cfb78b0edb clan: add dynamic machine completions to clan secrets subcommands 2024-06-03 17:32:33 +02:00
kenji
65fd7d3efe Merge pull request 'clan: add dynamic completion to clan machines show' (#1544) from kenji-clan/machine-show/add-commpletion into main
Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/1544
2024-06-03 15:15:45 +00:00
a-kenji
e8241fb7c9 clan: add dynamic completion to clan machines show 2024-06-03 17:06:03 +02:00
kenji
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: https://git.clan.lol/clan/clan-core/pulls/1538
Reviewed-by: kenji <aks.kenji@protonmail.com>
2024-06-03 10:44:41 +00:00
Ingolf Wagner
f6fb52afbf clan.static-hosts: excludeHosts should be empty if topLevelDomain is defined. 2024-06-03 10:44:41 +00:00
clan-bot
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
lassulus
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
clan-bot
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
lassulus
da8a733899 clan_cli secrets_upload: fix permissions 2024-06-03 10:52:18 +02:00
clan-bot
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
clan-bot
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
Qubasa
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
clan-bot
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
Qubasa
d513f66170 clan-cli: Refactor machines/update.py to cmd.run 2024-06-02 10:00:23 +02:00
clan-bot
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
Qubasa
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
clan-bot
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
Qubasa
55f4dcc460 docs: Add meta tags for link preview and fix js loading issue. 2024-06-01 22:19:37 +02:00
hsjobeki
ef4a83f739 Merge pull request 'clan-core: add clan meta for ui usage' (#1529) from hsjobeki-main into main
Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/1529
2024-05-31 16:26:46 +00:00
Johannes Kirschbauer
133f2b705f clan-core: add template to impure tests 2024-05-31 16:26:46 +00:00
Johannes Kirschbauer
83fe58e003 clan-core: add clan meta for ui usage 2024-05-31 16:26:46 +00:00
clan-bot
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
Jörg Thalheim
788eae432a split list machines into show machine command 2024-05-31 16:56:09 +02:00
clan-bot
b7936c4ed2 Merge pull request 'upgrade nix in development to latest' (#1528) from nix-latest into main 2024-05-31 14:41:21 +00:00
Jörg Thalheim
750c8df003 upgrade nix in development to latest
Better error messages!!
2024-05-31 16:37:07 +02:00
clan-bot
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
Qubasa
90e25eeb76 Contributing.md: Fix incorrect formating. 2024-05-31 15:58:29 +02:00
clan-bot
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
a-kenji
bcccf301f0 clan: add dynamic completions for fact generation services 2024-05-31 15:21:07 +02:00
clan-bot
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
Qubasa
66fe5ec4fd Contributing.md: Explain merge-after-ci for externals. 2024-05-31 13:58:13 +02:00
clan-bot
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
a-kenji
d31aa7cf88 clan: add completion timeout as static 2024-05-31 13:06:46 +02:00
clan-bot
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
a-kenji
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
clan-bot
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
Qubasa
c91c90a2a6 tea-create-pr: Add automatic rebase and autostash 2024-05-30 23:59:27 +02:00
clan-bot
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
Qubasa
01a4748d6b tea-create-pr: Fix non working assignees label 2024-05-30 23:37:53 +02:00
Qubasa
a8762522c8 tea-create-pr: Better username detection 2024-05-30 23:29:59 +02:00
Qubasa
adef52a938 docs: Fix installer wrong indentation 2024-05-30 22:41:30 +02:00
clan-bot
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
Qubasa
f63e3618c2 tea-create-pr: Require fork and upstream branch 2024-05-30 22:25:25 +02:00
Qubasa
b18d7bfeac Change clan favicon to one without text 2024-05-30 21:59:48 +02:00
clan-bot
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
Johannes Kirschbauer
6999685bba Webview: css font and icon import transformation 2024-05-30 18:23:49 +02:00
kenji
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: https://git.clan.lol/clan/clan-core/pulls/1499
2024-05-29 18:40:15 +00:00
Ingolf Wagner
2caa837537 Add top level domain option for zerotier machines. 2024-05-29 18:40:15 +00:00
clan-bot
e1ddbf226a Merge pull request 'install.sh: improvements' (#1500) from DavHau-install-dev into main 2024-05-29 18:03:50 +00:00
DavHau
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
clan-bot
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
DavHau
ccadac4bb3 gui-installer: depend on git + ignore flake config 2024-05-29 17:42:44 +02:00
clan-bot
15b77f6b8a Merge pull request 'Webview: bootstrap layout' (#1497) from hsjobeki-main into main 2024-05-29 14:45:45 +00:00
Johannes Kirschbauer
9bf76037aa Webview: bootstrap layout 2024-05-29 16:40:54 +02:00
Mic92
d0d973b797 Merge pull request 'make config command read-only' (#1319) from config into main
Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/1319
2024-05-29 11:25:27 +00:00
Jörg Thalheim
c1e2bc9ea9 make config command read-only 2024-05-29 13:17:55 +02:00
clan-bot
0eef21e2ef Merge pull request 'Update flakes' (#1492) from pass-nix-options into main 2024-05-29 10:58:19 +00:00
Jörg Thalheim
461aa579c2 fmt more stuff 2024-05-29 12:51:43 +02:00
Jörg Thalheim
da442c47f6 drop non-compiling wayland-proxy-virtwl 2024-05-29 12:51:18 +02:00
Jörg Thalheim
491d37ea67 update flake 2024-05-29 12:51:04 +02:00
clan-bot
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
Jörg Thalheim
5c75a6490b fix offline build of flash command 2024-05-29 12:45:50 +02:00
Jörg Thalheim
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
clan-bot
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
clan-bot
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
Jörg Thalheim
f0f97baa65 drop global argparse flags
They get shadowed by subargparser options.
2024-05-29 10:21:35 +02:00
a-kenji
c2dc94507e clan: clarify default backend 2024-05-29 10:17:22 +02:00
clan-bot
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
Jörg Thalheim
5dcac604d1 backup cli: make sure we have a flake 2024-05-29 10:14:14 +02:00
Jörg Thalheim
96746b7c98 flash: add write-efi-boot-entries flag 2024-05-29 10:14:14 +02:00
Jörg Thalheim
2ae50b7398 allow to override nix options in update/install/flash commands 2024-05-29 10:14:14 +02:00
a-kenji
3c905c5072 clan: add epilog to facts subcommands 2024-05-29 10:10:23 +02:00
Jörg Thalheim
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
clan-bot
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
a-kenji
7078f09872 clan/docs.py: remove epilog from the reference overview 2024-05-28 20:01:48 +02:00
Mic92
1aa7808c02 Merge pull request 'Update Contributing guide to external developers' (#1484) from Qubasa/clan-core:main into main
Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/1484
2024-05-28 16:12:11 +00:00
Qubasa
ba8a51101d Update Contributing guide to external developers 2024-05-28 18:06:31 +02:00
clan-bot
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
DavHau
fe5fa6a85d packaging: package clan gui for many distros 2024-05-28 17:50:32 +02:00
clan-bot
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
DavHau
3b6483e819 packaging: package clan gui for many distros 2024-05-28 17:33:55 +02:00
clan-bot
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
Johannes Kirschbauer
567d979243 Docs: fix relative links to git.clan.lol 2024-05-28 17:14:16 +02:00
clan-bot
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
a-kenji
31cde90819 clan/docs.py: add epilog to reference docs
Fixes #1469
2024-05-28 17:08:46 +02:00
clan-bot
a77bf5bf21 Merge pull request 'Docs: use offline fonts' (#1480) from hsjobeki-main into main 2024-05-28 15:05:22 +00:00
Johannes Kirschbauer
4befa80eb8 Docs: use offline fonts 2024-05-28 16:58:59 +02:00
clan-bot
52584662a8 Merge pull request 'Fix typos' (#1477) from a-kenji-fix/typos into main 2024-05-28 13:02:19 +00:00
a-kenji
de147f63e9 Fix typos 2024-05-28 14:58:38 +02:00
clan-bot
96c33dec7a Merge pull request 'consistent rename cLAN -> Clan' (#1475) from rename into main 2024-05-28 11:38:57 +00:00
Jörg Thalheim
3c0b5f0867 drop deprecated mdDoc 2024-05-28 13:35:11 +02:00
clan-bot
c252f11c1f Merge pull request 'docs/secrets: improve chapter assigning access' (#1474) from DavHau-dave into main 2024-05-28 11:11:46 +00:00
DavHau
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
clan-bot
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
a-kenji
c34664429c clan: add descriptions for reference documentation 2024-05-28 11:37:32 +02:00
clan-bot
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
a-kenji
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
clan-bot
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
a-kenji
a0b0e1a0ac editor: improve nixpkgs option completions 2024-05-28 09:34:57 +02:00
Jörg Thalheim
e2d7e6e86c consistent rename cLAN -> Clan 2024-05-27 15:54:17 +02:00
465 changed files with 19481 additions and 3668 deletions

4
.envrc
View File

@@ -1,11 +1,13 @@
# shellcheck shell=bash
if ! has nix_direnv_version || ! nix_direnv_version 3.0.4; then
source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/3.0.4/direnvrc" "sha256-DzlYZ33mWF/Gs8DDeyjr8mnVmQGx7ASYqA5WlxwvBG4="
fi
watch_file .direnv/selected-shell
watch_file formatter.nix
if [ -e .direnv/selected-shell ]; then
use flake .#$(cat .direnv/selected-shell)
use flake ".#$(cat .direnv/selected-shell)"
else
use flake
fi

View File

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

5
.gitignore vendored
View File

@@ -1,8 +1,10 @@
.direnv
**/.nixos-test-history
***/.hypothesis
out.log
.coverage.*
**/qubeclan
pkgs/repro-hook
**/testdir
democlan
example_clan
@@ -13,6 +15,7 @@ nixos.qcow2
**/*.glade~
/docs/out
# dream2nix
.dream2nix
@@ -35,4 +38,4 @@ repo
# node
node_modules
dist
.webui
.webui

View File

@@ -19,3 +19,5 @@ Run a local server:
```shell-session
mkdocs serve
```
Open http://localhost:8000/ in your browser.

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,13 +14,13 @@ 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:
- **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
### Managing secrets
In the Clan ecosystem, security is paramount. Learn how to handle secrets effectively:
@@ -32,14 +32,14 @@ The Clan project thrives on community contributions. We welcome everyone to cont
- **Contribution Guidelines**: Make a meaningful impact by following the steps in [contributing](https://docs.clan.lol/contributing/contributing/)<!-- [contributing.md](docs/CONTRIBUTING.md) -->.
## Join the Revolution
## 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.
### Community and Support
### Community and support
Connect with us and the Clan community for support and discussion:
- [Matrix channel](https://matrix.to/#/#clan:lassul.us) for live discussions.
- [Matrix channel](https://matrix.to/#/#clan:clan.lol) for live discussions.
- IRC bridges (coming soon) for real-time chat support.

View File

@@ -27,7 +27,7 @@
self.clanModules.localbackup
self.clanModules.sshd
];
clan.networking.targetHost = "machine";
clan.core.networking.targetHost = "machine";
networking.hostName = "machine";
services.openssh.settings.UseDns = false;
@@ -68,17 +68,9 @@
};
};
};
clanCore.facts.secretStore = "vm";
clan.core.facts.secretStore = "vm";
environment.systemPackages = [
self.packages.${pkgs.system}.clan-cli
(pkgs.writeShellScriptBin "pre-restore-command" ''
touch /var/test-service/pre-restore-command
'')
(pkgs.writeShellScriptBin "post-restore-command" ''
touch /var/test-service/post-restore-command
'')
];
environment.systemPackages = [ self.packages.${pkgs.system}.clan-cli ];
environment.etc.install-closure.source = "${closureInfo}/store-paths";
nix.settings = {
substituters = lib.mkForce [ ];
@@ -87,11 +79,18 @@
flake-registry = pkgs.writeText "flake-registry" ''{"flakes":[],"version":2}'';
};
system.extraDependencies = dependencies;
clanCore.state.test-backups.folders = [ "/var/test-backups" ];
clan.core.state.test-backups.folders = [ "/var/test-backups" ];
clanCore.state.test-service = {
preRestoreCommand = "pre-restore-command";
postRestoreCommand = "post-restore-command";
clan.core.state.test-service = {
preBackupScript = ''
touch /var/test-service/pre-backup-command
'';
preRestoreScript = ''
touch /var/test-service/pre-restore-command
'';
postRestoreScript = ''
touch /var/test-service/post-restore-command
'';
folders = [ "/var/test-service" ];
};
clan.borgbackup.destinations.test-backup.repo = "borg@machine:.";
@@ -145,14 +144,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,17 +159,19 @@
## 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")
machine.succeed("test -f /var/test-service/pre-backup-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("rm -rf /var/test-backups/somefile /var/test-service/ && mkdir -p /var/test-service")
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")
machine.succeed("test -f /var/test-service/pre-backup-command")
'';
} { inherit pkgs self; };
};

View File

@@ -16,9 +16,9 @@
};
}
{
clanCore.machineName = "machine";
clanCore.clanDir = ./.;
clanCore.state.testState.folders = [ "/etc/state" ];
clan.core.machineName = "machine";
clan.core.clanDir = ./.;
clan.core.state.testState.folders = [ "/etc/state" ];
environment.etc.state.text = "hello world";
systemd.tmpfiles.settings."vmsecrets" = {
"/etc/secrets/borgbackup.ssh" = {
@@ -36,7 +36,7 @@
};
};
};
clanCore.facts.secretStore = "vm";
clan.core.facts.secretStore = "vm";
clan.borgbackup.destinations.test.repo = "borg@localhost:.";
}

View File

@@ -10,8 +10,8 @@
self.clanModules.deltachat
self.nixosModules.clanCore
{
clanCore.machineName = "machine";
clanCore.clanDir = ./.;
clan.core.machineName = "machine";
clan.core.clanDir = ./.;
}
];
};

View File

@@ -0,0 +1,22 @@
{ ... }:
{
perSystem =
{ self', pkgs, ... }:
{
checks.devshell =
pkgs.runCommand "check-devshell-not-depends-on-clan-cli"
{
exportReferencesGraph = [
"graph"
self'.devShells.default
];
}
''
if grep -q "${self'.packages.clan-cli}" ./graph; then
echo "devshell depends on clan-cli, which is not allowed";
exit 1;
fi
mkdir $out
'';
};
}

View File

@@ -1,10 +1,11 @@
{ self, ... }:
{
imports = [
./impure/flake-module.nix
./backups/flake-module.nix
./installation/flake-module.nix
./devshell/flake-module.nix
./flash/flake-module.nix
./impure/flake-module.nix
./installation/flake-module.nix
];
perSystem =
{
@@ -23,7 +24,7 @@
options =
(pkgs.nixos {
imports = [ self.nixosModules.clanCore ];
clanCore.clanDir = ./.;
clan.core.clanDir = ./.;
}).options;
warningsAreErrors = false;
};
@@ -40,10 +41,12 @@
secrets = import ./secrets nixosTestArgs;
container = import ./container nixosTestArgs;
deltachat = import ./deltachat nixosTestArgs;
matrix-synapse = import ./matrix-synapse nixosTestArgs;
zt-tcp-relay = import ./zt-tcp-relay nixosTestArgs;
borgbackup = import ./borgbackup nixosTestArgs;
matrix-synapse = import ./matrix-synapse nixosTestArgs;
mumble = import ./mumble nixosTestArgs;
syncthing = import ./syncthing nixosTestArgs;
zt-tcp-relay = import ./zt-tcp-relay nixosTestArgs;
postgresql = import ./postgresql nixosTestArgs;
wayland-proxy-virtwl = import ./wayland-proxy-virtwl nixosTestArgs;
};

View File

@@ -1,33 +1,50 @@
{ ... }:
{ self, ... }:
{
perSystem =
{ ... }:
{
# checks = pkgs.lib.mkIf (pkgs.stdenv.isLinux) {
# flash = (import ../lib/test-base.nix) {
# name = "flash";
# nodes.target = {
# virtualisation.emptyDiskImages = [ 4096 ];
# virtualisation.memorySize = 3000;
# environment.systemPackages = [ self.packages.${pkgs.system}.clan-cli ];
# environment.etc."install-closure".source = "${closureInfo}/store-paths";
nodes,
pkgs,
lib,
...
}:
let
dependencies = [
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
] ++ 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";
nodes.target = {
virtualisation.emptyDiskImages = [ 4096 ];
virtualisation.memorySize = 3000;
environment.systemPackages = [ self.packages.${pkgs.system}.clan-cli ];
environment.etc."install-closure".source = "${closureInfo}/store-paths";
# nix.settings = {
# substituters = lib.mkForce [ ];
# hashed-mirrors = null;
# connect-timeout = lib.mkForce 3;
# flake-registry = pkgs.writeText "flake-registry" ''{"flakes":[],"version":2}'';
# experimental-features = [
# "nix-command"
# "flakes"
# ];
# };
# };
# testScript = ''
# start_all()
# machine.succeed("clan --debug --flake ${../..} flash --yes --disk main /dev/vdb test_install_machine")
# '';
# } { inherit pkgs self; };
# };
nix.settings = {
substituters = lib.mkForce [ ];
hashed-mirrors = null;
connect-timeout = lib.mkForce 3;
flake-registry = pkgs.writeText "flake-registry" ''{"flakes":[],"version":2}'';
experimental-features = [
"nix-command"
"flakes"
];
};
};
testScript = ''
start_all()
machine.succeed("clan flash --debug --flake ${../..} --yes --disk main /dev/vdb test_install_machine")
'';
} { inherit pkgs self; };
};
};
}

View File

@@ -1,6 +1,11 @@
{
perSystem =
{ pkgs, lib, ... }:
{
pkgs,
lib,
self',
...
}:
{
# a script that executes all other checks
packages.impure-checks = pkgs.writeShellScriptBin "impure-checks" ''
@@ -10,14 +15,21 @@
unset CLAN_DIR
export PATH="${
lib.makeBinPath [
pkgs.gitMinimal
pkgs.nix
pkgs.rsync # needed to have rsync installed on the dummy ssh server
]
lib.makeBinPath (
[
pkgs.gitMinimal
pkgs.nix
pkgs.rsync # needed to have rsync installed on the dummy ssh server
]
++ self'.packages.clan-cli-full.runtimeDependencies
)
}"
ROOT=$(git rev-parse --show-toplevel)
cd "$ROOT/pkgs/clan-cli"
# this disables dynamic dependency loading in clan-cli
export CLAN_NO_DYNAMIC_DEPS=1
nix develop "$ROOT#clan-cli" -c bash -c "TMPDIR=/tmp python -m pytest -s -m impure ./tests $@"
'';
};

View File

@@ -1,9 +1,9 @@
{ self, lib, ... }:
{
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";
clan.core.networking.targetHost = "test_install_machine";
fileSystems."/".device = lib.mkDefault "/dev/vdb";
boot.loader.grub.device = lib.mkDefault "/dev/vdb";
imports = [ self.nixosModules.test_install_machine ];
};
@@ -12,7 +12,7 @@
{ lib, modulesPath, ... }:
{
imports = [
self.clanModules.disk-layouts
"${self}/nixosModules/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")
];
@@ -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

@@ -151,7 +151,7 @@ class Machine:
"""
# Always run command with shell opts
command = f"set -euo pipefail; {command}"
command = f"set -eo pipefail; source /etc/profile; set -u; {command}"
proc = subprocess.run(
[

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

@@ -4,26 +4,61 @@
name = "matrix-synapse";
nodes.machine =
{ self, lib, ... }:
{
config,
self,
lib,
...
}:
{
imports = [
self.clanModules.matrix-synapse
self.nixosModules.clanCore
{
clanCore.machineName = "machine";
clanCore.clanDir = ./.;
clan.matrix-synapse = {
enable = true;
domain = "clan.test";
};
}
{
# secret override
clanCore.facts.services.matrix-synapse.secret.synapse-registration_shared_secret.path = "${./synapse-registration_shared_secret}";
clan.core.machineName = "machine";
clan.core.clanDir = ./.;
services.nginx.virtualHosts."matrix.clan.test" = {
enableACME = lib.mkForce false;
forceSSL = lib.mkForce false;
};
clan.matrix-synapse.domain = "clan.test";
clan.matrix-synapse.users.admin.admin = true;
clan.matrix-synapse.users.someuser = { };
clan.core.facts.secretStore = "vm";
# because we use systemd-tmpfiles to copy the secrets, we need to a seperate systemd-tmpfiles call to provison them.
boot.postBootCommands = "${config.systemd.package}/bin/systemd-tmpfiles --create /etc/tmpfiles.d/00-vmsecrets.conf";
systemd.tmpfiles.settings."00-vmsecrets" = {
# run before 00-nixos.conf
"/etc/secrets" = {
d.mode = "0700";
z.mode = "0700";
};
"/etc/secrets/synapse-registration_shared_secret" = {
f.argument = "supersecret";
z = {
mode = "0400";
user = "root";
};
};
"/etc/secrets/matrix-password-admin" = {
f.argument = "matrix-password1";
z = {
mode = "0400";
user = "root";
};
};
"/etc/secrets/matrix-password-someuser" = {
f.argument = "matrix-password2";
z = {
mode = "0400";
user = "root";
};
};
};
}
];
};
@@ -32,6 +67,12 @@
machine.wait_for_unit("matrix-synapse")
machine.succeed("${pkgs.netcat}/bin/nc -z -v ::1 8008")
machine.succeed("${pkgs.curl}/bin/curl -Ssf -L http://localhost/_matrix/static/ -H 'Host: matrix.clan.test'")
machine.systemctl("restart matrix-synapse >&2") # check if user creation is idempotent
machine.execute("journalctl -u matrix-synapse --no-pager >&2")
machine.wait_for_unit("matrix-synapse")
machine.succeed("${pkgs.netcat}/bin/nc -z -v ::1 8008")
machine.succeed("${pkgs.curl}/bin/curl -Ssf -L http://localhost/_matrix/static/ -H 'Host: matrix.clan.test'")
'';
}
)

146
checks/mumble/default.nix Normal file
View File

@@ -0,0 +1,146 @@
(import ../lib/test-base.nix) (
{ ... }:
let
common =
{ self, pkgs, ... }:
{
imports = [
self.clanModules.mumble
self.nixosModules.clanCore
(self.inputs.nixpkgs + "/nixos/tests/common/x11.nix")
{
clan.core.clanDir = ./.;
environment.systemPackages = [ pkgs.killall ];
services.murmur.sslKey = "/etc/mumble-key";
services.murmur.sslCert = "/etc/mumble-cert";
clan.core.facts.services.mumble.secret."mumble-key".path = "/etc/mumble-key";
clan.core.facts.services.mumble.public."mumble-cert".path = "/etc/mumble-cert";
}
];
};
in
{
name = "mumble";
enableOCR = true;
nodes.peer1 =
{ ... }:
{
imports = [
common
{
clan.core.machineName = "peer1";
environment.etc = {
"mumble-key".source = ./peer_1/peer_1_test_key;
"mumble-cert".source = ./peer_1/peer_1_test_cert;
};
systemd.tmpfiles.settings."vmsecrets" = {
"/etc/secrets/mumble-key" = {
C.argument = "${./peer_1/peer_1_test_key}";
z = {
mode = "0400";
user = "murmur";
};
};
"/etc/secrets/mumble-cert" = {
C.argument = "${./peer_1/peer_1_test_cert}";
z = {
mode = "0400";
user = "murmur";
};
};
};
services.murmur.sslKey = "/etc/mumble-key";
services.murmur.sslCert = "/etc/mumble-cert";
clan.core.facts.services.mumble.secret."mumble-key".path = "/etc/mumble-key";
clan.core.facts.services.mumble.public."mumble-cert".path = "/etc/mumble-cert";
}
];
};
nodes.peer2 =
{ ... }:
{
imports = [
common
{
clan.core.machineName = "peer2";
environment.etc = {
"mumble-key".source = ./peer_2/peer_2_test_key;
"mumble-cert".source = ./peer_2/peer_2_test_cert;
};
systemd.tmpfiles.settings."vmsecrets" = {
"/etc/secrets/mumble-key" = {
C.argument = "${./peer_2/peer_2_test_key}";
z = {
mode = "0400";
user = "murmur";
};
};
"/etc/secrets/mumble-cert" = {
C.argument = "${./peer_2/peer_2_test_cert}";
z = {
mode = "0400";
user = "murmur";
};
};
};
}
];
};
testScript = ''
start_all()
with subtest("Waiting for x"):
peer1.wait_for_x()
peer2.wait_for_x()
with subtest("Waiting for murmur"):
peer1.wait_for_unit("murmur.service")
peer2.wait_for_unit("murmur.service")
with subtest("Starting Mumble"):
# starting mumble is blocking
peer1.execute("mumble >&2 &")
peer2.execute("mumble >&2 &")
with subtest("Wait for Mumble"):
peer1.wait_for_window(r"^Mumble$")
peer2.wait_for_window(r"^Mumble$")
with subtest("Wait for certificate creation"):
peer1.wait_for_window(r"^Mumble$")
peer1.sleep(3) # mumble is slow to register handlers
peer1.send_chars("\n")
peer1.send_chars("\n")
peer2.wait_for_window(r"^Mumble$")
peer2.sleep(3) # mumble is slow to register handlers
peer2.send_chars("\n")
peer2.send_chars("\n")
with subtest("Wait for server connect"):
peer1.wait_for_window(r"^Mumble Server Connect$")
peer2.wait_for_window(r"^Mumble Server Connect$")
with subtest("Check validity of server certificates"):
peer1.execute("killall .mumble-wrapped")
peer1.sleep(1)
peer1.execute("mumble mumble://peer2 >&2 &")
peer1.wait_for_window(r"^Mumble$")
peer1.sleep(3) # mumble is slow to register handlers
peer1.send_chars("\n")
peer1.send_chars("\n")
peer1.wait_for_text("Connected.")
peer2.execute("killall .mumble-wrapped")
peer2.sleep(1)
peer2.execute("mumble mumble://peer1 >&2 &")
peer2.wait_for_window(r"^Mumble$")
peer2.sleep(3) # mumble is slow to register handlers
peer2.send_chars("\n")
peer2.send_chars("\n")
peer2.wait_for_text("Connected.")
'';
}
)

View File

@@ -0,0 +1,22 @@
-----BEGIN CERTIFICATE-----
MIIDazCCAlOgAwIBAgIUCUjfNkF0CDhTKbO3nNczcsCW4qEwDQYJKoZIhvcNAQEL
BQAwRTELMAkGA1UEBhMCQVUxEzARBgNVBAgMClNvbWUtU3RhdGUxITAfBgNVBAoM
GEludGVybmV0IFdpZGdpdHMgUHR5IEx0ZDAeFw0yNDA2MjcwOTM2NDZaFw0yNDA3
MjcwOTM2NDZaMEUxCzAJBgNVBAYTAkFVMRMwEQYDVQQIDApTb21lLVN0YXRlMSEw
HwYDVQQKDBhJbnRlcm5ldCBXaWRnaXRzIFB0eSBMdGQwggEiMA0GCSqGSIb3DQEB
AQUAA4IBDwAwggEKAoIBAQDCcdZEJvXJIeOKO5pF5XUFvUeJtCCiwfWvWS662bxc
R/5MZucRLqfTNYo9aBv4NITw5kxZsTaaubmS4zSGQoTEAVzqzVdi3a/gNvsdVLb+
7CivpmweLllX/OGsTL0kHPEI+74AYiTBjXfdWV1Y5T1tuwc3G8ATrguQ33Uo5vvF
vcqsbTKcRZC0pB9O/nn4q03GsRdvlpaKakIhjMpRG/uZ3u7wtbyZ+WqjsjxZNfnY
aMyPoaipFqX1v+L7GKlOj2NpyEZFVVwa2ZqhVSYXyDfpAWQFznwKGzD5mjtcyKym
gnv/5LwrpH4Xj+JMt48hN+rPnu5vfXT8Y4KnID30OQW7AgMBAAGjUzBRMB0GA1Ud
DgQWBBQBBO8Wp975pAGioMjkaxANAVInfzAfBgNVHSMEGDAWgBQBBO8Wp975pAGi
oMjkaxANAVInfzAPBgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEBCwUAA4IBAQAg
F40MszTZXpR/A1z9B1CcXH47tNK67f8bCMR2dhvXODbpatwSihyxhQjtLb5R6kYH
5Yq/B4yrh303j0CXaobCQ4nQH7zI7fhViww+TzW7vDhgM7ueEyyXrqCXt6JY8avg
TuvIRtJSeWSQJ5aLNaYqmiwMf/tj9W3BMDpctGyLqu1WTSrbpYa9mA5Vudud70Yz
DgZ/aqHilB07cVNqzVYZzRZ56WJlTjGzVevRgnHZqPiZNVrU13H6gtWa3r8aV4Gj
i4F663eRAttj166cRgfl1QqpSG2IprNyV9UfuS2LlUaVNT3y0idawiJ4HhaA8pGB
ZqMUUkA4DSucb6xxEcTK
-----END CERTIFICATE-----

View File

@@ -0,0 +1 @@
AGE-SECRET-KEY-1UCXEUJH6JXF8LFKWFHDM4N9AQE2CCGQZGXLUNV4TKR5KY0KC8FDQ2TY4NX

View File

@@ -0,0 +1,14 @@
-----BEGIN CERTIFICATE-----
MIICHTCCAaKgAwIBAgIIT2gZuvqVFP0wCgYIKoZIzj0EAwIwSjESMBAGA1UEChMJ
U3luY3RoaW5nMSAwHgYDVQQLExdBdXRvbWF0aWNhbGx5IEdlbmVyYXRlZDESMBAG
A1UEAxMJc3luY3RoaW5nMB4XDTIzMTIwNjAwMDAwMFoXDTQzMTIwMTAwMDAwMFow
SjESMBAGA1UEChMJU3luY3RoaW5nMSAwHgYDVQQLExdBdXRvbWF0aWNhbGx5IEdl
bmVyYXRlZDESMBAGA1UEAxMJc3luY3RoaW5nMHYwEAYHKoZIzj0CAQYFK4EEACID
YgAEBAr1CsciwCa0vi7eC6xxuSGijY3txbjtsyFanec/fge4oJBD3rVpaLKFETb3
TvHHsuvblzElcP483MEVq6FMUoxwuL9CzTtpJrRhtwSmAs8AHLFu8irVn8sZjgkL
sXMho1UwUzAOBgNVHQ8BAf8EBAMCBaAwHQYDVR0lBBYwFAYIKwYBBQUHAwEGCCsG
AQUFBwMCMAwGA1UdEwEB/wQCMAAwFAYDVR0RBA0wC4IJc3luY3RoaW5nMAoGCCqG
SM49BAMCA2kAMGYCMQDbrtLgfcyMMIkNQn+PJe9DHYAqj8C47LQcWuIY/nekhOu0
aUfKctEAwyBtI60Y5zcCMQCEdgD/6CNBh7Qqq3z3CKPhlrpxHtCO5tNw17k0jfdH
haCwJInHZvZgclHk4EtFpTw=
-----END CERTIFICATE-----

View File

@@ -0,0 +1,6 @@
-----BEGIN EC PRIVATE KEY-----
MIGkAgEBBDA14Nqo17Xs/xRLGH2KLuyzjKp4eW9iWFobVNM93RZZbECT++W3XcQc
cEc5WVtiPmWgBwYFK4EEACKhZANiAAQECvUKxyLAJrS+Lt4LrHG5IaKNje3FuO2z
IVqd5z9+B7igkEPetWlosoURNvdO8cey69uXMSVw/jzcwRWroUxSjHC4v0LNO2km
tGG3BKYCzwAcsW7yKtWfyxmOCQuxcyE=
-----END EC PRIVATE KEY-----

View File

@@ -0,0 +1,22 @@
-----BEGIN CERTIFICATE-----
MIIDazCCAlOgAwIBAgIUfENbTtH5nr7giuawwQpDYqUpWJswDQYJKoZIhvcNAQEL
BQAwRTELMAkGA1UEBhMCQVUxEzARBgNVBAgMClNvbWUtU3RhdGUxITAfBgNVBAoM
GEludGVybmV0IFdpZGdpdHMgUHR5IEx0ZDAeFw0yNDA2MjcwOTQxNDNaFw0yNDA3
MjcwOTQxNDNaMEUxCzAJBgNVBAYTAkFVMRMwEQYDVQQIDApTb21lLVN0YXRlMSEw
HwYDVQQKDBhJbnRlcm5ldCBXaWRnaXRzIFB0eSBMdGQwggEiMA0GCSqGSIb3DQEB
AQUAA4IBDwAwggEKAoIBAQCfP6cZhCs9jOnWqyQP12vrOOxlBrWofYZFf9amUA24
AfE7oGcSfkylanmkxzvGqQkhgLAvkHZj/GEvHujKyy8PgcEGP+pwmsfWNQMvU0Dz
j3syjWOTi3eIC/3DoUnHlWCT2qCil/bjqxgU1l7fO/OXUlq5kyvIjln7Za4sUHun
ixe/m96Er6l8a4Mh2pxh2C5pkLCvulkQhjjGG+R6MccH8wwQwmLg5oVBkFEZrnRE
pnRKBI0DvA+wk1aJFAPOI4d8Q5T7o/MyxH3f8TYGHqbeMQFCKwusnlWPRtrNdaIc
gaLvSpR0LVlroXGu8tYmRpvHPByoKGDbgVvO0Bwx8fmRAgMBAAGjUzBRMB0GA1Ud
DgQWBBR7r+mQWNUZ0TpQNwrwjgxgngvOjTAfBgNVHSMEGDAWgBR7r+mQWNUZ0TpQ
NwrwjgxgngvOjTAPBgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEBCwUAA4IBAQCO
7B4s6uQEGE8jg3CQgy76oU/D8sazGcP8+/E4JLHSc0Nj49w4ztSpkOVk2HyEtzbm
uR3TreIw+SfqpbiOI/ivVNDbEBsb/vEeq7qPzDH1Bi72plHZNRVhNGGV5rd7ibga
TkfXHKPM9yt8ffffHHiu1ROvb8gg2B6JbQwboU4hvvmmorW7onyTFSYEzZVdNSpv
pUtKPldxYjTnLlbsJdXC4xyCC4PrJt2CC0n0jsWfICJ77LMxIxTODh8oZNjbPg6r
RdI7U/DsD+R072DjbIcrivvigotJM+jihzz5inZwbO8o0WQOHAbJLIG3C3BnRW3A
Ek4u3+HXZMl5a0LGJ76u
-----END CERTIFICATE-----

View File

@@ -0,0 +1,14 @@
-----BEGIN CERTIFICATE-----
MIICHjCCAaOgAwIBAgIJAKbMWefkf1rVMAoGCCqGSM49BAMCMEoxEjAQBgNVBAoT
CVN5bmN0aGluZzEgMB4GA1UECxMXQXV0b21hdGljYWxseSBHZW5lcmF0ZWQxEjAQ
BgNVBAMTCXN5bmN0aGluZzAeFw0yMzEyMDYwMDAwMDBaFw00MzEyMDEwMDAwMDBa
MEoxEjAQBgNVBAoTCVN5bmN0aGluZzEgMB4GA1UECxMXQXV0b21hdGljYWxseSBH
ZW5lcmF0ZWQxEjAQBgNVBAMTCXN5bmN0aGluZzB2MBAGByqGSM49AgEGBSuBBAAi
A2IABFZTMt4RfsfBue0va7QuNdjfXMI4HfZzJCEcG+b9MtV7FlDmwMKX5fgGykD9
FBbC7yiza3+xCobdMb5bakz1qYJ7nUFCv1mwSDo2eNM+/XE+rJmlre8NwkwGmvzl
h1uhyqNVMFMwDgYDVR0PAQH/BAQDAgWgMB0GA1UdJQQWMBQGCCsGAQUFBwMBBggr
BgEFBQcDAjAMBgNVHRMBAf8EAjAAMBQGA1UdEQQNMAuCCXN5bmN0aGluZzAKBggq
hkjOPQQDAgNpADBmAjEAwzhsroN6R4/quWeXj6dO5gt5CfSTLkLee6vrcuIP5i1U
rZvJ3OKQVmmGG6IWYe7iAjEAyuq3X2wznaqiw2YK3IDI4qVeYWpCUap0fwRNq7/x
4dC4k+BOzHcuJOwNBIY/bEuK
-----END CERTIFICATE-----

View File

@@ -0,0 +1,6 @@
-----BEGIN EC PRIVATE KEY-----
MIGkAgEBBDCXHGpvumKjjDRxB6SsjZOb7duw3w+rdlGQCJTIvRThLjD6zwjnyImi
7c3PD5nWtLqgBwYFK4EEACKhZANiAARWUzLeEX7HwbntL2u0LjXY31zCOB32cyQh
HBvm/TLVexZQ5sDCl+X4BspA/RQWwu8os2t/sQqG3TG+W2pM9amCe51BQr9ZsEg6
NnjTPv1xPqyZpa3vDcJMBpr85Ydboco=
-----END EC PRIVATE KEY-----

View File

@@ -0,0 +1 @@
AGE-SECRET-KEY-1UCXEUJH6JXF8LFKWFHDM4N9AQE2CCGQZGXLUNV4TKR5KY0KC8FDQ2TY4NX

View File

@@ -0,0 +1,22 @@
-----BEGIN CERTIFICATE-----
MIIDazCCAlOgAwIBAgIUCUjfNkF0CDhTKbO3nNczcsCW4qEwDQYJKoZIhvcNAQEL
BQAwRTELMAkGA1UEBhMCQVUxEzARBgNVBAgMClNvbWUtU3RhdGUxITAfBgNVBAoM
GEludGVybmV0IFdpZGdpdHMgUHR5IEx0ZDAeFw0yNDA2MjcwOTM2NDZaFw0yNDA3
MjcwOTM2NDZaMEUxCzAJBgNVBAYTAkFVMRMwEQYDVQQIDApTb21lLVN0YXRlMSEw
HwYDVQQKDBhJbnRlcm5ldCBXaWRnaXRzIFB0eSBMdGQwggEiMA0GCSqGSIb3DQEB
AQUAA4IBDwAwggEKAoIBAQDCcdZEJvXJIeOKO5pF5XUFvUeJtCCiwfWvWS662bxc
R/5MZucRLqfTNYo9aBv4NITw5kxZsTaaubmS4zSGQoTEAVzqzVdi3a/gNvsdVLb+
7CivpmweLllX/OGsTL0kHPEI+74AYiTBjXfdWV1Y5T1tuwc3G8ATrguQ33Uo5vvF
vcqsbTKcRZC0pB9O/nn4q03GsRdvlpaKakIhjMpRG/uZ3u7wtbyZ+WqjsjxZNfnY
aMyPoaipFqX1v+L7GKlOj2NpyEZFVVwa2ZqhVSYXyDfpAWQFznwKGzD5mjtcyKym
gnv/5LwrpH4Xj+JMt48hN+rPnu5vfXT8Y4KnID30OQW7AgMBAAGjUzBRMB0GA1Ud
DgQWBBQBBO8Wp975pAGioMjkaxANAVInfzAfBgNVHSMEGDAWgBQBBO8Wp975pAGi
oMjkaxANAVInfzAPBgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEBCwUAA4IBAQAg
F40MszTZXpR/A1z9B1CcXH47tNK67f8bCMR2dhvXODbpatwSihyxhQjtLb5R6kYH
5Yq/B4yrh303j0CXaobCQ4nQH7zI7fhViww+TzW7vDhgM7ueEyyXrqCXt6JY8avg
TuvIRtJSeWSQJ5aLNaYqmiwMf/tj9W3BMDpctGyLqu1WTSrbpYa9mA5Vudud70Yz
DgZ/aqHilB07cVNqzVYZzRZ56WJlTjGzVevRgnHZqPiZNVrU13H6gtWa3r8aV4Gj
i4F663eRAttj166cRgfl1QqpSG2IprNyV9UfuS2LlUaVNT3y0idawiJ4HhaA8pGB
ZqMUUkA4DSucb6xxEcTK
-----END CERTIFICATE-----

View File

@@ -0,0 +1,28 @@
-----BEGIN PRIVATE KEY-----
MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDCcdZEJvXJIeOK
O5pF5XUFvUeJtCCiwfWvWS662bxcR/5MZucRLqfTNYo9aBv4NITw5kxZsTaaubmS
4zSGQoTEAVzqzVdi3a/gNvsdVLb+7CivpmweLllX/OGsTL0kHPEI+74AYiTBjXfd
WV1Y5T1tuwc3G8ATrguQ33Uo5vvFvcqsbTKcRZC0pB9O/nn4q03GsRdvlpaKakIh
jMpRG/uZ3u7wtbyZ+WqjsjxZNfnYaMyPoaipFqX1v+L7GKlOj2NpyEZFVVwa2Zqh
VSYXyDfpAWQFznwKGzD5mjtcyKymgnv/5LwrpH4Xj+JMt48hN+rPnu5vfXT8Y4Kn
ID30OQW7AgMBAAECggEAGVKn+/Iy+kG+l2cRvV6XseqnoWhjA69M5swviMgIfuAl
Xx/boeI4mwoS+dJQKi/0zEbB1MB+gwIDB/0s/vs0vS4MQswBQG/skr+2TmiU+Hgb
CF0dIYUZv5rAbScFTumx/mCCqxwc+1QIMzyLKqOYL203EFc92ZJGEVT4th321haZ
8Wd+dllcYAb7BbEeBhCrTqRe9T3zt5reZgtZTquTF5hGm8EAyBp6rLjZK7dyZ9dd
gyIsDbWgPC9vkRc6x/eANn70hgDbYOuoXwAP/qIFnWLL1Zzy8LKUyOsSgQ91S3S3
Il4Lt6lEyU3+61MsCYss7jDoP/7REEjz5h6gfxlFSQKBgQD9u8nhHuwte4/d9VNU
rhSBW9h8IJzwPif/eS8vh9VaS2SjR2dDCcHg6rGYKnexeEzUcx56aQMA+p3nRJwy
Uwnx5BfEWs9FO6yPR8VEI0a2sBp+hoWKJX/Lvat+QCs6IFuGmlQpczD7/RYAkhG4
mwyt/ymqzjukb9mFaeYIltOfPwKBgQDELnkH1ChTUH5u3HgDoelFbzR18okz6dxH
urMbfZMAl8W5h2zAvHsAX5qxyHHankOUsiH2y3BrAgqQtTuIA2a5W7j+yHBkYiEZ
EUNeI9YNA0KU+wwZpVVvRGUsRB5SUBo5LlcSYmX/V32f0oU5Np44i0vjl3Ju8esx
2MLfj1A2hQKBgQDCxtZZZ0h8Pb8Z7wpSFfQNvXi5CLwQvFYuClQLk6VXVErkAJsn
XiUjyGYeXnNVm/i2mcyKwXQZ20k90HBrPU2ED8mi5Ob5ya5Uqw6mmMHe2d7sw81d
WB37RBWSrCXC0DYSZQQ4cYHn3sd2Fqtd4EBijV7qDLjCKU582OdKLqYzNwKBgH31
UKQkJZgIkIThbPT4GewI0GgCRvFb76DmUGUQJTg2Oi86siq1WUwOFiabie5RuxZX
oNLyH8W008/BbO2RMX1FVOvRCciJ8LJFkTl6TM6iDzfUUBqPOuFryoG3Yrh60btw
81rMbqyZIgFhi0QGu2OWnC0Oadyt2tJwV/5t55R5AoGBAPspZttDmOzVkAJDSn9Z
iByYt1KmwBQ6l7LpFg33a7ds9zWqW4+i6r0PzXvSewf/z69L0cAywSk5CaJJjDso
dTlNMqwux01wd6V+nQGR871xnsOg+qzgJ565TJZelWgRmNRUooi4DMp5POJA33xp
rqAISUfW0w2S+q7/5Lm0QiJE
-----END PRIVATE KEY-----

View File

@@ -0,0 +1,22 @@
-----BEGIN CERTIFICATE-----
MIIDazCCAlOgAwIBAgIUfENbTtH5nr7giuawwQpDYqUpWJswDQYJKoZIhvcNAQEL
BQAwRTELMAkGA1UEBhMCQVUxEzARBgNVBAgMClNvbWUtU3RhdGUxITAfBgNVBAoM
GEludGVybmV0IFdpZGdpdHMgUHR5IEx0ZDAeFw0yNDA2MjcwOTQxNDNaFw0yNDA3
MjcwOTQxNDNaMEUxCzAJBgNVBAYTAkFVMRMwEQYDVQQIDApTb21lLVN0YXRlMSEw
HwYDVQQKDBhJbnRlcm5ldCBXaWRnaXRzIFB0eSBMdGQwggEiMA0GCSqGSIb3DQEB
AQUAA4IBDwAwggEKAoIBAQCfP6cZhCs9jOnWqyQP12vrOOxlBrWofYZFf9amUA24
AfE7oGcSfkylanmkxzvGqQkhgLAvkHZj/GEvHujKyy8PgcEGP+pwmsfWNQMvU0Dz
j3syjWOTi3eIC/3DoUnHlWCT2qCil/bjqxgU1l7fO/OXUlq5kyvIjln7Za4sUHun
ixe/m96Er6l8a4Mh2pxh2C5pkLCvulkQhjjGG+R6MccH8wwQwmLg5oVBkFEZrnRE
pnRKBI0DvA+wk1aJFAPOI4d8Q5T7o/MyxH3f8TYGHqbeMQFCKwusnlWPRtrNdaIc
gaLvSpR0LVlroXGu8tYmRpvHPByoKGDbgVvO0Bwx8fmRAgMBAAGjUzBRMB0GA1Ud
DgQWBBR7r+mQWNUZ0TpQNwrwjgxgngvOjTAfBgNVHSMEGDAWgBR7r+mQWNUZ0TpQ
NwrwjgxgngvOjTAPBgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEBCwUAA4IBAQCO
7B4s6uQEGE8jg3CQgy76oU/D8sazGcP8+/E4JLHSc0Nj49w4ztSpkOVk2HyEtzbm
uR3TreIw+SfqpbiOI/ivVNDbEBsb/vEeq7qPzDH1Bi72plHZNRVhNGGV5rd7ibga
TkfXHKPM9yt8ffffHHiu1ROvb8gg2B6JbQwboU4hvvmmorW7onyTFSYEzZVdNSpv
pUtKPldxYjTnLlbsJdXC4xyCC4PrJt2CC0n0jsWfICJ77LMxIxTODh8oZNjbPg6r
RdI7U/DsD+R072DjbIcrivvigotJM+jihzz5inZwbO8o0WQOHAbJLIG3C3BnRW3A
Ek4u3+HXZMl5a0LGJ76u
-----END CERTIFICATE-----

View File

@@ -0,0 +1,28 @@
-----BEGIN PRIVATE KEY-----
MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCfP6cZhCs9jOnW
qyQP12vrOOxlBrWofYZFf9amUA24AfE7oGcSfkylanmkxzvGqQkhgLAvkHZj/GEv
HujKyy8PgcEGP+pwmsfWNQMvU0Dzj3syjWOTi3eIC/3DoUnHlWCT2qCil/bjqxgU
1l7fO/OXUlq5kyvIjln7Za4sUHunixe/m96Er6l8a4Mh2pxh2C5pkLCvulkQhjjG
G+R6MccH8wwQwmLg5oVBkFEZrnREpnRKBI0DvA+wk1aJFAPOI4d8Q5T7o/MyxH3f
8TYGHqbeMQFCKwusnlWPRtrNdaIcgaLvSpR0LVlroXGu8tYmRpvHPByoKGDbgVvO
0Bwx8fmRAgMBAAECggEACAkjOnNj5zA0IIP0RuRc6rqtmw9ynTTwUJN51lyVxKI8
dQDMEq/S2En+J2VyS7z92/XtbgkBIFx83u7VWl5UWpj2j4UsJFB7IwD7zyiJT4D+
+3cM/kX8Wx4XyQZbfbm47N0MXAgFCkn45hxHH0acLReXwmN9wxoDyl7AIjZRdwvG
Qq0rnOnIc8kkkew7L6AiFwQS8b77eyzua3d6moKXN9hU/kfiJ6YUFG/WLe0pmQA1
HbF27YghfeLnYUt50oDuX6jF6CzQhflchWVq/wn8/cxEpg/RMicWE8ulrTk7o27l
JwCrHrhYEBsPuZO4mxX/DHrAMmhTeFjLaV5bQlz0PQKBgQDgRPSOEixYnKz9iPs/
EDTlji5LA3Rm6TytRCNsjYY6Trw60KcvYqwyDUCiEjruvOQ9mqgBiQm1VHSalrG3
RcbVfpEMouyZbEwmTjS8KdOi5x4Z6AX+4yWDN31jX3b8sktgbxV/HRdg3sA3q7MJ
vExTUuoXg57W+FepIZ+XlhSoQwKBgQC1x6UMAlAeW45/yUUm/LFRcCgb/bdCQx+e
hSb8w3jdvVoNWgx1j7RsjjFKaZUnseK3qQvVfCm4Qjvlz6MpKDxslaUYuR162Ku0
e153z/xc7XRoXyPyPLdGZFlWii30jirB7ZqPdyz6mwlWwqdImNerbUqdFt9R8bId
pYsyHB5zmwKBgBjYCq9iW/9E+/TqI8sMpI95fK9app5v4AThs3rnAqOa7Ucmrh6V
s7Wnui06D8U6r54Tb+EbqTOpM3Gcl/tRg4FLEA5yTfuA/76Ok1D04Tj+mVsNVPyz
dQhgMUe835WGusroA12df2V/x5NjNeYyMdJZMQ2ByyrNQAjAbMmCGq+5AoGBAIj8
ERFysMOfxUvg9b7CkDFJrsAhOzew86P2vYGfIHchGTqUkG0LRTDFGrnzxNXsBGjY
+DUB40Kajx7IkTETxC0jvA1ceq23l/VjPrZVQt0YiC+a+rCyNn7SYkyHxsfTVr9b
ea0BZyDXMntyJrPbkjL6Ik8tDE9pLwuOU84ISJ5fAoGAZ2+Ams/VhdZj/wpRpMky
K4jtS4nzbCmJzzTa6vdVV7Kjer5kFxSFFqMrS/FtJ/RxHeHvxdze9dfGu9jIdTKK
vSzbyQdHFfZgRkmAKfcoN9u567z7Oc74AQ9UgFEGdEVFQUbfWOevmr8KIPt8nDQK
J9HuVfILi1kH0jzDd/64TvA=
-----END PRIVATE KEY-----

View File

@@ -0,0 +1,72 @@
(import ../lib/container-test.nix) ({
name = "postgresql";
nodes.machine =
{ self, config, ... }:
{
imports = [
self.nixosModules.clanCore
self.clanModules.postgresql
self.clanModules.localbackup
];
clan.postgresql.users.test = { };
clan.postgresql.databases.test.create.options.OWNER = "test";
clan.postgresql.databases.test.restore.stopOnRestore = [ "sample-service" ];
clan.localbackup.targets.hdd.directory = "/mnt/external-disk";
systemd.services.sample-service = {
wantedBy = [ "multi-user.target" ];
script = ''
while true; do
echo "Hello, world!"
sleep 5
done
'';
};
environment.systemPackages = [ config.services.postgresql.package ];
};
testScript =
{ nodes, ... }:
''
start_all()
machine.wait_for_unit("postgresql")
machine.wait_for_unit("sample-service")
# Create a test table
machine.succeed("runuser -u postgres -- /run/current-system/sw/bin/psql -c 'CREATE TABLE test (id serial PRIMARY KEY);' test")
machine.succeed("/run/current-system/sw/bin/localbackup-create >&2")
timestamp_before = int(machine.succeed("systemctl show --property=ExecMainStartTimestampMonotonic sample-service | cut -d= -f2").strip())
machine.succeed("test -e /mnt/external-disk/snapshot.0/machine/var/backup/postgres/test/pg-dump || { echo 'pg-dump not found'; exit 1; }")
machine.succeed("runuser -u postgres -- /run/current-system/sw/bin/psql -d test -c 'INSERT INTO test DEFAULT VALUES;'")
machine.succeed("runuser -u postgres -- /run/current-system/sw/bin/psql -d test -c 'DROP TABLE test;'")
machine.succeed("test -e /var/backup/postgres/test/pg-dump || { echo 'pg-dump not found'; exit 1; }")
machine.succeed("rm -rf /var/backup/postgres")
machine.succeed("NAME=/mnt/external-disk/snapshot.0 FOLDERS=/var/backup/postgres/test /run/current-system/sw/bin/localbackup-restore >&2")
machine.succeed("test -e /var/backup/postgres/test/pg-dump || { echo 'pg-dump not found'; exit 1; }")
machine.succeed("""
set -x
${nodes.machine.clan.core.state.test.postRestoreCommand}
""")
machine.succeed("runuser -u postgres -- /run/current-system/sw/bin/psql -l >&2")
machine.succeed("runuser -u postgres -- /run/current-system/sw/bin/psql -d test -c '\dt' >&2")
timestamp_after = int(machine.succeed("systemctl show --property=ExecMainStartTimestampMonotonic sample-service | cut -d= -f2").strip())
assert timestamp_before < timestamp_after, f"{timestamp_before} >= {timestamp_after}: expected sample-service to be restarted after restore"
# Check that the table is still there
machine.succeed("runuser -u postgres -- /run/current-system/sw/bin/psql -d test -c 'SELECT * FROM test;'")
output = machine.succeed("runuser -u postgres -- /run/current-system/sw/bin/psql --csv -c \"SELECT datdba::regrole FROM pg_database WHERE datname = 'test'\"")
owner = output.split("\n")[1]
assert owner == "test", f"Expected database owner to be 'test', got '{owner}'"
# check if restore works if the database does not exist
machine.succeed("runuser -u postgres -- dropdb test")
machine.succeed("${nodes.machine.clan.core.state.test.postRestoreCommand}")
machine.succeed("runuser -u postgres -- /run/current-system/sw/bin/psql -d test -c '\dt' >&2")
'';
})

View File

@@ -10,8 +10,8 @@
environment.etc."group-secret".source = config.sops.secrets.group-secret.path;
sops.age.keyFile = "/etc/privkey.age";
clanCore.clanDir = "${./.}";
clanCore.machineName = "machine";
clan.core.clanDir = "${./.}";
clan.core.machineName = "machine";
networking.hostName = "machine";
};

View File

@@ -1,4 +1,4 @@
{
"publickey": "age15x8u838dwqflr3t6csf4tlghxm4tx77y379ncqxav7y2n8qp7yzqgrwt00",
"type": "age"
}
}

View File

@@ -1,4 +1,4 @@
{
"publickey": "age15x8u838dwqflr3t6csf4tlghxm4tx77y379ncqxav7y2n8qp7yzqgrwt00",
"type": "age"
}
}

View File

@@ -12,14 +12,14 @@
self.clanModules.syncthing
self.nixosModules.clanCore
{
clanCore.machineName = "introducer";
clanCore.clanDir = ./.;
clan.core.machineName = "introducer";
clan.core.clanDir = ./.;
environment.etc = {
"syncthing.pam".source = ./introducer/introducer_test_cert;
"syncthing.key".source = ./introducer/introducer_test_key;
"syncthing.api".source = ./introducer/introducer_test_api;
};
clanCore.facts.services.syncthing.secret."syncthing.api".path = "/etc/syncthing.api";
clan.core.facts.services.syncthing.secret."syncthing.api".path = "/etc/syncthing.api";
services.syncthing.cert = "/etc/syncthing.pam";
services.syncthing.key = "/etc/syncthing.key";
# Doesn't test zerotier!
@@ -53,8 +53,8 @@
self.clanModules.syncthing
self.nixosModules.clanCore
{
clanCore.machineName = "peer1";
clanCore.clanDir = ./.;
clan.core.machineName = "peer1";
clan.core.clanDir = ./.;
clan.syncthing.introducer = lib.strings.removeSuffix "\n" (
builtins.readFile ./introducer/introducer_device_id
);
@@ -75,8 +75,8 @@
self.clanModules.syncthing
self.nixosModules.clanCore
{
clanCore.machineName = "peer2";
clanCore.clanDir = ./.;
clan.core.machineName = "peer2";
clan.core.clanDir = ./.;
clan.syncthing.introducer = lib.strings.removeSuffix "\n" (
builtins.readFile ./introducer/introducer_device_id
);

View File

@@ -14,8 +14,8 @@ import ../lib/test-base.nix (
imports = [
self.nixosModules.clanCore
{
clanCore.machineName = "machine";
clanCore.clanDir = ./.;
clan.core.machineName = "machine";
clan.core.clanDir = ./.;
}
];
services.wayland-proxy-virtwl.enable = true;

View File

@@ -10,8 +10,8 @@
self.nixosModules.clanCore
self.clanModules.zt-tcp-relay
{
clanCore.machineName = "machine";
clanCore.clanDir = ./.;
clan.core.machineName = "machine";
clan.core.clanDir = ./.;
}
];
};

View File

@@ -0,0 +1,11 @@
---
description = "Statically configure borgbackup with sane defaults."
---
This module implements the `borgbackup` backend and implements sane defaults
for backup management through `borgbackup` for members of the clan.
Configure target machines where the backups should be sent to through `targets`.
Configure machines that should be backuped either through `includeMachines`
which will exclusively add the included machines to be backuped, or through
`excludeMachines`, which will add every machine except the excluded machine to the backup.

View File

@@ -0,0 +1,101 @@
{ lib, config, ... }:
let
clanDir = config.clan.core.clanDir;
machineDir = clanDir + "/machines/";
in
lib.warn "This module is deprecated use the service via the inventory interface instead." {
imports = [ ../borgbackup ];
options.clan.borgbackup-static = {
excludeMachines = lib.mkOption {
type = lib.types.listOf lib.types.str;
example = [ config.clan.core.machineName ];
default = [ ];
description = ''
Machines that should not be backuped.
Mutually exclusive with includeMachines.
If this is not empty, every other machine except the targets in the clan will be backuped by this module.
If includeMachines is set, only the included machines will be backuped.
'';
};
includeMachines = lib.mkOption {
type = lib.types.listOf lib.types.str;
example = [ config.clan.core.machineName ];
default = [ ];
description = ''
Machines that should be backuped.
Mutually exclusive with excludeMachines.
'';
};
targets = lib.mkOption {
type = lib.types.listOf lib.types.str;
default = [ ];
description = ''
Machines that should act as target machines for backups.
'';
};
};
config.services.borgbackup.repos =
let
machines = builtins.readDir machineDir;
borgbackupIpMachinePath = machines: machineDir + machines + "/facts/borgbackup.ssh.pub";
filteredMachines =
if ((builtins.length config.clan.borgbackup-static.includeMachines) != 0) then
lib.filterAttrs (name: _: (lib.elem name config.clan.borgbackup-static.includeMachines)) machines
else
lib.filterAttrs (name: _: !(lib.elem name config.clan.borgbackup-static.excludeMachines)) machines;
machinesMaybeKey = lib.mapAttrsToList (
machine: _:
let
fullPath = borgbackupIpMachinePath machine;
in
if builtins.pathExists fullPath then machine else null
) filteredMachines;
machinesWithKey = lib.filter (x: x != null) machinesMaybeKey;
hosts = builtins.map (machine: {
name = machine;
value = {
path = "/var/lib/borgbackup/${machine}";
authorizedKeys = [ (builtins.readFile (borgbackupIpMachinePath machine)) ];
};
}) machinesWithKey;
in
lib.mkIf
(builtins.any (
target: target == config.clan.core.machineName
) config.clan.borgbackup-static.targets)
(if (builtins.listToAttrs hosts) != null then builtins.listToAttrs hosts else { });
config.clan.borgbackup.destinations =
let
destinations = builtins.map (d: {
name = d;
value = {
repo = "borg@${d}:/var/lib/borgbackup/${config.clan.core.machineName}";
};
}) config.clan.borgbackup-static.targets;
in
lib.mkIf (builtins.any (
target: target == config.clan.core.machineName
) config.clan.borgbackup-static.includeMachines) (builtins.listToAttrs destinations);
config.assertions = [
{
assertion =
!(
((builtins.length config.clan.borgbackup-static.excludeMachines) != 0)
&& ((builtins.length config.clan.borgbackup-static.includeMachines) != 0)
);
message = ''
The options:
config.clan.borgbackup-static.excludeMachines = [${builtins.toString config.clan.borgbackup-static.excludeMachines}]
and
config.clan.borgbackup-static.includeMachines = [${builtins.toString config.clan.borgbackup-static.includeMachines}]
are mutually exclusive.
Use excludeMachines to exclude certain machines and backup the other clan machines.
Use include machines to only backup certain machines.
'';
}
];
}

View File

@@ -1,2 +1,13 @@
Efficient, deduplicating backup program with optional compression and secure encryption.
---
---
description = "Efficient, deduplicating backup program with optional compression and secure encryption."
categories = ["backup"]
---
BorgBackup (short: Borg) gives you:
- Space efficient storage of backups.
- Secure, authenticated encryption.
- Compression: lz4, zstd, zlib, lzma or none.
- Mountable backups with FUSE.
- Easy installation on multiple platforms: Linux, macOS, BSD, ...
- Free software (BSD license).
- Backed by a large and active open source community.

View File

@@ -6,8 +6,73 @@
}:
let
cfg = config.clan.borgbackup;
preBackupScript = ''
declare -A preCommandErrors
${lib.concatMapStringsSep "\n" (
state:
lib.optionalString (state.preBackupCommand != null) ''
echo "Running pre-backup command for ${state.name}"
if ! /run/current-system/sw/bin/${state.preBackupCommand}; then
preCommandErrors["${state.name}"]=1
fi
''
) (lib.attrValues config.clan.core.state)}
if [[ ''${#preCommandErrors[@]} -gt 0 ]]; then
echo "pre-backup commands failed for the following services:"
for state in "''${!preCommandErrors[@]}"; do
echo " $state"
done
exit 1
fi
'';
in
# Each .nix file in the roles directory is a role
# TODO: Helper function to set available roles within module meta.
# roles =
# if builtins.pathExists ./roles then
# lib.pipe ./roles [
# builtins.readDir
# (lib.filterAttrs (_n: v: v == "regular"))
# lib.attrNames
# (map (fileName: lib.removeSuffix ".nix" fileName))
# ]
# else
# null;
# TODO: make this an interface of every module
# Maybe load from readme.md
# metaInfoOption = lib.mkOption {
# readOnly = true;
# description = ''
# Meta is used to retrieve information about this module.
# - `availableRoles` is a list of roles that can be assigned via the inventory.
# - `category` is used to group services in the clan marketplace.
# - `description` is a short description of the service for the clan marketplace.
# '';
# default = {
# description = "Borgbackup is a backup program. Optionally, it supports compression and authenticated encryption.";
# availableRoles = roles;
# category = "backup";
# };
# type = lib.types.submodule {
# options = {
# description = lib.mkOption { type = lib.types.str; };
# availableRoles = lib.mkOption { type = lib.types.nullOr (lib.types.listOf lib.types.str); };
# category = lib.mkOption {
# description = "A category for the service. This is used to group services in the clan ui";
# type = lib.types.enum [
# "backup"
# "network"
# ];
# };
# };
# };
# };
{
# options.clan.borgbackup.meta = metaInfoOption;
options.clan.borgbackup.destinations = lib.mkOption {
type = lib.types.attrsOf (
lib.types.submodule (
@@ -26,9 +91,9 @@ in
rsh = lib.mkOption {
type = lib.types.str;
default = "ssh -i ${
config.clanCore.facts.services.borgbackup.secret."borgbackup.ssh".path
} -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null";
defaultText = "ssh -i \${config.clanCore.facts.services.borgbackup.secret.\"borgbackup.ssh\".path} -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null";
config.clan.core.facts.services.borgbackup.secret."borgbackup.ssh".path
} -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o IdentitiesOnly=Yes";
defaultText = "ssh -i \${config.clan.core.facts.services.borgbackup.secret.\"borgbackup.ssh\".path} -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null";
description = "the rsh to use for the backup";
};
};
@@ -41,6 +106,16 @@ in
'';
};
options.clan.borgbackup.exclude = lib.mkOption {
type = lib.types.listOf lib.types.str;
example = [ "*.pyc" ];
default = [ ];
description = ''
Directories/Files to exclude from the backup.
Use * as a wildcard.
'';
};
imports = [
(lib.mkRemovedOptionModule [
"clan"
@@ -50,21 +125,30 @@ in
];
config = lib.mkIf (cfg.destinations != { }) {
systemd.services = lib.mapAttrs' (
_: dest:
lib.nameValuePair "borgbackup-job-${dest.name}" {
# since borgbackup mounts the system read-only, we need to run in a ExecStartPre script, so we can generate additional files.
serviceConfig.ExecStartPre = [
''+${pkgs.writeShellScript "borgbackup-job-${dest.name}-pre-backup-commands" preBackupScript}''
];
}
) cfg.destinations;
services.borgbackup.jobs = lib.mapAttrs (_: dest: {
paths = lib.flatten (map (state: state.folders) (lib.attrValues config.clanCore.state));
exclude = [ "*.pyc" ];
paths = lib.unique (
lib.flatten (map (state: state.folders) (lib.attrValues config.clan.core.state))
);
exclude = cfg.exclude;
repo = dest.repo;
environment.BORG_RSH = dest.rsh;
compression = "auto,zstd";
startAt = "*-*-* 01:00:00";
persistentTimer = true;
preHook = ''
set -x
'';
encryption = {
mode = "repokey";
passCommand = "cat ${config.clanCore.facts.services.borgbackup.secret."borgbackup.repokey".path}";
passCommand = "cat ${config.clan.core.facts.services.borgbackup.secret."borgbackup.repokey".path}";
};
prune.keep = {
@@ -75,7 +159,7 @@ in
};
}) cfg.destinations;
clanCore.facts.services.borgbackup = {
clan.core.facts.services.borgbackup = {
public."borgbackup.ssh.pub" = { };
secret."borgbackup.ssh" = { };
secret."borgbackup.repokey" = { };
@@ -111,7 +195,7 @@ in
(pkgs.writeShellScriptBin "borgbackup-restore" ''
set -efux
cd /
IFS=';' read -ra FOLDER <<< "$FOLDERS"
IFS=':' read -ra FOLDER <<< "$FOLDERS"
job_name=$(echo "$NAME" | ${pkgs.gawk}/bin/awk -F'::' '{print $1}')
backup_name=''${NAME#"$job_name"::}
if ! command -v borg-job-"$job_name" &> /dev/null; then
@@ -122,7 +206,7 @@ in
'')
];
clanCore.backups.providers.borgbackup = {
clan.core.backups.providers.borgbackup = {
list = "borgbackup-list";
create = "borgbackup-create";
restore = "borgbackup-restore";

View File

@@ -0,0 +1,30 @@
{ config, lib, ... }:
let
instances = config.clan.inventory.services.borgbackup;
# roles = { ${role_name} :: { machines :: [string] } }
allServers = lib.foldlAttrs (
acc: _instanceName: instanceConfig:
acc
++ (
if builtins.elem machineName instanceConfig.roles.client.machines then
instanceConfig.roles.server.machines
else
[ ]
)
) [ ] instances;
inherit (config.clan.core) machineName;
in
{
config.clan.borgbackup.destinations =
let
destinations = builtins.map (serverName: {
name = serverName;
value = {
repo = "borg@${serverName}:/var/lib/borgbackup/${machineName}";
};
}) allServers;
in
(builtins.listToAttrs destinations);
}

View File

@@ -0,0 +1,51 @@
{ config, lib, ... }:
let
clanDir = config.clan.core.clanDir;
machineDir = clanDir + "/machines/";
inherit (config.clan.core) machineName;
instances = config.clan.inventory.services.borgbackup;
# roles = { ${role_name} :: { machines :: [string] } }
allClients = lib.foldlAttrs (
acc: _instanceName: instanceConfig:
acc
++ (
if (builtins.elem machineName instanceConfig.roles.server.machines) then
instanceConfig.roles.client.machines
else
[ ]
)
) [ ] instances;
in
{
config.services.borgbackup.repos =
let
borgbackupIpMachinePath = machines: machineDir + machines + "/facts/borgbackup.ssh.pub";
machinesMaybeKey = builtins.map (
machine:
let
fullPath = borgbackupIpMachinePath machine;
in
if builtins.pathExists fullPath then
machine
else
lib.warn ''
Machine ${machine} does not have a borgbackup key at ${fullPath},
run `clan facts generate ${machine}` to generate it.
'' null
) allClients;
machinesWithKey = lib.filter (x: x != null) machinesMaybeKey;
hosts = builtins.map (machine: {
name = machine;
value = {
path = "/var/lib/borgbackup/${machine}";
authorizedKeys = [ (builtins.readFile (borgbackupIpMachinePath machine)) ];
};
}) machinesWithKey;
in
if (builtins.listToAttrs hosts) != [ ] then builtins.listToAttrs hosts else { };
}

View File

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

View File

@@ -5,7 +5,7 @@
services.maddy =
let
domain = "${config.clanCore.machineName}.local";
domain = "${config.clan.core.machineName}.local";
in
{
enable = true;

View File

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

View File

@@ -1,2 +1,3 @@
A modern IRC server
---
description = "A modern IRC server"
---

View File

@@ -10,5 +10,5 @@ _: {
};
};
clanCore.state.ergochat.folders = [ "/var/lib/ergo" ];
clan.core.state.ergochat.folders = [ "/var/lib/ergo" ];
}

View File

@@ -1,21 +1,24 @@
{ ... }:
{
flake.clanModules = {
disk-layouts = {
imports = [ ./disk-layouts ];
};
borgbackup = ./borgbackup;
borgbackup-static = ./borgbackup-static;
deltachat = ./deltachat;
ergochat = ./ergochat;
localbackup = ./localbackup;
localsend = ./localsend;
single-disk = ./single-disk;
matrix-synapse = ./matrix-synapse;
moonlight = ./moonlight;
packages = ./packages;
mumble = ./mumble;
postgresql = ./postgresql;
root-password = ./root-password;
sshd = ./sshd;
sunshine = ./sunshine;
static-hosts = ./static-hosts;
syncthing = ./syncthing;
syncthing-static-peers = ./syncthing-static-peers;
thelounge = ./thelounge;
trusted-nix-caches = ./trusted-nix-caches;
user-password = ./user-password;

View File

@@ -1,2 +1,3 @@
Automatically backups current machine to local directory.
---
description = "Automatically backups current machine to local directory."
---

View File

@@ -6,7 +6,10 @@
}:
let
cfg = config.clan.localbackup;
rsnapshotConfig = target: states: ''
uniqueFolders = lib.unique (
lib.flatten (lib.mapAttrsToList (_name: state: state.folders) config.clan.core.state)
);
rsnapshotConfig = target: ''
config_version 1.2
snapshot_root ${target.directory}
sync_first 1
@@ -17,12 +20,6 @@ let
cmd_logger ${pkgs.inetutils}/bin/logger
cmd_du ${pkgs.coreutils}/bin/du
cmd_rsnapshot_diff ${pkgs.rsnapshot}/bin/rsnapshot-diff
${lib.optionalString (target.preBackupHook != null) ''
cmd_preexec ${pkgs.writeShellScript "preexec.sh" ''
set -efu -o pipefail
${target.preBackupHook}
''}
''}
${lib.optionalString (target.postBackupHook != null) ''
cmd_postexec ${pkgs.writeShellScript "postexec.sh" ''
@@ -31,11 +28,9 @@ let
''}
''}
retain snapshot ${builtins.toString config.clan.localbackup.snapshots}
${lib.concatMapStringsSep "\n" (state: ''
${lib.concatMapStringsSep "\n" (folder: ''
backup ${folder} ${config.networking.hostName}/
'') state.folders}
'') states}
${lib.concatMapStringsSep "\n" (folder: ''
backup ${folder} ${config.networking.hostName}/
'') uniqueFolders}
'';
in
{
@@ -129,14 +124,29 @@ in
]
}
${lib.concatMapStringsSep "\n" (target: ''
(
${mountHook target}
echo "Creating backup '${target.name}'"
rsnapshot -c "${pkgs.writeText "rsnapshot.conf" (rsnapshotConfig target (lib.attrValues config.clanCore.state))}" sync
rsnapshot -c "${pkgs.writeText "rsnapshot.conf" (rsnapshotConfig target (lib.attrValues config.clanCore.state))}" snapshot
)
'') (builtins.attrValues cfg.targets)}
'')
${mountHook target}
echo "Creating backup '${target.name}'"
${lib.optionalString (target.preBackupHook != null) ''
(
${target.preBackupHook}
)
''}
declare -A preCommandErrors
${lib.concatMapStringsSep "\n" (
state:
lib.optionalString (state.preBackupCommand != null) ''
echo "Running pre-backup command for ${state.name}"
if ! /run/current-system/sw/bin/${state.preBackupCommand}; then
preCommandErrors["${state.name}"]=1
fi
''
) (builtins.attrValues config.clan.core.state)}
rsnapshot -c "${pkgs.writeText "rsnapshot.conf" (rsnapshotConfig target)}" sync
rsnapshot -c "${pkgs.writeText "rsnapshot.conf" (rsnapshotConfig target)}" snapshot
'') (builtins.attrValues cfg.targets)}'')
(pkgs.writeShellScriptBin "localbackup-list" ''
set -efu -o pipefail
export PATH=${
@@ -167,6 +177,14 @@ in
pkgs.gawk
]
}
if [[ "''${NAME:-}" == "" ]]; then
echo "No backup name given via NAME environment variable"
exit 1
fi
if [[ "''${FOLDERS:-}" == "" ]]; then
echo "No folders given via FOLDERS environment variable"
exit 1
fi
name=$(awk -F'::' '{print $1}' <<< $NAME)
backupname=''${NAME#$name::}
@@ -182,8 +200,9 @@ in
exit 1
fi
IFS=';' read -ra FOLDER <<< "$FOLDERS"
IFS=':' read -ra FOLDER <<< "''$FOLDERS"
for folder in "''${FOLDER[@]}"; do
mkdir -p "$folder"
rsync -a "$backupname/${config.networking.hostName}$folder/" "$folder"
done
'')
@@ -213,7 +232,7 @@ in
''
) cfg.targets;
clanCore.backups.providers.localbackup = {
clan.core.backups.providers.localbackup = {
# TODO list needs to run locally or on the remote machine
list = "localbackup-list";
create = "localbackup-create";

View File

@@ -1,2 +1,3 @@
Securely sharing files and messages over a local network without internet connectivity.
---
description = "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";
@@ -18,7 +18,7 @@
};
config = lib.mkIf config.clan.localsend.enable {
clanCore.state.localsend.folders = [
clan.core.state.localsend.folders = [
"/var/localsend"
config.clan.localsend.defaultLocation
];

View File

@@ -1,2 +1,3 @@
A federated messaging server with end-to-end encryption.
---
description = "A federated messaging server with end-to-end encryption."
---

View File

@@ -6,16 +6,65 @@
}:
let
cfg = config.clan.matrix-synapse;
nginx-vhost = "matrix.${config.clan.matrix-synapse.domain}";
element-web =
pkgs.runCommand "element-web-with-config" { nativeBuildInputs = [ pkgs.buildPackages.jq ]; }
''
cp -r ${pkgs.element-web} $out
chmod -R u+w $out
jq '."default_server_config"."m.homeserver" = { "base_url": "https://${nginx-vhost}:443", "server_name": "${config.clan.matrix-synapse.domain}" }' \
> $out/config.json < ${pkgs.element-web}/config.json
ln -s $out/config.json $out/config.${nginx-vhost}.json
'';
in
# FIXME: This was taken from upstream. Drop this when our patch is upstream
{
options.services.matrix-synapse.package = lib.mkOption { readOnly = false; };
options.clan.matrix-synapse = {
enable = lib.mkEnableOption "Enable matrix-synapse";
domain = lib.mkOption {
type = lib.types.str;
description = "The domain name of the matrix server";
example = "example.com";
};
users = lib.mkOption {
default = { };
type = lib.types.attrsOf (
lib.types.submodule (
{ name, ... }:
{
options = {
name = lib.mkOption {
type = lib.types.str;
default = name;
description = "The name of the user";
};
admin = lib.mkOption {
type = lib.types.bool;
default = false;
description = "Whether the user should be an admin";
};
};
}
)
);
description = "A list of users. Not that only new users will be created and existing ones are not modified.";
example.alice = {
admin = true;
};
};
};
config = lib.mkIf cfg.enable {
imports = [
../postgresql
(lib.mkRemovedOptionModule [
"clan"
"matrix-synapse"
"enable"
] "Importing the module will already enable the service.")
../postgresql
];
config = {
services.matrix-synapse = {
enable = true;
settings = {
@@ -29,6 +78,7 @@ in
"turn:turn.matrix.org?transport=udp"
"turn:turn.matrix.org?transport=tcp"
];
registration_shared_secret_path = "/run/synapse-registration-shared-secret";
listeners = [
{
port = 8008;
@@ -49,45 +99,76 @@ in
}
];
};
extraConfigFiles = [ "/var/lib/matrix-synapse/registration_shared_secret.yaml" ];
};
systemd.services.matrix-synapse.serviceConfig.ExecStartPre = [
"+${pkgs.writeScript "copy_registration_shared_secret" ''
#!/bin/sh
cp ${config.clanCore.facts.services.matrix-synapse.secret.synapse-registration_shared_secret.path} /var/lib/matrix-synapse/registration_shared_secret.yaml
chown matrix-synapse:matrix-synapse /var/lib/matrix-synapse/registration_shared_secret.yaml
chmod 600 /var/lib/matrix-synapse/registration_shared_secret.yaml
''}"
];
clanCore.facts.services."matrix-synapse" = {
secret."synapse-registration_shared_secret" = { };
generator.path = with pkgs; [
coreutils
pwgen
];
generator.script = ''
echo "registration_shared_secret: $(pwgen -s 32 1)" > "$secrets"/synapse-registration_shared_secret
'';
};
services.postgresql.enable = true;
# we need to use both ensusureDatabases and initialScript, because the former runs everytime but with the wrong collation
services.postgresql = {
ensureDatabases = [ "matrix-synapse" ];
ensureUsers = [
{
name = "matrix-synapse";
ensureDBOwnership = true;
systemd.tmpfiles.settings."01-matrix" = {
"/run/synapse-registration-shared-secret" = {
C.argument =
config.clan.core.facts.services.matrix-synapse.secret.synapse-registration_shared_secret.path;
z = {
mode = "0400";
user = "matrix-synapse";
};
};
};
clan.postgresql.users.matrix-synapse = { };
clan.postgresql.databases.matrix-synapse.create.options = {
TEMPLATE = "template0";
LC_COLLATE = "C";
LC_CTYPE = "C";
ENCODING = "UTF8";
OWNER = "matrix-synapse";
};
clan.postgresql.databases.matrix-synapse.restore.stopOnRestore = [ "matrix-synapse" ];
clan.core.facts.services =
{
"matrix-synapse" = {
secret."synapse-registration_shared_secret" = { };
generator.path = with pkgs; [
coreutils
pwgen
];
generator.script = ''
echo -n "$(pwgen -s 32 1)" > "$secrets"/synapse-registration_shared_secret
'';
};
}
// lib.mapAttrs' (
name: user:
lib.nameValuePair "matrix-password-${user.name}" {
secret."matrix-password-${user.name}" = { };
generator.path = with pkgs; [ xkcdpass ];
generator.script = ''
xkcdpass -n 4 -d - > "$secrets"/${lib.escapeShellArg "matrix-password-${user.name}"}
'';
}
];
initialScript = pkgs.writeText "synapse-init.sql" ''
CREATE DATABASE "matrix-synapse"
TEMPLATE template0
LC_COLLATE = "C"
LC_CTYPE = "C";
'';
};
) cfg.users;
systemd.services.matrix-synapse =
let
usersScript =
''
while ! ${pkgs.netcat}/bin/nc -z -v ::1 8008; do
if ! kill -0 "$MAINPID"; then exit 1; fi
sleep 1;
done
''
+ lib.concatMapStringsSep "\n" (user: ''
# only create user if it doesn't exist
/run/current-system/sw/bin/matrix-synapse-register_new_matrix_user --exists-ok --password-file ${
config.clan.core.facts.services."matrix-password-${user.name}".secret."matrix-password-${user.name}".path
} --user "${user.name}" ${if user.admin then "--admin" else "--no-admin"}
'') (lib.attrValues cfg.users);
in
{
path = [ pkgs.curl ];
serviceConfig.ExecStartPost = [
(''+${pkgs.writeShellScript "matrix-synapse-create-users" usersScript}'')
];
};
services.nginx = {
enable = true;
virtualHosts = {
@@ -102,7 +183,7 @@ in
return 200 '${
builtins.toJSON {
"m.homeserver" = {
"base_url" = "https://matrix.${cfg.domain}";
"base_url" = "https://${nginx-vhost}";
};
"m.identity_server" = {
"base_url" = "https://vector.im";
@@ -111,15 +192,12 @@ in
}';
'';
};
"matrix.${cfg.domain}" = {
${nginx-vhost} = {
forceSSL = true;
enableACME = true;
locations."/_matrix" = {
proxyPass = "http://localhost:8008";
};
locations."/test".extraConfig = ''
return 200 "Hello, world!";
'';
locations."/_matrix".proxyPass = "http://localhost:8008";
locations."/_synapse".proxyPass = "http://localhost:8008";
locations."/".root = element-web;
};
};
};

View File

@@ -1,2 +1,3 @@
A desktop streaming client optimized for remote gaming and synchronized movie viewing.
---
description = "A desktop streaming client optimized for remote gaming and synchronized movie viewing."
---

View File

@@ -13,10 +13,10 @@ in
systemd.tmpfiles.rules = [
"d '/var/lib/moonlight' 0770 'user' 'users' - -"
"C '/var/lib/moonlight/moonlight.cert' 0644 'user' 'users' - ${
config.clanCore.facts.services.moonlight.secret."moonlight.cert".path or ""
config.clan.core.facts.services.moonlight.secret."moonlight.cert".path or ""
}"
"C '/var/lib/moonlight/moonlight.key' 0644 'user' 'users' - ${
config.clanCore.facts.services.moonlight.secret."moonlight.key".path or ""
config.clan.core.facts.services.moonlight.secret."moonlight.key".path or ""
}"
];
@@ -45,7 +45,7 @@ in
systemd.user.services.moonlight-join = {
description = "Join sunshine hosts";
script = ''${ms-accept}/bin/moonlight-sunshine-accept moonlight join --port ${builtins.toString defaultPort} --cert '${
config.clanCore.facts.services.moonlight.public."moonlight.cert".value or ""
config.clan.core.facts.services.moonlight.public."moonlight.cert".value or ""
}' --host fd2e:25da:6035:c98f:cd99:93e0:b9b8:9ca1'';
serviceConfig = {
Type = "oneshot";
@@ -68,7 +68,7 @@ in
};
};
clanCore.facts.services.moonlight = {
clan.core.facts.services.moonlight = {
secret."moonlight.key" = { };
secret."moonlight.cert" = { };
public."moonlight.cert" = { };

View File

@@ -0,0 +1,14 @@
---
description = "Open Source, Low Latency, High Quality Voice Chat."
categories = ["chat", "voice"]
---
The mumble clan module gives you:
- True low latency voice communication.
- Secure, authenticated encryption.
- Free software.
- Backed by a large and active open-source community.
This all set up in a way that allows peer-to-peer hosting.
Every machine inside the clan can be a host for mumble,
and thus it doesn't matter who in the network is online - as long as two people are online they are able to chat with each other.

View File

@@ -0,0 +1,105 @@
{
lib,
config,
pkgs,
...
}:
let
clanDir = lib.trace config.clan.core.clanDir config.clan.core.clanDir;
machineDir = clanDir + "/machines/";
machinesFileSet = builtins.readDir machineDir;
machines = lib.mapAttrsToList (name: _: name) machinesFileSet;
machineJson = builtins.toJSON (lib.trace machines machines);
certificateMachinePath = machines: machineDir + "/${machines}" + "/facts/mumble-cert";
certificatesUnchecked = builtins.map (
machine:
let
fullPath = certificateMachinePath machine;
in
if builtins.pathExists (lib.trace fullPath fullPath) then machine else null
) machines;
certificate = lib.filter (machine: machine != null) certificatesUnchecked;
machineCert = builtins.map (
machine:
lib.trace machine (lib.nameValuePair machine (builtins.readFile (certificateMachinePath machine)))
) certificate;
machineCertJson = builtins.toJSON (lib.trace machineCert machineCert);
in
{
options.clan.services.mumble = {
user = lib.mkOption {
type = lib.types.string;
default = "alice";
description = "The user mumble should be set up for.";
};
};
config = {
services.murmur = {
enable = true;
logDays = -1;
registerName = config.clan.core.machineName;
openFirewall = true;
bonjour = true;
sslKey = config.clan.core.facts.services.mumble.secret.mumble-key.path;
sslCert = config.clan.core.facts.services.mumble.public.mumble-cert.path;
};
clan.core.state.mumble.folders = [
"/var/lib/mumble"
"/var/lib/murmur"
];
systemd.tmpfiles.rules = [
"d '/var/lib/mumble' 0770 '${config.clan.services.mumble.user}' 'users' - -"
];
environment.systemPackages =
let
mumbleCfgDir = "/var/lib/mumble";
mumbleDatabasePath = "${mumbleCfgDir}/mumble.sqlite";
mumbleCfgPath = "/var/lib/mumble/mumble_settings.json";
populate-channels = pkgs.writers.writePython3 "mumble-populate-channels" {
libraries = [
pkgs.python3Packages.cryptography
pkgs.python3Packages.pyopenssl
];
flakeIgnore = [
# We don't live in the dark ages anymore.
# Languages like Python that are whitespace heavy will overrun
# 79 characters..
"E501"
];
} (builtins.readFile ./mumble-populate-channels.py);
mumble = pkgs.writeShellScriptBin "mumble" ''
set -xeu
mkdir -p ${mumbleCfgDir}
pushd "${mumbleCfgDir}"
XDG_DATA_HOME=${mumbleCfgDir}
XDG_DATA_DIR=${mumbleCfgDir}
${populate-channels} --ensure-config '${mumbleCfgPath}' --db-location ${mumbleDatabasePath}
echo ${machineCertJson}
${populate-channels} --machines '${machineJson}' --username ${config.clan.core.machineName} --db-location ${mumbleDatabasePath}
${populate-channels} --servers '${machineCertJson}' --username ${config.clan.core.machineName} --db-location ${mumbleDatabasePath} --cert True
${pkgs.mumble}/bin/mumble --config ${mumbleCfgPath} "$@"
popd
'';
in
[ mumble ];
clan.core.facts.services.mumble = {
secret.mumble-key = { };
public.mumble-cert = { };
generator.path = [
pkgs.coreutils
pkgs.openssl
];
generator.script = ''
openssl genrsa -out $secrets/mumble-key 2048
openssl req -new -x509 -key $secrets/mumble-key -out $facts/mumble-cert
'';
};
};
}

View File

@@ -0,0 +1,249 @@
import argparse
import json
import os
import sqlite3
def ensure_config(path: str, db_path: str) -> None:
# Default JSON structure if the file doesn't exist
default_json = {
"misc": {
"audio_wizard_has_been_shown": True,
"database_location": db_path,
"viewed_server_ping_consent_message": True,
},
"settings_version": 1,
}
# Check if the file exists
if os.path.exists(path):
with open(path) as file:
data = json.load(file)
else:
data = default_json
# Create the file with default JSON structure
with open(path, "w") as file:
json.dump(data, file, indent=4)
# TODO: make sure to only update the diff
updated_data = {**default_json, **data}
# Write the modified JSON object back to the file
with open(path, "w") as file:
json.dump(updated_data, file, indent=4)
def initialize_database(db_location: str) -> None:
"""
Initializes the database. If the database or the servers table does not exist, it creates them.
:param db_location: The path to the SQLite database
"""
conn = sqlite3.connect(db_location)
try:
cursor = conn.cursor()
# Create the servers table if it doesn't exist
cursor.execute("""
CREATE TABLE IF NOT EXISTS servers (
id INTEGER PRIMARY KEY AUTOINCREMENT,
name TEXT NOT NULL,
hostname TEXT NOT NULL,
port INTEGER NOT NULL,
username TEXT NOT NULL,
password TEXT NOT NULL,
url TEXT
)
""")
# Commit the changes
conn.commit()
except sqlite3.Error as e:
print(f"An error occurred while initializing the database: {e}")
finally:
conn.close()
def initialize_certificates(
db_location: str, hostname: str, port: str, digest: str
) -> None:
# Connect to the SQLite database
conn = sqlite3.connect(db_location)
try:
# Create a cursor object
cursor = conn.cursor()
# TODO: check if cert already there
# if server_check(cursor, name, hostname):
# print(
# f"Server with name '{name}' and hostname '{hostname}' already exists."
# )
# return
# SQL command to insert data into the servers table
insert_query = """
INSERT INTO cert (hostname, port, digest)
VALUES (?, ?, ?)
"""
# Data to be inserted
data = (hostname, port, digest)
# Execute the insert command with the provided data
cursor.execute(insert_query, data)
# Commit the changes
conn.commit()
print("Data has been successfully inserted.")
except sqlite3.Error as e:
print(f"An error occurred: {e}")
finally:
# Close the connection
conn.close()
pass
def calculate_digest(cert: str) -> str:
from cryptography import x509
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives import hashes
cert = cert.strip()
cert = cert.encode("utf-8")
cert = x509.load_pem_x509_certificate(cert, default_backend())
digest = cert.fingerprint(hashes.SHA1()).hex()
return digest
def server_check(cursor: str, name: str, hostname: str) -> bool:
"""
Check if a server with the given name and hostname already exists.
:param cursor: The database cursor
:param name: The name of the server
:param hostname: The hostname of the server
:return: True if the server exists, False otherwise
"""
check_query = """
SELECT 1 FROM servers WHERE name = ? AND hostname = ?
"""
cursor.execute(check_query, (name, hostname))
return cursor.fetchone() is not None
def insert_server(
name: str,
hostname: str,
port: str,
username: str,
password: str,
url: str,
db_location: str,
) -> None:
"""
Inserts a new server record into the servers table.
:param name: The name of the server
:param hostname: The hostname of the server
:param port: The port number
:param username: The username
:param password: The password
:param url: The URL
"""
# Connect to the SQLite database
conn = sqlite3.connect(db_location)
try:
# Create a cursor object
cursor = conn.cursor()
if server_check(cursor, name, hostname):
print(
f"Server with name '{name}' and hostname '{hostname}' already exists."
)
return
# SQL command to insert data into the servers table
insert_query = """
INSERT INTO servers (name, hostname, port, username, password, url)
VALUES (?, ?, ?, ?, ?, ?)
"""
# Data to be inserted
data = (name, hostname, port, username, password, url)
# Execute the insert command with the provided data
cursor.execute(insert_query, data)
# Commit the changes
conn.commit()
print("Data has been successfully inserted.")
except sqlite3.Error as e:
print(f"An error occurred: {e}")
finally:
# Close the connection
conn.close()
if __name__ == "__main__":
port = 64738
password = ""
url = None
parser = argparse.ArgumentParser(
prog="initialize_mumble",
)
subparser = parser.add_subparsers(dest="certificates")
# cert_parser = subparser.add_parser("certificates")
parser.add_argument("--cert")
parser.add_argument("--digest")
parser.add_argument("--machines")
parser.add_argument("--servers")
parser.add_argument("--username")
parser.add_argument("--db-location")
parser.add_argument("--ensure-config")
args = parser.parse_args()
print(args)
if args.ensure_config:
ensure_config(args.ensure_config, args.db_location)
print("Initialized config")
exit(0)
if args.servers:
print(args.servers)
servers = json.loads(f"{args.servers}")
db_location = args.db_location
for server in servers:
digest = calculate_digest(server.get("value"))
name = server.get("name")
initialize_certificates(db_location, name, port, digest)
print("Initialized certificates")
exit(0)
initialize_database(args.db_location)
# Insert the server into the database
print(args.machines)
machines = json.loads(f"{args.machines}")
print(machines)
print(list(machines))
for machine in list(machines):
print(f"Inserting {machine}.")
insert_server(
machine,
machine,
port,
args.username,
password,
url,
args.db_location,
)

View File

@@ -0,0 +1,42 @@
{ pkgs, self, ... }:
pkgs.nixosTest {
name = "mumble";
nodes.peer1 =
{ ... }:
{
imports = [
self.nixosModules.mumble
self.inputs.clan-core.nixosModules.clanCore
{
config = {
clan.core.machineName = "peer1";
clan.core.clanDir = ./.;
documentation.enable = false;
};
}
];
};
nodes.peer2 =
{ ... }:
{
imports = [
self.nixosModules.mumble
self.inputs.clan-core.nixosModules.clanCore
{
config = {
clan.core.machineName = "peer2";
clan.core.clanDir = ./.;
documentation.enable = false;
};
}
];
};
testScript = ''
start_all()
'';
}

View File

@@ -0,0 +1,4 @@
---
description = "Define package sets from nixpkgs and install them on one or more machines"
categories = ["packages"]
---

View File

@@ -0,0 +1,19 @@
{
config,
lib,
pkgs,
...
}:
{
options.clan.packages = {
packages = lib.mkOption {
type = lib.types.listOf lib.types.str;
description = "The packages to install on the machine";
};
};
config = {
environment.systemPackages = map (
pName: lib.getAttrFromPath (lib.splitString "." pName) pkgs
) config.clan.packages.packages;
};
}

View File

@@ -0,0 +1 @@
{ }

View File

@@ -0,0 +1,3 @@
---
description = "A free and open-source relational database management system (RDBMS) emphasizing extensibility and SQL compliance."
---

View File

@@ -0,0 +1,226 @@
{
pkgs,
lib,
config,
...
}:
let
createDatatbaseState =
db:
let
folder = "/var/backup/postgres/${db.name}";
current = "${folder}/pg-dump";
compression = lib.optionalString (lib.versionAtLeast config.services.postgresql.package.version "16") "--compress=zstd";
in
{
folders = [ folder ];
preBackupScript = ''
export PATH=${
lib.makeBinPath [
config.services.postgresql.package
config.systemd.package
pkgs.coreutils
pkgs.util-linux
pkgs.zstd
]
}
while [[ "$(systemctl is-active postgresql)" == activating ]]; do
sleep 1
done
mkdir -p "${folder}"
runuser -u postgres -- pg_dump ${compression} --dbname=${db.name} -Fc -c > "${current}.tmp"
mv "${current}.tmp" ${current}
'';
postRestoreScript = ''
export PATH=${
lib.makeBinPath [
config.services.postgresql.package
config.systemd.package
pkgs.coreutils
pkgs.util-linux
pkgs.zstd
pkgs.gnugrep
]
}
while [[ "$(systemctl is-active postgresql)" == activating ]]; do
sleep 1
done
echo "Waiting for postgres to be ready..."
while ! runuser -u postgres -- psql --port=${builtins.toString config.services.postgresql.settings.port} -d postgres -c "" ; do
if ! systemctl is-active postgresql; then exit 1; fi
sleep 0.1
done
if [[ -e "${current}" ]]; then
(
systemctl stop ${lib.concatStringsSep " " db.restore.stopOnRestore}
trap "systemctl start ${lib.concatStringsSep " " db.restore.stopOnRestore}" EXIT
mkdir -p "${folder}"
if runuser -u postgres -- psql -d postgres -c "SELECT 1 FROM pg_database WHERE datname = '${db.name}'" | grep -q 1; then
runuser -u postgres -- dropdb "${db.name}"
fi
runuser -u postgres -- pg_restore -C -d postgres "${current}"
)
else
echo No database backup found, skipping restore
fi
'';
};
createDatabase = db: ''
CREATE DATABASE "${db.name}" ${
lib.concatStringsSep " " (
lib.mapAttrsToList (name: value: "${name} = '${value}'") db.create.options
)
}
'';
cfg = config.clan.postgresql;
userClauses = lib.mapAttrsToList (
_: user:
''$PSQL -tAc "SELECT 1 FROM pg_roles WHERE rolname='${user.name}'" | grep -q 1 || $PSQL -tAc 'CREATE USER "${user.name}"' ''
) cfg.users;
databaseClauses = lib.mapAttrsToList (
name: db:
lib.optionalString db.create.enable ''$PSQL -d postgres -c "SELECT 1 FROM pg_database WHERE datname = '${name}'" | grep -q 1 || $PSQL -d postgres -c ${lib.escapeShellArg (createDatabase db)} ''
) cfg.databases;
in
{
options.clan.postgresql = {
# we are reimplemeting ensureDatabase and ensureUser options here to allow to create databases with options
databases = lib.mkOption {
description = "Databases to create";
default = { };
type = lib.types.attrsOf (
lib.types.submodule (
{ name, ... }:
{
options = {
name = lib.mkOption {
type = lib.types.str;
default = name;
description = "Database name.";
};
service = lib.mkOption {
type = lib.types.str;
default = name;
description = "Service name that we associate with the database.";
};
# set to false, in case the upstream module uses ensureDatabase option
create.enable = lib.mkOption {
type = lib.types.bool;
default = true;
description = "Create the database if it does not exist.";
};
create.options = lib.mkOption {
description = "Options to pass to the CREATE DATABASE command.";
type = lib.types.lazyAttrsOf lib.types.str;
default = { };
example = {
TEMPLATE = "template0";
LC_COLLATE = "C";
LC_CTYPE = "C";
ENCODING = "UTF8";
OWNER = "foo";
};
};
restore.stopOnRestore = lib.mkOption {
type = lib.types.listOf lib.types.str;
default = [ ];
description = "List of systemd services to stop before restoring the database.";
};
};
}
)
);
};
users = lib.mkOption {
description = "Users to create";
default = { };
type = lib.types.attrsOf (
lib.types.submodule (
{ name, ... }:
{
options.name = lib.mkOption {
description = "User name";
type = lib.types.str;
default = name;
};
}
)
);
};
};
config = {
services.postgresql.settings = {
wal_level = "replica";
max_wal_senders = 3;
};
services.postgresql.enable = true;
# We are duplicating a bit the upstream module but allow to create databases with options
systemd.services.postgresql.postStart = ''
PSQL="psql --port=${builtins.toString config.services.postgresql.settings.port}"
while ! $PSQL -d postgres -c "" 2> /dev/null; do
if ! kill -0 "$MAINPID"; then exit 1; fi
sleep 0.1
done
${lib.concatStringsSep "\n" userClauses}
${lib.concatStringsSep "\n" databaseClauses}
'';
clan.core.state = lib.mapAttrs' (
_: db: lib.nameValuePair db.service (createDatatbaseState db)
) config.clan.postgresql.databases;
environment.systemPackages = builtins.map (
db:
let
folder = "/var/backup/postgres/${db.name}";
current = "${folder}/pg-dump";
in
pkgs.writeShellScriptBin "postgres-db-restore-command-${db.name}" ''
export PATH=${
lib.makeBinPath [
config.services.postgresql.package
config.systemd.package
pkgs.coreutils
pkgs.util-linux
pkgs.zstd
pkgs.gnugrep
]
}
while [[ "$(systemctl is-active postgresql)" == activating ]]; do
sleep 1
done
echo "Waiting for postgres to be ready..."
while ! runuser -u postgres -- psql --port=${builtins.toString config.services.postgresql.settings.port} -d postgres -c "" ; do
if ! systemctl is-active postgresql; then exit 1; fi
sleep 0.1
done
if [[ -e "${current}" ]]; then
(
${
lib.optionalString (db.restore.stopOnRestore != [ ]) ''
systemctl stop ${builtins.toString db.restore.stopOnRestore}
trap "systemctl start ${builtins.toString db.restore.stopOnRestore}" EXIT
''
}
mkdir -p "${folder}"
if runuser -u postgres -- psql -d postgres -c "SELECT 1 FROM pg_database WHERE datname = '${db.name}'" | grep -q 1; then
runuser -u postgres -- dropdb "${db.name}"
fi
runuser -u postgres -- pg_restore -C -d postgres "${current}"
)
else
echo No database backup found, skipping restore
fi
''
) (builtins.attrValues config.clan.postgresql.databases);
};
}

View File

@@ -1,4 +1,5 @@
Automatically generates and configures a password for the root user.
---
description = "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:

View File

@@ -1,10 +1,19 @@
{ pkgs, config, ... }:
{
pkgs,
config,
lib,
...
}:
{
users.mutableUsers = false;
users.users.root.hashedPasswordFile =
config.clanCore.facts.services.root-password.secret.password-hash.path;
sops.secrets."${config.clanCore.machineName}-password-hash".neededForUsers = true;
clanCore.facts.services.root-password = {
config.clan.core.facts.services.root-password.secret.password-hash.path;
sops.secrets = lib.mkIf (config.clan.core.facts.secretStore == "sops") {
"${config.clan.core.machineName}-password-hash".neededForUsers = true;
};
clan.core.facts.services.root-password = {
secret.password = { };
secret.password-hash = { };
generator.path = with pkgs; [
@@ -13,8 +22,8 @@
mkpasswd
];
generator.script = ''
xkcdpass --numwords 3 --delimiter - --count 1 > $secrets/password
cat $secrets/password | mkpasswd -s -m sha-512 > $secrets/password-hash
xkcdpass --numwords 3 --delimiter - --count 1 | tr -d "\n" > $secrets/password
cat $secrets/password | mkpasswd -s -m sha-512 | tr -d "\n" > $secrets/password-hash
'';
};
}

View File

@@ -0,0 +1,42 @@
---
description = "Configures partitioning of the main disk"
categories = ["disk-layout"]
---
# Primary Disk Layout
A module for the "disk-layout" category MUST be choosen.
There is exactly one slot for this type of module in the UI, if you don't fill the slot, your machine cannot boot
This module is a good choice for most machines. In the future clan will offer a broader choice of disk-layouts
The UI will ask for the options of this module:
`device: "/dev/null"`
# Usage example
`inventory.json`
```json
"services": {
"single-disk": {
"default": {
"meta": {
"name": "single-disk"
},
"roles": {
"default": {
"machines": ["jon"]
}
},
"machines": {
"jon": {
"config": {
"device": "/dev/null"
}
}
}
}
}
}
```

View File

@@ -0,0 +1,53 @@
{ lib, config, ... }:
{
options.clan.single-disk = {
device = lib.mkOption {
default = null;
type = lib.types.nullOr lib.types.str;
description = "The primary disk device to install the system on";
# Question: should we set a default here?
# default = "/dev/null";
};
};
config = {
boot.loader.grub.efiSupport = lib.mkDefault true;
boot.loader.grub.efiInstallAsRemovable = lib.mkDefault true;
disko.devices = {
disk = {
main = {
type = "disk";
# This is set through the UI
device = config.clan.single-disk.device;
content = {
type = "gpt";
partitions = {
boot = {
size = "1M";
type = "EF02"; # for grub MBR
priority = 1;
};
ESP = {
size = "512M";
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
};
};
root = {
size = "100%";
content = {
type = "filesystem";
format = "ext4";
mountpoint = "/";
};
};
};
};
};
};
};
};
}

View File

@@ -0,0 +1 @@
{ }

View File

@@ -1,2 +1,3 @@
Enables secure remote access to the machine over ssh
---
description = "Enables secure remote access to the machine over ssh"
---

View File

@@ -5,12 +5,12 @@
services.openssh.hostKeys = [
{
path = config.clanCore.facts.services.openssh.secret."ssh.id_ed25519".path;
path = config.clan.core.facts.services.openssh.secret."ssh.id_ed25519".path;
type = "ed25519";
}
];
clanCore.facts.services.openssh = {
clan.core.facts.services.openssh = {
secret."ssh.id_ed25519" = { };
public."ssh.id_ed25519.pub" = { };
generator.path = [

View File

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

View File

@@ -3,20 +3,36 @@
options.clan.static-hosts = {
excludeHosts = lib.mkOption {
type = lib.types.listOf lib.types.str;
default = [ config.clanCore.machineName ];
default =
if config.clan.static-hosts.topLevelDomain != "" then [ ] else [ config.clan.core.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;
clanDir = config.clan.core.clanDir;
machineDir = clanDir + "/machines/";
zerotierIpMachinePath = machines: machineDir + machines + "/facts/zerotier-ip";
machines = builtins.readDir machineDir;
machinesFileSet = builtins.readDir machineDir;
machines = lib.mapAttrsToList (name: _: name) machinesFileSet;
networkIpsUnchecked = builtins.map (
machine:
let
fullPath = zerotierIpMachinePath machine;
in
if builtins.pathExists fullPath then machine else null
) machines;
networkIps = lib.filter (machine: machine != null) networkIpsUnchecked;
machinesWithIp = lib.filterAttrs (name: _: (lib.elem name networkIps)) machinesFileSet;
filteredMachines = lib.filterAttrs (
name: _: !(lib.elem name config.clan.static-hosts.excludeHosts)
) machines;
) machinesWithIp;
in
lib.filterAttrs (_: value: value != null) (
lib.mapAttrs' (
@@ -24,7 +40,15 @@
let
path = zerotierIpMachinePath machine;
in
if builtins.pathExists path then lib.nameValuePair (builtins.readFile path) [ machine ] else null
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
{ }
) filteredMachines
);
}

View File

@@ -1,2 +1,3 @@
A desktop streaming server optimized for remote gaming and synchronized movie viewing.
---
description = "A desktop streaming server optimized for remote gaming and synchronized movie viewing."
---

View File

@@ -97,10 +97,10 @@ in
systemd.tmpfiles.rules = [
"d '/var/lib/sunshine' 0770 'user' 'users' - -"
"C '/var/lib/sunshine/sunshine.cert' 0644 'user' 'users' - ${
config.clanCore.facts.services.sunshine.secret."sunshine.cert".path or ""
config.clan.core.facts.services.sunshine.secret."sunshine.cert".path or ""
}"
"C '/var/lib/sunshine/sunshine.key' 0644 'user' 'users' - ${
config.clanCore.facts.services.sunshine.secret."sunshine.key".path or ""
config.clan.core.facts.services.sunshine.secret."sunshine.key".path or ""
}"
];
@@ -117,8 +117,8 @@ in
RestartSec = "5s";
ReadWritePaths = [ "/var/lib/sunshine" ];
ReadOnlyPaths = [
(config.clanCore.facts.services.sunshine.secret."sunshine.key".path or "")
(config.clanCore.facts.services.sunshine.secret."sunshine.cert".path or "")
(config.clan.core.facts.services.sunshine.secret."sunshine.key".path or "")
(config.clan.core.facts.services.sunshine.secret."sunshine.cert".path or "")
];
};
wantedBy = [ "graphical-session.target" ];
@@ -137,7 +137,7 @@ in
startLimitIntervalSec = 500;
script = ''
${ms-accept}/bin/moonlight-sunshine-accept sunshine init-state --uuid ${
config.clanCore.facts.services.sunshine.public.sunshine-uuid.value or null
config.clan.core.facts.services.sunshine.public.sunshine-uuid.value or null
} --state-file /var/lib/sunshine/state.json
'';
serviceConfig = {
@@ -173,9 +173,9 @@ in
startLimitIntervalSec = 500;
script = ''
${ms-accept}/bin/moonlight-sunshine-accept sunshine listen --port ${builtins.toString listenPort} --uuid ${
config.clanCore.facts.services.sunshine.public.sunshine-uuid.value or null
config.clan.core.facts.services.sunshine.public.sunshine-uuid.value or null
} --state /var/lib/sunshine/state.json --cert '${
config.clanCore.facts.services.sunshine.public."sunshine.cert".value or null
config.clan.core.facts.services.sunshine.public."sunshine.cert".value or null
}'
'';
serviceConfig = {
@@ -187,7 +187,7 @@ in
wantedBy = [ "graphical-session.target" ];
};
clanCore.facts.services.ergochat = {
clan.core.facts.services.ergochat = {
secret."sunshine.key" = { };
secret."sunshine.cert" = { };
public."sunshine-uuid" = { };

View File

@@ -0,0 +1,3 @@
---
description = "Statically configure syncthing peers through clan"
---

View File

@@ -0,0 +1,108 @@
{
lib,
config,
pkgs,
...
}:
let
clanDir = config.clan.core.clanDir;
machineDir = clanDir + "/machines/";
syncthingPublicKeyPath = machines: machineDir + machines + "/facts/syncthing.pub";
machinesFileSet = builtins.readDir machineDir;
machines = lib.mapAttrsToList (name: _: name) machinesFileSet;
syncthingPublicKeysUnchecked = builtins.map (
machine:
let
fullPath = syncthingPublicKeyPath machine;
in
if builtins.pathExists fullPath then machine else null
) machines;
syncthingPublicKeyMachines = lib.filter (machine: machine != null) syncthingPublicKeysUnchecked;
zerotierIpMachinePath = machines: machineDir + machines + "/facts/zerotier-ip";
networkIpsUnchecked = builtins.map (
machine:
let
fullPath = zerotierIpMachinePath machine;
in
if builtins.pathExists fullPath then machine else null
) machines;
networkIpMachines = lib.filter (machine: machine != null) networkIpsUnchecked;
devices = builtins.map (machine: {
name = machine;
value = {
name = machine;
id = (lib.removeSuffix "\n" (builtins.readFile (syncthingPublicKeyPath machine)));
addresses =
[ "dynamic" ]
++ (
if (lib.elem machine networkIpMachines) then
[ "tcp://[${(lib.removeSuffix "\n" (builtins.readFile (zerotierIpMachinePath machine)))}]:22000" ]
else
[ ]
);
};
}) syncthingPublicKeyMachines;
in
{
options.clan.syncthing-static-peers = {
excludeMachines = lib.mkOption {
type = lib.types.listOf lib.types.str;
example = [ config.clan.core.machineName ];
default = [ ];
description = ''
Machines that should not be added.
'';
};
};
config.services.syncthing.settings.devices = (builtins.listToAttrs devices);
imports = [
{
# Syncthing ports: 8384 for remote access to GUI
# 22000 TCP and/or UDP for sync traffic
# 21027/UDP for discovery
# source: https://docs.syncthing.net/users/firewall.html
networking.firewall.interfaces."zt+".allowedTCPPorts = [
8384
22000
];
networking.firewall.allowedTCPPorts = [ 8384 ];
networking.firewall.interfaces."zt+".allowedUDPPorts = [
22000
21027
];
# Activates inotify compatibility on syncthing
# use mkOverride 900 here as it otherwise would collide with the default of the
# upstream nixos xserver.nix
boot.kernel.sysctl."fs.inotify.max_user_watches" = lib.mkOverride 900 524288;
services.syncthing = {
enable = true;
configDir = "/var/lib/syncthing";
group = "syncthing";
key = lib.mkDefault config.clan.core.facts.services.syncthing.secret."syncthing.key".path or null;
cert = lib.mkDefault config.clan.core.facts.services.syncthing.secret."syncthing.cert".path or null;
};
clan.core.facts.services.syncthing = {
secret."syncthing.key" = { };
secret."syncthing.cert" = { };
public."syncthing.pub" = { };
generator.path = [
pkgs.coreutils
pkgs.gnugrep
pkgs.syncthing
];
generator.script = ''
syncthing generate --config "$secrets"
mv "$secrets"/key.pem "$secrets"/syncthing.key
mv "$secrets"/cert.pem "$secrets"/syncthing.cert
cat "$secrets"/config.xml | grep -oP '(?<=<device id=")[^"]+' | uniq > "$facts"/syncthing.pub
'';
};
}
];
}

View File

@@ -1,4 +1,5 @@
A secure, file synchronization app for devices over networks, offering a private alternative to cloud services.
---
description = "A secure, file synchronization app for devices over networks, offering a private alternative to cloud services."
---
## Usage

View File

@@ -7,10 +7,14 @@
{
options.clan.syncthing = {
id = lib.mkOption {
description = ''
The ID of the machine.
It is generated automatically by default.
'';
type = lib.types.nullOr lib.types.str;
example = "BABNJY4-G2ICDLF-QQEG7DD-N3OBNGF-BCCOFK6-MV3K7QJ-2WUZHXS-7DTW4AS";
default = config.clanCore.facts.services.syncthing.public."syncthing.pub".value or null;
defaultText = "config.clanCore.facts.services.syncthing.public.\"syncthing.pub\".value";
default = config.clan.core.facts.services.syncthing.public."syncthing.pub".value or null;
defaultText = "config.clan.core.facts.services.syncthing.public.\"syncthing.pub\".value";
};
introducer = lib.mkOption {
description = ''
@@ -94,7 +98,7 @@
settings = {
options = {
urAccepted = -1;
allowedNetworks = [ config.clan.networking.zerotier.subnet ];
allowedNetworks = [ config.clan.core.networking.zerotier.subnet ];
};
devices =
{ }
@@ -119,7 +123,7 @@
getPendingDevices = "/rest/cluster/pending/devices";
postNewDevice = "/rest/config/devices";
SharedFolderById = "/rest/config/folders/";
apiKey = config.clanCore.facts.services.syncthing.secret."syncthing.api".path or null;
apiKey = config.clan.core.facts.services.syncthing.secret."syncthing.api".path or null;
in
lib.mkIf config.clan.syncthing.autoAcceptDevices {
description = "Syncthing auto accept devices";
@@ -161,7 +165,7 @@
systemd.services.syncthing-init-api-key =
let
apiKey = config.clanCore.facts.services.syncthing.secret."syncthing.api".path or null;
apiKey = config.clan.core.facts.services.syncthing.secret."syncthing.api".path or null;
in
lib.mkIf config.clan.syncthing.autoAcceptDevices {
description = "Set the api key";
@@ -183,7 +187,7 @@
};
};
clanCore.facts.services.syncthing = {
clan.core.facts.services.syncthing = {
secret."syncthing.key" = { };
secret."syncthing.cert" = { };
secret."syncthing.api" = { };

View File

@@ -1,2 +1,3 @@
Modern web IRC client
---
description = "Modern web IRC client"
---

View File

@@ -11,5 +11,5 @@ _: {
};
};
clanCore.state.thelounde.folders = [ "/var/lib/thelounge" ];
clan.core.state.thelounde.folders = [ "/var/lib/thelounge" ];
}

View File

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

View File

@@ -1,4 +1,5 @@
Automatically generates and configures a password for the specified user account.
---
description = "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.

View File

@@ -22,9 +22,13 @@
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 = {
config.clan.core.facts.services.user-password.secret.user-password-hash.path;
sops.secrets = lib.mkIf (config.clan.core.facts.secretStore == "sops") {
"${config.clan.core.machineName}-user-password-hash".neededForUsers = true;
};
clan.core.facts.services.user-password = {
secret.user-password = { };
secret.user-password-hash = { };
generator.prompt = (
@@ -37,12 +41,12 @@
mkpasswd
];
generator.script = ''
if [[ -n $prompt_value ]]; then
echo $prompt_value > $secrets/user-password
if [[ -n ''${prompt_value-} ]]; then
echo $prompt_value | tr -d "\n" > $secrets/user-password
else
xkcdpass --numwords 3 --delimiter - --count 1 > $secrets/user-password
xkcdpass --numwords 3 --delimiter - --count 1 | tr -d "\n" > $secrets/user-password
fi
cat $secrets/user-password | mkpasswd -s -m sha-512 > $secrets/user-password-hash
cat $secrets/user-password | mkpasswd -s -m sha-512 | tr -d "\n" > $secrets/user-password-hash
'';
};
};

View File

@@ -1,2 +1,3 @@
A lightweight desktop manager
---
description = "A lightweight desktop manager"
---

View File

@@ -1,4 +1,5 @@
Statically configure the `zerotier` peers of a clan network.
---
description = "Statically configure the `zerotier` peers of a clan network."
---
Statically configure the `zerotier` peers of a clan network.

View File

@@ -2,11 +2,10 @@
lib,
config,
pkgs,
inputs,
...
}:
let
clanDir = config.clanCore.clanDir;
clanDir = config.clan.core.clanDir;
machineDir = clanDir + "/machines/";
machinesFileSet = builtins.readDir machineDir;
machines = lib.mapAttrsToList (name: _: name) machinesFileSet;
@@ -20,7 +19,7 @@ let
if builtins.pathExists fullPath then builtins.readFile fullPath else null
) machines;
networkIds = lib.filter (machine: machine != null) networkIdsUnchecked;
networkId = builtins.elemAt networkIds 0;
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
@@ -28,44 +27,61 @@ in
options.clan.zerotier-static-peers = {
excludeHosts = lib.mkOption {
type = lib.types.listOf lib.types.str;
default = [ config.clanCore.machineName ];
default = [ config.clan.core.machineName ];
description = "Hosts that should be excluded";
};
networkIps = lib.mkOption {
type = lib.types.listOf lib.types.str;
default = [ ];
description = "Extra zerotier network Ips that should be accepted";
};
networkIds = lib.mkOption {
type = lib.types.listOf lib.types.str;
default = [ ];
description = "Extra zerotier network Ids that should be accepted";
};
};
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.static-hosts.excludeHosts)
networkIpsUnchecked = builtins.map (
machine:
let
fullPath = zerotierIpMachinePath machine;
in
if builtins.pathExists fullPath then machine else null
) machines;
networkIps = lib.filter (machine: machine != null) networkIpsUnchecked;
machinesWithIp = lib.filterAttrs (name: _: (lib.elem name networkIps)) machinesFileSet;
filteredMachines = lib.filterAttrs (
name: _: !(lib.elem name config.clan.zerotier-static-peers.excludeHosts)
) machinesWithIp;
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
lib.nameValuePair (builtins.readFile fullPath) [ machine ]
) filteredMachines
);
allHostIPs = config.clan.zerotier-static-peers.networkIps ++ hosts;
in
lib.mkIf (config.clan.networking.zerotier.controller.enable) {
lib.mkIf (config.clan.core.networking.zerotier.controller.enable) {
wantedBy = [ "multi-user.target" ];
after = [ "zerotierone.service" ];
path = [ pkgs.zerotierone ];
path = [ config.clan.core.clanPkgs.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.core.clanPkgs.zerotier-members}/bin/zerotier-members allow --member-ip ${host}
'') allHostIPs}
${lib.concatMapStringsSep "\n" (host: ''
${config.clan.core.clanPkgs.zerotier-members}/bin/zerotier-members allow ${host}
'') config.clan.zerotier-static-peers.networkIds}
'';
};
config.clan.networking.zerotier.networkId = lib.mkDefault networkId;
config.clan.core.networking.zerotier.networkId = lib.mkDefault networkId;
}

View File

@@ -1,2 +1,3 @@
Enable ZeroTier VPN over TCP for networks where UDP is blocked.
---
description = "Enable ZeroTier VPN over TCP for networks where UDP is blocked."
---

View File

@@ -26,8 +26,10 @@
devShells.default = pkgs.mkShell {
packages = [
select-shell
pkgs.nix-unit
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
@@ -36,6 +38,7 @@
];
shellHook = ''
echo -e "${ansiEscapes.green}switch to another dev-shell using: select-shell${ansiEscapes.reset}"
export PROJECT_ROOT=$(git rev-parse --show-toplevel)
'';
};
};

View File

@@ -1,6 +1,8 @@
# shellcheck shell=bash
source_up
watch_file $(find ./nix -name "*.nix" -printf '%p ')
mapfile -d '' -t nix_files < <(find ./nix -name "*.nix" -print0)
watch_file "${nix_files[@]}"
# Because we depend on nixpkgs sources, uploading to builders takes a long time
use flake .#docs --builders ''

7
docs/.gitignore vendored
View File

@@ -1 +1,6 @@
/site/reference
/site/reference/clan-core
/site/reference/clanModules
/site/reference/nix-api/inventory.md
/site/reference/cli
/site/static/Roboto-Regular.ttf
/site/static/FiraCode-VF.ttf

View File

@@ -15,92 +15,131 @@ 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
```
5. **Create an access token**:
- Log in to Gitea.
- Go to your account settings.
- Navigate to the Applications section.
- Click Generate New Token.
- Name your token and select all available scopes.
- Generate the token and copy it for later use.
- Your access token is now ready to use with all permissions.
- 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? Yes
- Token: <yourtoken>
- 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-app 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 +189,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

@@ -16,15 +16,26 @@ def define_env(env: Any) -> None:
@env.macro
def asciinema(name: str) -> str:
return f"""<div id="{name}">
<script src="{asciinema_dir}/asciinema-player.min.js"></script>
<script>
AsciinemaPlayer.create('{video_dir + name}',
document.getElementById("{name}"), {{
loop: true,
autoPlay: true,
controls: false,
speed: 1.5,
theme: "solarized-light"
}});
// 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 Docs
site_name: Clan Documentation
site_url: https://docs.clan.lol
repo_url: https://git.clan.lol/clan/clan-core/
repo_name: clan-core
@@ -14,6 +14,7 @@ markdown_extensions:
- attr_list
- footnotes
- md_in_html
- def_list
- meta
- plantuml_markdown
- pymdownx.emoji:
@@ -38,8 +39,6 @@ exclude_docs: |
/drafts/
nav:
- Blog:
- blog/index.md
- Getting started:
- index.md
- Installer: getting-started/installer.md
@@ -49,22 +48,32 @@ nav:
- Mesh VPN: getting-started/mesh-vpn.md
- Backup & Restore: getting-started/backups.md
- Flake-parts: getting-started/flake-parts.md
- Modules:
- Guides:
- guides/index.md
- Inventory: guides/inventory.md
- Reference:
- reference/index.md
- Clan Modules:
- reference/clanModules/index.md
- reference/clanModules/borgbackup-static.md
- reference/clanModules/borgbackup.md
- reference/clanModules/deltachat.md
- reference/clanModules/disk-layouts.md
- reference/clanModules/ergochat.md
- reference/clanModules/localbackup.md
- reference/clanModules/localsend.md
- reference/clanModules/matrix-synapse.md
- reference/clanModules/moonlight.md
- reference/clanModules/packages.md
- reference/clanModules/postgresql.md
- reference/clanModules/root-password.md
- reference/clanModules/single-disk.md
- reference/clanModules/sshd.md
- reference/clanModules/sunshine.md
- reference/clanModules/syncthing.md
- reference/clanModules/static-hosts.md
- reference/clanModules/sunshine.md
- reference/clanModules/syncthing-static-peers.md
- reference/clanModules/syncthing.md
- reference/clanModules/thelounge.md
- reference/clanModules/mumble.md
- reference/clanModules/trusted-nix-caches.md
- reference/clanModules/user-password.md
- reference/clanModules/xfce.md
@@ -73,14 +82,15 @@ nav:
- 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/show.md
- reference/cli/ssh.md
- reference/cli/state.md
- reference/cli/vms.md
- Clan Core:
- reference/clan-core/index.md
@@ -88,14 +98,23 @@ nav:
- reference/clan-core/facts.md
- reference/clan-core/sops.md
- reference/clan-core/state.md
- reference/clan-core/deployment.md
- reference/clan-core/networking.md
- Nix API:
- reference/nix-api/index.md
- buildClan: reference/nix-api/buildclan.md
- Inventory: reference/nix-api/inventory.md
- Contributing: contributing/contributing.md
- Blog:
- blog/index.md
docs_dir: site
site_dir: out
theme:
font: false
logo: https://clan.lol/static/logo/clan-white.png
favicon: https://clan.lol/static/logo/clan-dark.png
favicon: https://clan.lol/static/dark-favicon/128x128.png
name: material
features:
- navigation.instant
@@ -104,9 +123,8 @@ theme:
- content.code.copy
- content.tabs.link
icon:
repo: fontawesome/brands/git
font:
code: Roboto Mono
repo: fontawesome/brands/git-alt
custom_dir: overrides
palette:
# Palette toggle for light mode
@@ -128,8 +146,7 @@ theme:
name: Switch to light mode
extra_css:
- static/asciinema-player/custom-theme.css
- static/asciinema-player/asciinema-player.css
- static/extra.css
extra:
social:
@@ -142,7 +159,6 @@ extra:
- icon: fontawesome/solid/rss
link: /feed_rss_created.xml
plugins:
- search
- blog

View File

@@ -2,8 +2,11 @@
pkgs,
module-docs,
clan-cli-docs,
inventory-api-docs,
asciinema-player-js,
asciinema-player-css,
roboto,
fira-code,
...
}:
let
@@ -24,15 +27,21 @@ pkgs.stdenv.mkDerivation {
mkdocs-material
mkdocs-rss-plugin
mkdocs-macros
filelock # FIXME: this should be already provided by mkdocs-rss-plugin
]);
configurePhase = ''
mkdir -p ./site/reference/cli
cp -af ${module-docs}/* ./site/reference/
cp -af ${clan-cli-docs}/* ./site/reference/cli/
cp -af ${inventory-api-docs} ./site/reference/nix-api/inventory.md
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

@@ -12,13 +12,14 @@
# { clanCore = «derivation JSON»; clanModules = { ${name} = «derivation JSON» }; }
jsonDocs = import ./get-module-docs.nix {
inherit (inputs) nixpkgs;
inherit pkgs self;
inherit pkgs;
inherit (self.nixosModules) clanCore;
inherit (self) clanModules;
};
clanModulesFileInfo = pkgs.writeText "info.json" (builtins.toJSON jsonDocs.clanModules);
clanModulesReadmes = pkgs.writeText "info.json" (builtins.toJSON jsonDocs.clanModulesReadmes);
# clanModulesReadmes = pkgs.writeText "info.json" (builtins.toJSON jsonDocs.clanModulesReadmes);
# clanModulesMeta = pkgs.writeText "info.json" (builtins.toJSON jsonDocs.clanModulesMeta);
# Simply evaluated options (JSON)
renderOptions =
@@ -29,6 +30,7 @@
nativeBuildInputs = [
pkgs.python3
pkgs.mypy
self'.packages.clan-cli
];
}
''
@@ -36,7 +38,7 @@
patchShebangs --build $out
ruff format --check --diff $out
ruff --line-length 88 $out
ruff check --line-length 88 $out
mypy --strict $out
'';
@@ -49,28 +51,41 @@
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
export CLAN_MODULES=${clanModulesFileInfo}
export CLAN_MODULES_READMES=${clanModulesReadmes}
module-docs =
pkgs.runCommand "rendered"
{
buildInputs = [
pkgs.python3
self'.packages.clan-cli
# TODO: see postFixup clan-cli/default.nix:L188
self'.packages.clan-cli.propagatedBuildInputs
];
}
''
export CLAN_CORE_PATH=${self}
export CLAN_CORE_DOCS=${jsonDocs.clanCore}/share/doc/nixos/options.json
# A file that contains the links to all clanModule docs
export CLAN_MODULES=${clanModulesFileInfo}
mkdir $out
mkdir $out
# The python script will place mkDocs files in the output directory
python3 ${renderOptions}
'';
# The python script will place mkDocs files in the output directory
python3 ${renderOptions}
'';
in
{
devShells.docs = pkgs.callPackage ./shell.nix {
inherit (self'.packages) docs clan-cli-docs;
inherit module-docs;
inherit asciinema-player-js;
inherit asciinema-player-css;
inherit (self'.packages) docs clan-cli-docs inventory-api-docs;
inherit
asciinema-player-js
asciinema-player-css
module-docs
self'
;
};
packages = {
docs = pkgs.python3.pkgs.callPackage ./default.nix {
inherit (self'.packages) clan-cli-docs;
inherit (self'.packages) clan-cli-docs inventory-api-docs;
inherit (inputs) nixpkgs;
inherit module-docs;
inherit asciinema-player-js;

View File

@@ -3,7 +3,6 @@
pkgs,
clanCore,
clanModules,
self,
}:
let
allNixosModules = (import "${nixpkgs}/nixos/modules/module-list.nix") ++ [
@@ -13,7 +12,7 @@ let
clanCoreNixosModules = [
clanCore
{ clanCore.clanDir = ./.; }
{ clan.core.clanDir = ./.; }
] ++ allNixosModules;
# TODO: optimally we would not have to evaluate all nixos modules for every page
@@ -25,27 +24,24 @@ let
# improves eval performance slightly (10%)
getOptions = modules: (clanCoreNixos.extendModules { inherit modules; }).options;
getOptionsWithoutCore = modules: builtins.removeAttrs (getOptions modules) [ "core" ];
evalDocs =
options:
pkgs.nixosOptionsDoc {
options = options;
warningsAreErrors = false;
warningsAreErrors = true;
};
# clanModules docs
clanModulesDocs = builtins.mapAttrs (
name: module: (evalDocs ((getOptions [ module ]).clan.${name} or { })).optionsJSON
) clanModules;
clanModulesReadmes = builtins.mapAttrs (
module_name: _module: self.lib.modules.getReadme module_name
name: module: (evalDocs ((getOptionsWithoutCore [ module ]).clan.${name} or { })).optionsJSON
) clanModules;
# clanCore docs
clanCoreDocs = (evalDocs (getOptions [ ]).clanCore).optionsJSON;
clanCoreDocs = (evalDocs (getOptions [ ]).clan.core).optionsJSON;
in
{
inherit clanModulesReadmes;
clanCore = clanCoreDocs;
clanModules = clanModulesDocs;
}

View File

@@ -28,10 +28,12 @@ import os
from pathlib import Path
from typing import Any
from clan_cli.api.modules import Frontmatter, extract_frontmatter, get_roles
# Get environment variables
CLAN_CORE = os.getenv("CLAN_CORE")
CLAN_CORE_PATH = os.getenv("CLAN_CORE_PATH")
CLAN_CORE_DOCS = os.getenv("CLAN_CORE_DOCS")
CLAN_MODULES = os.environ.get("CLAN_MODULES")
CLAN_MODULES_READMES = os.environ.get("CLAN_MODULES_READMES")
OUT = os.environ.get("out")
@@ -40,13 +42,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:
@@ -75,7 +78,9 @@ def render_option(name: str, option: dict[str, Any], level: int = 3) -> str:
res = f"""
{"#" * level} {sanitize(name)}
{"Readonly" if read_only else ""}
{"**Readonly**" if read_only else ""}
{option.get("description", "No description available.")}
**Type**: `{option["type"]}`
@@ -108,17 +113,19 @@ def render_option(name: str, option: dict[str, Any], level: int = 3) -> str:
"""
decls = option.get("declarations", [])
source_path = replace_store_path(decls[0])
res += f"""
:simple-git: [{source_path.name}]({source_path})
if decls:
source_path, name = replace_store_path(decls[0])
print(source_path, name)
res += f"""
:simple-git: [{name}]({source_path})
"""
res += "\n"
res += "\n"
return res
def module_header(module_name: str) -> str:
return f"# {module_name}\n"
return f"# {module_name}\n\n"
def module_usage(module_name: str) -> str:
@@ -135,7 +142,7 @@ To use this module, import it like this:
"""
clan_core_descr = """ClanCore delivers all the essential features for every clan.
clan_core_descr = """ClanCore delivers all the essential features for every clan.
It's always included in your setup, and you can customize your clan's behavior with the configuration [options](#module-options) provided below.
"""
@@ -144,9 +151,9 @@ options_head = "\n## Module Options\n"
def produce_clan_core_docs() -> None:
if not CLAN_CORE:
if not CLAN_CORE_DOCS:
raise ValueError(
f"Environment variables are not set correctly: $CLAN_CORE={CLAN_CORE}"
f"Environment variables are not set correctly: $CLAN_CORE_DOCS={CLAN_CORE_DOCS}"
)
if not OUT:
@@ -154,14 +161,14 @@ def produce_clan_core_docs() -> None:
# A mapping of output file to content
core_outputs: dict[str, str] = {}
with open(CLAN_CORE) as f:
with open(CLAN_CORE_DOCS) as f:
options: dict[str, dict[str, Any]] = json.load(f)
module_name = "clan-core"
for option_name, info in options.items():
outfile = f"{module_name}/index.md"
# Create seperate files for nested options
if len(option_name.split(".")) <= 2:
# Create separate files for nested options
if len(option_name.split(".")) <= 3:
# i.e. clan-core.clanDir
output = core_outputs.get(
outfile,
@@ -172,7 +179,7 @@ def produce_clan_core_docs() -> None:
core_outputs[outfile] = output
else:
# Clan sub-options
[_, sub] = option_name.split(".")[0:2]
[_, sub] = option_name.split(".")[1:3]
outfile = f"{module_name}/{sub}.md"
# Get the content or write the header
output = core_outputs.get(outfile, render_option_header(sub))
@@ -186,14 +193,47 @@ def produce_clan_core_docs() -> None:
of.write(output)
def render_roles(roles: list[str] | None, module_name: str) -> str:
if roles:
roles_list = "\n".join([f" - `{r}`" for r in roles])
return f"""
???+ tip "Inventory usage"
Predefined roles:
{roles_list}
Usage:
```{{.nix hl_lines="4"}}
buildClan {{
inventory.services = {{
{module_name}.instance_1 = {{
roles.{roles[0]}.machines = [ "sara_machine" ];
# ...
}};
}};
}}
```
"""
return ""
clan_modules_descr = """Clan modules are [NixOS modules](https://wiki.nixos.org/wiki/NixOS_modules) which have been enhanced with additional features provided by Clan, with certain option types restricted to enable configuration through a graphical interface.
"""
def produce_clan_modules_docs() -> None:
if not CLAN_MODULES:
raise ValueError(
f"Environment variables are not set correctly: $CLAN_MODULES={CLAN_MODULES}"
)
if not CLAN_MODULES_READMES:
if not CLAN_CORE_PATH:
raise ValueError(
f"Environment variables are not set correctly: $CLAN_MODULES_READMES={CLAN_MODULES_READMES}"
f"Environment variables are not set correctly: $CLAN_CORE_PATH={CLAN_CORE_PATH}"
)
if not OUT:
@@ -202,18 +242,44 @@ def produce_clan_modules_docs() -> None:
with open(CLAN_MODULES) as f:
links: dict[str, str] = json.load(f)
with open(CLAN_MODULES_READMES) as readme:
readme_map: dict[str, str] = json.load(readme)
# with open(CLAN_MODULES_READMES) as readme:
# readme_map: dict[str, str] = json.load(readme)
# with open(CLAN_MODULES_META) as f:
# meta_map: dict[str, Any] = json.load(f)
# print(meta_map)
# {'borgbackup': '/nix/store/hi17dwgy7963ddd4ijh81fv0c9sbh8sw-options.json', ... }
modules_index = "# Modules Overview\n\n"
modules_index += clan_modules_descr
modules_index += "## Overview\n\n"
modules_index += '<div class="grid cards" markdown>\n\n'
for module_name, options_file in links.items():
readme_file = Path(CLAN_CORE_PATH) / "clanModules" / module_name / "README.md"
print(module_name, readme_file)
with open(readme_file) as f:
readme = f.read()
frontmatter: Frontmatter
frontmatter, readme_content = extract_frontmatter(readme, str(readme_file))
print(frontmatter, readme_content)
modules_index += build_option_card(module_name, frontmatter)
with open(Path(options_file) / "share/doc/nixos/options.json") as f:
options: dict[str, dict[str, Any]] = json.load(f)
print(f"Rendering options for {module_name}...")
output = module_header(module_name)
if readme_map.get(module_name, None):
output += f"{readme_map[module_name]}\n"
if frontmatter.description:
output += f"**{frontmatter.description}**\n\n"
output += f"{readme_content}\n"
# get_roles(str) -> list[str] | None
roles = get_roles(str(Path(CLAN_CORE_PATH) / "clanModules" / module_name))
if roles:
output += render_roles(roles, module_name)
output += module_usage(module_name)
@@ -229,6 +295,39 @@ def produce_clan_modules_docs() -> None:
with open(outfile, "w") as of:
of.write(output)
modules_index += "</div>"
modules_index += "\n"
modules_outfile = Path(OUT) / "clanModules/index.md"
with open(modules_outfile, "w") as of:
of.write(modules_index)
def build_option_card(module_name: str, frontmatter: Frontmatter) -> str:
"""
Build the overview index card for each reference target option.
"""
def indent_all(text: str, indent_size: int = 4) -> str:
"""
Indent all lines in a string.
"""
indent = " " * indent_size
lines = text.split("\n")
indented_text = indent + ("\n" + indent).join(lines)
return indented_text
def to_md_li(module_name: str, frontmatter: Frontmatter) -> str:
md_li = (
f"""- **[{module_name}](./{"-".join(module_name.split(" "))}.md)**\n\n"""
)
md_li += f"""{indent_all("---", 4)}\n\n"""
fmd = f"\n{frontmatter.description.strip()}" if frontmatter.description else ""
md_li += f"""{indent_all(fmd, 4)}"""
return md_li
return f"{to_md_li(module_name, frontmatter)}\n\n"
if __name__ == "__main__":
produce_clan_core_docs()

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