83 Commits
Author SHA1 Message Date
Linus Heckemann 9302845601 package: use buildPackages for licxxbridge build
This fixes a regression in cross builds introduced in https://gerrit.lix.systems/c/lix/+/5704.

Change-Id: I3031d7c4daa5554cc16f654d28311f486a6a6964
2026-07-07 10:59:53 +02:00
Linus Heckemannandeldritch horrors 267a8e7c9b nix-eval-jobs: fix version
Change-Id: Ie237ddb2b1a0829b0954b05794506afd6a6a6964
2026-06-06 15:20:47 +00:00
Linus Heckemann 8edb857248 libfetchers: lock inputs before fetching them
Fixes #1122

Change-Id: I9243e692779a795066417a15c6315dd56a6a6964
2026-05-26 15:14:13 +00:00
Linus Heckemann 1f100371d7 doc/hacking: switch buildkite sso url to afnix
Change-Id: I7f7e65fe2dc52b40d4771e59198dd66a6a6a6964
2026-05-18 18:13:47 +02:00
Linus Heckemann f87d753987 libexpr: print flake config warning to stderr
Fixes #1155

Change-Id: Ie63f9200f7c06b1eec6c52518d6f523f6a6a6964
2026-03-17 07:10:00 +00:00
Linus Heckemann 52ef1181f0 build: fix cross-compilation
We need capnproto-lix to be provided by callPackage, otherwise it won't
be spliced and the same (built for the cross host platform) for both
buildInputs (correct) and nativeBuildInputs (incorrect). We thus move it
into the overlay.

A similar problem exists for the lowdown build. We thus use callPackage
to override it as well. This is horrible (especially because it means we
need to pass the enableDarwinSandbox package argument through
ourselves), but at least it builds...

Fixes: https://git.lix.systems/lix-project/lix/issues/939
Change-Id: I802152072d852903401ef701f526195aa99475f2
2025-08-08 09:48:42 +02:00
Linus Heckemann e753fcb414 gc: delay throwing error until cleanup is complete
Previously, paths not being deleted by gcDeleteSpecific would result in
(a) hardlinks not being cleaned up, and
(b) statistics not being reported correctly.

By throwing the error later, we fix both of these problems.

Change-Id: I8019f3e10d9f22e81ea87bb26b77f04ebc888a19
2025-06-02 20:05:32 +02:00
Linus HeckemannandLix Systems Gerrit 6c773375c2 Merge "doc: explain runtime and indirect roots, merge roots section into GC section" into main 2025-05-26 15:34:25 +00:00
Linus HeckemannandLix Systems Gerrit bbc9aaf8a6 Merge "build: disable LTO on Darwin" into main 2025-05-23 12:27:04 +00:00
Linus Heckemann da94e860dd build: disable LTO on Darwin
Due to https://git.lix.systems/lix-project/lix/issues/832 , Lix 2.93.0
fails to build on Darwin without overrides. Until the root cause has
been determined and fixed, build without LTO.

Change-Id: I4db5eb294d8f19e5a366b1e19efa5a327b3e2e78
2025-05-22 13:34:30 +02:00
Linus Heckemann 498e828efe doc: explain runtime and indirect roots, merge roots section into GC section
Change-Id: Ib2547c04c938af8fc7346f49616085f514c81749
2025-05-20 12:52:51 +02:00
Linus HeckemannandLix Systems Gerrit a7634f87aa Merge "libstore/local-derivation-goal: better debuggability for FOD mismatches" into main 2025-05-16 15:18:11 +00:00
Linus Heckemann d19593d00b libstore/local-derivation-goal: better debuggability for FOD mismatches
The expected and the obtained path are now printed as part of the
error message, making comparing them easier when they're both at hand.

The extra rethrow for the hash-mismatch exception in the bmCheck case
has been removed, allowing the path to be registered as in the
non-check case. This makes having both paths at hand a lot more likely!

The determinism check logic was incorrect for content-addressed paths,
since it only ever tried to compare the path produced, even if this
was not the path expected (in the case of fixed-output derivations) or
the path previously produced (in the case of non-fixed CA
derivations). This made little sense, because that would always be the
same path if it exists! The determinism check is therefore now
bypassed for CA paths. Having a correct determinism check for
non-fixed CA derivations and running the diff hook for fixed-output
derivations would be nice, but feels out of scope and bypassing the
inapplicable logic isn't a regression from the previous behaviour.

