mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-10-04 14:00:04 +00:00
To reproduce:
$ nix run nixpkgs/3b32825de172d0bc85664f495edb096b10862524#ast-grep \
-- scan --update-all --inline-rules '
id: nix-x86_64-darwin
language: nix
rule:
any:
- pattern: "\"x86_64-darwin\""
kind: list_expression > string_expression
- pattern:
context: "{ \"x86_64-darwin\" = $EXPR; }"
selector: binding
- pattern:
context: "{ x86_64-darwin = $EXPR; }"
selector: binding
fix:
template: ""
' pkgs
$ nix run nixpkgs/3b32825de172d0bc85664f495edb096b10862524#ast-grep \
-- scan --update-all --inline-rules '
id: json-first-x86_64-darwin
language: json
rule:
kind: object > pair:nth-child(1)
has:
pattern: "\"x86_64-darwin\""
field: key
fix:
template: ""
expandEnd: { regex: "," }
' pkgs
$ nix run nixpkgs/3b32825de172d0bc85664f495edb096b10862524#ast-grep \
-- scan --update-all --inline-rules '
id: json-x86_64-darwin
language: json
rule:
kind: object > pair
has:
pattern: "\"x86_64-darwin\""
field: key
fix:
template: ""
expandStart: { regex: "," }
' pkgs
$ git restore pkgs/by-name/om/omnix/package.nix
$ git diff --name-only -z \
| nix shell nixpkgs/3b32825de172d0bc85664f495edb096b10862524#gnused \
-c xargs -0 sed -i '/^$/N; /^\n\? \+$/d'
$ treefmt
79 lines
2.0 KiB
Nix
79 lines
2.0 KiB
Nix
{
|
|
stdenvNoCC,
|
|
fetchzip,
|
|
autoPatchelfHook,
|
|
installShellFiles,
|
|
makeWrapper,
|
|
lib,
|
|
zlib,
|
|
testers,
|
|
}:
|
|
let
|
|
platform =
|
|
{
|
|
x86_64-linux = "x86_64-pc-linux";
|
|
aarch64-darwin = "arm64-apple-darwin";
|
|
}
|
|
."${stdenvNoCC.system}" or (throw "unsupported system ${stdenvNoCC.hostPlatform.system}");
|
|
hash =
|
|
{
|
|
x86_64-linux = "sha256-SGV0fEuwmGwpqmD42a+x0fIK50RWSHEYDesH4obgRhg=";
|
|
aarch64-darwin = "sha256-qL0hjEdfkN62NDvhlzVgW4TYWv0IReo2Fo5eVhUaOrI=";
|
|
}
|
|
."${stdenvNoCC.system}" or (throw "unsupported system ${stdenvNoCC.hostPlatform.system}");
|
|
in
|
|
stdenvNoCC.mkDerivation (finalAttrs: {
|
|
pname = "bleep";
|
|
version = "0.0.13";
|
|
|
|
src = fetchzip {
|
|
url = "https://github.com/oyvindberg/bleep/releases/download/v${finalAttrs.version}/bleep-${platform}.tar.gz";
|
|
hash = hash;
|
|
};
|
|
|
|
nativeBuildInputs = [
|
|
installShellFiles
|
|
makeWrapper
|
|
]
|
|
++ lib.optional stdenvNoCC.hostPlatform.isLinux autoPatchelfHook;
|
|
|
|
buildInputs = [ zlib ];
|
|
|
|
installPhase = ''
|
|
runHook preInstall
|
|
install -Dm755 bleep -t $out/bin/
|
|
runHook postInstall
|
|
'';
|
|
|
|
dontAutoPatchelf = true;
|
|
|
|
postFixup =
|
|
lib.optionalString stdenvNoCC.hostPlatform.isLinux ''
|
|
autoPatchelf $out
|
|
''
|
|
+ lib.optionalString (stdenvNoCC.buildPlatform.canExecute stdenvNoCC.hostPlatform) ''
|
|
export PATH=$PATH:$out/bin
|
|
installShellCompletion --cmd bleep \
|
|
--bash <(bleep install-tab-completions-bash --stdout) \
|
|
--zsh <(bleep install-tab-completions-zsh --stdout)
|
|
'';
|
|
|
|
passthru.tests.version = testers.testVersion {
|
|
package = finalAttrs.finalPackage;
|
|
command = "bleep --help | sed -n '/Bleeping/s/[^0-9.]//gp'";
|
|
};
|
|
|
|
meta = {
|
|
homepage = "https://bleep.build/";
|
|
sourceProvenance = [ lib.sourceTypes.binaryNativeCode ];
|
|
license = lib.licenses.mit;
|
|
description = "Bleeping fast scala build tool";
|
|
mainProgram = "bleep";
|
|
platforms = [
|
|
"x86_64-linux"
|
|
"aarch64-darwin"
|
|
];
|
|
maintainers = with lib.maintainers; [ kristianan ];
|
|
};
|
|
})
|