Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update nix flake to remove deprecation warning #113

Merged
merged 2 commits into from
Feb 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
coverage.out
dist/
doc/public/

coverage.out
result
12 changes: 7 additions & 5 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/23.11";
flake-utils.url = "github:numtide/flake-utils";
flake-utils.inputs.nixpkgs.follows = "nixpkgs";
};

outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
let
pkgs = import nixpkgs {
system = system;
};
xc = pkgs.callPackage ./xc.nix {};
xc = pkgs.callPackage ./xc.nix { };
in
{
defaultPackage = xc;
packages = {
packages = {
xc = xc;
};
devShells = {
Expand Down
4 changes: 2 additions & 2 deletions update-nix.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ sed -e "s/__VERSION__/$(git describe --tags --abbrev=0)/g" xc.nix.tmpl > xc.nix
# We first try to build and it fails with hash mismatch, and we use it to populate sha256.
nix-build -E 'with import <nixpkgs> { }; callPackage ./xc.nix { }'
SRC_SHA256="$(nix-build -E 'with import <nixpkgs> { }; callPackage ./xc.nix { }' 2>&1 | grep -oE 'got:\s+sha256-\S+' | cut -d "-" -f 2)"
sed -i -e "s|sha256 = lib.fakeSha256;|sha256 = \"$SRC_SHA256\";|g" xc.nix
sed -i -e "s|sha256 = \"\";|sha256 = \"$SRC_SHA256\";|g" xc.nix

# We try again to build and it fails with hash mismatch, and we use it to populate vendorSha256.
VENDOR_SHA256="$(nix-build -E 'with import <nixpkgs> { }; callPackage ./xc.nix { }' 2>&1 | grep -oE 'got:\s+sha256-\S+' | cut -d "-" -f 2)"
sed -i -e "s|vendorSha256 = lib.fakeSha256;|vendorSha256 = \"$VENDOR_SHA256\";|g" xc.nix
sed -i -e "s|vendorHash = \"\";|vendorHash = \"sha256-$VENDOR_SHA256\";|g" xc.nix

6 changes: 3 additions & 3 deletions xc.nix
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{ config, lib, pkgs, fetchFromGitHub, ... }:
{ config, pkgs, fetchFromGitHub, ... }:

pkgs.buildGoModule rec {
pname = "xc";
version = "v0.8.0";
subPackages = ["cmd/xc"];
subPackages = [ "cmd/xc" ];
src = pkgs.fetchFromGitHub {
owner = "joerdav";
repo = "xc";
rev = version;
sha256 = "vTyCS85xbJnAgbasWD6LFxij9EezzlJ1pyvCJptqmOU=";
};
vendorSha256 = "EbIuktQ2rExa2DawyCamTrKRC1yXXMleRB8/pcKFY5c=";
vendorHash = "sha256-EbIuktQ2rExa2DawyCamTrKRC1yXXMleRB8/pcKFY5c=";
}
8 changes: 4 additions & 4 deletions xc.nix.tmpl
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{ config, lib, pkgs, fetchFromGitHub, ... }:
{ config, pkgs, fetchFromGitHub, ... }:

pkgs.buildGoModule rec {
pname = "xc";
version = "__VERSION__";
subPackages = ["cmd/xc"];
subPackages = [ "cmd/xc" ];
src = pkgs.fetchFromGitHub {
owner = "joerdav";
repo = "xc";
rev = version;
sha256 = lib.fakeSha256;
sha256 = "";
};
vendorSha256 = lib.fakeSha256;
vendorHash = "";
}
Loading