aboutsummaryrefslogtreecommitdiff
path: root/src/libutil
AgeCommit message (Collapse)Author
2023-06-15Don't assume the type of string::size_typeThéophane Hufschmitt
The code accidentally conflated `std::string::size_type` and `long unsigned int`. This was fine on 64bits machines where they are apparently the same in practice, but not on 32bits. Fix that by using `std::string::size_type` everywhere.
2023-06-14Remove dead code (#8504)Daniel Asaturov
`filesystem.cc` is the only place where `createSymlink()` is used with three arguments: in the definition of `replaceSymlink()` with three parameters that _is not used at all_. Closes #8495
2023-06-14Merge pull request #4282 from tweag/fix-ca-hash-rewritingJohn Ericson
fix the hash rewriting for ca-derivations
2023-06-09Parse TOML timestamps (#8120)Andrea Bedini
Currently `fromTOML` throws an exception when encountering a timestamp since the Nix language lacks a way to represent them. This patch changes this beaviour and makes `fromTOML` parse timestamps as attrsets of the format { _type = "timestamp"; value = "1979-05-27T07:32:00Z"; } This is guarded by an experimental feature flag to leave room for iterating on the representation.
2023-05-31Merge pull request #8318 from fricklerhandwerk/doc-currentTimeValentin Gagarin
document `builtins.currentTime`
2023-05-26create pathAccessible, use it to infer default dirsYorick van Pelt
2023-05-26ci: Always run with sandbox, even on DarwinSilvan Mosberger
And fix a test failure in the sandbox due to /home existing on Darwin but not being accessible in the sandbox since it's a symlink to /System/Volumes/Data/home, see https://github.com/NixOS/nix/actions/runs/4205378453/jobs/7297384658#step:6:2127: C++ exception with description "error: getting status of /home/schnitzel/darmstadt/pommes: Operation not permitted" thrown in the test body. On Linux this wasn't a problem because there /home doesn't exist in the sandbox
2023-05-24Make `RewritingSink` accept a map of rewritesThéophane Hufschmitt
Giving it the same semantics as `rewriteStrings`. Also add some tests for it
2023-05-19Merge pull request #8354 from KasyanDiGris/git-fetcher-ask-credentialsEelco Dolstra
Ask for git credentials in fetcher
2023-05-18Add option isInteractiveKonstantin Vukolov
2023-05-17Upgrade `downstreamPlaceholder` to a type with methodsJohn Ericson
This gets us ready for dynamic derivation dependencies (part of RFC 92).
2023-05-17add cross-references to pure evaluation modeValentin Gagarin
use consistent wording everywhere. add some details on the configuration option documentation.
2023-05-15Delete commited build artifactsJohn Ericson
They were improperly added in 8a93b5a55184d9d34effdd94d58429c9ad1a3d14. They were not `.gitignore`d because they were stale in that commit -- build artifacts no longer used that name by then and so `.gitignore` was updated accordingly.
2023-05-15Merge pull request #8141 from tweag/user-files-docJohn Ericson
Document user files of nix
2023-05-10Merge pull request #3959 from obsidiansystems/ca-drv-exoticJohn Ericson
Derivations can output "text-hashed" data
2023-04-26Document user files of nixAlexander Bantyev
2023-04-25TarArchive: Remove a duplicate constant and increase the buffer sizeEelco Dolstra
2023-04-24Merge remote-tracking branch 'origin/master' into source-pathEelco Dolstra
2023-04-17`TextHashMethod` -> `TextIngestionMethod`, gate with XP featureJohn Ericson
I suppose we can use `dynamic-derivations` for the few things we neeed.
2023-04-17Merge pull request #8230 from obsidiansystems/daemon-trust-overrideRobert Hensing
Experimentally allow forcing `nix-daemon` trust; use this to test
2023-04-17Experimentally allow forcing `nix-daemon` trust; use this to testJohn Ericson
We finally test the status quo of remote build trust in a number of ways. We create a new experimental feature on `nix-daemon` to do so. PR #3921, which improves the situation with trustless remote building, will build upon these changes. This code / tests was pull out of there to make this, so everything is easier to review, and in particular we test before and after so the new behavior in that PR is readily apparent from the testsuite diff alone.
2023-04-17Fix some issues with experimental config settingsJohn Ericson
Issues: 1. Features gated on disabled experimental settings should warn and be ignored, not silently succeed. 2. Experimental settings in the same config "batch" (file or env var) as the enabling of the experimental feature should work. 3. For (2), the order should not matter. These are analogous to the issues @roberth caught with my changes for arg handling, but they are instead for config handling. Co-authored-by: Robert Hensing <roberth@users.noreply.github.com>
2023-04-17Merge pull request #7732 from hercules-ci/make-initLibStore-viable-alternativeJohn Ericson
Make `initLibStore` a viable alternative
2023-04-17Merge remote-tracking branch 'upstream/master' into source-pathRobert Hensing
2023-04-16Mark experimental configuration settings programmaticallyJohn Ericson
Fix #8162 The test is changed to compare `nlohmann::json` values, not strings of dumped JSON, which allows us to format things more nicely.
2023-04-14Merge pull request #8176 from tweag/rename-confusing-write-methodEelco Dolstra
Rename and protect `BufferedSink::write`
2023-04-11Do not gate or hide experimental settingsJohn Ericson
This is somewhat hacky fix just for 2.15. I unintentionally hid them from the manual, when no one wanted to hide them that (including myself). I also required the experimental feature to be enabled in an order-dependent way, which is not good. The simplest fix for this immanent release is just to always show them, and always allow them to be set. Effectively undoes some changes from aa663b7e89d3d02248d37ee9f68b52770b247018
2023-04-11Merge pull request #7798 from peeley/list-experimental-featuresEelco Dolstra
Documentation: list experimental features in manual
2023-04-11NitpicksEelco Dolstra
2023-04-07Merge pull request #8179 from tweag/disable-gc-on-coroutineRobert Hensing
disable gc on coroutine
2023-04-07Require openssl >= 1.1.1Robert Hensing
Versions older this are sufficiently old that we don't want to support them, and they require extra support code.
2023-04-07libutil: Provide alternatives to startSignalHandlerThreadRobert Hensing
How signals should be handled depends on what kind of process Nix is integrated into. The signal handler thread used by the stand-alone Nix commands / processes may not work well in the context of other runtime systems, such as those of Python, Perl, or Haskell.
2023-04-07Move OpenSSL init to initLibUtilRobert Hensing
Part of an effort to make it easier to initialize the right things, by moving code into the appropriate libraries.
2023-04-07Finish converting existing comments for internal API docs (#8146)John Ericson
* Finish converting existing comments for internal API docs 99% of this was just reformatting existing comments. Only two exceptions: - Expanded upon `BuildResult::status` compat note - Split up file-level `symbol-table.hh` doc comments to get per-definition docs Also fixed a few whitespace goofs, turning leading tabs to spaces and removing trailing spaces. Picking up from #8133 * Fix two things from comments * Use triple-backtick not indent for `dumpPath` * Convert GNU-style `\`..'` quotes to markdown style in API docs This will render correctly.
2023-04-07Always disable GC in a coroutine unless the patch is appliedYorick van Pelt
2023-04-07DisableGC: replace by CoroutineContext, std::shared_ptr<void>Yorick van Pelt
2023-04-07Disable GC inside coroutines on mac OSYorick van Pelt
2023-04-07Create `Derivation::fromJSON`John Ericson
And test, of course
2023-04-07Rename and protect `BufferedSink::write`Théophane Hufschmitt
The `write` name is ambiguous and could lead to some funny bugs like https://github.com/NixOS/nix/pull/8173#issuecomment-1500009480. So rename it to the more explicit `writeUnbuffered`. Besides, this method shouldn't be (and isn't) used outside of the class implementation, so mark it `protected`. This makes it more symetrical to `BufferedSource` which uses a `protected readUnbuffered` method.
2023-04-06Describe active experimental features in the contributing guideJohn Ericson
They are put in the manual separate pages under the new overarching description of experimental features. The settings page just lists the valid experimental feature names (so people know what a valid setting entry looks like), with links to those pages. It doesn't attempt to describe each experimental feature as that is too much information for the configuration settings section.
2023-04-06Link the new general documentation on xp features on the settingJohn Ericson
2023-04-06Fix typo in `no-url-literals` experimental feature docsNoah Snelson
Co-authored-by: Valentin Gagarin <valentin.gagarin@tweag.io>
2023-04-06Expand documentation for `experimental-features`Noah Snelson
Adds examples and additional information to the `impure-derivations`, `recursive-nix`, and `no-url-literals` experimental feature documentation.
2023-04-06Backport SourcePath from the lazy-trees branchEelco Dolstra
This introduces the SourcePath type from lazy-trees as an abstraction for accessing files from inputs that may not be materialized in the real filesystem (e.g. Git repositories). Currently, however, it's just a wrapper around CanonPath, so it shouldn't change any behaviour. (On lazy-trees, SourcePath is a <InputAccessor, CanonPath> tuple.)
2023-04-04Assemble experimental feature docs outside of Nix itselfJohn Ericson
Instead of constructing a markdown list in C++ (which involved all sorts of nasty string literals), export some JSON and assemble it with the manual build system. Besides following the precedent set with other dumped data, this is a better separate of content and presentation; if we decide for example we want to display this information in a different way, or in a different section of the manual, it will become much easier to do so.
2023-04-04Merge remote-tracking branch 'upstream/master' into list-experimental-featuresJohn Ericson
2023-04-04Apply suggestions from code reviewJohn Ericson
Co-authored-by: Valentin Gagarin <valentin.gagarin@tweag.io>
2023-04-03Merge pull request #8157 from hercules-ci/switch-bugsThéophane Hufschmitt
Fix current and future `switch` bugs
2023-04-03Enable -Werror=switch-enumRobert Hensing
switch statements must now match all enum values or disable the warning. Explicit is good. This has helped us find two bugs, after solving another one by debugging. From now on, adding to an enum will raise errors where they are not explicitly handled, which is good for productivity, and helps us decide the correct behavior in all usages. Notably still excluded from this though are the cases where the warning is disabled by local pragmas. fromTOML.cc did not build despite a top-level pragma, so I've had to resort to a makefile solution for that.
2023-04-03Add explicit case statements where -Wswitch-enum would report themRobert Hensing