mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-30 02:42:59 +00:00
1862813d11
This is done with the following bash script: ``` #!/usr/bin/env bash process_line() { local filename=${1%:} if [[ $4 =~ \"(.*)\"\; ]]; then local sha256="${BASH_REMATCH[1]}" fi [[ -z $sha256 ]] && return 0 local hash=$(nix hash to-sri --type sha256 $sha256) echo "Processing: $filename" echo " $sha256 => $hash" sed -i "s|cargoSha256 = \"$sha256\"|cargoHash = \"$hash\"|" $filename } # split output by line grep -r 'cargoSha256 = ' . | while IFS= read -r line; do # split them further by space read -r -a parts <<< "$line" process_line "${parts[@]}" done ```
32 lines
791 B
Nix
32 lines
791 B
Nix
{ lib
|
|
, fetchFromGitHub
|
|
, rustPlatform
|
|
}:
|
|
|
|
rustPlatform.buildRustPackage rec {
|
|
pname = "licensor";
|
|
version = "unstable-2021-02-03";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "raftario";
|
|
repo = pname;
|
|
rev = "1897882a708ec6ed65a9569ae0e07d6ea576c652";
|
|
sha256 = "0x0lkfrj7jka0p6nx6i9syz0bnzya5z9np9cw09zm1c9njv9mm32";
|
|
};
|
|
|
|
cargoHash = "sha256-gEOMOb2VRx0cFnzmfKBh9W1FoI4Nr7/PW4GQnldoxsA=";
|
|
|
|
# https://github.com/raftario/licensor/issues/67
|
|
postPatch = ''
|
|
sed "/Copyright (c) 2021/s/2021/$(date +%Y)/" -i tests/integration.rs
|
|
'';
|
|
|
|
meta = with lib; {
|
|
description = "Write licenses to stdout";
|
|
homepage = "https://github.com/raftario/licensor";
|
|
license = licenses.mit;
|
|
maintainers = with maintainers; [ Br1ght0ne ];
|
|
mainProgram = "licensor";
|
|
};
|
|
}
|