mirror of
https://github.com/NotAShelf/nvf.git
synced 2026-06-12 15:58:58 +00:00
flake: remove flake-parts and nix-systems from flake
This commit is contained in:
parent
cd45295f9c
commit
3bc7761c1c
7 changed files with 270 additions and 313 deletions
235
flake.nix
235
flake.nix
|
|
@ -1,71 +1,67 @@
|
|||
{
|
||||
description = "A neovim flake with a modular configuration";
|
||||
outputs = {
|
||||
flake-parts,
|
||||
self,
|
||||
nixpkgs,
|
||||
...
|
||||
} @ inputs: let
|
||||
systems = nixpkgs.lib.platforms.all;
|
||||
|
||||
# Provide simple per-system abstraction
|
||||
# either giving you the system directly
|
||||
# or the package set for that system.
|
||||
eachSystem = nixpkgs.lib.genAttrs systems;
|
||||
|
||||
eachSystemPkgs = f:
|
||||
nixpkgs.lib.genAttrs systems
|
||||
(system: f nixpkgs.legacyPackages.${system});
|
||||
|
||||
# Call the extended 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 {inherit inputs self;};
|
||||
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/templates
|
||||
./flake/apps.nix
|
||||
./flake/packages.nix
|
||||
./flake/develop.nix
|
||||
];
|
||||
in {
|
||||
lib = {
|
||||
inherit (lib) nvim;
|
||||
inherit (lib.nvim) neovimConfiguration;
|
||||
};
|
||||
|
||||
flake = {
|
||||
lib = {
|
||||
inherit (lib) nvim;
|
||||
inherit (lib.nvim) neovimConfiguration;
|
||||
};
|
||||
inherit (lib.importJSON ./npins/sources.json) pins;
|
||||
|
||||
inherit (lib.importJSON ./npins/sources.json) pins;
|
||||
homeManagerModules = {
|
||||
nvf = import ./flake/modules/home-manager.nix {inherit lib inputs;};
|
||||
default = self.homeManagerModules.nvf;
|
||||
neovim-flake =
|
||||
lib.warn ''
|
||||
'homeManagerModules.neovim-flake' has been deprecated, and will be removed
|
||||
in a future release. Please use 'homeManagerModules.nvf' instead.
|
||||
''
|
||||
self.homeManagerModules.nvf;
|
||||
};
|
||||
|
||||
homeManagerModules = {
|
||||
nvf = import ./flake/modules/home-manager.nix {inherit lib inputs;};
|
||||
default = self.homeManagerModules.nvf;
|
||||
neovim-flake =
|
||||
lib.warn ''
|
||||
'homeManagerModules.neovim-flake' has been deprecated, and will be removed
|
||||
in a future release. Please use 'homeManagerModules.nvf' instead.
|
||||
''
|
||||
self.homeManagerModules.nvf;
|
||||
};
|
||||
nixosModules = {
|
||||
nvf = import ./flake/modules/nixos.nix {inherit lib inputs;};
|
||||
default = self.nixosModules.nvf;
|
||||
neovim-flake =
|
||||
lib.warn ''
|
||||
'nixosModules.neovim-flake' has been deprecated, and will be removed
|
||||
in a future release. Please use 'nixosModules.nvf' instead.
|
||||
''
|
||||
self.nixosModules.nvf;
|
||||
};
|
||||
|
||||
nixosModules = {
|
||||
nvf = import ./flake/modules/nixos.nix {inherit lib inputs;};
|
||||
default = self.nixosModules.nvf;
|
||||
neovim-flake =
|
||||
lib.warn ''
|
||||
'nixosModules.neovim-flake' has been deprecated, and will be removed
|
||||
in a future release. Please use 'nixosModules.nvf' instead.
|
||||
''
|
||||
self.nixosModules.nvf;
|
||||
};
|
||||
darwinModules = {
|
||||
nvf = import ./flake/modules/nixos.nix {inherit lib inputs;};
|
||||
default = self.darwinModules.nvf;
|
||||
};
|
||||
|
||||
darwinModules = {
|
||||
nvf = import ./flake/modules/nixos.nix {inherit lib inputs;};
|
||||
default = self.darwinModules.nvf;
|
||||
};
|
||||
};
|
||||
|
||||
perSystem = {pkgs, ...}: {
|
||||
# Provides the default formatter for 'nix fmt', which will format the
|
||||
# entire Nix source with Alejandra. The wrapper script is necessary due to
|
||||
# changes to the behaviour of Nix, which now encourages wrappers for
|
||||
# tree-wide formatting.
|
||||
formatter = pkgs.writeShellApplication {
|
||||
# Provides the default formatter for 'nix fmt', which will format the
|
||||
# entire Nix source with Alejandra. The wrapper script is necessary due to
|
||||
# changes to the behaviour of Nix, which now encourages wrappers for
|
||||
# tree-wide formatting.
|
||||
formatter = eachSystemPkgs (
|
||||
pkgs:
|
||||
pkgs.writeShellApplication {
|
||||
name = "nix3-fmt-wrapper";
|
||||
|
||||
runtimeInputs = [
|
||||
|
|
@ -83,52 +79,109 @@
|
|||
echo "Formatting Markdown files"
|
||||
fd "$@" -t f -e md -x deno fmt -q '{}'
|
||||
'';
|
||||
};
|
||||
}
|
||||
);
|
||||
|
||||
# Provides checks to be built an ran on 'nix flake check'. They can also
|
||||
# be built individually with 'nix build' as described below.
|
||||
checks = {
|
||||
# Check if codebase is properly formatted.
|
||||
# This can be initiated with `nix build .#checks.<system>.nix-fmt`
|
||||
# or with `nix flake check`
|
||||
nix-fmt =
|
||||
pkgs.runCommand "nix-fmt-check"
|
||||
{
|
||||
src = self;
|
||||
nativeBuildInputs = [pkgs.alejandra pkgs.fd];
|
||||
} ''
|
||||
cd "$src"
|
||||
fd -t f -e nix -x alejandra --check '{}'
|
||||
touch $out
|
||||
'';
|
||||
# Provides checks to be built an ran on 'nix flake check'. They can also
|
||||
# be built individually with 'nix build' as described below.
|
||||
checks = eachSystemPkgs (pkgs: {
|
||||
# Check if codebase is properly formatted.
|
||||
# This can be initiated with `nix build .#checks.<system>.nix-fmt`
|
||||
# or with `nix flake check`
|
||||
nix-fmt =
|
||||
pkgs.runCommand "nix-fmt-check"
|
||||
{
|
||||
src = self;
|
||||
nativeBuildInputs = [pkgs.alejandra pkgs.fd];
|
||||
} ''
|
||||
cd "$src"
|
||||
fd -t f -e nix -x alejandra --check '{}'
|
||||
touch $out
|
||||
'';
|
||||
|
||||
# Check if Markdown sources are properly formatted
|
||||
# This can be initiated with `nix build .#checks.<system>.md-fmt`
|
||||
# or with `nix flake check`
|
||||
md-fmt =
|
||||
pkgs.runCommand "md-fmt-check" {
|
||||
src = self;
|
||||
nativeBuildInputs = [pkgs.deno pkgs.fd];
|
||||
} ''
|
||||
cd "$src"
|
||||
fd -t f -e md -x deno fmt --check '{}'
|
||||
touch $out
|
||||
'';
|
||||
};
|
||||
# Check if Markdown sources are properly formatted
|
||||
# This can be initiated with `nix build .#checks.<system>.md-fmt`
|
||||
# or with `nix flake check`
|
||||
md-fmt =
|
||||
pkgs.runCommand "md-fmt-check" {
|
||||
src = self;
|
||||
nativeBuildInputs = [pkgs.deno pkgs.fd];
|
||||
} ''
|
||||
cd "$src"
|
||||
fd -t f -e md -x deno fmt --check '{}'
|
||||
touch $out
|
||||
'';
|
||||
});
|
||||
|
||||
templates = import ./flake/templates;
|
||||
|
||||
apps = eachSystem (system: let
|
||||
inherit (lib.meta) getExe;
|
||||
in {
|
||||
nix = {
|
||||
type = "app";
|
||||
program = getExe self.packages.${system}.nix;
|
||||
meta = {};
|
||||
};
|
||||
};
|
||||
maximal = {
|
||||
type = "app";
|
||||
program = getExe self.packages.${system}.maximal;
|
||||
meta = {};
|
||||
};
|
||||
default = self.apps.${system}.nix;
|
||||
});
|
||||
|
||||
packages = let
|
||||
inherit (lib.attrsets) recursiveUpdate;
|
||||
in
|
||||
recursiveUpdate
|
||||
(eachSystem (system: import ./flake/packages.nix {inherit inputs lib self system;}))
|
||||
(eachSystemPkgs (pkgs: {
|
||||
# This package exists to make development easier by providing the place and
|
||||
# boilerplate to build a test nvf configuration. Feel free to use this for
|
||||
# testing, but make sure to discard the changes before creating a pull
|
||||
# request.
|
||||
dev = let
|
||||
configuration = {
|
||||
# This is essentially the configuration that will be passed to the
|
||||
# builder function. For example:
|
||||
# vim.languages.nix.enable = true;
|
||||
};
|
||||
|
||||
customNeovim = lib.nvim.neovimConfiguration {
|
||||
inherit pkgs;
|
||||
modules = [configuration];
|
||||
};
|
||||
in
|
||||
customNeovim.neovim;
|
||||
}));
|
||||
|
||||
devShells = eachSystemPkgs (pkgs: {
|
||||
# The default dev shell provides packages required to interact with
|
||||
# the codebase as described by the contributing guidelines. It includes the
|
||||
# formatters required, and a few additional goodies for linting work.
|
||||
default = pkgs.mkShellNoCC {
|
||||
packages = with pkgs; [
|
||||
# Nix tooling
|
||||
nil # LSP
|
||||
statix # static checker
|
||||
deadnix # dead code finder
|
||||
|
||||
# So that we can interact with plugin sources
|
||||
npins
|
||||
|
||||
# Formatters
|
||||
alejandra
|
||||
deno
|
||||
];
|
||||
};
|
||||
});
|
||||
};
|
||||
|
||||
inputs = {
|
||||
systems.url = "github:nix-systems/default";
|
||||
|
||||
## Basic Inputs
|
||||
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
|
||||
|
||||
flake-parts = {
|
||||
url = "github:hercules-ci/flake-parts";
|
||||
inputs.nixpkgs-lib.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
flake-compat = {
|
||||
url = "git+https://git.lix.systems/lix-project/flake-compat.git";
|
||||
flake = false;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue