{ inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; systems.url = "github:nix-systems/default-linux"; }; outputs = { self, nixpkgs, systems, }: let forAllSystems = function: nixpkgs.lib.genAttrs (import systems) (system: function nixpkgs.legacyPackages.${system}); version = builtins.toString self.lastModified; getPkgs = builtins.attrValues; deps = pkgs: { minimal = getPkgs { inherit (pkgs.ocamlPackages) dune_3 ocaml angstrom angstrom-unix ppx_inline_test ; }; 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 = '' 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 nix build .#tests --offline printf "\\n\\n\\t************ running visual test ************\\n\\n\\n" echo one two three four | CULRS="(255,0,0);(0,0,255);#00FF00" CULR_ORDER="1;0;2" result/bin/culr @push: git commit -a git push ''; in '' printf '${justFile}' > justfile ''; }; }); checks = forAllSystems (pkgs: { default = pkgs.callPackage ./nix/test.nix { culr = self.packages.${pkgs.system}.tests; inherit version; }; }); packages = forAllSystems ( pkgs: let minimal = (deps pkgs).minimal; in { 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; }; }; }