nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 81 lines 2.0 kB view raw
1{ 2 lib, 3 stdenv, 4 bundlerEnv, 5 buildPackages, 6 fetchFromGitHub, 7 makeBinaryWrapper, 8 nixosTests, 9 callPackage, 10}: 11stdenv.mkDerivation ( 12 finalAttrs: 13 let 14 # Use bundlerEnvArgs from passthru to allow overriding bundlerEnv arguments. 15 rubyEnv = bundlerEnv finalAttrs.passthru.bundlerEnvArgs; 16 # We also need a separate nativeRubyEnv to precompile assets on the build 17 # host. If possible, reuse existing rubyEnv derivation. 18 nativeRubyEnv = 19 if stdenv.buildPlatform.canExecute stdenv.hostPlatform then 20 rubyEnv 21 else 22 buildPackages.bundlerEnv finalAttrs.passthru.bundlerEnvArgs; 23 24 bundlerEnvArgs = { 25 name = "${finalAttrs.pname}-${finalAttrs.version}-gems"; 26 gemdir = ./.; 27 }; 28 in 29 { 30 pname = "pghero"; 31 version = "3.6.1"; 32 33 src = fetchFromGitHub { 34 owner = "pghero"; 35 repo = "pghero"; 36 rev = "v${finalAttrs.version}"; 37 hash = "sha256-kABdQRwV5Y/jB9P8kYVmwmntOK0CF/JJYmaINNv26fA="; 38 }; 39 40 strictDeps = true; 41 nativeBuildInputs = [ 42 nativeRubyEnv 43 makeBinaryWrapper 44 ]; 45 46 inherit rubyEnv; 47 48 buildPhase = '' 49 runHook preBuild 50 DATABASE_URL=nulldb:/// RAILS_ENV=production rake assets:precompile 51 runHook postBuild 52 ''; 53 54 installPhase = '' 55 runHook preInstall 56 mkdir -p -- "$out"/{share,bin} 57 cp -a -- . "$out"/share/pghero 58 makeWrapper "$rubyEnv"/bin/puma "$out"/bin/pghero \ 59 --add-flags -C \ 60 --add-flags config/puma.rb \ 61 --chdir "$out"/share/pghero 62 runHook postInstall 63 ''; 64 65 passthru = { 66 inherit bundlerEnvArgs; 67 updateScript = callPackage ./update.nix { }; 68 tests = { 69 inherit (nixosTests) pghero; 70 }; 71 }; 72 73 meta = { 74 homepage = "https://github.com/ankane/pghero"; 75 description = "Performance dashboard for Postgres"; 76 mainProgram = "pghero"; 77 license = lib.licenses.mit; 78 maintainers = [ lib.maintainers.tie ]; 79 }; 80 } 81)