forked from nix-community/nixvim
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
misc: added flake template (nix-community#219)
* Added simple flake template * Added readme to template * Updated readme to show how to use the template * Formatting * removed unused file from template * Fixed template url and pkgs * Formatting
- Loading branch information
1 parent
6e027c4
commit 2258eb8
Showing
9 changed files
with
133 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{pkgs, ...}: { | ||
checkNvim = { | ||
name, | ||
nvim, | ||
... | ||
}: | ||
pkgs.stdenv.mkDerivation { | ||
name = name; | ||
|
||
nativeBuildInputs = [nvim]; | ||
|
||
dontUnpack = true; | ||
# We need to set HOME because neovim will try to create some files | ||
# | ||
# Because neovim does not return an exitcode when quitting we need to check if there are | ||
# errors on stderr | ||
buildPhase = '' | ||
output=$(HOME=$(realpath .) nvim -mn --headless "+q" 2>&1 >/dev/null) | ||
if [[ -n $output ]]; then | ||
echo "ERROR: $output" | ||
exit 1 | ||
fi | ||
''; | ||
|
||
# If we don't do this nix is not happy | ||
installPhase = '' | ||
mkdir $out | ||
''; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Args probably only needs pkgs and lib | ||
args: { | ||
# Add all exported modules here | ||
check = import ./check.nix args; | ||
helpers = import ./helpers.nix args; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Nixvim template | ||
|
||
This template gives you a good starting point for configuring nixvim standalone. | ||
|
||
## Configuring | ||
|
||
To start configuring, just add or modify the nix files in `./config`. If you add a new configuration file, remember to add it to the [`congig/default.nix`](./config/default.nix) file | ||
|
||
## Testing your new configuration | ||
|
||
To test your configuration simply run the following command | ||
|
||
``` | ||
nix run . | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
plugins.bufferline = { | ||
enable = true; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
# Import all your configuration modules here | ||
imports = [ | ||
./bufferline.nix | ||
]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
{ | ||
description = "A nixvim configuration"; | ||
|
||
inputs = { | ||
nixvim.url = "github:pta2002/nixvim"; | ||
flake-utils.url = "github:numtide/flake-utils"; | ||
}; | ||
|
||
outputs = { | ||
nixpkgs, | ||
nixvim, | ||
flake-utils, | ||
... | ||
} @ inputs: let | ||
nixvimLib = nixvim.lib; | ||
config = import ./config; # import the module directly | ||
in | ||
flake-utils.lib.eachDefaultSystem (system: let | ||
pkgs = import nixpkgs {inherit system;}; | ||
nixvim' = nixvim.legacyPackages.${system}; | ||
nvim = nixvim'.makeNixvimWithModule { | ||
inherit pkgs; | ||
module = config; | ||
}; | ||
in { | ||
checks = { | ||
# Run `nix check .` to verify that your config is not broken | ||
default = nixvim.lib.${system}.check.checkNvim { | ||
inherit nvim; | ||
name = "A nixvim configuration"; | ||
}; | ||
}; | ||
|
||
packages = { | ||
# Lets you run `nix run .` to start nixvim | ||
default = nvim; | ||
}; | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,16 @@ | ||
{ | ||
makeNixvim, | ||
pkgs, | ||
}: let | ||
} @ args: let | ||
tests = import ./plugins {inherit (pkgs) lib;}; | ||
check = import ../lib/check.nix args; | ||
checkConfig = check.checkNvim; | ||
in | ||
# We attempt to build & execute all configurations | ||
builtins.mapAttrs ( | ||
name: config: let | ||
nvim = makeNixvim config; | ||
in | ||
pkgs.stdenv.mkDerivation { | ||
name = name; | ||
|
||
nativeBuildInputs = [nvim]; | ||
|
||
dontUnpack = true; | ||
# We need to set HOME because neovim will try to create some files | ||
# | ||
# Because neovim does not return an exitcode when quitting we need to check if there are | ||
# errors on stderr | ||
buildPhase = '' | ||
output=$(HOME=$(realpath .) nvim -mn --headless "+q" 2>&1 >/dev/null) | ||
if [[ -n $output ]]; then | ||
echo "ERROR: $output" | ||
exit 1 | ||
fi | ||
''; | ||
|
||
# If we don't do this nix is not happy | ||
installPhase = '' | ||
mkdir $out | ||
''; | ||
} | ||
checkConfig {inherit name nvim;} | ||
) | ||
tests |