forked from input-output-hk/daedalus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
lib.nix
33 lines (30 loc) · 1.11 KB
/
lib.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
{ nodeImplementation ? "cardano" }:
let
sources = import ./nix/sources.nix;
iohkNix = import sources.iohk-nix { sourcesOverride = sources; };
# TODO: can we use the filter in iohk-nix instead?
cleanSourceFilter = with pkgs.stdenv;
name: type: let baseName = baseNameOf (toString name); in ! (
# Filter out .git repo
(type == "directory" && baseName == ".git") ||
# Filter out editor backup / swap files.
lib.hasSuffix "~" baseName ||
builtins.match "^\\.sw[a-z]$" baseName != null ||
builtins.match "^\\..*\\.sw[a-z]$" baseName != null ||
# Filter out locally generated/downloaded things.
baseName == "dist" ||
baseName == "node_modules" ||
# Filter out the files which I'm editing often.
lib.hasSuffix ".nix" baseName ||
lib.hasSuffix ".dhall" baseName ||
lib.hasSuffix ".hs" baseName ||
# Filter out nix-build result symlinks
(type == "symlink" && lib.hasPrefix "result" baseName)
);
isDaedalus = name: false;
pkgs = iohkNix.pkgs;
lib = pkgs.lib;
in
lib // {
inherit sources iohkNix pkgs isDaedalus cleanSourceFilter;
}