101 lines
2.2 KiB
Nix
101 lines
2.2 KiB
Nix
{
|
|
description = "A very simple programming language, used to map functions to commands";
|
|
|
|
inputs = {
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
|
|
|
treefmt-nix = {
|
|
url = "github:numtide/treefmt-nix";
|
|
inputs = {
|
|
nixpkgs.follows = "nixpkgs";
|
|
};
|
|
};
|
|
|
|
crane = {
|
|
url = "github:ipetkov/crane";
|
|
inputs = {
|
|
nixpkgs.follows = "nixpkgs";
|
|
};
|
|
};
|
|
rust-overlay = {
|
|
url = "github:oxalica/rust-overlay";
|
|
inputs = {
|
|
nixpkgs.follows = "nixpkgs";
|
|
flake-utils.follows = "flake-utils";
|
|
};
|
|
};
|
|
|
|
# inputs for following
|
|
systems = {
|
|
url = "github:nix-systems/x86_64-linux"; # only evaluate for this system
|
|
};
|
|
flake-compat = {
|
|
url = "github:edolstra/flake-compat";
|
|
flake = false;
|
|
};
|
|
flake-utils = {
|
|
url = "github:numtide/flake-utils";
|
|
inputs = {
|
|
systems.follows = "systems";
|
|
};
|
|
};
|
|
};
|
|
|
|
outputs = {
|
|
self,
|
|
nixpkgs,
|
|
flake-utils,
|
|
treefmt-nix,
|
|
crane,
|
|
rust-overlay,
|
|
...
|
|
}:
|
|
flake-utils.lib.eachDefaultSystem (system: let
|
|
pkgs = import nixpkgs {
|
|
inherit system;
|
|
overlays = [(import rust-overlay)];
|
|
};
|
|
|
|
nightly = false;
|
|
rust_minimal =
|
|
if nightly
|
|
then pkgs.rust-bin.selectLatestNightlyWith (toolchain: toolchain.minimal)
|
|
else pkgs.rust-bin.stable.latest.minimal;
|
|
rust_default =
|
|
if nightly
|
|
then pkgs.rust-bin.selectLatestNightlyWith (toolchain: toolchain.default)
|
|
else pkgs.rust-bin.stable.latest.default;
|
|
|
|
craneLib = (crane.mkLib pkgs).overrideToolchain rust_minimal;
|
|
craneBuild = craneLib.buildPackage {
|
|
src = craneLib.cleanCargoSource ./.;
|
|
|
|
doCheck = true;
|
|
};
|
|
|
|
treefmtEval = import ./treefmt.nix {inherit treefmt-nix pkgs;};
|
|
in {
|
|
packages.default = craneBuild;
|
|
|
|
checks = {
|
|
inherit craneBuild;
|
|
formatting = treefmtEval.config.build.check self;
|
|
};
|
|
|
|
formatter = treefmtEval.config.build.wrapper;
|
|
|
|
devShells.default = pkgs.mkShell {
|
|
packages = with pkgs; [
|
|
cocogitto
|
|
|
|
rust_default
|
|
cargo-edit
|
|
|
|
licensure
|
|
];
|
|
};
|
|
});
|
|
}
|
|
# vim: ts=2
|
|
|