diff --git a/buildbot-nix.toml b/buildbot-nix.toml new file mode 100644 index 000000000..ac64389e4 --- /dev/null +++ b/buildbot-nix.toml @@ -0,0 +1 @@ +attribute = "checks.x86_64-linux" diff --git a/flake.lock b/flake.lock index f21f080f9..b0a49fb48 100644 --- a/flake.lock +++ b/flake.lock @@ -62,6 +62,22 @@ } }, "flake-compat_2": { + "flake": false, + "locked": { + "lastModified": 1747046372, + "narHash": "sha256-CIVLLkVgvHYbgI2UpXvIIBJ12HWgX+fjA8Xf8PUmqCY=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "9100a0f413b0c601e0533d1d94ffd501ce2e7885", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-compat_3": { "flake": false, "locked": { "lastModified": 1761588595, @@ -179,6 +195,73 @@ "type": "github" } }, + "hillingar": { + "inputs": { + "flake-utils": [ + "flake-utils" + ], + "mirage-opam-overlays": [ + "mirage-opam-overlays" + ], + "nix-filter": "nix-filter", + "nixpkgs": [ + "nixpkgs" + ], + "opam-nix": "opam-nix", + "opam-overlays": [ + "opam-overlays" + ], + "opam-repository": [ + "opam-repository" + ], + "opam2json": "opam2json" + }, + "locked": { + "lastModified": 1766236620, + "narHash": "sha256-HGlWtnNeUKih2mhCyC71EHAj9uodhFjXzaJOFjWbtzw=", + "owner": "RyanGibb", + "repo": "hillingar", + "rev": "cdc7ea9cdf071dd92197db07dd282510796f8394", + "type": "github" + }, + "original": { + "owner": "RyanGibb", + "repo": "hillingar", + "type": "github" + } + }, + "mirage-opam-overlays": { + "flake": false, + "locked": { + "lastModified": 1760115982, + "narHash": "sha256-vXpXKP3fWPk1e6tiVtv1dj01mdDtRWckqSzCW62FnCU=", + "owner": "dune-universe", + "repo": "mirage-opam-overlays", + "rev": "eddcd1bc7e035392596b603d23dde67a88e6f6bc", + "type": "github" + }, + "original": { + "owner": "dune-universe", + "repo": "mirage-opam-overlays", + "type": "github" + } + }, + "nix-filter": { + "locked": { + "lastModified": 1659352118, + "narHash": "sha256-X/Tdlj/PYxcQg/1hcHXxdnDr5zLO22LohIudX+oT968=", + "owner": "numtide", + "repo": "nix-filter", + "rev": "3e1fff9ec0112fe5ec61ea7cc6d37c1720d865f8", + "type": "github" + }, + "original": { + "owner": "numtide", + "ref": "3e1fff9", + "repo": "nix-filter", + "type": "github" + } + }, "nixdoc-to-github": { "flake": false, "locked": { @@ -211,9 +294,104 @@ "type": "github" } }, - "pre-commit-hooks": { + "opam-nix": { "inputs": { "flake-compat": "flake-compat_2", + "flake-utils": [ + "hillingar", + "flake-utils" + ], + "mirage-opam-overlays": [ + "hillingar", + "mirage-opam-overlays" + ], + "nixpkgs": [ + "hillingar", + "nixpkgs" + ], + "opam-overlays": [ + "hillingar", + "opam-overlays" + ], + "opam-repository": [ + "hillingar", + "opam-repository" + ], + "opam2json": [ + "hillingar", + "opam2json" + ] + }, + "locked": { + "lastModified": 1762273592, + "narHash": "sha256-dXex1fPdmzj4xKWEWrcvbgin/iLFaxrt9vi305m6nUc=", + "owner": "tweag", + "repo": "opam-nix", + "rev": "98ca8f4401e996aeac38b6f14bf3a82d85b7add7", + "type": "github" + }, + "original": { + "owner": "tweag", + "repo": "opam-nix", + "type": "github" + } + }, + "opam-overlays": { + "flake": false, + "locked": { + "lastModified": 1765419722, + "narHash": "sha256-tjb9uZAuex5nOeFo5oRL+Z7AnXK6Of0n7s+rIotlD34=", + "owner": "dune-universe", + "repo": "opam-overlays", + "rev": "12731a6f86d7c452a94c72106fa9d3327988582d", + "type": "github" + }, + "original": { + "owner": "dune-universe", + "repo": "opam-overlays", + "type": "github" + } + }, + "opam-repository": { + "flake": false, + "locked": { + "lastModified": 1766253070, + "narHash": "sha256-s1WDiWw488G5FsJeYz9Dqgz6T1tuzodGTQhqjLjf7pc=", + "owner": "ocaml", + "repo": "opam-repository", + "rev": "a2ea42d4ff1fc1152596f11a8cb64c1a396f89ea", + "type": "github" + }, + "original": { + "owner": "ocaml", + "repo": "opam-repository", + "type": "github" + } + }, + "opam2json": { + "inputs": { + "nixpkgs": [ + "hillingar", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1671540003, + "narHash": "sha256-5pXfbUfpVABtKbii6aaI2EdAZTjHJ2QntEf0QD2O5AM=", + "owner": "tweag", + "repo": "opam2json", + "rev": "819d291ea95e271b0e6027679de6abb4d4f7f680", + "type": "github" + }, + "original": { + "owner": "tweag", + "repo": "opam2json", + "type": "github" + } + }, + "pre-commit-hooks": { + "inputs": { + "flake-compat": "flake-compat_3", "gitignore": "gitignore", "nixpkgs": [ "nixpkgs" @@ -282,8 +460,12 @@ "buildbot-nix": "buildbot-nix", "dream2nix": "dream2nix", "flake-utils": "flake-utils", + "hillingar": "hillingar", + "mirage-opam-overlays": "mirage-opam-overlays", "nixdoc-to-github": "nixdoc-to-github", "nixpkgs": "nixpkgs", + "opam-overlays": "opam-overlays", + "opam-repository": "opam-repository", "pre-commit-hooks": "pre-commit-hooks", "sbt-derivation": "sbt-derivation", "sops-nix": "sops-nix", diff --git a/flake.nix b/flake.nix index 01051346e..9e70c3dbe 100644 --- a/flake.nix +++ b/flake.nix @@ -17,6 +17,26 @@ inputs.nixdoc-to-github.flake = false; inputs.nixdoc-to-github.url = "github:fricklerhandwerk/nixdoc-to-github"; + inputs.hillingar.inputs.nixpkgs.follows = "nixpkgs"; + inputs.hillingar.inputs.flake-utils.follows = "flake-utils"; + inputs.hillingar.inputs.opam-repository.follows = "opam-repository"; + inputs.hillingar.inputs.opam-overlays.follows = "opam-overlays"; + inputs.hillingar.inputs.mirage-opam-overlays.follows = "mirage-opam-overlays"; + inputs.hillingar.url = "github:RyanGibb/hillingar"; + # update ocaml-related overlays to use new-enough ocaml packages + inputs.opam-repository = { + url = "github:ocaml/opam-repository"; + flake = false; + }; + inputs.opam-overlays = { + url = "github:dune-universe/opam-overlays"; + flake = false; + }; + inputs.mirage-opam-overlays = { + url = "github:dune-universe/mirage-opam-overlays"; + flake = false; + }; + # See for plans to support Darwin. inputs.systems.url = "github:nix-systems/default-linux"; diff --git a/maintainers/shells/default.nix b/maintainers/shells/default.nix index 0fc85b658..765e5d7d3 100644 --- a/maintainers/shells/default.nix +++ b/maintainers/shells/default.nix @@ -61,6 +61,7 @@ pkgs.mkShellNoCC { # FIX: package scope "bigbluebutton" "heads" + "dnsvizor" # FIX: don't update `sparql-queries` if there is no version change "inventaire-client" # fetcher not supported diff --git a/pkgs/by-name/default.nix b/pkgs/by-name/default.nix index 923f69de2..114d8b0d8 100644 --- a/pkgs/by-name/default.nix +++ b/pkgs/by-name/default.nix @@ -2,6 +2,7 @@ lib, pkgs, dream2nix, + hillingar, sources, }: let @@ -82,6 +83,10 @@ let callPackage (directory + "/sbt-derivation.nix") { inherit mkSbtDerivation; } + else if pathExists (directory + "/hillingar.nix") then + callPackage (directory + "/hillingar.nix") { + inherit hillingar; + } else throw "No package.nix, dream2.nix or sbt-derivation.nix found in ${directory}" ) packageDirectories; diff --git a/pkgs/by-name/dnsvizor/hillingar.nix b/pkgs/by-name/dnsvizor/hillingar.nix new file mode 100644 index 000000000..cf9c11e9b --- /dev/null +++ b/pkgs/by-name/dnsvizor/hillingar.nix @@ -0,0 +1,93 @@ +{ + lib, + hillingar, + fetchFromGitHub, + pkgsStatic, + stdenv, +}: + +let + version = "0-unstable-2025-12-17"; + + unikernel = + lib.flip hillingar.mkUnikernelPackages + (fetchFromGitHub { + owner = "robur-coop"; + repo = "dnsvizor"; + rev = "57dbfa7208c765ba531995d9638f4a68b4cc6c15"; + hash = "sha256-heiCAB+1TlAVa23r1GD6WP2w3Ha8kbqKup/gzJz0EW8="; + # ideally we should use postPatch, but we cannot + postFetch = '' + # TODO(linj) enable test + # currently tests fail to build if target is not "unix" + rm -vrf $out/test + + # TODO(linj) remove this patch after dnsvizor#114 is merged + substituteInPlace $out/config.ml --replace-fail \ + 'package ~min:"0.5.0" "metrics";' \ + 'package ~min:"0.5.0" "metrics"; package ~min:"0.5.0" "metrics-lwt";' + ''; + }) + { + unikernelName = "dnsvizor"; + depexts = [ + pkgsStatic.gmp # some targets, such as hvt, need static gmp + ]; + monorepoQuery = { + uutf = "1.0.3+dune"; # default version is not in the dune overlay yet + }; + query = { + # follow upstream CI version (.cirrus.yml) because newer ones fail to build + ocaml-base-compiler = "4.14.2"; + }; + }; + + targets = [ + "unix" + "hvt" + "spt" + "xen" + "qubes" + "virtio" + "muen" + "macosx" + "genode" + ]; + + # not use lib.isDerivation because it triggers IFD error if there is one + isDerivation = target: _package: lib.elem target targets; + + # bad: eval failure by IFD or build failure + # do not use/set meta.broken because it doesn't cover eval failure by IFD + # more detailed support state can be found in https://github.com/Solo5/solo5/blob/dabc69fd89b8119449ec4088c54b458d4ccc851b/docs/building.md?plain=1#L55 + knownBad = + target: + (lib.elem target [ + "macosx" + "genode" # removed in solo5 0.7.0 + ]) + || ( + stdenv.hostPlatform.isAarch64 + && lib.elem target [ + "xen" + "qubes" + "virtio" + "muen" + ] + ); + notKnownBad = target: _package: !(knownBad target); + + # This project has no release so the inferred version is "dev", which is invalid for nix. + # Use this function to make it valid when necessary. + overrideVersionIfDev = + newVersion: package: + package.overrideAttrs (old: { + version = if old.version == "dev" then newVersion else old.version; + __intentionallyOverridingVersion = true; + }); +in +lib.pipe unikernel [ + (lib.filterAttrs isDerivation) + (lib.filterAttrs notKnownBad) + (lib.mapAttrs (_target: package: overrideVersionIfDev version package)) +] diff --git a/pkgs/lib.nix b/pkgs/lib.nix index 42c8a5d39..8ef9e6dd0 100644 --- a/pkgs/lib.nix +++ b/pkgs/lib.nix @@ -32,6 +32,7 @@ rec { call = self.newScope { nixdoc-to-github = self.callPackage sources.nixdoc-to-github { }; dream2nix = sources.dream2nix; + hillingar = sources.hillingar.lib.${system}; }; # Similar to `import`, but aware of `default` scope attributes.