forked from nix-community/nixvim
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
flake/dev: add a convenient devshell
- Loading branch information
1 parent
d149f46
commit 274293f
Showing
5 changed files
with
129 additions
and
11 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{inputs, ...}: { | ||
imports = [ | ||
./dev.nix | ||
./dev | ||
./helpers.nix | ||
./lib.nix | ||
./legacy-packages.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
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,66 @@ | ||
{inputs, ...}: { | ||
imports = [ | ||
inputs.devshell.flakeModule | ||
]; | ||
|
||
perSystem = { | ||
pkgs, | ||
config, | ||
system, | ||
... | ||
}: { | ||
devshells.default = { | ||
devshell.startup.pre-commit.text = config.pre-commit.installationScript; | ||
|
||
commands = let | ||
# Thanks to this, the user can choose to use `nix-output-monitor` (`nom`) instead of plain `nix` | ||
nix = "$([ '$\{NIXVIM_NOM:-0}' = '1' ] && echo ${pkgs.lib.getExe pkgs.nom} || echo nix)"; | ||
in [ | ||
{ | ||
name = "checks"; | ||
help = "Run all nixvim checks"; | ||
command = "nix flake check"; | ||
} | ||
{ | ||
name = "tests"; | ||
help = "Run nixvim tests"; | ||
command = '' | ||
echo "=> Running nixvim tests for the '${system}' architecture..." | ||
${nix} build .#checks.${system}.tests | ||
''; | ||
} | ||
{ | ||
name = "format"; | ||
help = "Format the entire codebase"; | ||
command = "nix fmt"; | ||
} | ||
{ | ||
name = "docs"; | ||
help = "Build nixvim documentation"; | ||
command = '' | ||
echo "=> Building nixvim documentation..." | ||
${nix} build .#docs | ||
''; | ||
} | ||
{ | ||
name = "serve-docs"; | ||
help = "Build and serve documentation locally"; | ||
command = '' | ||
echo -e "=> Building nixvim documentation...\n" | ||
doc_derivation=$(${nix} build .#docs --no-link --print-out-paths) | ||
echo -e "\n=> Documentation succesfully built ('$doc_derivation')" | ||
port=8000 | ||
echo -e "\n=> Now open your browser and navigate to 'localhost:$port'\n" | ||
${pkgs.lib.getExe pkgs.python3} -m http.server -d "$doc_derivation"/share/doc | ||
''; | ||
} | ||
]; | ||
}; | ||
}; | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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