mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-21 23:01:05 +00:00
feat(nix): set VERGEN_* build env vars (#1375)
This commit is contained in:
parent
4257b95e8d
commit
bb29e238b5
2 changed files with 9 additions and 7 deletions
10
flake.nix
10
flake.nix
|
|
@ -27,15 +27,13 @@
|
|||
(system:
|
||||
let
|
||||
pkgs = import nixpkgs { inherit system overlays; };
|
||||
versionSuffix = "pre${
|
||||
builtins.substring 0 8
|
||||
(self.lastModifiedDate or self.lastModified or "19700101")
|
||||
}_${self.shortRev or "dirty"}";
|
||||
rev = self.shortRev or "dirty";
|
||||
date = (self.lastModifiedDate or self.lastModified or "19700101");
|
||||
version = (builtins.fromTOML
|
||||
(builtins.readFile ./yazi-fm/Cargo.toml)).package.version
|
||||
+ versionSuffix;
|
||||
+ "pre${builtins.substring 0 8 date}_${rev}";
|
||||
|
||||
yazi-unwrapped = pkgs.callPackage ./nix/yazi-unwrapped.nix { inherit version; };
|
||||
yazi-unwrapped = pkgs.callPackage ./nix/yazi-unwrapped.nix { inherit version rev date; };
|
||||
yazi = pkgs.callPackage ./nix/yazi.nix { inherit yazi-unwrapped; };
|
||||
in
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
{ makeRustPlatform
|
||||
, rustToolchain
|
||||
, version ? "git"
|
||||
, rev
|
||||
, date
|
||||
, lib
|
||||
|
||||
, installShellFiles
|
||||
|
|
@ -12,7 +14,7 @@
|
|||
|
||||
(makeRustPlatform { cargo = rustToolchain; rustc = rustToolchain; }).buildRustPackage rec {
|
||||
pname = "yazi";
|
||||
inherit version;
|
||||
inherit version rev;
|
||||
|
||||
src = ../.;
|
||||
|
||||
|
|
@ -24,6 +26,8 @@
|
|||
};
|
||||
|
||||
env.YAZI_GEN_COMPLETIONS = true;
|
||||
env.VERGEN_GIT_SHA = rev;
|
||||
env.VERGEN_BUILD_DATE = builtins.concatStringsSep "-" (builtins.match "(.{4})(.{2})(.{2}).*" date);
|
||||
|
||||
nativeBuildInputs = [ installShellFiles imagemagick ];
|
||||
buildInputs = lib.optionals stdenv.isDarwin (
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue