Commit Graph

85 Commits

Author SHA1 Message Date
Alexander Sieg
3b0ba6a6e1
writers.*: use lib.makeBinPath in documentation
This also fixes a syntax error with `,` being used as a array element
separator.
2024-08-26 12:19:19 +02:00
Sigmanificient
f03b7856a6 makePythonWriter: add doCheck toggle 2024-08-21 19:17:36 +02:00
Philip Taron
661aa513a1
writers: remove with statements from aliases 2024-08-18 06:31:14 -07:00
lassulus
4b3c31b884
Merge pull request #334776 from aos/aos/update-writepy3-example
fix: Update writePython3Bin docs
2024-08-15 07:42:45 +02:00
Aos Dabbagh
55e4114fb3 fix: Update writePython3Bin docs
Was trying out the recommended example for `writePython3Bin` and it
failed with:
```
Traceback (most recent call last):
  File "/nix/store/gcmhfm7mslpndjasfhvs66f1ca24vxim-test_py3/bin/test_py3", line 4, in <module>
    y = yaml.load("""
TypeError: load() missing 1 required positional argument: 'Loader'
```

Looks like `yaml.load(input)` was deprecated in 5.1: https://msg.pyyaml.org/load

`nixos-24.05` uses `6.0.1` so we're in the clear.
2024-08-15 00:57:39 -04:00
Philip Taron
989f10d419
pkgs.writers: improve documentation on {makeScriptWriter,makeScriptWriterBin} 2024-08-12 08:42:11 -07:00
Johannes Kirschbauer
85a8d22290
Pkgs.writers: document {makeScriptWriter,makeScriptWriterBin} 2024-08-09 14:13:02 +02:00
Sandro Jäckel
2040dfa812
uglify-js: remove remaining aliases, entry from nodePackages 2024-07-03 21:25:54 +02:00
Alexis Hildebrandt
755b915a15 treewide: Remove indefinite article from meta.description
nix run nixpkgs#silver-searcher -- -G '\.nix$' -0l 'description.*"[Aa]n?' pkgs \
  | xargs -0 nix run nixpkgs#gnused -- -i '' -Ee 's/(description.*")[Aa]n? (.)/\1\U\2/'
2024-06-09 23:07:45 +02:00
Philip Taron
efb603b277 Avoid top-level with ...; in pkgs/build-support/writers/test.nix 2024-03-19 22:31:19 +01:00
annalee
636ed70ab3
Merge remote-tracking branch 'upstream/staging-next' into staging 2024-03-16 00:07:22 +00:00
Philip Taron
dc59ca2bd9
Avoid lib.or in pkgs/build-support/writers/ 2024-03-14 14:11:11 -07:00
DavHau
9a5b86c189 writers: add support for wrapping
Add a makeWrapperArgs argument to all script writers under pkgs.writers.

This can be used to set, prefix, or suffix the PATH or other environment variables which improves the ability to generate scripts with reproducible behavior.

Some of the writers (writeBash, writeDash, writeFish, writeNu) previously did not support passing an argument set, for example
```
writeBash "example" "echo hello"

```

In order to add the new capability to these writers as well, their call signature is now overloaded in order to allow the following:
(The old call style from the example above remains intact)
```
writeBash "example"
  { makeWrapperArgs = [ "--prefix" "PATH" ":" "${pkgs.hello}/bin" ]; }
  ''
    hello
  ''
```

Done as well:
- add tests
- add more docs
- fix some misleading docs
- extend existing docs with more examples
2024-03-05 14:25:42 +07:00
Vladimír Čunát
ea4b95755d
Revert "writers: add support for wrapping" 2024-03-04 07:05:23 +01:00
lassulus
97345af560
Merge pull request #291854 from DavHau/writers-wrap
writers: add support for wrapping
2024-03-04 08:37:18 +07:00
DavHau
3e3ae4ecf5 writers: add support for wrapping
Add a makeWrapperArgs argument to all script writers under pkgs.writers.

This can be used to set, prefix, or suffix the PATH or other environment variables which improves the ability to generate scripts with reproducible behavior.

Some of the writers (writeBash, writeDash, writeFish, writeNu) previously did not support passing an argument set, for example
```
writeBash "example" "echo hello"

```

In order to add the new capability to these writers as well, their call signature is now overloaded in order to allow the following:
(The old call style from the example above remains intact)
```
writeBash "example"
  { makeWrapperArgs = [ "--prefix" "PATH" ":" "${pkgs.hello}/bin" ]; }
  ''
    hello
  ''
```

Done as well:
- add tests
- add more docs
- fix some misleading docs
- extend existing docs with more examples
2024-02-29 17:31:58 +07:00
Johannes Kirschbauer
54658a47d0
doc: improve pkgs.writers comments 2024-02-29 10:38:03 +01:00
Tulili
1e7dc0e1b8 pkgs.writers: fix type in description for writeHaskellBin 2024-01-30 06:48:51 +01:00
Tulili
703a085c0a pkgs.writers: tests for lua ruby, and remove failed tests because of external package errors 2024-01-30 06:48:43 +01:00
Tulili
f6e0ee5545 pkgs.writers: remove tests that dont work anymore and add comments tracking issues 2024-01-30 06:48:35 +01:00
Tulili
05ad04bdd3 pkgs.writers add snu, lua and ruby 2024-01-30 06:48:15 +01:00
Raphael Robatsch
5ba1e86bb0 tests.writers.simple.fsharp: Add missing dependency
This test currently fails because `FSharp.SystemTextJson` depends on
`System.Text.Json`. Fix the test by adding the missing dependency.
2023-12-11 09:47:06 +01:00
Robert Hensing
a6622bf00a writers/test: Refactor
It now also checks the executable bit.
2023-10-24 11:17:38 +02:00
Robert Hensing
e64f987fd6 writers.makeDataWriter: Deprecate 2023-10-24 11:17:38 +02:00
Robert Hensing
79130267d3 writers/data.nix: Remove duplicate implementations 2023-10-24 11:17:38 +02:00
Vladimír Čunát
d5732d9669
Merge branch 'staging-next' into staging 2023-08-05 07:45:29 +02:00
Simon Žlender
8e912feb29 codesign_allocate: reference cctools 2023-08-01 21:27:09 +02:00
Robert Hensing
0ed9e35a22 writers: Set mainProgram
Part of https://github.com/NixOS/nixpkgs/pull/246386
2023-08-01 12:21:06 +02:00
Ben Wolsieffer
025af47303 writers: use runCommand instead of runCommandNoCC
runCommandNoCC is now an alias for runCommand, which was causing ofborg
failures with allowAliases = false.
2023-07-28 00:39:21 -04:00
Ben Wolsieffer
09dd973987 writers: use callPackages to import sub-groups of writers
Use callPackages instead of plain import to get proper splicing. Without this,
writeNginxConfig fails when cross-compiling.
2023-07-27 22:54:41 -04:00
zimbatm
504e42b559 writers: introduce data writers
Make it easy to write structured data back to disk.
2023-07-22 17:54:41 +02:00
zimbatm
d0c7ffc596 writers: make room for other types of writers 2023-07-22 17:54:41 +02:00
zimbatm
73ee03cbc5 writers: split out the tests
Make it easier to run and debug individual tests.
2023-07-22 17:53:52 +02:00
zimbatm
c04c43ccd1 writers: fix fsharp writer
dotnet needs a writable $HOME to operate
2023-07-22 13:36:31 +02:00
Artturin
3ea5e83373 writers.makePythonWriter: fix interpreter executable 2023-06-17 22:58:14 +03:00
sternenseemann
192d03bee4 writers: fix aarch64-darwin workaround if content is a string
When authoring #220966, I missed that the `//` would take effect solely
in the else branch, fixing hledger-check-fancyassertions, but not
tests.writers.bin.haskell.
2023-03-29 03:29:13 +02:00
sternenseemann
86dbc928fb writers: make codesign_allocate available in PATH on aarch64-darwin
codesign_allocate is assumed to be in PATH:

https://github.com/NixOS/nixpkgs/issues/154203
https://github.com/NixOS/nixpkgs/issues/148189

Using an absolute reference in post-link-sign-hook would be another
possibility, but hasn't been fruitful so far:
https://github.com/NixOS/nixpkgs/pull/148282
https://github.com/NixOS/nixpkgs/pull/208120
2023-03-14 19:45:53 +01:00
Jeremy Schlatter
2581bc08da
writers: fix typo in comment 2023-01-05 20:26:25 -08:00
lassulus
85a36f9146 writers.writeJS: pass arguments to script 2022-10-11 20:16:37 +02:00
pacien
0495b0217b writers.writeFish: avoid loading user config files
This makes the Fish interpreter ignore user configuration files.
This was not desirable for running scripts, especially system ones.
2022-10-10 23:10:36 +02:00
pacien
6e4a14b54f writers: add writeFish and writeFishBin
This adds writers for Fish shell scripts, with syntax checking.
2022-10-10 15:59:23 +02:00
squalus
4246654992 writers.makePythonWriter: fix cross compile
The check script needs to run at build time. Add a new argument to
makePythonWriter for the appropriate buildPackages version of pythonPackages,
and use this to run the check script.
2022-08-25 17:46:34 -07:00
Profpatsch
a1aed2a716 builders/writeHaskell: build with threaded GHC runtime
Some haskell code starts silently hanging when not built with a
threaded runtime, so let’s assume people using `writeHaskell` don’t
care about micro-optimizations like this and do the expected thing.

Some architectures don’t support a threaded runtime, for these we
provide the `threadedRuntime` option to turn it off (it should fail at
build time in that case, easy to detect).

If somebody already passed `"-threaded"` before via ghcArgs, this
will not add the flag a second time. Thus it’s backward-compatible in
this regard.

I tested out both branches (with `-threaded` set and not set before),
on an example I had where the runtime would hang when not compiled
with `-threaded`.
2022-06-30 10:12:50 +02:00
Ben Siraphob
259fa13d53 treewide: remove nativeBuildInputs that are in stdenv 2022-04-16 21:46:46 +03:00
Robert Hensing
200175a701 config.allowAliases: Define as option
This simplifies usages and makes the default value consistent.

In a few cases, the default value was interpreted to be `false`,
but this is useless, because virtually nobody will explicitly
set `allowAliases = true;`.
2022-04-01 11:33:10 +02:00
Moises Nessim
81998d0a1d Add writeFSharp and makeFSharpWriter functions to writers
Uses fsharp interactive (fsi) to run fsx script

Expose mkNugetSource and mkNugetDeps functions

Use them in writers.writeFSharp and buildDotnetModule

Add tests
2022-02-28 17:40:43 -05:00
Markus S. Wamser
b93e478777 writers.PyPy{2,3}: init 2021-12-15 10:01:08 +01:00
Markus S. Wamser
4e42f6bcb3 writers.writePython2: remove 2021-12-15 09:56:14 +01:00
Enno Richter
10c725dc6b writers.makePythonWriter: drop flake8 checks for Python 2 scripts 2021-12-05 09:59:47 +01:00
Uri Baghin
7111193ee6 writers: fix writeRust on darwin 2021-11-13 11:04:36 +11:00