diff options
author | Someone <else@someonex.net> | 2024-07-31 17:52:43 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-31 17:52:43 +0300 |
commit | 1a20f73b9df803703a567626aa712fadb3ff8f79 (patch) | |
tree | 3f786dbef6e6f7127a3f948110cc0f947e9648dd | |
parent | 72cf8cfcc59f792ff48eb28c3f760678dc10090c (diff) | |
parent | 9e459aa2801b3e0ea85e6150c7300be60b306f74 (diff) |
Merge pull request #13 from sinanmohd/refactor/nix
Refactor nix expressions
-rw-r--r-- | flake.nix | 44 | ||||
-rw-r--r-- | package.nix | 55 |
2 files changed, 58 insertions, 41 deletions
@@ -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 @@ -55,36 +46,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..6fa0b52 --- /dev/null +++ b/package.nix @@ -0,0 +1,55 @@ +{ + lib, + cjson, + highs, + makeWrapper, + meson, + ninja, + nix-eval-jobs, + pkg-config, + stdenv, + uthash, +}: +stdenv.mkDerivation (finalAttrs: { + name = "evanix"; + + src = + let + fs = lib.fileset; + in + fs.toSource { + root = ./.; + fileset = fs.unions [ + ./src + ./tests + ./include + ./meson.build + ./meson_options.txt + ]; + }; + nativeBuildInputs = [ + meson + ninja + pkg-config + makeWrapper + ]; + buildInputs = [ + cjson + highs + uthash + ]; + + doCheck = true; + + 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 ]; + }; +}) |