This reverts commit 65a333600d5c88a98d674f637d092807cfc12253. This wasn't tested for correctness with something like fodwatch [0], and should not have been (self-)merged so quickly, especially without further review. It also resulted in the breakage of at least one package [1] (and that's the one we know of and was caught). A few packages that were updated in between this commit and this revert were not reverted back to using `rev`, but other than that, this is a 1:1 revert. [0]: https://codeberg.org/raphaelr/fodwatch [1]: https://github.com/NixOS/nixpkgs/pull/396904 / 758551e4587d75882aebc21a04bee960418f8ce9
		
			
				
	
	
		
			75 lines
		
	
	
		
			1.9 KiB
		
	
	
	
		
			Nix
		
	
	
	
	
	
			
		
		
	
	
			75 lines
		
	
	
		
			1.9 KiB
		
	
	
	
		
			Nix
		
	
	
	
	
	
{
 | 
						|
  stdenv,
 | 
						|
  lib,
 | 
						|
  fetchpatch,
 | 
						|
  rustPlatform,
 | 
						|
  fetchFromGitHub,
 | 
						|
  installShellFiles,
 | 
						|
  makeBinaryWrapper,
 | 
						|
  nix-eval-jobs,
 | 
						|
  nix,
 | 
						|
  colmena,
 | 
						|
  testers,
 | 
						|
}:
 | 
						|
 | 
						|
rustPlatform.buildRustPackage rec {
 | 
						|
  pname = "colmena";
 | 
						|
  version = "0.4.0";
 | 
						|
 | 
						|
  src = fetchFromGitHub {
 | 
						|
    owner = "zhaofengli";
 | 
						|
    repo = "colmena";
 | 
						|
    rev = "v${version}";
 | 
						|
    sha256 = "sha256-01bfuSY4gnshhtqA1EJCw2CMsKkAx+dHS+sEpQ2+EAQ=";
 | 
						|
  };
 | 
						|
 | 
						|
  useFetchCargoVendor = true;
 | 
						|
  cargoHash = "sha256-2OLApLD/04etEeTxv03p0cx8O4O51iGiBQTIG/iOIkU=";
 | 
						|
 | 
						|
  nativeBuildInputs = [
 | 
						|
    installShellFiles
 | 
						|
    makeBinaryWrapper
 | 
						|
  ];
 | 
						|
 | 
						|
  buildInputs = [ nix-eval-jobs ];
 | 
						|
 | 
						|
  NIX_EVAL_JOBS = "${nix-eval-jobs}/bin/nix-eval-jobs";
 | 
						|
 | 
						|
  patches = [
 | 
						|
    # Fixes nix 2.24 compat: https://github.com/zhaofengli/colmena/pull/236
 | 
						|
    (fetchpatch {
 | 
						|
      url = "https://github.com/zhaofengli/colmena/commit/36382ee2bef95983848435065f7422500c7923a8.patch";
 | 
						|
      sha256 = "sha256-5cQ2u3eTzhzjPN+rc6xWIskHNtheVXXvlSeJ1G/lz+E=";
 | 
						|
    })
 | 
						|
  ];
 | 
						|
 | 
						|
  postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
 | 
						|
    installShellCompletion --cmd colmena \
 | 
						|
      --bash <($out/bin/colmena gen-completions bash) \
 | 
						|
      --zsh <($out/bin/colmena gen-completions zsh) \
 | 
						|
      --fish <($out/bin/colmena gen-completions fish)
 | 
						|
 | 
						|
    wrapProgram $out/bin/colmena \
 | 
						|
      --prefix PATH ":" "${lib.makeBinPath [ nix ]}"
 | 
						|
  '';
 | 
						|
 | 
						|
  # Recursive Nix is not stable yet
 | 
						|
  doCheck = false;
 | 
						|
 | 
						|
  passthru = {
 | 
						|
    # We guarantee CLI and Nix API stability for the same minor version
 | 
						|
    apiVersion = builtins.concatStringsSep "." (lib.take 2 (lib.splitVersion version));
 | 
						|
 | 
						|
    tests.version = testers.testVersion { package = colmena; };
 | 
						|
  };
 | 
						|
 | 
						|
  meta = with lib; {
 | 
						|
    description = "Simple, stateless NixOS deployment tool";
 | 
						|
    homepage = "https://colmena.cli.rs/${passthru.apiVersion}";
 | 
						|
    license = licenses.mit;
 | 
						|
    maintainers = with maintainers; [ zhaofengli ];
 | 
						|
    platforms = platforms.linux ++ platforms.darwin;
 | 
						|
    mainProgram = "colmena";
 | 
						|
  };
 | 
						|
}
 |