add treefmt

This commit is contained in:
Johannes Jöns 2024-08-08 21:04:32 +02:00
parent d5b07c82ae
commit 55aeca7389
3 changed files with 76 additions and 36 deletions

View file

@ -18,11 +18,11 @@
},
"catppuccin": {
"locked": {
"lastModified": 1722661201,
"narHash": "sha256-2JX3S1hmmUhHuyGyGWnaM4xT0SiaDdVkNzmBrEowwK0=",
"lastModified": 1722997334,
"narHash": "sha256-vE5FcKVQ3E0txJKt5w3vOlfcN1XoTAlxK9PnQ/CJavA=",
"owner": "catppuccin",
"repo": "nix",
"rev": "19a0f144f0204a12a89243363efb6a493b8cfc83",
"rev": "66f4ea170093b62f319f41cebd2337a51b225c5a",
"type": "github"
},
"original": {
@ -112,11 +112,11 @@
]
},
"locked": {
"lastModified": 1722821805,
"narHash": "sha256-FGrUPUD+LMDwJsYyNSxNIzFMldtCm8wXiQuyL2PHSrM=",
"lastModified": 1723080788,
"narHash": "sha256-C5LbM5VMdcolt9zHeLQ0bYMRjUL+N+AL5pK7/tVTdes=",
"owner": "nix-community",
"repo": "disko",
"rev": "0257e44f4ad472b54f19a6dd1615aee7fa48ed49",
"rev": "ffc1f95f6c28e1c6d1e587b51a2147027a3e45ed",
"type": "github"
},
"original": {
@ -156,11 +156,11 @@
},
"locked": {
"dir": "pkgs/firefox-addons",
"lastModified": 1722917006,
"narHash": "sha256-29qBs5HlcegrLP8oQe8T9hHx7u94TEz9ivPwZlorAJU=",
"lastModified": 1723089792,
"narHash": "sha256-vXv+xno/CxWom/MFLz54QV4OYNZ8gJmqV82FtZeH51c=",
"owner": "rycee",
"repo": "nur-expressions",
"rev": "8552abe55a4f364d94efb84502a550c2c9c3101c",
"rev": "cba8af387c1e02cd459f5df427e190d2dbf7db85",
"type": "gitlab"
},
"original": {
@ -500,11 +500,11 @@
]
},
"locked": {
"lastModified": 1722936497,
"narHash": "sha256-UBst8PkhY0kqTgdKiR8MtTBt4c1XmjJoOV11efjsC/o=",
"lastModified": 1723015306,
"narHash": "sha256-jQnFEtH20/OsDPpx71ntZzGdRlpXhUENSQCGTjn//NA=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "a6c743980e23f4cef6c2a377f9ffab506568413a",
"rev": "b3d5ea65d88d67d4ec578ed11d4d2d51e3de525e",
"type": "github"
},
"original": {
@ -553,11 +553,11 @@
]
},
"locked": {
"lastModified": 1722929371,
"narHash": "sha256-lsj4+K7F7pjlgBwrfWbBd0QwmZBoolCy1IoD0exzaOY=",
"lastModified": 1723016361,
"narHash": "sha256-iEVCAOn7WUdJGrK2EW5hkfl4gBmYl5gVck+MSn6ba44=",
"owner": "Jovian-Experiments",
"repo": "Jovian-NixOS",
"rev": "99099d758c82ba77f682867690a085e055efe906",
"rev": "fc3d12deef508a73c7beef4cd9bebe03acde4ed7",
"type": "github"
},
"original": {
@ -723,11 +723,11 @@
]
},
"locked": {
"lastModified": 1722819251,
"narHash": "sha256-f99it92NQSZsrZ8AYbiwAUfrtb/ZpZRqUsl4q6rMA5s=",
"lastModified": 1723078345,
"narHash": "sha256-HSxOQEKNZXiJe9aWnckTTCThOhcRCabwHa32IduDKLk=",
"owner": "nix-community",
"repo": "nixos-generators",
"rev": "c8c3a20b8191819219dba1af79388aa6d555f634",
"rev": "d6c5d29f58acc10ea82afff1de2b28f038f572bd",
"type": "github"
},
"original": {
@ -840,11 +840,11 @@
"treefmt-nix": "treefmt-nix_4"
},
"locked": {
"lastModified": 1722925425,
"narHash": "sha256-BXUYNBaG5KF+h8aU7p/4HUxGK1G42Ji/GK+KkC3bntU=",
"lastModified": 1723123215,
"narHash": "sha256-PZbdO1N8zpmkFsGWk3rLUal/TnpqAXgItsIj6IUCswY=",
"owner": "nix-community",
"repo": "nixvim",
"rev": "e48ce785d9e72c0106319d93e23c5579336ffe33",
"rev": "1b135dedc4b6256faad9dae2f625e821425a60dd",
"type": "github"
},
"original": {
@ -916,11 +916,11 @@
"pre-commit-hooks": "pre-commit-hooks"
},
"locked": {
"lastModified": 1722888520,
"narHash": "sha256-pCePr5/6mpnMMFe+0ysm7CCgucjEl/9g838AW/fAKJk=",
"lastModified": 1723049304,
"narHash": "sha256-8ebAo54qjZ716ktZZR15lxxw9jwvBCP1pJ4+FMuP5Gw=",
"owner": "PrismLauncher",
"repo": "PrismLauncher",
"rev": "7a5e4a4293ec2832786ab84614de6129037bf073",
"rev": "b41e730707f2988d182c82894d4bc5c1c92826f9",
"type": "github"
},
"original": {
@ -948,7 +948,8 @@
"snm": "snm",
"sops-nix": "sops-nix_2",
"srvos": "srvos",
"tela-icon-theme": "tela-icon-theme"
"tela-icon-theme": "tela-icon-theme",
"treefmt-nix": "treefmt-nix_5"
}
},
"snm": {
@ -961,11 +962,11 @@
"nixpkgs-24_05": "nixpkgs-24_05"
},
"locked": {
"lastModified": 1721121314,
"narHash": "sha256-zwc7YXga/1ppaZMWFreZykXtFwBgXodxUZiUx969r+g=",
"lastModified": 1722877200,
"narHash": "sha256-qgKDNJXs+od+1UbRy62uk7dYal3h98I4WojfIqMoGcg=",
"owner": "simple-nixos-mailserver",
"repo": "nixos-mailserver",
"rev": "059b50b2e729729ea00c6831124d3837c494f3d5",
"rev": "af7d3bf5daeba3fc28089b015c0dd43f06b176f2",
"type": "gitlab"
},
"original": {
@ -1030,11 +1031,11 @@
]
},
"locked": {
"lastModified": 1722473484,
"narHash": "sha256-gl0NnSdNwjuAgIHfmGSVx/2jKHNfN5ie8Ex6OTjfczY=",
"lastModified": 1723077922,
"narHash": "sha256-FY5UMtlBCcbMxk+ykmZzYYtm7l/uUKwiMNYbFgqG5yg=",
"owner": "nix-community",
"repo": "srvos",
"rev": "46a59095dc9228a945bf1ee8160b397eb502ad6c",
"rev": "f389064525b8330f20106231762f52854490654e",
"type": "github"
},
"original": {
@ -1175,6 +1176,26 @@
"repo": "treefmt-nix",
"type": "github"
}
},
"treefmt-nix_5": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1722330636,
"narHash": "sha256-uru7JzOa33YlSRwf9sfXpJG+UAV+bnBEYMjrzKrQZFw=",
"owner": "numtide",
"repo": "treefmt-nix",
"rev": "768acdb06968e53aa1ee8de207fd955335c754b7",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "treefmt-nix",
"type": "github"
}
}
},
"root": "root",

