summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2018-10-31 18:24:57 +0100
committertv <tv@krebsco.de>2018-10-31 18:26:05 +0100
commit170c46d53c83c9bf277b7b6dba7e86c052eae257 (patch)
tree6096523faac3e0c9d477458b547f7a6b3bebb345
parente2b29654251367545700154ffbac806705dd04c0 (diff)
populate git: add clean.exclude
-rw-r--r--README.md2
-rw-r--r--lib/default.nix1
-rw-r--r--lib/types/populate.nix6
-rw-r--r--pkgs/populate/default.nix5
4 files changed, 12 insertions, 2 deletions
diff --git a/README.md b/README.md
index 2f49627..e455456 100644
--- a/README.md
+++ b/README.md
@@ -26,9 +26,9 @@ let
source = lib.evalSource [{
nixpkgs.git = {
+ clean.exclude = ["/.version-suffix"];
ref = "4b4bbce199d3b3a8001ee93495604289b01aaad3";
url = https://github.com/NixOS/nixpkgs;
-
};
nixos-config.file = toString (pkgs.writeText "nixos-config" ''
{ pkgs, ... }: {
diff --git a/lib/default.nix b/lib/default.nix
index 3ebefdc..cf57316 100644
--- a/lib/default.nix
+++ b/lib/default.nix
@@ -16,6 +16,7 @@ let {
};
};
sanitize = x: lib.getAttr (lib.typeOf x) {
+ list = map sanitize x;
set = lib.mapAttrs
(lib.const sanitize)
(lib.filterAttrs
diff --git a/lib/types/populate.nix b/lib/types/populate.nix
index 3b13df0..f35786d 100644
--- a/lib/types/populate.nix
+++ b/lib/types/populate.nix
@@ -56,6 +56,12 @@
};
git = lib.types.submodule {
options = {
+ clean = {
+ exclude = lib.mkOption {
+ default = [];
+ type = lib.types.listOf lib.types.str;
+ };
+ };
ref = lib.mkOption {
type = lib.types.str; # TODO lib.types.git.ref
};
diff --git a/pkgs/populate/default.nix b/pkgs/populate/default.nix
index d8c1510..d5ff9a1 100644
--- a/pkgs/populate/default.nix
+++ b/pkgs/populate/default.nix
@@ -45,7 +45,10 @@ let
git submodule update --init --recursive
fi
- git clean -dfx
+ git clean -dfx \
+ ${concatMapStringsSep " "
+ (pattern: /* sh */ "-e ${quote pattern}")
+ source.clean.exclude }
'';
pop.pass = target: source: let