-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
96 lines (85 loc) · 2.54 KB
/
flake.nix
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
{
description =
"Make a nushell instance with specific plugins and/or nushell libraries";
nixConfig = {
extra-substituters = [ "https://cache.garnix.io" ];
extra-trusted-public-keys =
[ "cache.garnix.io:CTFPyKSLcx5RMJKfLo5EEPUObbA78b0YQ2DTCJXqr9g=" ];
};
inputs = {
crane.url = "github:ipetkov/crane";
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
# Nu libraries' sources:
nu-batteries-src = {
url = "github:nome/nu-batteries";
flake = false;
};
webserver-nu-src = {
url = "github:Jan9103/webserver.nu";
flake = false;
};
crates-io-index = {
url = "github:rust-lang/crates.io-index";
flake = false;
};
};
outputs = { self, crane, nixpkgs, ... }@flake-inputs:
let
# nixpkgs.lib.systems.flakeExposed, minus powerpc64le-linux
supported-systems = [
"x86_64-linux"
"aarch64-linux"
"x86_64-darwin"
"armv6l-linux"
"armv7l-linux"
"i686-linux"
"aarch64-darwin"
"riscv64-linux"
"x86_64-freebsd"
];
in
{
lib = import ./nix-src/lib.nix flake-inputs;
# Makes the flake directly usable as a function:
__functor = (_: self.lib.nushellWith);
packages = nixpkgs.lib.genAttrs supported-systems (system:
let
pkgs = import nixpkgs { inherit system; };
inputs-for-libs = {
inherit pkgs;
inherit system;
} // (builtins.removeAttrs flake-inputs [
"nixpkgs"
"flake-utils"
]);
std-plugins = with pkgs.nushellPlugins; [
formats
gstat
polars
query
];
nu-libs-and-plugins =
import ./nix-src/nu-libs-and-plugins.nix inputs-for-libs;
nu-with = name: libs: plugins:
self.lib.nushellWith {
inherit pkgs name;
libraries.source = libs;
plugins.nix = std-plugins ++ plugins;
config-nu = builtins.toFile "empty-config.nu"
"# Just source the user config";
keep-path = true;
source-user-config = true;
};
in
nu-libs-and-plugins // (with nu-libs-and-plugins; {
nushellWithStdPlugins = nu-with "nushell-with-std-plugins" [ ] [ ];
nushellWithExtras = nu-with "nushell-with-extras" [
nu-batteries
] [
nu_plugin_file
nu_plugin_plotters
nu_plugin_vec
];
}));
};
}