From a8f99675da94681a8bb3b77f4eb9b0dc189d3e2f Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Sat, 6 Jul 2024 15:23:28 +0100 Subject: [PATCH] Use `flake-parts` --- flake.lock | 31 +++++++++++++++++++++++++++++++ flake.nix | 51 ++++++++++++++++++++++++++++++--------------------- 2 files changed, 61 insertions(+), 21 deletions(-) diff --git a/flake.lock b/flake.lock index f150a65..3f8ba71 100644 --- a/flake.lock +++ b/flake.lock @@ -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" diff --git a/flake.nix b/flake.nix index f72a5e3..1c06536 100644 --- a/flake.nix +++ b/flake.nix @@ -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; + }; }; }