Switching to lzebulon's packages

belenios
Lyes Saadi 2026-03-22 19:09:17 +01:00
parent 8ffb2cee36
commit 1509b60542
No known key found for this signature in database
GPG Key ID: 55A1D803917CF39A
11 changed files with 177 additions and 122 deletions

View File

@ -1,20 +0,0 @@
Copyright (c) 2003-2026 Eelco Dolstra and the Nixpkgs/NixOS contributors
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@ -1,110 +1,28 @@
{
buildNpmPackage,
fetchFromGitLab,
importNpmLock,
lib,
libsodium,
makeWrapper,
nodePackages,
ocaml-ng,
ocamlPackages,
belenios-server,
belenios-tool
}:
let
ocamlPackages = ocaml-ng.ocamlPackages_4_14;
in
ocamlPackages.buildDunePackage rec {
pname = "belenios";
version = "3.0";
# solves warnings 'patchelf: wrong ELF type'
dontFixup = true;
src = fetchFromGitLab {
domain = "gitlab.inria.fr";
owner = "belenios";
repo = "belenios";
owner = pname;
repo = pname;
rev = version;
hash = "sha256-paTkzWB2QiBfFnGfiMkTIHdKeg37PTGbMu25JLJc38U=";
};
nativeBuildInputs = with ocamlPackages; [
odoc
];
nativeBuildInputs =
[
libsodium
nodePackages.nodejs
]
++ (with ocamlPackages; [
atdgen
js_of_ocaml
menhir
ocaml_gettext
]);
buildInputs =
[ makeWrapper ]
++ (with ocamlPackages; [
atdgen
calendar
cmdliner
csv
cohttp-lwt-unix
cryptokit
eliom
gettext-camomile
hex
js_of_ocaml
js_of_ocaml-lwt
js_of_ocaml-ppx
js_of_ocaml-tyxml
ocamlnet
ocsipersist-sqlite-config
sodium
xml-light
yojson
]);
frontend = buildNpmPackage {
pname = "belenios-frontend";
inherit version;
src = "${src}/frontend";
npmFlags = [ "--include=dev" ];
npmDeps = importNpmLock {
npmRoot = "${src}/frontend";
packageLock = lib.importJSON ./package-lock.json;
};
inherit (importNpmLock) npmConfigHook;
dontBuild = true;
};
buildPhase = ''
dune build --release
pushd frontend
ln -s ${frontend}/lib/node_modules/belenios-responsive-booth/node_modules .
(cd booth && npx webpack --config webpack.config.js --mode production)
export NODE_PATH="$PWD/node_modules"
node ./bundle-css.js ../src/web/static/responsive_site.css > site.bundle.css
node ./bundle-css.js booth/app.css > booth/app.bundle.css
popd
'';
installPhase = ''
dune install --prefix $out
pushd frontend
DEST=$out/share/belenios-server
mkdir -p $DEST/static/frontend/{booth,translations}
cp *.bundle.css "$DEST/static"
cp -r booth/dist/bundle.js booth/app.bundle.css "$DEST/static/frontend/booth/"
cp -r booth/vote.html "$DEST/apps/"
cp -r translations/* "$DEST/static/frontend/translations/"
popd
'';
meta = {
description = "Verifiable online voting system";
homepage = "https://www.belenios.org/";
changelog = "https://gitlab.inria.fr/belenios/belenios/-/blob/${src.rev}/CHANGES.md";
license = lib.licenses.agpl3Plus;
# maintainers = with lib.maintainers; [ kiara ];
mainProgram = "belenios";
};
buildInputs = [
belenios-server
belenios-tool
];
}

View File

@ -0,0 +1,29 @@
{
belenios,
belenios-platform,
ocamlPackages,
}:
ocamlPackages.buildDunePackage {
pname = "belenios-lib";
inherit (belenios) version src;
nativeBuildInputs = with ocamlPackages; [
atdgen
];
propagatedBuildInputs =
[
belenios-platform
]
++ (with ocamlPackages; [
atdgen
base64
hex
ocaml_gettext
re
uri
yojson
]);
}

View File

@ -0,0 +1,23 @@
{
belenios,
belenios-platform,
ocamlPackages,
}:
ocamlPackages.buildDunePackage {
pname = "belenios-platform-js";
inherit (belenios) version src;
nativeBuildInputs = with ocamlPackages; [
odoc
];
propagatedBuildInputs =
[
belenios-platform
]
++ (with ocamlPackages; [
js_of_ocaml
js_of_ocaml-ppx
]);
}

View File

@ -0,0 +1,24 @@
{
belenios,
belenios-platform,
ocamlPackages,
libsodium
}:
ocamlPackages.buildDunePackage {
pname = "belenios-platform-native";
inherit (belenios) version src;
nativeBuildInputs = with ocamlPackages; [
odoc
];
propagatedBuildInputs =
[
belenios-platform
libsodium
]
++ (with ocamlPackages; [
cryptokit
]);
}

View File

@ -0,0 +1,13 @@
{
belenios,
ocamlPackages,
}:
ocamlPackages.buildDunePackage {
pname = "belenios-platform";
inherit (belenios) version src;
nativeBuildInputs = with ocamlPackages; [
odoc
];
}

View File

@ -0,0 +1,37 @@
{
belenios,
belenios-lib,
belenios-platform-native,
belenios-platform-js,
ocsipersist-sqlite-config,
ocamlPackages,
}:
ocamlPackages.buildDunePackage {
pname = "belenios-server";
inherit (belenios) version src;
nativeBuildInputs = with ocamlPackages; [
atdgen
js_of_ocaml-compiler
menhir
ocaml_gettext
];
propagatedBuildInputs =
[
belenios-lib
belenios-platform-native
belenios-platform-js
ocsipersist-sqlite-config
]
++ (with ocamlPackages; [
calendar
csv
(eliom.override {ocsipersist = ocsipersist ;})
gettext-camomile
lwt
ocamlnet
]);
}

View File

@ -3,7 +3,7 @@
let
cfg = config.services.belenios;
configFile = lib.writeText "beleniosserver.conf" cfg.config;
configFile = pkgs.writeText "beleniosserver.conf" cfg.config;
inherit (lib) mkEnableOption mkPackageOption mkOption mkIf;
in
@ -11,10 +11,10 @@ in
options.services.belenios = {
enable = mkEnableOption "Whether to enable the Belenios Web server.";
package = mkPackageOption pkgs "belenios";
package = mkPackageOption pkgs "belenios" {};
config = mkOption {
types = lib.types.str;
type = lib.types.str;
description = ''
The Belenios Web server configuration.
See
@ -124,7 +124,6 @@ in
</ocsigen>
'';
#
};
};

View File

@ -0,0 +1,23 @@
{
belenios,
belenios-lib,
belenios-platform,
belenios-platform-native,
ocamlPackages
}:
ocamlPackages.buildDunePackage {
pname = "belenios-tool";
inherit (belenios) version src;
propagatedBuildInputs =
[
belenios-lib
belenios-platform
belenios-platform-native
]
++ (with ocamlPackages; [
cmdliner
cohttp-lwt-unix
]);
}

View File

@ -9,7 +9,7 @@
# Import local packages
nixpkgs.overlays = [
(final: prev: {
local = import ./pkgs.nix { pkgs = final; };
local = import ./packages.nix { pkgs = final; };
})
];
}

View File

@ -1,5 +1,14 @@
{ pkgs ? import <nixpkgs> { } }:
{
belenios = pkgs.callPackage ./belenios {};
let
ocamlPackages = pkgs.ocaml-ng.ocamlPackages_4_14;
in
rec {
belenios = pkgs.callPackage ./belenios { inherit ocamlPackages belenios-server belenios-tool; };
belenios-lib = pkgs.callPackage ./belenios/belenios-lib.nix { inherit belenios ocamlPackages belenios-platform; };
belenios-tool = pkgs.callPackage ./belenios/belenios-tool.nix { inherit belenios ocamlPackages belenios-lib belenios-platform belenios-platform-native; };
belenios-server = pkgs.callPackage ./belenios/belenios-server.nix { inherit belenios ocamlPackages belenios-lib belenios-platform-native belenios-platform-js; };
belenios-platform = pkgs.callPackage ./belenios/belenios-platform.nix { inherit belenios ocamlPackages; };
belenios-platform-native = pkgs.callPackage ./belenios/belenios-platform-native.nix { inherit belenios ocamlPackages belenios-platform; };
belenios-platform-js = pkgs.callPackage ./belenios/belenios-platform-js.nix { inherit belenios ocamlPackages belenios-platform; };
}