Skip to content

Commit

Permalink
Merge pull request #11287 from obsidiansystems/meson-nix-cli-symlinks
Browse files Browse the repository at this point in the history
Fix Meson installation of the Nix CLI
  • Loading branch information
Ericson2314 committed Aug 13, 2024
2 parents 59def6c + 95fe9f5 commit 3bdfc82
Showing 1 changed file with 52 additions and 0 deletions.
52 changes: 52 additions & 0 deletions src/nix/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -192,3 +192,55 @@ this_exe = executable(
link_args: linker_export_flags,
install : true,
)

meson.override_find_program('nix', this_exe)

nix_symlinks = [
'nix-build',
'nix-channel',
'nix-collect-garbage',
'nix-copy-closure',
'nix-daemon',
'nix-env',
'nix-hash',
'nix-instantiate',
'nix-prefetch-url',
'nix-shell',
'nix-store',
]

foreach linkname : nix_symlinks
install_symlink(
linkname,
# TODO(Qyriad): should these continue to be relative symlinks?
pointing_to : 'nix',
install_dir : get_option('bindir'),
# The 'runtime' tag is what executables default to, which we want to emulate here.
install_tag : 'runtime'
)
t = custom_target(
command: ['ln', '-sf', fs.name(this_exe), '@OUTPUT@'],
output: linkname,
# TODO(Ericson2314): Don't do this once we have the `meson.override_find_program` working)
build_by_default: true
)
# TODO(Ericson3214): Dosen't yet work
#meson.override_find_program(linkname, t)
endforeach

install_symlink(
'build-remote',
pointing_to : '..' / '..'/ get_option('bindir') / 'nix',
install_dir : get_option('libexecdir') / 'nix',
# The 'runtime' tag is what executables default to, which we want to emulate here.
install_tag : 'runtime'
)

custom_target(
command: ['ln', '-sf', fs.name(this_exe), '@OUTPUT@'],
output: 'build-remote',
# TODO(Ericson2314): Don't do this once we have the `meson.override_find_program` working)
build_by_default: true
)
# TODO(Ericson3214): Dosen't yet work
#meson.override_find_program(linkname, t)

0 comments on commit 3bdfc82

Please sign in to comment.