Skip to content

Commit

Permalink
Add nixd to flake.nix and legacyPackages.nix.
Browse files Browse the repository at this point in the history
  • Loading branch information
Elias-Ainsworth committed Nov 11, 2024
1 parent 2489fe9 commit 64713b0
Show file tree
Hide file tree
Showing 3 changed files with 200 additions and 87 deletions.
96 changes: 96 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

155 changes: 84 additions & 71 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -1,91 +1,100 @@
{
description = "A neovim flake with a modular configuration";
outputs = {
flake-parts,
self,
...
} @ inputs: let
# call the extedended library with `inputs`
# inputs is used to get the original standard library, and to pass inputs to the plugin autodiscovery function
lib = import ./lib/stdlib-extended.nix inputs;
in
flake-parts.lib.mkFlake {
inherit inputs;
specialArgs = {inherit lib;};
} {
# Allow users to bring their own systems.
# «https://github.com/nix-systems/nix-systems»
systems = import inputs.systems;
imports = [
./flake/apps.nix
./flake/legacyPackages.nix
./flake/overlays.nix
./flake/packages.nix
];

flake = {
lib = {
inherit (lib) nvim;
inherit (lib.nvim) neovimConfiguration;
outputs =
{
flake-parts,
self,
...
}@inputs:
let
# call the extedended library with `inputs`
# inputs is used to get the original standard library, and to pass inputs to the plugin autodiscovery function
lib = import ./lib/stdlib-extended.nix inputs;
in
flake-parts.lib.mkFlake
{
inherit inputs;
specialArgs = {
inherit lib;
};
}
{
# Allow users to bring their own systems.
# «https://github.com/nix-systems/nix-systems»
systems = import inputs.systems;
imports = [
./flake/apps.nix
./flake/legacyPackages.nix
./flake/overlays.nix
./flake/packages.nix
];

flake = {
lib = {
inherit (lib) nvim;
inherit (lib.nvim) neovimConfiguration;
};

homeManagerModules = {
neovim-flake =
lib.warn ''
homeManagerModules = {
neovim-flake = lib.warn ''
homeManagerModules.neovim-flake has been deprecated.
Plese use the homeManagerModules.nvf instead
''
self.homeManagerModules.nvf;
'' self.homeManagerModules.nvf;

nvf = import ./flake/modules/home-manager.nix self.packages lib;
nvf = import ./flake/modules/home-manager.nix self.packages lib;

default = self.homeManagerModules.nvf;
};
default = self.homeManagerModules.nvf;
};

nixosModules = {
neovim-flake =
lib.warn ''
nixosModules = {
neovim-flake = lib.warn ''
nixosModules.neovim-flake has been deprecated.
Please use the nixosModules.nvf instead
''
self.nixosModules.nvf;
'' self.nixosModules.nvf;

nvf = import ./flake/modules/nixos.nix self.packages lib;

default = self.nixosModules.nvf;
};
};
nvf = import ./flake/modules/nixos.nix self.packages lib;

perSystem = {
self',
config,
pkgs,
...
}: {
devShells = {
default = self'.devShells.lsp;
nvim-nix = pkgs.mkShell {packages = [config.packages.nix];};
lsp = pkgs.mkShell {
packages = with pkgs; [nil statix deadnix alejandra];
default = self.nixosModules.nvf;
};
};

# Provide the default formatter. `nix fmt` in project root
# will format available files with the correct formatter.
# P.S: Please do not format with nixfmt! It messes with many
# syntax elements and results in unreadable code.
formatter = pkgs.alejandra;

# Check if codebase is properly formatted.
# This can be initiated with `nix build .#checks.<system>.nix-fmt`
# or with `nix flake check`
checks = {
nix-fmt = pkgs.runCommand "nix-fmt-check" {nativeBuildInputs = [pkgs.alejandra];} ''
alejandra --check ${self} < /dev/null | tee $out
'';
};
perSystem =
{
self',
config,
pkgs,
...
}:
{
devShells = {
default = self'.devShells.lsp;
nvim-nix = pkgs.mkShell { packages = [ config.packages.nix ]; };
lsp = pkgs.mkShell {
packages = with pkgs; [
nil
statix
deadnix
alejandra
];
};
};

# Provide the default formatter. `nix fmt` in project root
# will format available files with the correct formatter.
# P.S: Please do not format with nixfmt! It messes with many
# syntax elements and results in unreadable code.
formatter = pkgs.alejandra;

# Check if codebase is properly formatted.
# This can be initiated with `nix build .#checks.<system>.nix-fmt`
# or with `nix flake check`
checks = {
nix-fmt = pkgs.runCommand "nix-fmt-check" { nativeBuildInputs = [ pkgs.alejandra ]; } ''
alejandra --check ${self} < /dev/null | tee $out
'';
};
};
};
};

# Flake inputs
inputs = {
Expand All @@ -111,6 +120,10 @@
inputs.nixpkgs.follows = "nixpkgs";
inputs.flake-utils.follows = "flake-utils";
};
nixd = {
url = "github:nix-community/nixd";
inputs.nixpkgs.follows = "nixpkgs";
};

## Plugins
# LSP plugins
Expand Down
36 changes: 20 additions & 16 deletions flake/legacyPackages.nix
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
{inputs, ...}: {
perSystem = {
system,
inputs',
...
}: {
legacyPackages = import inputs.nixpkgs {
inherit system;
overlays = [
inputs.self.overlays.default
(_: _: {
rnix-lsp = inputs'.rnix-lsp.defaultPackage;
nil = inputs'.nil.packages.default;
})
];
{ inputs, ... }:
{
perSystem =
{
system,
inputs',
...
}:
{
legacyPackages = import inputs.nixpkgs {
inherit system;
overlays = [
inputs.self.overlays.default
(_: _: {
rnix-lsp = inputs'.rnix-lsp.defaultPackage;
nil = inputs'.nil.packages.default;
nixd = inputs'.nixd.packages.default;
})
];
};
};
};
}

0 comments on commit 64713b0

Please sign in to comment.