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