move nix package definition directly into fork

This commit is contained in:
778a69cd 2023-08-03 16:59:12 +02:00
parent 11c1590cac
commit e046a6ef16
5 changed files with 10617 additions and 3 deletions

164
default.nix Normal file
View file

@ -0,0 +1,164 @@
{ lib
, beam
, callPackage
, writeShellScriptBin
, writeText
, yarn2nix
, mix2nix
, fetchFromGitLab
, fetchFromGitHub
, fetchgit
, fetchurl
, git
, cmake
, nixosTests
, src
}:
let
beamPackages = beam.packages.erlangR25.extend (self: super: {
elixir = super.elixir_1_14;
});
inherit (beamPackages) mixRelease buildMix buildRebar3 fetchHex;
in
mixRelease rec {
pname = "mobilizon";
version = "3.1.0";
inherit src;
# See https://github.com/whitfin/cachex/issues/205
# This circumvents a startup error for now
stripDebug = false;
compileFlags = [ "--no-validate-compile-env" ];
nativeBuildInputs = [ git cmake ];
mixNixDeps = import ./mix.nix {
inherit beamPackages lib;
overrides = (final: prev:
(lib.mapAttrs
(_: value: value.override {
appConfigPath = src + "/config";
})
prev) // {
fast_html = prev.fast_html.override {
nativeBuildInputs = [ cmake ];
};
ex_cldr = prev.ex_cldr.overrideAttrs (old: {
version = "2.37.1";
preBuild = "touch config/prod.exs";
# We have to use the GitHub sources, as it otherwise tries to download
# the locales at build time.
src = fetchFromGitHub {
owner = "erictapen";
repo = "cldr";
rev = "7b293aa9f27e58a5168bb134aad9309043b0f431";
sha256 = "sha256-WJbj18TarCc4tEpvehFUbmeLaof7gmx+j5A0iJlpHRg=";
};
postInstall = ''
cp $src/priv/cldr/locales/* $out/lib/erlang/lib/ex_cldr-${old.version}/priv/cldr/locales/
'';
});
ex_cldr_currencies = prev.ex_cldr_currencies.override {
preBuild = "touch config/prod.exs";
};
ex_cldr_numbers = prev.ex_cldr_numbers.override {
preBuild = "touch config/prod.exs";
};
ex_cldr_dates_times = prev.ex_cldr_dates_times.override {
preBuild = "touch config/prod.exs";
};
ex_cldr_plugs = prev.ex_cldr_plugs.override {
preBuild = "touch config/prod.exs";
};
# Upstream issue: https://github.com/bryanjos/geo_postgis/pull/87
geo_postgis = prev.geo_postgis.overrideAttrs (old: {
propagatedBuildInputs = old.propagatedBuildInputs ++ [ final.ecto ];
});
# The remainder are Git dependencies (and their deps) that are not supported by mix2nix currently.
web_push_encryption = buildMix rec {
name = "web_push_encryption";
version = "0.3.1";
src = fetchFromGitHub {
owner = "danhper";
repo = "elixir-web-push-encryption";
rev = "70f00d06cbd88c9ac382e0ad2539e54448e9d8da";
sha256 = "sha256-b4ZMrt/8n2sPUFtCDRTwXS1qWm5VlYdbx8qC0R0boOA=";
};
beamDeps = with final; [ httpoison jose ];
};
icalendar = buildMix rec {
name = "icalendar";
version = "unstable-2022-04-10";
src = fetchFromGitHub {
owner = "tcitworld";
repo = name;
rev = "1033d922c82a7223db0ec138e2316557b70ff49f";
sha256 = "sha256-N3bJZznNazLewHS4c2B7LP1lgxd1wev+EWVlQ7rOwfU=";
};
beamDeps = with final; [ mix_test_watch ex_doc timex ];
};
erlport = buildRebar3 rec {
name = "erlport";
version = "0.10.1-compat";
src = fetchFromGitHub {
owner = "tcitworld";
repo = name;
rev = "04bcfd732fa458735001328b44e8b3a1764316a5";
sha256 = "sha256-VzGnhHeD5zC+HyUt41FJfLH7Q7I9fJzfcqxTv7uLKnI=";
};
};
rajska = buildMix rec {
name = "rajska";
version = "1.3.3";
src = fetchFromGitHub {
owner = "tcitworld";
repo = name;
rev = "0c036448e261e8be6a512581c592fadf48982d84";
sha256 = "sha256-4pfply1vTAIT2Xvm3kONmrCK05xKfXFvcb8EKoSCXBE=";
};
beamDeps = with final; [ ex_doc credo absinthe excoveralls hammer mock ];
};
exkismet = buildMix rec {
name = "exkismet";
version = "0.0.3";
src = fetchFromGitHub {
owner = "tcitworld";
repo = name;
rev = "8b5485fde00fafbde20f315bec387a77f7358334";
sha256 = "sha256-ttgCWoBKU7VTjZJBhZNtqVF4kN7psBr/qOeR65MbTqw=";
};
beamDeps = with final; [ httpoison ex_doc credo doctor dialyxir ];
};
});
};
preConfigure = ''
export LANG=C.UTF-8 # fix elixir locale warning
'';
# Install the compiled js part
preBuild =
let
js = callPackage ./js/js.nix { mobilizon-src = src; };
in
''
cp -a "${js}/libexec/mobilizon/deps/priv/static" ./priv
chmod 770 -R ./priv
'';
postBuild = ''
mix phx.digest --no-deps-check
'';
meta = with lib; {
description = "Mobilizon is an online tool to help manage your events, your profiles and your groups";
homepage = "https://joinmobilizon.org/";
license = licenses.agpl3Plus;
maintainers = with maintainers; [ minijackson erictapen ];
};
}

View file

@ -3,11 +3,13 @@
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
outputs = { self, nixpkgs }: { outputs = { self, nixpkgs }: let
pkgs = import nixpkgs { system = "x86_64-linux"; };
in {
packages.x86_64-linux.hello = nixpkgs.legacyPackages.x86_64-linux.hello; packages.x86_64-linux.mobilizon = pkgs.callPackage ./. { };
packages.x86_64-linux.default = self.packages.x86_64-linux.hello; packages.x86_64-linux.default = self.packages.x86_64-linux.mobilizon;
devShells.x86_64-linux.default = let devShells.x86_64-linux.default = let
pkgs = import nixpkgs { system = "x86_64-linux"; }; pkgs = import nixpkgs { system = "x86_64-linux"; };

34
js/js.nix Normal file
View file

@ -0,0 +1,34 @@
{ lib, applyPatches, yarn, mkYarnPackage, imagemagick, mobilizon-src }:
mkYarnPackage rec {
src = applyPatches {
name = "mobilizon-js-src";
src = "${mobilizon-src}/js";
};
packageJSON = ./package.json;
yarnLock = ./yarn.lock;
yarnNix = ./yarn.nix;
buildPhase = ''
runHook preBuild
# Tests cannot find the functions of the testing framework
rm -r ./deps/mobilizon/tests
yarn run build
runHook postBuild
'';
# doCheck = true;
# checkPhase = "yarn test:unit";
nativeBuildInputs = [ imagemagick ];
meta = with lib; {
description = "Frontend for the Mobilizon server";
homepage = "https://joinmobilizon.org/";
license = licenses.agpl3Plus;
maintainers = with maintainers; [ minijackson erictapen ];
};
}

8413
js/yarn.nix Normal file

File diff suppressed because it is too large Load diff

2001
mix.nix Normal file

File diff suppressed because it is too large Load diff