move pkgs
This commit is contained in:
parent
84f07ef08f
commit
af2b5a14f2
14 changed files with 1 additions and 1 deletions
29
pkgs/default.nix
Normal file
29
pkgs/default.nix
Normal file
|
@ -0,0 +1,29 @@
|
|||
# nix-build -E 'with import <nixpkgs> {}; callPackage ./default.nix {}'
|
||||
_final: prev: {
|
||||
v = {
|
||||
glitch-soc = prev.callPackage ./glitch-soc { };
|
||||
|
||||
unbound = prev.unbound.override {
|
||||
withSystemd = true;
|
||||
withDoH = true;
|
||||
withDNSCrypt = true;
|
||||
withTFO = true;
|
||||
};
|
||||
|
||||
dnd-5e-latex-template = prev.callPackage ./dnd-5e-latex-template { };
|
||||
|
||||
roundcube-swipe = prev.callPackage ./roundcube-swipe { };
|
||||
|
||||
gitea-agatheme = prev.callPackage ./gitea-agatheme { };
|
||||
|
||||
# nix-shell -p "(vscode-with-extensions.override {vscodeExtensions = with vscode-extensions; [ jnoortheen.nix-ide ]; })" -I nixpkgs=.
|
||||
vscode-extensions = {
|
||||
platformio.platformio-ide =
|
||||
prev.callPackage ./vscode-extensions/platformio.nix { };
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
plex-plexpass = prev.callPackage ./plex-pass { };
|
||||
plexRaw-plexpass = prev.callPackage ./plex-pass/raw.nix { };
|
||||
}
|
30
pkgs/dnd-5e-latex-template/default.nix
Normal file
30
pkgs/dnd-5e-latex-template/default.nix
Normal file
|
@ -0,0 +1,30 @@
|
|||
{ lib, stdenvNoCC, fetchFromGitHub }:
|
||||
stdenvNoCC.mkDerivation rec {
|
||||
pname = "dnd-5e-latex-template";
|
||||
version = "0.8.0";
|
||||
tlType = "run";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "rpgtex";
|
||||
repo = "DND-5e-LaTeX-Template";
|
||||
rev = "d611f61d2d0f54e621641cffe87b49ca216ccf1a";
|
||||
sha256 = "sha256-jSYC0iduKGoUaYI1jrH0cakC45AMug9UodERqsvwVxw=";
|
||||
};
|
||||
|
||||
phases = [ "installPhase" ];
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
path="$out/tex/latex/${pname}"
|
||||
mkdir -p "$path"
|
||||
cp -r $src/* $path
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
meta = {
|
||||
description = "DnD 5e latex template";
|
||||
license = lib.licenses.mit;
|
||||
};
|
||||
}
|
21
pkgs/gitea-agatheme/default.nix
Normal file
21
pkgs/gitea-agatheme/default.nix
Normal file
|
@ -0,0 +1,21 @@
|
|||
{ stdenvNoCC, fetchurl, lib }:
|
||||
stdenvNoCC.mkDerivation {
|
||||
pname = "gitea-agatheme";
|
||||
version = "1.2";
|
||||
|
||||
src = fetchurl {
|
||||
url =
|
||||
"https://git.lain.faith/attachments/290e2304-92a3-4991-8703-fbbf52f31340";
|
||||
sha256 = "424f4e232c7d759485cdf1bcde9edde50f2992cf6bde61c21f71eae03a905543";
|
||||
};
|
||||
|
||||
phases = [ "installPhase" ];
|
||||
|
||||
installPhase = ''
|
||||
cp $src $out
|
||||
'';
|
||||
|
||||
meta = with lib; {
|
||||
description = "Gitea/Forgejo purple theme";
|
||||
};
|
||||
}
|
169
pkgs/glitch-soc/default.nix
Normal file
169
pkgs/glitch-soc/default.nix
Normal file
|
@ -0,0 +1,169 @@
|
|||
{ lib, stdenv, nodejs-slim, bundlerEnv, nixosTests
|
||||
, yarn, callPackage, imagemagick, ffmpeg, file, ruby, writeShellScript
|
||||
, fetchYarnDeps, prefetch-yarn-deps
|
||||
, brotli
|
||||
|
||||
# Allow building a fork or custom version of Mastodon:
|
||||
, pname ? "mastodon"
|
||||
, version ? srcOverride.version
|
||||
, patches ? []
|
||||
# src is a package
|
||||
, srcOverride ? callPackage ./source.nix { inherit patches; }
|
||||
, gemset ? ./. + "/gemset.nix"
|
||||
, yarnHash ? srcOverride.yarnHash
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
inherit pname version;
|
||||
|
||||
src = srcOverride;
|
||||
|
||||
mastodonGems = bundlerEnv {
|
||||
name = "${pname}-gems-${version}";
|
||||
inherit version gemset ruby;
|
||||
gemdir = src;
|
||||
# This fix (copied from https://github.com/NixOS/nixpkgs/pull/76765) replaces the gem
|
||||
# symlinks with directories, resolving this error when running rake:
|
||||
# /nix/store/451rhxkggw53h7253izpbq55nrhs7iv0-mastodon-gems-3.0.1/lib/ruby/gems/2.6.0/gems/bundler-1.17.3/lib/bundler/settings.rb:6:in `<module:Bundler>': uninitialized constant Bundler::Settings (NameError)
|
||||
postBuild = ''
|
||||
for gem in "$out"/lib/ruby/gems/*/gems/*; do
|
||||
cp -a "$gem/" "$gem.new"
|
||||
rm "$gem"
|
||||
# needed on macOS, otherwise the mv yields permission denied
|
||||
chmod +w "$gem.new"
|
||||
mv "$gem.new" "$gem"
|
||||
done
|
||||
'';
|
||||
};
|
||||
|
||||
mastodonModules = stdenv.mkDerivation {
|
||||
pname = "${pname}-modules";
|
||||
inherit src version;
|
||||
|
||||
yarnOfflineCache = fetchYarnDeps {
|
||||
yarnLock = "${src}/yarn.lock";
|
||||
hash = yarnHash;
|
||||
};
|
||||
|
||||
nativeBuildInputs = [ prefetch-yarn-deps nodejs-slim yarn mastodonGems mastodonGems.wrappedRuby brotli ];
|
||||
|
||||
RAILS_ENV = "production";
|
||||
NODE_ENV = "production";
|
||||
|
||||
buildPhase = ''
|
||||
runHook preBuild
|
||||
|
||||
export HOME=$PWD
|
||||
# This option is needed for openssl-3 compatibility
|
||||
# Otherwise we encounter this upstream issue: https://github.com/mastodon/mastodon/issues/17924
|
||||
export NODE_OPTIONS=--openssl-legacy-provider
|
||||
fixup-yarn-lock ~/yarn.lock
|
||||
yarn config --offline set yarn-offline-mirror $yarnOfflineCache
|
||||
yarn install --offline --frozen-lockfile --ignore-engines --ignore-scripts --no-progress
|
||||
|
||||
patchShebangs ~/bin
|
||||
patchShebangs ~/node_modules
|
||||
|
||||
# skip running yarn install
|
||||
rm -rf ~/bin/yarn
|
||||
|
||||
OTP_SECRET=precompile_placeholder SECRET_KEY_BASE=precompile_placeholder \
|
||||
rails assets:precompile
|
||||
yarn cache clean --offline
|
||||
rm -rf ~/node_modules/.cache
|
||||
|
||||
# Create missing static gzip and brotli files
|
||||
gzip --best --keep ~/public/assets/500.html
|
||||
gzip --best --keep ~/public/packs/report.html
|
||||
find ~/public/assets -maxdepth 1 -type f -name '.*.json' \
|
||||
-exec gzip --best --keep --force {} ';'
|
||||
brotli --best --keep ~/public/packs/report.html
|
||||
find ~/public/assets -type f -regextype posix-extended -iregex '.*\.(css|js|json|html)' \
|
||||
-exec brotli --best --keep {} ';'
|
||||
|
||||
runHook postBuild
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
mkdir -p $out/public
|
||||
cp -r node_modules $out/node_modules
|
||||
cp -r public/assets $out/public
|
||||
cp -r public/packs $out/public
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
};
|
||||
|
||||
propagatedBuildInputs = [ imagemagick ffmpeg file mastodonGems.wrappedRuby ];
|
||||
buildInputs = [ mastodonGems nodejs-slim ];
|
||||
|
||||
buildPhase = ''
|
||||
runHook preBuild
|
||||
|
||||
ln -s $mastodonModules/node_modules node_modules
|
||||
ln -s $mastodonModules/public/assets public/assets
|
||||
ln -s $mastodonModules/public/packs public/packs
|
||||
|
||||
patchShebangs bin/
|
||||
for b in $(ls $mastodonGems/bin/)
|
||||
do
|
||||
if [ ! -f bin/$b ]; then
|
||||
ln -s $mastodonGems/bin/$b bin/$b
|
||||
fi
|
||||
done
|
||||
|
||||
# Remove execute permissions
|
||||
chmod 0444 public/emoji/*.svg
|
||||
|
||||
# Create missing static gzip and brotli files
|
||||
find public -maxdepth 1 -type f -regextype posix-extended -iregex '.*\.(css|js|svg|txt|xml)' \
|
||||
-exec gzip --best --keep --force {} ';' \
|
||||
-exec brotli --best --keep {} ';'
|
||||
find public/emoji -type f -name '.*.svg' \
|
||||
-exec gzip --best --keep --force {} ';' \
|
||||
-exec brotli --best --keep {} ';'
|
||||
ln -s assets/500.html.gz public/500.html.gz
|
||||
ln -s assets/500.html.br public/500.html.br
|
||||
ln -s packs/sw.js.gz public/sw.js.gz
|
||||
ln -s packs/sw.js.br public/sw.js.br
|
||||
ln -s packs/sw.js.map.gz public/sw.js.map.gz
|
||||
ln -s packs/sw.js.map.br public/sw.js.map.br
|
||||
|
||||
rm -rf log
|
||||
ln -s /var/log/mastodon log
|
||||
ln -s /tmp tmp
|
||||
|
||||
runHook postBuild
|
||||
'';
|
||||
|
||||
installPhase = let
|
||||
run-streaming = writeShellScript "run-streaming.sh" ''
|
||||
# NixOS helper script to consistently use the same NodeJS version the package was built with.
|
||||
${nodejs-slim}/bin/node ./streaming
|
||||
'';
|
||||
in ''
|
||||
runHook preInstall
|
||||
|
||||
mkdir -p $out
|
||||
cp -r * $out/
|
||||
ln -s ${run-streaming} $out/run-streaming.sh
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
passthru = {
|
||||
tests.mastodon = nixosTests.mastodon;
|
||||
# run with: nix-shell ./maintainers/scripts/update.nix --argstr package mastodon
|
||||
updateScript = ./update.sh;
|
||||
};
|
||||
|
||||
meta = with lib; {
|
||||
description = "Self-hosted, globally interconnected microblogging software based on ActivityPub";
|
||||
homepage = "https://joinmastodon.org";
|
||||
license = licenses.agpl3Plus;
|
||||
platforms = [ "x86_64-linux" "i686-linux" "aarch64-linux" ];
|
||||
maintainers = with maintainers; [ happy-river erictapen izorkin ghuntley ];
|
||||
};
|
||||
}
|
3383
pkgs/glitch-soc/gemset.nix
Normal file
3383
pkgs/glitch-soc/gemset.nix
Normal file
File diff suppressed because it is too large
Load diff
18
pkgs/glitch-soc/source.nix
Normal file
18
pkgs/glitch-soc/source.nix
Normal file
|
@ -0,0 +1,18 @@
|
|||
# This file was generated by pkgs.mastodon.updateScript.
|
||||
{ fetchFromGitHub, applyPatches, patches ? [] }:
|
||||
let
|
||||
version = "0e562916cce3241d98bd10f04a6aa7419700605";
|
||||
in
|
||||
(
|
||||
applyPatches {
|
||||
src = fetchFromGitHub {
|
||||
owner = "glitch-soc";
|
||||
repo = "mastodon";
|
||||
rev = "v${version}";
|
||||
hash = "sha256-fZH3zPEU5jnYFhLx8OKDNrvsSVT46Peu92L84Fg5YpQ=";
|
||||
};
|
||||
inherit patches;
|
||||
}) // {
|
||||
inherit version;
|
||||
yarnHash = "sha256-P7KswzsCusyiS4MxUFnC1HYMTQ6fLpIwd97AglCukIk=";
|
||||
}
|
112
pkgs/glitch-soc/update.sh
Executable file
112
pkgs/glitch-soc/update.sh
Executable file
|
@ -0,0 +1,112 @@
|
|||
#!/usr/bin/env nix-shell
|
||||
#! nix-shell -i bash -p bundix coreutils diffutils nix-prefetch-github gnused jq prefetch-yarn-deps
|
||||
set -e
|
||||
|
||||
OWNER=mastodon
|
||||
REPO=mastodon
|
||||
|
||||
POSITIONAL=()
|
||||
while [[ $# -gt 0 ]]; do
|
||||
key="$1"
|
||||
|
||||
case $key in
|
||||
--owner)
|
||||
OWNER="$2"
|
||||
shift # past argument
|
||||
shift # past value
|
||||
;;
|
||||
--repo)
|
||||
REPO="$2"
|
||||
shift # past argument
|
||||
shift # past value
|
||||
;;
|
||||
--ver)
|
||||
VERSION="$2"
|
||||
shift # past argument
|
||||
shift # past value
|
||||
;;
|
||||
--rev)
|
||||
REVISION="$2"
|
||||
shift # past argument
|
||||
shift # past value
|
||||
;;
|
||||
--patches)
|
||||
PATCHES="$2"
|
||||
shift # past argument
|
||||
shift # past value
|
||||
;;
|
||||
*) # unknown option
|
||||
POSITIONAL+=("$1")
|
||||
shift # past argument
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [[ -n "$POSITIONAL" ]]; then
|
||||
echo "Usage: update.sh [--owner OWNER] [--repo REPO] [--ver VERSION] [--rev REVISION] [--patches PATCHES]"
|
||||
echo "OWNER and REPO must be paths on github."
|
||||
echo "If REVISION is not provided, the latest tag from github.com/mastodon/mastodon is fetched and VERSION is calculated from it."
|
||||
echo "If OWNER and REPO are not provided, it defaults they default to mastodon and mastodon."
|
||||
echo "PATCHES, if provided, should be one or more Nix expressions separated by spaces."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -z "$REVISION" ]]; then
|
||||
REVISION="$(curl ${GITHUB_TOKEN:+" -u \":$GITHUB_TOKEN\""} -s "https://api.github.com/repos/$OWNER/$REPO/releases" | jq -r 'map(select(.prerelease == false)) | .[0].tag_name')"
|
||||
fi
|
||||
|
||||
VERSION="$(echo "$REVISION" | cut -c2-)"
|
||||
|
||||
rm -f gemset.nix source.nix
|
||||
cd "$(dirname "${BASH_SOURCE[0]}")" || exit 1
|
||||
|
||||
WORK_DIR=$(mktemp -d)
|
||||
|
||||
# Check that working directory was created.
|
||||
if [[ -z "$WORK_DIR" || ! -d "$WORK_DIR" ]]; then
|
||||
echo "Could not create temporary directory"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Delete the working directory on exit.
|
||||
function cleanup {
|
||||
# Report errors, if any, from nix-prefetch-git
|
||||
grep "fatal" $WORK_DIR/nix-prefetch-git.out >/dev/stderr || true
|
||||
rm -rf "$WORK_DIR"
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
||||
echo "Fetching source code $REVISION"
|
||||
JSON=$(nix-prefetch-github "$OWNER" "$REPO" --rev "$REVISION" 2> $WORK_DIR/nix-prefetch-git.out)
|
||||
HASH=$(echo "$JSON" | jq -r .hash)
|
||||
|
||||
cat > source.nix << EOF
|
||||
# This file was generated by pkgs.mastodon.updateScript.
|
||||
{ fetchFromGitHub, applyPatches, patches ? [] }:
|
||||
let
|
||||
version = "$VERSION";
|
||||
in
|
||||
(
|
||||
applyPatches {
|
||||
src = fetchFromGitHub {
|
||||
owner = "$OWNER";
|
||||
repo = "$REPO";
|
||||
rev = "v\${version}";
|
||||
hash = "$HASH";
|
||||
};
|
||||
patches = patches ++ [$PATCHES];
|
||||
}) // {
|
||||
inherit version;
|
||||
yarnHash = "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=";
|
||||
}
|
||||
EOF
|
||||
SOURCE_DIR="$(nix-build --no-out-link -E '(import <nixpkgs> {}).callPackage ./source.nix {}')"
|
||||
|
||||
echo "Creating gemset.nix"
|
||||
bundix --lockfile="$SOURCE_DIR/Gemfile.lock" --gemfile="$SOURCE_DIR/Gemfile"
|
||||
echo "" >> gemset.nix # Create trailing newline to please EditorConfig checks
|
||||
|
||||
echo "Creating yarn-hash.nix"
|
||||
YARN_HASH="$(prefetch-yarn-deps "$SOURCE_DIR/yarn.lock")"
|
||||
YARN_HASH="$(nix hash to-sri --type sha256 "$YARN_HASH")"
|
||||
sed -i "s/sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=/$YARN_HASH/g" source.nix
|
3
pkgs/plex-pass/default.nix
Normal file
3
pkgs/plex-pass/default.nix
Normal file
|
@ -0,0 +1,3 @@
|
|||
{ plex, plexRaw-plexpass }:
|
||||
# Copied from: https://github.com/tadfisher/flake/blob/ed949a619236ba30f0be614fed804abdf1e8005b/pkgs/plex-plexpass/default.nix
|
||||
plex.override { plexRaw = plexRaw-plexpass; }
|
15
pkgs/plex-pass/raw.nix
Normal file
15
pkgs/plex-pass/raw.nix
Normal file
|
@ -0,0 +1,15 @@
|
|||
{ lib, stdenv, plexRaw, fetchurl }:
|
||||
let
|
||||
sources = builtins.fromJSON (builtins.readFile ./sources.json);
|
||||
source = lib.findFirst (x: x.platform == stdenv.hostPlatform.system)
|
||||
(throw "unsupported platform: ${stdenv.hostPlatform.system}")
|
||||
sources;
|
||||
in
|
||||
plexRaw.overrideAttrs (attrs: {
|
||||
pname = attrs.pname + "-plexpass";
|
||||
inherit (source) version;
|
||||
src = fetchurl {
|
||||
inherit (source) url;
|
||||
sha256 = source.hash;
|
||||
};
|
||||
})
|
14
pkgs/plex-pass/sources.json
Normal file
14
pkgs/plex-pass/sources.json
Normal file
|
@ -0,0 +1,14 @@
|
|||
[
|
||||
{
|
||||
"version": "1.40.0.7775",
|
||||
"platform": "aarch64-linux",
|
||||
"url": "https://downloads.plex.tv/plex-media-server-new/1.40.0.7775-456fbaf97/debian/plexmediaserver_1.40.0.7775-456fbaf97_arm64.deb",
|
||||
"hash": "0awannq36c5zgp2hln6g90yc44qf2sm0cq14wp7ck4yvs7wr5rwh"
|
||||
},
|
||||
{
|
||||
"version": "1.40.0.7775",
|
||||
"platform": "x86_64-linux",
|
||||
"url": "https://downloads.plex.tv/plex-media-server-new/1.40.0.7775-456fbaf97/debian/plexmediaserver_1.40.0.7775-456fbaf97_amd64.deb",
|
||||
"hash": "0zkz2w2rjngkdamsdp10j1gxd197kqrlqdm6z0sfvnzf7zvlr7v6"
|
||||
}
|
||||
]
|
33
pkgs/plex-pass/update.sh
Executable file
33
pkgs/plex-pass/update.sh
Executable file
|
@ -0,0 +1,33 @@
|
|||
#! /usr/bin/env nix-shell
|
||||
#! nix-shell -i bash -p vault curl jq
|
||||
|
||||
shopt -s extglob
|
||||
set -eu -o pipefail
|
||||
|
||||
path="$(realpath "$(dirname "$0")")"
|
||||
|
||||
declare -A platforms=(
|
||||
[linux-x86_64]=x86_64-linux
|
||||
[linux-aarch64]=aarch64-linux
|
||||
)
|
||||
|
||||
token=$(vault kv get -field=plex_token hades_secrets/nixos/plex)
|
||||
manifest=$(curl -s "https://plex.tv/api/downloads/5.json?channel=plexpass" -H "X-Plex-Token: ${token}")
|
||||
version=$(echo "$manifest" | jq -r '.computer.Linux.version | split("-") | .[0]')
|
||||
|
||||
tmp="$path/sources.tmp.json"
|
||||
echo '' >$tmp
|
||||
|
||||
for arch in "${!platforms[@]}"; do
|
||||
url="$(echo "$manifest" | jq --arg arch "$arch" -r '.computer.Linux.releases[] | select(.distro == "debian" and .build == $arch) .url')"
|
||||
hash="$(nix-prefetch-url "$url")"
|
||||
nixPlatform=${platforms[$arch]}
|
||||
jq --arg version $version \
|
||||
--arg platform $nixPlatform \
|
||||
--arg url "$url" \
|
||||
--arg hash $hash \
|
||||
-n '$ARGS.named' >>$tmp
|
||||
done
|
||||
|
||||
jq -s '.' $tmp >"$path/sources.json"
|
||||
rm $tmp
|
20
pkgs/roundcube-swipe/default.nix
Normal file
20
pkgs/roundcube-swipe/default.nix
Normal file
|
@ -0,0 +1,20 @@
|
|||
{ runCommand, fetchFromGitHub }:
|
||||
let
|
||||
roundcubePlugin = { version, src, ... }:
|
||||
|
||||
runCommand "roundcube-plugin-swipe-${version}" { } ''
|
||||
mkdir -p $out/plugins/
|
||||
cp -r ${src} $out/plugins/swipe
|
||||
'';
|
||||
in
|
||||
roundcubePlugin rec {
|
||||
pname = "roundcube-swipe";
|
||||
version = "0.5";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "johndoh";
|
||||
repo = pname;
|
||||
rev = "de96f82183bc593d879c335e6614fa983d51abfc";
|
||||
sha256 = "sha256-vrMSvGwUzufSFDsUvUSL9JLR/+GtWdebVqgKiXMOOq4=";
|
||||
};
|
||||
}
|
11
pkgs/vscode-extensions/platformio.nix
Normal file
11
pkgs/vscode-extensions/platformio.nix
Normal file
|
@ -0,0 +1,11 @@
|
|||
{ vscode-utils }:
|
||||
let inherit (vscode-utils) buildVscodeMarketplaceExtension;
|
||||
in buildVscodeMarketplaceExtension {
|
||||
mktplcRef = {
|
||||
name = "platformio-ide";
|
||||
publisher = "platformio";
|
||||
version = "3.1.1";
|
||||
sha256 = "sha256-g9yTG3DjVUS2w9eHGAai5LoIfEGus+FPhqDnCi4e90Q=";
|
||||
# sha256 = lib.fakeSha256;
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue