Skip to content

Commit

Permalink
nix: only use rev hash if it exists
Browse files Browse the repository at this point in the history
  • Loading branch information
SpiralP committed Dec 31, 2024
1 parent 3bd07e3 commit 6bb5283
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
nodeManifest = lib.importJSON ./package.json;
rustManifest = lib.importTOML ./Cargo.toml;

revSuffix = lib.optionalString (self ? shortRev || self ? dirtyShortRev)
"-${self.shortRev or self.dirtyShortRev}";

makePackage = (system: dev:
let
pkgs = import nixpkgs {
Expand Down Expand Up @@ -48,7 +51,7 @@
rec {
default = pkgs.buildNpmPackage rec {
pname = nodeManifest.name;
version = "${nodeManifest.version}-${self.shortRev or self.dirtyShortRev}";
version = nodeManifest.version + revSuffix;

src = lib.sourceByRegex ./. [
"^\.gitignore$"
Expand Down Expand Up @@ -132,7 +135,7 @@

wasm = pkgs.rustPlatform.buildRustPackage {
pname = "${rustManifest.package.name}-wasm";
version = "${rustManifest.package.version}-${self.shortRev or self.dirtyShortRev}";
version = rustManifest.package.version + revSuffix;

src = lib.sourceByRegex ./. [
"^\.cargo(/.*)?$"
Expand Down

0 comments on commit 6bb5283

Please sign in to comment.