]> git.immae.eu Git - perso/Immae/Config/Nix.git/blobdiff - flake.nix
Add flake skeletons
[perso/Immae/Config/Nix.git] / flake.nix
diff --git a/flake.nix b/flake.nix
new file mode 100644 (file)
index 0000000..cb3548f
--- /dev/null
+++ b/flake.nix
@@ -0,0 +1,61 @@
+{
+  description = "immae-eu infrastructure";
+  inputs = {
+    flake-parts.url = "github:hercules-ci/flake-parts";
+    # TODO: use nixos-unstable branch at some point and use the lock to keep the actual commit
+    nixpkgs.url = "github:nixos/nixpkgs/062a0c5437b68f950b081bbfc8a699d57a4ee026";
+
+    s-backports.url = "path:./flakes/backports";
+    s-copanier.url = "path:./flakes/copanier";
+    s-diaspora.url = "path:./flakes/diaspora";
+    s-etherpad-lite.url = "path:./flakes/etherpad-lite";
+    s-fiche.url = "path:./flakes/fiche";
+    s-files-watcher.url = "path:./flakes/files-watcher";
+    s-grocy.url = "path:./flakes/grocy";
+    s-lib.url = "path:./flakes/lib";
+    s-mastodon.url = "path:./flakes/mastodon";
+    s-mediagoblin.url = "path:./flakes/mediagoblin";
+    s-myuids.url = "path:./flakes/myuids";
+    s-openarc.url = "path:./flakes/openarc";
+    s-opendmarc.url = "path:./flakes/opendmarc";
+    s-paste.url = "path:./flakes/paste";
+    s-peertube.url = "path:./flakes/peertube";
+    s-rsync_backup.url = "path:./flakes/rsync_backup";
+    s-secrets.url = "path:./flakes/secrets";
+    s-surfer.url = "path:./flakes/surfer";
+    s-taskwarrior-web.url = "path:./flakes/taskwarrior-web";
+
+    s-private-buildbot.url = "path:./flakes/private/buildbot";
+    s-private-openarc.url = "path:./flakes/private/openarc";
+    s-private-opendmarc.url = "path:./flakes/private/opendmarc";
+    s-private-paste.url = "path:./flakes/private/paste";
+    s-private-peertube.url = "path:./flakes/private/peertube";
+    s-private-php.url = "path:./flakes/private/php";
+
+    mypackages.url = "path:./flakes/mypackages";
+  };
+  outputs = inputs@{ self, flake-parts, mypackages, ... }:
+    flake-parts.lib.mkFlake { inherit inputs; } {
+      imports = [
+        (mypackages.mylibs.flakePartsAddPerSystem { name = "lib"; type = "unspecified"; })
+        (mypackages.mylibs.flakePartsAddPerSystem { name = "environments"; type = "package"; })
+      ];
+      systems = [ "x86_64-linux" ];
+      perSystem = { config, inputs', pkgs, ... }:
+        {
+          inherit (inputs'.mypackages) packages environments lib;
+        };
+      flake = {
+        inherit (mypackages) mylibs sources overlays;
+        subflakes = let
+          flakeNames = builtins.map (a: builtins.substring 2 (builtins.stringLength a) a) (builtins.filter (a: builtins.substring 0 2 a == "s-") (builtins.attrNames inputs));
+          partitionned = builtins.partition (a: builtins.substring 0 8 a == "private-") flakeNames;
+          privateFlakes = builtins.map (a: builtins.substring 8 (builtins.stringLength a) a) partitionned.right;
+          publicFlakes = partitionned.wrong;
+        in {
+          public = builtins.foldl' (a: b: a // { "${b}" = inputs."s-${b}"; }) {} publicFlakes;
+          private = builtins.foldl' (a: b: a // { "${b}" = inputs."s-private-${b}"; }) {} privateFlakes;
+        };
+      };
+    };
+}