thekenlicht/flake.nix

120 lines
3.4 KiB
Nix
Raw Normal View History

2024-08-28 22:48:06 +02:00
{
description = "Daemon to convert ArtNet to Thekenlicht Commands";
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:
let
pkgs = nixpkgs.legacyPackages.${system};
inherit (pkgs) lib;
craneLib = crane.mkLib pkgs;
src = craneLib.cleanCargoSource ./.;
# Common arguments can be set here to avoid repeating them later
commonArgs = {
inherit src;
strictDeps = true;
buildInputs = [];
};
cargoArtifacts = craneLib.buildDepsOnly commonArgs;
# artifacts from above.
thekenlicht-daemon = craneLib.buildPackage (commonArgs // {
inherit cargoArtifacts;
});
in
{
checks = {
inherit thekenlicht-daemon;
# Run clippy (and deny all warnings) on the crate source,
# again, reusing 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.
thekenlicht-daemon-clippy = craneLib.cargoClippy (commonArgs // {
inherit cargoArtifacts;
cargoClippyExtraArgs = "--all-targets -- --deny warnings";
});
thekenlicht-daemon-doc = craneLib.cargoDoc (commonArgs // {
inherit cargoArtifacts;
});
# Check formatting
thekenlicht-daemon-fmt = craneLib.cargoFmt {
inherit src;
};
# Audit dependencies
thekenlicht-daemon-audit = craneLib.cargoAudit {
inherit src advisory-db;
};
# Audit licenses
#thekenlicht-daemon-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 twice
thekenlicht-daemon-nextest = craneLib.cargoNextest (commonArgs // {
inherit cargoArtifacts;
partitions = 1;
partitionType = "count";
});
};
packages = {
default = thekenlicht-daemon;
};
apps.default = flake-utils.lib.mkApp {
drv = thekenlicht-daemon;
};
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
];
};
2024-08-28 22:55:41 +02:00
}) // {
2024-08-28 22:58:04 +02:00
nixosModules.thekenlicht-daemon = (import ./module.nix {flake=self;});
2024-08-28 22:55:41 +02:00
};
2024-08-28 22:48:06 +02:00
}