diff options
author | Ismaël Bouya <ismael.bouya@normalesup.org> | 2023-10-04 01:35:06 +0200 |
---|---|---|
committer | Ismaël Bouya <ismael.bouya@normalesup.org> | 2023-10-04 02:11:48 +0200 |
commit | 1a64deeb894dc95e2645a75771732c6cc53a79ad (patch) | |
tree | 1b9df4838f894577a09b9b260151756272efeb53 /flakes/private/chatons | |
parent | fa25ffd4583cc362075cd5e1b4130f33306103f0 (diff) | |
download | Nix-1a64deeb894dc95e2645a75771732c6cc53a79ad.tar.gz Nix-1a64deeb894dc95e2645a75771732c6cc53a79ad.tar.zst Nix-1a64deeb894dc95e2645a75771732c6cc53a79ad.zip |
Squash changes containing private information
There were a lot of changes since the previous commit, but a lot of them
contained personnal information about users. All thos changes got
stashed into a single commit (history is kept in a different place) and
private information was moved in a separate private repository
Diffstat (limited to 'flakes/private/chatons')
-rw-r--r-- | flakes/private/chatons/flake.lock | 23 | ||||
-rw-r--r-- | flakes/private/chatons/flake.nix | 142 |
2 files changed, 165 insertions, 0 deletions
diff --git a/flakes/private/chatons/flake.lock b/flakes/private/chatons/flake.lock new file mode 100644 index 0000000..39ed484 --- /dev/null +++ b/flakes/private/chatons/flake.lock | |||
@@ -0,0 +1,23 @@ | |||
1 | { | ||
2 | "nodes": { | ||
3 | "environment": { | ||
4 | "locked": { | ||
5 | "lastModified": 1, | ||
6 | "narHash": "sha256-rMKbM7fHqWQbI7y59BsPG8KwoDj2jyrvN2niPWB24uE=", | ||
7 | "path": "../environment", | ||
8 | "type": "path" | ||
9 | }, | ||
10 | "original": { | ||
11 | "path": "../environment", | ||
12 | "type": "path" | ||
13 | } | ||
14 | }, | ||
15 | "root": { | ||
16 | "inputs": { | ||
17 | "environment": "environment" | ||
18 | } | ||
19 | } | ||
20 | }, | ||
21 | "root": "root", | ||
22 | "version": 7 | ||
23 | } | ||
diff --git a/flakes/private/chatons/flake.nix b/flakes/private/chatons/flake.nix new file mode 100644 index 0000000..70fb02d --- /dev/null +++ b/flakes/private/chatons/flake.nix | |||
@@ -0,0 +1,142 @@ | |||
1 | { | ||
2 | inputs.environment.url = "path:../environment"; | ||
3 | outputs = { self, environment }: { | ||
4 | nixosModule = self.nixosModules.chatons; | ||
5 | nixosModules.chatons = { config, lib, pkgs, nodes, ... }: | ||
6 | let | ||
7 | concatValue = value: if lib.isList value then builtins.concatStringsSep "," value else builtins.toString value; | ||
8 | toProperties = properties: builtins.concatStringsSep "\n" ( | ||
9 | lib.collect | ||
10 | (p: !(lib.isAttrs p)) | ||
11 | (lib.mapAttrsRecursive | ||
12 | (path: value: builtins.concatStringsSep "." (builtins.filter (f: f != "") path) + " = " + (concatValue value)) | ||
13 | properties)); | ||
14 | before = name: { | ||
15 | "${name}" = { | ||
16 | status.level = "OK"; | ||
17 | status.description = "OK"; | ||
18 | install.type = "PACKAGE"; | ||
19 | registration.load = "OPEN"; | ||
20 | }; | ||
21 | host = { | ||
22 | name = "Hetzner"; | ||
23 | server.type = "PHYSICAL"; | ||
24 | provider.type = "HOSTEDSERVER"; | ||
25 | server.distribution = "NixOS"; | ||
26 | country.name = "Allemagne"; | ||
27 | country.code = "DE"; | ||
28 | }; | ||
29 | }; | ||
30 | after = name: { | ||
31 | file = { | ||
32 | class = name; | ||
33 | protocol = "ChatonsInfos-0.5"; | ||
34 | generator = "Nix derivation"; | ||
35 | }; | ||
36 | "${name}" = { | ||
37 | legal.url = "https://www.immae.eu/mentions.html"; | ||
38 | guide.technical = "https://git.immae.eu/cgit/perso/Immae/Config/Nix.git/"; | ||
39 | contact.url = "https://www.immae.eu/contacts_fr.html"; | ||
40 | contact.email = config.myEnv.tools.contact; | ||
41 | startdate = "01/01/2019"; | ||
42 | }; | ||
43 | }; | ||
44 | organization = { | ||
45 | file = { | ||
46 | class = "organization"; | ||
47 | protocol = "ChatonsInfos-0.5"; | ||
48 | datetime = "2021-01-11T22:23:00"; | ||
49 | generator = "Nix derivation"; | ||
50 | }; | ||
51 | organization = { | ||
52 | country.name = "France"; | ||
53 | country.code = "FR"; | ||
54 | name = "ImmaeEu"; | ||
55 | description = "ImmaeEu est un CHATONS des Alpes-Maritimes"; | ||
56 | website = "https://www.immae.eu"; | ||
57 | logo = "https://assets.immae.eu/logo.jpg"; | ||
58 | socialnetworks = { | ||
59 | diaspora = "https://diaspora.immae.eu/people/1a185f29cc76cb35"; | ||
60 | facebook = "https://www.facebook.com/ismael.bouya"; | ||
61 | mastodon = "https://mastodon.immae.eu/@immae"; | ||
62 | peertube = "https://peertube.immae.eu/accounts/immae/"; | ||
63 | twitter = "https://twitter.com/_immae"; | ||
64 | }; | ||
65 | chatrooms = { | ||
66 | xmpp = "ismael@immae.fr"; | ||
67 | irc = "immae@freenode"; | ||
68 | matrix = "#support:immae.eu"; | ||
69 | }; | ||
70 | contact.url = "https://www.immae.eu/contacts_fr.html"; | ||
71 | contact.email = config.myEnv.tools.contact; | ||
72 | legal.url = "https://www.immae.eu/mentions.html"; | ||
73 | guide.technical = "https://git.immae.eu/cgit/perso/Immae/Config/Nix.git/"; | ||
74 | guide.user = "https://www.immae.eu/docs"; | ||
75 | status.level = "ACTIVE"; | ||
76 | status.description = "En activité"; | ||
77 | startdate = "01/01/2019"; | ||
78 | type = "COMPANY"; | ||
79 | owner = { | ||
80 | logo = "https://assets.immae.eu/logo.jpg"; | ||
81 | name = "Ismaël Bouya"; | ||
82 | website = "https://www.immae.eu"; | ||
83 | }; | ||
84 | memberof.chatons = { | ||
85 | startdate = "01/07/2019"; | ||
86 | status.level = "ACTIVE"; | ||
87 | status.description = "Participe au collectif"; | ||
88 | }; | ||
89 | }; | ||
90 | }; | ||
91 | subname = v: if v.published or true then "subs" else "subs-hidden"; | ||
92 | toOrganizationProperties = name: pkgs.writeText name (toProperties organization + "\n" + ( | ||
93 | builtins.concatStringsSep "\n" (lib.mapAttrsToList | ||
94 | (n: v: "${subname v}.${n} = https://www.immae.eu/.well-known/chatonsinfos/service-${n}.properties") mergedServices | ||
95 | )) + "\n" + ( | ||
96 | builtins.concatStringsSep "\n" (lib.mapAttrsToList | ||
97 | (n: v: "subs.hosting-${n} = https://www.immae.eu/.well-known/chatonsinfos/hosting-${n}.properties") mergedHostings | ||
98 | ))); | ||
99 | toHostingProperties = name: content: pkgs.writeText name (toProperties (lib.recursiveUpdate (before "hosting") (lib.recursiveUpdate content (after "hosting")))); | ||
100 | toServiceProperties = name: content: pkgs.writeText name (toProperties (lib.recursiveUpdate (before "service") (lib.recursiveUpdate content (after "service")))); | ||
101 | |||
102 | cfg = config.myServices.chatonsProperties; | ||
103 | mergedServices = lib.foldr (v: o: lib.recursiveUpdate o v) {} (lib.mapAttrsToList (k: v: if (v.config.myServices or {}) ? "chatonsProperties" then v.config.myServices.chatonsProperties.services else {}) nodes); | ||
104 | mergedHostings = lib.foldr (v: o: lib.recursiveUpdate o v) {} (lib.mapAttrsToList (k: v: if (v.config.myServices or {}) ? "chatonsProperties" then v.config.myServices.chatonsProperties.hostings else {}) nodes); | ||
105 | in { | ||
106 | imports = [ | ||
107 | environment.nixosModule | ||
108 | ]; | ||
109 | options.myServices.chatonsProperties.organization = lib.mkOption { | ||
110 | type = lib.types.attrsOf lib.types.unspecified; | ||
111 | default = {}; | ||
112 | description = '' | ||
113 | nested attrs of strings or arrays of strings | ||
114 | ''; | ||
115 | }; | ||
116 | options.myServices.chatonsProperties.services = lib.mkOption { | ||
117 | type = lib.types.attrsOf lib.types.unspecified; | ||
118 | default = {}; | ||
119 | description = '' | ||
120 | nested attrs of strings or arrays of strings | ||
121 | ''; | ||
122 | }; | ||
123 | options.myServices.chatonsProperties.hostings = lib.mkOption { | ||
124 | type = lib.types.attrsOf lib.types.unspecified; | ||
125 | default = {}; | ||
126 | description = '' | ||
127 | nested attrs of strings or arrays of strings | ||
128 | ''; | ||
129 | }; | ||
130 | options.myServices.chatonsProperties.propertiesPath = lib.mkOption { | ||
131 | type = lib.types.package; | ||
132 | readOnly = true; | ||
133 | default = pkgs.runCommand "chatons" {} '' | ||
134 | mkdir -p $out | ||
135 | cp ${toOrganizationProperties "immae-eu"} $out/immae-eu.properties | ||
136 | ${builtins.concatStringsSep "\n" (lib.mapAttrsToList (n: c: "cp ${toHostingProperties n c} $out/hosting-${n}.properties") mergedHostings)} | ||
137 | ${builtins.concatStringsSep "\n" (lib.mapAttrsToList (n: c: "cp ${toServiceProperties n c} $out/service-${n}.properties") mergedServices)} | ||
138 | ''; | ||
139 | }; | ||
140 | }; | ||
141 | }; | ||
142 | } | ||