diff --git a/checks/installation/flake-module.nix b/checks/installation/flake-module.nix index b5f87ef12..ff5a5d92a 100644 --- a/checks/installation/flake-module.nix +++ b/checks/installation/flake-module.nix @@ -12,11 +12,11 @@ { lib, modulesPath, ... }: { imports = [ - self.clanModules.diskLayouts + self.clanModules.disk-layouts (modulesPath + "/testing/test-instrumentation.nix") # we need these 2 modules always to be able to run the tests (modulesPath + "/profiles/qemu-guest.nix") ]; - clan.diskLayouts.singleDiskExt4.device = "/dev/vdb"; + clan.disk-layouts.singleDiskExt4.device = "/dev/vdb"; environment.etc."install-successful".text = "ok"; diff --git a/clanModules/borgbackup/README.md b/clanModules/borgbackup/README.md new file mode 100644 index 000000000..b639786d3 --- /dev/null +++ b/clanModules/borgbackup/README.md @@ -0,0 +1,2 @@ +Efficient, deduplicating backup program with optional compression and secure encryption. +--- \ No newline at end of file diff --git a/clanModules/borgbackup.nix b/clanModules/borgbackup/default.nix similarity index 100% rename from clanModules/borgbackup.nix rename to clanModules/borgbackup/default.nix diff --git a/clanModules/deltachat/README.md b/clanModules/deltachat/README.md index 66968b371..3b5583fa1 100644 --- a/clanModules/deltachat/README.md +++ b/clanModules/deltachat/README.md @@ -1,4 +1,5 @@ Email-based instant messaging for Desktop. +--- !!! warning "Under construction" diff --git a/clanModules/disk-layouts/README.md b/clanModules/disk-layouts/README.md new file mode 100644 index 000000000..d88ecb7ac --- /dev/null +++ b/clanModules/disk-layouts/README.md @@ -0,0 +1,2 @@ +Automatically format a disk drive on clan installation +--- diff --git a/clanModules/diskLayouts.nix b/clanModules/disk-layouts/default.nix similarity index 90% rename from clanModules/diskLayouts.nix rename to clanModules/disk-layouts/default.nix index 32de6f11d..78f2295a0 100644 --- a/clanModules/diskLayouts.nix +++ b/clanModules/disk-layouts/default.nix @@ -1,6 +1,6 @@ { config, lib, ... }: { - options.clan.diskLayouts.singleDiskExt4 = { + options.clan.disk-layouts.singleDiskExt4 = { device = lib.mkOption { type = lib.types.str; example = "/dev/disk/by-id/ata-Samsung_SSD_850_EVO_250GB_S21PNXAGB12345"; @@ -13,7 +13,7 @@ disk = { main = { type = "disk"; - device = config.clan.diskLayouts.singleDiskExt4.device; + device = config.clan.disk-layouts.singleDiskExt4.device; content = { type = "gpt"; partitions = { diff --git a/clanModules/ergochat/README.md b/clanModules/ergochat/README.md new file mode 100644 index 000000000..ff4d14976 --- /dev/null +++ b/clanModules/ergochat/README.md @@ -0,0 +1,2 @@ +A modern IRC server +--- diff --git a/clanModules/ergochat.nix b/clanModules/ergochat/default.nix similarity index 100% rename from clanModules/ergochat.nix rename to clanModules/ergochat/default.nix diff --git a/clanModules/flake-module.nix b/clanModules/flake-module.nix index 8578e179a..1a80b37df 100644 --- a/clanModules/flake-module.nix +++ b/clanModules/flake-module.nix @@ -1,28 +1,25 @@ { inputs, ... }: { flake.clanModules = { - diskLayouts = { + disk-layouts = { imports = [ - ./diskLayouts.nix + ./disk-layouts inputs.disko.nixosModules.default ]; }; - borgbackup = ./borgbackup.nix; - ergochat = ./ergochat.nix; + borgbackup = ./borgbackup; + ergochat = ./ergochat; deltachat = ./deltachat; - graphical = ./graphical.nix; - localbackup = ./localbackup.nix; - localsend = ./localsend.nix; - matrix-synapse = ./matrix-synapse.nix; - moonlight = ./moonlight.nix; - sshd = ./sshd.nix; - sunshine = ./sunshine.nix; + localbackup = ./localbackup; + localsend = ./localsend; + matrix-synapse = ./matrix-synapse; + moonlight = ./moonlight; + sshd = ./sshd; + sunshine = ./sunshine; syncthing = ./syncthing; root-password = ./root-password; - thelounge = ./thelounge.nix; - vm-user = ./vm-user.nix; - xfce = ./xfce.nix; - xfce-vm = ./xfce-vm.nix; - zt-tcp-relay = ./zt-tcp-relay.nix; + thelounge = ./thelounge; + xfce = ./xfce; + zt-tcp-relay = ./zt-tcp-relay; }; } diff --git a/clanModules/graphical.nix b/clanModules/graphical.nix deleted file mode 100644 index e272d8b80..000000000 --- a/clanModules/graphical.nix +++ /dev/null @@ -1 +0,0 @@ -_: { fonts.enableDefaultPackages = true; } diff --git a/clanModules/localbackup/README.md b/clanModules/localbackup/README.md new file mode 100644 index 000000000..47eea811d --- /dev/null +++ b/clanModules/localbackup/README.md @@ -0,0 +1,2 @@ +Automatically backups current machine to local directory. +--- diff --git a/clanModules/localbackup.nix b/clanModules/localbackup/default.nix similarity index 100% rename from clanModules/localbackup.nix rename to clanModules/localbackup/default.nix diff --git a/clanModules/localsend/README.md b/clanModules/localsend/README.md new file mode 100644 index 000000000..7fd4d9dce --- /dev/null +++ b/clanModules/localsend/README.md @@ -0,0 +1,2 @@ +Securely sharing files and messages over a local network without internet connectivity. +--- diff --git a/clanModules/localsend.nix b/clanModules/localsend/default.nix similarity index 100% rename from clanModules/localsend.nix rename to clanModules/localsend/default.nix diff --git a/clanModules/matrix-synapse/README.md b/clanModules/matrix-synapse/README.md new file mode 100644 index 000000000..e53000b2b --- /dev/null +++ b/clanModules/matrix-synapse/README.md @@ -0,0 +1,2 @@ +A federated messaging server with end-to-end encryption. +--- diff --git a/clanModules/matrix-synapse.nix b/clanModules/matrix-synapse/default.nix similarity index 100% rename from clanModules/matrix-synapse.nix rename to clanModules/matrix-synapse/default.nix diff --git a/clanModules/moonlight/README.md b/clanModules/moonlight/README.md new file mode 100644 index 000000000..9abdc53ff --- /dev/null +++ b/clanModules/moonlight/README.md @@ -0,0 +1,2 @@ +A desktop streaming client optimized for remote gaming and synchronized movie viewing. +--- diff --git a/clanModules/moonlight.nix b/clanModules/moonlight/default.nix similarity index 100% rename from clanModules/moonlight.nix rename to clanModules/moonlight/default.nix diff --git a/clanModules/root-password/README.md b/clanModules/root-password/README.md index 1fd0c2ec3..a5a6d4855 100644 --- a/clanModules/root-password/README.md +++ b/clanModules/root-password/README.md @@ -1,6 +1,5 @@ -Creates a root-password - -!!! tip "This module sets the password for the root user (automatically)." +Automatically generates and configures a password for the root user. +--- After the system was installed/deployed the following command can be used to display the root-password: @@ -8,6 +7,5 @@ After the system was installed/deployed the following command can be used to dis clan secrets get {machine_name}-password ``` ---- See also: [Facts / Secrets](../../getting-started/secrets.md) diff --git a/clanModules/sshd/README.md b/clanModules/sshd/README.md new file mode 100644 index 000000000..57c1c333a --- /dev/null +++ b/clanModules/sshd/README.md @@ -0,0 +1,2 @@ +Enables secure remote access to the machine over ssh +--- diff --git a/clanModules/sshd.nix b/clanModules/sshd/default.nix similarity index 100% rename from clanModules/sshd.nix rename to clanModules/sshd/default.nix diff --git a/clanModules/sunshine/README.md b/clanModules/sunshine/README.md new file mode 100644 index 000000000..11dbf9b07 --- /dev/null +++ b/clanModules/sunshine/README.md @@ -0,0 +1,2 @@ +A desktop streaming server optimized for remote gaming and synchronized movie viewing. +--- diff --git a/clanModules/sunshine.nix b/clanModules/sunshine/default.nix similarity index 100% rename from clanModules/sunshine.nix rename to clanModules/sunshine/default.nix diff --git a/clanModules/syncthing/README.md b/clanModules/syncthing/README.md index 6f719e781..1bffe740e 100644 --- a/clanModules/syncthing/README.md +++ b/clanModules/syncthing/README.md @@ -1,7 +1,5 @@ -Syncthing is a free, open-source file synchronization application designed to allow users to synchronize files between multiple devices over the internet or local networks securely and privately. - -It is an alternative to cloud-based file sharing services. - +A secure, file synchronization app for devices over networks, offering a private alternative to cloud services. +--- ## Usage We recommend configuring this module as an sync-service through the provided options. Although it provides a Web GUI through which more usage scenarios are supported. diff --git a/clanModules/thelounge/README.md b/clanModules/thelounge/README.md new file mode 100644 index 000000000..717146928 --- /dev/null +++ b/clanModules/thelounge/README.md @@ -0,0 +1,2 @@ +Modern web IRC client +--- diff --git a/clanModules/thelounge.nix b/clanModules/thelounge/default.nix similarity index 100% rename from clanModules/thelounge.nix rename to clanModules/thelounge/default.nix diff --git a/clanModules/vm-user.nix b/clanModules/vm-user.nix deleted file mode 100644 index 28e93535e..000000000 --- a/clanModules/vm-user.nix +++ /dev/null @@ -1,20 +0,0 @@ -{ - security = { - sudo.wheelNeedsPassword = false; - polkit.enable = true; - rtkit.enable = true; - }; - - users.users.user = { - isNormalUser = true; - createHome = true; - uid = 1000; - initialHashedPassword = ""; - extraGroups = [ - "wheel" - "video" - "render" - ]; - shell = "/run/current-system/sw/bin/bash"; - }; -} diff --git a/clanModules/xfce-vm.nix b/clanModules/xfce-vm.nix deleted file mode 100644 index 7eadd7f42..000000000 --- a/clanModules/xfce-vm.nix +++ /dev/null @@ -1,15 +0,0 @@ -{ - imports = [ - ./vm-user.nix - ./graphical.nix - ]; - - services.xserver = { - enable = true; - displayManager.autoLogin.enable = true; - displayManager.autoLogin.user = "user"; - desktopManager.xfce.enable = true; - desktopManager.xfce.enableScreensaver = false; - xkb.layout = "us"; - }; -} diff --git a/clanModules/xfce/README.md b/clanModules/xfce/README.md new file mode 100644 index 000000000..ed97d539c --- /dev/null +++ b/clanModules/xfce/README.md @@ -0,0 +1 @@ +--- diff --git a/clanModules/xfce.nix b/clanModules/xfce/default.nix similarity index 100% rename from clanModules/xfce.nix rename to clanModules/xfce/default.nix diff --git a/clanModules/zt-tcp-relay/README.md b/clanModules/zt-tcp-relay/README.md new file mode 100644 index 000000000..ed97d539c --- /dev/null +++ b/clanModules/zt-tcp-relay/README.md @@ -0,0 +1 @@ +--- diff --git a/clanModules/zt-tcp-relay.nix b/clanModules/zt-tcp-relay/default.nix similarity index 92% rename from clanModules/zt-tcp-relay.nix rename to clanModules/zt-tcp-relay/default.nix index 7ad8f438f..005e65797 100644 --- a/clanModules/zt-tcp-relay.nix +++ b/clanModules/zt-tcp-relay/default.nix @@ -20,7 +20,7 @@ after = [ "network.target" ]; serviceConfig = { ExecStart = "${ - pkgs.callPackage ../pkgs/zt-tcp-relay { } + pkgs.callPackage ../../pkgs/zt-tcp-relay { } }/bin/zt-tcp-relay --listen [::]:${builtins.toString config.clan.zt-tcp-relay.port}"; Restart = "always"; RestartSec = "5"; diff --git a/docs/mkdocs.yml b/docs/mkdocs.yml index 70e456fc4..4016dbcc6 100644 --- a/docs/mkdocs.yml +++ b/docs/mkdocs.yml @@ -55,9 +55,8 @@ nav: - clanModules: - reference/clanModules/borgbackup.md - reference/clanModules/deltachat.md - - reference/clanModules/diskLayouts.md + - reference/clanModules/disk-layouts.md - reference/clanModules/ergochat.md - - reference/clanModules/graphical.md - reference/clanModules/localbackup.md - reference/clanModules/localsend.md - reference/clanModules/matrix-synapse.md @@ -67,8 +66,6 @@ nav: - reference/clanModules/sunshine.md - reference/clanModules/syncthing.md - reference/clanModules/thelounge.md - - reference/clanModules/vm-user.md - - reference/clanModules/xfce-vm.md - reference/clanModules/xfce.md - reference/clanModules/zt-tcp-relay.md - Contributing: contributing/contributing.md diff --git a/docs/nix/get-module-docs.nix b/docs/nix/get-module-docs.nix index 25e67a88b..830e52fa2 100644 --- a/docs/nix/get-module-docs.nix +++ b/docs/nix/get-module-docs.nix @@ -38,7 +38,7 @@ let ) clanModules; clanModulesReadmes = builtins.mapAttrs ( - module_name: _module: self.lib.modules.getDescription module_name + module_name: _module: self.lib.modules.getReadme module_name ) clanModules; # clanCore docs diff --git a/lib/description.nix b/lib/description.nix index 0cd302187..deb315b44 100644 --- a/lib/description.nix +++ b/lib/description.nix @@ -1,19 +1,26 @@ { clan-core, ... }: -{ - getDescription = +rec { + getReadme = modulename: let readme = "${clan-core}/clanModules/${modulename}/README.md"; readmeContents = - if - builtins.trace "Trying to get Module README.md for ${modulename} from ${readme}" - # TODO: Edge cases - (builtins.pathExists readme) - then + if (builtins.pathExists readme) then (builtins.readFile readme) else - null; + throw "No README.md found for module ${modulename}"; in readmeContents; + + getShortDescription = + modulename: + let + content = (getReadme modulename); + parts = builtins.split "---" content; + in + if (builtins.length parts) > 0 then + builtins.head parts + else + throw "Short description delimiter `---` not found in README.md for module ${modulename}"; } diff --git a/pkgs/schemas/flake-module.nix b/pkgs/schemas/flake-module.nix index c0be58265..e3f17a0e7 100644 --- a/pkgs/schemas/flake-module.nix +++ b/pkgs/schemas/flake-module.nix @@ -38,7 +38,7 @@ clanModuleFunctionSchemas = lib.mapAttrsFlatten (modulename: module: { name = modulename; - description = self.lib.modules.getDescription modulename; + description = self.lib.modules.getShortDescription modulename; parameters = self.lib.jsonschema.parseOptions (optionsFromModule modulename module); }) clanModules; in @@ -46,7 +46,7 @@ checks = { module-schema = pkgs.runCommand "schema-checks" { } '' ${pkgs.check-jsonschema}/bin/check-jsonschema \ - --check-metaschema ${packages.module-schema} + --check-metaschema --fill-defaults ${packages.module-schema} touch $out ''; }; diff --git a/templates/new-clan/modules/shared.nix b/templates/new-clan/modules/shared.nix index 5cc1ca73f..56477b433 100644 --- a/templates/new-clan/modules/shared.nix +++ b/templates/new-clan/modules/shared.nix @@ -2,7 +2,7 @@ { imports = [ clan-core.clanModules.sshd - clan-core.clanModules.diskLayouts + clan-core.clanModules.disk-layouts clan-core.clanModules.root-password ]; }