diff options
author | Silvan Mosberger <contact@infinisil.com> | 2021-06-25 14:39:59 +0200 |
---|---|---|
committer | Silvan Mosberger <contact@infinisil.com> | 2021-06-25 14:39:59 +0200 |
commit | 33ffb05d390987802fe939f9c9a3d6a451076535 (patch) | |
tree | c871c34ba7d07b656e6a1985f5ba1b17e4d02fd5 /pkgs/build-support/writers/default.nix | |
parent | 370a10c27fc13f2b70dfee2284b30d6989b4336b (diff) | |
download | nixpkgs-33ffb05d390987802fe939f9c9a3d6a451076535.tar nixpkgs-33ffb05d390987802fe939f9c9a3d6a451076535.tar.gz nixpkgs-33ffb05d390987802fe939f9c9a3d6a451076535.tar.bz2 nixpkgs-33ffb05d390987802fe939f9c9a3d6a451076535.tar.lz nixpkgs-33ffb05d390987802fe939f9c9a3d6a451076535.tar.xz nixpkgs-33ffb05d390987802fe939f9c9a3d6a451076535.tar.zst nixpkgs-33ffb05d390987802fe939f9c9a3d6a451076535.zip |
writers: Allow string paths
Before this change, it was not possible to use string paths, because then the `types.str.check` would succeed. So the only paths that could be used were ones from the local filesystem via e.g. `./some/path`. We can easily fix this by using `types.path.check` instead to determine whether we are dealing with a path. This notably also allows using Nix-fetched sources as the content, e.g. `fetchFromGitHub { ... } + "/some/file"`
Diffstat (limited to 'pkgs/build-support/writers/default.nix')
-rw-r--r-- | pkgs/build-support/writers/default.nix | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/pkgs/build-support/writers/default.nix b/pkgs/build-support/writers/default.nix index 47919c251af..5a70bcbe3cf 100644 --- a/pkgs/build-support/writers/default.nix +++ b/pkgs/build-support/writers/default.nix @@ -15,12 +15,12 @@ rec { name = last (builtins.split "/" nameOrPath); in - pkgs.runCommandLocal name (if (types.str.check content) then { - inherit content interpreter; - passAsFile = [ "content" ]; - } else { + pkgs.runCommandLocal name (if types.path.check content then { inherit interpreter; contentPath = content; + } else { + inherit content interpreter; + passAsFile = [ "content" ]; }) '' # On darwin a script cannot be used as an interpreter in a shebang but # there doesn't seem to be a limit to the size of shebang and multiple |