mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-21 08:35:43 +02:00
flake/dev: add a convenient devshell
This commit is contained in:
parent
d149f46b00
commit
274293fd69
5 changed files with 129 additions and 11 deletions
|
@ -1,6 +1,6 @@
|
||||||
{inputs, ...}: {
|
{inputs, ...}: {
|
||||||
imports = [
|
imports = [
|
||||||
./dev.nix
|
./dev
|
||||||
./helpers.nix
|
./helpers.nix
|
||||||
./lib.nix
|
./lib.nix
|
||||||
./legacy-packages.nix
|
./legacy-packages.nix
|
||||||
|
|
|
@ -1,17 +1,10 @@
|
||||||
{inputs, ...}: {
|
{inputs, ...}: {
|
||||||
imports = [
|
imports = [
|
||||||
inputs.pre-commit-hooks.flakeModule
|
inputs.pre-commit-hooks.flakeModule
|
||||||
|
./devshell.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
perSystem = {
|
perSystem = {pkgs, ...}: {
|
||||||
pkgs,
|
|
||||||
config,
|
|
||||||
...
|
|
||||||
}: {
|
|
||||||
devShells.default = pkgs.mkShellNoCC {
|
|
||||||
shellHook = config.pre-commit.installationScript;
|
|
||||||
};
|
|
||||||
|
|
||||||
formatter = pkgs.alejandra;
|
formatter = pkgs.alejandra;
|
||||||
|
|
||||||
pre-commit = {
|
pre-commit = {
|
66
flake-modules/dev/devshell.nix
Normal file
66
flake-modules/dev/devshell.nix
Normal file
|
@ -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
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
57
flake.lock
generated
57
flake.lock
generated
|
@ -1,5 +1,26 @@
|
||||||
{
|
{
|
||||||
"nodes": {
|
"nodes": {
|
||||||
|
"devshell": {
|
||||||
|
"inputs": {
|
||||||
|
"flake-utils": "flake-utils",
|
||||||
|
"nixpkgs": [
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1708939976,
|
||||||
|
"narHash": "sha256-O5+nFozxz2Vubpdl1YZtPrilcIXPcRAjqNdNE8oCRoA=",
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "devshell",
|
||||||
|
"rev": "5ddecd67edbd568ebe0a55905273e56cc82aabe3",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "devshell",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"flake-compat": {
|
"flake-compat": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1696426674,
|
"lastModified": 1696426674,
|
||||||
|
@ -68,6 +89,24 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"flake-utils_2": {
|
||||||
|
"inputs": {
|
||||||
|
"systems": "systems_2"
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1701680307,
|
||||||
|
"narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=",
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"rev": "4022d587cbbfd70fe950c1e2083a02621806a725",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"gitignore": {
|
"gitignore": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"nixpkgs": [
|
"nixpkgs": [
|
||||||
|
@ -148,7 +187,7 @@
|
||||||
"pre-commit-hooks": {
|
"pre-commit-hooks": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"flake-compat": "flake-compat_2",
|
"flake-compat": "flake-compat_2",
|
||||||
"flake-utils": "flake-utils",
|
"flake-utils": "flake-utils_2",
|
||||||
"gitignore": "gitignore",
|
"gitignore": "gitignore",
|
||||||
"nixpkgs": [
|
"nixpkgs": [
|
||||||
"nixpkgs"
|
"nixpkgs"
|
||||||
|
@ -173,6 +212,7 @@
|
||||||
},
|
},
|
||||||
"root": {
|
"root": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
|
"devshell": "devshell",
|
||||||
"flake-compat": "flake-compat",
|
"flake-compat": "flake-compat",
|
||||||
"flake-parts": "flake-parts",
|
"flake-parts": "flake-parts",
|
||||||
"home-manager": "home-manager",
|
"home-manager": "home-manager",
|
||||||
|
@ -195,6 +235,21 @@
|
||||||
"repo": "default",
|
"repo": "default",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"systems_2": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1681028828,
|
||||||
|
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||||
|
"owner": "nix-systems",
|
||||||
|
"repo": "default",
|
||||||
|
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nix-systems",
|
||||||
|
"repo": "default",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"root": "root",
|
"root": "root",
|
||||||
|
|
|
@ -16,6 +16,10 @@
|
||||||
url = "github:hercules-ci/flake-parts";
|
url = "github:hercules-ci/flake-parts";
|
||||||
inputs.nixpkgs-lib.follows = "nixpkgs";
|
inputs.nixpkgs-lib.follows = "nixpkgs";
|
||||||
};
|
};
|
||||||
|
devshell = {
|
||||||
|
url = "github:numtide/devshell";
|
||||||
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
};
|
||||||
|
|
||||||
flake-compat.url = "https://flakehub.com/f/edolstra/flake-compat/1.tar.gz";
|
flake-compat.url = "https://flakehub.com/f/edolstra/flake-compat/1.tar.gz";
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue