Skip to content

flakes: builtins.toXML and nix run use checkout path instead of store path #16550

Closed

Description

@yorickvP

Describe the bug

Since 2.32, a path value in a git flake (./data.txt) returns the path in
the local checkout in places where it used to be the store path:

  • builtins.toXML ./data.txt gives <path value="/home/me/project/data.txt" />
    instead of /nix/store/…-source/data.txt, so the XML depends on where the
    flake is checked out.
  • An app with program = ./run.sh fails with
    error: app program '/home/me/project/run.sh' is not in the Nix store.
    This works in 2.31, and with a path: flake.

Steps To Reproduce

cd "$(mktemp -d)"
echo hi > data.txt
printf '#!/bin/sh\necho hello\n' > run.sh
chmod +x run.sh
cat > flake.nix <<'EOF'
{
  outputs = { self }: {
    toString = toString ./data.txt;
    toXML = builtins.toXML ./data.txt;
    apps.x86_64-linux.default = { type = "app"; program = ./run.sh; };
  };
}
EOF
git init -q
git add -A
git commit -qm init

nix eval --raw .#toString
nix eval --raw .#toXML
nix run .

On master (f83a7f3):

/nix/store/…-source/data.txt
<?xml version='1.0' encoding='utf-8'?>
<expr>
  <path value="/tmp/tmp.XXXXXXXXXX/data.txt" />
</expr>
error: app program '/tmp/tmp.XXXXXXXXXX/run.sh' is not in the Nix store

Expected behavior

As in 2.31:

/nix/store/…-source/data.txt
<?xml version='1.0' encoding='utf-8'?>
<expr>
  <path value="/nix/store/…-source/data.txt" />
</expr>
hello

Metadata

nix-env (Nix) 2.36.0pre20261001_f83a7f3, x86_64-linux

Additional context

Found by https://github.com/yorickvP/nix-pbt assisted by Claude Opus 5.5.

Checklist


Add 👍 to issues you find important.

Activity

  1. added
    language
    on Oct 2, 2026
  2. xokdvium commented on Nov 8, 2026

    @xokdvium
    Contributor

    Fixed the cases outlined here and more that I could find #16780

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugflakeslanguage

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions