2023-07-08 12:55:04 +00:00
---
title: Project structure
---
= Project structure
2023-08-03 10:11:04 +00:00
Next, we have the project directory — the environment you'll be living in for the next year, tinkering your Nix configs.
2023-07-08 12:55:04 +00:00
It is required to be familiar with the workspace, after all.
2023-07-26 10:05:22 +00:00
My configuration takes a lot of cues from link:{devos-link}[devos] (which is unfortunately is a lot to take if you're just beginning to grok Nix as a whole).
2023-07-08 12:55:04 +00:00
My NixOS config should look like the following:
[source, tree]
----
nixos-config
2023-07-14 12:18:57 +00:00
├── docs/
2023-07-08 12:55:04 +00:00
├── hosts/
├── lib/
├── modules/
2023-09-25 10:38:52 +00:00
├── overlays/
2023-07-08 12:55:04 +00:00
├── pkgs/
├── scripts/
├── secrets/
├── shells/
├── templates/
├── users/
├── default.nix
├── flake.lock
├── flake.nix
├── images.toml
2023-07-09 04:15:32 +00:00
├── users.toml
2023-07-08 12:55:04 +00:00
└── README.adoc
----
2023-07-09 04:15:32 +00:00
One of the more notable files here when first start looking is the `./images.toml` file where it contains a description of the images.
2023-07-14 11:09:23 +00:00
For more details, see xref:../../03-project-specific-setup/01-declarative-host-management/index.adoc[Declarative host management].
2023-07-08 12:55:04 +00:00
2023-07-09 04:15:32 +00:00
A similar file, `./users.toml`, contains the description for the home-manager users to be exported from this flake.
2023-07-14 11:09:23 +00:00
For more details, see xref:../../03-project-specific-setup/02-declarative-user-management/index.adoc[Declarative user management].
2023-07-08 12:55:04 +00:00
2023-07-14 11:09:23 +00:00
Most of the said folders are related to a flake output attribute, see xref:../03-whats-in-my-flake/index.adoc[What's in my flake?] for more details.
2023-07-09 04:15:32 +00:00
2023-07-14 12:18:57 +00:00
* `./docs/` contain the source code for the website.
Currently, it uses link:https://gohugo.io/[Hugo] for statically generating the website.
2023-07-09 04:15:32 +00:00
* `./hosts/` contain machine-specific configuration.
2023-07-08 12:55:04 +00:00
This usually configures like the hardware setup, timezone, and users.
Host configurations are also exported in the flakes in `outputs.nixosConfigurations`.
2023-07-09 04:15:32 +00:00
* `./modules/` contain my custom modules including NixOS and home-manager modules.
For more information, see the github:{github-repo}[related documentation, path=./modules/README.adoc, rev=master].
2023-07-08 12:55:04 +00:00
2023-09-25 10:38:52 +00:00
* `./overlays/` contain the overlays for several established packages.
This is typically used exclusively for the project and advised to not use it if you're not foodogsquared.
2023-07-09 04:15:32 +00:00
* `./pkgs/` contains my custom packages.
2023-07-08 12:55:04 +00:00
It is exported in the flakes at `outputs.packages` compiled through various systems.
2023-07-09 04:15:32 +00:00
* `./scripts/` contains various scripts for various purposes.
2023-07-08 12:55:04 +00:00
Should be self-explanatory.
2023-07-09 04:15:32 +00:00
* `./secrets/` contains my cluster-wide secrets managed with github:mozilla/sops[opts=repo] and github:Mic92/sops-nix[opts=repo].
2023-07-08 12:55:04 +00:00
Take note, each component (e.g., hosts, modules, users) could have their own specific secrets.
2023-07-14 11:09:23 +00:00
For more information, see xref:../../03-project-specific-setup/03-secrets-management/index.adoc[Secrets management].
2023-07-08 12:55:04 +00:00
2023-07-09 04:15:32 +00:00
* `./shells/` contains my development shells for interacting with the usual type of projects.
2023-07-08 12:55:04 +00:00
Setting this up can bring benefits outside of NixOS (unless you're interacting with projects with any OpenGL-related stuff).
footnote:[Since packages brought from Nix shells can only work with the store, a container might be better at some situations.]
2023-07-09 04:15:32 +00:00
* `./templates/` contains my custom templates handy for quickly initializing for various types of projects.
2023-07-08 12:55:04 +00:00
2023-07-09 04:15:32 +00:00
* `./users/` contains my github:nix-community/home-manager[opts=repo] configurations.
2023-07-08 12:55:04 +00:00
It is exported in the flakes at `outputs.homeConfigurations`.
2023-07-09 04:15:32 +00:00
For more information, see the github:{github-repo}[related documentation, path=./users/README.adoc, rev=master].