forked from nushell/nushell
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
129 lines (111 loc) · 3.31 KB
/
Copy pathflake.nix
File metadata and controls
129 lines (111 loc) · 3.31 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
{
nixConfig = {
extra-substituters = [ "https://wvhulle.cachix.org" ];
extra-trusted-public-keys = [ "wvhulle.cachix.org-1:heXx8DZMiRsKUx6l1TxNoF+Nmtmz66QEdsonQzc1ir0=" ];
};
description = "Nushell that shows LSP diagnostics inline as you type";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
crane.url = "github:ipetkov/crane";
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs =
{
nixpkgs,
crane,
rust-overlay,
...
}:
let
system = "x86_64-linux";
pkgs = import nixpkgs {
inherit system;
overlays = [ (import rust-overlay) ];
};
# Toolchain pinned by ./rust-toolchain.toml (single source of truth, matches
# upstream CI). rust-src and rust-analyzer are added for IDE support.
rustToolchain = (pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml).override {
extensions = [
"rust-src"
"rust-analyzer"
];
};
craneLib = (crane.mkLib pkgs).overrideToolchain rustToolchain;
src = pkgs.lib.cleanSource ./.;
# Track the upstream nushell version instead of hardcoding it. The root
# package inherits its version from the workspace.
cargoToml = pkgs.lib.importTOML ./Cargo.toml;
nushellVersion =
if (cargoToml.package.version.workspace or false) then
cargoToml.workspace.package.version
else
cargoToml.package.version;
commonArgs = {
inherit src;
pname = "nu-inline-diagnostics";
version = nushellVersion;
nativeBuildInputs = with pkgs; [
pkg-config
python3
];
buildInputs = with pkgs; [
zstd
libx11
openssl
];
# Required for openssl-sys
OPENSSL_NO_VENDOR = 1;
# Build with mcp feature
cargoExtraArgs = "--features mcp";
};
# Build dependencies separately - this gets cached
cargoArtifacts = craneLib.buildDepsOnly commonArgs;
in
rec {
apps.${system}.default = {
type = "app";
program = pkgs.lib.getExe packages.${system}.default;
};
packages.${system} = {
default = craneLib.buildPackage (
commonArgs
// {
inherit cargoArtifacts;
doCheck = false;
passthru.shellPath = "/bin/nu";
meta = {
description = "Nushell that shows LSP diagnostics inline as you type";
homepage = "https://github.com/wvhulle/nushell";
mainProgram = "nu";
};
}
);
nu_plugin_query = craneLib.buildPackage (
commonArgs
// {
inherit cargoArtifacts;
pname = "nu_plugin_query";
cargoExtraArgs = "--package nu_plugin_query";
doCheck = false;
meta = {
description = "Nushell query plugin";
mainProgram = "nu_plugin_query";
};
}
);
};
# Dev shell for working on nushell
devShells.${system}.default = craneLib.devShell {
packages = with pkgs; [
pkg-config
python3
zstd
libx11
openssl
];
};
};
}