From a1eb8e06c42bf15e916a83180fc0d62c5a86fd37 Mon Sep 17 00:00:00 2001 From: sinanmohd Date: Tue, 3 Sep 2024 08:32:27 +0530 Subject: flake/inputs: add nix --- flake.lock | 144 +++++++++++++++++++++++++++++++++++++++++++++++++++++ flake.nix | 26 ++++++++-- package.nix | 2 + python-package.nix | 2 + 4 files changed, 169 insertions(+), 5 deletions(-) diff --git a/flake.lock b/flake.lock index 81623d6..eca34ac 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,116 @@ { "nodes": { + "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1696426674, + "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-parts": { + "inputs": { + "nixpkgs-lib": [ + "nix", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1719994518, + "narHash": "sha256-pQMhCCHyQGRzdfAkdJ4cIWiw+JNuWsTX7f0ZYSyz0VY=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "9227223f6d922fee3c7b190b2cc238a99527bbb7", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "git-hooks-nix": { + "inputs": { + "flake-compat": [ + "nix" + ], + "gitignore": [ + "nix" + ], + "nixpkgs": [ + "nix", + "nixpkgs" + ], + "nixpkgs-stable": [ + "nix", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1721042469, + "narHash": "sha256-6FPUl7HVtvRHCCBQne7Ylp4p+dpP3P/OYuzjztZ4s70=", + "owner": "cachix", + "repo": "git-hooks.nix", + "rev": "f451c19376071a90d8c58ab1a953c6e9840527fd", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "git-hooks.nix", + "type": "github" + } + }, + "libgit2": { + "flake": false, + "locked": { + "lastModified": 1715853528, + "narHash": "sha256-J2rCxTecyLbbDdsyBWn9w7r3pbKRMkI9E7RvRgAqBdY=", + "owner": "libgit2", + "repo": "libgit2", + "rev": "36f7e21ad757a3dacc58cf7944329da6bc1d6e96", + "type": "github" + }, + "original": { + "owner": "libgit2", + "ref": "v1.8.1", + "repo": "libgit2", + "type": "github" + } + }, + "nix": { + "inputs": { + "flake-compat": "flake-compat", + "flake-parts": "flake-parts", + "git-hooks-nix": "git-hooks-nix", + "libgit2": "libgit2", + "nixpkgs": [ + "nixpkgs" + ], + "nixpkgs-23-11": "nixpkgs-23-11", + "nixpkgs-regression": "nixpkgs-regression" + }, + "locked": { + "lastModified": 1725279604, + "narHash": "sha256-Pp8VveOTKfqxW0tYukaq/f6+cyDYH+GWlAYajDbNaMw=", + "owner": "NixOS", + "repo": "nix", + "rev": "ef1ac0d1175ce4d27742314861cddb39ea520a8f", + "type": "github" + }, + "original": { + "owner": "NixOS", + "repo": "nix", + "type": "github" + } + }, "nixpkgs": { "locked": { "lastModified": 1722421184, @@ -16,8 +127,41 @@ "type": "github" } }, + "nixpkgs-23-11": { + "locked": { + "lastModified": 1717159533, + "narHash": "sha256-oamiKNfr2MS6yH64rUn99mIZjc45nGJlj9eGth/3Xuw=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "a62e6edd6d5e1fa0329b8653c801147986f8d446", + "type": "github" + }, + "original": { + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "a62e6edd6d5e1fa0329b8653c801147986f8d446", + "type": "github" + } + }, + "nixpkgs-regression": { + "locked": { + "lastModified": 1643052045, + "narHash": "sha256-uGJ0VXIhWKGXxkeNnq4TvV3CIOkUJ3PAoLZ3HMzNVMw=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2", + "type": "github" + }, + "original": { + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2", + "type": "github" + } + }, "root": { "inputs": { + "nix": "nix", "nixpkgs": "nixpkgs" } } diff --git a/flake.nix b/flake.nix index 1cf206c..409947c 100644 --- a/flake.nix +++ b/flake.nix @@ -1,10 +1,21 @@ { description = "A Nix build Scheduler"; - inputs.nixpkgs.url = "github:NixOs/nixpkgs/nixos-unstable"; + inputs = { + nixpkgs.url = "github:NixOs/nixpkgs/nixos-unstable"; + + nix = { + url = "github:NixOS/nix"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + }; outputs = - { self, nixpkgs }: + { + self, + nixpkgs, + nix, + }: let lib = nixpkgs.lib; @@ -49,19 +60,24 @@ packages = forAllSystems ( { system, pkgs }: + let + nixPkg = nix.packages.${system}.nix; + in { default = self.packages.${system}.evanix; - evanix = pkgs.callPackage ./package.nix { }; + evanix = pkgs.callPackage ./package.nix { nix = nixPkg; }; evanix-asan = self.packages.${system}.evanix.overrideAttrs ( _: previousAttrs: { mesonFlags = previousAttrs.mesonFlags ++ [ (lib.mesonOption "b_sanitize" "address") ]; } ); - evanix-py = pkgs.python3Packages.callPackage ./python-package.nix { }; + evanix-py = pkgs.python3Packages.callPackage ./python-package.nix { nix = nixPkg; }; pythonWithEvanix = let - wrapper = pkgs.python3.withPackages (ps: [ (ps.callPackage ./python-package.nix { }) ]); + wrapper = pkgs.python3.withPackages (ps: [ + (ps.callPackage ./python-package.nix { nix = nixPkg; }) + ]); in wrapper.overrideAttrs (oldAttrs: { makeWrapperArgs = oldAttrs.makeWrapperArgs or [ ] ++ [ diff --git a/package.nix b/package.nix index 8e35901..ed3f38d 100644 --- a/package.nix +++ b/package.nix @@ -10,6 +10,7 @@ stdenv, uthash, sqlite, + nix, }: stdenv.mkDerivation (finalAttrs: { name = "evanix"; @@ -35,6 +36,7 @@ stdenv.mkDerivation (finalAttrs: { makeWrapper ]; buildInputs = [ + nix cjson highs uthash diff --git a/python-package.nix b/python-package.nix index 4a1d170..68cb4f1 100644 --- a/python-package.nix +++ b/python-package.nix @@ -9,6 +9,7 @@ highs, uthash, sqlite, + nix, }: buildPythonPackage { @@ -39,6 +40,7 @@ buildPythonPackage { makeWrapper ]; buildInputs = [ + nix cjson highs uthash -- cgit v1.2.3