mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-21 08:35:43 +02:00
flake: formatting (#342)
This commit is contained in:
parent
3ad504ed49
commit
52120a891d
1 changed files with 153 additions and 161 deletions
72
flake.nix
72
flake.nix
|
@ -10,12 +10,12 @@
|
||||||
inputs.pre-commit-hooks.url = "github:cachix/pre-commit-hooks.nix";
|
inputs.pre-commit-hooks.url = "github:cachix/pre-commit-hooks.nix";
|
||||||
inputs.pre-commit-hooks.inputs.nixpkgs.follows = "nixpkgs";
|
inputs.pre-commit-hooks.inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
|
||||||
outputs =
|
outputs = {
|
||||||
{ self
|
self,
|
||||||
, nixpkgs
|
nixpkgs,
|
||||||
, flake-utils
|
flake-utils,
|
||||||
, pre-commit-hooks
|
pre-commit-hooks,
|
||||||
, ...
|
...
|
||||||
} @ inputs:
|
} @ inputs:
|
||||||
with nixpkgs.lib;
|
with nixpkgs.lib;
|
||||||
with builtins; let
|
with builtins; let
|
||||||
|
@ -32,7 +32,7 @@
|
||||||
_module.args = {
|
_module.args = {
|
||||||
pkgs = mkForce pkgs;
|
pkgs = mkForce pkgs;
|
||||||
inherit (pkgs) lib;
|
inherit (pkgs) lib;
|
||||||
helpers = import ./plugins/helpers.nix { inherit (pkgs) lib; };
|
helpers = import ./plugins/helpers.nix {inherit (pkgs) lib;};
|
||||||
inputs = inputs;
|
inputs = inputs;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -43,13 +43,11 @@
|
||||||
|
|
||||||
flakeOutput =
|
flakeOutput =
|
||||||
flake-utils.lib.eachDefaultSystem
|
flake-utils.lib.eachDefaultSystem
|
||||||
(system:
|
(system: let
|
||||||
let
|
pkgs = import nixpkgs {inherit system;};
|
||||||
pkgs = import nixpkgs { inherit system; };
|
extractRustAnalyzer = {
|
||||||
extractRustAnalyzer =
|
stdenv,
|
||||||
{ stdenv
|
pkgs,
|
||||||
, pkgs
|
|
||||||
,
|
|
||||||
}:
|
}:
|
||||||
stdenv.mkDerivation {
|
stdenv.mkDerivation {
|
||||||
pname = "extract_rust_analyzer";
|
pname = "extract_rust_analyzer";
|
||||||
|
@ -58,7 +56,7 @@
|
||||||
dontUnpack = true;
|
dontUnpack = true;
|
||||||
dontBuild = true;
|
dontBuild = true;
|
||||||
|
|
||||||
buildInputs = [ pkgs.python3 ];
|
buildInputs = [pkgs.python3];
|
||||||
|
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
ls -la
|
ls -la
|
||||||
|
@ -66,9 +64,8 @@
|
||||||
cp ${./helpers/extract_rust_analyzer.py} $out/bin/extract_rust_analyzer.py
|
cp ${./helpers/extract_rust_analyzer.py} $out/bin/extract_rust_analyzer.py
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
extractRustAnalyzerPkg = pkgs.callPackage extractRustAnalyzer { };
|
extractRustAnalyzerPkg = pkgs.callPackage extractRustAnalyzer {};
|
||||||
in
|
in {
|
||||||
{
|
|
||||||
checks =
|
checks =
|
||||||
(import ./tests {
|
(import ./tests {
|
||||||
inherit pkgs;
|
inherit pkgs;
|
||||||
|
@ -84,7 +81,7 @@
|
||||||
hooks = {
|
hooks = {
|
||||||
alejandra = {
|
alejandra = {
|
||||||
enable = true;
|
enable = true;
|
||||||
excludes = [ "plugins/_sources" ];
|
excludes = ["plugins/_sources"];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -100,9 +97,9 @@
|
||||||
};
|
};
|
||||||
runUpdates =
|
runUpdates =
|
||||||
pkgs.callPackage
|
pkgs.callPackage
|
||||||
({ pkgs
|
({
|
||||||
, stdenv
|
pkgs,
|
||||||
,
|
stdenv,
|
||||||
}:
|
}:
|
||||||
stdenv.mkDerivation {
|
stdenv.mkDerivation {
|
||||||
pname = "run-updates";
|
pname = "run-updates";
|
||||||
|
@ -110,7 +107,7 @@
|
||||||
|
|
||||||
src = pkgs.rust-analyzer.src;
|
src = pkgs.rust-analyzer.src;
|
||||||
|
|
||||||
nativeBuildInputs = with pkgs; [ extractRustAnalyzerPkg alejandra ];
|
nativeBuildInputs = with pkgs; [extractRustAnalyzerPkg alejandra];
|
||||||
|
|
||||||
buildPhase = ''
|
buildPhase = ''
|
||||||
extract_rust_analyzer.py editors/code/package.json |
|
extract_rust_analyzer.py editors/code/package.json |
|
||||||
|
@ -122,7 +119,7 @@
|
||||||
cp rust-analyzer-config.nix $out/share
|
cp rust-analyzer-config.nix $out/share
|
||||||
'';
|
'';
|
||||||
})
|
})
|
||||||
{ };
|
{};
|
||||||
# Used to updates plugins, launch 'nix run .#nvfetcher' in the 'plugins' directory
|
# Used to updates plugins, launch 'nix run .#nvfetcher' in the 'plugins' directory
|
||||||
nvfetcher = pkgs.nvfetcher;
|
nvfetcher = pkgs.nvfetcher;
|
||||||
};
|
};
|
||||||
|
@ -135,16 +132,15 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
formatter =
|
formatter = let
|
||||||
let
|
|
||||||
# We need to exclude the plugins/_sources/* files as they are autogenerated
|
# We need to exclude the plugins/_sources/* files as they are autogenerated
|
||||||
# nix formatter only takes a derivation so we need to make a proxy that passes
|
# nix formatter only takes a derivation so we need to make a proxy that passes
|
||||||
# the correct flags
|
# the correct flags
|
||||||
excludeWrapper =
|
excludeWrapper = {
|
||||||
{ stdenv
|
stdenv,
|
||||||
, alejandra
|
alejandra,
|
||||||
, writeShellScript
|
writeShellScript,
|
||||||
, ...
|
...
|
||||||
}:
|
}:
|
||||||
stdenv.mkDerivation {
|
stdenv.mkDerivation {
|
||||||
pname = "alejandra-excludes";
|
pname = "alejandra-excludes";
|
||||||
|
@ -152,19 +148,17 @@
|
||||||
|
|
||||||
dontUnpack = true;
|
dontUnpack = true;
|
||||||
dontBuild = true;
|
dontBuild = true;
|
||||||
installPhase =
|
installPhase = let
|
||||||
let
|
|
||||||
script = writeShellScript "alejandra-excludes.sh" ''
|
script = writeShellScript "alejandra-excludes.sh" ''
|
||||||
${alejandra}/bin/alejandra --exclude ./plugins/_sources "$@"
|
${alejandra}/bin/alejandra --exclude ./plugins/_sources "$@"
|
||||||
'';
|
'';
|
||||||
in
|
in ''
|
||||||
''
|
|
||||||
mkdir -p $out/bin
|
mkdir -p $out/bin
|
||||||
cp ${script} $out/bin/alejandra-excludes
|
cp ${script} $out/bin/alejandra-excludes
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
pkgs.callPackage excludeWrapper { };
|
pkgs.callPackage excludeWrapper {};
|
||||||
|
|
||||||
lib = import ./lib {
|
lib = import ./lib {
|
||||||
inherit pkgs;
|
inherit pkgs;
|
||||||
|
@ -179,14 +173,12 @@
|
||||||
nixDarwinModules.nixvim = import ./wrappers/darwin.nix modules;
|
nixDarwinModules.nixvim = import ./wrappers/darwin.nix modules;
|
||||||
rawModules.nixvim = nixvimModules;
|
rawModules.nixvim = nixvimModules;
|
||||||
|
|
||||||
templates =
|
templates = let
|
||||||
let
|
|
||||||
simple = {
|
simple = {
|
||||||
path = ./templates/simple;
|
path = ./templates/simple;
|
||||||
description = "A simple nix flake template for getting started with nixvim";
|
description = "A simple nix flake template for getting started with nixvim";
|
||||||
};
|
};
|
||||||
in
|
in {
|
||||||
{
|
|
||||||
default = simple;
|
default = simple;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue