/ flake.nix
flake.nix
1 { 2 description = "Atlassian CLI"; 3 4 inputs = { 5 nixpkgs.url = "github:NixOS/nixpkgs"; 6 }; 7 8 outputs = {self, nixpkgs, ...}: 9 let 10 supportedSystems = [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ]; 11 12 forAllSystems = nixpkgs.lib.genAttrs supportedSystems; 13 14 nixpkgsFor = forAllSystems (system: import nixpkgs { inherit system; }); 15 in { 16 packages = forAllSystems (system: 17 let 18 pkgs = nixpkgsFor.${system}; 19 downloadPathPartArchitecture = { 20 "x86_64-linux" = "linux_amd64"; 21 "x86_64-darwin" = "darwin_amd64"; 22 "aarch64-linux" = "linux_arm64"; 23 "aarch64-darwin" = "darwin_arm64"; 24 }."${system}"; 25 downloadPathPartOs = { 26 "x86_64-linux" = "linux"; 27 "x86_64-darwin" = "darwin"; 28 "aarch64-linux" = "linux"; 29 "aarch64-darwin" = "darwin"; 30 }."${system}"; 31 checksum = { 32 "x86_64-linux" = "sha256-O4c426w3jszp7sVignU8d9QD7zQONWd7NjkK2VQWe80="; 33 "x86_64-darwin" = "sha256-Og87J6jKDnLXaKp15QyVKLeLWjKw5Pm3kVcI/JkVdnk="; 34 "aarch64-linux" = "sha256-WDO+YwaTeEZG/Yt0L3DiRBh/FNZfgJXlF3aGR3LorRI="; 35 "aarch64-darwin" = "sha256-SF3zJ0Q/varFTUYDucEUR5dX/qYPECNgdaHlJAtSOAA="; 36 }."${system}"; 37 in rec { 38 default = pkgs.stdenv.mkDerivation rec { 39 name = "acli-${version}"; 40 version = "1.3.2"; 41 42 src = pkgs.fetchzip { 43 url = "https://acli.atlassian.com/${downloadPathPartOs}/${version}-stable/acli_${version}-stable_${downloadPathPartArchitecture}.tar.gz"; 44 stripRoot = true; 45 sha256 = checksum; 46 }; 47 48 sourceRoot = "./source"; 49 50 dontFixup = true; 51 52 installPhase = '' 53 runHook preInstall 54 install -m755 -D acli $out/bin/acli 55 runHook postInstall 56 ''; 57 58 meta = with pkgs.lib; { 59 homepage = "https://developer.atlassian.com/cloud/acli/guides/introduction/"; 60 description = "Atlassian CLI"; 61 platforms = platforms.linux ++ platforms.darwin; 62 }; 63 }; 64 } 65 ); 66 apps = forAllSystems (system: 67 { 68 default = { 69 type = "app"; 70 program = "${self.packages."${system}".default}/bin/acli"; 71 }; 72 } 73 ); 74 }; 75 }