89 lines
2.2 KiB
Nix
89 lines
2.2 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});
|
|
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: {
|
|
default = pkgs.mkShell {
|
|
packages = pkgs.lib.mapAttrsToList (_: v: v) deps.${pkgs.system};
|
|
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: {
|
|
default = pkgs.callPackage ./nix/default.nix {
|
|
buildInputs = deps.${pkgs.system}.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.system}.default;
|
|
};
|
|
|
|
};
|
|
}
|