nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 rustPlatform,
4 fetchFromGitHub,
5 pkg-config,
6 installShellFiles,
7 openssl,
8 cachix,
9 versionCheckHook,
10 nix-update-script,
11}:
12rustPlatform.buildRustPackage (finalAttrs: {
13 pname = "omnix";
14 version = "1.3.2";
15
16 src = fetchFromGitHub {
17 owner = "juspay";
18 repo = "omnix";
19 tag = "v${finalAttrs.version}";
20 hash = "sha256-D9rAVsSFooVWpSX//gTcRcmgiAjwZYNRMDIctMmwnho=";
21 };
22
23 cargoHash = "sha256-3zWbhuZzqkxgM0Js3luR6+Yr5/UGn1EoL6OqxPt94JM=";
24
25 nativeBuildInputs = [
26 installShellFiles
27 pkg-config
28 ];
29
30 buildInputs = [
31 openssl
32 ];
33
34 # Note: The ENVs below will have to be kept in sync with <https://github.com/juspay/omnix/blob/main/nix/envs/default.nix>
35 env = {
36 OMNIX_SOURCE = finalAttrs.src;
37 CACHIX_BIN = lib.getExe cachix;
38 OM_INIT_REGISTRY = "path:${finalAttrs.src}/crates/omnix-init/registry";
39 DEVOUR_FLAKE = fetchFromGitHub {
40 owner = "srid";
41 repo = "devour-flake";
42 rev = "9fe4db872c107ea217c13b24527b68d9e4a4c01b";
43 hash = "sha256-R7MHvTh5fskzxNLBe9bher+GQBZ8ZHjz75CPQG3fSRI=";
44 };
45 NIX_SYSTEMS =
46 let
47 x86_64-linux = fetchFromGitHub {
48 owner = "nix-systems";
49 repo = "x86_64-linux";
50 rev = "2ecfcac5e15790ba6ce360ceccddb15ad16d08a8";
51 hash = "sha256-Gtqg8b/v49BFDpDetjclCYXm8mAnTrUzR0JnE2nv5aw=";
52 };
53 aarch64-linux = fetchFromGitHub {
54 owner = "nix-systems";
55 repo = "aarch64-linux";
56 rev = "aa1ce1b64c822dff925d63d3e771113f71ada1bb";
57 hash = "sha256-1Zp7TRYLXj4P5FLhQ8jBChrgAmQxR3iTypmWf9EFTnc=";
58 };
59 x86_64-darwin = fetchFromGitHub {
60 owner = "nix-systems";
61 repo = "x86_64-darwin";
62 rev = "db0463cce4cd60fb791f33a83d29a1ed53edab9b";
63 hash = "sha256-+xT9B1ZbhMg/zpJqd00S06UCZb/A2URW9bqqrZ/JTOg=";
64 };
65 aarch64-darwin = fetchFromGitHub {
66 owner = "nix-systems";
67 repo = "aarch64-darwin";
68 rev = "75e6c6912484d28ebba5769b794ffa4aff653ba2";
69 hash = "sha256-PHVNQ7y0EQYzujQRYoRdb96K0m1KSeAjSrbz2b75S6Q=";
70 };
71 in
72 builtins.toJSON {
73 inherit
74 x86_64-linux
75 aarch64-linux
76 x86_64-darwin
77 aarch64-darwin
78 ;
79 };
80 FALSE_FLAKE = fetchFromGitHub {
81 owner = "boolean-option";
82 repo = "false";
83 rev = "d06b4794a134686c70a1325df88a6e6768c6b212";
84 hash = "sha256-vLy8GQr0noEcoA+jX24FgUVBA/poV36zDWAUChN3hIY=";
85 };
86 TRUE_FLAKE = fetchFromGitHub {
87 owner = "boolean-option";
88 repo = "true";
89 rev = "6ecb49143ca31b140a5273f1575746ba93c3f698";
90 hash = "sha256-L9eyTL7njtPBUYmZRYFKCzQFDgua9U9oE7UwCzjZfl8=";
91 };
92 INSPECT_FLAKE = fetchFromGitHub {
93 owner = "juspay";
94 repo = "inspect";
95 rev = "e82e65949d2ba5283865609b8728c50ebe7573e3";
96 hash = "sha256-GTxRovvYWYn2/LDvjA73YttGuqvtKaOFZfOR9YxtST0=";
97 };
98 DEFAULT_FLAKE_SCHEMAS = "path:${finalAttrs.src}/nix/flake-schemas";
99 FLAKE_METADATA = "path:${finalAttrs.src}/crates/nix_rs/src/flake/functions/metadata";
100 FLAKE_ADDSTRINGCONTEXT = "path:${finalAttrs.src}/crates/nix_rs/src/flake/functions/addstringcontext";
101 };
102
103 # Requires networking and/or nix sandbox disabled
104 doCheck = false;
105
106 postInstall = ''
107 installShellCompletion --cmd om \
108 --bash <($out/bin/om completion bash) \
109 --fish <($out/bin/om completion fish) \
110 --zsh <($out/bin/om completion zsh)
111 '';
112
113 nativeInstallCheckInputs = [
114 versionCheckHook
115 ];
116 versionCheckProgram = "${placeholder "out"}/bin/om";
117 doInstallCheck = true;
118
119 passthru = {
120 updateScript = nix-update-script { };
121 };
122
123 meta = {
124 description = "Nix companion to improve developer experience";
125 homepage = "https://omnix.page";
126 changelog = "https://omnix.page/history.html#${finalAttrs.version}";
127 maintainers = with lib.maintainers; [
128 shivaraj-bh
129 ];
130 license = lib.licenses.agpl3Only;
131 mainProgram = "om";
132 };
133})