2025-01-16 10:40:44 +01:00
|
|
|
# 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;
|
2025-01-16 19:28:53 +01:00
|
|
|
container-image = pkgs.dockerTools.buildImage {
|
|
|
|
name = "git.madhouse-project.org/algernon/iocaine";
|
|
|
|
tag = "latest";
|
|
|
|
copyToRoot = pkgs.buildEnv {
|
|
|
|
name = "image-root";
|
|
|
|
paths = [ self.packages.${pkgs.hostPlatform.system}.iocaine ];
|
|
|
|
pathsToLink = [ "/bin" ];
|
|
|
|
};
|
|
|
|
config = {
|
|
|
|
Entrypoint = [ "/bin/iocaine" ];
|
|
|
|
Labels = {
|
|
|
|
"org.opencontainers.image.description" = "The deadliest poison known to AI";
|
|
|
|
"org.opencontainers.image.source" = "https://git.madhouse-project.org/algernon/iocaine";
|
2025-01-25 02:33:11 +01:00
|
|
|
"org.opencontainers.image.url" = "https://iocaine.madhouse-project.org/";
|
2025-01-16 19:28:53 +01:00
|
|
|
"org.opencontainers.image.authors" = "Gergely Nagy";
|
|
|
|
"org.opencontainers.image.licenses" = "MIT";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
2025-01-16 10:40:44 +01:00
|
|
|
}
|
|
|
|
);
|
|
|
|
|
|
|
|
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
|
2025-01-25 01:31:38 +01:00
|
|
|
zola
|
2025-01-16 10:40:44 +01:00
|
|
|
];
|
|
|
|
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;
|
|
|
|
};
|
|
|
|
});
|
2025-01-16 12:27:10 +01:00
|
|
|
|
|
|
|
nixosModules.default = import ./nix/nixos-module.nix { inherit self; };
|
2025-01-16 10:40:44 +01:00
|
|
|
};
|
|
|
|
}
|