-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathnu-libs-and-plugins.nix
More file actions
executable file
·72 lines (67 loc) · 1.92 KB
/
nu-libs-and-plugins.nix
File metadata and controls
executable file
·72 lines (67 loc) · 1.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# This flake exposes some existing nushell libraries (packaged with their dependencies)
#
# When adding a library/plugin here, don't forget to add its inputs to the main flake.nix
{
flake-inputs,
pkgs, # Overriden pkgs, with nushell & craneLib
}:
let
nushellLibraries =
let # Shortcut to build a nu library without too much fuss:
simpleNuLib =
name: extraArgs:
pkgs.makeNuLibrary (
{
inherit name;
src = flake-inputs."${name}-src";
}
// extraArgs
);
in
{
nu-batteries = simpleNuLib "nu-batteries" { };
};
nushellPlugins =
let
pluginsBaseBuildInputs =
with pkgs;
[ pkg-config ]
;
nativeBuildInputs =
with pkgs;
lib.optionals (stdenv.hostPlatform.isDarwin) [
iconv
];
pluginSpecifics = import ../plugin-specifics.nix;
buildPluginFromCratesIo =
shortName:
{ broken, ... }@infoFromToml:
let
src = pkgs.craneLib.downloadCargoPackage (
infoFromToml
// {
source = "registry+https://github.com/rust-lang/crates.io-index";
}
);
buildInputs = pluginsBaseBuildInputs ++ ((pluginSpecifics.sysdeps pkgs).${shortName} or [ ]);
cargoArtifacts = pkgs.craneLib.buildDepsOnly {
inherit src buildInputs nativeBuildInputs;
doCheck = false;
};
in
pkgs.craneLib.buildPackage {
inherit src buildInputs nativeBuildInputs cargoArtifacts;
doCheck = false;
}
// {
meta.broken = broken || builtins.elem shortName pluginSpecifics.known-broken;
};
in
# All the plugins from crates.io:
builtins.mapAttrs (shortName: buildPluginFromCratesIo shortName) (
fromTOML (builtins.readFile ../plugin-list.toml)
);
in
{
inherit nushellLibraries nushellPlugins;
}