-
Notifications
You must be signed in to change notification settings - Fork 55
Expand file tree
/
Copy pathflake.nix
More file actions
78 lines (74 loc) · 2.4 KB
/
Copy pathflake.nix
File metadata and controls
78 lines (74 loc) · 2.4 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
{
description = "Infer parentheses for Clojure, Lisp, and Scheme";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils }:
(flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
parinfer-rust = pkgs.callPackage ./derivation.nix {};
localeEnv = if pkgs.stdenv.isDarwin
then ""
else "LOCALE_ARCHIVE=${pkgs.glibcLocales}/lib/locale/locale-archive";
runVimTests = name: path: pkgs.stdenv.mkDerivation {
name = "parinfer-rust-${name}-tests";
src = ./tests/vim;
buildPhase = ''
printf 'Testing %s\n' '${path}'
LC_ALL=en_US.UTF-8 \
${localeEnv} \
VIM_TO_TEST=${path} \
PLUGIN_TO_TEST=${parinfer-rust}/share/vim-plugins/parinfer-rust \
${pkgs.vim}/bin/vim --clean -u run.vim
'';
installPhase = ''
touch $out
'';
};
in {
packages = {
default = parinfer-rust;
inherit parinfer-rust;
};
checks = {
vim-tests = runVimTests "vim" "${pkgs.vim}/bin/vim";
#FIXME: Currently broken
#neovim-tests = runVimTests "neovim" "${pkgs.neovim}/bin/nvim";
kakoune-tests = pkgs.stdenv.mkDerivation {
name = "parinfer-rust-kakoune-tests";
src = ./tests/kakoune;
buildInputs = [
pkgs.kakoune-unwrapped
parinfer-rust
];
buildPhase = ''
patchShebangs ./run.sh
PLUGIN_TO_TEST=${parinfer-rust}/share/kak/autoload/plugins ./run.sh
'';
installPhase = ''
touch $out
'';
};
};
devShells.default = parinfer-rust.overrideAttrs (oldAttrs: {
nativeBuildInputs = oldAttrs.nativeBuildInputs ++ (with pkgs; [
vim
neovim
]);
});
})) // {
overlays.default = final: prev: let
parinfer-rust = prev.callPackage ./derivation.nix {};
in {
inherit parinfer-rust;
kakounePlugins = prev.kakounePlugins // {
inherit parinfer-rust;
};
vimPlugins = prev.vimPlugins // {
inherit parinfer-rust;
};
};
};
}