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": { "nodes": {
"crane": { "crane": {
"locked": { "locked": {
"lastModified": 1727060013, "lastModified": 1755993354,
"narHash": "sha256-/fC5YlJy4IoAW9GhkJiwyzk0K/gQd9Qi4rRcoweyG9E=", "narHash": "sha256-FCRRAzSaL/+umLIm3RU3O/+fJ2ssaPHseI2SSFL8yZU=",
"owner": "ipetkov", "owner": "ipetkov",
"repo": "crane", "repo": "crane",
"rev": "6b40cc876c929bfe1e3a24bf538ce3b5622646ba", "rev": "25bd41b24426c7734278c2ff02e53258851db914",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -23,11 +23,11 @@
"rust-analyzer-src": "rust-analyzer-src" "rust-analyzer-src": "rust-analyzer-src"
}, },
"locked": { "locked": {
"lastModified": 1727245890, "lastModified": 1755585599,
"narHash": "sha256-B4gUhZxqdn24PqL7z7ZuvLOS84HVskhKRByWdgA4/RI=", "narHash": "sha256-tl/0cnsqB/Yt7DbaGMel2RLa7QG5elA8lkaOXli6VdY=",
"owner": "nix-community", "owner": "nix-community",
"repo": "fenix", "repo": "fenix",
"rev": "de3acda8b67b92abeeb35ac236924afd959874ad", "rev": "6ed03ef4c8ec36d193c18e06b9ecddde78fb7e42",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -41,11 +41,11 @@
"nixpkgs-lib": "nixpkgs-lib" "nixpkgs-lib": "nixpkgs-lib"
}, },
"locked": { "locked": {
"lastModified": 1726153070, "lastModified": 1754487366,
"narHash": "sha256-HO4zgY0ekfwO5bX0QH/3kJ/h4KvUDFZg8YpkNwIbg1U=", "narHash": "sha256-pHYj8gUBapuUzKV/kN/tR3Zvqc7o6gdFB9XKXIp1SQ8=",
"owner": "hercules-ci", "owner": "hercules-ci",
"repo": "flake-parts", "repo": "flake-parts",
"rev": "bcef6817a8b2aa20a5a6dbb19b43e63c5bf8619a", "rev": "af66ad14b28a127c5c0f3bbb298218fc63528a18",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -56,11 +56,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1726937504, "lastModified": 1756125398,
"narHash": "sha256-bvGoiQBvponpZh8ClUcmJ6QnsNKw0EMrCQJARK3bI1c=", "narHash": "sha256-XexyKZpf46cMiO5Vbj+dWSAXOnr285GHsMch8FBoHbc=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "9357f4f23713673f310988025d9dc261c20e70c6", "rev": "3b9f00d7a7bf68acd4c4abb9d43695afb04e03a5",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -72,14 +72,17 @@
}, },
"nixpkgs-lib": { "nixpkgs-lib": {
"locked": { "locked": {
"lastModified": 1725233747, "lastModified": 1753579242,
"narHash": "sha256-Ss8QWLXdr2JCBPcYChJhz4xJm+h/xjl4G0c0XlP6a74=", "narHash": "sha256-zvaMGVn14/Zz8hnp4VWT9xVnhc8vuL3TStRqwk22biA=",
"type": "tarball", "owner": "nix-community",
"url": "https://github.com/NixOS/nixpkgs/archive/356624c12086a18f2ea2825fed34523d60ccc4e3.tar.gz" "repo": "nixpkgs.lib",
"rev": "0f36c44e01a6129be94e3ade315a5883f0228a6e",
"type": "github"
}, },
"original": { "original": {
"type": "tarball", "owner": "nix-community",
"url": "https://github.com/NixOS/nixpkgs/archive/356624c12086a18f2ea2825fed34523d60ccc4e3.tar.gz" "repo": "nixpkgs.lib",
"type": "github"
} }
}, },
"root": { "root": {
@ -95,11 +98,11 @@
"rust-analyzer-src": { "rust-analyzer-src": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1727104575, "lastModified": 1755504847,
"narHash": "sha256-lB/ZS0SnHyE8Z3G8DIL/QJPg6w6x5ZhgVO2pBqnz89g=", "narHash": "sha256-VX0B9hwhJypCGqncVVLC+SmeMVd/GAYbJZ0MiiUn2Pk=",
"owner": "rust-lang", "owner": "rust-lang",
"repo": "rust-analyzer", "repo": "rust-analyzer",
"rev": "3d0343251fe084b335b55c17a52bb4a3527b1bd0", "rev": "a905e3b21b144d77e1b304e49f3264f6f8d4db75",
"type": "github" "type": "github"
}, },
"original": { "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; systems = import inputs.systems;
imports = [ imports = [
inputs.flake-parts.flakeModules.easyOverlay inputs.flake-parts.flakeModules.easyOverlay
]; ];
perSystem = { self', pkgs, lib, system, ... }: perSystem =
{
self',
pkgs,
lib,
system,
...
}:
let let
cargoToml = lib.importTOML ./Cargo.toml; cargoToml = lib.importTOML ./Cargo.toml;
@ -56,10 +73,7 @@
buildInputs = [ buildInputs = [
pkgs.openssl pkgs.openssl
] ++ (lib.optionals pkgs.stdenv.isDarwin [ ];
pkgs.darwin.apple_sdk.frameworks.CoreServices
pkgs.libiconv
]);
nativeBuildInputs = [ nativeBuildInputs = [
pkgs.pkg-config pkgs.pkg-config
@ -71,7 +85,9 @@
# re-building them. # re-building them.
cargoArtifacts = craneLib.buildDepsOnly commonCraneArgs; cargoArtifacts = craneLib.buildDepsOnly commonCraneArgs;
typst = craneLib.buildPackage (commonCraneArgs // { typst = craneLib.buildPackage (
commonCraneArgs
// {
inherit cargoArtifacts; inherit cargoArtifacts;
nativeBuildInputs = commonCraneArgs.nativeBuildInputs ++ [ nativeBuildInputs = commonCraneArgs.nativeBuildInputs ++ [
@ -94,10 +110,11 @@
"${version} (${rev})"; "${version} (${rev})";
meta.mainProgram = "typst"; meta.mainProgram = "typst";
}); }
);
in in
{ {
formatter = pkgs.nixpkgs-fmt; formatter = pkgs.nixfmt-tree;
packages = { packages = {
default = typst; default = typst;
@ -113,14 +130,20 @@
checks = { checks = {
typst-fmt = craneLib.cargoFmt commonCraneArgs; typst-fmt = craneLib.cargoFmt commonCraneArgs;
typst-clippy = craneLib.cargoClippy (commonCraneArgs // { typst-clippy = craneLib.cargoClippy (
commonCraneArgs
// {
inherit cargoArtifacts; inherit cargoArtifacts;
cargoClippyExtraArgs = "--workspace -- --deny warnings"; cargoClippyExtraArgs = "--workspace -- --deny warnings";
}); }
typst-test = craneLib.cargoTest (commonCraneArgs // { );
typst-test = craneLib.cargoTest (
commonCraneArgs
// {
inherit cargoArtifacts; inherit cargoArtifacts;
cargoTestExtraArgs = "--workspace"; cargoTestExtraArgs = "--workspace";
}); }
);
}; };
devShells.default = craneLib.devShell { devShells.default = craneLib.devShell {