chore: integrate treefmt

This commit is contained in:
Julian Stiller 2025-02-17 23:24:51 +01:00
parent 3c95151c88
commit 2fe7988a48
6 changed files with 154 additions and 23 deletions

View file

@ -5,14 +5,19 @@
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.11";
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
# Treefmt for formatting
treefmt-nix.url = "github:numtide/treefmt-nix";
treefmt-nix.inputs.nixpkgs.follows = "nixpkgs";
};
outputs =
{
self,
nixpkgs,
nixpkgs-unstable,
flake-utils,
treefmt-nix,
systems,
...
}:
flake-utils.lib.eachDefaultSystem (
system:
@ -56,7 +61,7 @@
in
pkgs.dockerTools.buildImageWithNixDb {
name = "git.flyinggecko.org/oci-images/nixos-runner/${name}";
tag = tag;
inherit tag;
copyToRoot =
with pkgs;
(imagePackages pkgs)
@ -66,20 +71,20 @@
name = "containerPolicy";
destination = "/etc/containers/policy.json";
text = ''
{
"default": [
{
"type": "insecureAcceptAnything"
}
],
"transports":
{
"docker-daemon":
{
"": [{"type":"insecureAcceptAnything"}]
}
}
}
{
"default": [
{
"type": "insecureAcceptAnything"
}
],
"transports":
{
"docker-daemon":
{
"": [{"type":"insecureAcceptAnything"}]
}
}
}
'';
})
@ -87,14 +92,14 @@
name = "containerRegistries";
destination = "/etc/containers/registries.conf";
text = ''
[registries.block]
registries = []
[registries.block]
registries = []
[registries.insecure]
registries = []
[registries.insecure]
registries = []
[registries.search]
registries = ["docker.io", "quay.io"]
[registries.search]
registries = ["docker.io", "quay.io"]
'';
})
@ -230,12 +235,31 @@
];
};
};
forEachSystem =
f:
nixpkgs.lib.genAttrs (import systems) (
system:
let
pkgs = import nixpkgs {
inherit system;
};
in
f pkgs
);
treefmtEval = forEachSystem (pkgs: treefmt-nix.lib.evalModule pkgs ./treefmt.nix);
# treefmtWrapper = pkgs: treefmtEval.${pkgs.system}.config.build.wrapper;
in
{
packages = {
nixos-2411 = containerLambda "nixos" "24.11" nixpkgs;
nixos-unstable = containerLambda "nixos" "unstable" nixpkgs-unstable;
};
# dev shells in project
devShells = import ./shell.nix { inherit nixpkgs treefmtEval system; };
# formatter = forEachSystem (pkgs: treefmtEval.${pkgs.system}.config.build.wrapper);
}
);
}