From 016f81f7790007bf6d667b6c51ed29534161eff5 Mon Sep 17 00:00:00 2001 From: atagen Date: Fri, 6 Dec 2024 15:20:25 +1100 Subject: [PATCH] add ocaml overlay back, create justfile --- flake.lock | 38 ++++++++++++++++++++++++++++---------- flake.nix | 46 +++++++++++++++++++++++++++++++++++++++------- 2 files changed, 67 insertions(+), 17 deletions(-) diff --git a/flake.lock b/flake.lock index 9d55469..8ab77d7 100644 --- a/flake.lock +++ b/flake.lock @@ -73,7 +73,7 @@ "lix" ], "nixpkgs": [ - "nixpkgs" + "nixpkgs-oc" ] }, "locked": { @@ -122,19 +122,37 @@ "type": "github" } }, - "nixpkgs_2": { + "nixpkgs-oc": { + "inputs": { + "nixpkgs": "nixpkgs_2" + }, "locked": { - "lastModified": 1733229606, - "narHash": "sha256-FLYY5M0rpa5C2QAE3CKLYAM6TwbKicdRK6qNrSHlNrE=", - "owner": "nixos", - "repo": "nixpkgs", - "rev": "566e53c2ad750c84f6d31f9ccb9d00f823165550", + "lastModified": 1733437725, + "narHash": "sha256-ridu0NcO4Dr2TsHqPE+kh58xTHcXg7IHq/FF74KrP/g=", + "owner": "nix-ocaml", + "repo": "nix-overlays", + "rev": "03b85ffd6c37255829d475f3584f8d8a1556d5f2", "type": "github" }, "original": { - "owner": "nixos", - "ref": "nixpkgs-unstable", + "owner": "nix-ocaml", + "repo": "nix-overlays", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1733380312, + "narHash": "sha256-ywntxT10Om755wkB9tYgJwEwELQZKYAO5WcNuHv1vjI=", + "owner": "NixOS", "repo": "nixpkgs", + "rev": "a772498086eac57d97065a980a21fc0f304e3192", + "type": "github" + }, + "original": { + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "a772498086eac57d97065a980a21fc0f304e3192", "type": "github" } }, @@ -144,7 +162,7 @@ "lix": "lix", "lix-module": "lix-module", "nh": "nh", - "nixpkgs": "nixpkgs_2" + "nixpkgs-oc": "nixpkgs-oc" } }, "systems": { diff --git a/flake.nix b/flake.nix index 54ec089..1732604 100644 --- a/flake.nix +++ b/flake.nix @@ -1,6 +1,6 @@ { inputs = { - nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; + nixpkgs-oc.url = "github:nix-ocaml/nix-overlays"; flake-utils.url = "github:numtide/flake-utils"; @@ -13,18 +13,23 @@ lix-module = { url = "https://git.lix.systems/lix-project/nixos-module/archive/main.tar.gz"; - inputs.nixpkgs.follows = "nixpkgs"; + inputs.nixpkgs.follows = "nixpkgs-oc"; inputs.lix.follows = "lix"; }; }; + nixConfig = { + extra-substituters = "https://anmonteiro.nix-cache.workers.dev"; + extra-trusted-public-keys = "ocaml.nix-cache.com-1:/xI2h2+56rwFfKyyFVbkJSeGqSIYMC/Je+7XXqGKDIY="; + }; + outputs = inputs @ { self, - nixpkgs, + nixpkgs-oc, flake-utils, ... }: let - inherit (inputs) nixpkgs; + inherit (inputs) nixpkgs-oc; lix-overlay = inputs.lix-module.overlays.default; lix-module = inputs.lix-module.nixosModules.default; nh-overlay = inputs.nh.overlays.default; @@ -32,11 +37,12 @@ in flake-utils.lib.eachDefaultSystem ( system: let - pkgs = import nixpkgs { + pkgs = import nixpkgs-oc { inherit system; overlays = [ lix-overlay nh-overlay + nixpkgs-oc.overlays.default ]; modules = [lix-module]; extra-substituters = "https://anmonteiro.nix-cache.workers.dev"; @@ -73,6 +79,31 @@ in mkShell { buildInputs = minimal ++ dev ++ [lix nh]; + 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 + ''; }; packages.default = pkgs.callPackage ./nix/default.nix { @@ -86,8 +117,9 @@ // { nixosModules.meat = import ./nix/module.nix { meatOverlays = [ - self.overlays.meat + nixpkgs-oc.overlays.default nh-overlay + self.overlays.meat ]; lixModule = lix-module; }; @@ -95,7 +127,7 @@ overlays.meat = final: prev: let ocaml-deps = let inherit - (prev.ocamlPackages) + (final.ocamlPackages) dune_3 ocaml ;