outputs = { self, myuids, nixpkgs, peertube, flake-utils }: flake-utils.lib.eachSystem ["x86_64-linux"] (system:
let
- version = (builtins.fromJSON (builtins.readFile ./flake.lock)).nodes.peertube.locked.rev;
pkgs = import nixpkgs { inherit system; overlays = [
(self: super: { nodejs = self.nodejs-12_x; })
]; };
patchedSource = stdenv.mkDerivation {
pname = "peertube";
- inherit version;
+ version = peertube.rev;
src = peertube;
phases = [ "unpackPhase" "patchPhase" "installPhase" ];
patches = [ ./fix_yarn_lock.patch ];
});
server = callPackage ./server.nix {
- inherit version yarnModulesConfig mkYarnModules';
+ inherit yarnModulesConfig mkYarnModules';
sources = patchedSource;
};
client = callPackage ./client.nix {
- inherit server version yarnModulesConfig mkYarnModules';
+ inherit server yarnModulesConfig mkYarnModules';
sources = patchedSource;
};
in rec {
- packages.peertube = stdenv.mkDerivation rec {
- inherit version;
- pname = "peertube";
- src = patchedSource;
- buildPhase = ''
- ln -s ${server.modules}/node_modules .
- rm -rf dist && cp -a ${server.dist}/dist dist
- rm -rf client/dist && cp -a ${client.dist}/dist client/
- '';
- installPhase = ''
- mkdir $out
- cp -a * $out
- ln -s /tmp $out/.cache
- '';
-
- meta = {
- description = "A free software to take back control of your videos";
-
- longDescription = ''
- PeerTube aspires to be a decentralized and free/libre alternative to video
- broadcasting services.
- PeerTube is not meant to become a huge platform that would centralize
- videos from all around the world. Rather, it is a network of
- inter-connected small videos hosters.
- Anyone with a modicum of technical skills can host a PeerTube server, aka
- an instance. Each instance hosts its users and their videos. In this way,
- every instance is created, moderated and maintained independently by
- various administrators.
- You can still watch from your account videos hosted by other instances
- though if the administrator of your instance had previously connected it
- with other instances.
- '';
-
- license = stdenv.lib.licenses.agpl3Plus;
-
- homepage = "https://joinpeertube.org/";
-
- platforms = stdenv.lib.platforms.unix;
- };
- };
+ packages.peertube = callPackage ./. { inherit server client; src = patchedSource; };
defaultPackage = packages.peertube;
legacyPackages.peertube = packages.peertube;
checks = {
};
};
}
- ) // {
+ ) // rec {
+ overlays = {
+ peertube = final: prev: {
+ peertube = self.defaultPackage."${final.system}";
+ };
+ };
+ overlay = overlays.peertube;
nixosModule = { lib, pkgs, config, ... }:
let
name = "peertube";
- cfg = config.services.peertube;
+ cfg = config.immaeServices.peertube;
in
{
- options.services.peertube = {
+ options.immaeServices.peertube = {
enable = lib.mkEnableOption "Enable Peertube’s service";
user = lib.mkOption {
type = lib.types.str;
};
package = lib.mkOption {
type = lib.types.package;
- default = self.defaultPackage."${pkgs.system}";
+ default = pkgs.peertube;
description = ''
Peertube package to use.
'';
};
config = lib.mkIf cfg.enable {
+ nixpkgs.overlays = [ self.overlay ];
users.users = lib.optionalAttrs (cfg.user == name) {
"${name}" = {
uid = myuids.lib.uids.peertube;