basic autoformat in helix

This commit is contained in:
Cyryl Płotnicki 2022-12-19 09:04:27 +00:00
parent 3f26f07401
commit 2c324ccaf7
3 changed files with 114 additions and 10 deletions

View File

@ -1,5 +1,28 @@
{
"nodes": {
"alejandra": {
"inputs": {
"fenix": "fenix",
"flakeCompat": "flakeCompat",
"nixpkgs": [
"nixpkgs-nixos-unstable"
]
},
"locked": {
"lastModified": 1668317688,
"narHash": "sha256-wC04cwcKyV2TUYXqMibFWkq7WOMIXHw5DrfAJrWHzgI=",
"owner": "kamadorueda",
"repo": "alejandra",
"rev": "378cde949be70caea431682756b36552a58e965d",
"type": "github"
},
"original": {
"owner": "kamadorueda",
"ref": "main",
"repo": "alejandra",
"type": "github"
}
},
"crane": {
"flake": false,
"locked": {
@ -113,6 +136,28 @@
"type": "github"
}
},
"fenix": {
"inputs": {
"nixpkgs": [
"alejandra",
"nixpkgs"
],
"rust-analyzer-src": "rust-analyzer-src"
},
"locked": {
"lastModified": 1668234453,
"narHash": "sha256-FmuZThToBvRsqCauYJ3l8HJoGLAY5cMULeYEKIaGrRw=",
"owner": "nix-community",
"repo": "fenix",
"rev": "8f219f6b36e8d0d56afa7f67e6e3df63ef013cdb",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "fenix",
"type": "github"
}
},
"flake-compat": {
"flake": false,
"locked": {
@ -160,6 +205,22 @@
"type": "github"
}
},
"flakeCompat": {
"flake": false,
"locked": {
"lastModified": 1650374568,
"narHash": "sha256-Z+s0J8/r907g149rllvwhb4pKi8Wam5ij0st8PwAh+E=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "b4a34015c698c7793d592d66adbab377907a2be8",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"helix": {
"inputs": {
"nci": "nci",
@ -339,6 +400,7 @@
},
"root": {
"inputs": {
"alejandra": "alejandra",
"darwin": "darwin",
"flake-compat": "flake-compat",
"flake-utils": "flake-utils",
@ -353,6 +415,23 @@
"sops": "sops"
}
},
"rust-analyzer-src": {
"flake": false,
"locked": {
"lastModified": 1668182250,
"narHash": "sha256-PYGaOCiFvnJdVz+ZCaKF8geGdffXjJUNcMwaBHv0FT4=",
"owner": "rust-lang",
"repo": "rust-analyzer",
"rev": "45ec315e01dc8dd1146dfeb65f0ef6e5c2efed78",
"type": "github"
},
"original": {
"owner": "rust-lang",
"ref": "nightly",
"repo": "rust-analyzer",
"type": "github"
}
},
"rust-overlay": {
"inputs": {
"flake-utils": "flake-utils_2",

View File

@ -2,7 +2,7 @@
description = "NixOS configuration with flakes";
outputs = { self, flake-utils, flake-compat, home-manager
, nixpkgs-nixos-unstable, nixpkgs-master, nixpkgs-stable, darwin
, nixos-hardware, nur, sops, nil, helix }@inputs:
, nixos-hardware, nur, sops, nil, helix, alejandra }@inputs:
let
mkServer = pkgs: system: hostname:
@ -262,7 +262,13 @@
inputs.nixpkgs.follows = "nixpkgs-stable";
inputs.nixpkgs-stable.follows = "nixpkgs-stable";
};
alejandra = {
type = "github";
owner = "kamadorueda";
repo = "alejandra";
ref = "main";
inputs.nixpkgs.follows = "nixpkgs-nixos-unstable";
};
flake-compat = {
url = "github:edolstra/flake-compat";
flake = false;

View File

@ -1,14 +1,33 @@
{ config, pkgs, lib, inputs, system, ... }: {
{
config,
pkgs,
lib,
inputs,
system,
...
}: let
alejandra = lib.getExe inputs.alejandra.packages.${system}.default;
nil = lib.getExe inputs.nil.packages.${system}.default;
in {
programs.helix = {
enable = true;
package = inputs.helix.packages."${system}".helix;
settings = { theme = "solarized_dark"; };
languages = [{
name = "nix";
auto-format = true;
language-server = {
command = "${inputs.nil.packages.${system}.default}/bin/nil";
settings = {
keys.normal = {
C-p = "file_picker";
C-b = "buffer_picker";
};
}];
};
languages = [
{
name = "nix";
auto-format = true;
language-server = {command = nil;};
formatter = {
command = alejandra;
args = ["-q"];
};
}
];
};
}