diff options
author | Ismaël Bouya <ismael.bouya@normalesup.org> | 2021-08-23 01:50:09 +0200 |
---|---|---|
committer | Ismaël Bouya <ismael.bouya@normalesup.org> | 2021-08-24 00:49:51 +0200 |
commit | 5e2ec9fb8628136e7f9f618c68c0e42ab086b80e (patch) | |
tree | ee56ee4a49b7d48fc91e7baf34ca0158f9c64cff /flakes/peertube | |
parent | dfe02d8fd52e33c7d4e1a209cf486696100b88f3 (diff) | |
download | Nix-5e2ec9fb8628136e7f9f618c68c0e42ab086b80e.tar.gz Nix-5e2ec9fb8628136e7f9f618c68c0e42ab086b80e.tar.zst Nix-5e2ec9fb8628136e7f9f618c68c0e42ab086b80e.zip |
Refactor flakes using follows
Diffstat (limited to 'flakes/peertube')
-rw-r--r-- | flakes/peertube/client.nix | 6 | ||||
-rw-r--r-- | flakes/peertube/default.nix | 41 | ||||
-rw-r--r-- | flakes/peertube/flake.lock | 8 | ||||
-rw-r--r-- | flakes/peertube/flake.nix | 56 | ||||
-rw-r--r-- | flakes/peertube/server.nix | 6 |
5 files changed, 62 insertions, 55 deletions
diff --git a/flakes/peertube/client.nix b/flakes/peertube/client.nix index 06383a7..1501574 100644 --- a/flakes/peertube/client.nix +++ b/flakes/peertube/client.nix | |||
@@ -1,8 +1,8 @@ | |||
1 | { yarnModulesConfig, mkYarnModules', server, sources, version, nodejs, stdenv }: | 1 | { yarnModulesConfig, mkYarnModules', server, sources, nodejs, stdenv }: |
2 | rec { | 2 | rec { |
3 | modules = mkYarnModules' rec { | 3 | modules = mkYarnModules' rec { |
4 | pname = "peertube-client-yarn-modules"; | 4 | pname = "peertube-client-yarn-modules"; |
5 | inherit version; | 5 | inherit (sources) version; |
6 | name = "${pname}-${version}"; | 6 | name = "${pname}-${version}"; |
7 | packageJSON = "${sources}/client/package.json"; | 7 | packageJSON = "${sources}/client/package.json"; |
8 | yarnLock = "${sources}/client/yarn.lock"; | 8 | yarnLock = "${sources}/client/yarn.lock"; |
@@ -10,7 +10,7 @@ rec { | |||
10 | }; | 10 | }; |
11 | dist = stdenv.mkDerivation { | 11 | dist = stdenv.mkDerivation { |
12 | pname = "peertube-client"; | 12 | pname = "peertube-client"; |
13 | inherit version; | 13 | inherit (sources) version; |
14 | src = sources; | 14 | src = sources; |
15 | buildPhase = '' | 15 | buildPhase = '' |
16 | ln -s ${server.modules}/node_modules . | 16 | ln -s ${server.modules}/node_modules . |
diff --git a/flakes/peertube/default.nix b/flakes/peertube/default.nix new file mode 100644 index 0000000..8ba0c5f --- /dev/null +++ b/flakes/peertube/default.nix | |||
@@ -0,0 +1,41 @@ | |||
1 | { stdenv, lib, src, server, client }: | ||
2 | stdenv.mkDerivation rec { | ||
3 | inherit (src) version; | ||
4 | pname = "peertube"; | ||
5 | inherit src; | ||
6 | buildPhase = '' | ||
7 | ln -s ${server.modules}/node_modules . | ||
8 | rm -rf dist && cp -a ${server.dist}/dist dist | ||
9 | rm -rf client/dist && cp -a ${client.dist}/dist client/ | ||
10 | ''; | ||
11 | installPhase = '' | ||
12 | mkdir $out | ||
13 | cp -a * $out | ||
14 | ln -s /tmp $out/.cache | ||
15 | ''; | ||
16 | |||
17 | meta = { | ||
18 | description = "A free software to take back control of your videos"; | ||
19 | |||
20 | longDescription = '' | ||
21 | PeerTube aspires to be a decentralized and free/libre alternative to video | ||
22 | broadcasting services. | ||
23 | PeerTube is not meant to become a huge platform that would centralize | ||
24 | videos from all around the world. Rather, it is a network of | ||
25 | inter-connected small videos hosters. | ||
26 | Anyone with a modicum of technical skills can host a PeerTube server, aka | ||
27 | an instance. Each instance hosts its users and their videos. In this way, | ||
28 | every instance is created, moderated and maintained independently by | ||
29 | various administrators. | ||
30 | You can still watch from your account videos hosted by other instances | ||
31 | though if the administrator of your instance had previously connected it | ||
32 | with other instances. | ||
33 | ''; | ||
34 | |||
35 | license = lib.licenses.agpl3Plus; | ||
36 | |||
37 | homepage = "https://joinpeertube.org/"; | ||
38 | |||
39 | platforms = lib.platforms.unix; | ||
40 | }; | ||
41 | } | ||
diff --git a/flakes/peertube/flake.lock b/flakes/peertube/flake.lock index b6fc1d0..6187115 100644 --- a/flakes/peertube/flake.lock +++ b/flakes/peertube/flake.lock | |||
@@ -18,11 +18,11 @@ | |||
18 | "myuids": { | 18 | "myuids": { |
19 | "locked": { | 19 | "locked": { |
20 | "dir": "flakes/myuids", | 20 | "dir": "flakes/myuids", |
21 | "lastModified": 1611091761, | 21 | "lastModified": 1628207001, |
22 | "narHash": "sha256-fE3FBeUxVaMezKjEpepdQW9apOza+0AfBALFhaaD0VA=", | 22 | "narHash": "sha256-7e12OfDv9zMOfqcAlsk1sZj2l3ZB03kcBdWUqhwVaWo=", |
23 | "ref": "master", | 23 | "ref": "master", |
24 | "rev": "23f9fdf03a6673dbe334ae33be4f498cc4753191", | 24 | "rev": "dfe02d8fd52e33c7d4e1a209cf486696100b88f3", |
25 | "revCount": 802, | 25 | "revCount": 865, |
26 | "type": "git", | 26 | "type": "git", |
27 | "url": "https://git.immae.eu/perso/Immae/Config/Nix.git" | 27 | "url": "https://git.immae.eu/perso/Immae/Config/Nix.git" |
28 | }, | 28 | }, |
diff --git a/flakes/peertube/flake.nix b/flakes/peertube/flake.nix index 2a594c0..9a5c557 100644 --- a/flakes/peertube/flake.nix +++ b/flakes/peertube/flake.nix | |||
@@ -14,7 +14,6 @@ | |||
14 | 14 | ||
15 | outputs = { self, myuids, nixpkgs, peertube, flake-utils }: flake-utils.lib.eachSystem ["x86_64-linux"] (system: | 15 | outputs = { self, myuids, nixpkgs, peertube, flake-utils }: flake-utils.lib.eachSystem ["x86_64-linux"] (system: |
16 | let | 16 | let |
17 | version = (builtins.fromJSON (builtins.readFile ./flake.lock)).nodes.peertube.locked.rev; | ||
18 | pkgs = import nixpkgs { inherit system; overlays = [ | 17 | pkgs = import nixpkgs { inherit system; overlays = [ |
19 | (self: super: { nodejs = self.nodejs-12_x; }) | 18 | (self: super: { nodejs = self.nodejs-12_x; }) |
20 | ]; }; | 19 | ]; }; |
@@ -22,7 +21,7 @@ | |||
22 | 21 | ||
23 | patchedSource = stdenv.mkDerivation { | 22 | patchedSource = stdenv.mkDerivation { |
24 | pname = "peertube"; | 23 | pname = "peertube"; |
25 | inherit version; | 24 | version = peertube.rev; |
26 | src = peertube; | 25 | src = peertube; |
27 | phases = [ "unpackPhase" "patchPhase" "installPhase" ]; | 26 | phases = [ "unpackPhase" "patchPhase" "installPhase" ]; |
28 | patches = [ ./fix_yarn_lock.patch ]; | 27 | patches = [ ./fix_yarn_lock.patch ]; |
@@ -71,55 +70,16 @@ | |||
71 | }); | 70 | }); |
72 | 71 | ||
73 | server = callPackage ./server.nix { | 72 | server = callPackage ./server.nix { |
74 | inherit version yarnModulesConfig mkYarnModules'; | 73 | inherit yarnModulesConfig mkYarnModules'; |
75 | sources = patchedSource; | 74 | sources = patchedSource; |
76 | }; | 75 | }; |
77 | client = callPackage ./client.nix { | 76 | client = callPackage ./client.nix { |
78 | inherit server version yarnModulesConfig mkYarnModules'; | 77 | inherit server yarnModulesConfig mkYarnModules'; |
79 | sources = patchedSource; | 78 | sources = patchedSource; |
80 | }; | 79 | }; |
81 | 80 | ||
82 | in rec { | 81 | in rec { |
83 | packages.peertube = stdenv.mkDerivation rec { | 82 | packages.peertube = callPackage ./. { inherit server client; src = patchedSource; }; |
84 | inherit version; | ||
85 | pname = "peertube"; | ||
86 | src = patchedSource; | ||
87 | buildPhase = '' | ||
88 | ln -s ${server.modules}/node_modules . | ||
89 | rm -rf dist && cp -a ${server.dist}/dist dist | ||
90 | rm -rf client/dist && cp -a ${client.dist}/dist client/ | ||
91 | ''; | ||
92 | installPhase = '' | ||
93 | mkdir $out | ||
94 | cp -a * $out | ||
95 | ln -s /tmp $out/.cache | ||
96 | ''; | ||
97 | |||
98 | meta = { | ||
99 | description = "A free software to take back control of your videos"; | ||
100 | |||
101 | longDescription = '' | ||
102 | PeerTube aspires to be a decentralized and free/libre alternative to video | ||
103 | broadcasting services. | ||
104 | PeerTube is not meant to become a huge platform that would centralize | ||
105 | videos from all around the world. Rather, it is a network of | ||
106 | inter-connected small videos hosters. | ||
107 | Anyone with a modicum of technical skills can host a PeerTube server, aka | ||
108 | an instance. Each instance hosts its users and their videos. In this way, | ||
109 | every instance is created, moderated and maintained independently by | ||
110 | various administrators. | ||
111 | You can still watch from your account videos hosted by other instances | ||
112 | though if the administrator of your instance had previously connected it | ||
113 | with other instances. | ||
114 | ''; | ||
115 | |||
116 | license = stdenv.lib.licenses.agpl3Plus; | ||
117 | |||
118 | homepage = "https://joinpeertube.org/"; | ||
119 | |||
120 | platforms = stdenv.lib.platforms.unix; | ||
121 | }; | ||
122 | }; | ||
123 | defaultPackage = packages.peertube; | 83 | defaultPackage = packages.peertube; |
124 | legacyPackages.peertube = packages.peertube; | 84 | legacyPackages.peertube = packages.peertube; |
125 | checks = { | 85 | checks = { |
@@ -196,7 +156,13 @@ | |||
196 | }; | 156 | }; |
197 | }; | 157 | }; |
198 | } | 158 | } |
199 | ) // { | 159 | ) // rec { |
160 | overlays = { | ||
161 | peertube = final: prev: { | ||
162 | peertube = self.defaultPackage."${final.system}"; | ||
163 | }; | ||
164 | }; | ||
165 | overlay = overlays.peertube; | ||
200 | nixosModule = { lib, pkgs, config, ... }: | 166 | nixosModule = { lib, pkgs, config, ... }: |
201 | let | 167 | let |
202 | name = "peertube"; | 168 | name = "peertube"; |
diff --git a/flakes/peertube/server.nix b/flakes/peertube/server.nix index 1bba06d..26348cc 100644 --- a/flakes/peertube/server.nix +++ b/flakes/peertube/server.nix | |||
@@ -1,8 +1,8 @@ | |||
1 | { yarnModulesConfig, mkYarnModules', sources, version, nodejs, stdenv }: | 1 | { yarnModulesConfig, mkYarnModules', sources, nodejs, stdenv }: |
2 | rec { | 2 | rec { |
3 | modules = mkYarnModules' rec { | 3 | modules = mkYarnModules' rec { |
4 | pname = "peertube-server-yarn-modules"; | 4 | pname = "peertube-server-yarn-modules"; |
5 | inherit version; | 5 | inherit (sources) version; |
6 | name = "${pname}-${version}"; | 6 | name = "${pname}-${version}"; |
7 | packageJSON = "${sources}/package.json"; | 7 | packageJSON = "${sources}/package.json"; |
8 | yarnLock = "${sources}/yarn.lock"; | 8 | yarnLock = "${sources}/yarn.lock"; |
@@ -10,7 +10,7 @@ rec { | |||
10 | }; | 10 | }; |
11 | dist = stdenv.mkDerivation { | 11 | dist = stdenv.mkDerivation { |
12 | pname = "peertube-server"; | 12 | pname = "peertube-server"; |
13 | inherit version; | 13 | inherit (sources) version; |
14 | src = sources; | 14 | src = sources; |
15 | buildPhase = '' | 15 | buildPhase = '' |
16 | ln -s ${modules}/node_modules . | 16 | ln -s ${modules}/node_modules . |