Skip to content

Nix: Fix wrong git revision in version #1962

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
48 changes: 26 additions & 22 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -59,21 +59,18 @@
inherit (project.hsPkgs.cardano-cli.components.exes) cardano-cli;
})

(final: prev:
let
profiled = project.profiled.exes;
in {
# The cardano-db-sync NixOS module (nix/nixos/cardano-db-sync-service.nix)
# expects these to be here
inherit (project.exes)
cardano-db-sync
cardano-db-tool
cardano-smash-server;
(final: prev: {
# The cardano-db-sync NixOS module (nix/nixos/cardano-db-sync-service.nix)
# expects these to be here
inherit (exes)
cardano-db-sync
cardano-db-tool
cardano-smash-server;

cardano-db-sync-profiled = profiled.cardano-db-sync;
cardano-smash-server-profiled = profiled.cardano-smash-server;
cardano-db-sync-profiled = profiledExes.cardano-db-sync;
cardano-smash-server-profiled = profiledExes.cardano-smash-server;

schema = ./schema;
schema = ./schema;
})

(final: prev: {
Expand Down Expand Up @@ -110,6 +107,7 @@
];
};


# Set up and start Postgres before running database tests
preCheck = ''
echo pre-check
Expand Down Expand Up @@ -384,6 +382,17 @@
})
];

setGitRev = nixpkgs.setGitRev (self.rev or "dirty");

setGitRevs = exes:
with nixpkgs.lib; pipe exes [
(filterAttrs (_: isDerivation))
(mapAttrs (_: setGitRev))
];

exes = setGitRevs project.exes;
profiledExes = setGitRevs project.profiled.exes;

staticChecks =
let
inherit (project.args) src compiler-nix-name;
Expand All @@ -399,10 +408,7 @@
let
mkDist = platform: project:
let
exes = with lib; pipe project.exes [
(collect isDerivation)
(map setGitRev)
];
exeVals = builtins.attrValues exes;
name = "cardano-db-sync-${version}-${platform}";
version = project.exes.cardano-db-sync.identifier.version;
env = {
Expand All @@ -419,7 +425,7 @@
--no-clobber \
--remove-destination \
--verbose \
${lib.concatMapStringsSep " " (exe: "${exe}/bin/*") exes} \
${lib.concatMapStringsSep " " (exe: "${exe}/bin/*") exeVals} \
./bin

# Copy magrations to intermediate dir
Expand All @@ -436,7 +442,7 @@
(platform == "macos")
(lib.concatMapStrings
(exe: "rewrite-libs . ${exe}/bin/*")
exes)}
exeVals)}

# Package distribution
dist_file=${name}.tar.gz
Expand Down Expand Up @@ -484,8 +490,6 @@
else
drv;

setGitRev = nixpkgs.setGitRev (self.rev or "dirty");

in rec {
checks = staticChecks;

Expand Down Expand Up @@ -515,7 +519,7 @@
cardano-smash-server-docker
project;

default = flake.packages."cardano-db-sync:exe:cardano-db-sync";
default = exes.cardano-db-sync;
} // lib.optionalAttrs (system == "x86_64-darwin") {
inherit cardano-db-sync-macos;
} // {
Expand Down
Loading