From 189b9cf8cb285c800df182b5c312ce6927b5b1c5 Mon Sep 17 00:00:00 2001 From: efim Date: Thu, 14 Oct 2021 23:47:59 +0300 Subject: [PATCH] [nix] explicit pypi-deps-db flake input This change will allow for easier fix of the situation when python dependencies of the project get updated to version that's not available in current version of "pypi-deps-db", and also not yet propagated to "mach-nix-src" repo This way "nix flake lock --update-input pypi-deps-db" will take latest commit of the db, and it will be used as input for "mach-nix-src" locally --- flake.lock | 13 ++++++++----- flake.nix | 36 +++++++++++++++++++++++------------- 2 files changed, 31 insertions(+), 18 deletions(-) diff --git a/flake.lock b/flake.lock index 6df60a8c8..c0fe4d3a0 100644 --- a/flake.lock +++ b/flake.lock @@ -50,7 +50,9 @@ "inputs": { "flake-utils": "flake-utils_2", "nixpkgs": "nixpkgs", - "pypi-deps-db": "pypi-deps-db" + "pypi-deps-db": [ + "pypi-deps-db" + ] }, "locked": { "lastModified": 1629464241, @@ -99,11 +101,11 @@ "pypi-deps-db": { "flake": false, "locked": { - "lastModified": 1622970040, - "narHash": "sha256-u//RFnae/XMIhoy83G2uH2Qu/1LiUhVCdwwY1xj4Ufs=", + "lastModified": 1634243405, + "narHash": "sha256-mopV8eg7VChFcdS0V74wpyWLXBpl5E4zPaKHq/CcgUQ=", "owner": "DavHau", "repo": "pypi-deps-db", - "rev": "be6591698c67a86a69c81fef72167e38d038a9fc", + "rev": "c00afed61c57a09ba931c4dc264195570db4e943", "type": "github" }, "original": { @@ -117,7 +119,8 @@ "flake-compat": "flake-compat", "flake-utils": "flake-utils", "mach-nix-src": "mach-nix-src", - "nixpkgs": "nixpkgs_2" + "nixpkgs": "nixpkgs_2", + "pypi-deps-db": "pypi-deps-db" } } }, diff --git a/flake.nix b/flake.nix index 21a1439bb..eb51e02eb 100644 --- a/flake.nix +++ b/flake.nix @@ -3,16 +3,20 @@ inputs = { nixpkgs.url = "github:NixOS/nixpkgs"; - mach-nix-src.url = "github:DavHau/mach-nix"; flake-utils.url = "github:numtide/flake-utils"; + pypi-deps-db = { + url = "github:DavHau/pypi-deps-db"; + flake = false; + }; + mach-nix-src.url = "github:DavHau/mach-nix"; + mach-nix-src.inputs.pypi-deps-db.follows = "pypi-deps-db"; + flake-compat = { + url = "github:edolstra/flake-compat"; + flake = false; + }; }; - inputs.flake-compat = { - url = "github:edolstra/flake-compat"; - flake = false; - }; - - outputs = { self, nixpkgs, flake-utils, mach-nix-src, ... }: + outputs = { self, nixpkgs, flake-utils, mach-nix-src, pypi-deps-db, ... }: let # TODO : for some reason `nix flake show` results in error: # ```error: a 'aarch64-darwin' with features {} is required to build '/nix/store/s79ixgs3xy250x1b9vyy90g7dzd6bsh4-conda-channels.json.drv', @@ -25,8 +29,14 @@ nixpkgs.lib.genAttrs supportedSystems (system: f system); python = "python38"; - pypiDataRev = "18250538b9eeb9484c4e3bdf135bc1f3a2ccd949"; - pypiDataSha256 = "01hdjy5rpcjm92fyp8n6lci773rgbsa81h2n08r49zjhk9michrb"; + + # if updating python dependencies results in error + # "The given requirements might contain package versions which are not yet part of the dependency DB" + # then + # run `nix flake lock --update-input pypi-deps-db` to set lock file to most recent pypi-deps-db + pypiDataRev = pypi-deps-db.rev; + pypiDataSha256 = pypi-deps-db.narHash; + # pypiDataSha256 = "1k66qyivkv6bhhpmddj2sw0i8mcq4fzrsnp6b3rlv7g5a0n1dbdf"; requirements = builtins.readFile ./requirements.txt; nixpkgsFor = forAllSystems ( @@ -56,10 +66,10 @@ } ); dev-python = - mach-nix.mkPython { - inherit python; - requirements = requirements; - }; + mach-nix.mkPython { + inherit python; + requirements = requirements; + }; }; packages = forAllSystems ( system: