Skip to content

Commit 08f82fc

Browse files
committed
fix: Update setGitRev to work with multi home-unit support
1 parent 03ca8f1 commit 08f82fc

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

flake.nix

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -355,15 +355,6 @@
355355
# Collect local package `exe`s
356356
nixpkgs.haskell-nix.haskellLib.projectOverlays.projectComponents
357357

358-
# Add git revision to `exe`s
359-
(final: prev: {
360-
hsPkgs = final.pkgs.setGitRevForPaths (self.rev or "dirty") [
361-
"cardano-db-sync.components.exes.cardano-db-sync"
362-
"cardano-smash-server.components.exes.cardano-smash-server"
363-
"cardano-db-tool.components.exes.cardano-db-tool"
364-
] prev.hsPkgs;
365-
})
366-
367358
(final: prev: {
368359
profiled = final.appendModule {
369360
modules = [{
@@ -393,7 +384,10 @@
393384
let
394385
mkDist = platform: project:
395386
let
396-
exes = lib.collect lib.isDerivation project.exes;
387+
exes = with lib; pipe project.exes [
388+
(collect isDerivation)
389+
(map setGitRev)
390+
];
397391
name = "cardano-db-sync-${version}-${platform}";
398392
version = project.exes.cardano-db-sync.identifier.version;
399393
env = {
@@ -460,6 +454,14 @@
460454
nonRequiredMacOSPaths
461455
else [];
462456

457+
exeSetGitRev = drvKey: drv:
458+
if nixpkgs.lib.hasInfix ":exe:" drvKey then
459+
setGitRev drv
460+
else
461+
drv;
462+
463+
setGitRev = nixpkgs.setGitRev (self.rev or "dirty");
464+
463465
in rec {
464466
checks = staticChecks;
465467

@@ -494,7 +496,8 @@
494496
inherit cardano-db-sync-macos;
495497
} // {
496498
inherit cardano-smash-server-no-basic-auth profiled;
497-
};
499+
# Run setGitRev on all packages that have ":exe:" in their key
500+
} // builtins.mapAttrs exeSetGitRev flake.packages;
498501
})) // {
499502
nixosModules = {
500503
cardano-db-sync = { pkgs, lib, ... }: {

0 commit comments

Comments
 (0)