]> git.immae.eu Git - perso/Immae/Config/Nix.git/blobdiff - flakes/peertube/flake.nix
Refactor flakes using follows
[perso/Immae/Config/Nix.git] / flakes / peertube / flake.nix
index 2a594c0ea8be099325532059b96d5de56aba91c8..9a5c55746353b1c32d3ef5eadfa806c8f62d8370 100644 (file)
@@ -14,7 +14,6 @@
 
   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; })
       ]; };
@@ -22,7 +21,7 @@
 
       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";