Change-Id: I5fc14fb477c8c7d2f5bdedad5591af916f72b128
2025-05-11 21:22:52 +02:00
Linus HeckemannandLix Systems Gerrit a10de1ee56 Merge "build-release-notes: ignore dotfiles" into main 2025-05-10 09:53:56 +00:00
Linus Heckemannandjade b0947777ec build-release-notes: ignore dotfiles
Editors may leave these hanging about, but they're not likely to be
valid release notes

Change-Id: Ie3c9a6e849c6d54514ac25370a8d847a0caf499d
2025-05-08 23:47:59 +00:00
Linus Heckemann 08d7ddd6ca release notes: name SSH options that are no longer used
When I read the note, I wasn't sure what was meant by connection
sharing. This adds a reference to SSH documentation for clarity.

Change-Id: I1d6e5c53fb6a6fac8380210967f56d86f0333e55
2025-05-07 10:53:12 +02:00
Linus HeckemannandLix Systems Gerrit 14055866dc Merge "libexpr/get-drvs: improve error messages on bad outputsToInstall" into main 2025-04-22 15:35:54 +00:00
Linus Heckemann aeb27b2e25 libexpr/get-drvs: improve error messages on bad outputsToInstall
Change-Id: I6540f4e77c0d98f357f6f3960bfe3ce4d1c3c6fb
2025-04-16 11:20:48 +02:00
Linus Heckemann b52db5e7c1 gc: fix paths-not-deleted error message
The newline was previously omitted when fewer than summaryThreshold paths were present.

Change-Id: Ieb9292262f9b5a666784a4273de534941bc31998
2025-03-28 09:46:22 +01:00
Linus HeckemannandGerrit Code Review be1491fa6a Merge "gc: allow continuing deletion even if some paths are still live" into main 2025-03-11 13:42:16 +00:00
Linus Heckemann 29b07611b8 gc: allow continuing deletion even if some paths are still live
This adds a gcTryDeleteSpecific operation. This is similar to
gcDeleteSpecific, but will not fail if any of the given paths cannot
be deleted. Paths that could not be deleted are reported in the new
`kept` field of struct GCResults.

This also changes the behaviour of gcDeleteSpecific, such that it will
now continue deleting paths even if it fails to delete one along the
way, and only throw an error once deletion of all the given paths has
been attempted. This seems reasonable to me, because it makes its
behaviour somewhat less surprising -- previously, if some paths were
deletable and others weren't, the deletable ones would be deleted iff
they preceded the live ones in lexical sort order.

This also fixes a regression introduced in
8614cf1334, whereby nix-store --delete
failed to delete paths if they had any dependents -- even if none of
the dependents had GC roots.

The gcTryDeleteSpecific operation is surfaced via additional flags for
the `nix store delete` and `nix-store --delete` commands.

This makes custom garbage-collection logic a lot easier to implement
and experiment with:

- Paths known to be large can be thrown at `nix store delete` without
  having to manually filter out those that are still reachable from a
  root, e.g.
  `nix store delete /nix/store/*mbrola-voices*`

- The --delete-closure option allows extending this to paths that are
  not large themselves but do have a large closure size, e.g.
  `nix store delete /nix/store/*nixos-system-gamingpc*`
  Having an option for this is not strictly necessary, but convenient
  because it doesn't require the user to add an extra `nix-store
  -qR` (or `nix path-info -r`) into their command, nor to rewrite
  their command to use `--stdin` if the closure ends up too large to
  fit on a command line.

- Other heuristics like atime-based deletion can be applied more
  easily, because `nix store delete` once again takes over the task of
  working out which paths can't be deleted.

Change-Id: If345407fe7b11bdb3a8fdc04b0d56c32ab3d5928
2025-03-11 14:10:32 +01:00
Linus HeckemannandGerrit Code Review f9d91129de Merge "libcmd/markdown: avoid stripping ANSI escapes" into main 2025-03-10 21:05:40 +00:00
Linus Heckemann a954a5ea2f libcmd/markdown: avoid stripping ANSI escapes
Instead, we instruct lowdown not to emit them in the first place.

Fixes #622.

Change-Id: I596bb873943c2c0b5067c5357a90457f01307cfa
2025-03-10 19:32:00 +01:00
Linus HeckemannandGerrit Code Review f7a93d8ffb Merge "nix store delete: don't realise paths" into main 2025-03-10 18:27:29 +00:00
Linus HeckemannandGerrit Code Review 423a343937 Merge "libstore/gc: restore deletion of referrers" into main 2025-03-09 21:41:49 +00:00
Linus Heckemann d6c871eb2d libstore/gc: restore deletion of referrers
Fixes: 8614cf1334
Fixes #495

Change-Id: I4d8d655c6254786ba1222a5b37551c68d9e370ee
2025-03-09 22:15:12 +01:00
Linus Heckemann 6a4efb82bc nix store delete: don't realise paths
Change-Id: I9566974a3afa70c61a0c8185b4dbd24a6440473f
2025-03-09 13:07:03 +01:00
Linus Heckemann 6eda9a95a4 nix-eval-jobs: passthru nix
Change-Id: Ied6d4abb8a67dcbe221271e6be1a14b71f9543d1
2025-02-20 22:36:53 +01:00
Linus HeckemannandGerrit Code Review 02c12314e4 Merge "libstore: more precise origin info for strange structured logs" into main 2025-02-17 16:28:19 +00:00
Linus HeckemannandGerrit Code Review ae81f44b86 Merge "nar-info: use string views for construction" into main 2025-01-24 08:11:28 +00:00
Linus Heckemann 8cf4c2c9e0 nar-info: use string views for construction
This doesn't break any usages within lix, and allows avoiding copying
in some calls. The constructor already copies bits and pieces of the
data passed in.

Change-Id: Iea39906ca430195da4c509dd8a0a54d49b46ca4f
2025-01-23 11:21:24 +00:00
Linus HeckemannandGerrit Code Review c95b73d8a1 Merge "libstore: report all differing outputs rather than just the first" into main 2024-10-30 19:04:57 +00:00
Linus Heckemann 8b0ac51f12 libstore: report all differing outputs rather than just the first
Before:

error: derivation '/nix/store/4spy3nz1661zm15gkybsy1h5f36aliwx-python3.11-test-1.0.0.drv' may not be deterministic: output '/nix/store/ccqcp01zg18wp9iadzmzimqzdi3ll08d-python3.11-test-1.0.0-dist' differs from '/nix/store/ccqcp01zg18wp9iadzmzimqzdi3ll08d-python3.11-test-1.0.0-dist.check'

After:

error: derivation '4spy3nz1661zm15gkybsy1h5f36aliwx-python3.11-test-1.0.0.drv' may not be deterministic: outputs differ
         output differs: output '/nix/store/ccqcp01zg18wp9iadzmzimqzdi3ll08d-python3.11-test-1.0.0-dist' differs from '/nix/store/ccqcp01zg18wp9iadzmzimqzdi3ll08d-python3.11-test-1.0.0-dist.check'
         output differs: output '/nix/store/yl59v08356i841c560alb0zmk7q16klb-python3.11-test-1.0.0' differs from '/nix/store/yl59v08356i841c560alb0zmk7q16klb-python3.11-test-1.0.0.check'

Change-Id: Ib2871fa602bf1fa9c00e2565b3a2e1b26f908152
2024-10-29 18:34:54 +01:00
Linus HeckemannandGerrit Code Review f55ed83991 Merge "libutil: handle json builder log messages with unexpected format" into main 2024-10-27 22:54:11 +00:00
Linus Heckemann e55cd3beea libutil: handle json builder log messages with unexpected format
Before this change, expressions like:

with import <nixpkgs> {};
runCommand "foo" {} ''
  echo '@nix {}' >&$NIX_LOG_FD
''

would result in Lix crashing, because accessing nonexistent fields of
a JSON object throws an exception.

Rather than handling each field individually, we just catch JSON
exceptions wholesale. Since these log messages are an unusual
circumstance, log a warning when this happens.

Fixes #544.

Change-Id: Idc2d8acf6e37046b3ec212f42e29269163dca893
2024-10-15 11:15:42 +02:00
Linus HeckemannandJade Lovelace 609b721425 libstore/filetransfer: fix no-s3 build
Fixes a compiler error that looks like:

error: could not convert '[...]' from 'future<void>' to 'future<nix::FileTransferResult>'
Change-Id: I4aeadfeba0dadfdf133f25e6abce90ede7a86ca6
2024-06-05 15:50:57 -07:00
Linus HeckemannandGerrit Code Review 5312e60be6 Merge "libfetchers: allow fetching gitlab refs with >1 commit" into main 2024-06-01 09:54:11 +00:00
Linus Heckemann 82de36f77a libfetchers: allow fetching gitlab refs with >1 commit
Change-Id: I945c4c5512def9eff728bb67fe3c03ae17f99d6d
2024-05-31 21:12:04 +02:00
Linus Heckemann 3df013597d libfetchers: handle nonexistent refs in GitLab repos more gracefully
Before:

$ nix flake lock --override-input nixpkgs gitlab:simple-nixos-mailserver/nixos-mailserver/nonexistent
fetching git input 'git+file:///home/linus/projects/lix'
fetching gitlab input 'gitlab:simple-nixos-mailserver/nixos-mailserver/nonexistent'
error: [json.exception.type_error.302] type must be string, but is null

After:

$ outputs/out/bin/nix flake lock --override-input nixpkgs gitlab:simple-nixos-mailserver/nixos-mailserver/nonexistent
fetching git input 'git+file:///home/linus/projects/lix'
fetching gitlab input 'gitlab:simple-nixos-mailserver/nixos-mailserver/nonexistent'
error:
       … while updating the lock file of flake 'git+file:///home/linus/projects/lix?ref=refs/heads/fix-gitlab-nonexistent&rev=915f16a619a36237a099b9aa9afed6d14ff613b4'

       … while updating the flake input 'nixpkgs'

       … while fetching the input 'gitlab:simple-nixos-mailserver/nixos-mailserver/nonexistent'

       error: No commits returned by GitLab API -- does the ref really exist?

Change-Id: Id9bc79d98348500e152ed519bb3ac79a3d15c38d
2024-05-30 21:53:51 +00:00
Linus Heckemann 2dbcbe4179 flake: actually use lix 2024-05-09 13:12:12 +02:00
Linus Heckemann c3d8ca19b3 EvalError needs to reference an eval state now 2024-04-15 19:35:05 +02:00
Linus Heckemann c1ee00bf7c ProcessOptions: remove allowVfork field
This was removed in Lix 1f8b85786e
2024-04-15 19:30:56 +02:00
Linus Heckemann 14e4308346 parseCmdline: no allowShebang arg
This arg was only introduced in Nix 2.19 (commit ffd414eb756dcb3c64348551d5dbaf674c0d4900)
2024-04-15 19:30:32 +02:00
Linus Heckemann a2bd945259 hasPrefix -> starts_with
hasPrefix was removed in lix commit 61e21b2557
2024-04-15 19:28:36 +02:00
Linus Heckemann 733f3051b1 Fix include paths for Nix headers
While the previous style seems more sensible to me (the header names
are quite generic), the pkg-config definitions both from upstream Nix
and from Lix specify -I${includedir}/nix in CFLAGS rather than
-I${includedir}. This may be worth changing, but for now I want
nix-eval-jobs to work and this does what I want.
2024-04-15 19:20:21 +02:00
Linus Heckemann 3c3bd0767f Create test lockfiles in TEST_ROOT 2023-03-19 14:14:30 +01:00
Linus Heckemann f1c9d83697 Only allow reference lock files when allow-dirty is set 2023-03-19 14:12:49 +01:00
Linus Heckemann ea207a2eed Add tests for alternate lockfile path functionality 2023-03-19 14:11:19 +01:00
Linus Heckemann af4cbdafe7 LocalDerivationGoal: set NIX_ATTRS_*_FILE correctly for sandboxed builds 2023-03-16 15:26:52 +01:00
Linus HeckemannandEelco Dolstra 3a1de4c3fe Apply review suggestions
Co-authored-by: Eelco Dolstra <edolstra@gmail.com>
2023-03-14 12:02:03 +01:00
Linus HeckemannandWill Fancher e91596eb69 Allow specifying alternative paths for reading/writing flake locks
This allows having multiple separate lockfiles for a single
project, which can be useful for testing against different versions of
nixpkgs; it also allows tracking custom input overrides for remote
flakes without requiring local clones of these flakes.

For example, if I want to build Nix against my locally pinned nixpkgs,
and have a lock file tracking this override independently of future
updates to said nixpkgs:

nix flake lock --output-lock-file /tmp/nix-flake.lock --override-input nixpkgs flake:nixpkgs
nix build --reference-lock-file /tmp/nix-flake.lock

Co-Authored-By: Will Fancher <elvishjerricco@gmail.com>
2023-03-13 21:08:52 +01:00
Linus Heckemann c83a8174fd tests: fix for nixpkgs 22.11
runCommand now uses stdenvNoCC by default, so that needs to be
included instead of the regular stdenv.
2023-01-08 14:38:34 +01:00
Linus Heckemann 1c40182b12 fixup: remove boehmgc patch 2022-12-19 13:35:05 +01:00
Linus Heckemann 25e87c3c91 flake.lock: Update
Flake lock file updates:

• Updated input 'nixpkgs':
    'github:NixOS/nixpkgs/e22d9c397e5e6d92771cc1534e7769f2167c2952' (2022-11-26)
  → 'github:NixOS/nixpkgs/04a75b2eecc0acf6239acf9dd04485ff8d14f425' (2022-12-08)

NixOS 22.11 is now no longer beta.
2022-12-08 17:09:50 +01:00
Linus Heckemann 8e0946e8df Remove repeat and enforce-determinism options
These only functioned if a very narrow combination of conditions held:

- The result path does not yet exist (--check did not result in
  repeated builds), AND
- The result path is not available from any configured substituters, AND
- No remote builders that can build the path are available.

If any of these do not hold, a derivation would be built 0 or 1 times
regardless of the repeat option. Thus, remove it to avoid confusion.
2022-12-07 11:36:48 +01:00
Linus Heckemann ff62f6a84b tests/fetchGitSubmodules: fix for newer Git 2022-12-02 20:24:34 +01:00
Linus Heckemann 9c90452f9d bump nixpkgs to 22.11 beta 2022-11-29 12:06:57 +01:00
Linus Heckemann 19f3ecd830 nix-build: remove unused --add-root arg
Fixes #1982
2022-09-27 00:07:42 +02:00
Linus Heckemann 8cf26385cd [fixup] handle cache expiration in sqlite query 2022-06-23 14:54:25 -04:00
Linus Heckemann d533a88546 nar-info-disk-cache: refresh nix-cache-info weekly
This allows changes to nix-cache-info to be picked up by existing
clients. Previously, the only way for this to happen would be for
clients to delete binary-cache-v6.sqlite, which is quite awkward for
users.

On the other hand, updates to nix-cache-info should be pretty rare,
hence the choice of a fairly long TTL. Configurability is probably not
useful enough to warrant implementing it.
2022-06-22 10:49:18 -04:00
Linus Heckemann dbdc63bc41 path-info: use full store paths when we have them
Fixes #5645
2022-02-19 00:32:05 +01:00
Linus Heckemann a3553cdae8 doc/nix-shell: Remove outdated bashrc information
This behaviour was removed in 65f6d5db6f.
2021-05-11 14:33:35 +02:00
Linus Heckemann f59404e1a6 nix-env: refactor uninstallDerivations
Reduces the number of store queries it performs. Also prints a warning
if any of the selectors did not match any installed derivations.

UX Caveats:
- Will print a warning that nothing matched if a previous selector
  already removed the path
- Will not do anything if no selectors were provided (no change from
  before).

Fixes #3531
2020-04-25 16:30:42 +02:00
Linus Heckemann 2aa89daab3 eval: improve type description for primops and applied primops
This can make type errors a little easier to understand.
2019-03-21 15:31:46 +01:00
Linus Heckemann 6f093073b6 manual: include builtins.* for globally available builtins
This improves searchability.
2019-03-21 09:37:22 +01:00
Linus Heckemann 40e0c9e925 nix ls-nar: allow reading from FIFOs
fixes #2528
2018-11-16 16:24:36 +01:00
Linus Heckemann 34d2948f21 Fix manual build
This was broken by some missing closing tags in 0bea4a50e0
2018-11-08 14:07:19 +01:00
Linus Heckemann f3b8173a93 config: use all of XDG_CONFIG_DIRS
Previously, config would only be read from XDG_CONFIG_HOME. This change
allows reading config from additional directories, which enables e.g.
per-project binary caches or chroot stores with the help of direnv.
2018-10-31 09:24:43 +01:00
Linus Heckemann a25abe823f Promote log-lines to a fully-qualified option
This allows commands like

nix build --log-lines 30 nixpkgs.hello

in order to obtain more information in case of a failure.
2018-10-23 16:54:24 +02:00
Linus Heckemann d7402c9cd5 dirOf: allow use on non-absolute paths 2018-08-13 11:27:35 +02:00
Linus Heckemann 9ac1a79882 copyPathsToStore: honour keep-going 2018-07-24 17:05:06 +02:00
Linus Heckemann 639c166647 build-remote: take extra-platforms into account 2018-03-16 22:50:57 +00:00
Linus Heckemann 637701b604 rename build-extra-platforms -> extra-platforms
also document it
2018-03-16 22:50:27 +00:00
Linus Heckemann 12913ccf45 nix-shell: allow symlinks to .drvs
This makes persistent shell environments easier to use.
2018-03-16 22:15:24 +00:00
Linus Heckemann 919c3c20b3 seccomp: add 32-bit ARM on aarch64-linux
This allows building armv[67]l-linux derivations on compatible aarch64
machines. Failure to add the architecture may result from missing
hardware support, in which case we can't run 32-bit binaries and don't
need to restrict them with seccomp anyway,
2018-02-27 00:32:15 +00:00
Linus Heckemann eb03a296c1 Add build-extra-platforms setting
This allows specifying additional systems that a machine is able to
build for. This may apply on some armv7-capable aarch64 processors, or
on systems using qemu-user with binfmt-misc to support transparent
execution of foreign-arch programs.

This removes the previous hard-coded assumptions about which systems are
ABI-compatible with which other systems, and instead relies on the user
to specify any additional platforms that they have ensured compatibility
for and wish to build for locally.

NixOS should probably add i686-linux on x86_64-linux systems for this
setting by default.
2018-02-27 00:27:58 +00:00
Linus Heckemann 78ac3eb4eb Fix #1762
nix-store --export, nix-store --dump, and nix dump-path would previously
fail silently if writing the data out failed, because
 a) FdSink::write ignored exceptions, and
 b) the commands relied on FdSink's destructor, which ignores
    exceptions, to flush the data out.

This could cause rather opaque issues with installing nixos, because
nix-store --export would happily proceed even if it couldn't write its
data out (e.g. if nix-store --import on the other side of the pipe
failed).

This commit adds tests that expose these issues in the nix-store
commands, and fixes them for all three.
2018-02-13 14:26:19 +00:00
Linus Heckemann f986a44980 Fix "Unexpected EOF reading a line" error
propagated-user-env-packages files in nixpkgs aren't all terminated by
newlines, as buildenv expected. Now it does not require a terminating
newline; note that this introduces a behaviour change: propagated user
env packages may now be spread across multiple lines. However, nix
1.11.x still expects them to be on a single line so this shouldn't be
used in nixpkgs for now.
2017-11-29 11:56:15 +00:00
Linus Heckemann d48edcc3a5 nix-shell: use appropriate prompt terminator
If running nix-shell as root, the terminator should be # and not $.
2017-05-10 12:03:45 +01:00
Linus Heckemann 9622d00afa Manual: document tryEval 2017-04-17 10:33:53 +01:00
Linus Heckemann b8564987a3 Document toString better 2017-02-20 14:23:48 +00:00
Linus Heckemann bb5a6c0085 Document path-search behaviour 2016-12-11 17:13:37 +00:00
Linus Heckemann 6b30e1462e Add missing DBD::SQLite to shell.nix 2016-12-11 17:13:18 +00:00