From 19f7eac1ec285ab9d0b76b4c10e02c2e40dec8be Mon Sep 17 00:00:00 2001 From: SomeoneSerge Date: Wed, 31 Jul 2024 12:57:01 +0000 Subject: .#evanix: make callPackage-able --- flake.nix | 31 +------------------------------ package.nix | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 30 deletions(-) create mode 100644 package.nix diff --git a/flake.nix b/flake.nix index 3505d12..14108d1 100644 --- a/flake.nix +++ b/flake.nix @@ -55,36 +55,7 @@ { system, pkgs }: { default = self.packages.${system}.evanix; - evanix = pkgs.stdenv.mkDerivation (finalAttrs: { - name = "evanix"; - - src = ./.; - nativeBuildInputs = with pkgs; [ - uthash - meson - ninja - pkg-config - makeWrapper - ]; - buildInputs = with pkgs; [ - cjson - highs - ]; - - mesonFlags = [ - (lib.mesonOption "NIX_EVAL_JOBS_PATH" (lib.getExe pkgs.nix-eval-jobs)) - ]; - - meta = { - homepage = "https://git.sinanmohd.com/evanix"; - - license = lib.licenses.gpl3; - platforms = supportedSystems; - mainProgram = "evanix"; - - maintainers = with lib.maintainers; [ sinanmohd ]; - }; - }); + evanix = pkgs.callPackage ./package.nix { }; evanix-py = pkgs.python3Packages.callPackage ./python-package.nix { }; pythonWithEvanix = diff --git a/package.nix b/package.nix new file mode 100644 index 0000000..56561f6 --- /dev/null +++ b/package.nix @@ -0,0 +1,40 @@ +{ + lib, + cjson, + highs, + makeWrapper, + meson, + ninja, + nix-eval-jobs, + pkg-config, + stdenv, + uthash, +}: +stdenv.mkDerivation (finalAttrs: { + name = "evanix"; + + src = ./.; + nativeBuildInputs = [ + uthash + meson + ninja + pkg-config + makeWrapper + ]; + buildInputs = [ + cjson + highs + ]; + + mesonFlags = [ (lib.mesonOption "NIX_EVAL_JOBS_PATH" (lib.getExe nix-eval-jobs)) ]; + + meta = { + homepage = "https://git.sinanmohd.com/evanix"; + + license = lib.licenses.gpl3; + platforms = lib.platforms.all; + mainProgram = "evanix"; + + maintainers = with lib.maintainers; [ sinanmohd ]; + }; +}) -- cgit v1.2.3 From a857029b2bfae6dc64573c035491ce7eb73ed5ac Mon Sep 17 00:00:00 2001 From: SomeoneSerge Date: Wed, 31 Jul 2024 13:03:04 +0000 Subject: .#evanix: remove .nix files from src --- package.nix | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/package.nix b/package.nix index 56561f6..06ff619 100644 --- a/package.nix +++ b/package.nix @@ -13,7 +13,20 @@ stdenv.mkDerivation (finalAttrs: { name = "evanix"; - src = ./.; + src = + let + fs = lib.fileset; + in + fs.toSource { + root = ./.; + fileset = fs.unions [ + ./src + ./tests + ./include + ./meson.build + ./meson_options.txt + ]; + }; nativeBuildInputs = [ uthash meson -- cgit v1.2.3 From 14f4f176b6889ed69a1f2f60ee2464a428d9b3d8 Mon Sep 17 00:00:00 2001 From: SomeoneSerge Date: Wed, 31 Jul 2024 13:05:31 +0000 Subject: .#evanix: use uthash from the hosts platform --- package.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.nix b/package.nix index 06ff619..80f442f 100644 --- a/package.nix +++ b/package.nix @@ -28,7 +28,6 @@ stdenv.mkDerivation (finalAttrs: { ]; }; nativeBuildInputs = [ - uthash meson ninja pkg-config @@ -37,6 +36,7 @@ stdenv.mkDerivation (finalAttrs: { buildInputs = [ cjson highs + uthash ]; mesonFlags = [ (lib.mesonOption "NIX_EVAL_JOBS_PATH" (lib.getExe nix-eval-jobs)) ]; -- cgit v1.2.3 From 8b338aaee0855934ce469498f5615cf22b6c2c04 Mon Sep 17 00:00:00 2001 From: SomeoneSerge Date: Wed, 31 Jul 2024 13:08:54 +0000 Subject: .#devShells: reuse buildInputs from .#evanix --- flake.nix | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/flake.nix b/flake.nix index 14108d1..837785f 100644 --- a/flake.nix +++ b/flake.nix @@ -25,17 +25,8 @@ default = pkgs.mkShell { name = "dev"; - buildInputs = with pkgs; [ - jq - highs - cjson - uthash - nix-eval-jobs - - pkg-config - meson - ninja - + inputsFrom = [ self.packages.${system}.evanix ]; + packages = with pkgs; [ gdb ccls valgrind -- cgit v1.2.3 From 9e459aa2801b3e0ea85e6150c7300be60b306f74 Mon Sep 17 00:00:00 2001 From: SomeoneSerge Date: Wed, 31 Jul 2024 13:13:56 +0000 Subject: .#evanix: run tests --- package.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/package.nix b/package.nix index 80f442f..6fa0b52 100644 --- a/package.nix +++ b/package.nix @@ -39,6 +39,8 @@ stdenv.mkDerivation (finalAttrs: { uthash ]; + doCheck = true; + mesonFlags = [ (lib.mesonOption "NIX_EVAL_JOBS_PATH" (lib.getExe nix-eval-jobs)) ]; meta = { -- cgit v1.2.3