Compare commits
2 Commits
91fdc07d18
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 9de5daa2ad | |||
| 7fd9daa5d1 |
@@ -5,7 +5,7 @@
|
|||||||
};
|
};
|
||||||
services.dawarich = {
|
services.dawarich = {
|
||||||
enable = true;
|
enable = true;
|
||||||
package = pkgs.dawarich.overrideAttrs (old: {
|
package = (pkgs.callPackage ./dawarich/package.nix { }).overrideAttrs (old: {
|
||||||
# https://github.com/Freika/dawarich/issues/1469
|
# https://github.com/Freika/dawarich/issues/1469
|
||||||
postInstall = (old.postInstall or "") + ''
|
postInstall = (old.postInstall or "") + ''
|
||||||
cp ${./dawarich_smtp_config.rb} $out/config/initializers/smtp_settings.rb
|
cp ${./dawarich_smtp_config.rb} $out/config/initializers/smtp_settings.rb
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
diff --git a/Gemfile.lock b/Gemfile.lock
|
||||||
|
index d45a7657..d0a7b750 100644
|
||||||
|
--- a/Gemfile.lock
|
||||||
|
+++ b/Gemfile.lock
|
||||||
|
@@ -172,12 +172,7 @@ GEM
|
||||||
|
railties (>= 6.1.0)
|
||||||
|
fakeredis (0.1.4)
|
||||||
|
ffaker (2.25.0)
|
||||||
|
- ffi (1.17.2-aarch64-linux-gnu)
|
||||||
|
- ffi (1.17.2-arm-linux-gnu)
|
||||||
|
- ffi (1.17.2-arm64-darwin)
|
||||||
|
- ffi (1.17.2-x86-linux-gnu)
|
||||||
|
- ffi (1.17.2-x86_64-darwin)
|
||||||
|
- ffi (1.17.2-x86_64-linux-gnu)
|
||||||
|
+ ffi (1.17.2)
|
||||||
|
foreman (0.90.0)
|
||||||
|
thor (~> 1.4)
|
||||||
|
fugit (1.11.1)
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
diff --git a/Gemfile b/Gemfile
|
||||||
|
index 36cf0d9c..fc914849 100644
|
||||||
|
--- a/Gemfile
|
||||||
|
+++ b/Gemfile
|
||||||
|
@@ -28,6 +28,7 @@ gem 'omniauth-github', '~> 2.0.0'
|
||||||
|
gem 'omniauth-google-oauth2'
|
||||||
|
gem 'omniauth_openid_connect'
|
||||||
|
gem 'omniauth-rails_csrf_protection'
|
||||||
|
+gem 'openssl'
|
||||||
|
gem 'parallel'
|
||||||
|
gem 'pg'
|
||||||
|
gem 'prometheus_exporter'
|
||||||
|
diff --git a/Gemfile.lock b/Gemfile.lock
|
||||||
|
index a32eb801..b2fc45bc 100644
|
||||||
|
--- a/Gemfile.lock
|
||||||
|
+++ b/Gemfile.lock
|
||||||
|
@@ -348,6 +348,7 @@ GEM
|
||||||
|
tzinfo
|
||||||
|
validate_url
|
||||||
|
webfinger (~> 2.0)
|
||||||
|
+ openssl (3.3.1)
|
||||||
|
optimist (3.2.1)
|
||||||
|
orm_adapter (0.5.0)
|
||||||
|
ostruct (0.6.1)
|
||||||
|
@@ -665,6 +666,7 @@ DEPENDENCIES
|
||||||
|
omniauth-google-oauth2
|
||||||
|
omniauth-rails_csrf_protection
|
||||||
|
omniauth_openid_connect
|
||||||
|
+ openssl
|
||||||
|
parallel
|
||||||
|
pg
|
||||||
|
prometheus_exporter
|
||||||
3400
machines/hippocampus/servers/public/dawarich/gemset.nix
Normal file
3400
machines/hippocampus/servers/public/dawarich/gemset.nix
Normal file
File diff suppressed because it is too large
Load Diff
142
machines/hippocampus/servers/public/dawarich/package.nix
Normal file
142
machines/hippocampus/servers/public/dawarich/package.nix
Normal file
@@ -0,0 +1,142 @@
|
|||||||
|
{
|
||||||
|
lib,
|
||||||
|
applyPatches,
|
||||||
|
bundlerEnv,
|
||||||
|
fetchFromGitHub,
|
||||||
|
fetchNpmDeps,
|
||||||
|
nixosTests,
|
||||||
|
nodejs,
|
||||||
|
npmHooks,
|
||||||
|
ruby_3_4,
|
||||||
|
stdenv,
|
||||||
|
tailwindcss_3,
|
||||||
|
gemset ? import ./gemset.nix,
|
||||||
|
sources ? lib.importJSON ./sources.json,
|
||||||
|
unpatchedSource ? fetchFromGitHub {
|
||||||
|
owner = "Freika";
|
||||||
|
repo = "dawarich";
|
||||||
|
tag = sources.version;
|
||||||
|
inherit (sources) hash;
|
||||||
|
},
|
||||||
|
}:
|
||||||
|
let
|
||||||
|
ruby = ruby_3_4;
|
||||||
|
in
|
||||||
|
stdenv.mkDerivation (finalAttrs: {
|
||||||
|
pname = "dawarich";
|
||||||
|
inherit (sources) version;
|
||||||
|
|
||||||
|
# Use `applyPatches` here because bundix in the update script (see ./update.sh)
|
||||||
|
# needs to run on the already patched Gemfile and Gemfile.lock.
|
||||||
|
# Only patches changing these two files should be here;
|
||||||
|
# patches for other parts of the application should go directly into mkDerivation.
|
||||||
|
src = applyPatches {
|
||||||
|
src = unpatchedSource;
|
||||||
|
patches = [
|
||||||
|
# bundix and bundlerEnv fail with system-specific gems
|
||||||
|
./0001-build-ffi-gem.diff
|
||||||
|
# openssl 3.6.0 breaks ruby openssl gem
|
||||||
|
# See https://github.com/NixOS/nixpkgs/issues/456753
|
||||||
|
# and https://github.com/ruby/openssl/issues/949#issuecomment-3370358680
|
||||||
|
./0002-openssl-hotfix.diff
|
||||||
|
];
|
||||||
|
postPatch = ''
|
||||||
|
substituteInPlace ./Gemfile \
|
||||||
|
--replace-fail "ruby File.read('.ruby-version').strip" "ruby '>= 3.4.0'"
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
postPatch = ''
|
||||||
|
# move import directory to a more convenient place, otherwise its behind systemd private tmp
|
||||||
|
substituteInPlace ./app/services/imports/watcher.rb \
|
||||||
|
--replace-fail 'tmp/imports/watched' 'storage/imports/watched'
|
||||||
|
'';
|
||||||
|
|
||||||
|
dawarichGems = bundlerEnv {
|
||||||
|
name = "${finalAttrs.pname}-gems-${finalAttrs.version}";
|
||||||
|
inherit gemset ruby;
|
||||||
|
inherit (finalAttrs) version;
|
||||||
|
gemdir = finalAttrs.src;
|
||||||
|
};
|
||||||
|
|
||||||
|
npmDeps = fetchNpmDeps {
|
||||||
|
inherit (finalAttrs) src;
|
||||||
|
hash = sources.npmHash;
|
||||||
|
};
|
||||||
|
|
||||||
|
RAILS_ENV = "production";
|
||||||
|
NODE_ENV = "production";
|
||||||
|
REDIS_URL = ""; # build error if not defined
|
||||||
|
TAILWINDCSS_INSTALL_DIR = "${tailwindcss_3}/bin";
|
||||||
|
|
||||||
|
nativeBuildInputs = [
|
||||||
|
nodejs
|
||||||
|
npmHooks.npmConfigHook
|
||||||
|
finalAttrs.dawarichGems
|
||||||
|
finalAttrs.dawarichGems.wrappedRuby
|
||||||
|
];
|
||||||
|
propagatedBuildInputs = [
|
||||||
|
finalAttrs.dawarichGems.wrappedRuby
|
||||||
|
];
|
||||||
|
buildInputs = [
|
||||||
|
finalAttrs.dawarichGems
|
||||||
|
];
|
||||||
|
|
||||||
|
buildPhase = ''
|
||||||
|
runHook preBuild
|
||||||
|
|
||||||
|
patchShebangs bin/
|
||||||
|
for b in $(ls $dawarichGems/bin/)
|
||||||
|
do
|
||||||
|
if [ ! -f bin/$b ]; then
|
||||||
|
ln -s $dawarichGems/bin/$b bin/$b
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
SECRET_KEY_BASE_DUMMY=1 bundle exec rake assets:precompile
|
||||||
|
|
||||||
|
rm -rf node_modules tmp log storage
|
||||||
|
ln -s /var/log/dawarich log
|
||||||
|
ln -s /var/lib/dawarich storage
|
||||||
|
ln -s /tmp tmp
|
||||||
|
|
||||||
|
# delete more files unneeded at runtime
|
||||||
|
rm -rf docker docs screenshots package.json package-lock.json *.md *.example
|
||||||
|
|
||||||
|
runHook postBuild
|
||||||
|
'';
|
||||||
|
|
||||||
|
installPhase = ''
|
||||||
|
runHook preInstall
|
||||||
|
|
||||||
|
# tests are not needed at runtime
|
||||||
|
rm -rf spec e2e
|
||||||
|
# delete artifacts from patching
|
||||||
|
rm *.orig
|
||||||
|
|
||||||
|
mkdir -p $out
|
||||||
|
mv .{ruby*,app_version} $out/
|
||||||
|
mv * $out/
|
||||||
|
|
||||||
|
runHook postInstall
|
||||||
|
'';
|
||||||
|
|
||||||
|
passthru = {
|
||||||
|
tests = {
|
||||||
|
inherit (nixosTests) dawarich;
|
||||||
|
};
|
||||||
|
# run with: nix-shell ./maintainers/scripts/update.nix --argstr package dawarich
|
||||||
|
updateScript = ./update.sh;
|
||||||
|
};
|
||||||
|
|
||||||
|
meta = {
|
||||||
|
changelog = "https://github.com/Freika/dawarich/blob/${finalAttrs.version}/CHANGELOG.md";
|
||||||
|
description = "Self-hostable alternative to Google Location History (Google Maps Timeline)";
|
||||||
|
homepage = "https://dawarich.app/";
|
||||||
|
license = lib.licenses.agpl3Only;
|
||||||
|
maintainers = with lib.maintainers; [
|
||||||
|
diogotcorreia
|
||||||
|
];
|
||||||
|
platforms = lib.platforms.linux;
|
||||||
|
};
|
||||||
|
})
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"version": "1.1.0",
|
||||||
|
"hash": "sha256-oL1XLBaSYCeP+Fn+6BlGMEgCTkwZhT1VZNamrcRXrgI=",
|
||||||
|
"npmHash": "sha256-doBsDBsO7npHs/jyeg4xWzdauWoK6dPe8z+97IP2zxI="
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user