From 5b77e7295fdd4539952ce03626c5315020ce702e Mon Sep 17 00:00:00 2001 From: Jean-Paul Calderone Date: Thu, 13 Jan 2022 14:22:21 -0500 Subject: [PATCH 1/7] add a source for it with niv --- nix/sources.json | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/nix/sources.json b/nix/sources.json index fc5bbbb..d324dd9 100644 --- a/nix/sources.json +++ b/nix/sources.json @@ -11,6 +11,18 @@ "url": "https://github.com/input-output-hk/haskell.nix/archive/f624ca56629d5be438c7d44a721b0c1d944eda23.tar.gz", "url_template": "https://github.com///archive/.tar.gz" }, + "libchallenge_bypass_ristretto_ffi": { + "branch": "master", + "description": "Python bindings for Brave's challenge-bypass-ristretto library", + "homepage": null, + "owner": "leastauthority", + "repo": "python-challenge-bypass-ristretto", + "rev": "v2021.07.12", + "sha256": "16af1qmx7srhvcc936x7hl2bz50hafm39311dbzqam9ms1i5q89j", + "type": "tarball", + "url": "https://github.com/leastauthority/python-challenge-bypass-ristretto/archive/v2021.07.12.tar.gz", + "url_template": "https://github.com///archive/.tar.gz" + }, "niv": { "branch": "master", "description": "Easy dependency management for Nix projects", From 3806636bda674f0eaee8ce9ba67594ad5b011123 Mon Sep 17 00:00:00 2001 From: Jean-Paul Calderone Date: Thu, 13 Jan 2022 14:23:24 -0500 Subject: [PATCH 2/7] use the niv source instead of this other thing --- nix/challenge-bypass-ristretto-repo.nix | 9 --------- nix/challenge-bypass-ristretto.nix | 9 ++++++--- 2 files changed, 6 insertions(+), 12 deletions(-) delete mode 100644 nix/challenge-bypass-ristretto-repo.nix diff --git a/nix/challenge-bypass-ristretto-repo.nix b/nix/challenge-bypass-ristretto-repo.nix deleted file mode 100644 index 1357efe..0000000 --- a/nix/challenge-bypass-ristretto-repo.nix +++ /dev/null @@ -1,9 +0,0 @@ -let - pkgs = import {}; -in - pkgs.fetchFromGitHub { - owner = "LeastAuthority"; - repo = "python-challenge-bypass-ristretto"; - rev = "v2021.07.12"; - sha256 = "16af1qmx7srhvcc936x7hl2bz50hafm39311dbzqam9ms1i5q89j"; - } diff --git a/nix/challenge-bypass-ristretto.nix b/nix/challenge-bypass-ristretto.nix index dc08608..69599b0 100644 --- a/nix/challenge-bypass-ristretto.nix +++ b/nix/challenge-bypass-ristretto.nix @@ -1,6 +1,9 @@ # Provide the ffi bindings to the Rust challenge-bypass-ristretto library. -{ fetchFromGitHub, callPackage }: let - src = import ./challenge-bypass-ristretto-repo.nix; + sources = import ./sources.nix; in - import "${src}/default-challenge-bypass-ristretto-ffi.nix" { } +{ fetchFromGitHub +, callPackage +, libchallenge_bypass_ristretto_ffi_repo ? sources.libchallenge_bypass_ristretto_ffi +}: + import "${libchallenge_bypass_ristretto_ffi_repo}/default-challenge-bypass-ristretto-ffi.nix" { } From 253be207ba1df189fb467919e41ce8fab12cf6b0 Mon Sep 17 00:00:00 2001 From: Jean-Paul Calderone Date: Thu, 13 Jan 2022 14:56:10 -0500 Subject: [PATCH 3/7] update to in-development version of dep that fixes pkg-config --- nix/challenge-bypass-ristretto.nix | 2 +- nix/sources.json | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/nix/challenge-bypass-ristretto.nix b/nix/challenge-bypass-ristretto.nix index 69599b0..e813986 100644 --- a/nix/challenge-bypass-ristretto.nix +++ b/nix/challenge-bypass-ristretto.nix @@ -6,4 +6,4 @@ in , callPackage , libchallenge_bypass_ristretto_ffi_repo ? sources.libchallenge_bypass_ristretto_ffi }: - import "${libchallenge_bypass_ristretto_ffi_repo}/default-challenge-bypass-ristretto-ffi.nix" { } + import "${libchallenge_bypass_ristretto_ffi_repo}/challenge-bypass-ristretto.nix" { } diff --git a/nix/sources.json b/nix/sources.json index d324dd9..00cc440 100644 --- a/nix/sources.json +++ b/nix/sources.json @@ -12,15 +12,15 @@ "url_template": "https://github.com///archive/.tar.gz" }, "libchallenge_bypass_ristretto_ffi": { - "branch": "master", + "branch": "lib-dir-is-lib-dir", "description": "Python bindings for Brave's challenge-bypass-ristretto library", "homepage": null, "owner": "leastauthority", "repo": "python-challenge-bypass-ristretto", - "rev": "v2021.07.12", - "sha256": "16af1qmx7srhvcc936x7hl2bz50hafm39311dbzqam9ms1i5q89j", + "rev": "7c99b67e8731486f1aa0193ac1325f77e7d6338d", + "sha256": "0w5vpq9kqhdbbynbbky1ibx1im5582yacqnb9y2y3h114diywdyq", "type": "tarball", - "url": "https://github.com/leastauthority/python-challenge-bypass-ristretto/archive/v2021.07.12.tar.gz", + "url": "https://github.com/leastauthority/python-challenge-bypass-ristretto/archive/7c99b67e8731486f1aa0193ac1325f77e7d6338d.tar.gz", "url_template": "https://github.com///archive/.tar.gz" }, "niv": { From 12316020721ecccc1e976edd15ac16faeea3b680 Mon Sep 17 00:00:00 2001 From: Jean-Paul Calderone Date: Thu, 13 Jan 2022 15:01:54 -0500 Subject: [PATCH 4/7] update CircleCI caching logic it depended on now-deleted nix source file make it use niv sources instead also drop the NIXPKGS_REV which has been unused for a while --- .circleci/config.yml | 37 +++---------------------------------- 1 file changed, 3 insertions(+), 34 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 691a231..8a0cfda 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -24,46 +24,16 @@ jobs: resource_class: "xlarge" - environment: - # Specify a revision of NixOS/nixpkgs to run against. This essentially - # pins the majority of the software involved in the build. This - # revision is selected arbitrarily. It's somewhat current as of the - # time of this comment. We can bump it to a newer version when that - # makes sense. Meanwhile, the platform won't shift around beneath us - # unexpectedly. - NIXPKGS_REV: "92609f3d9bc3acffbdbe54fa1c591a885612aa73" - steps: - run: name: "Setup Environment Variables" command: | - # Get NIX_PATH set for the rest of the job so that the revision of - # nixpkgs we selected will be used everywhere Nix pulls in software. - # There is no way to set an environment variable containing the - # value of another environment variable on CircleCI except to use - # the `BASH_ENV` feature as we do here. - echo "export NIX_PATH=nixpkgs=https://github.com/NixOS/nixpkgs/archive/$NIXPKGS_REV.tar.gz" >> $BASH_ENV # Set XDG_CONFIG_DIRS to point at the source directory, so that nix # will pickup nix/nix.conf as a configuration file from there. echo "export XDG_CONFIG_DIRS=$CIRCLE_WORKING_DIRECTORY" >> $BASH_ENV # Get *our* source code. - "checkout" - - - "run": - # CircleCI won't let us interpolate NIXPKGS_REV into a cache key. - # Only CircleCI's own environment variables or variables set via the - # web interface in a "context" can be interpolated into cache keys. - # However, we can interpolate the checksum of a file... Since we - # don't care about the exact revision, we just care that a new - # revision gives us a new string, we can write the revision to a - # file and then put the checksum of that file into the cache key. - # This way, we don't have to maintain the nixpkgs revision in two - # places and risk having them desynchronize. - name: "Prepare For Cache Key" - command: | - echo "${NIXPKGS_REV}" > nixpkgs.rev - - restore_cache: # Get all of Nix's state relating to the particular revision of # nixpkgs we're using. It will always be the same. CircleCI @@ -87,9 +57,8 @@ jobs: # If nixpkgs changes then potentially a lot of cached packages for # the base system will be invalidated so we may as well drop them # and make a new cache with the new packages. - - paymentserver-nix-store-v5-{{ checksum "nixpkgs.rev" }}-{{ checksum "nix/challenge-bypass-ristretto-repo.nix" }} - - paymentserver-nix-store-v5-{{ checksum "nixpkgs.rev" }}- - - paymentserver-nix-store-v5- + - paymentserver-nix-store-v6-{{ checksum "nix/sources.json" }} + - paymentserver-nix-store-v6- - run: name: "Building with Nix" @@ -114,7 +83,7 @@ jobs: - save_cache: name: "Cache Nix Store Paths" - key: paymentserver-nix-store-v5-{{ checksum "nixpkgs.rev" }}-{{ checksum "nix/challenge-bypass-ristretto-repo.nix" }} + key: paymentserver-nix-store-v6-{{ checksum "niv/sources.json" }} paths: - "/nix" From 4116dd67e659cf714999cec9ecc039e4ebaf1a84 Mon Sep 17 00:00:00 2001 From: Jean-Paul Calderone Date: Thu, 13 Jan 2022 15:11:37 -0500 Subject: [PATCH 5/7] correct typo in cache key in save_cache step --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 8a0cfda..8c947f7 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -83,7 +83,7 @@ jobs: - save_cache: name: "Cache Nix Store Paths" - key: paymentserver-nix-store-v6-{{ checksum "niv/sources.json" }} + key: paymentserver-nix-store-v6-{{ checksum "nix/sources.json" }} paths: - "/nix" From 22c98686ac6bec8b0b168932ec269835a19e7d18 Mon Sep 17 00:00:00 2001 From: Jean-Paul Calderone Date: Thu, 13 Jan 2022 15:29:27 -0500 Subject: [PATCH 6/7] callPackage to propagate our nixpkgs --- nix/challenge-bypass-ristretto.nix | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/nix/challenge-bypass-ristretto.nix b/nix/challenge-bypass-ristretto.nix index e813986..10bf5e8 100644 --- a/nix/challenge-bypass-ristretto.nix +++ b/nix/challenge-bypass-ristretto.nix @@ -2,8 +2,7 @@ let sources = import ./sources.nix; in -{ fetchFromGitHub -, callPackage +{ callPackage , libchallenge_bypass_ristretto_ffi_repo ? sources.libchallenge_bypass_ristretto_ffi }: - import "${libchallenge_bypass_ristretto_ffi_repo}/challenge-bypass-ristretto.nix" { } + callPackage "${libchallenge_bypass_ristretto_ffi_repo}/challenge-bypass-ristretto.nix" { } From 9232d319b6803c20ae6f02442a0f2f4138c9f3f6 Mon Sep 17 00:00:00 2001 From: Jean-Paul Calderone Date: Thu, 13 Jan 2022 16:19:14 -0500 Subject: [PATCH 7/7] Point at fixed master revision of libchallenge_bypass_ristretto_ffi --- nix/sources.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/nix/sources.json b/nix/sources.json index 00cc440..fd1415e 100644 --- a/nix/sources.json +++ b/nix/sources.json @@ -12,15 +12,15 @@ "url_template": "https://github.com///archive/.tar.gz" }, "libchallenge_bypass_ristretto_ffi": { - "branch": "lib-dir-is-lib-dir", + "branch": "master", "description": "Python bindings for Brave's challenge-bypass-ristretto library", "homepage": null, "owner": "leastauthority", "repo": "python-challenge-bypass-ristretto", - "rev": "7c99b67e8731486f1aa0193ac1325f77e7d6338d", + "rev": "6e25af8a721a9d8507745efad3d15dae75b78909", "sha256": "0w5vpq9kqhdbbynbbky1ibx1im5582yacqnb9y2y3h114diywdyq", "type": "tarball", - "url": "https://github.com/leastauthority/python-challenge-bypass-ristretto/archive/7c99b67e8731486f1aa0193ac1325f77e7d6338d.tar.gz", + "url": "https://github.com/leastauthority/python-challenge-bypass-ristretto/archive/6e25af8a721a9d8507745efad3d15dae75b78909.tar.gz", "url_template": "https://github.com///archive/.tar.gz" }, "niv": {