mirror of
https://github.com/nickolaj-jepsen/nixos.git
synced 2026-01-22 08:06:50 +01:00
feat: add a fmt github action
This commit is contained in:
parent
76055bdf3f
commit
2c0c99180e
4 changed files with 50 additions and 9 deletions
32
.github/workflows/fmt.yml
vendored
Normal file
32
.github/workflows/fmt.yml
vendored
Normal file
|
|
@ -0,0 +1,32 @@
|
||||||
|
name: CI
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [main]
|
||||||
|
pull_request:
|
||||||
|
branches: [main]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
fmt:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- uses: DeterminateSystems/nix-installer-action@main
|
||||||
|
|
||||||
|
- uses: DeterminateSystems/magic-nix-cache-action@main
|
||||||
|
|
||||||
|
- name: Check formatting
|
||||||
|
run: nix fmt -- --fail-on-change
|
||||||
|
|
||||||
|
check:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- uses: DeterminateSystems/nix-installer-action@main
|
||||||
|
|
||||||
|
- uses: DeterminateSystems/magic-nix-cache-action@main
|
||||||
|
|
||||||
|
- name: Run nix flake check
|
||||||
|
run: nix flake check
|
||||||
|
|
@ -51,14 +51,17 @@ just bootstrap-flash /dev/sdX
|
||||||
## Adding a New Host
|
## Adding a New Host
|
||||||
|
|
||||||
1. Run the new-host command:
|
1. Run the new-host command:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
just new-host <hostname> <username>
|
just new-host <hostname> <username>
|
||||||
```
|
```
|
||||||
|
|
||||||
This creates:
|
This creates:
|
||||||
- `hosts/<hostname>/` directory
|
- `hosts/<hostname>/` directory
|
||||||
- `secrets/hosts/<hostname>/` with SSH keys
|
- `secrets/hosts/<hostname>/` with SSH keys
|
||||||
|
|
||||||
2. Add host configuration in `hosts/default.nix`:
|
2. Add host configuration in `hosts/default.nix`:
|
||||||
|
|
||||||
```nix
|
```nix
|
||||||
<hostname> = mkSystem {
|
<hostname> = mkSystem {
|
||||||
hostname = "<hostname>";
|
hostname = "<hostname>";
|
||||||
|
|
@ -72,6 +75,7 @@ just bootstrap-flash /dev/sdX
|
||||||
- Other host-specific modules as needed
|
- Other host-specific modules as needed
|
||||||
|
|
||||||
4. Generate hardware config:
|
4. Generate hardware config:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
just factor <hostname>
|
just factor <hostname>
|
||||||
# Or for remote:
|
# Or for remote:
|
||||||
|
|
@ -120,6 +124,7 @@ just age -e <file> -o <output.age>
|
||||||
### Formatting
|
### Formatting
|
||||||
|
|
||||||
Code is formatted using `treefmt-nix` with:
|
Code is formatted using `treefmt-nix` with:
|
||||||
|
|
||||||
- **alejandra** - Nix formatter
|
- **alejandra** - Nix formatter
|
||||||
- **deadnix** - Remove unused Nix code
|
- **deadnix** - Remove unused Nix code
|
||||||
- **statix** - Nix linter
|
- **statix** - Nix linter
|
||||||
|
|
@ -173,4 +178,4 @@ Heavily inspired by / stolen from [Flexoki](https://stephango.com/flexoki)
|
||||||
| magenta | #CE5D97 |
|
| magenta | #CE5D97 |
|
||||||
| magenta-alt | #A02F6F |
|
| magenta-alt | #A02F6F |
|
||||||
| white | #DAD8CE |
|
| white | #DAD8CE |
|
||||||
| white-alt | #F2F0E5 |
|
| white-alt | #F2F0E5 |
|
||||||
|
|
|
||||||
4
justfile
4
justfile
|
|
@ -94,12 +94,12 @@ bootstrap-flash device:
|
||||||
echo "Error: {{ device }} is not a block device"
|
echo "Error: {{ device }} is not a block device"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Build the ISO first if needed
|
# Build the ISO first if needed
|
||||||
if [ ! -d "result/iso" ]; then
|
if [ ! -d "result/iso" ]; then
|
||||||
just bootstrap-iso
|
just bootstrap-iso
|
||||||
fi
|
fi
|
||||||
|
|
||||||
iso_file=$(ls -1 result/iso/*.iso | head -1)
|
iso_file=$(ls -1 result/iso/*.iso | head -1)
|
||||||
echo "Flashing $iso_file to {{ device }}..."
|
echo "Flashing $iso_file to {{ device }}..."
|
||||||
echo "WARNING: This will ERASE ALL DATA on {{ device }}"
|
echo "WARNING: This will ERASE ALL DATA on {{ device }}"
|
||||||
|
|
|
||||||
|
|
@ -76,9 +76,11 @@
|
||||||
{
|
{
|
||||||
id = "secondary-left";
|
id = "secondary-left";
|
||||||
name = "Secondary Bar (Left)";
|
name = "Secondary Bar (Left)";
|
||||||
screenPreferences = builtins.map (monitor: {
|
screenPreferences =
|
||||||
inherit (monitor) name;
|
builtins.map (monitor: {
|
||||||
}) leftMonitors;
|
inherit (monitor) name;
|
||||||
|
})
|
||||||
|
leftMonitors;
|
||||||
showOnLastDisplay = false;
|
showOnLastDisplay = false;
|
||||||
leftWidgets = [];
|
leftWidgets = [];
|
||||||
centerWidgets = [];
|
centerWidgets = [];
|
||||||
|
|
@ -92,9 +94,11 @@
|
||||||
{
|
{
|
||||||
id = "secondary-right";
|
id = "secondary-right";
|
||||||
name = "Secondary Bar (Right)";
|
name = "Secondary Bar (Right)";
|
||||||
screenPreferences = builtins.map (monitor: {
|
screenPreferences =
|
||||||
inherit (monitor) name;
|
builtins.map (monitor: {
|
||||||
}) rightMonitors;
|
inherit (monitor) name;
|
||||||
|
})
|
||||||
|
rightMonitors;
|
||||||
showOnLastDisplay = false;
|
showOnLastDisplay = false;
|
||||||
leftWidgets = [
|
leftWidgets = [
|
||||||
"workspaceSwitcher"
|
"workspaceSwitcher"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue