meson-built nix seems to search for the config file in PREFIX/etc/nix.conf instead of PREFIX/etc/nix/nix.conf #231

Closed
opened 2024-04-08 02:17:16 +00:00 by jade · 2 comments
Owner

This might be a self inflicted problem.

I did:

meson configure build --prefix=$(pwd)/outputs/out/
ninja -C build
meson -C build install

I observed: outputs/out/etc/nix/nix.conf is not being read, but outputs/etc/nix.conf was.

nix show-config --json | jq . | grep -C2 machines
  "builders": {
    "aliases": [],
    "defaultValue": "@/home/jade/lix/lix/outputs/out/etc/machines",
    "description": "\nA semicolon-separated list of build machines.\nFor the exact format and examples, see [the manual chapter on remote builds](../advanced-topic
s/distributed-builds.md)\n\n",
    "documentDefault": true,
    "experimentalFeature": null,

This suggests to me that nixConfDir got haunted somehow. Commit 06e11778b5.

This might be a self inflicted problem. I did: ``` meson configure build --prefix=$(pwd)/outputs/out/ ninja -C build meson -C build install ``` I observed: `outputs/out/etc/nix/nix.conf` is not being read, but `outputs/etc/nix.conf` was. ``` nix show-config --json | jq . | grep -C2 machines "builders": { "aliases": [], "defaultValue": "@/home/jade/lix/lix/outputs/out/etc/machines", "description": "\nA semicolon-separated list of build machines.\nFor the exact format and examples, see [the manual chapter on remote builds](../advanced-topic s/distributed-builds.md)\n\n", "documentDefault": true, "experimentalFeature": null, ``` This suggests to me that `nixConfDir` got haunted somehow. Commit 06e11778b594931b24d256a0a68ccea6533c6b48.
jade added the
devx
label 2024-04-08 02:17:49 +00:00
qyriad was assigned by jade 2024-04-08 03:46:20 +00:00
Owner

Okay so this was slightly more of a rabbithole than expected. For this issue itself,

'NIX_CONF_DIR': sysconfdir,

just needs to be sysconfdir / 'nix' (will push a CL in a moment), but this is not actually enough to unfuck the nix.conf dir in general.

sysconfdir plays double duty. It determines the absolute path where Lix should look for nix.conf, and also determines where shell completions are installed. For the Make buildsystem, package.nix sets sysconfdir to /etc, so Lix looks there, but then overrides it specifically for make install. If sysconfdir is set to $out/etc then Lix will only ever look in /nix/store/longhashfor-lix/etc/nix.conf.

So these two need to be separate options in the build. lmao.

Okay so this was slightly more of a rabbithole than expected. For this issue itself, https://git.lix.systems/lix-project/lix/src/commit/a95c62673b06813632b5cf487519fb535e47a2b3/src/libstore/meson.build#L154 just needs to be `sysconfdir / 'nix'` (will push a CL in a moment), but this is not actually enough to unfuck the nix.conf dir in general. `sysconfdir` plays double duty. It determines the *absolute path* where Lix should look for `nix.conf`, and also determines where shell completions are *installed*. For the Make buildsystem, package.nix [sets sysconfdir to `/etc`](https://git.lix.systems/lix-project/lix/src/commit/a95c62673b06813632b5cf487519fb535e47a2b3/package.nix#L299), so Lix looks there, but then [overrides it specifically for `make install`](https://git.lix.systems/lix-project/lix/src/commit/a95c62673b06813632b5cf487519fb535e47a2b3/package.nix#L314). If sysconfdir is set to `$out/etc` then Lix will only ever look in `/nix/store/longhashfor-lix/etc/nix.conf`. So these two need to be separate options in the build. lmao.
Owner

(Correction, not completions but the nix-daemon shell rc scripts)

(Correction, not completions but the nix-daemon shell rc scripts)
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: lix-project/lix#231
No description provided.