73 lines
No EOL
2.1 KiB
Nix
73 lines
No EOL
2.1 KiB
Nix
{
|
|
description = "A simple dollcode encoder, decoder, and generator inside your terminal :3";
|
|
|
|
inputs = {
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
|
crane.url = "github:ipetkov/crane";
|
|
flake-utils.url = "github:numtide/flake-utils";
|
|
};
|
|
|
|
outputs = { self, nixpkgs, crane, flake-utils }:
|
|
flake-utils.lib.eachDefaultSystem (system:
|
|
let
|
|
pkgs = import nixpkgs { inherit system; };
|
|
|
|
craneLib = crane.mkLib pkgs;
|
|
|
|
# Common build inputs / env shared across derivations.
|
|
# crane's default cargo source filter drops LICENSE, but main.rs does
|
|
# `include_str!("../LICENSE")`, so we keep it alongside cargo sources.
|
|
commonArgs = {
|
|
src = pkgs.lib.cleanSourceWith {
|
|
src = ./.;
|
|
filter = path: type:
|
|
craneLib.filterCargoSources path type
|
|
|| baseNameOf path == "LICENSE";
|
|
};
|
|
strictDeps = true;
|
|
};
|
|
|
|
# Build *just* the dependencies so they can be cached and reused
|
|
# across source changes. (Edition 2024 needs Rust >= 1.85, which
|
|
# nixpkgs-unstable ships by default.)
|
|
cargoArtifacts = craneLib.buildDepsOnly commonArgs;
|
|
|
|
dolltool = craneLib.buildPackage (commonArgs // {
|
|
inherit cargoArtifacts;
|
|
doCheck = true;
|
|
});
|
|
in
|
|
{
|
|
packages = {
|
|
default = dolltool;
|
|
inherit dolltool;
|
|
};
|
|
|
|
apps.default = flake-utils.lib.mkApp {
|
|
drv = dolltool;
|
|
name = "dolltool";
|
|
};
|
|
|
|
devShells.default = pkgs.mkShell {
|
|
inputsFrom = [ dolltool ];
|
|
packages = with pkgs; [
|
|
rustc
|
|
cargo
|
|
cargo-edit
|
|
rustfmt
|
|
clippy
|
|
];
|
|
};
|
|
|
|
checks = {
|
|
inherit dolltool;
|
|
clippy = craneLib.cargoClippy (commonArgs // {
|
|
inherit cargoArtifacts;
|
|
cargoClippyExtraArgs = "--all-targets -- --deny warnings";
|
|
});
|
|
fmt = craneLib.cargoFmt (commonArgs // {
|
|
inherit cargoArtifacts;
|
|
});
|
|
};
|
|
});
|
|
} |