From 331d8966668250b9703876c7e8d8c4a1bf59bbd7 Mon Sep 17 00:00:00 2001 From: Robert Hensing Date: Sat, 2 May 2026 15:54:21 +0100 Subject: [PATCH] chore(dev): add nix-unit --- dev/flake-module.nix | 6 ++++ dev/flake.lock | 65 ++++++++++++++++++++++++++++++++++++++++++++ dev/flake.nix | 2 ++ flake.nix | 1 + 4 files changed, 74 insertions(+) diff --git a/dev/flake-module.nix b/dev/flake-module.nix index 066fce4..c923f68 100644 --- a/dev/flake-module.nix +++ b/dev/flake-module.nix @@ -4,6 +4,7 @@ imports = [ inputs.pre-commit-hooks-nix.flakeModule inputs.hercules-ci-effects.flakeModule # herculesCI attr + inputs.nix-unit.modules.flake.default ]; systems = [ "x86_64-linux" "aarch64-darwin" ]; @@ -21,6 +22,7 @@ devShells.default = pkgs.mkShell { nativeBuildInputs = [ + config.nix-unit.package pkgs.nixpkgs-fmt pkgs.hci ]; @@ -40,6 +42,10 @@ let tests = import ./tests/eval-tests.nix { flake-parts = self; }; in tests.runTests pkgs.emptyFile // { internals = tests; }; + # nix-unit evaluates the flake, which triggers the dev partition via + # flake-compat, requiring network to fetch dev inputs. + nix-unit.allowNetwork = true; + }; flake = { # for repl exploration / debug diff --git a/dev/flake.lock b/dev/flake.lock index 18184fd..98a0667 100644 --- a/dev/flake.lock +++ b/dev/flake.lock @@ -76,6 +76,49 @@ "type": "github" } }, + "nix-github-actions": { + "inputs": { + "nixpkgs": [ + "nix-unit", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1737420293, + "narHash": "sha256-F1G5ifvqTpJq7fdkT34e/Jy9VCyzd5XfJ9TO8fHhJWE=", + "owner": "nix-community", + "repo": "nix-github-actions", + "rev": "f4158fa080ef4503c8f4c820967d946c2af31ec9", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nix-github-actions", + "type": "github" + } + }, + "nix-unit": { + "inputs": { + "nix-github-actions": "nix-github-actions", + "nixpkgs": [ + "nixpkgs" + ], + "treefmt-nix": "treefmt-nix" + }, + "locked": { + "lastModified": 1777114263, + "narHash": "sha256-vZfRXBDC9FTO2Vpz8TroVMqOYqp+hcVk6Nwx6+kRN1Q=", + "owner": "nix-community", + "repo": "nix-unit", + "rev": "02e6597889281382303cbb7973748f04f2940e1a", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nix-unit", + "type": "github" + } + }, "nixpkgs": { "locked": { "lastModified": 1775710090, @@ -132,9 +175,31 @@ "root": { "inputs": { "hercules-ci-effects": "hercules-ci-effects", + "nix-unit": "nix-unit", "nixpkgs": "nixpkgs_2", "pre-commit-hooks-nix": "pre-commit-hooks-nix" } + }, + "treefmt-nix": { + "inputs": { + "nixpkgs": [ + "nix-unit", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1775636079, + "narHash": "sha256-pc20NRoMdiar8oPQceQT47UUZMBTiMdUuWrYu2obUP0=", + "owner": "numtide", + "repo": "treefmt-nix", + "rev": "790751ff7fd3801feeaf96d7dc416a8d581265ba", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "treefmt-nix", + "type": "github" + } } }, "root": "root", diff --git a/dev/flake.nix b/dev/flake.nix index 571ebb7..82e080b 100644 --- a/dev/flake.nix +++ b/dev/flake.nix @@ -10,6 +10,8 @@ pre-commit-hooks-nix.url = "github:cachix/pre-commit-hooks.nix"; pre-commit-hooks-nix.inputs.nixpkgs.follows = "nixpkgs"; hercules-ci-effects.url = "github:hercules-ci/hercules-ci-effects"; + nix-unit.url = "github:nix-community/nix-unit"; + nix-unit.inputs.nixpkgs.follows = "nixpkgs"; }; outputs = { ... }: diff --git a/flake.nix b/flake.nix index 0039290..8d1aef5 100644 --- a/flake.nix +++ b/flake.nix @@ -59,6 +59,7 @@ partitionedAttrs.checks = "dev"; partitionedAttrs.devShells = "dev"; partitionedAttrs.herculesCI = "dev"; + partitionedAttrs.tests = "dev"; partitions.dev.extraInputsFlake = ./dev; partitions.dev.module = { imports = [ ./dev/flake-module.nix ];