fdb820602b
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
95 lines
2.7 KiB
Nix
95 lines
2.7 KiB
Nix
{
|
|
stdenv,
|
|
lib,
|
|
fetchurl,
|
|
testers,
|
|
installShellFiles,
|
|
}:
|
|
|
|
# this expression is mostly automated, and you are STRONGLY
|
|
# RECOMMENDED to use to nix-update for updating this expression when new
|
|
# releases come out, which runs the sibling `update.sh` script.
|
|
#
|
|
# from the root of the nixpkgs git repository, run:
|
|
#
|
|
# nix-shell maintainers/scripts/update.nix \
|
|
# --arg commit true \
|
|
# --argstr package infisical
|
|
|
|
let
|
|
# build hashes, which correspond to the hashes of the precompiled binaries procured by GitHub Actions.
|
|
buildHashes = builtins.fromJSON (builtins.readFile ./hashes.json);
|
|
|
|
# the version of infisical
|
|
version = "0.41.90";
|
|
|
|
# the platform-specific, statically linked binary
|
|
src =
|
|
let
|
|
suffix =
|
|
{
|
|
# map the platform name to the golang toolchain suffix
|
|
# NOTE: must be synchronized with update.sh!
|
|
x86_64-linux = "linux_amd64";
|
|
aarch64-linux = "linux_arm64";
|
|
aarch64-darwin = "darwin_arm64";
|
|
}
|
|
."${stdenv.hostPlatform.system}" or (throw "Unsupported system: ${stdenv.hostPlatform.system}");
|
|
|
|
name = "infisical_${version}_${suffix}.tar.gz";
|
|
hash = buildHashes."${stdenv.hostPlatform.system}";
|
|
url = "https://github.com/Infisical/infisical/releases/download/infisical-cli%2Fv${version}/${name}";
|
|
in
|
|
fetchurl { inherit name url hash; };
|
|
|
|
in
|
|
stdenv.mkDerivation (finalAttrs: {
|
|
pname = "infisical";
|
|
version = version;
|
|
inherit src;
|
|
|
|
nativeBuildInputs = [ installShellFiles ];
|
|
|
|
doCheck = true;
|
|
dontConfigure = true;
|
|
dontStrip = true;
|
|
|
|
sourceRoot = ".";
|
|
buildPhase = "chmod +x ./infisical";
|
|
checkPhase = "./infisical --version";
|
|
installPhase = ''
|
|
mkdir -p $out/bin/ $out/share/completions/ $out/share/man/
|
|
cp infisical $out/bin
|
|
cp completions/* $out/share/completions/
|
|
cp manpages/* $out/share/man/
|
|
'';
|
|
postInstall = ''
|
|
installManPage share/man/infisical.1.gz
|
|
installShellCompletion share/completions/infisical.{bash,fish,zsh}
|
|
'';
|
|
|
|
passthru = {
|
|
updateScript = ./update.sh;
|
|
tests.version = testers.testVersion { package = finalAttrs.finalPackage; };
|
|
};
|
|
|
|
meta = {
|
|
description = "Official Infisical CLI";
|
|
longDescription = ''
|
|
Infisical is the open-source secret management platform:
|
|
Sync secrets across your team/infrastructure and prevent secret leaks.
|
|
'';
|
|
homepage = "https://infisical.com";
|
|
changelog = "https://github.com/infisical/infisical/releases/tag/infisical-cli%2Fv${version}";
|
|
license = lib.licenses.mit;
|
|
mainProgram = "infisical";
|
|
maintainers = with lib.maintainers; [ hausken ];
|
|
teams = [ lib.teams.infisical ];
|
|
platforms = [
|
|
"x86_64-linux"
|
|
"aarch64-linux"
|
|
"aarch64-darwin"
|
|
];
|
|
};
|
|
})
|