2023-09-19 09:36:14 -04:00
# My NixOS configs
2024-11-12 16:55:57 -05:00
## AGS
2024-01-18 09:41:57 -05:00
You might find it weird that most of my config is written in TypeScript.
2024-01-18 10:40:59 -05:00
That's because all my desktops run
2024-11-12 16:55:57 -05:00
[AGSv2 ](https://github.com/Aylur/ags/tree/v2 )
2024-01-18 10:40:59 -05:00
for UI. Click on
2024-11-12 16:55:57 -05:00
[this ](https://git.nelim.org/matt1432/nixos-configs/src/branch/master/nixosModules/ags-v2 )
2024-01-18 10:40:59 -05:00
to see my configuration.
2024-01-18 09:41:57 -05:00
2024-03-26 13:55:55 -04:00
I'm also a victim of Stockholm syndrome at this point and make my scripts
in TypeScript because it's the scripting language I am most comfortable with.
2024-01-17 20:16:26 -05:00
## About
2023-09-19 09:36:14 -04:00
2024-01-18 10:40:59 -05:00
### General
This repo is the complete configuration of machines I own,
2024-08-02 22:32:29 -04:00
running NixOS or Nix. Its structure is based on a flake's
[outputs ](https://wiki.nixos.org/wiki/Flakes#Output_schema ).
2024-01-18 10:40:59 -05:00
### Flake Location
2024-03-26 13:55:55 -04:00
This git repo will always be located at `$FLAKE` (`config.environment.variables.FLAKE`)
2024-01-18 10:40:59 -05:00
and symlinked to `/etc/nixos` to have everything where NixOS tools
expect things to be.
ie.
```bash
sudo rm -r /etc/nixos
2024-03-26 13:55:55 -04:00
echo "$FLAKE" # /home/matt/.nix
2024-01-18 10:40:59 -05:00
sudo ln -sf /home/matt/.nix /etc/nixos
```
### Flake Outputs
| Output | Description |
| ---------------------------------- | ----------- |
| `nixosConfigurations` | [devices ](https://git.nelim.org/matt1432/nixos-configs/src/branch/master/devices )' + ISO's configurations |
| `nixOnDroidConfigurations.default` | [Nix-On-Droid ](https://git.nelim.org/matt1432/nixos-configs/src/branch/master/devices/android )'s configuration |
2024-07-21 17:30:11 -04:00
| `packages` | Some custom [packages ](https://git.nelim.org/matt1432/nixos-configs/src/branch/master/packages ) not available in nixpkgs or modified from it |
| `legacyPackages` | Some custom [package scopes ](https://git.nelim.org/matt1432/nixos-configs/src/branch/master/legacyPackages ) not available in nixpkgs or modified from it |
2024-08-02 22:32:29 -04:00
| `apps` | Scripts ran from the flake defined [here ](https://git.nelim.org/matt1432/nixos-configs/src/branch/master/apps ) |
| `homeManagerModules` | [Modules ](https://git.nelim.org/matt1432/nixos-configs/src/branch/master/homeManagerModules ) made for home-manager |
| `homeManagerModules` | [Modules ](https://git.nelim.org/matt1432/nixos-configs/src/branch/master/nixosModules ) made for NixOS systems |
2024-06-26 14:47:14 -04:00
| `formatter` | I format nix code with [alejandra ](https://github.com/kamadorueda/alejandra ) |
2024-01-18 10:40:59 -05:00
| `devShells.default` | A dev shell to build an ISO from the live-image nixosConfiguration |
2024-06-26 14:47:14 -04:00
| `devShells.ags` | A dev shell to have a NodeJS env when I enter my AGS's config directory |
2024-01-18 10:40:59 -05:00
### Flake Inputs
2024-06-26 14:47:14 -04:00
To allow use of the full nix language for my inputs, I use [genflake ](https://github.com/jorsn/flakegen ).
2024-08-05 20:51:11 -04:00
Therefore, the flake I edit is located at `./outputs.nix` .
2024-05-20 01:17:07 -04:00
I also prefer using a more descriptive format for my inputs like so:
2024-01-18 10:40:59 -05:00
```nix
nixpkgs = {
type = "github";
owner = "NixOS";
repo = "nixpkgs";
# Branch name
ref = "nixos-unstable";
# Pin this input to a specific commit
rev = "842d9d80cfd4560648c785f8a4e6f3b096790e19";
};
```
to make it more clear what is what in the flake URI
### Secrets
All my secrets are in a private git repo that makes use of
[sops-nix ](https://github.com/Mic92/sops-nix ).
2024-05-19 14:02:08 -04:00
I generate `.sops.yaml` from `.sops.nix` :
2024-01-18 10:40:59 -05:00
```nix
let
wim = "somekey";
2024-07-14 22:59:33 -04:00
binto = "somekey2";
2024-01-18 10:40:59 -05:00
in {
creation_rules = [
{
path_regex = "secrets/[^/]+\\.(yaml|json|env|ini)$";
key_groups = [
{
2024-07-14 22:59:33 -04:00
age = [wim binto];
2024-01-18 10:40:59 -05:00
}
];
}
];
}
```
which is then converted to `.sops.yaml` using
[remarshal ](https://github.com/remarshal-project/remarshal )
and this shell command:
```bash
nix eval --json --file ./.sops.nix | remarshal --if json --of yaml > .sops.yaml
```
2023-06-27 17:19:28 -04:00
2024-01-18 10:40:59 -05:00
TLDR: I
**[hate](https://ruudvanasseldonk.com/2023/01/11/the-yaml-document-from-hell)**
YAML