From 4de6aaea5dd3689ba27258798b7fa92d88eea257 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Fri, 23 Feb 2018 18:26:47 -0500 Subject: [PATCH] Allow `*.nix` just within subdirectories --- default.nix | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/default.nix b/default.nix index d88c89e..353b97e 100644 --- a/default.nix +++ b/default.nix @@ -1,7 +1,20 @@ { pkgs ? import {}, revCount, shortRev }: let lib = pkgs.lib; - sources = lib.sourceFilesBySuffices ./. [ ".xml" ".txt" ]; + + sources = let + + # We want nix examples, but not the top level nix to build things + noTopLevelNix = path: type: let + relPath = lib.removePrefix (toString ./. + "/") (toString path); + in builtins.match "[^/]*\.nix" relPath == null; + + extensions = [ ".xml" ".txt" ".nix" ".bash" ]; + + in lib.cleanSourceWith { + filter = noTopLevelNix; + src = lib.sourceFilesBySuffices ./. extensions; + }; combined = pkgs.runCommand "nix-pills-combined" {