aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoreldritch horrors <pennae@lix.systems>2024-03-29 17:24:16 +0100
committereldritch horrors <pennae@lix.systems>2024-03-29 20:10:33 +0000
commite28dc26084f5dc65de564a6e4dddf13a239444fd (patch)
treefae83dc7ad9e71d993988f311215698270d2c0f4
parent1da1f501fcf9384e9cc15405b041f3dd9bb2a51a (diff)
meson: install shell files
Change-Id: I7c30690e5763d095cf7444333f7b687509051c5f
-rw-r--r--meson.build7
-rw-r--r--misc/bash/meson.build8
-rw-r--r--misc/fish/meson.build8
-rw-r--r--misc/meson.build3
-rw-r--r--misc/zsh/meson.build10
-rw-r--r--scripts/meson.build15
6 files changed, 46 insertions, 5 deletions
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