purge flake demons

This commit is contained in:
atagen 2025-07-01 00:26:18 +10:00
parent 40feebba44
commit 9d46a07857
5 changed files with 142 additions and 181 deletions

149
flake.nix
View file

@ -1,59 +1,45 @@
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
nixConfig = {
extra-substituters = "https://anmonteiro.nix-cache.workers.dev";
extra-trusted-public-keys = "ocaml.nix-cache.com-1:/xI2h2+56rwFfKyyFVbkJSeGqSIYMC/Je+7XXqGKDIY=";
systems.url = "github:nix-systems/default-linux";
};
outputs =
{
self,
nixpkgs,
flake-utils,
systems,
}:
let
forAllSystems =
function: nixpkgs.lib.genAttrs (import systems) (system: function nixpkgs.legacyPackages.${system});
version = builtins.toString self.lastModified;
in
flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = import nixpkgs {
inherit system;
getPkgs = builtins.attrValues;
deps = pkgs: {
minimal = getPkgs {
inherit (pkgs.ocamlPackages)
dune_3
ocaml
angstrom
angstrom-unix
ppx_inline_test
;
};
inherit (pkgs) mkShell ocamlPackages;
inherit (ocamlPackages)
dune_3
ocaml
utop
ocaml-lsp
ocamlformat
ocamlformat-rpc-lib
angstrom
angstrom-unix
ppx_inline_test
;
minimal = [
dune_3
ocaml
angstrom
angstrom-unix
ppx_inline_test
];
dev = [
utop
ocaml-lsp
ocamlformat
ocamlformat-rpc-lib
pkgs.just
];
in
{
devShells.default = mkShell {
buildInputs = minimal ++ dev;
dev = getPkgs {
inherit (pkgs.ocamlPackages)
utop
ocaml-lsp
ocamlformat
ocamlformat-rpc-lib
;
inherit (pkgs) just;
};
};
in
{
devShells = forAllSystems (pkgs: {
default = pkgs.mkShell {
packages = with (deps pkgs); minimal ++ dev;
shellHook =
let
justFile = ''
@ -82,59 +68,46 @@
printf '${justFile}' > justfile
'';
};
});
checks.default = pkgs.callPackage ./nix/test.nix {
culr = self.packages.${system}.tests;
checks = forAllSystems (pkgs: {
default = pkgs.callPackage ./nix/test.nix {
culr = self.packages.${pkgs.system}.tests;
inherit version;
};
});
packages.default = pkgs.callPackage ./nix/default.nix {
ocaml-deps = minimal;
inherit version;
};
packages.debug = pkgs.callPackage ./nix/default.nix {
debug = true;
ocaml-deps = minimal;
inherit version;
};
packages.tests = pkgs.callPackage ./nix/default.nix {
debug = true;
ocaml-deps = minimal;
doCheck = true;
inherit version;
};
}
)
// {
nixosModules.culr = import ./nix/module.nix { overlays = [ self.overlays.culr ]; };
overlays.culr =
final: prev:
packages = forAllSystems (
pkgs:
let
ocaml-deps =
let
inherit (prev.ocamlPackages)
dune_3
ocaml
angstrom
angstrom-unix
ppx_inline_test
;
in
[
dune_3
ocaml
angstrom
angstrom-unix
ppx_inline_test
];
minimal = (deps pkgs).minimal;
in
{
culr = final.callPackage ./nix/default.nix {
inherit ocaml-deps version;
culr = self.packages.${pkgs.system}.default;
default = pkgs.ocamlPackages.callPackage ./nix/default.nix {
ocaml-deps = minimal;
inherit version;
};
debug = pkgs.ocamlPackages.callPackage ./nix/default.nix {
debug = true;
ocaml-deps = minimal;
inherit version;
};
tests = pkgs.ocamlPackages.callPackage ./nix/default.nix {
debug = true;
ocaml-deps = minimal;
doCheck = true;
inherit version;
};
}
);
nixosModules.culr =
{ pkgs, ... }:
{
imports = [ ./nix/module.nix ];
programs.culr.package = self.packages.${pkgs.system}.culr;
};
};
}