mirror of
https://git.madhouse-project.org/algernon/iocaine.git
synced 2025-02-02 15:56:19 +01:00
94 lines
2.4 KiB
Nix
94 lines
2.4 KiB
Nix
|
# SPDX-FileCopyrightText: 2025 Gergely Nagy
|
||
|
# SPDX-FileContributor: Gergely Nagy
|
||
|
#
|
||
|
# SPDX-License-Identifier: MIT
|
||
|
{
|
||
|
description = "The deadliest poison known to AI";
|
||
|
|
||
|
inputs = {
|
||
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11";
|
||
|
|
||
|
pre-commit-hooks = {
|
||
|
url = "github:cachix/pre-commit-hooks.nix";
|
||
|
inputs.nixpkgs.follows = "nixpkgs";
|
||
|
};
|
||
|
treefmt-nix = {
|
||
|
url = "github:numtide/treefmt-nix";
|
||
|
inputs.nixpkgs.follows = "nixpkgs";
|
||
|
};
|
||
|
};
|
||
|
|
||
|
outputs =
|
||
|
{
|
||
|
self,
|
||
|
nixpkgs,
|
||
|
systems,
|
||
|
treefmt-nix,
|
||
|
...
|
||
|
}@inputs:
|
||
|
let
|
||
|
inherit (nixpkgs) lib;
|
||
|
|
||
|
forEachSystem =
|
||
|
f:
|
||
|
nixpkgs.lib.genAttrs (import systems) (
|
||
|
system:
|
||
|
let
|
||
|
pkgs = import nixpkgs {
|
||
|
inherit system;
|
||
|
|
||
|
overlays = [ self.overlays.default ];
|
||
|
};
|
||
|
in
|
||
|
f pkgs
|
||
|
);
|
||
|
|
||
|
treefmtEval = forEachSystem (pkgs: treefmt-nix.lib.evalModule pkgs ./nix/treefmt.nix);
|
||
|
treefmtWrapper = pkgs: treefmtEval.${pkgs.system}.config.build.wrapper;
|
||
|
in
|
||
|
{
|
||
|
overlays.default = import ./nix/overlay.nix { inherit self lib; };
|
||
|
formatter = forEachSystem treefmtWrapper;
|
||
|
checks = forEachSystem (pkgs: {
|
||
|
formatting = treefmtEval.${pkgs.system}.config.build.check self;
|
||
|
pre-commit-check = inputs.pre-commit-hooks.lib.${pkgs.system}.run {
|
||
|
src = ./.;
|
||
|
hooks = import ./nix/pre-commit-check.nix {
|
||
|
inherit pkgs;
|
||
|
treefmt = treefmtWrapper pkgs;
|
||
|
};
|
||
|
};
|
||
|
});
|
||
|
packages = forEachSystem (
|
||
|
pkgs:
|
||
|
(self.overlays.default pkgs pkgs)
|
||
|
// {
|
||
|
default = self.packages.${pkgs.hostPlatform.system}.iocaine;
|
||
|
}
|
||
|
);
|
||
|
|
||
|
apps = forEachSystem (pkgs: {
|
||
|
iocaine = {
|
||
|
type = "app";
|
||
|
program = "${pkgs.lib.getExe pkgs.iocaine}";
|
||
|
};
|
||
|
});
|
||
|
|
||
|
devShells = forEachSystem (pkgs: {
|
||
|
default = pkgs.mkShell {
|
||
|
packages = with pkgs; [
|
||
|
clippy
|
||
|
reuse
|
||
|
rust-analyzer
|
||
|
];
|
||
|
inputsFrom = [
|
||
|
self.packages.${pkgs.system}.iocaine
|
||
|
treefmtEval.${pkgs.system}.config.build.devShell
|
||
|
];
|
||
|
shellHook =
|
||
|
"export RUSTFLAGS='--cfg tokio_unstable';" + self.checks.${pkgs.system}.pre-commit-check.shellHook;
|
||
|
};
|
||
|
});
|
||
|
};
|
||
|
}
|