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": { "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": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1717952948, "lastModified": 1717952948,
@ -32,6 +50,18 @@
"type": "github" "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": { "nixpkgs-unstable": {
"locked": { "locked": {
"lastModified": 1717786204, "lastModified": 1717786204,
@ -50,6 +80,7 @@
}, },
"root": { "root": {
"inputs": { "inputs": {
"flake-parts": "flake-parts",
"nixpkgs": "nixpkgs", "nixpkgs": "nixpkgs",
"nixpkgs-2305": "nixpkgs-2305", "nixpkgs-2305": "nixpkgs-2305",
"nixpkgs-unstable": "nixpkgs-unstable" "nixpkgs-unstable": "nixpkgs-unstable"

View file

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