Update nix flake and use nixfmt (#6827)

This commit is contained in:
Max 2025-08-27 20:01:20 +00:00 committed by GitHub
parent f278e43e0f
commit 2d5fa4f0ff
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 166 additions and 140 deletions

View File

@ -2,11 +2,11 @@
"nodes": {
"crane": {
"locked": {
"lastModified": 1727060013,
"narHash": "sha256-/fC5YlJy4IoAW9GhkJiwyzk0K/gQd9Qi4rRcoweyG9E=",
"lastModified": 1755993354,
"narHash": "sha256-FCRRAzSaL/+umLIm3RU3O/+fJ2ssaPHseI2SSFL8yZU=",
"owner": "ipetkov",
"repo": "crane",
"rev": "6b40cc876c929bfe1e3a24bf538ce3b5622646ba",
"rev": "25bd41b24426c7734278c2ff02e53258851db914",
"type": "github"
},
"original": {
@ -23,11 +23,11 @@
"rust-analyzer-src": "rust-analyzer-src"
},
"locked": {
"lastModified": 1727245890,
"narHash": "sha256-B4gUhZxqdn24PqL7z7ZuvLOS84HVskhKRByWdgA4/RI=",
"lastModified": 1755585599,
"narHash": "sha256-tl/0cnsqB/Yt7DbaGMel2RLa7QG5elA8lkaOXli6VdY=",
"owner": "nix-community",
"repo": "fenix",
"rev": "de3acda8b67b92abeeb35ac236924afd959874ad",
"rev": "6ed03ef4c8ec36d193c18e06b9ecddde78fb7e42",
"type": "github"
},
"original": {
@ -41,11 +41,11 @@
"nixpkgs-lib": "nixpkgs-lib"
},
"locked": {
"lastModified": 1726153070,
"narHash": "sha256-HO4zgY0ekfwO5bX0QH/3kJ/h4KvUDFZg8YpkNwIbg1U=",
"lastModified": 1754487366,
"narHash": "sha256-pHYj8gUBapuUzKV/kN/tR3Zvqc7o6gdFB9XKXIp1SQ8=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "bcef6817a8b2aa20a5a6dbb19b43e63c5bf8619a",
"rev": "af66ad14b28a127c5c0f3bbb298218fc63528a18",
"type": "github"
},
"original": {
@ -56,11 +56,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1726937504,
"narHash": "sha256-bvGoiQBvponpZh8ClUcmJ6QnsNKw0EMrCQJARK3bI1c=",
"lastModified": 1756125398,
"narHash": "sha256-XexyKZpf46cMiO5Vbj+dWSAXOnr285GHsMch8FBoHbc=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "9357f4f23713673f310988025d9dc261c20e70c6",
"rev": "3b9f00d7a7bf68acd4c4abb9d43695afb04e03a5",
"type": "github"
},
"original": {
@ -72,14 +72,17 @@
},
"nixpkgs-lib": {
"locked": {
"lastModified": 1725233747,
"narHash": "sha256-Ss8QWLXdr2JCBPcYChJhz4xJm+h/xjl4G0c0XlP6a74=",
"type": "tarball",
"url": "https://github.com/NixOS/nixpkgs/archive/356624c12086a18f2ea2825fed34523d60ccc4e3.tar.gz"
"lastModified": 1753579242,
"narHash": "sha256-zvaMGVn14/Zz8hnp4VWT9xVnhc8vuL3TStRqwk22biA=",
"owner": "nix-community",
"repo": "nixpkgs.lib",
"rev": "0f36c44e01a6129be94e3ade315a5883f0228a6e",
"type": "github"
},
"original": {
"type": "tarball",
"url": "https://github.com/NixOS/nixpkgs/archive/356624c12086a18f2ea2825fed34523d60ccc4e3.tar.gz"
"owner": "nix-community",
"repo": "nixpkgs.lib",
"type": "github"
}
},
"root": {
@ -95,11 +98,11 @@
"rust-analyzer-src": {
"flake": false,
"locked": {
"lastModified": 1727104575,
"narHash": "sha256-lB/ZS0SnHyE8Z3G8DIL/QJPg6w6x5ZhgVO2pBqnz89g=",
"lastModified": 1755504847,
"narHash": "sha256-VX0B9hwhJypCGqncVVLC+SmeMVd/GAYbJZ0MiiUn2Pk=",
"owner": "rust-lang",
"repo": "rust-analyzer",
"rev": "3d0343251fe084b335b55c17a52bb4a3527b1bd0",
"rev": "a905e3b21b144d77e1b304e49f3264f6f8d4db75",
"type": "github"
},
"original": {

View File

@ -15,14 +15,31 @@
};
};
outputs = inputs@{ flake-parts, crane, nixpkgs, fenix, rust-manifest, self, ... }: flake-parts.lib.mkFlake { inherit inputs; } {
outputs =
inputs@{
flake-parts,
crane,
nixpkgs,
fenix,
rust-manifest,
self,
...
}:
flake-parts.lib.mkFlake { inherit inputs; } {
systems = import inputs.systems;
imports = [
inputs.flake-parts.flakeModules.easyOverlay
];
perSystem = { self', pkgs, lib, system, ... }:
perSystem =
{
self',
pkgs,
lib,
system,
...
}:
let
cargoToml = lib.importTOML ./Cargo.toml;
@ -56,10 +73,7 @@
buildInputs = [
pkgs.openssl
] ++ (lib.optionals pkgs.stdenv.isDarwin [
pkgs.darwin.apple_sdk.frameworks.CoreServices
pkgs.libiconv
]);
];
nativeBuildInputs = [
pkgs.pkg-config
@ -71,7 +85,9 @@
# re-building them.
cargoArtifacts = craneLib.buildDepsOnly commonCraneArgs;
typst = craneLib.buildPackage (commonCraneArgs // {
typst = craneLib.buildPackage (
commonCraneArgs
// {
inherit cargoArtifacts;
nativeBuildInputs = commonCraneArgs.nativeBuildInputs ++ [
@ -94,10 +110,11 @@
"${version} (${rev})";
meta.mainProgram = "typst";
});
}
);
in
{
formatter = pkgs.nixpkgs-fmt;
formatter = pkgs.nixfmt-tree;
packages = {
default = typst;
@ -113,14 +130,20 @@
checks = {
typst-fmt = craneLib.cargoFmt commonCraneArgs;
typst-clippy = craneLib.cargoClippy (commonCraneArgs // {
typst-clippy = craneLib.cargoClippy (
commonCraneArgs
// {
inherit cargoArtifacts;
cargoClippyExtraArgs = "--workspace -- --deny warnings";
});
typst-test = craneLib.cargoTest (commonCraneArgs // {
}
);
typst-test = craneLib.cargoTest (
commonCraneArgs
// {
inherit cargoArtifacts;
cargoTestExtraArgs = "--workspace";
});
}
);
};
devShells.default = craneLib.devShell {