add latest invidious package
This commit is contained in:
parent
2d2fc539c0
commit
1973e97b99
18
flake.lock
18
flake.lock
|
@ -41,11 +41,11 @@
|
||||||
"nixpkgs": "nixpkgs_2"
|
"nixpkgs": "nixpkgs_2"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1641700429,
|
"lastModified": 1641799033,
|
||||||
"narHash": "sha256-+Pd33S+4+VX6RYGJQ5Q4n46+iRLr9y9ilq9oC/bcnoc=",
|
"narHash": "sha256-f7/p46rC65buVGk7OHb9sxJ+kF1xzs3NUuLZExoqCqY=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "home-manager",
|
"repo": "home-manager",
|
||||||
"rev": "a90ddcd62748e445bbbe01834595eda29dc28db9",
|
"rev": "f3be3cda6a69365f2acecc201b3cd1ee4f6d4614",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -72,11 +72,11 @@
|
||||||
},
|
},
|
||||||
"nixpkgs_2": {
|
"nixpkgs_2": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1641671388,
|
"lastModified": 1641726770,
|
||||||
"narHash": "sha256-aHoO6CpPLJK8hLkPJrpMnCRnj3YbfQZ7HNcXcnI83E0=",
|
"narHash": "sha256-7Wk3V+/gNbQ4/5LgGQz9KVSwSw3V/L3+iqgH8+G/6V0=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "32356ce11b8cc5cc421b68138ae8c730cc8ad4a2",
|
"rev": "27d2fe1e69deb1894f9113a1fe2ca43fb89c8ad1",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -86,11 +86,11 @@
|
||||||
},
|
},
|
||||||
"nixpkgs_3": {
|
"nixpkgs_3": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1641528457,
|
"lastModified": 1641710811,
|
||||||
"narHash": "sha256-FyU9E63n1W7Ql4pMnhW2/rO9OftWZ37pLppn/c1aisY=",
|
"narHash": "sha256-yVJ+CtwWZY8BnkNIJ/ue5a28yrRM6CkDF1LvmGmqqwM=",
|
||||||
"owner": "nixos",
|
"owner": "nixos",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "ff377a78794d412a35245e05428c8f95fef3951f",
|
"rev": "0ecf7d414811f831060cf55707c374d54fbb1dec",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
{ ... }: {
|
{ pkgs, ... }: {
|
||||||
services.invidious = {
|
services.invidious = {
|
||||||
enable = true;
|
enable = true;
|
||||||
port = 3000;
|
port = 3000;
|
||||||
|
package = pkgs.invidious-latest;
|
||||||
settings = {
|
settings = {
|
||||||
full_refresh = true;
|
full_refresh = true;
|
||||||
https_only = true;
|
https_only = true;
|
||||||
|
|
|
@ -1,7 +1,11 @@
|
||||||
{ ... }:
|
{ ... }:
|
||||||
let
|
let
|
||||||
backupUser = "root";
|
backupUser = "root";
|
||||||
backupPaths = [ "/var/lib/postgresql" "/var/lib/vault" ];
|
backupPaths = [
|
||||||
|
"/var/lib/postgresql"
|
||||||
|
"/var/lib/vault"
|
||||||
|
"/var/lib/acme"
|
||||||
|
];
|
||||||
timerConfig = {
|
timerConfig = {
|
||||||
OnBootSec = "1m";
|
OnBootSec = "1m";
|
||||||
OnCalendar = "daily";
|
OnCalendar = "daily";
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
home.dev.all
|
home.dev.all
|
||||||
home.network_manager
|
home.network_manager
|
||||||
home.sway
|
home.sway
|
||||||
#home.reversing
|
home.reversing
|
||||||
home.apps.vivaldi
|
home.apps.vivaldi
|
||||||
home.apps.telegram
|
home.apps.telegram
|
||||||
home.apps.quassel
|
home.apps.quassel
|
||||||
|
|
|
@ -2,4 +2,8 @@ final: prev: {
|
||||||
comic-code = final.callPackage ./comic-code { };
|
comic-code = final.callPackage ./comic-code { };
|
||||||
zar = final.callPackage ./zar { };
|
zar = final.callPackage ./zar { };
|
||||||
gobar = final.callPackage ./gobar { };
|
gobar = final.callPackage ./gobar { };
|
||||||
|
invidious-latest = final.callPackage ./invidious-latest {
|
||||||
|
# needs a specific version of lsquic
|
||||||
|
lsquic = final.callPackage ./invidious-latest/lsquic.nix { };
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
91
overlay/invidious-latest/default.nix
Normal file
91
overlay/invidious-latest/default.nix
Normal file
|
@ -0,0 +1,91 @@
|
||||||
|
{ lib, crystal, fetchFromGitHub, librsvg, pkg-config, libxml2, openssl, sqlite, lsquic, shards }:
|
||||||
|
let
|
||||||
|
# When updating, always update the following:
|
||||||
|
# * the git revision
|
||||||
|
# * the version attribute
|
||||||
|
# * the source hash (sha256)
|
||||||
|
# If the shards.lock file changed, also the following:
|
||||||
|
# * shards.nix (by running `crystal2nix` in invidious’ source tree)
|
||||||
|
# * If the lsquic.cr dependency changed: lsquic in lsquic.nix (version, sha256)
|
||||||
|
# * If the lsquic version changed: boringssl' in lsquic.nix (version, sha256)
|
||||||
|
rev = "d928b9eaadc8298f2e92a766fdd10c79e6048858";
|
||||||
|
in
|
||||||
|
crystal.buildCrystalPackage rec {
|
||||||
|
pname = "invidious";
|
||||||
|
version = "master";
|
||||||
|
|
||||||
|
src = fetchFromGitHub {
|
||||||
|
owner = "iv-org";
|
||||||
|
repo = pname;
|
||||||
|
inherit rev;
|
||||||
|
sha256 = "sha256-WojYv9HMqS3UcZFewgE/svbpqeAY6BIyAtxAMfdn1xk=";
|
||||||
|
};
|
||||||
|
|
||||||
|
postPatch =
|
||||||
|
let
|
||||||
|
# Replacing by the value (templates) of the variables ensures that building
|
||||||
|
# fails if upstream changes the way the metadata is formatted.
|
||||||
|
branchTemplate = ''{{ "#{`git branch | sed -n '/* /s///p'`.strip}" }}'';
|
||||||
|
commitTemplate = ''{{ "#{`git rev-list HEAD --max-count=1 --abbrev-commit`.strip}" }}'';
|
||||||
|
versionTemplate = ''{{ "#{`git log -1 --format=%ci | awk '{print $1}' | sed s/-/./g`.strip}" }}'';
|
||||||
|
# This always uses the latest commit which invalidates the cache even if
|
||||||
|
# the assets were not changed
|
||||||
|
assetCommitTemplate = ''{{ "#{`git rev-list HEAD --max-count=1 --abbrev-commit -- assets`.strip}" }}'';
|
||||||
|
in
|
||||||
|
''
|
||||||
|
# Use the version metadata from the derivation instead of using git at
|
||||||
|
# build-time
|
||||||
|
substituteInPlace src/invidious.cr \
|
||||||
|
--replace ${lib.escapeShellArg branchTemplate} '"master"' \
|
||||||
|
--replace ${lib.escapeShellArg commitTemplate} '"${lib.substring 0 7 rev}"' \
|
||||||
|
--replace ${lib.escapeShellArg versionTemplate} '"${lib.replaceChars ["-"] ["."] (lib.substring 9 10 version)}"' \
|
||||||
|
--replace ${lib.escapeShellArg assetCommitTemplate} '"${lib.substring 0 7 rev}"'
|
||||||
|
|
||||||
|
# Patch the assets and locales paths to be absolute
|
||||||
|
substituteInPlace src/invidious.cr \
|
||||||
|
--replace 'public_folder "assets"' 'public_folder "${placeholder "out"}/share/invidious/assets"'
|
||||||
|
substituteInPlace src/invidious/helpers/i18n.cr \
|
||||||
|
--replace 'File.read("locales/' 'File.read("${placeholder "out"}/share/invidious/locales/'
|
||||||
|
|
||||||
|
# Reference sql initialisation/migration scripts by absolute path
|
||||||
|
substituteInPlace src/invidious/database/base.cr \
|
||||||
|
--replace 'config/sql' '${placeholder "out"}/share/invidious/config/sql'
|
||||||
|
|
||||||
|
substituteInPlace src/invidious/users.cr \
|
||||||
|
--replace 'Process.run(%(rsvg-convert' 'Process.run(%(${lib.getBin librsvg}/bin/rsvg-convert'
|
||||||
|
'';
|
||||||
|
|
||||||
|
# shards required for spectator
|
||||||
|
nativeBuildInputs = [ pkg-config shards ];
|
||||||
|
buildInputs = [ libxml2 openssl sqlite ];
|
||||||
|
|
||||||
|
format = "crystal";
|
||||||
|
shardsFile = ./shards.nix;
|
||||||
|
crystalBinaries.invidious.src = "src/invidious.cr";
|
||||||
|
|
||||||
|
postConfigure = ''
|
||||||
|
# lib includes nix store paths which can’t be patched, so the links have to
|
||||||
|
# be dereferenced first.
|
||||||
|
cp -rL lib lib2
|
||||||
|
rm -r lib
|
||||||
|
mv lib2 lib
|
||||||
|
chmod +w -R lib
|
||||||
|
cp ${lsquic}/lib/liblsquic.a lib/lsquic/src/lsquic/ext
|
||||||
|
'';
|
||||||
|
|
||||||
|
postInstall = ''
|
||||||
|
mkdir -p $out/share/invidious/config
|
||||||
|
|
||||||
|
# Copy static parts
|
||||||
|
cp -r assets locales $out/share/invidious
|
||||||
|
cp -r config/sql $out/share/invidious/config
|
||||||
|
'';
|
||||||
|
|
||||||
|
# Invidious tries to open config/config.yml and connect to the database, even
|
||||||
|
# when running --help. This specifies a minimal configuration in an
|
||||||
|
# environment variable. Even though the database is bogus, --help still
|
||||||
|
# works.
|
||||||
|
installCheckPhase = ''
|
||||||
|
INVIDIOUS_CONFIG="database_url: sqlite3:///dev/null" $out/bin/invidious --help
|
||||||
|
'';
|
||||||
|
}
|
58
overlay/invidious-latest/lsquic.nix
Normal file
58
overlay/invidious-latest/lsquic.nix
Normal file
|
@ -0,0 +1,58 @@
|
||||||
|
{ lib, boringssl, stdenv, fetchgit, fetchFromGitHub, cmake, zlib, perl, libevent }:
|
||||||
|
let
|
||||||
|
# lsquic requires a specific boringssl version (noted in its README)
|
||||||
|
boringssl' = boringssl.overrideAttrs (old: rec {
|
||||||
|
version = "251b5169fd44345f455438312ec4e18ae07fd58c";
|
||||||
|
src = fetchgit {
|
||||||
|
url = "https://boringssl.googlesource.com/boringssl";
|
||||||
|
rev = version;
|
||||||
|
sha256 = "sha256-EU6T9yQCdOLx98Io8o01rEsgxDFF/Xoy42LgPopD2/A=";
|
||||||
|
};
|
||||||
|
});
|
||||||
|
in
|
||||||
|
stdenv.mkDerivation rec {
|
||||||
|
pname = "lsquic";
|
||||||
|
version = "2.18.1";
|
||||||
|
|
||||||
|
src = fetchFromGitHub {
|
||||||
|
owner = "litespeedtech";
|
||||||
|
repo = pname;
|
||||||
|
rev = "v${version}";
|
||||||
|
sha256 = "sha256-hG8cUvhbCNeMOsKkaJlgGpzUrIx47E/WhmPIdI5F3qM=";
|
||||||
|
fetchSubmodules = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
nativeBuildInputs = [ cmake perl ];
|
||||||
|
buildInputs = [ boringssl' libevent zlib ];
|
||||||
|
|
||||||
|
cmakeFlags = [
|
||||||
|
"-DBORINGSSL_DIR=${lib.getDev boringssl'}"
|
||||||
|
"-DBORINGSSL_LIB_crypto=${lib.getLib boringssl'}/lib/libcrypto.a"
|
||||||
|
"-DBORINGSSL_LIB_ssl=${lib.getLib boringssl'}/lib/libssl.a"
|
||||||
|
"-DZLIB_LIB=${zlib}/lib/libz.so"
|
||||||
|
];
|
||||||
|
|
||||||
|
# adapted from lsquic.cr’s Dockerfile
|
||||||
|
# (https://github.com/iv-org/lsquic.cr/blob/master/docker/Dockerfile)
|
||||||
|
installPhase = ''
|
||||||
|
runHook preInstall
|
||||||
|
|
||||||
|
mkdir combinedlib
|
||||||
|
cd combinedlib
|
||||||
|
ar -x ${lib.getLib boringssl'}/lib/libssl.a
|
||||||
|
ar -x ${lib.getLib boringssl'}/lib/libcrypto.a
|
||||||
|
ar -x ../src/liblsquic/liblsquic.a
|
||||||
|
ar rc liblsquic.a *.o
|
||||||
|
ranlib liblsquic.a
|
||||||
|
install -D liblsquic.a $out/lib/liblsquic.a
|
||||||
|
|
||||||
|
runHook postInstall
|
||||||
|
'';
|
||||||
|
|
||||||
|
meta = with lib; {
|
||||||
|
description = "A library for QUIC and HTTP/3 (version for Invidious)";
|
||||||
|
homepage = "https://github.com/litespeedtech/lsquic";
|
||||||
|
maintainers = with maintainers; [ infinisil sbruder ];
|
||||||
|
license = with licenses; [ openssl isc mit bsd3 ]; # statically links against boringssl, so has to include its licenses
|
||||||
|
};
|
||||||
|
}
|
74
overlay/invidious-latest/shards.nix
Normal file
74
overlay/invidious-latest/shards.nix
Normal file
|
@ -0,0 +1,74 @@
|
||||||
|
{
|
||||||
|
athena-negotiation = {
|
||||||
|
owner = "athena-framework";
|
||||||
|
repo = "negotiation";
|
||||||
|
rev = "v0.1.1";
|
||||||
|
sha256 = "1vkk59lqrxb0l8kyzs114i3c18zb2bdiah2xhazkk8q7x6fz4yzk";
|
||||||
|
};
|
||||||
|
backtracer = {
|
||||||
|
owner = "sija";
|
||||||
|
repo = "backtracer.cr";
|
||||||
|
rev = "v1.2.1";
|
||||||
|
sha256 = "02r1l7rn2wsljkx495s5s7j04zgn73m2kx0hkzs7620camvlwbqq";
|
||||||
|
};
|
||||||
|
db = {
|
||||||
|
owner = "crystal-lang";
|
||||||
|
repo = "crystal-db";
|
||||||
|
rev = "v0.10.1";
|
||||||
|
sha256 = "03c5h14z6h2mxnx949lihnyqjd19hcj38iasdwq9fp95h8cld376";
|
||||||
|
};
|
||||||
|
exception_page = {
|
||||||
|
owner = "crystal-loot";
|
||||||
|
repo = "exception_page";
|
||||||
|
rev = "v0.2.0";
|
||||||
|
sha256 = "0nlgnh5iykbr1v2132342k2mz6s2laws6nkgqsqlwhhcr4gb4jcx";
|
||||||
|
};
|
||||||
|
kemal = {
|
||||||
|
owner = "kemalcr";
|
||||||
|
repo = "kemal";
|
||||||
|
rev = "v1.1.0";
|
||||||
|
sha256 = "07vlvddy4mba9li2bvskzqzywwq55cyvlgkz13q6dsl4zfgc96ca";
|
||||||
|
};
|
||||||
|
kilt = {
|
||||||
|
owner = "jeromegn";
|
||||||
|
repo = "kilt";
|
||||||
|
rev = "v0.6.1";
|
||||||
|
sha256 = "0dpc15y9m8c5l9zdfif6jlf7zmkrlm9w4m2igi5xa22fdjwamwfp";
|
||||||
|
};
|
||||||
|
lsquic = {
|
||||||
|
owner = "iv-org";
|
||||||
|
repo = "lsquic.cr";
|
||||||
|
rev = "v2.18.1-2";
|
||||||
|
sha256 = "0bljk0pwbjb813dfwrhgi00w2ai09k868xvak4hfzdkbmpc7id6y";
|
||||||
|
};
|
||||||
|
pg = {
|
||||||
|
owner = "will";
|
||||||
|
repo = "crystal-pg";
|
||||||
|
rev = "v0.24.0";
|
||||||
|
sha256 = "07i5bqkv5j6y6f8v5cpqdxc5wzzrvgv3ds24znv4mzv6nc84csn4";
|
||||||
|
};
|
||||||
|
protodec = {
|
||||||
|
owner = "iv-org";
|
||||||
|
repo = "protodec";
|
||||||
|
rev = "v0.1.4";
|
||||||
|
sha256 = "15azh9izxqgwpgkpicmivfdz31wkibnwy09rwhxsg0lyc4wf8xj9";
|
||||||
|
};
|
||||||
|
radix = {
|
||||||
|
owner = "luislavena";
|
||||||
|
repo = "radix";
|
||||||
|
rev = "v0.4.1";
|
||||||
|
sha256 = "1l08cydkdidq9yyil1wl240hvk41iycv04jrg6nx5mkvzw4z1bzg";
|
||||||
|
};
|
||||||
|
spectator = {
|
||||||
|
owner = "icy-arctic-fox";
|
||||||
|
repo = "spectator";
|
||||||
|
rev = "v0.10.3";
|
||||||
|
sha256 = "0gh9g7ycn17n4g4sr728c8fdrrznx68alhpkwhcrzxxn2hgsp46v";
|
||||||
|
};
|
||||||
|
sqlite3 = {
|
||||||
|
owner = "crystal-lang";
|
||||||
|
repo = "crystal-sqlite3";
|
||||||
|
rev = "v0.18.0";
|
||||||
|
sha256 = "03nnvpchhq9f9ywsm3pk2rrj4a3figw7xs96zdziwgr5znkz6x93";
|
||||||
|
};
|
||||||
|
}
|
|
@ -8,4 +8,4 @@ git add .
|
||||||
|
|
||||||
deploy -s ".#lappy"
|
deploy -s ".#lappy"
|
||||||
deploy -s ".#hetzner-vm"
|
deploy -s ".#hetzner-vm"
|
||||||
deploy -s ".#raspberry" -- --no-sandbox
|
#deploy -s ".#raspberry" -- --no-sandbox
|
||||||
|
|
Loading…
Reference in a new issue