Skip to content

File system store object of nixos config won't get realize when configuration.nix is empty #442

@n0099

Description

@n0099

Describe the bug

When a configuration.nix that used by flake.nix of nixos config is empty, the store path of flake is not exists in /nix/store, so its store object is not being realized.

Steps To Reproduce

git clone --depth 1 --revision 0defd19d32413f757d7273596cd9641cb91af25a --recurse-submodules https://github.com/n0099/nixos.git
nix repl --show-trace .
nixosConfigurations.nixos.config

gives

[stacktraces]
       error: syntax error, unexpected end of file
       at /nix/store/hbm2x6a84f4gyx43784v20dsayds8mc2-source/configuration.nix:1:1:

that store path /nix/store/hbm2x6a84f4gyx43784v20dsayds8mc2-source of this flake is not exists.


If there's content in configuration.nix

echo '{}' > configuration.nix

rerun nix repl and eval previous expr will realize the store object of flake.


If then mark configuration.nix as skip-worktree:

git update-index --skip-worktree configuration.nix

it'll stop realize the flake again.


If then do anything to make git worktree dirty like

touch test
git add test

it'll be able to realize again.

Expected behavior

Realize the flake's store object.

Metadata

nix (Determinate Nix 3.19.0) 2.34.6

Additional context

It's not reproducible on upstream Nix 2.34.6 that detsys nix 3.19.0 based on, and previous version of detsys nix 3.18.1: v3.18.1...v3.19.0

Checklist

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions