Add Nix flake. :3
This commit is contained in:
parent
29a68bc047
commit
03f35f0b35
2 changed files with 75 additions and 0 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -5,3 +5,5 @@ pkg/*.pkg.tar.zst
|
||||||
pkg/*.tar.gz
|
pkg/*.tar.gz
|
||||||
pkg/pkg/
|
pkg/pkg/
|
||||||
pkg/src/
|
pkg/src/
|
||||||
|
result/
|
||||||
|
flake.lock
|
||||||
|
|
|
||||||
73
flake.nix
Normal file
73
flake.nix
Normal file
|
|
@ -0,0 +1,73 @@
|
||||||
|
{
|
||||||
|
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;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
});
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue