about summary refs log tree commit diff
path: root/pkgs/build-support/writers
AgeCommit message (Collapse)AuthorFilesLines
2023-03-29writers: fix aarch64-darwin workaround if content is a stringsternenseemann1-2/+2
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-14writers: make codesign_allocate available in PATH on aarch64-darwinsternenseemann1-0/+5
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-01-05writers: fix typo in commentJeremy Schlatter1-1/+1
2022-10-11writers.writeJS: pass arguments to scriptlassulus1-1/+1
2022-10-10writers.writeFish: avoid loading user config filespacien1-2/+2
This makes the Fish interpreter ignore user configuration files. This was not desirable for running scripts, especially system ones.
2022-10-10writers: add writeFish and writeFishBinpacien2-0/+27
This adds writers for Fish shell scripts, with syntax checking.
2022-08-25writers.makePythonWriter: fix cross compilesqualus1-5/+5
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-06-30builders/writeHaskell: build with threaded GHC runtimeProfpatsch1-2/+7
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-04-16treewide: remove nativeBuildInputs that are in stdenvBen Siraphob1-2/+2
2022-04-01config.allowAliases: Define as optionRobert Hensing1-1/+1
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-02-28Add writeFSharp and makeFSharpWriter functions to writersMoises Nessim2-1/+64
Uses fsharp interactive (fsi) to run fsx script Expose mkNugetSource and mkNugetDeps functions Use them in writers.writeFSharp and buildDotnetModule Add tests
2021-12-15writers.PyPy{2,3}: initMarkus S. Wamser2-0/+86
2021-12-15writers.writePython2: removeMarkus S. Wamser3-49/+44
2021-12-05writers.makePythonWriter: drop flake8 checks for Python 2 scriptsEnno Richter1-2/+2
2021-11-13writers: fix writeRust on darwinUri Baghin1-2/+5
2021-10-29writers: run fixupPhase for darwin bin writerssternenseemann1-0/+4
mach-o executables we produce in writers are not always fully valid for some reason. In normal derivation this is fixed in fixupPhase and we can replicate this behavior here easily. Resolves #132660.
2021-10-29writers: use platform's default stripsternenseemann1-2/+2
bintools points to the default bintools (e. g. cctools, binutils, llvmPackages.bintools) for the next stage. So instead of using GNU binutils' strip which may not support the current platform, we need to use buildPackages.bintools-unwrapped. Additionally we need to use `-S` over `--strip-unneeded` as the latter is a GNU binutils-specific flag and not supported by cctools. Also add the correct targetPrefix in order to support cross-compilation correctly here at least.
2021-08-25writers: drop writeCJörg Thalheim2-71/+0
This function is fundamentally broken. Not even the ncurses example will compile. The interface needs to be rethought for it to work (i.e. don't unconditionally include all pc files, set include path and ld path and rpath). Since it is unlikely that in the current this has any user, just drop it for now.
2021-07-13tests.writers: also expose path via passthrusternenseemann1-1/+1
2021-06-28Revert "writers: Allow string paths"Yureka1-4/+4
This reverts commit 33ffb05d390987802fe939f9c9a3d6a451076535.
2021-06-25writers: Allow string pathsSilvan Mosberger1-4/+4
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"`
2021-06-08tests.writers: use dashes instead of underscores in drv namessternenseemann1-21/+21
This is more in line with standard derivation name policy in nixpkgs.
2021-06-08tests.writers: give all test derivations unique namessternenseemann1-26/+26
This makes it easier to debug test failures since the derivation name will give an indication which writer it belongs to.
2021-03-31treewide: use perl.withPackages when possiblernhmjoj1-12/+3
Since 03eaa48 added perl.withPackages, there is a canonical way to create a perl interpreter from a list of libraries, for use in script shebangs or generic build inputs. This method is declarative (what we are doing is clear), produces short shebangs[1] and needs not to wrap existing scripts. Unfortunately there are a few exceptions that I've found: 1. Scripts that are calling perl with the -T switch. This makes perl ignore PERL5LIB, which is what perl.withPackages is using to inform the interpreter of the library paths. 2. Perl packages that depends on libraries in their own path. This is not possible because perl.withPackages works at build time. The workaround is to add `-I $out/${perl.libPrefix}` to the shebang. In all other cases I propose to switch to perl.withPackages. [1]: https://lwn.net/Articles/779997/
2021-03-05writers: formatSandro Jäckel1-11/+10
2021-03-04treewide: remove stdenv where not neededBen Siraphob1-1/+0
2021-01-24treewide: stdenv.lib -> libPavol Rusnak1-1/+1
2021-01-19treewide: pkgs.pkgconfig -> pkgs.pkg-config, move pkgconfig to alias.nixJonathan Ringer1-1/+1
continuation of #109595 pkgconfig was aliased in 2018, however, it remained in all-packages.nix due to its wide usage. This cleans up the remaining references to pkgs.pkgsconfig and moves the entry to aliases.nix. python3Packages.pkgconfig remained unchanged because it's the canonical name of the upstream package on pypi.
2021-01-12writers: add test for rustDominik Xaver Hörl1-0/+6
2021-01-12writers: add rustDominik Xaver Hörl1-4/+26
2021-01-11writers: deduplicate binary stripping logicDominik Xaver Hörl1-3/+3
2020-10-29writers.writeNginxConfig: fix cross-compilationBen Wolsieffer1-3/+4
Native versions of awk, sed and gixy need to be used.
2020-09-07pkgs/build-support/writers: allow passing ghc arguments in writeHaskellDominik Xaver Hörl1-2/+3
2020-07-25writers.makeScriptWriter: fix on Darwin\MacOS (#93757)Adrian1-1/+24
* writers.makeScriptWriter: fix on Darwin\MacOS On Darwin a script cannot be used as an interpreter in a shebang line, which causes scripts produced with makeScriptWriter (and its derivatives) to fail at run time if the used interpreter was wrapped with makeWrapper (as in the case of python3.withPackages). This commit fixes the problem by detecting if the interpreter is a script and prepending its shebang to the final interpreter line. For example if used interpreter is; ``` /nix/store/ynwv137n2650qy39swcflxbcygk5jwv1-python3-3.8.3-env/bin/python ``` which is a script with following shebang: ``` #! /nix/store/knd85yc7iwli8344ghav3zli8d9gril0-bash-4.4-p23/bin/bash -e ``` then the shebang line in the produced script will be ``` #! /nix/store/knd85yc7iwli8344ghav3zli8d9gril0-bash-4.4-p23/bin/bash -e /nix/store/ynwv137n2650qy39swcflxbcygk5jwv1-python3-3.8.3-env/bin/python ``` This works on Darwin since there does not seem to be a limit to the length of the shabang line and the shebang lines support multiple arguments to the interpreters (as opposed to linux where the kernel imposes a strict limit on shebang lengh and everything following the interpreter is passed to it as a single string). fixes; #93609 related to: #65351 #11133 (and probably a bunch of others) NOTE: scripts produced on platforms other than Darwin will remain unmodified by this PR. However it might worth considering extending this fix to BSD systems in general. I didn't do it since I have no way of testing it on systems other than MacOS and linux. * writers.makeScriptWriter: fix typo in comment * writers.makeScriptWriter: fail build if interpreter of interpreter is a script
2020-07-24writers.writePython2 and writePython3: use "bare" python if no deps are neededAdrian Gierakowski2-22/+28
`python.withPackages` has a runtime dependecy on bash since it's wrapped with `makeWrapper`. This fix avoids bash as runtime dependency when it's not needed. as discussed here: https://github.com/NixOS/nixpkgs/issues/93609#issuecomment-662880047
2020-02-18pkgs/build-support/writers: use `runCommandLocal` for scriptsProfpatsch1-2/+2
If we just want to write a non-compiled script (e.g. writeDash), it’s usually a lot faster just doing it locally. That’s what `runCommandLocal` was introduced for, so let’s use it in `writers`.
2019-12-14WriteHaskell: Strip binariesChuck1-0/+1
This reduces the size of Hello World [1] from 3.06 MiB to 678 KiB. [1] As measured by nix-shell -p 'writers.writeHaskellBin "hello" {} "main = putStrLn \"hello\""' --run 'ls -l `which hello`'
2019-10-23writers test: use writeC with library for testinglassulus1-2/+24
2019-10-23writers test: fix python2 linter errorslassulus1-0/+4
2019-10-23writers: fix writeC libraries detectionlassulus1-1/+3
2019-09-08treewide: remove redundant quotesvolth1-2/+2
2019-08-31nixos/modules: Remove all usages of types.stringSilvan Mosberger1-4/+4
And replace them with a more appropriate type Also fix up some minor module problems along the way
2019-05-28build-support/writers: actually run checkslassulus1-0/+3
2019-04-21writeC: fix finding of librarieslassulus1-2/+2
2019-04-08nixos/nginx: fix error in writeNginxConfigIzorkin1-3/+10
2019-03-20build-support writers: add writeNginxConfigtv1-0/+10
2018-12-15lib.makePerlPath -> perlPackages.makePerlPathvolth1-2/+2
2018-12-04build-support writers: content can be string or filelassulus2-64/+106
2018-11-27build-support writers: add testslassulus1-0/+149
2018-11-27build-support: add writers from krebs/writerslassulus1-0/+239
Reference https://github.com/krebs/nix-writers revision 40fde9e