This commit is contained in:
Naxdy committed 2025-07-06 08:48:18 +02:00
commit 7af20ed20e
7 files changed
+358

No files matched your search

+1
View File
@@ -0,0 +1 @@
use flake
+11
View File
@@ -0,0 +1,11 @@
/.direnv
/result
/result-*
/target
# Added by cargo
#
# already existing elements were commented out
#/target
+6
View File
@@ -0,0 +1,6 @@
[package]
name = "syn-parse-helpers"
version = "0.1.0"
edition = "2024"
[dependencies]
Generated
+131
View File
@@ -0,0 +1,131 @@
{
"nodes": {
"crane": {
"locked": {
"lastModified": 1751562746,
"narHash": "sha256-smpugNIkmDeicNz301Ll1bD7nFOty97T79m4GUMUczA=",
"owner": "ipetkov",
"repo": "crane",
"rev": "aed2020fd3dc26e1e857d4107a5a67a33ab6c1fd",
"type": "github"
},
"original": {
"owner": "ipetkov",
"repo": "crane",
"type": "github"
}
},
"fenix": {
"inputs": {
"nixpkgs": "nixpkgs",
"rust-analyzer-src": "rust-analyzer-src"
},
"locked": {
"lastModified": 1751611255,
"narHash": "sha256-OoD7QdCBKk41sjGr7UpTxXtVba2kc2gfdex2qUCO1FQ=",
"owner": "nix-community",
"repo": "fenix",
"rev": "e60617a7e9ad348c2679557d01177f9d244e6e5d",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "fenix",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1751271578,
"narHash": "sha256-P/SQmKDu06x8yv7i0s8bvnnuJYkxVGBWLWHaU+tt4YY=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "3016b4b15d13f3089db8a41ef937b13a9e33a8df",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1751637120,
"narHash": "sha256-xVNy/XopSfIG9c46nRmPaKfH1Gn/56vQ8++xWA8itO4=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "5c724ed1388e53cc231ed98330a60eb2f7be4be3",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_3": {
"locked": {
"lastModified": 1747958103,
"narHash": "sha256-qmmFCrfBwSHoWw7cVK4Aj+fns+c54EBP8cGqp/yK410=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "fe51d34885f7b5e3e7b59572796e1bcb427eccb1",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"crane": "crane",
"fenix": "fenix",
"nixpkgs": "nixpkgs_2",
"treefmt-nix": "treefmt-nix"
}
},
"rust-analyzer-src": {
"flake": false,
"locked": {
"lastModified": 1751584117,
"narHash": "sha256-X+eVYBgJtR5WtFGifchtuidsl0epV3+oKXVxdd9ntuY=",
"owner": "rust-lang",
"repo": "rust-analyzer",
"rev": "040049b79973a742bbd0eef25369b983f764dc38",
"type": "github"
},
"original": {
"owner": "rust-lang",
"ref": "nightly",
"repo": "rust-analyzer",
"type": "github"
}
},
"treefmt-nix": {
"inputs": {
"nixpkgs": "nixpkgs_3"
},
"locked": {
"lastModified": 1750931469,
"narHash": "sha256-0IEdQB1nS+uViQw4k3VGUXntjkDp7aAlqcxdewb/hAc=",
"owner": "numtide",
"repo": "treefmt-nix",
"rev": "ac8e6f32e11e9c7f153823abc3ab007f2a65d3e1",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "treefmt-nix",
"type": "github"
}
}
},
"root": "root",
"version": 7
}
+173
View File
@@ -0,0 +1,173 @@
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
fenix.url = "github:nix-community/fenix";
crane.url = "github:ipetkov/crane";
treefmt-nix.url = "github:numtide/treefmt-nix";
};
outputs =
{
self,
nixpkgs,
fenix,
crane,
treefmt-nix,
}:
let
supportedSystems = [
"x86_64-linux"
"aarch64-linux"
"x86_64-darwin"
"aarch64-darwin"
];
forEachSupportedSystem =
f:
nixpkgs.lib.genAttrs supportedSystems (
system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ fenix.overlays.default ];
};
rustToolchain = pkgs.fenix.stable.withComponents [
"cargo"
"rustc"
"rustfmt"
"rust-std"
"rust-analyzer"
"clippy"
];
# more info on https://crane.dev/API.html
craneLib = (crane.mkLib pkgs).overrideToolchain rustToolchain;
cargoToml = builtins.fromTOML (builtins.readFile ./Cargo.toml);
craneArgs = {
pname = cargoToml.workspace.package.name or cargoToml.package.name;
version = cargoToml.workspace.package.version or cargoToml.package.version;
src = craneLib.cleanCargoSource ./.;
strictDeps = true;
# can add `nativeBuildInputs` or `buildInputs` here
env = {
# print backtrace on compilation failure
RUST_BACKTRACE = "1";
# treat warnings as errors
RUSTFLAGS = "-Dwarnings";
RUSTDOCFLAGS = "-Dwarnings";
};
};
cargoArtifacts = craneLib.buildDepsOnly craneArgs;
craneBuildArgs = craneArgs // {
src = self;
inherit cargoArtifacts;
};
treefmtEval = treefmt-nix.lib.evalModule pkgs (
import ./treefmt.nix { inherit rustToolchain cargoToml; }
);
treefmt = treefmtEval.config.build.wrapper;
in
f {
inherit
cargoArtifacts
craneArgs
craneBuildArgs
craneLib
pkgs
rustToolchain
system
treefmt
treefmtEval
;
}
);
in
{
devShells = forEachSupportedSystem (
{
pkgs,
rustToolchain,
treefmt,
craneBuildArgs,
system,
...
}:
{
default = self.devShells.${system}.full;
full = pkgs.mkShell {
nativeBuildInputs = [
rustToolchain
treefmt
] ++ (craneBuildArgs.nativeBuildInputs or [ ]);
buildInputs = craneBuildArgs.buildInputs or [ ];
};
toolchainOnly = pkgs.mkShell {
nativeBuildInputs = [
rustToolchain
];
};
}
);
formatter = forEachSupportedSystem ({ treefmt, ... }: treefmt);
packages = forEachSupportedSystem (
{
craneLib,
craneBuildArgs,
system,
...
}:
{
default = craneLib.buildPackage craneBuildArgs;
docs = craneLib.cargoDoc (
craneBuildArgs
// {
# used to disable `--no-deps`, which crane enables by default,
# so we include all packages in the resulting docs, to have fully-functional
# offline docs
cargoDocExtraArgs = "";
}
);
}
);
checks = forEachSupportedSystem (
{
craneLib,
craneBuildArgs,
treefmtEval,
...
}:
{
# can also use `cargoNextest`
test = craneLib.cargoTest craneBuildArgs;
doc = craneLib.cargoDoc craneBuildArgs;
clippy = craneLib.cargoClippy craneBuildArgs;
treefmt = treefmtEval.config.build.check self;
}
);
};
}
+3
View File
@@ -0,0 +1,3 @@
fn main() {
println!("Hello, world!");
}
+33
View File
@@ -0,0 +1,33 @@
{ rustToolchain, cargoToml }:
{ pkgs, ... }:
{
# rust
programs.rustfmt = {
enable = true;
package = rustToolchain;
edition = cargoToml.workspace.package.edition or cargoToml.package.edition;
};
# nix
programs.nixfmt.enable = true;
# toml
programs.taplo.enable = true;
# markdown, yaml, etc.
programs.prettier = {
enable = true;
settings = {
trailingComma = "all";
semi = true;
printWidth = 120;
};
};
programs.typos = {
enable = true;
includes = [
"*.rs"
];
};
}
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.