-
Notifications
You must be signed in to change notification settings - Fork 51
/
Copy pathflake.nix
86 lines (81 loc) · 2.48 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
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
flake-parts.url = "github:hercules-ci/flake-parts";
pre-commit-nix.url = "github:cachix/pre-commit-hooks.nix";
rust-overlay.url = "github:oxalica/rust-overlay";
nci.url = "github:yusdacra/nix-cargo-integration";
};
outputs = {
self,
flake-parts,
...
} @ inputs:
flake-parts.lib.mkFlake {inherit inputs;} {
imports = [
inputs.nci.flakeModule
inputs.pre-commit-nix.flakeModule
];
systems = ["x86_64-darwin" "x86_64-linux" "aarch64-darwin" "aarch64-linux"];
perSystem = {
config,
lib,
pkgs,
self',
...
}: let
inherit (config.nci) outputs;
withOpenSSL = {
# Needed to get openssl-sys to use pkgconfig.
env = lib.optionalAttrs pkgs.stdenv.isLinux {
OPENSSL_NO_VENDOR = true;
};
mkDerivation = {
nativeBuildInputs = with pkgs; [pkg-config];
buildInputs = with pkgs; [openssl] ++ lib.optionals pkgs.stdenv.isDarwin [
darwin.apple_sdk.frameworks.Security
darwin.apple_sdk.frameworks.SystemConfiguration
];
prePatch = ''
rm .cargo/config.toml
'';
};
};
in {
nci = {
toolchainConfig = ./rust-toolchain.toml;
projects."sg.nvim" = {
path = ./.;
drvConfig = withOpenSSL;
depsDrvConfig = withOpenSSL;
};
crates = {
jsonrpc = {};
sg-gql = {};
sg-types = {};
sg = {};
};
};
devShells.default = outputs."sg.nvim".devShell;
packages = {
default = outputs.sg.packages.release;
sg-nvim = pkgs.vimUtils.buildVimPlugin {
name = "sg.nvim";
inherit (self'.packages.default) version;
src = ./.;
propagatedBuildInputs = [self'.packages.default];
# Some package managers, like lazy.nvim, have some nifty features that depend on plugin directories being full fledged git repositories.
# So we'll leave .git lying around just for them :)
leaveDotGit = true;
};
};
pre-commit = {
settings = {
hooks.alejandra.enable = true;
hooks.rustfmt.enable = true;
hooks.cargo-check.enable = true;
};
};
};
};
}