From 25b5f58866a530e1a1285720813f54f656860739 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Thu, 3 Aug 2023 11:29:05 +0200 Subject: [PATCH] drop nix-unit from flake-inputs --- flake.lock | 49 ---------------------------------- flake.nix | 5 +--- pkgs/clan-cli/shell.nix | 2 +- pkgs/nix-unit/default.nix | 45 +++++++++++++++++++++++++++++++ pkgs/nix-unit/flake-module.nix | 5 ++++ 5 files changed, 52 insertions(+), 54 deletions(-) create mode 100644 pkgs/nix-unit/default.nix create mode 100644 pkgs/nix-unit/flake-module.nix diff --git a/flake.lock b/flake.lock index 1196be246..62baf34a5 100644 --- a/flake.lock +++ b/flake.lock @@ -95,54 +95,6 @@ "type": "github" } }, - "nix-github-actions": { - "inputs": { - "nixpkgs": [ - "nix-unit", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1688870561, - "narHash": "sha256-4UYkifnPEw1nAzqqPOTL2MvWtm3sNGw1UTYTalkTcGY=", - "owner": "nix-community", - "repo": "nix-github-actions", - "rev": "165b1650b753316aa7f1787f3005a8d2da0f5301", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "nix-github-actions", - "type": "github" - } - }, - "nix-unit": { - "inputs": { - "flake-parts": [ - "flake-parts" - ], - "nix-github-actions": "nix-github-actions", - "nixpkgs": [ - "nixpkgs" - ], - "treefmt-nix": [ - "treefmt-nix" - ] - }, - "locked": { - "lastModified": 1690289081, - "narHash": "sha256-PCXQAQt8+i2pkUym9P1JY4JGoeZJLzzxWBhprHDdItM=", - "owner": "adisbladis", - "repo": "nix-unit", - "rev": "a9d6f33e50d4dcd9cfc0c92253340437bbae282b", - "type": "github" - }, - "original": { - "owner": "adisbladis", - "repo": "nix-unit", - "type": "github" - } - }, "nixlib": { "locked": { "lastModified": 1689469483, @@ -253,7 +205,6 @@ "inputs": { "disko": "disko", "flake-parts": "flake-parts", - "nix-unit": "nix-unit", "nixos-generators": "nixos-generators", "nixpkgs": "nixpkgs", "pre-commit-hooks-nix": "pre-commit-hooks-nix", diff --git a/flake.nix b/flake.nix index e509386eb..b64fefe3e 100644 --- a/flake.nix +++ b/flake.nix @@ -12,10 +12,6 @@ treefmt-nix.url = "github:numtide/treefmt-nix"; treefmt-nix.inputs.nixpkgs.follows = "nixpkgs"; pre-commit-hooks-nix.url = "github:cachix/pre-commit-hooks.nix"; - nix-unit.url = "github:adisbladis/nix-unit"; - nix-unit.inputs.flake-parts.follows = "flake-parts"; - nix-unit.inputs.nixpkgs.follows = "nixpkgs"; - nix-unit.inputs.treefmt-nix.follows = "treefmt-nix"; }; outputs = inputs @ { flake-parts, ... }: @@ -35,6 +31,7 @@ ./templates/flake-module.nix ./templates/python-project/flake-module.nix ./pkgs/clan-cli/flake-module.nix + ./pkgs/nix-unit/flake-module.nix ./lib/flake-module.nix ]; }); diff --git a/pkgs/clan-cli/shell.nix b/pkgs/clan-cli/shell.nix index fb7735c96..d3c658e8b 100644 --- a/pkgs/clan-cli/shell.nix +++ b/pkgs/clan-cli/shell.nix @@ -15,7 +15,7 @@ in pkgs.mkShell { packages = [ pkgs.ruff - self.inputs.nix-unit.packages.${pkgs.system}.nix-unit + self.packages.${pkgs.system}.nix-unit pythonWithDeps ]; # sets up an editable install and add enty points to $PATH diff --git a/pkgs/nix-unit/default.nix b/pkgs/nix-unit/default.nix new file mode 100644 index 000000000..58f8b051f --- /dev/null +++ b/pkgs/nix-unit/default.nix @@ -0,0 +1,45 @@ +{ stdenv +, lib +, nixVersions +, fetchFromGitHub +, nlohmann_json +, boost +, bear +, meson +, pkg-config +, ninja +, cmake +, clang-tools +}: + +stdenv.mkDerivation { + pname = "nix-unit"; + version = "0.1"; + src = fetchFromGitHub { + owner = "adisbladis"; + repo = "nix-unit"; + rev = "a9d6f33e50d4dcd9cfc0c92253340437bbae282b"; + sha256 = "sha256-PCXQAQt8+i2pkUym9P1JY4JGoeZJLzzxWBhprHDdItM="; + }; + buildInputs = [ + nlohmann_json + nixVersions.unstable + boost + ]; + nativeBuildInputs = [ + bear + meson + pkg-config + ninja + # nlohmann_json can be only discovered via cmake files + cmake + ] ++ (lib.optional stdenv.cc.isClang [ bear clang-tools ]); + + meta = { + description = "Nix unit test runner"; + homepage = "https://github.com/adisbladis/nix-unit"; + license = lib.licenses.gpl3; + maintainers = with lib.maintainers; [ adisbladis ]; + platforms = lib.platforms.unix; + }; +} diff --git a/pkgs/nix-unit/flake-module.nix b/pkgs/nix-unit/flake-module.nix new file mode 100644 index 000000000..dfc25395a --- /dev/null +++ b/pkgs/nix-unit/flake-module.nix @@ -0,0 +1,5 @@ +{ + perSystem = { pkgs, ... }: { + packages.nix-unit = pkgs.callPackage ./default.nix { }; + }; +}