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.
This commit is contained in:
William Carroll 2020-08-28 18:14:22 +01:00
parent 9c820e663f
commit 2715591c97

View file

@ -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))