1{
2 fetchFromGitHub,
3 formats,
4 fzf,
5 git,
6 lib,
7 makeWrapper,
8 neovim,
9 nix-update-script,
10 ripgrep,
11 runCommand,
12 stdenv,
13 vim-full,
14 spacevim_config ? import ./init.nix,
15}:
16
17let
18 format = formats.toml { };
19 spacevimdir = runCommand "SpaceVim.d" { } ''
20 mkdir -p $out
21 cp ${format.generate "init.toml" spacevim_config} $out/init.toml
22 '';
23in
24stdenv.mkDerivation rec {
25 pname = "spacevim";
26 version = "2.4.0";
27 src = fetchFromGitHub {
28 owner = "SpaceVim";
29 repo = "SpaceVim";
30 rev = "v${version}";
31 hash = "sha256-qiNadhQJjU9RY14X8+pd4Ul+NLoNqbxuh3Kenw1dHDc=";
32 };
33
34 nativeBuildInputs = [ makeWrapper ];
35 dontBuild = true;
36
37 installPhase = ''
38 runHook preInstall
39 mkdir -p $out/bin
40
41 cp -r $(pwd) $out/SpaceVim
42
43 # trailing slash very important for SPACEVIMDIR
44 makeWrapper "${vim-full}/bin/vim" "$out/bin/spacevim" \
45 --add-flags "-u $out/SpaceVim/vimrc" --set SPACEVIMDIR "${spacevimdir}/" \
46 --prefix PATH : ${
47 lib.makeBinPath [
48 fzf
49 git
50 ripgrep
51 ]
52 }
53 makeWrapper "${neovim}/bin/nvim" "$out/bin/spacenvim" \
54 --add-flags "-u $out/SpaceVim/init.vim" --set SPACEVIMDIR "${spacevimdir}/" \
55 --prefix PATH : ${
56 lib.makeBinPath [
57 fzf
58 git
59 ripgrep
60 ]
61 }
62 runHook postInstall
63 '';
64
65 passthru.updateScript = nix-update-script { };
66
67 meta = {
68 description = "Modular Vim/Neovim configuration";
69 longDescription = ''
70 SpaceVim is a modular configuration of Vim and Neovim. It's inspired by
71 spacemacs. It manages collections of plugins in layers, which help to
72 collect related packages together to provide features. This approach
73 helps keep the configuration organized and reduces overhead for the user
74 by keeping them from having to think about what packages to install.
75 '';
76 homepage = "https://spacevim.org/";
77 license = lib.licenses.gpl3Plus;
78 maintainers = [ lib.maintainers.perchun ];
79 platforms = lib.platforms.all;
80 mainProgram = "spacevim";
81 };
82}