Use flake-parts

This commit is contained in:
Oliver Davies 2024-07-06 15:23:28 +01:00
parent eab6448f28
commit a8f99675da
2 changed files with 61 additions and 21 deletions

View file

@ -1,5 +1,23 @@
{
"nodes": {
"flake-parts": {
"inputs": {
"nixpkgs-lib": "nixpkgs-lib"
},
"locked": {
"lastModified": 1719994518,
"narHash": "sha256-pQMhCCHyQGRzdfAkdJ4cIWiw+JNuWsTX7f0ZYSyz0VY=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "9227223f6d922fee3c7b190b2cc238a99527bbb7",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "flake-parts",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1717952948,
@ -32,6 +50,18 @@
"type": "github"
}
},
"nixpkgs-lib": {
"locked": {
"lastModified": 1719876945,
"narHash": "sha256-Fm2rDDs86sHy0/1jxTOKB1118Q0O3Uc7EC0iXvXKpbI=",
"type": "tarball",
"url": "https://github.com/NixOS/nixpkgs/archive/5daf0514482af3f97abaefc78a6606365c9108e2.tar.gz"
},
"original": {
"type": "tarball",
"url": "https://github.com/NixOS/nixpkgs/archive/5daf0514482af3f97abaefc78a6606365c9108e2.tar.gz"
}
},
"nixpkgs-unstable": {
"locked": {
"lastModified": 1717786204,
@ -50,6 +80,7 @@
},
"root": {
"inputs": {
"flake-parts": "flake-parts",
"nixpkgs": "nixpkgs",
"nixpkgs-2305": "nixpkgs-2305",
"nixpkgs-unstable": "nixpkgs-unstable"

View file

@ -1,32 +1,41 @@
{
inputs = {
flake-parts.url = "github:hercules-ci/flake-parts";
nixpkgs-2305.url = "github:NixOS/nixpkgs/nixos-23.05";
nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixos-unstable";
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05";
};
outputs =
{ nixpkgs, self, ... }@inputs:
let
system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages.${system};
lib = import ./lib { inherit inputs self; };
inherit (lib) mkNeovim mkVimPlugin;
default = mkVimPlugin { inherit system; };
neovim = mkNeovim { inherit system; };
in
{
inherit lib;
formatter.${system} = pkgs.nixfmt-rfc-style;
packages.${system} = {
inherit default neovim;
inputs@{ self, flake-parts, ... }:
flake-parts.lib.mkFlake { inherit inputs; } {
flake = {
lib = import ./lib { inherit inputs self; };
};
systems = [ "x86_64-linux" ];
perSystem =
{
config,
pkgs,
system,
...
}:
{
apps = {
nvim = {
program = "${config.packages.neovim}/bin/nvim";
type = "app";
};
};
packages = {
default = self.lib.mkVimPlugin { inherit system; };
neovim = self.lib.mkNeovim { inherit system; };
};
formatter = pkgs.nixfmt-rfc-style;
};
};
}