diff options
author | William Carroll <wpcarro@gmail.com> | 2020-08-28T17·14+0100 |
---|---|---|
committer | William Carroll <wpcarro@gmail.com> | 2020-08-28T17·14+0100 |
commit | 2715591c970b6318c970a12919cc3f1c0e1e889d (patch) | |
tree | 407fb8806150b85f6db166fc4f39153ff0e56bda | |
parent | 9c820e663ff07145f34637facd6a018e753e50b4 (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.
-rw-r--r-- | default.nix | 49 |
1 files changed, 25 insertions, 24 deletions
diff --git a/default.nix b/default.nix index 0df52cce6a79..dca6dea16c23 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)) |