about summary refs log tree commit diff
path: root/default.nix
diff options
context:
space:
mode:
authorWilliam Carroll <wpcarro@gmail.com>2020-08-28T17·14+0100
committerWilliam Carroll <wpcarro@gmail.com>2020-08-28T17·14+0100
commit2715591c970b6318c970a12919cc3f1c0e1e889d (patch)
tree407fb8806150b85f6db166fc4f39153ff0e56bda /default.nix
parent9c820e663ff07145f34637facd6a018e753e50b4 (diff)
Call readTree on all top-level, visible directories in briefcase
Instead of manually maintaining the list of directories that I expose to
readTree, I'm using `builtins.readDir` to get a list of all non-hidden top-level
directories.
Diffstat (limited to 'default.nix')
-rw-r--r--default.nix49
1 files changed, 25 insertions, 24 deletions
diff --git a/default.nix b/default.nix
index 0df52cce6a..dca6dea16c 100644
--- a/default.nix
+++ b/default.nix
@@ -1,32 +1,33 @@
 { ... }:
 
 let
-  depot = import (builtins.fetchGit {
+  inherit (builtins) fetchGit readDir path;
+  inherit (pkgs.lib) filterAttrs mapAttrs;
+  inherit (pkgs.lib.strings) hasPrefix;
+
+  briefcasePath = path {
+    path = ./.;
+    name = "briefcase";
+  };
+
+  depot = import (fetchGit {
     url = "https://cl.tvl.fyi/depot";
     rev = "a2e86152401c7c531801c79347c3f15e1806aabc";
   }) {};
+
+  pkgs = import (fetchGit {
+    url = "https://github.com/NixOS/nixpkgs-channels";
+    ref = "nixos-20.03";
+    rev = "afa9ca61924f05aacfe495a7ad0fd84709d236cc";
+  }) {};
+
+  briefcase = import briefcasePath {};
+
   readTree = depot.nix.readTree {
-    pkgs = import (builtins.fetchGit {
-      url = "https://github.com/NixOS/nixpkgs-channels";
-      ref = "nixos-20.03";
-      rev = "afa9ca61924f05aacfe495a7ad0fd84709d236cc";
-    }) {};
-    briefcase = import (builtins.path {
-      path = ./.;
-      name = "briefcase";
-    }) {};
-    depot = depot;
+    inherit depot pkgs briefcase;
   };
-in {
-  ci           = readTree ./ci;
-  nixos        = readTree ./nixos;
-  utils        = readTree ./utils;
-  emacs        = readTree ./emacs;
-  website      = readTree ./website;
-  lisp         = readTree ./lisp;
-  gopkgs       = readTree ./gopkgs;
-  third_party  = readTree ./third_party;
-  tools        = readTree ./tools;
-  buildHaskell = readTree ./buildHaskell;
-  zoo          = readTree ./zoo;
-}
+in mapAttrs
+  (name: _: readTree (./. + "/${name}"))
+  (filterAttrs
+    (name: type: type == "directory" && !hasPrefix "." name)
+    (readDir briefcasePath))