Skip to content

Commit 370fce7

Browse files
committed
Add extraBinDirs setting
1 parent 8f4caf1 commit 370fce7

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed

modules/base.nix

+5
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ with lib;
3333
type = types.attrsOf types.package;
3434
default = {};
3535
};
36+
37+
extraBinDirs = mkOption {
38+
type = types.attrsOf (types.listOf types.package);
39+
default = {};
40+
};
3641
};
3742

3843
config = {

nix/makeEnvironment.nix

+12
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
, lib
33
, fetchgit
44
, fetchFromGitHub
5+
, runCommand
56
, symlinkJoin
67
, system
78
, writeTextDir
@@ -65,6 +66,16 @@ let
6566
meta = chooseMeta pkg;
6667
};
6768

69+
linkBinaries = newBin: inputs: runCommand "${name}-${newBin}" {} ''
70+
mkdir -p "$out/${newBin}"
71+
72+
for input in ${builtins.toString inputs}; do
73+
find "$input/bin" -type f -executable | while read -r executable; do
74+
ln -s "$executable" "$out/${newBin}/$(basename "$executable")"
75+
done
76+
done
77+
'';
78+
6879
in
6980

7081
symlinkJoin {
@@ -74,6 +85,7 @@ symlinkJoin {
7485
++ attrValues evaluated.config.builtLanguageServers
7586
++ lib.optionals (builtins.length exporters > 0) [(writeTextDir "lib/codedown/exporters.yaml" (lib.generators.toYAML {} exporters))]
7687
++ attrValues evaluated.config.packages
88+
++ lib.mapAttrsToList linkBinaries evaluated.config.extraBinDirs
7789
;
7890

7991
passthru = rec {

sample_environments/bash.nix

+7
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
11
{ codedown
2+
, pkgsStable
23
, ...
34
}:
45

56
codedown.makeEnvironment {
67
kernels.bash.enable = true;
8+
9+
extraBinDirs = {
10+
"runner_bin" = [
11+
pkgsStable.tmux
12+
];
13+
};
714
}

0 commit comments

Comments
 (0)