use packages from nix-packages
This commit is contained in:
parent
a37ee4b457
commit
f185566ea3
21 changed files with 129 additions and 4728 deletions
|
@ -1,4 +1,4 @@
|
|||
{ pkgs, config, lib, ... }:
|
||||
{ nix-packages, system, pkgs, config, lib, ... }:
|
||||
let
|
||||
listenIPs = (import ../../utils/getInternalIP.nix config).listenIPs;
|
||||
listenStatements = lib.concatStringsSep "\n" (builtins.map (ip: "listen ${ip}:443 http3;") listenIPs) + ''
|
||||
|
@ -12,7 +12,7 @@ let
|
|||
"mastodon-sidekiq.service"
|
||||
];
|
||||
};
|
||||
mastodon = pkgs.callPackage ../../packages/mastodon { };
|
||||
mastodon = nix-packages.packages.${system}.mastodon;
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{ config, pkgs, lib, ... }:
|
||||
{ nix-packages, system, config, pkgs, lib, ... }:
|
||||
let
|
||||
matrix-media-repo = pkgs.callPackage ../../packages/matrix/matrix-media-repo.nix { };
|
||||
matrix-media-repo = nix-packages.packages.${system}.matrix-media-repo;
|
||||
config-yml = pkgs.writeText "matrix-media-repo.yaml" (lib.generators.toYAML { } {
|
||||
repo = {
|
||||
bindAddress = "127.0.0.1";
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
{ ... }:
|
||||
{ nix-packages, system, ... }:
|
||||
let
|
||||
homepage-old = import ../../packages/old-homepage.nix { };
|
||||
homepage-old = nix-packages.packages.${system}.homepage-old;
|
||||
in
|
||||
{
|
||||
systemd.services.homepage-old = {
|
||||
enable = true;
|
||||
description = "darkkirb.de";
|
||||
script = "${homepage-old.homepage-old}/homepage";
|
||||
script = "${homepage-old}/homepage";
|
||||
serviceConfig = {
|
||||
WorkingDirectory = homepage-old.homepage-old;
|
||||
WorkingDirectory = homepage-old;
|
||||
EnvironmentFile = "/run/secrets/services/old-homepage";
|
||||
};
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{ pkgs, config, ... }: {
|
||||
{ nix-packages, system, pkgs, config, ... }: {
|
||||
services.nginx.virtualHosts."hydra.chir.rs" = {
|
||||
sslCertificate = "/var/lib/acme/chir.rs/cert.pem";
|
||||
sslCertificateKey = "/var/lib/acme/chir.rs/key.pem";
|
||||
|
@ -11,7 +11,9 @@
|
|||
};
|
||||
};
|
||||
services.nginx.virtualHosts."mastodon.chir.rs" =
|
||||
let mastodon = pkgs.callPackage ../../packages/mastodon { }; in
|
||||
let
|
||||
mastodon = nix-packages.packages.${system}.mastodon;
|
||||
in
|
||||
{
|
||||
sslCertificate = "/var/lib/acme/chir.rs/cert.pem";
|
||||
sslCertificateKey = "/var/lib/acme/chir.rs/key.pem";
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{ pkgs, miifox-net, ... }: {
|
||||
{ pkgs, nix-packages, system, ... }: {
|
||||
users.users.miifox = {
|
||||
createHome = true;
|
||||
description = "Miifox";
|
||||
|
@ -27,7 +27,7 @@
|
|||
sslCertificateKey = "/var/lib/acme/miifox.net/key.pem";
|
||||
locations."/" =
|
||||
let
|
||||
miifox-website = pkgs.callPackage (import ../../packages/miifox.nix miifox-net) { };
|
||||
miifox-website = nix-packages.packages.${system}.miifox-net;
|
||||
in
|
||||
{
|
||||
root = "${miifox-website}";
|
||||
|
|
135
flake.lock
135
flake.lock
|
@ -181,6 +181,25 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"gomod2nix": {
|
||||
"inputs": {
|
||||
"nixpkgs": "nixpkgs_4",
|
||||
"utils": "utils"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1654019497,
|
||||
"narHash": "sha256-yj53tEaOAJoZ1iEBbZ4TArpgAsLZnmivfr4eD0xF52c=",
|
||||
"owner": "tweag",
|
||||
"repo": "gomod2nix",
|
||||
"rev": "71c797eb0d83f33de7e0247b3ffe7120d98c6b49",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "tweag",
|
||||
"repo": "gomod2nix",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"home-manager": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
|
@ -275,23 +294,55 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"miifox-net": {
|
||||
"mastodon": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1648216492,
|
||||
"narHash": "sha256-OKGPwQZjZXbXziJLSOE8K/0fCWCnvU/I2Lm3Vc8KD/o=",
|
||||
"ref": "refs/heads/master",
|
||||
"rev": "7826b9a3bec5dddd4b8a879c3396a1406fc37370",
|
||||
"revCount": 5,
|
||||
"type": "git",
|
||||
"url": "https://git.chir.rs/CarolineHusky/MiiFox.net"
|
||||
"lastModified": 1654881571,
|
||||
"narHash": "sha256-ASSrCM0jHMI04U7fFPQdaeDvt/sHzpiWKHSy6+/FW0M=",
|
||||
"owner": "glitch-soc",
|
||||
"repo": "mastodon",
|
||||
"rev": "970f06331bc7e482226e974c468b559a9e2f3fa3",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"type": "git",
|
||||
"url": "https://git.chir.rs/CarolineHusky/MiiFox.net"
|
||||
"owner": "glitch-soc",
|
||||
"repo": "mastodon",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"miifox-net_2": {
|
||||
"matrix-media-repo": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1648768263,
|
||||
"narHash": "sha256-H1S9l5S4gcVU482qYCpDW+Ki0r8VkwBgkbUCk6k63sg=",
|
||||
"owner": "turt2live",
|
||||
"repo": "matrix-media-repo",
|
||||
"rev": "3184dbc7720fc103aaf4704be894eac69535e887",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "turt2live",
|
||||
"repo": "matrix-media-repo",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"mautrix-whatsapp": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1654374800,
|
||||
"narHash": "sha256-8Jm1Z4pCmHBIZ+TNy2DFX/vQwYqeH4k2XtIoYkeoF3Y=",
|
||||
"owner": "mautrix",
|
||||
"repo": "whatsapp",
|
||||
"rev": "0796d14133c19d5e18223b6f138835229b7acf10",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "mautrix",
|
||||
"repo": "whatsapp",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"miifox-net": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1648216492,
|
||||
|
@ -348,17 +399,22 @@
|
|||
"inputs": {
|
||||
"clean-s3-cache": "clean-s3-cache",
|
||||
"flake-utils": "flake-utils_4",
|
||||
"miifox-net": "miifox-net_2",
|
||||
"gomod2nix": "gomod2nix",
|
||||
"mastodon": "mastodon",
|
||||
"matrix-media-repo": "matrix-media-repo",
|
||||
"mautrix-whatsapp": "mautrix-whatsapp",
|
||||
"miifox-net": "miifox-net",
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
],
|
||||
"nixpkgs-go116": "nixpkgs-go116"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1654974491,
|
||||
"narHash": "sha256-T4Kf3mgVu4QRxJqEMvIM0UvtCKwU4Jp6OaJYMFXf2PI=",
|
||||
"lastModified": 1655044097,
|
||||
"narHash": "sha256-zxkgayMFhrXCfO8Z8yycy04EwOtXggxFxqoGrbz1vW4=",
|
||||
"owner": "DarkKirb",
|
||||
"repo": "nix-packages",
|
||||
"rev": "1c7b6c474494809cdc36a70d49b4d6f8f28617fc",
|
||||
"rev": "03667319ca6732486e1761aa468328cf295e2723",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -509,11 +565,27 @@
|
|||
},
|
||||
"nixpkgs_4": {
|
||||
"locked": {
|
||||
"lastModified": 1655003801,
|
||||
"narHash": "sha256-V0NaVMDKQO/LxyKqD++5jEQGOHzfx1JzFGz7hHPly2U=",
|
||||
"lastModified": 1653581809,
|
||||
"narHash": "sha256-Uvka0V5MTGbeOfWte25+tfRL3moECDh1VwokWSZUdoY=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "18bd58aa85947bdef47ae3a601fff2d81de0b2d3",
|
||||
"rev": "83658b28fe638a170a19b8933aa008b30640fbd1",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs_5": {
|
||||
"locked": {
|
||||
"lastModified": 1655046959,
|
||||
"narHash": "sha256-gxqHZKq1ReLDe6ZMJSbmSZlLY95DsVq5o6jQihhzvmw=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "07bf3d25ce1da3bee6703657e6a787a4c6cdcea9",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -546,11 +618,11 @@
|
|||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1654969551,
|
||||
"narHash": "sha256-mcQIDMKK1yloAByYk6mnuG21K/mDznHWdmd2zHGZcRY=",
|
||||
"lastModified": 1655023857,
|
||||
"narHash": "sha256-Kspm/iGHRMe/1wgmlBKIybHUHxPe/PwtHtq1p/zDN7o=",
|
||||
"owner": "PolyMC",
|
||||
"repo": "PolyMC",
|
||||
"rev": "2bd8e7dca4aa55c836cb0bf33dc8d4be84fc938c",
|
||||
"rev": "c4f2e3a95584d9c50544a978a83650f8f83551fa",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -567,12 +639,10 @@
|
|||
"home-manager": "home-manager",
|
||||
"hosts-list": "hosts-list",
|
||||
"hydra": "hydra",
|
||||
"miifox-net": "miifox-net",
|
||||
"nix": "nix",
|
||||
"nix-packages": "nix-packages",
|
||||
"nixos-hardware": "nixos-hardware",
|
||||
"nixpkgs": "nixpkgs_4",
|
||||
"nixpkgs-go116": "nixpkgs-go116",
|
||||
"nixpkgs": "nixpkgs_5",
|
||||
"nixpkgs-noto-variable": "nixpkgs-noto-variable",
|
||||
"nur": "nur",
|
||||
"polymc": "polymc",
|
||||
|
@ -625,6 +695,21 @@
|
|||
"repo": "sops-nix",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"utils": {
|
||||
"locked": {
|
||||
"lastModified": 1653893745,
|
||||
"narHash": "sha256-0jntwV3Z8//YwuOjzhV2sgJJPt+HY6KhU7VZUL0fKZQ=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "1ed9fb1935d260de5fe1c2f7ee0ebaae17ed2fa1",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
|
|
|
@ -21,10 +21,7 @@ rec {
|
|||
hosts-list.url = github:StevenBlack/hosts;
|
||||
hosts-list.flake = false;
|
||||
nixos-hardware.url = github:NixOS/nixos-hardware;
|
||||
miifox-net.url = "git+https://git.chir.rs/CarolineHusky/MiiFox.net";
|
||||
miifox-net.flake = false;
|
||||
nixpkgs-noto-variable.url = github:NixOS/nixpkgs/1988f9a17fc1c2ab11f5817adf34a4eb8d06454d;
|
||||
nixpkgs-go116.url = github:NixOS/nixpkgs/dab5668f6be905a7f0de39a7d67fd8f78a13d600;
|
||||
|
||||
nix-packages.url = github:DarkKirb/nix-packages/main;
|
||||
nix-packages.inputs.nixpkgs.follows = "nixpkgs";
|
||||
|
@ -103,6 +100,7 @@ rec {
|
|||
github-cli
|
||||
];
|
||||
};
|
||||
formatters.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.alejandra;
|
||||
hydraJobs = (builtins.listToAttrs (map
|
||||
({ name, system }: {
|
||||
inherit name;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{ config, pkgs, lib, ... }:
|
||||
{ nix-packages, system, config, pkgs, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
dataDir = "/var/lib/mautrix-whatsapp";
|
||||
|
@ -7,7 +7,7 @@ let
|
|||
settingsFormat = pkgs.formats.yaml { };
|
||||
settingsFileUnsubstituted = settingsFormat.generate "mautrix-telegram-whatsapp-unsubstituted.yaml" cfg.settings;
|
||||
settingsFile = "${dataDir}/config.yaml";
|
||||
mautrix-whatsapp = pkgs.callPackage ../../packages/matrix/mautrix-whatsapp.nix { };
|
||||
mautrix-whatsapp = nix-packages.packages.${system}.mautrix-whatsapp;
|
||||
in
|
||||
{
|
||||
options = {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{ config, lib, options, pkgs, ... }:
|
||||
{ nix-packages, system, config, lib, options, pkgs, ... }:
|
||||
with lib;
|
||||
let
|
||||
papermc = pkgs.callPackage ../../packages/minecraft/paper.nix { };
|
||||
papermc = nix-packages.packages.${system}.papermc;
|
||||
cfg = config.services.minecraft;
|
||||
opt = options.services.minecraft;
|
||||
serverProperties = pkgs.writeText "server.properties" ''
|
||||
|
|
|
@ -1,138 +0,0 @@
|
|||
{ lib
|
||||
, stdenv
|
||||
, nodejs-slim
|
||||
, mkYarnPackage
|
||||
, fetchFromGitHub
|
||||
, bundlerEnv
|
||||
, nixosTests
|
||||
, yarn
|
||||
, callPackage
|
||||
, imagemagick
|
||||
, ffmpeg
|
||||
, file
|
||||
, ruby_3_0
|
||||
, writeShellScript
|
||||
, fetchYarnDeps
|
||||
, fixup_yarn_lock
|
||||
|
||||
# Allow building a fork or custom version of Mastodon:
|
||||
, pname ? "mastodon-glitch"
|
||||
, version ? import ./version.nix
|
||||
, srcOverride ? null
|
||||
, dependenciesDir ? ./. # Should contain gemset.nix, yarn.nix and package.json.
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
inherit pname version;
|
||||
|
||||
# Using overrideAttrs on src does not build the gems and modules with the overridden src.
|
||||
# Putting the callPackage up in the arguments list also does not work.
|
||||
src = if srcOverride != null then srcOverride else callPackage ./source.nix { };
|
||||
|
||||
yarnOfflineCache = fetchYarnDeps {
|
||||
yarnLock = "${src}/yarn.lock";
|
||||
sha256 = "sha256-wvzwggDdMqr+XI4K8ZDm13yTuBdqnRwzT78cLnTVAH4=";
|
||||
};
|
||||
|
||||
mastodon-gems = bundlerEnv {
|
||||
name = "${pname}-gems-${version}";
|
||||
inherit version;
|
||||
ruby = ruby_3_0;
|
||||
gemdir = src;
|
||||
gemset = dependenciesDir + "/gemset.nix";
|
||||
# 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
|
||||
'';
|
||||
};
|
||||
|
||||
mastodon-modules = stdenv.mkDerivation {
|
||||
pname = "${pname}-modules";
|
||||
inherit src version;
|
||||
|
||||
nativeBuildInputs = [ fixup_yarn_lock nodejs-slim yarn mastodon-gems mastodon-gems.wrappedRuby ];
|
||||
|
||||
RAILS_ENV = "production";
|
||||
NODE_ENV = "production";
|
||||
|
||||
buildPhase = ''
|
||||
export HOME=$PWD
|
||||
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
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out/public
|
||||
cp -r node_modules $out/node_modules
|
||||
cp -r public/assets $out/public
|
||||
cp -r public/packs $out/public
|
||||
'';
|
||||
};
|
||||
|
||||
propagatedBuildInputs = [ imagemagick ffmpeg file mastodon-gems.wrappedRuby ];
|
||||
buildInputs = [ mastodon-gems nodejs-slim ];
|
||||
|
||||
buildPhase = ''
|
||||
ln -s ${mastodon-modules}/node_modules node_modules
|
||||
ln -s ${mastodon-modules}/public/assets public/assets
|
||||
ln -s ${mastodon-modules}/public/packs public/packs
|
||||
|
||||
patchShebangs bin/
|
||||
for b in $(ls ${mastodon-gems}/bin/)
|
||||
do
|
||||
if [ ! -f bin/$b ]; then
|
||||
ln -s ${mastodon-gems}/bin/$b bin/$b
|
||||
fi
|
||||
done
|
||||
|
||||
rm -rf log
|
||||
ln -s /var/log/mastodon log
|
||||
ln -s /tmp tmp
|
||||
'';
|
||||
|
||||
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
|
||||
''
|
||||
mkdir -p $out
|
||||
cp -r * $out/
|
||||
ln -s ${run-streaming} $out/run-streaming.sh
|
||||
'';
|
||||
|
||||
passthru = {
|
||||
tests.mastodon = nixosTests.mastodon;
|
||||
updateScript = callPackage ./update.nix { };
|
||||
};
|
||||
|
||||
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; [ petabyteboy happy-river erictapen izorkin ];
|
||||
};
|
||||
}
|
File diff suppressed because it is too large
Load diff
|
@ -1,11 +0,0 @@
|
|||
# This file was generated by pkgs.mastodon.updateScript.
|
||||
{ fetchgit, applyPatches }: let
|
||||
src = fetchgit {
|
||||
url = "https://github.com/glitch-soc/mastodon";
|
||||
rev = "c1d0a6a7981b5fe74bdd03c958a558096ea3cde8";
|
||||
sha256 = "1ybhj352wb704b2fa7vnnfzn421m03vnv5w2fy3jfikn51765bhl";
|
||||
};
|
||||
in applyPatches {
|
||||
inherit src;
|
||||
patches = [];
|
||||
}
|
|
@ -1,30 +0,0 @@
|
|||
{ pkgs
|
||||
, runCommand
|
||||
, lib
|
||||
, makeWrapper
|
||||
, yarn2nix
|
||||
, bundix
|
||||
, coreutils
|
||||
, diffutils
|
||||
, nix-prefetch-git
|
||||
, gnused
|
||||
, jq
|
||||
}:
|
||||
let
|
||||
binPath = lib.makeBinPath [ yarn2nix bundix coreutils diffutils nix-prefetch-git gnused jq ];
|
||||
in
|
||||
runCommand "mastodon-update-script"
|
||||
{
|
||||
nativeBuildInputs = [ makeWrapper ];
|
||||
|
||||
meta = {
|
||||
maintainers = with lib.maintainers; [ happy-river ];
|
||||
description = "Utility to generate Nix expressions for Mastodon's dependencies";
|
||||
platforms = lib.platforms.unix;
|
||||
};
|
||||
} ''
|
||||
mkdir -p $out/bin
|
||||
cp ${./update.sh} $out/bin/update.sh
|
||||
patchShebangs $out/bin/update.sh
|
||||
wrapProgram $out/bin/update.sh --prefix PATH : ${binPath}
|
||||
''
|
|
@ -1,98 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
URL=https://github.com/mastodon/mastodon.git
|
||||
|
||||
POSITIONAL=()
|
||||
while [[ $# -gt 0 ]]; do
|
||||
key="$1"
|
||||
|
||||
case $key in
|
||||
--url)
|
||||
URL="$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 [[ -z "$VERSION" || -n "$POSITIONAL" ]]; then
|
||||
echo "Usage: update.sh [--url URL] --ver VERSION [--rev REVISION] [--patches PATCHES]"
|
||||
echo "URL may be any path acceptable to 'git clone' and VERSION the"
|
||||
echo "semantic version number. If VERSION is not a revision acceptable to"
|
||||
echo "'git checkout', you must provide one in REVISION. If URL is not"
|
||||
echo "provided, it defaults to https://github.com/mastodon/mastodon.git."
|
||||
echo "PATCHES, if provided, should be one or more Nix expressions"
|
||||
echo "separated by spaces."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -z "$REVISION" ]]; then
|
||||
REVISION="$VERSION"
|
||||
fi
|
||||
|
||||
rm -f gemset.nix version.nix source.nix
|
||||
TARGET_DIR="$PWD"
|
||||
|
||||
|
||||
WORK_DIR=$(mktemp -d)
|
||||
|
||||
# Check that working directory was created.
|
||||
if [[ ! "$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 from $URL"
|
||||
JSON=$(nix-prefetch-git --url "$URL" --rev "$REVISION" 2> $WORK_DIR/nix-prefetch-git.out)
|
||||
SHA=$(echo $JSON | jq -r .sha256)
|
||||
FETCHED_SOURCE_DIR=$(grep '^path is' $WORK_DIR/nix-prefetch-git.out | sed 's/^path is //')
|
||||
|
||||
echo "Creating version.nix"
|
||||
echo \"$VERSION\" | sed 's/^"v/"/' > version.nix
|
||||
|
||||
cat > source.nix << EOF
|
||||
# This file was generated by pkgs.mastodon.updateScript.
|
||||
{ fetchgit, applyPatches }: let
|
||||
src = fetchgit {
|
||||
url = "$URL";
|
||||
rev = "$REVISION";
|
||||
sha256 = "$SHA";
|
||||
};
|
||||
in applyPatches {
|
||||
inherit src;
|
||||
patches = [$PATCHES];
|
||||
}
|
||||
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 "" >> $TARGET_DIR/gemset.nix # Create trailing newline to please EditorConfig checks
|
|
@ -1 +0,0 @@
|
|||
"3.5.3"
|
|
@ -1,30 +0,0 @@
|
|||
{ buildGo116Module
|
||||
, fetchFromGitHub
|
||||
, git
|
||||
}: buildGo116Module rec {
|
||||
pname = "matrix-media-repo";
|
||||
version = "1.2.12";
|
||||
src = fetchFromGitHub {
|
||||
owner = "turt2live";
|
||||
repo = pname;
|
||||
rev = "v${version}";
|
||||
sha256 = "1j6y7alr60mmj5h014qmpz9a5qjv8cm61andwdacb0dqjjbvsm0z";
|
||||
};
|
||||
patches = [
|
||||
./matrix-media-repo.patch
|
||||
];
|
||||
proxyVendor = true;
|
||||
vendorSha256 = "sha256-gb2inc/XlPAplVYQXmR77b3/5GsEZDg5v7D/FbZRQ7w=";
|
||||
nativeBuildInputs = [
|
||||
git
|
||||
];
|
||||
buildPhase = ''
|
||||
GOBIN=$PWD/bin go install -v ./cmd/compile_assets
|
||||
$PWD/bin/compile_assets
|
||||
GOBIN=$PWD/bin go install -ldflags "-X github.com/turt2live/matrix-media-repo/common/version.GitCommit=$(git rev-list -1 HEAD) -X github.com/turt2live/matrix-media-repo/common/version.Version=$(git describe --tags)" -v ./cmd/...
|
||||
'';
|
||||
installPhase = ''
|
||||
mkdir $out
|
||||
cp -rv bin $out
|
||||
'';
|
||||
}
|
File diff suppressed because it is too large
Load diff
|
@ -1,16 +0,0 @@
|
|||
{ buildGo118Module
|
||||
, fetchFromGitHub
|
||||
, olm
|
||||
}: buildGo118Module rec {
|
||||
pname = "mautrix-whatsapp";
|
||||
version = "0.4.0";
|
||||
src = fetchFromGitHub {
|
||||
owner = "mautrix";
|
||||
repo = "whatsapp";
|
||||
rev = "v${version}";
|
||||
sha256 = "sha256-2F0smK2L9Xj3/65j7vwwGT1OLxcTqkImpn16wB5rWDw=";
|
||||
};
|
||||
proxyVendor = true;
|
||||
vendorSha256 = "sha256-CuLlg7lynJNNkGhZEh+Un6Mx3whhcU4hHF0rCggo6h4=";
|
||||
buildInputs = [ olm ];
|
||||
}
|
|
@ -1,17 +0,0 @@
|
|||
miifox-net: { lndir, stdenvNoCC, python3Packages, ... }: stdenvNoCC.mkDerivation {
|
||||
name = "miifox.net";
|
||||
srcs = miifox-net;
|
||||
nativeBuildInputs = [
|
||||
python3Packages.chevron
|
||||
lndir
|
||||
];
|
||||
buildPhase = ''
|
||||
chevron -d index.json index.handlebars > index.html
|
||||
'';
|
||||
installPhase = ''
|
||||
mkdir $out
|
||||
lndir -silent ${miifox-net} $out
|
||||
cp index.html $out
|
||||
rm $out/index.json
|
||||
'';
|
||||
}
|
|
@ -1,37 +0,0 @@
|
|||
{ lib, stdenv, fetchurl, bash, openjdk17_headless }:
|
||||
let
|
||||
mcVersion = "1.18.2";
|
||||
buildNum = "332";
|
||||
jar = fetchurl {
|
||||
url = "https://papermc.io/api/v2/projects/paper/versions/${mcVersion}/builds/${buildNum}/downloads/paper-${mcVersion}-${buildNum}.jar";
|
||||
sha256 = "333f4a7d1d2048d222dc5a02e5c26871905f980ab6a7f394153b0818ebada49e";
|
||||
};
|
||||
in
|
||||
stdenv.mkDerivation {
|
||||
pname = "papermc";
|
||||
version = "${mcVersion}r${buildNum}";
|
||||
|
||||
preferLocalBuild = true;
|
||||
|
||||
dontUnpack = true;
|
||||
dontConfigure = true;
|
||||
|
||||
buildPhase = ''
|
||||
cat > minecraft-server << EOF
|
||||
#!${bash}/bin/sh
|
||||
exec ${openjdk17_headless}/bin/java \$@ -jar $out/share/papermc/papermc.jar nogui
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
install -Dm444 ${jar} $out/share/papermc/papermc.jar
|
||||
install -Dm555 -t $out/bin minecraft-server
|
||||
'';
|
||||
|
||||
meta = {
|
||||
description = "High-performance Minecraft Server";
|
||||
homepage = "https://papermc.io/";
|
||||
license = lib.licenses.gpl3Only;
|
||||
platforms = lib.platforms.unix;
|
||||
maintainers = with lib.maintainers; [ aaronjanse neonfuz ];
|
||||
};
|
||||
}
|
|
@ -1,6 +0,0 @@
|
|||
{ ... }: {
|
||||
homepage-old = builtins.fetchTarball {
|
||||
url = "https://static.darkkirb.de/homepage.tar.zst";
|
||||
sha256 = "1wf90kpb0ra0fy0msh1drmr4jjxw7c1q3ksqc9zfy04sjh6y5msg";
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue