nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 130 lines 2.8 kB view raw
1{ 2 stdenv, 3 lib, 4 fetchFromGitHub, 5 bundlerEnv, 6 nixosTests, 7 ruby_3_4, 8 pdfium-binaries, 9 makeWrapper, 10 bundler, 11 fetchYarnDeps, 12 yarn, 13 yarnConfigHook, 14 nodejs, 15}: 16 17stdenv.mkDerivation (finalAttrs: { 18 pname = "docuseal"; 19 version = "2.2.0"; 20 21 bundler = bundler.override { ruby = ruby_3_4; }; 22 23 src = fetchFromGitHub { 24 owner = "docusealco"; 25 repo = "docuseal"; 26 tag = finalAttrs.version; 27 hash = "sha256-QKGIcLdyIeYcHXA3TRv7PS9V2mok3Y8UOuqCdnCpNfM="; 28 # https://github.com/docusealco/docuseal/issues/505#issuecomment-3153802333 29 postFetch = "rm $out/db/schema.rb"; 30 }; 31 32 rubyEnv = bundlerEnv { 33 name = "docuseal-gems"; 34 ruby = ruby_3_4; 35 inherit (finalAttrs) bundler; 36 gemdir = ./.; 37 }; 38 39 docusealWeb = stdenv.mkDerivation { 40 pname = "docuseal-web"; 41 inherit (finalAttrs) 42 version 43 src 44 meta 45 ; 46 47 offlineCache = fetchYarnDeps { 48 inherit (finalAttrs) src; 49 hash = "sha256-WypnmgUbt+qlJivg1oWX6dabD/1o0H6c3ODcv+S5Ptw="; 50 }; 51 52 nativeBuildInputs = [ 53 yarn 54 yarnConfigHook 55 nodejs 56 finalAttrs.rubyEnv 57 ]; 58 59 RAILS_ENV = "production"; 60 NODE_ENV = "production"; 61 62 # no idea how to patch ./bin/shakapacker. instead we execute the two bundle exec commands manually 63 buildPhase = '' 64 runHook preBuild 65 66 export HOME=$(mktemp -d) 67 68 bundle exec rails assets:precompile 69 bundle exec rails shakapacker:compile 70 71 runHook postBuild 72 ''; 73 74 installPhase = '' 75 runHook preInstall 76 77 cp -r public/packs $out 78 79 runHook postInstall 80 ''; 81 }; 82 83 buildInputs = [ finalAttrs.rubyEnv ]; 84 propagatedBuildInputs = [ finalAttrs.rubyEnv.wrappedRuby ]; 85 nativeBuildInputs = [ 86 makeWrapper 87 ]; 88 89 RAILS_ENV = "production"; 90 BUNDLE_WITHOUT = "development:test"; 91 92 installPhase = '' 93 runHook preInstall 94 95 mkdir -p $out/public/packs 96 cp -r ${finalAttrs.src}/* $out 97 cp -r ${finalAttrs.docusealWeb}/* $out/public/packs 98 99 bundle exec bootsnap precompile --gemfile app/ lib/ 100 101 runHook postInstall 102 ''; 103 104 # create empty folder which are needed, but never used 105 postInstall = '' 106 chmod +w $out/tmp/ 107 mkdir -p $out/tmp/{cache,sockets} 108 ''; 109 110 postFixup = '' 111 wrapProgram $out/bin/rails \ 112 --prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath [ pdfium-binaries ]}" 113 ''; 114 115 passthru = { 116 tests = { 117 inherit (nixosTests) docuseal-psql docuseal-sqlite; 118 }; 119 updateScript = ./update.sh; 120 }; 121 122 meta = { 123 description = "Open source tool for creating, filling and signing digital documents"; 124 homepage = "https://www.docuseal.co/"; 125 license = lib.licenses.agpl3Only; 126 maintainers = with lib.maintainers; [ stunkymonkey ]; 127 platforms = lib.platforms.unix; 128 broken = stdenv.hostPlatform.isDarwin; 129 }; 130})