From e28dc26084f5dc65de564a6e4dddf13a239444fd Mon Sep 17 00:00:00 2001 From: eldritch horrors Date: Fri, 29 Mar 2024 17:24:16 +0100 Subject: [PATCH] meson: install shell files Change-Id: I7c30690e5763d095cf7444333f7b687509051c5f --- meson.build | 7 ++----- misc/bash/meson.build | 8 ++++++++ misc/fish/meson.build | 8 ++++++++ misc/meson.build | 3 +++ misc/zsh/meson.build | 10 ++++++++++ scripts/meson.build | 15 +++++++++++++++ 6 files changed, 46 insertions(+), 5 deletions(-) create mode 100644 misc/bash/meson.build create mode 100644 misc/fish/meson.build create mode 100644 misc/meson.build create mode 100644 misc/zsh/meson.build diff --git a/meson.build b/meson.build index ca250ce99..eaa5aa348 100644 --- a/meson.build +++ b/meson.build @@ -354,13 +354,10 @@ if get_option('profile-build').require(meson.get_compiler('cpp').get_id() == 'cl endif subdir('src') +subdir('scripts') +subdir('misc') 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/functional') endif diff --git a/misc/bash/meson.build b/misc/bash/meson.build new file mode 100644 index 000000000..75acce2ea --- /dev/null +++ b/misc/bash/meson.build @@ -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, +) diff --git a/misc/fish/meson.build b/misc/fish/meson.build new file mode 100644 index 000000000..d54de9a13 --- /dev/null +++ b/misc/fish/meson.build @@ -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, +) diff --git a/misc/meson.build b/misc/meson.build new file mode 100644 index 000000000..f279aeff4 --- /dev/null +++ b/misc/meson.build @@ -0,0 +1,3 @@ +subdir('bash') +subdir('fish') +subdir('zsh') diff --git a/misc/zsh/meson.build b/misc/zsh/meson.build new file mode 100644 index 000000000..8063a5cb8 --- /dev/null +++ b/misc/zsh/meson.build @@ -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 diff --git a/scripts/meson.build b/scripts/meson.build index 4fe584850..5bfda71cf 100644 --- a/scripts/meson.build +++ b/scripts/meson.build @@ -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( input : 'nix-profile.sh.in', output : 'nix-profile.sh', @@ -12,3 +14,16 @@ configure_file( output : 'nix-profile.sh.in', 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