Skip to content

Commit

Permalink
docs(README): update README with current instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
dr460nf1r3 committed Sep 13, 2023
1 parent 5129111 commit 4ae0ee6
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 35 deletions.
68 changes: 33 additions & 35 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,32 +5,55 @@

## General information

The Garuda Nix Subsystem is a Nix flake which allows easy dual boot with Garuda Linux. But it also provides a framework for pure NixOS, which provides opiniated defaults and a system which can be fully set up by toggling a few module options.

## Quick links

## Devshell and tooling
- Coming soon™️

## Devshell and how to enter it

This NixOS flake provides a [devshell](https://github.com/numtide/devshell) which contains all deployment tools as well as handy aliases for common tasks.
The only requirement for using it is having the Nix package manager available and having flakes enabled. It can be installed on various distributions via the package manager or the following script:
The only requirement for using it is having the Nix package manager available. It can be installed on various distributions via the package manager or the following script ([click me for more information](https://zero-to-nix.com/start/install)):

```
sh <(curl -L https://nixos.org/nix/install) --daemon
```sh
curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix -o nix-install.sh # Check its content afterwards
sh ./nix-install.sh install --diagnostic-endpoint=""
```

After that, the shell can be invoked as follows:
This installs the Nix packages with flakes already pre-enabled. After that, the shell can be invoked as follows:

```
nix-shell # Assuming flakes are not enabled, this bootstraps the needed files and sets up the pre-commit hook
nix develop # Contains our custom tools like `gns-update`
```sh
nix develop # The intended way to use the devshell
nix-shell # Legacy, non-flakes way if flakes are not available for some reason
```

To enable flakes and the direct usage of `nix develop` follow this [wiki article](https://nixos.wiki/wiki/Flakes#Other_Distros:_Without_Home-Manager).
This also sets up pre-commit-hooks and shows the currently implemented tasks, which can be executed by running the command.

```sh
[infra-nix]

ansible-core - Radically simple IT automation
apply - Applies the infra-nix configuration pushed to the servers
buildiso-local - Spawns a local buildiso shell to build to ./buildiso (needs Docker)
buildiso-remote - Spawn a buildiso shell on the iso-runner builder
clean - Runs the garbage collection on the servers
deploy - Deploys the local NixOS configuration to the servers
update - Performs a full system update on the servers by bumping flake lock
update-forum - Updates the Discourse container of our forum
update-toolbox - Updates the locked Chaotic toolbox commit and deploys the changes
update-website - Updates the locked website commit and deploys the changes
```

## General structure

A general overview of the folder structure can be found below:

```
```sh
├── devshell
├── docs
│   ├── src
│   └── theme
├── internal
│   ├── modules
│   │   ├── base
Expand All @@ -40,28 +63,3 @@ A general overview of the folder structure can be found below:
│   └── testing
└── lib
```

## Linting and formatting

We utilize [pre-commit-hooks](https://github.com/cachix/pre-commit-hooks.nix) to automatically set up the pre-commit-hook with all the tools once `nix-shell` is run for the first time. Checks can then be executed by running either

```
nix flake check # checks flake outputs and runs pre-commit at the end
pre-commit run --all-files # only runs the pre-commit tools on all files
```

Its configuration can be found in the `devshell` folder ([click me](https://gitlab.com/garuda-linux/infra-nix/-/blob/main/devshell/flake-module.nix?ref_type=heads#L110)). At the time of writing, the following tools are being run:

- [commitizen](https://github.com/commitizen-tools/commitizen)
- [deadnix](https://github.com/astro/deadnix)
- [nil](https://github.com/oxalica/nil)
- [nixpkgs-fmt](https://github.com/nix-community/nixpkgs-fmt)
- [prettier](https://prettier.io/)
- [shellcheck](https://github.com/koalaman/shellcheck)
- [shfmt](https://github.com/mvdan/sh)
- [statix](https://github.com/nerdypepper/statix)
- [yamllint](https://github.com/adrienverge/yamllint)

It is recommended to run `pre-commit run --all-files` before commiting any files. Then use `cz commit` to generate a `commitizen` complying commit message.

## CI tooling
1 change: 1 addition & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
}: {
checks.pre-commit-check = pre-commit-hooks.lib.${system}.run {
hooks = {
actionlint.enable = true;
commitizen.enable = true;
deadnix.enable = true;
nil.enable = true;
Expand Down

0 comments on commit 4ae0ee6

Please sign in to comment.