meat/flake.nix
atagen 0fc93545ce
All checks were successful
Nix Build / nix build (push) Successful in 40s
satisfy nixpkgs pedantry
2026-01-29 16:18:32 +11:00

96 lines
2.4 KiB
Nix

{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
nix-systems.url = "github:nix-systems/default-linux";
unf.url = "git+https://git.atagen.co/atagen/unf";
};
outputs =
inputs:
with inputs;
let
version = builtins.toString self.lastModified;
collectPkgs = builtins.attrValues;
forEachSystem =
function:
nixpkgs.lib.genAttrs (import nix-systems) (
system: function nixpkgs.legacyPackages.${system} system
);
deps = forEachSystem (
pkgs: _: {
build = collectPkgs {
inherit (pkgs.ocamlPackages)
dune_3
ocaml
;
};
dev = collectPkgs {
inherit (pkgs.ocamlPackages)
utop
ocaml-lsp
ocamlformat
ocamlformat-rpc-lib
;
};
}
);
in
{
devShells = forEachSystem (
pkgs: sys: {
default = pkgs.mkShell {
packages = pkgs.lib.mapAttrsToList (_: v: v) deps.${sys};
shellHook =
let
justFile = ''
default:
@just --list
@build:
nix build .#debug --offline
@release:
nix build --offline
@test:
printf "\\n\\n\\t************ running nix+dune tests ************\\n\\n\\n"
nix flake check --offline
'';
in
''
printf '${justFile}' > justfile
'';
};
}
);
packages = forEachSystem (
pkgs: sys: {
default = pkgs.callPackage ./nix/default.nix {
buildInputs = deps.${sys}.build;
inherit version;
};
docs = pkgs.callPackage unf.lib.pak-chooie {
inherit self;
projectName = "meat";
newPath = "https://git.atagen.co/atagen/meat/src";
modules = [
self.nixosModules.meat
];
};
}
);
nixosModules.meat =
{
pkgs,
lib,
...
}:
{
imports = [ ./nix/module.nix ];
programs.meat.package = self.packages.${pkgs.stdenv.hostPlatform.system}.default;
};
};
}