From f6724252e56bf9a5e6d8897de1859d70331005a9 Mon Sep 17 00:00:00 2001 From: r17x Date: Fri, 24 May 2024 06:35:59 +0700 Subject: [PATCH] refactor(nvim): merge with r17x/nvim.nix --- flake.lock | 37 ++++++++++++++---------------- flake.nix | 3 +-- modules/parts/default.nix | 9 ++++++-- nvim.nix/default.nix | 47 +++++++++++++++++++-------------------- 4 files changed, 48 insertions(+), 48 deletions(-) diff --git a/flake.lock b/flake.lock index b9ca380..c8720d6 100644 --- a/flake.lock +++ b/flake.lock @@ -335,6 +335,22 @@ "type": "github" } }, + "nixpkgs": { + "locked": { + "lastModified": 1716358718, + "narHash": "sha256-NQbegJb2ZZnAqp2EJhWwTf6DrZXSpA6xZCEq+RGV1r0=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "3f316d2a50699a78afe5e77ca486ad553169061e", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, "nixpkgs-fmt": { "inputs": { "fenix": "fenix", @@ -533,9 +549,7 @@ "master": "master", "nix": "nix", "nix-index-database": "nix-index-database", - "nixpkgs": [ - "unstable" - ], + "nixpkgs": "nixpkgs", "nixpkgs-fmt": "nixpkgs-fmt", "nixvim": "nixvim", "nvim-treesitter": "nvim-treesitter", @@ -544,7 +558,6 @@ "sops": "sops", "stable": "stable", "ts-rescript": "ts-rescript", - "unstable": "unstable", "vimPlugins_chatgpt-nvim": "vimPlugins_chatgpt-nvim", "vimPlugins_codeium": "vimPlugins_codeium", "vimPlugins_git-conflict-nvim": "vimPlugins_git-conflict-nvim", @@ -640,22 +653,6 @@ "type": "github" } }, - "unstable": { - "locked": { - "lastModified": 1716358718, - "narHash": "sha256-NQbegJb2ZZnAqp2EJhWwTf6DrZXSpA6xZCEq+RGV1r0=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "3f316d2a50699a78afe5e77ca486ad553169061e", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixpkgs-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, "utils": { "locked": { "lastModified": 1667395993, diff --git a/flake.nix b/flake.nix index 3466512..74ffb62 100644 --- a/flake.nix +++ b/flake.nix @@ -33,8 +33,7 @@ ## -- nixpkgs master.url = "github:NixOS/nixpkgs/master"; stable.url = "github:NixOS/nixpkgs/release-22.11"; - unstable.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; - nixpkgs.follows = "unstable"; + nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; ## -- Platform diff --git a/modules/parts/default.nix b/modules/parts/default.nix index 90421cc..f836245 100644 --- a/modules/parts/default.nix +++ b/modules/parts/default.nix @@ -3,7 +3,7 @@ { imports = [ ]; - perSystem = { lib, pkgs, system, inputs', ... }: { + perSystem = { lib, system, inputs', ... }: { formatter = inputs.nixpkgs-fmt.defaultPackage.${system}; _module.args = rec { @@ -13,6 +13,12 @@ inherit (pkgs) stdenv; }; + pkgs = import inputs.nixpkgs { + inherit (nixpkgs) config; + inherit system; + overlays = [ self.overlays.default ]; + }; + # nixpkgs (channel) configuration (not the flake input) nixpkgs = { config = lib.mkForce { @@ -49,7 +55,6 @@ in { master = pkgsFrom inputs.master system; - unstable = pkgsFrom inputs.unstable system; stable = pkgsFrom inputs.stable system; }; }; diff --git a/nvim.nix/default.nix b/nvim.nix/default.nix index 4abdc52..21268a0 100644 --- a/nvim.nix/default.nix +++ b/nvim.nix/default.nix @@ -3,32 +3,31 @@ perSystem = { pkgs , system - , nixpkgs , ... - }: + }: let - nixvimLib = inputs.nixvim.lib.${system}; - nixvim' = inputs.nixvim.legacyPackages.${system}; - nixvimModule = { - inherit pkgs; - module = import ./config; # import the module directly - # You can use `extraSpecialArgs` to pass additional arguments to your module files - # extraSpecialArgs = { - # # inherit (inputs) foo; - # }; - }; - nvim = nixvim'.makeNixvimWithModule nixvimModule; - in - { - checks = { - # Run `nix flake check .` to verify that your config is not broken - nvim = nixvimLib.check.mkTestDerivationFromNixvimModule nixvimModule; - }; + nixvimLib = inputs.nixvim.lib.${system}; + nixvim' = inputs.nixvim.legacyPackages.${system}; + nixvimModule = { + inherit pkgs; + module = import ./config; # import the module directly + # You can use `extraSpecialArgs` to pass additional arguments to your module files + # extraSpecialArgs = { + # # inherit (inputs) foo; + # }; + }; + nvim = nixvim'.makeNixvimWithModule nixvimModule; + in + { + checks = { + # Run `nix flake check .` to verify that your config is not broken + nvim = nixvimLib.check.mkTestDerivationFromNixvimModule nixvimModule; + }; - packages = { - # Lets you run `nix run .` to start nixvim - inherit nvim; - }; - }; + packages = { + # Lets you run `nix run .` to start nixvim + inherit nvim; + }; + }; }