summaryrefslogtreecommitdiff
path: root/flake.nix
diff options
context:
space:
mode:
authorJakub Stachurski <j.stachurski@student.utwente.nl>2026-04-18 23:38:22 +0200
committerJakub Stachurski <j.stachurski@student.utwente.nl>2026-04-18 23:38:22 +0200
commitff05ad9be1e136fc8eb3f7904739be97cca51ce9 (patch)
tree5f3f44f2683c094a10dd398e96e7ff7e98bb43ae /flake.nix
parentbccc574ba48356a5f134425b14489cc802d1acf1 (diff)
Tweak formatting
Diffstat (limited to 'flake.nix')
-rw-r--r--flake.nix28
1 files changed, 19 insertions, 9 deletions
diff --git a/flake.nix b/flake.nix
index 4a7716c..8b48c5f 100644
--- a/flake.nix
+++ b/flake.nix
@@ -50,8 +50,24 @@
"x86_64-linux"
"aarch64-linux"
];
+ # Allows code to execute for all used architectures
forAllSystems = f: (lib.genAttrs systems (system: f nixpkgs.legacyPackages.${system}));
- treefmtEval = forAllSystems (pkgs: treefmt-nix.lib.evalModule pkgs ./modules/treefmt.nix);
+
+ # Treefmt has a bunch of long paths that we want to bundle.
+ treefmtStuff = forAllSystems (
+ pkgs:
+ let
+ treefmt = treefmt-nix.lib.evalModule pkgs ./modules/treefmt.nix;
+ in
+ {
+ formatter = treefmt.config.build.wrapper;
+ formatCheck = {
+ formatting = treefmt.config.build.check self;
+ };
+ }
+ );
+ # Convenient extractor which generates an attrset of system: attribute, with the attribute being picked from treefmtStuff by name.
+ treefmtExtract = name: (builtins.mapAttrs (_system: conf: conf."${name}") (treefmtStuff));
in
{
# packages."x86_64-linux".full-iso = self.nixosConfigurations.full-iso.config.system.build.isoImage;
@@ -61,15 +77,9 @@
})
);
# for `nix fmt`
- formatter = (
- forAllSystems (pkgs: treefmtEval.${pkgs.stdenv.hostPlatform.system}.config.build.wrapper)
- );
+ formatter = treefmtExtract "formatter";
# for `nix flake check`
- checks = (
- forAllSystems (pkgs: {
- formatting = treefmtEval.${pkgs.stdenv.hostPlatform.system}.config.build.check self;
- })
- );
+ checks = treefmtExtract "formatCheck";
nixosConfigurations = {
apocalypse = nixpkgs.lib.nixosSystem {