flake: formatting (#342)

This commit is contained in:
Gaétan Lepage 2023-04-21 10:16:01 +02:00 committed by GitHub
parent 3ad504ed49
commit 52120a891d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -10,12 +10,12 @@
inputs.pre-commit-hooks.url = "github:cachix/pre-commit-hooks.nix";
inputs.pre-commit-hooks.inputs.nixpkgs.follows = "nixpkgs";
outputs =
{ self
, nixpkgs
, flake-utils
, pre-commit-hooks
, ...
outputs = {
self,
nixpkgs,
flake-utils,
pre-commit-hooks,
...
} @ inputs:
with nixpkgs.lib;
with builtins; let
@ -32,7 +32,7 @@
_module.args = {
pkgs = mkForce pkgs;
inherit (pkgs) lib;
helpers = import ./plugins/helpers.nix { inherit (pkgs) lib; };
helpers = import ./plugins/helpers.nix {inherit (pkgs) lib;};
inputs = inputs;
};
};
@ -43,13 +43,11 @@
flakeOutput =
flake-utils.lib.eachDefaultSystem
(system:
let
pkgs = import nixpkgs { inherit system; };
extractRustAnalyzer =
{ stdenv
, pkgs
,
(system: let
pkgs = import nixpkgs {inherit system;};
extractRustAnalyzer = {
stdenv,
pkgs,
}:
stdenv.mkDerivation {
pname = "extract_rust_analyzer";
@ -58,7 +56,7 @@
dontUnpack = true;
dontBuild = true;
buildInputs = [ pkgs.python3 ];
buildInputs = [pkgs.python3];
installPhase = ''
ls -la
@ -66,9 +64,8 @@
cp ${./helpers/extract_rust_analyzer.py} $out/bin/extract_rust_analyzer.py
'';
};
extractRustAnalyzerPkg = pkgs.callPackage extractRustAnalyzer { };
in
{
extractRustAnalyzerPkg = pkgs.callPackage extractRustAnalyzer {};
in {
checks =
(import ./tests {
inherit pkgs;
@ -84,7 +81,7 @@
hooks = {
alejandra = {
enable = true;
excludes = [ "plugins/_sources" ];
excludes = ["plugins/_sources"];
};
};
};
@ -100,9 +97,9 @@
};
runUpdates =
pkgs.callPackage
({ pkgs
, stdenv
,
({
pkgs,
stdenv,
}:
stdenv.mkDerivation {
pname = "run-updates";
@ -110,7 +107,7 @@
src = pkgs.rust-analyzer.src;
nativeBuildInputs = with pkgs; [ extractRustAnalyzerPkg alejandra ];
nativeBuildInputs = with pkgs; [extractRustAnalyzerPkg alejandra];
buildPhase = ''
extract_rust_analyzer.py editors/code/package.json |
@ -122,7 +119,7 @@
cp rust-analyzer-config.nix $out/share
'';
})
{ };
{};
# Used to updates plugins, launch 'nix run .#nvfetcher' in the 'plugins' directory
nvfetcher = pkgs.nvfetcher;
};
@ -135,16 +132,15 @@
};
};
};
formatter =
let
formatter = let
# 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
# the correct flags
excludeWrapper =
{ stdenv
, alejandra
, writeShellScript
, ...
excludeWrapper = {
stdenv,
alejandra,
writeShellScript,
...
}:
stdenv.mkDerivation {
pname = "alejandra-excludes";
@ -152,19 +148,17 @@
dontUnpack = true;
dontBuild = true;
installPhase =
let
installPhase = let
script = writeShellScript "alejandra-excludes.sh" ''
${alejandra}/bin/alejandra --exclude ./plugins/_sources "$@"
'';
in
''
in ''
mkdir -p $out/bin
cp ${script} $out/bin/alejandra-excludes
'';
};
in
pkgs.callPackage excludeWrapper { };
pkgs.callPackage excludeWrapper {};
lib = import ./lib {
inherit pkgs;
@ -179,14 +173,12 @@
nixDarwinModules.nixvim = import ./wrappers/darwin.nix modules;
rawModules.nixvim = nixvimModules;
templates =
let
templates = let
simple = {
path = ./templates/simple;
description = "A simple nix flake template for getting started with nixvim";
};
in
{
in {
default = simple;
};
};