From 481ad09f98b58c2dca7a4e9dc55fec25c6f7b477 Mon Sep 17 00:00:00 2001 From: Sebastian Estrella <2049686+sestrella@users.noreply.github.com> Date: Thu, 5 Oct 2023 16:34:12 -0500 Subject: [PATCH] Extract vim-plugins to a separate flake --- flake.lock | 70 +++++++++++++++++++++++++- flake.nix | 9 ++-- flakes/vim-plugins/flake.nix | 25 +++++++++ home.nix | 11 +--- home/neovim/plugins/auto-dark-mode.nix | 2 +- 5 files changed, 101 insertions(+), 16 deletions(-) create mode 100644 flakes/vim-plugins/flake.nix diff --git a/flake.lock b/flake.lock index f1a5636..88accb4 100644 --- a/flake.lock +++ b/flake.lock @@ -109,6 +109,24 @@ "type": "github" } }, + "flake-utils_3": { + "inputs": { + "systems": "systems_3" + }, + "locked": { + "lastModified": 1694529238, + "narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "ff7b65b44d01cf9ba6a71320833626af21126384", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, "gitignore": { "inputs": { "nixpkgs": [ @@ -255,6 +273,22 @@ "type": "github" } }, + "nixpkgs_3": { + "locked": { + "lastModified": 1696419054, + "narHash": "sha256-EdR+dIKCfqL3voZUDYwcvgRDOektQB9KbhBVcE0/3Mo=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "7131f3c223a2d799568e4b278380cd9dac2b8579", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, "pre-commit-hooks": { "inputs": { "flake-compat": [ @@ -285,12 +319,12 @@ }, "root": { "inputs": { - "auto-dark-mode": "auto-dark-mode", "darwin": "darwin", "devenv": "devenv", "flake-utils": "flake-utils_2", "home-manager": "home-manager", - "nixpkgs": "nixpkgs_2" + "nixpkgs": "nixpkgs_2", + "vim-plugins": "vim-plugins" } }, "systems": { @@ -322,6 +356,38 @@ "repo": "default", "type": "github" } + }, + "systems_3": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "vim-plugins": { + "inputs": { + "auto-dark-mode": "auto-dark-mode", + "flake-utils": "flake-utils_3", + "nixpkgs": "nixpkgs_3" + }, + "locked": { + "lastModified": 1, + "narHash": "sha256-Ienx/DvbEUkHDEb6QyDKJYqJHz+N5BszZWokhAnJI4U=", + "path": "flakes/vim-plugins", + "type": "path" + }, + "original": { + "path": "flakes/vim-plugins", + "type": "path" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index fea9b37..ed5ff27 100644 --- a/flake.nix +++ b/flake.nix @@ -1,8 +1,8 @@ { # https://nix-community.github.io/home-manager/index.html#sec-flakes-nix-darwin-module inputs = { - auto-dark-mode.flake = false; - auto-dark-mode.url = "github:f-person/auto-dark-mode.nvim"; + # auto-dark-mode.flake = false; + # auto-dark-mode.url = "github:f-person/auto-dark-mode.nvim"; darwin.inputs.nixpkgs.follows = "nixpkgs"; darwin.url = "github:LnL7/nix-darwin"; devenv.url = "github:cachix/devenv"; @@ -10,11 +10,12 @@ home-manager.inputs.nixpkgs.follows = "nixpkgs"; home-manager.url = "github:nix-community/home-manager"; nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + vim-plugins.url = "path:flakes/vim-plugins"; }; outputs = { self - , auto-dark-mode + , vim-plugins , darwin , devenv , flake-utils @@ -30,7 +31,7 @@ { home-manager = { backupFileExtension = "bak"; - extraSpecialArgs = { inherit auto-dark-mode; }; + extraSpecialArgs = { vim-plugins-overlays = inputs.vim-plugins.overlays.${system}; }; users.sestrella = import ./home.nix; }; } diff --git a/flakes/vim-plugins/flake.nix b/flakes/vim-plugins/flake.nix new file mode 100644 index 0000000..96d9cb8 --- /dev/null +++ b/flakes/vim-plugins/flake.nix @@ -0,0 +1,25 @@ +{ + inputs = { + auto-dark-mode.flake = false; + auto-dark-mode.url = "github:f-person/auto-dark-mode.nvim"; + flake-utils.url = "github:numtide/flake-utils"; + nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + }; + + outputs = inputs: inputs.flake-utils.lib.eachDefaultSystem (system: + let pkgs = inputs.nixpkgs.legacyPackages.${system}; + in + rec { + packages = { + auto-dark-mode = pkgs.vimUtils.buildVimPlugin { + name = "auto-dark-mode.nvim"; + src = inputs.auto-dark-mode; + }; + }; + + overlays.default = (final: prev: { + vimPlugins = prev.vimPlugins // { inherit (packages) auto-dark-mode; }; + }); + } + ); +} diff --git a/home.nix b/home.nix index b557824..c2132d9 100644 --- a/home.nix +++ b/home.nix @@ -1,4 +1,4 @@ -{ auto-dark-mode, config, pkgs, ... }: +{ config, pkgs, vim-plugins-overlays, ... }: { # This value determines the Home Manager release that your @@ -67,13 +67,6 @@ programs.starship.enable = true; nixpkgs.overlays = [ - (final: prev: { - vimPlugins = prev.vimPlugins.extend (final': prev': { - auto-dark-mode-nvim = pkgs.vimUtils.buildVimPlugin { - name = "auto-dark-mode.nvim"; - src = auto-dark-mode; - }; - }); - }) + vim-plugins-overlays.default ]; } diff --git a/home/neovim/plugins/auto-dark-mode.nix b/home/neovim/plugins/auto-dark-mode.nix index 000985f..6cf403c 100644 --- a/home/neovim/plugins/auto-dark-mode.nix +++ b/home/neovim/plugins/auto-dark-mode.nix @@ -2,7 +2,7 @@ [ { - plugin = pkgs.vimPlugins.auto-dark-mode-nvim; + plugin = pkgs.vimPlugins.auto-dark-mode; config = builtins.readFile ./auto-dark-mode.lua; type = "lua"; }