Formatting with nixfmt-rfc-style and setup nixd language server
This commit is contained in:
parent
7915f78ee3
commit
8e8a483e97
7 changed files with 1903 additions and 1796 deletions
9
.helix/languages.toml
Normal file
9
.helix/languages.toml
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
[[language]]
|
||||||
|
auto-format = true
|
||||||
|
file-types = ["nix"]
|
||||||
|
name = "nix"
|
||||||
|
scope = "source.nix"
|
||||||
|
|
||||||
|
[language.formatter]
|
||||||
|
args = ["-"]
|
||||||
|
command = "nixfmt"
|
33
flake.nix
33
flake.nix
|
@ -1,9 +1,12 @@
|
||||||
{
|
{
|
||||||
outputs = inputs: let
|
outputs =
|
||||||
lib = import ./lib inputs;
|
inputs:
|
||||||
in
|
let
|
||||||
|
lib = import ./lib inputs;
|
||||||
|
uGenPkgs = lib.genPkgs inputs.nixpkgs-unstable;
|
||||||
|
in
|
||||||
{
|
{
|
||||||
packages = lib.genPkgs inputs.nixpkgs-unstable (import ./packages);
|
packages = uGenPkgs (import ./packages);
|
||||||
|
|
||||||
nixosConfigurations = import ./packages/hosts inputs;
|
nixosConfigurations = import ./packages/hosts inputs;
|
||||||
# homeConfigurations = import ./packages/users;
|
# homeConfigurations = import ./packages/users;
|
||||||
|
@ -11,23 +14,26 @@
|
||||||
templates = import ./lib/templates;
|
templates = import ./lib/templates;
|
||||||
|
|
||||||
diskoConfigurations = import ./lib/disko inputs;
|
diskoConfigurations = import ./lib/disko inputs;
|
||||||
checks = import ./packages/checks;
|
checks = uGenPkgs (import ./packages/checks inputs);
|
||||||
devShells = import ./packages/shells;
|
devShells = uGenPkgs (import ./packages/shells inputs);
|
||||||
|
|
||||||
nixosModules = import ./lib/modules/nixos inputs;
|
nixosModules = import ./lib/modules/nixos inputs;
|
||||||
homeManagerModules = import ./lib/modules/home inputs;
|
homeManagerModules = import ./lib/modules/home inputs;
|
||||||
|
|
||||||
# overlays = import ./lib/overlays inputs;
|
# overlays = import ./lib/overlays inputs;
|
||||||
|
|
||||||
formatter = lib.genPkgs inputs.nixpkgs-unstable (p: p.nixfmt-rfc-style);
|
formatter = uGenPkgs (p: p.nixfmt-rfc-style);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
TODO: nix-on-droid for phone terminal usage? mobile-nixos?
|
TODO: nix-on-droid for phone terminal usage? mobile-nixos?
|
||||||
TODO: nix-darwin for work?
|
TODO: nix-darwin for work?
|
||||||
TODO: nixos ISO?
|
TODO: nixos ISO?
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
// (import ./nix/constants.nix inputs);
|
// (import ./nix/constants.nix inputs)
|
||||||
|
// {
|
||||||
|
flakeLib = lib;
|
||||||
|
};
|
||||||
|
|
||||||
inputs = {
|
inputs = {
|
||||||
# stable inputs
|
# stable inputs
|
||||||
|
@ -75,7 +81,10 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
nixConfig = {
|
nixConfig = {
|
||||||
extra-experimental-features = ["nix-command" "flakes"];
|
extra-experimental-features = [
|
||||||
|
"nix-command"
|
||||||
|
"flakes"
|
||||||
|
];
|
||||||
|
|
||||||
extra-substituters = [
|
extra-substituters = [
|
||||||
"https://cache.nixos.org/"
|
"https://cache.nixos.org/"
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -6,4 +6,4 @@ scope = "source.nix"
|
||||||
|
|
||||||
[language.formatter]
|
[language.formatter]
|
||||||
args = ["-"]
|
args = ["-"]
|
||||||
command = "alejandra"
|
command = "nixfmt"
|
||||||
|
|
|
@ -4,45 +4,56 @@
|
||||||
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,
|
{
|
||||||
nixpkgs,
|
self,
|
||||||
pre-commit-hooks,
|
nixpkgs,
|
||||||
...
|
pre-commit-hooks,
|
||||||
}: let
|
...
|
||||||
systems = ["aarch64-linux" "aarch64-darwin" "x86_64-darwin" "x86_64-linux"];
|
}:
|
||||||
forSystems = nixpkgs.lib.genAttrs systems;
|
let
|
||||||
pkgsFor = system: (import nixpkgs {inherit system;});
|
systems = [
|
||||||
genPkgs = func: (forSystems (system: func (pkgsFor system)));
|
"aarch64-linux"
|
||||||
in {
|
"aarch64-darwin"
|
||||||
formatter = genPkgs (pkgs: pkgs.alejandra);
|
"x86_64-darwin"
|
||||||
|
"x86_64-linux"
|
||||||
|
];
|
||||||
|
forSystems = nixpkgs.lib.genAttrs systems;
|
||||||
|
pkgsFor = system: (import nixpkgs { inherit system; });
|
||||||
|
genPkgs = func: (forSystems (system: func (pkgsFor system)));
|
||||||
|
in
|
||||||
|
{
|
||||||
|
formatter = genPkgs (pkgs: pkgs.nixfmt-rfc-style);
|
||||||
|
|
||||||
checks = genPkgs (pkgs: {
|
checks = genPkgs (pkgs: {
|
||||||
pre-commit-check = pre-commit-hooks.lib.${pkgs.system}.run {
|
pre-commit-check = pre-commit-hooks.lib.${pkgs.system}.run {
|
||||||
src = ./.;
|
src = ./.;
|
||||||
hooks = {
|
hooks = {
|
||||||
alejandra.enable = true;
|
nixfmt-rfc-style.enable = true;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
});
|
||||||
});
|
|
||||||
|
|
||||||
devShells = genPkgs (pkgs: {
|
devShells = genPkgs (pkgs: {
|
||||||
nix = pkgs.mkShell {
|
nix = pkgs.mkShell {
|
||||||
packages = with pkgs; [nil alejandra];
|
packages = with pkgs; [
|
||||||
inherit (self.outputs.checks.${pkgs.system}.pre-commit-check) shellHook;
|
nixd
|
||||||
};
|
nixfmt-rfc-style
|
||||||
|
];
|
||||||
|
inherit (self.outputs.checks.${pkgs.system}.pre-commit-check) shellHook;
|
||||||
|
};
|
||||||
|
|
||||||
default = self.outputs.devShells.${pkgs.system}.nix;
|
default = self.outputs.devShells.${pkgs.system}.nix;
|
||||||
});
|
});
|
||||||
|
|
||||||
/*
|
/*
|
||||||
packages = genPkgs (pkgs: import ./pkgs {inherit pkgs;});
|
packages = genPkgs (pkgs: import ./pkgs {inherit pkgs;});
|
||||||
overlays = import ./overlays self;
|
overlays = import ./overlays self;
|
||||||
nixosModules = import ./modules/nixos;
|
nixosModules = import ./modules/nixos;
|
||||||
homeManagerModules = import ./modules/home-manager;
|
homeManagerModules = import ./modules/home-manager;
|
||||||
nixosConfigurations = import ./nixos;
|
nixosConfigurations = import ./nixos;
|
||||||
homeConfigurations = import ./home
|
homeConfigurations = import ./home
|
||||||
templates = import ./templates;
|
templates = import ./templates;
|
||||||
*/
|
*/
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,10 @@
|
||||||
|
{ git-hooks, ... }:
|
||||||
|
{ pkgs, ... }:
|
||||||
{
|
{
|
||||||
pkgs,
|
|
||||||
git-hooks,
|
|
||||||
...
|
|
||||||
}: {
|
|
||||||
git-hooks = git-hooks.lib.${pkgs.system}.run {
|
git-hooks = git-hooks.lib.${pkgs.system}.run {
|
||||||
src = ./.;
|
src = ./.;
|
||||||
hooks = {
|
hooks = {
|
||||||
alejandra.enable = true;
|
nixfmt-rfc-style.enable = true;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
|
{ self, ... }:
|
||||||
|
{ pkgs, ... }:
|
||||||
{
|
{
|
||||||
self,
|
|
||||||
pkgs,
|
|
||||||
...
|
|
||||||
}: {
|
|
||||||
default = pkgs.mkShell {
|
default = pkgs.mkShell {
|
||||||
inherit (self.outputs.checks.${pkgs.system}.git-hooks) shellHook;
|
inherit (self.outputs.checks.${pkgs.system}.git-hooks) shellHook;
|
||||||
packages = with pkgs; [
|
packages = with pkgs; [
|
||||||
|
|
Loading…
Add table
Reference in a new issue