text-editor/flake.nix

90 lines
2.5 KiB
Nix
Raw Normal View History

{
description = "text-editor";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
2023-04-26 10:16:36 +05:30
inputs.systems.url = "github:msfjarvis/flake-systems";
inputs.advisory-db.url = "github:rustsec/advisory-db";
inputs.advisory-db.flake = false;
2023-04-26 10:16:36 +05:30
inputs.crane.url = "github:ipetkov/crane";
inputs.crane.inputs.nixpkgs.follows = "nixpkgs";
2023-04-26 10:16:36 +05:30
inputs.devshell.url = "github:numtide/devshell";
inputs.devshell.inputs.nixpkgs.follows = "nixpkgs";
2024-01-31 11:26:49 +05:30
inputs.devshell.inputs.flake-utils.follows = "flake-utils";
inputs.fenix.url = "github:nix-community/fenix";
inputs.fenix.inputs.nixpkgs.follows = "nixpkgs";
inputs.flake-utils.url = "github:numtide/flake-utils";
inputs.flake-utils.inputs.systems.follows = "systems";
2023-04-26 10:16:36 +05:30
inputs.flake-compat.url = "github:nix-community/flake-compat";
inputs.flake-compat.flake = false;
2023-02-16 19:56:30 +05:30
outputs = {
self,
nixpkgs,
advisory-db,
2023-02-16 19:56:30 +05:30
crane,
devshell,
fenix,
2023-02-16 19:56:30 +05:30
flake-utils,
...
}:
flake-utils.lib.eachDefaultSystem (system: let
pkgs = import nixpkgs {
inherit system;
overlays = [devshell.overlays.default];
};
rustStable = (import fenix {inherit pkgs;}).fromToolchainFile {
file = ./rust-toolchain.toml;
sha256 = "sha256-gdYqng0y9iHYzYPAdkC/ka3DRny3La/S5G8ASj0Ayyc=";
2023-02-16 19:56:30 +05:30
};
2023-02-16 19:56:30 +05:30
craneLib = (crane.mkLib pkgs).overrideToolchain rustStable;
2023-04-26 10:16:36 +05:30
commonArgs = {
src = craneLib.cleanCargoSource ./.;
buildInputs = [];
nativeBuildInputs = [];
2023-02-16 19:56:30 +05:30
cargoClippyExtraArgs = "--all-targets -- --deny warnings";
};
2023-04-26 10:16:36 +05:30
cargoArtifacts = craneLib.buildDepsOnly (commonArgs // {doCheck = false;});
text-editor = craneLib.buildPackage (commonArgs // {doCheck = false;});
text-editor-clippy = craneLib.cargoClippy (commonArgs
// {
inherit cargoArtifacts;
});
text-editor-fmt = craneLib.cargoFmt (commonArgs // {});
text-editor-audit = craneLib.cargoAudit (commonArgs // {inherit advisory-db;});
2023-02-16 19:56:30 +05:30
in {
checks = {
inherit text-editor text-editor-audit text-editor-clippy text-editor-fmt;
2023-02-16 19:56:30 +05:30
};
2023-02-16 19:56:30 +05:30
packages.default = text-editor;
2023-02-16 19:56:30 +05:30
apps.default = flake-utils.lib.mkApp {drv = text-editor;};
devShells.default = pkgs.devshell.mkShell {
bash = {interactive = "";};
env = [
{
name = "DEVSHELL_NO_MOTD";
value = 1;
}
];
packages = with pkgs; [
2023-02-16 19:56:30 +05:30
cargo-nextest
rustStable
];
};
});
}