Set up a basic flake for Rust workspace
Dependencies
- [2]
5S4MZHL5pretty print decimals using icu - [3]
I2P2FTLEadd basic parser for german decimals - [*]
5PYSO4HI
Change contents
- file addition: flake.nix[5.1]
{description = "A framework for writing Beancount importers in Rust";inputs = {nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";crane = {url = "github:ipetkov/crane";inputs.nixpkgs.follows = "nixpkgs";};fenix = {url = "github:nix-community/fenix";inputs.nixpkgs.follows = "nixpkgs";inputs.rust-analyzer-src.follows = "";};flake-utils.url = "github:numtide/flake-utils";advisory-db = {url = "github:rustsec/advisory-db";flake = false;};};outputs = { self, nixpkgs, crane, fenix, flake-utils, advisory-db, ... }:flake-utils.lib.eachDefaultSystem (system:letpkgs = import nixpkgs {inherit system;};inherit (pkgs) lib;craneLib = crane.lib.${system};src = craneLib.cleanCargoSource (craneLib.path ./.);# Common arguments can be set here to avoid repeating them latercommonArgs = {inherit src;strictDeps = true;buildInputs = [# Add additional build inputs here] ++ lib.optionals pkgs.stdenv.isDarwin [# Additional darwin specific inputs can be set herepkgs.libiconv];# Additional environment variables can be set directly# MY_CUSTOM_VAR = "some value";};craneLibLLvmTools = craneLib.overrideToolchain(fenix.packages.${system}.complete.withComponents ["cargo""llvm-tools""rustc"]);# Build *just* the cargo dependencies, so we can reuse# all of that work (e.g. via cachix) when running in CIcargoArtifacts = craneLib.buildDepsOnly commonArgs;# Build the actual crate itself, reusing the dependency# artifacts from above.my-crate = craneLib.buildPackage (commonArgs // {inherit cargoArtifacts;});in{checks = {# Build the crate as part of `nix flake check` for convenienceinherit my-crate;# Run clippy (and deny all warnings) on the crate source,# again, resuing the dependency artifacts from above.## Note that this is done as a separate derivation so that# we can block the CI if there are issues here, but not# prevent downstream consumers from building our crate by itself.my-crate-clippy = craneLib.cargoClippy (commonArgs // {inherit cargoArtifacts;cargoClippyExtraArgs = "--all-targets -- --deny warnings";});my-crate-doc = craneLib.cargoDoc (commonArgs // {inherit cargoArtifacts;});# Check formattingmy-crate-fmt = craneLib.cargoFmt {inherit src;};# Audit dependenciesmy-crate-audit = craneLib.cargoAudit {inherit src advisory-db;};# Audit licensesmy-crate-deny = craneLib.cargoDeny {inherit src;};# Run tests with cargo-nextest# Consider setting `doCheck = false` on `my-crate` if you do not want# the tests to run twicemy-crate-nextest = craneLib.cargoNextest (commonArgs // {inherit cargoArtifacts;partitions = 1;partitionType = "count";});};packages = {default = my-crate;my-crate-llvm-coverage = craneLibLLvmTools.cargoLlvmCov (commonArgs // {inherit cargoArtifacts;});};apps.default = flake-utils.lib.mkApp {drv = my-crate;};devShells.default = craneLib.devShell {# Inherit inputs from checks.checks = self.checks.${system};# Additional dev-shell environment variables can be set directly# MY_CUSTOM_DEVELOPMENT_VAR = "something else";# Extra inputs can be added here; cargo and rustc are provided by default.packages = [# pkgs.ripgrep];};});} - file addition: flake.lock[5.1]
{"nodes": {"advisory-db": {"flake": false,"locked": {"lastModified": 1699714741,"narHash": "sha256-7cRZc3RoBv4n9GgMun+OoTK5ssI2fzqkDAZsp37uhTs=","owner": "rustsec","repo": "advisory-db","rev": "3338fcfb59cea5fcd7d2a4e7fe24cbc7cb778003","type": "github"},"original": {"owner": "rustsec","repo": "advisory-db","type": "github"}},"crane": {"inputs": {"nixpkgs": ["nixpkgs"]},"locked": {"lastModified": 1699548976,"narHash": "sha256-xnpxms0koM8mQpxIup9JnT0F7GrKdvv0QvtxvRuOYR4=","owner": "ipetkov","repo": "crane","rev": "6849911446e18e520970cc6b7a691e64ee90d649","type": "github"},"original": {"owner": "ipetkov","repo": "crane","type": "github"}},"fenix": {"inputs": {"nixpkgs": ["nixpkgs"],"rust-analyzer-src": []},"locked": {"lastModified": 1699770036,"narHash": "sha256-bZmI7ytPAYLpyFNgj5xirDkKuAniOkj1xHdv5aIJ5GM=","owner": "nix-community","repo": "fenix","rev": "81ab0b4f7ae9ebb57daa0edf119c4891806e4d3a","type": "github"},"original": {"owner": "nix-community","repo": "fenix","type": "github"}},"flake-utils": {"inputs": {"systems": "systems"},"locked": {"lastModified": 1694529238,"narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=","owner": "numtide","repo": "flake-utils","rev": "ff7b65b44d01cf9ba6a71320833626af21126384","type": "github"},"original": {"owner": "numtide","repo": "flake-utils","type": "github"}},"nixpkgs": {"locked": {"lastModified": 1699725108,"narHash": "sha256-NTiPW4jRC+9puakU4Vi8WpFEirhp92kTOSThuZke+FA=","owner": "NixOS","repo": "nixpkgs","rev": "911ad1e67f458b6bcf0278fa85e33bb9924fed7e","type": "github"},"original": {"owner": "NixOS","ref": "nixpkgs-unstable","repo": "nixpkgs","type": "github"}},"root": {"inputs": {"advisory-db": "advisory-db","crane": "crane","fenix": "fenix","flake-utils": "flake-utils","nixpkgs": "nixpkgs"}},"systems": {"locked": {"lastModified": 1681028828,"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=","owner": "nix-systems","repo": "default","rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e","type": "github"},"original": {"owner": "nix-systems","repo": "default","type": "github"}}},"root": "root","version": 7} - replacement in .ignore at line 1
# Created by https://www.toptal.com/developers/gitignore/api/rust,visualstudiocode,windows,linux# Edit at https://www.toptal.com/developers/gitignore?templates=rust,visualstudiocode,windows,linux# Created by https://www.toptal.com/developers/gitignore/api/rust,linux,windows,visualstudiocode,direnv# Edit at https://www.toptal.com/developers/gitignore?templates=rust,linux,windows,visualstudiocode,direnv### direnv ###.direnv.envrc - edit in .ignore at line 53
# Support for Project snippet scope.vscode/*.code-snippets - edit in .ignore at line 54
# Ignore code-workspaces*.code-workspace - replacement in .ignore at line 80
# End of https://www.toptal.com/developers/gitignore/api/rust,visualstudiocode,windows,linux# End of https://www.toptal.com/developers/gitignore/api/rust,linux,windows,visualstudiocode,direnv - replacement in .ignore at line 83
/common/beancount-pretty-printer/src/icu_data[2.69401]/common/beancount-pretty-printer/src/icu_data/parsers/iso20022-parser/src/types/external_code_sets.rs