diff --git a/docs/requirements.txt b/docs/requirements.txt index 372f33b..f9a29ab 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1,3 +1,4 @@ sphinx-click +myst-parser # furo sphinx theme furo diff --git a/docs/source/cli.md b/docs/source/cli.md new file mode 100644 index 0000000..53847fb --- /dev/null +++ b/docs/source/cli.md @@ -0,0 +1,18 @@ +# CLI Interface + +```{eval-rst} +.. click:: main:cli + :nested: none + :prog: kupferbootstrap + +``` + +## Commands + +% generated by cmd.rst + +```{toctree} +:glob: true + +cli/* +``` diff --git a/docs/source/cli.rst b/docs/source/cli.rst deleted file mode 100644 index b848f6e..0000000 --- a/docs/source/cli.rst +++ /dev/null @@ -1,17 +0,0 @@ -############# -CLI Interface -############# - -.. click:: main:cli - :nested: none - :prog: kupferbootstrap - - -Commands -======== - -.. generated by cmd.rst -.. toctree:: - :glob: - - cli/* diff --git a/docs/source/cmd.rst b/docs/source/cmd.md similarity index 80% rename from docs/source/cmd.rst rename to docs/source/cmd.md index 62b624f..a892022 100644 --- a/docs/source/cmd.rst +++ b/docs/source/cmd.md @@ -1,8 +1,11 @@ -:orphan: -:nosearch: +--- +nosearch: true +orphan: true +--- only used to trigger builds of the submodule docs! +```{eval-rst} .. autosummary:: :toctree: cli :template: command.rst @@ -16,3 +19,4 @@ only used to trigger builds of the submodule docs! image net packages +``` diff --git a/docs/source/conf.py b/docs/source/conf.py index 76e7048..fe0dc90 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -5,7 +5,9 @@ sys.path.insert(0, os.path.abspath('../..')) extensions = [ 'sphinx_click', 'sphinx.ext.autosummary', # Create neat summary tables + 'myst_parser' ] +myst_all_links_external = True templates_path = ['templates'] project = 'Kupfer👢strap' html_title = 'Kupferbootstrap' diff --git a/docs/source/config.md b/docs/source/config.md new file mode 100644 index 0000000..bf6e0f5 --- /dev/null +++ b/docs/source/config.md @@ -0,0 +1,121 @@ +# Configuration + +Kupferbootstrap uses [toml](https://en.wikipedia.org/wiki/TOML) for its configuration file. + +The file can either be edited manually or managed via the {doc}`cli/config` subcommand. + +You can quickly generate a default config by running {code}`kupferbootstrap config init -N`. + +## File Location + +The configuration is stored in `~/.config/kupfer/kupferbootstrap.toml`, where `~` is your user's home folder. + +Kupferbootstrap needs to create a number of folders, e.g. to download `PKGBUILDs.git` and store binary packages. +By default, all of those folders live inside `~/.cache/kupfer/`. + +See also the `[paths]` section in your config. + +## Sections + +A config file is split into sections like so: + +```toml +[pkgbuilds] +git_repo = "https://gitlab.com/kupfer/packages/pkgbuilds.git" +git_branch = "dev" + +[pacman] +parallel_downloads = 3 +``` + +Here, we have two sections: `pkgbuilds` and `pacman`. + +## Flavours + +Flavours are preset collections of software and functionality to enable, +i.e. desktop environments like [Gnome](https://en.wikipedia.org/wiki/GNOME) +and [Phosh](https://en.wikipedia.org/wiki/Phosh). + +## Profiles + +The last section and currently the only one with subsections is the `profiles` section. + +A profile is the configuration of a specific device image. It specifies (amongst others): + +- the device model +- the flavour (desktop environment) +- the host- and user name +- extra packages to install + +Using a profile's `parent` key, +you can inherit settings from another profile. + +This allows you to easily keep a number of slight variations of the same target profile around +without the need to constantly modify your Kupferbootstrap configuration file. + +You can easily create new profiles with +[kupferbootstrap config profile init](../cli/config/#kupferbootstrap-config-profile-init). + +Here's an example: + +```toml +[profiles] +current = "graphical" + +[profiles.default] +parent = "" +device = "oneplus-enchilada" +flavour = "barebone" +pkgs_include = [ "wget", "rsync", "nano", "tmux", "zsh", "pv", ] +pkgs_exclude = [] +hostname = "kupferphone" +username = "prawn" +size_extra_mb = 800 + +[profiles.graphical] +parent = "default" +flavour = "phosh" +pkgs_include = [ "firefox", "tilix", "gnome-tweaks" ] +size_extra_mb = "+3000" + +[profiles.hades] +parent = "graphical" +flavour = "phosh" +hostname = "hades" + +[profiles.recovery] +parent = "default" +flavour = "debug-shell" + +[profiles.beryllium] +parent = "graphical" +device = "xiaomi-beryllium-ebbg" +flavour = "gnome" +hostname = "pocof1" +``` + +The `current` key in the `profiles` section controlls which profile gets used by Kupferbootstrap by default. + +The first subsection (`profiles.default`) describes the `default` profile +which gets created by [config init](../cli/config/#kupferbootstrap-config-init). + +Next, we have a `graphical` profile that defines a couple of graphical programs for all but the `recovery` profile, +since that doesn't have a GUI. + +### `size_extra_mb` + +Note how `size_extra_mb` can either be a plain integer (`800`) or a string, +optionally leading with a plus sign (`+3000`), +which instructs Kupferbootstrap to add the value to the parent profile's `size_extra_mb`. + +### `pkgs_include` / `pkgs_exclude` + +Like `size_extra_mb`, `pkgs_include` will be merged with the parent profile's `pkgs_include`. + +To exclude unwanted packages from being inherited from a parent profile, use `pkgs_exclude` in the child profile. + +```{hint} +`pkgs_exclude` has no influence on Pacman's dependency resolution. +It only blocks packages during image build that would usually be explicitly installed +due to being listed in a parent profile or the selected flavour. +``` diff --git a/docs/source/config.rst b/docs/source/config.rst deleted file mode 100644 index 613a3eb..0000000 --- a/docs/source/config.rst +++ /dev/null @@ -1,134 +0,0 @@ -############# -Configuration -############# - - -Kupferbootstrap uses `toml `_ for its configuration file. - -The file can either be edited manually or managed via the :doc:`cli/config` subcommand. - -You can quickly generate a default config by running :code:`kupferbootstrap config init -N`. - - -File Location -############# - -The configuration is stored in ``~/.config/kupfer/kupferbootstrap.toml``, where ``~`` is your user's home folder. - -Kupferbootstrap needs to create a number of folders, e.g. to download ``PKGBUILDs.git`` and store binary packages. -By default, all of those folders live inside ``~/.cache/kupfer/``. - -See also the ``[paths]`` section in your config. - -Sections -######## - -A config file is split into sections like so: - -.. code-block:: toml - - [pkgbuilds] - git_repo = "https://gitlab.com/kupfer/packages/pkgbuilds.git" - git_branch = "dev" - - [pacman] - parallel_downloads = 3 - - -Here, we have two sections: ``pkgbuilds`` and ``pacman``. - -Flavours -######## - -Flavours are preset collections of software and functionality to enable, -i.e. desktop environments like `Gnome `_ -and `Phosh `_. - - -Profiles -######## - -The last section and currently the only one with subsections is the ``profiles`` section. - -A profile is the configuration of a specific device image. It specifies (amongst others): - -* the device model -* the flavour (desktop environment) -* the host- and user name -* extra packages to install - -Using a profile's ``parent`` key, -you can inherit settings from another profile. - -This allows you to easily keep a number of slight variations of the same target profile around -without the need to constantly modify your Kupferbootstrap configuration file. - -You can easily create new profiles with -`kupferbootstrap config profile init <../cli/config/#kupferbootstrap-config-profile-init>`_. - -Here's an example: - -.. code:: toml - - [profiles] - current = "graphical" - - [profiles.default] - parent = "" - device = "oneplus-enchilada" - flavour = "barebone" - pkgs_include = [ "wget", "rsync", "nano", "tmux", "zsh", "pv", ] - pkgs_exclude = [] - hostname = "kupferphone" - username = "prawn" - size_extra_mb = 800 - - [profiles.graphical] - parent = "default" - flavour = "phosh" - pkgs_include = [ "firefox", "tilix", "gnome-tweaks" ] - size_extra_mb = "+3000" - - [profiles.hades] - parent = "graphical" - flavour = "phosh" - hostname = "hades" - - [profiles.recovery] - parent = "default" - flavour = "debug-shell" - - [profiles.beryllium] - parent = "graphical" - device = "xiaomi-beryllium-ebbg" - flavour = "gnome" - hostname = "pocof1" - - - -The ``current`` key in the ``profiles`` section controlls which profile gets used by Kupferbootstrap by default. - -The first subsection (``profiles.default``) describes the `default` profile -which gets created by `config init <../cli/config/#kupferbootstrap-config-init>`_. - -Next, we have a `graphical` profile that defines a couple of graphical programs for all but the `recovery` profile, -since that doesn't have a GUI. - -``size_extra_mb`` ------------------ - -Note how ``size_extra_mb`` can either be a plain integer (``800``) or a string, -optionally leading with a plus sign (``+3000``), -which instructs Kupferbootstrap to add the value to the parent profile's ``size_extra_mb``. - -``pkgs_include`` / ``pkgs_exclude`` ------------------------------------ - -Like ``size_extra_mb``, ``pkgs_include`` will be merged with the parent profile's ``pkgs_include``. - -To exclude unwanted packages from being inherited from a parent profile, use ``pkgs_exclude`` in the child profile. - -.. hint:: - ``pkgs_exclude`` has no influence on Pacman's dependency resolution. - It only blocks packages during image build that would usually be explicitly installed - due to being listed in a parent profile or the selected flavour. diff --git a/docs/source/index.md b/docs/source/index.md new file mode 100644 index 0000000..82a3e72 --- /dev/null +++ b/docs/source/index.md @@ -0,0 +1,12 @@ +# Kupferbootstrap Documentation + +This is the documentation for [Kupferbootstrap](https://gitlab.com/kupfer/kupferbootstrap), +a tool to build and flash packages and images for the [Kupfer](https://gitlab.com/kupfer/) mobile Linux distro. + +## Documentation pages + +```{toctree} +install +config +cli +``` diff --git a/docs/source/index.rst b/docs/source/index.rst deleted file mode 100644 index 44c3f96..0000000 --- a/docs/source/index.rst +++ /dev/null @@ -1,16 +0,0 @@ -############################# -Kupferbootstrap Documentation -############################# - -This is the documentation for `Kupferbootstrap `_, -a tool to build and flash packages and images for the `Kupfer `_ mobile Linux distro. - - -Documentation pages -=================== - -.. toctree:: - - install - config - cli diff --git a/docs/source/install.md b/docs/source/install.md new file mode 100644 index 0000000..17c8266 --- /dev/null +++ b/docs/source/install.md @@ -0,0 +1,32 @@ +# Installation + +1. Install Python 3, Docker, and git. + + On Arch: `pacman -S python docker git --needed --noconfirm` + + ```{Hint} + After installing Docker you will have to add your user to the `docker` group: + + `sudo usermod -aG docker "$(whoami)"` + + Then restart your desktop session for the new group to take effect. + ``` + +2. Pick which Kupferbootstrap branch to clone: usually either `main` or `dev` + +3. Clone the repository: `git clone -b INSERT_BRANCHNAME_HERE https://gitlab.com/kupfer/kupferbootstrap` + +4. Change into the folder: `cd kupferbootstrap` + +5. Install python dependencies: `pip3 install -r requirements.txt` + + ```{Note} + Most of our python dependencies are available as distro packages on most distros, + sadly it's incomplete on Arch. + + See `requirements.txt` for the list of required python packages. + ``` + +6. Symlink `kupferbootstrap` into your `$PATH`: `sudo ln -s "$(pwd)/bin/kupferbootstrap" /usr/local/bin/` + +7. You should now be able to run `kupferbootstrap --help`! diff --git a/docs/source/install.rst b/docs/source/install.rst deleted file mode 100644 index 4620758..0000000 --- a/docs/source/install.rst +++ /dev/null @@ -1,35 +0,0 @@ -############ -Installation -############ - - -#. - Install Python 3, Docker, and git. - - On Arch: ``pacman -S python docker git --needed --noconfirm`` - - .. Hint:: - After installing Docker you will have to add your user to the ``docker`` group: - - ``sudo usermod -aG docker "$(whoami)"`` - - Then restart your desktop session for the new group to take effect. - -#. Pick which Kupferbootstrap branch to clone: usually either ``main`` or ``dev`` - -#. Clone the repository: ``git clone -b INSERT_BRANCHNAME_HERE https://gitlab.com/kupfer/kupferbootstrap`` - -#. Change into the folder: ``cd kupferbootstrap`` - -#. - Install python dependencies: ``pip3 install -r requirements.txt`` - - .. Note:: - Most of our python dependencies are available as distro packages on most distros, - sadly it's incomplete on Arch. - - See ``requirements.txt`` for the list of required python packages. - -#. Symlink ``kupferbootstrap`` into your ``$PATH``: ``sudo ln -s "$(pwd)/bin/kupferbootstrap" /usr/local/bin/`` - -#. You should now be able to run ``kupferbootstrap --help``!