Jump to content

Cheatsheet: Difference between revisions

Explain how to add to store with builtins.path
imported>Lordcirth
m (Typo)
imported>Nh2
(Explain how to add to store with builtins.path)
Line 314: Line 314:
$ printf "$storepath\n\n0\n" | nix-store --register-validity --reregister  # register the file in the Nix database
$ printf "$storepath\n\n0\n" | nix-store --register-validity --reregister  # register the file in the Nix database
$ exit  # exit to the original shell where /nix/store is still mounted read-only
$ exit  # exit to the original shell where /nix/store is still mounted read-only
</syntaxHighlight>
To add a file with fixed name (when the input filename is not stable), or to add entire directories with filter, you can use '''builtins.path''':
<syntaxHighlight lang="console">
$ nix-instantiate --eval --read-write-mode -E 'builtins.path { path = ./myfile; name = "myname"; }'
</syntaxHighlight>
</syntaxHighlight>


Anonymous user