Skip to content

Commit 22a5818

Browse files
authored
Merge pull request #1962 from sgillespie/fix/set-git-rev
Nix: Fix wrong git revision in version
2 parents 9e9ec55 + b6a024c commit 22a5818

1 file changed

Lines changed: 26 additions & 22 deletions

File tree

flake.nix

Lines changed: 26 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -63,21 +63,18 @@
6363
inherit (project.hsPkgs.cardano-cli.components.exes) cardano-cli;
6464
})
6565

66-
(final: prev:
67-
let
68-
profiled = project.profiled.exes;
69-
in {
70-
# The cardano-db-sync NixOS module (nix/nixos/cardano-db-sync-service.nix)
71-
# expects these to be here
72-
inherit (project.exes)
73-
cardano-db-sync
74-
cardano-db-tool
75-
cardano-smash-server;
66+
(final: prev: {
67+
# The cardano-db-sync NixOS module (nix/nixos/cardano-db-sync-service.nix)
68+
# expects these to be here
69+
inherit (exes)
70+
cardano-db-sync
71+
cardano-db-tool
72+
cardano-smash-server;
7673

77-
cardano-db-sync-profiled = profiled.cardano-db-sync;
78-
cardano-smash-server-profiled = profiled.cardano-smash-server;
74+
cardano-db-sync-profiled = profiledExes.cardano-db-sync;
75+
cardano-smash-server-profiled = profiledExes.cardano-smash-server;
7976

80-
schema = ./schema;
77+
schema = ./schema;
8178
})
8279

8380
(final: prev: {
@@ -112,6 +109,7 @@
112109
];
113110
};
114111

112+
115113
# Set up and start Postgres before running database tests
116114
preCheck = ''
117115
echo pre-check
@@ -380,6 +378,17 @@
380378
})
381379
];
382380

381+
setGitRev = nixpkgs.setGitRev (self.rev or "dirty");
382+
383+
setGitRevs = exes:
384+
with nixpkgs.lib; pipe exes [
385+
(filterAttrs (_: isDerivation))
386+
(mapAttrs (_: setGitRev))
387+
];
388+
389+
exes = setGitRevs project.exes;
390+
profiledExes = setGitRevs project.profiled.exes;
391+
383392
staticChecks =
384393
let
385394
inherit (project.args) src compiler-nix-name;
@@ -395,10 +404,7 @@
395404
let
396405
mkDist = platform: project:
397406
let
398-
exes = with lib; pipe project.exes [
399-
(collect isDerivation)
400-
(map setGitRev)
401-
];
407+
exeVals = builtins.attrValues exes;
402408
name = "cardano-db-sync-${version}-${platform}";
403409
version = project.exes.cardano-db-sync.identifier.version;
404410
env = {
@@ -415,7 +421,7 @@
415421
--no-clobber \
416422
--remove-destination \
417423
--verbose \
418-
${lib.concatMapStringsSep " " (exe: "${exe}/bin/*") exes} \
424+
${lib.concatMapStringsSep " " (exe: "${exe}/bin/*") exeVals} \
419425
./bin
420426
421427
# Copy magrations to intermediate dir
@@ -433,7 +439,7 @@
433439
(platform == "macos")
434440
(lib.concatMapStrings
435441
(exe: "rewrite-libs . ${exe}/bin/*")
436-
exes)}
442+
exeVals)}
437443
438444
# Package distribution
439445
dist_file=${name}.tar.gz
@@ -481,8 +487,6 @@
481487
else
482488
drv;
483489

484-
setGitRev = nixpkgs.setGitRev (self.rev or "dirty");
485-
486490
in rec {
487491
checks = staticChecks;
488492

@@ -523,7 +527,7 @@
523527
cardano-smash-server-docker
524528
project;
525529

526-
default = flake.packages."cardano-db-sync:exe:cardano-db-sync";
530+
default = exes.cardano-db-sync;
527531
} // lib.optionalAttrs (system == "x86_64-darwin") {
528532
inherit cardano-db-sync-macos;
529533
} // {

0 commit comments

Comments
 (0)