chore: fix formatting and add treefmt

This commit is contained in:
Tim Schubert 2025-07-26 20:56:40 +02:00
parent a26418c9c3
commit 5d55e620da
No known key found for this signature in database
10 changed files with 49 additions and 36 deletions

2
.envrc
View file

@ -1,3 +1,5 @@
#!/bin/sh
watch_file devshell.nix
use flake

View file

@ -1,10 +1,8 @@
name: Continuous Integration
on:
pull_request:
push:
branches: [main]
jobs:
checks:
name: "Checks"

View file

@ -3,7 +3,6 @@ on:
workflow_dispatch: # allows manual triggering
schedule:
- cron: '0 0 * * 0' # runs weekly on Sunday at 00:00
jobs:
lockfile:
runs-on: ubuntu-latest

View file

@ -24,7 +24,7 @@
name = "format";
help = "Format the project";
command = ''
nixpkgs-fmt .
treefmt .
'';
category = "dev";
}

View file

@ -21,8 +21,7 @@ let
nixpkgs.lib.nixosSystem {
inherit system;
modules =
[
modules = [
{
nixpkgs.overlays = nixpkgs.lib.attrValues self.overlays;
}

View file

@ -1,4 +1,9 @@
{ config, lib, pkgs, ... }:
{
config,
lib,
pkgs,
...
}:
{
imports = [

View file

@ -5,12 +5,14 @@
nixpkgs,
agenix,
devshell,
treefmt-nix,
...
}@inputs:
(flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = import nixpkgs { inherit system; };
treefmtEval = treefmt-nix.lib.evalModule pkgs ./treefmt.nix;
in
{
devShells.default =
@ -26,7 +28,7 @@
in
import ./devshell.nix { inherit pkgs extraModules; };
formatter = pkgs.nixfmt-tree;
formatter = treefmtEval.config.build.wrapper;
packages = import ./pkgs { inherit pkgs; } // {
installer-iso = self.nixosConfigurations.installer.config.system.build.isoImage;
@ -34,7 +36,6 @@
}
))
// {
hmModules = import ./home/modules.nix { lib = nixpkgs.lib; };
nixosConfigurations = import ./nixos/configurations.nix inputs;

View file

@ -1,3 +1,4 @@
{ pkgs }: {
{ pkgs }:
{
citizen-cups = pkgs.callPackage ./citizen-cups.nix { };
}

8
treefmt.nix Normal file
View file

@ -0,0 +1,8 @@
{ pkgs, ... }:
{
projectRootFile = "flake.nix";
programs.nixfmt.enable = true;
programs.shellcheck.enable = pkgs.hostPlatform.system != "riscv64-linux";
programs.shfmt.enable = pkgs.hostPlatform.system != "riscv64-linux";
programs.yamlfmt.enable = true;
}