Avoid lib.or in pkgs/build-support/writers/
This commit is contained in:
parent
18d2b24a84
commit
dc59ca2bd9
@ -30,7 +30,7 @@ in
|
|||||||
```
|
```
|
||||||
*/
|
*/
|
||||||
makeDataWriter = lib.warn "pkgs.writers.makeDataWriter is deprecated. Use pkgs.writeTextFile." ({ input ? lib.id, output ? "cp $inputPath $out" }: nameOrPath: data:
|
makeDataWriter = lib.warn "pkgs.writers.makeDataWriter is deprecated. Use pkgs.writeTextFile." ({ input ? lib.id, output ? "cp $inputPath $out" }: nameOrPath: data:
|
||||||
assert lib.or (types.path.check nameOrPath) (builtins.match "([0-9A-Za-z._])[0-9A-Za-z._-]*" nameOrPath != null);
|
assert (types.path.check nameOrPath) || (builtins.match "([0-9A-Za-z._])[0-9A-Za-z._-]*" nameOrPath != null);
|
||||||
let
|
let
|
||||||
name = last (builtins.split "/" nameOrPath);
|
name = last (builtins.split "/" nameOrPath);
|
||||||
in
|
in
|
||||||
|
|||||||
@ -19,8 +19,8 @@ rec {
|
|||||||
# writeBash = makeScriptWriter { interpreter = "${pkgs.bash}/bin/bash"; }
|
# writeBash = makeScriptWriter { interpreter = "${pkgs.bash}/bin/bash"; }
|
||||||
# makeScriptWriter { interpreter = "${pkgs.dash}/bin/dash"; } "hello" "echo hello world"
|
# makeScriptWriter { interpreter = "${pkgs.dash}/bin/dash"; } "hello" "echo hello world"
|
||||||
makeScriptWriter = { interpreter, check ? "" }: nameOrPath: content:
|
makeScriptWriter = { interpreter, check ? "" }: nameOrPath: content:
|
||||||
assert lib.or (types.path.check nameOrPath) (builtins.match "([0-9A-Za-z._])[0-9A-Za-z._-]*" nameOrPath != null);
|
assert (types.path.check nameOrPath) || (builtins.match "([0-9A-Za-z._])[0-9A-Za-z._-]*" nameOrPath != null);
|
||||||
assert lib.or (types.path.check content) (types.str.check content);
|
assert (types.path.check content) || (types.str.check content);
|
||||||
let
|
let
|
||||||
name = last (builtins.split "/" nameOrPath);
|
name = last (builtins.split "/" nameOrPath);
|
||||||
in
|
in
|
||||||
@ -82,8 +82,8 @@ rec {
|
|||||||
# Examples:
|
# Examples:
|
||||||
# writeSimpleC = makeBinWriter { compileScript = name: "gcc -o $out $contentPath"; }
|
# writeSimpleC = makeBinWriter { compileScript = name: "gcc -o $out $contentPath"; }
|
||||||
makeBinWriter = { compileScript, strip ? true }: nameOrPath: content:
|
makeBinWriter = { compileScript, strip ? true }: nameOrPath: content:
|
||||||
assert lib.or (types.path.check nameOrPath) (builtins.match "([0-9A-Za-z._])[0-9A-Za-z._-]*" nameOrPath != null);
|
assert (types.path.check nameOrPath) || (builtins.match "([0-9A-Za-z._])[0-9A-Za-z._-]*" nameOrPath != null);
|
||||||
assert lib.or (types.path.check content) (types.str.check content);
|
assert (types.path.check content) || (types.str.check content);
|
||||||
let
|
let
|
||||||
name = last (builtins.split "/" nameOrPath);
|
name = last (builtins.split "/" nameOrPath);
|
||||||
in
|
in
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user