templates: switch to flake-parts

This commit is contained in:
Gaetan Lepage 2024-01-05 12:19:08 +01:00 committed by Gaétan Lepage
parent 31284ddabe
commit f16f767f46
2 changed files with 44 additions and 29 deletions

View file

@ -3,8 +3,11 @@
nixvim.url = "path:../../.."; nixvim.url = "path:../../..";
simple = { simple = {
url = "path:../../simple"; url = "path:../../simple";
inputs.nixvim.follows = "nixvim"; inputs = {
inputs.flake-utils.follows = "nixvim/flake-utils"; nixvim.follows = "nixvim";
nixpkgs.follows = "nixvim/nixpkgs";
flake-parts.follows = "nixvim/flake-parts";
};
}; };
}; };

View file

@ -2,43 +2,55 @@
description = "A nixvim configuration"; description = "A nixvim configuration";
inputs = { inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
nixvim.url = "github:nix-community/nixvim"; nixvim.url = "github:nix-community/nixvim";
flake-utils.url = "github:numtide/flake-utils"; flake-parts.url = "github:hercules-ci/flake-parts";
}; };
outputs = { outputs = {
self, self,
nixpkgs,
nixvim, nixvim,
flake-utils, flake-parts,
... ...
} @ inputs: let } @ inputs: let
config = import ./config; # import the module directly config = import ./config; # import the module directly
in in
flake-utils.lib.eachDefaultSystem (system: let flake-parts.lib.mkFlake {inherit inputs;} {
nixvimLib = nixvim.lib.${system}; systems = [
pkgs = import nixpkgs {inherit system;}; "x86_64-linux"
nixvim' = nixvim.legacyPackages.${system}; "aarch64-linux"
nvim = nixvim'.makeNixvimWithModule { "x86_64-darwin"
inherit pkgs; "aarch64-darwin"
module = config; ];
# You can use `extraSpecialArgs` to pass additional arguments to your module files
extraSpecialArgs = {
inherit self;
};
};
in {
checks = {
# Run `nix flake check .` to verify that your config is not broken
default = nixvimLib.check.mkTestDerivationFromNvim {
inherit nvim;
name = "A nixvim configuration";
};
};
packages = { perSystem = {
# Lets you run `nix run .` to start nixvim pkgs,
default = nvim; system,
...
}: let
nixvimLib = nixvim.lib.${system};
nixvim' = nixvim.legacyPackages.${system};
nvim = nixvim'.makeNixvimWithModule {
inherit pkgs;
module = config;
# You can use `extraSpecialArgs` to pass additional arguments to your module files
extraSpecialArgs = {
inherit self;
};
};
in {
checks = {
# Run `nix flake check .` to verify that your config is not broken
default = nixvimLib.check.mkTestDerivationFromNvim {
inherit nvim;
name = "A nixvim configuration";
};
};
packages = {
# Lets you run `nix run .` to start nixvim
default = nvim;
};
}; };
}); };
} }