meson: install shell files

Change-Id: I7c30690e5763d095cf7444333f7b687509051c5f
This commit is contained in:
eldritch horrors 2024-03-29 17:24:16 +01:00
parent 1da1f501fc
commit e28dc26084
6 changed files with 46 additions and 5 deletions

View file

@ -354,13 +354,10 @@ if get_option('profile-build').require(meson.get_compiler('cpp').get_id() == 'cl
endif endif
subdir('src') subdir('src')
subdir('scripts')
subdir('misc')
if enable_tests if enable_tests
# Just configures `scripts/nix-profile.sh.in` (and copies the original to the build directory).
# Done as a subdirectory to convince Meson to put the configured files
# in `build/scripts` instead of just `build`.
subdir('scripts')
subdir('tests/unit') subdir('tests/unit')
subdir('tests/functional') subdir('tests/functional')
endif endif

8
misc/bash/meson.build Normal file
View file

@ -0,0 +1,8 @@
configure_file(
input : 'completion.sh',
output : 'nix',
install : true,
install_dir : datadir / 'bash-completion/completions',
install_mode : 'rw-r--r--',
copy : true,
)

8
misc/fish/meson.build Normal file
View file

@ -0,0 +1,8 @@
configure_file(
input : 'completion.fish',
output : 'nix.fish',
install : true,
install_dir : datadir / 'fish/vendor_completions.d',
install_mode : 'rw-r--r--',
copy : true,
)

3
misc/meson.build Normal file
View file

@ -0,0 +1,3 @@
subdir('bash')
subdir('fish')
subdir('zsh')

10
misc/zsh/meson.build Normal file
View file

@ -0,0 +1,10 @@
foreach script : [ [ 'completion.zsh', '_nix' ], [ 'run-help-nix' ] ]
configure_file(
input : script[0],
output : script.get(1, script[0]),
install : true,
install_dir : datadir / 'zsh/site-functions',
install_mode : 'rw-r--r--',
copy : true,
)
endforeach

View file

@ -1,3 +1,5 @@
# configures `scripts/nix-profile.sh.in` (and copies the original to the build directory).
# this is only needed for tests, but running it unconditionally does not hurt enough to care.
configure_file( configure_file(
input : 'nix-profile.sh.in', input : 'nix-profile.sh.in',
output : 'nix-profile.sh', output : 'nix-profile.sh',
@ -12,3 +14,16 @@ configure_file(
output : 'nix-profile.sh.in', output : 'nix-profile.sh.in',
copy : true, copy : true,
) )
foreach rc : [ '.sh', '.fish', '-daemon.sh', '-daemon.fish' ]
configure_file(
input : 'nix-profile' + rc + '.in',
output : 'nix' + rc,
install : true,
install_dir : sysconfdir / 'profile.d',
install_mode : 'rw-r--r--',
configuration : {
'localstatedir': state_dir,
},
)
endforeach