View file

@ -74,24 +74,38 @@
inputs.nixpkgs.follows = "nixpkgs";
inputs.disko.follows = "disko";
};
# Flake Stuff
treefmt-nix = {
url = "github:numtide/treefmt-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs =
inputs@{ self, nixpkgs, ... }:
inputs@{ self, nixpkgs, treefmt-nix, ... }:
let
forSystems = f: nixpkgs.lib.attrsets.genAttrs nixpkgs.lib.systems.flakeExposed (system: f system);
pkgs' = system: nixpkgs.legacyPackages.${system};
treefmtEval = system: treefmt-nix.lib.evalModule (pkgs' system) ./treefmt.nix;
in
{
modules.default = import ./modules;
nixosModules.default = import ./nixos-modules;
homeManagerModules.default = import ./home-modules;
nixosConfigurations = import ./systems { inherit self inputs nixpkgs; };
packages = nixpkgs.lib.attrsets.genAttrs nixpkgs.lib.systems.flakeExposed (
packages = forSystems (
system:
import ./packages {
inherit system inputs;
pkgs = nixpkgs.legacyPackages.${system};
pkgs = pkgs' system;
}
);
formatter = nixpkgs.lib.attrsets.genAttrs nixpkgs.lib.systems.flakeExposed (
system: nixpkgs.legacyPackages.${system}.nixfmt-rfc-style
formatter = forSystems (
system: (treefmtEval system).config.build.wrapper
);
checks = forSystems ( system: {
formatting = (treefmtEval system).config.build.check self;
});
};
}

5
treefmt.nix Normal file
View file

@ -0,0 +1,5 @@
{ pkgs, ... }:
{
projectRootFile = "flake.nix";
programs.nixfmt-rfc-style.enable = true;
}