diff --git a/default.nix b/default.nix index 68fc3b2..ec64995 100644 --- a/default.nix +++ b/default.nix @@ -6,29 +6,36 @@ let let newSrc = lib.cleanSourceWith { filter = f: t: true; src = ./.; }; in (builtins.functionArgs lib.cleanSourceWith) ? name || newSrc ? name; -in -{ - inherit (find-files) gitignoreFilter; - gitignoreSource = if newCleanSourceWith then - path: - let - origPath = path.origPath or path; - in - lib.cleanSourceWith { - name = "source"; - filter = find-files.gitignoreFilter origPath; - src = path; - } + path: gitignoreSourceWith { inherit path; } else path: if path ? _isLibCleanSourceWith then builtins.abort "Sorry, please update your Nixpkgs to 19.09 or master if you want to use gitignoreSource on cleanSourceWith" - else builtins.path { + else lib.warn "You are using gitignore.nix with an old version of Nixpkgs that is not supported." (builtins.path { name = "source"; filter = find-files.gitignoreFilter path; inherit path; - }; + }); + + gitignoreSourceWith = { path }: + lib.cleanSourceWith { + name = "source"; + filter = find-files.gitignoreFilterWith { basePath = path.origPath or path; }; + src = path; + }; + +in +{ + inherit (find-files) + gitignoreFilter + gitignoreFilterWith + ; + inherit + gitignoreSource + gitignoreSourceWith + ; + } diff --git a/find-files.nix b/find-files.nix index ceccc65..09018db 100644 --- a/find-files.nix +++ b/find-files.nix @@ -18,6 +18,9 @@ rec { # TODO: write test for trailing slash (matches dir only) gitignoreFilter = basePath: + gitignoreFilterWith { inherit basePath; }; + + gitignoreFilterWith = { basePath }: let patternsBelowP = findPatternsTree basePath; basePathStr = toString basePath; diff --git a/nix/ci.nix b/nix/ci.nix index 70de687..c574b1a 100644 --- a/nix/ci.nix +++ b/nix/ci.nix @@ -7,6 +7,7 @@ let dimension "Nixpkgs" { "nixpkgs-19_03" = sources."nixos-19.03"; "nixpkgs-19_09" = sources."nixos-19.09"; + "nixpkgs-21_05" = sources."nixos-21.05"; } (_key: nixpkgs: import ../tests/default.nix { pkgs = import ./default.nix { inherit nixpkgs; }; } ) diff --git a/nix/sources.json b/nix/sources.json index 6c2cc8f..56cbf2a 100644 --- a/nix/sources.json +++ b/nix/sources.json @@ -35,6 +35,18 @@ "url": "https://github.com/NixOS/nixpkgs-channels/archive/e6b068cd952e4640d416c2ccd62587d8a35cd774.tar.gz", "url_template": "https://github.com///archive/.tar.gz" }, + "nixos-21.05": { + "branch": "nixos-21.05", + "description": "Nix Packages collection", + "homepage": "", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "3b1789322fcbcb5cf51228d732752714f1bf77da", + "sha256": "0m6gcl2pzvicwbflsvmccdyf03ki1zl3d9dl8rn8hj1gdgssj6vr", + "type": "tarball", + "url": "https://github.com/NixOS/nixpkgs/archive/3b1789322fcbcb5cf51228d732752714f1bf77da.tar.gz", + "url_template": "https://github.com///archive/.tar.gz" + }, "nixpkgs": { "branch": "nixos-19.03", "description": "Nixpkgs/NixOS branches that track the Nixpkgs/NixOS channels",