about summary refs log tree commit diff
path: root/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'default.nix')
-rw-r--r--default.nix89
1 files changed, 71 insertions, 18 deletions
diff --git a/default.nix b/default.nix
index 0d08d7f26b66..e34734dc9e33 100644
--- a/default.nix
+++ b/default.nix
@@ -1,19 +1,72 @@
-{ nixpkgs ? import ./nixpkgs.nix {}
-, compiler ? "ghc865"
-, failOnWarnings ? false
-}:
+# This file sets up the top-level package set by traversing the package tree
+# (see read-tree.nix for details) and constructing a matching attribute set
+# tree.
+#
+# This makes packages accessible via the Nixery instance that is configured to
+# use this repository as its nixpkgs source.
+
+{ ... }@args:
+
+with builtins;
+
 let
-  inherit (nixpkgs) pkgs lib;
-  inherit (lib) id;
-  inherit (pkgs) fetchurl;
-  all-hies = import (fetchTarball {
-    url = "https://github.com/infinisil/all-hies/archive/4b6aab017cdf96a90641dc287437685675d598da.tar.gz";
-    sha256 = "0ap12mbzk97zmxk42fk8vqacyvpxk29r2wrnjqpx4m2w9g7gfdya";
-  }) {};
-  hie = all-hies.selection { selector = p: { inherit (p) ghc865; }; };
-  xanthous =
-    (if failOnWarnings then pkgs.haskell.lib.failOnAllWarnings else id)
-      ((pkgs.haskellPackages
-      .extend (import ./haskell-overlay.nix { inherit nixpkgs; })
-    ).callPackage (import ./pkg.nix { inherit nixpkgs; }) {}); in
-xanthous // { inherit hie; }
+  # This definition of fix is identical to <nixpkgs>.lib.fix, but the global
+  # package set is not available here.
+  fix = f: let x = f x; in x;
+
+  # Global configuration that all packages are called with.
+  config = depot: {
+    inherit depot;
+
+    # Pass third_party as 'pkgs' (for compatibility with external
+    # imports for certain subdirectories)
+    pkgs = depot.third_party;
+
+    kms = {
+      project = "tazjins-infrastructure";
+      region = "europe-north1";
+      keyring = "tazjins-keys";
+      key = "kontemplate-key";
+    };
+  };
+
+  readTree' = import ./nix/readTree {};
+
+  localPkgs = readTree: {
+    fun           = readTree ./fun;
+    lisp          = readTree ./lisp;
+    net           = readTree ./net;
+    nix           = readTree ./nix;
+    ops           = readTree ./ops;
+    presentations = readTree ./presentations;
+    third_party   = readTree ./third_party;
+    tools         = readTree ./tools;
+    users         = readTree ./users;
+    web           = readTree ./web;
+  };
+in fix(self: {
+  config = config self;
+
+  # Elevate 'lib' from nixpkgs
+  lib = import (self.third_party.nixpkgsSrc + "/lib");
+
+  # Expose readTree for downstream repo consumers.
+  readTree = {
+    __functor = x: (readTree' x.config);
+    config = self.config;
+  };
+
+  # Make the path to the depot available for things that might need it
+  # (e.g. NixOS module inclusions)
+  depotPath = ./.;
+}
+
+# Add local packages as structured by readTree
+// (localPkgs (readTree' (self.config // { inherit (self) lib; })))
+
+# Load overrides into the top-level.
+#
+# This can be used to move things from third_party into the top-level, too (such
+# as `lib`).
+// (readTree' { depot = self; pkgs = self.third_party; }) ./overrides
+)