From 84e7ea0aa447fbc11293e76977302ab1ee0fab38 Mon Sep 17 00:00:00 2001 From: Flameopathic <64027365+Flameopathic@users.noreply.github.com> Date: Thu, 10 Jul 2025 14:02:34 -0400 Subject: [PATCH] {nixvim,nvf}: add testbeds (#1579) Link: https://github.com/nix-community/stylix/pull/1579 Co-authored-by: NAHO <90870942+trueNAHO@users.noreply.github.com> Co-authored-by: awwpotato --- flake/dev/default.nix | 2 +- flake/dev/flake.lock | 269 +++++++++++++++++- flake/dev/flake.nix | 162 +++++++++-- ...gs-and-dev-nixpkgs-version-consistency.nix | 24 -- .../public-and-dev-version-consistency.nix | 41 +++ modules/neovim/testbeds/nixvim.nix | 18 ++ modules/neovim/testbeds/nvf.nix | 18 ++ stylix/testbed/default.nix | 4 + 8 files changed, 483 insertions(+), 55 deletions(-) delete mode 100644 flake/dev/nixpkgs-and-dev-nixpkgs-version-consistency.nix create mode 100644 flake/dev/public-and-dev-version-consistency.nix create mode 100644 modules/neovim/testbeds/nixvim.nix create mode 100644 modules/neovim/testbeds/nvf.nix diff --git a/flake/dev/default.nix b/flake/dev/default.nix index 2fc3ba64..5bd2e86a 100644 --- a/flake/dev/default.nix +++ b/flake/dev/default.nix @@ -1,9 +1,9 @@ { imports = [ ./dev-shell.nix - ./nixpkgs-and-dev-nixpkgs-version-consistency.nix ./packages.nix ./pre-commit.nix ./treefmt.nix + ./public-and-dev-version-consistency.nix ]; } diff --git a/flake/dev/flake.lock b/flake/dev/flake.lock index 8a49aa06..057a7012 100644 --- a/flake/dev/flake.lock +++ b/flake/dev/flake.lock @@ -1,5 +1,25 @@ { "nodes": { + "dev-flake-parts": { + "inputs": { + "nixpkgs-lib": [ + "dev-nixpkgs" + ] + }, + "locked": { + "lastModified": 1751413152, + "narHash": "sha256-Tyw1RjYEsp5scoigs1384gIg6e0GoBVjms4aXFfRssQ=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "77826244401ea9de6e3bac47c2db46005e1f30b5", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, "dev-nixpkgs": { "locked": { "lastModified": 1751792365, @@ -16,6 +36,21 @@ "type": "github" } }, + "dev-systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, "flake-compat": { "locked": { "lastModified": 1747046372, @@ -31,6 +66,60 @@ "type": "github" } }, + "flake-parts": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib" + }, + "locked": { + "lastModified": 1749398372, + "narHash": "sha256-tYBdgS56eXYaWVW3fsnPQ/nFlgWi/Z2Ymhyu21zVM98=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "9305fe4e5c2a6fcf5ba6a3ff155720fbe4076569", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_2": { + "inputs": { + "systems": "systems_2" + }, + "locked": { + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, "git-hooks": { "inputs": { "flake-compat": [ @@ -83,11 +172,11 @@ ] }, "locked": { - "lastModified": 1751824240, - "narHash": "sha256-aDDC0CHTlL7QDKWWhdbEgVPK6KwWt+ca0QkmHYZxMzI=", + "lastModified": 1752093218, + "narHash": "sha256-+3rXu8ewcNDi65/2mKkdSGrivQs5zEZVp5aYszXC0d0=", "owner": "nix-community", "repo": "home-manager", - "rev": "fd9e55f5fac45a26f6169310afca64d56b681935", + "rev": "206ed3c71418b52e176f16f58805c96e84555320", "type": "github" }, "original": { @@ -96,15 +185,183 @@ "type": "github" } }, + "ixx": { + "inputs": { + "flake-utils": [ + "nixvim", + "nuschtosSearch", + "flake-utils" + ], + "nixpkgs": [ + "nixvim", + "nuschtosSearch", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1748294338, + "narHash": "sha256-FVO01jdmUNArzBS7NmaktLdGA5qA3lUMJ4B7a05Iynw=", + "owner": "NuschtOS", + "repo": "ixx", + "rev": "cc5f390f7caf265461d4aab37e98d2292ebbdb85", + "type": "github" + }, + "original": { + "owner": "NuschtOS", + "ref": "v0.0.8", + "repo": "ixx", + "type": "github" + } + }, + "mnw": { + "locked": { + "lastModified": 1748710831, + "narHash": "sha256-eZu2yH3Y2eA9DD3naKWy/sTxYS5rPK2hO7vj8tvUCSU=", + "owner": "Gerg-L", + "repo": "mnw", + "rev": "cff958a4e050f8d917a6ff3a5624bc4681c6187d", + "type": "github" + }, + "original": { + "owner": "Gerg-L", + "repo": "mnw", + "type": "github" + } + }, + "nixpkgs-lib": { + "locked": { + "lastModified": 1748740939, + "narHash": "sha256-rQaysilft1aVMwF14xIdGS3sj1yHlI6oKQNBRTF40cc=", + "owner": "nix-community", + "repo": "nixpkgs.lib", + "rev": "656a64127e9d791a334452c6b6606d17539476e2", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixpkgs.lib", + "type": "github" + } + }, + "nixvim": { + "inputs": { + "flake-parts": [ + "dev-flake-parts" + ], + "nixpkgs": [ + "dev-nixpkgs" + ], + "nuschtosSearch": "nuschtosSearch", + "systems": [ + "dev-systems" + ] + }, + "locked": { + "lastModified": 1752158208, + "narHash": "sha256-XbXYLUtaB/wHvZYefvaDPbo4eYj27kbtowHfww9bqLw=", + "owner": "nix-community", + "repo": "nixvim", + "rev": "b728cf43d97814df43f5d9bd9dafac9072ccd9e8", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixvim", + "type": "github" + } + }, + "nuschtosSearch": { + "inputs": { + "flake-utils": "flake-utils", + "ixx": "ixx", + "nixpkgs": [ + "nixvim", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1749730855, + "narHash": "sha256-L3x2nSlFkXkM6tQPLJP3oCBMIsRifhIDPMQQdHO5xWo=", + "owner": "NuschtOS", + "repo": "search", + "rev": "8dfe5879dd009ff4742b668d9c699bc4b9761742", + "type": "github" + }, + "original": { + "owner": "NuschtOS", + "repo": "search", + "type": "github" + } + }, + "nvf": { + "inputs": { + "flake-parts": "flake-parts", + "flake-utils": "flake-utils_2", + "mnw": "mnw", + "nixpkgs": [ + "dev-nixpkgs" + ], + "systems": [ + "dev-systems" + ] + }, + "locked": { + "lastModified": 1752164923, + "narHash": "sha256-C9UCBd0MCPMeUJKENW9sakvA/MOEasubMvRUzssElx8=", + "owner": "NotAShelf", + "repo": "nvf", + "rev": "a82b228d82d619c84972b6f5cef171c48c7934b2", + "type": "github" + }, + "original": { + "owner": "NotAShelf", + "repo": "nvf", + "type": "github" + } + }, "root": { "inputs": { + "dev-flake-parts": "dev-flake-parts", "dev-nixpkgs": "dev-nixpkgs", + "dev-systems": "dev-systems", "flake-compat": "flake-compat", "git-hooks": "git-hooks", "home-manager": "home-manager", + "nixvim": "nixvim", + "nvf": "nvf", "treefmt-nix": "treefmt-nix" } }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_2": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, "treefmt-nix": { "inputs": { "nixpkgs": [ @@ -112,11 +369,11 @@ ] }, "locked": { - "lastModified": 1750931469, - "narHash": "sha256-0IEdQB1nS+uViQw4k3VGUXntjkDp7aAlqcxdewb/hAc=", + "lastModified": 1752055615, + "narHash": "sha256-19m7P4O/Aw/6+CzncWMAJu89JaKeMh3aMle1CNQSIwM=", "owner": "numtide", "repo": "treefmt-nix", - "rev": "ac8e6f32e11e9c7f153823abc3ab007f2a65d3e1", + "rev": "c9d477b5d5bd7f26adddd3f96cfd6a904768d4f9", "type": "github" }, "original": { diff --git a/flake/dev/flake.nix b/flake/dev/flake.nix index 13e038ee..bcf5caef 100644 --- a/flake/dev/flake.nix +++ b/flake/dev/flake.nix @@ -4,33 +4,130 @@ flake in the `dev` partition, but do not appear in consumers' lock files. ''; + # We need to define the dev-flake-parts, dev-nixpkgs, and dev-systems inputs + # so that other inputs can follow it. They are prefixed with 'dev-' to avoid + # shadowing public flake inputs, which could affect local testing with + # --override-input. + # + # TODO: Remove the /flake/dev/public-and-dev-version-consistency.nix checks + # and replace + # + # inputs = { + # dev-nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + # + # dev-flake-parts = { + # url = "github:hercules-ci/flake-parts"; + # inputs.nixpkgs-lib.follows = "dev-nixpkgs"; + # }; + # + # dev-systems.url = "github:nix-systems/default"; + # + # # keep-sorted start block=yes newline_separated=yes + # flake-compat.url = "github:edolstra/flake-compat"; + # + # git-hooks = { + # url = "github:cachix/git-hooks.nix"; + # inputs = { + # flake-compat.follows = "flake-compat"; + # nixpkgs.follows = "dev-nixpkgs"; + # }; + # }; + # + # home-manager = { + # url = "github:nix-community/home-manager"; + # inputs.nixpkgs.follows = "dev-nixpkgs"; + # }; + # + # nixvim = { + # url = "github:nix-community/nixvim"; + # inputs = { + # flake-parts.follows = "dev-flake-parts"; + # nixpkgs.follows = "dev-nixpkgs"; + # systems.follows = "dev-systems"; + # }; + # }; + # + # nvf = { + # url = "github:NotAShelf/nvf"; + # inputs = { + # nixpkgs.follows = "dev-nixpkgs"; + # systems.follows = "dev-systems"; + # }; + # }; + # # keep-sorted end + # }; + # + # with + # + # inputs = { + # stylix = { + # url = "path:../.."; + # inputs = { + # base16-fish.follows = ""; + # base16-helix.follows = ""; + # base16-vim.follows = ""; + # base16.follows = ""; + # firefox-gnome-theme.follows = ""; + # gnome-shell.follows = ""; + # nur.follows = ""; + # tinted-foot.follows = ""; + # tinted-kitty.follows = ""; + # tinted-schemes.follows = ""; + # tinted-tmux.follows = ""; + # tinted-zed.follows = ""; + # }; + # }; + # + # # keep-sorted start block=yes newline_separated=yes + # flake-compat.url = "github:edolstra/flake-compat"; + # + # git-hooks = { + # url = "github:cachix/git-hooks.nix"; + # inputs = { + # flake-compat.follows = "flake-compat"; + # nixpkgs.follows = "stylix/nixpkgs"; + # }; + # }; + # + # home-manager = { + # url = "github:nix-community/home-manager"; + # inputs.nixpkgs.follows = "stylix/nixpkgs"; + # }; + # + # nixvim = { + # url = "github:nix-community/nixvim"; + # inputs = { + # flake-parts.follows = "stylix/flake-parts"; + # nixpkgs.follows = "stylix/nixpkgs"; + # systems.follows = "stylix/systems"; + # }; + # }; + # + # nvf = { + # url = "github:NotAShelf/nvf"; + # inputs = { + # nixpkgs.follows = "stylix/nixpkgs"; + # systems.follows = "stylix/systems"; + # }; + # }; + # # keep-sorted end + # }; + # + # once 26.05 is released, giving non-flake end-users and Stylix + # contributors two LTS releases to adopt Nix 2.26+ [1]. Note that + # non-nixpkgs public flake inputs should be disabled. + # + # [1]: https://github.com/NixOS/nix/blob/d4f67fd46dfe2bc950bdfa14273f87b8a4c32e47/doc/manual/source/release-notes/rl-2.26.md?plain=1#L3-L11 inputs = { - # We need to define a nixpkgs input so that other inputs can follow it. - # It is prefixed with 'dev-' to avoid shadowing the public flake's - # 'nixpkgs' input, which could affect local testing with --override-input. - # - # TODO: Replace - # - # dev-nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; - # - # with - # - # dev-nixpkgs = { - # url = "path:../.."; - # inputs = { - # "".follows = ""; - # "".follows = ""; - # "".follows = ""; - # }; - # }; - # - # once 26.05 is released, giving non-flake end-users and Stylix - # contributors two LTS releases to adopt Nix 2.26+ [1]. Note that - # non-nixpkgs public flake inputs should be disabled. - # - # [1]: https://github.com/NixOS/nix/blob/d4f67fd46dfe2bc950bdfa14273f87b8a4c32e47/doc/manual/source/release-notes/rl-2.26.md?plain=1#L3-L11 dev-nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + dev-flake-parts = { + url = "github:hercules-ci/flake-parts"; + inputs.nixpkgs-lib.follows = "dev-nixpkgs"; + }; + + dev-systems.url = "github:nix-systems/default"; + # keep-sorted start block=yes newline_separated=yes flake-compat.url = "github:edolstra/flake-compat"; @@ -47,6 +144,23 @@ inputs.nixpkgs.follows = "dev-nixpkgs"; }; + nixvim = { + url = "github:nix-community/nixvim"; + inputs = { + flake-parts.follows = "dev-flake-parts"; + nixpkgs.follows = "dev-nixpkgs"; + systems.follows = "dev-systems"; + }; + }; + + nvf = { + url = "github:NotAShelf/nvf"; + inputs = { + nixpkgs.follows = "dev-nixpkgs"; + systems.follows = "dev-systems"; + }; + }; + treefmt-nix = { url = "github:numtide/treefmt-nix"; inputs.nixpkgs.follows = "dev-nixpkgs"; diff --git a/flake/dev/nixpkgs-and-dev-nixpkgs-version-consistency.nix b/flake/dev/nixpkgs-and-dev-nixpkgs-version-consistency.nix deleted file mode 100644 index 56e373be..00000000 --- a/flake/dev/nixpkgs-and-dev-nixpkgs-version-consistency.nix +++ /dev/null @@ -1,24 +0,0 @@ -{ inputs, ... }: -{ - perSystem = - { pkgs, ... }: - { - checks.nixpkgs-and-dev-nixpkgs-version-consistency = - pkgs.runCommand "nixpkgs-and-dev-nixpkgs-version-consistency" - { - dev_nixpkgs = inputs.dev-nixpkgs.narHash; - nixpkgs = inputs.nixpkgs.narHash; - } - '' - if [ "$nixpkgs" != "$dev_nixpkgs" ]; then - printf \ - 'inconsistent nixpkgs (%s) and dev-nixpkgs (%s) versions\n' \ - "$nixpkgs" \ - "$dev_nixpkgs" \ - >&2 - exit 1 - fi - mkdir "$out" - ''; - }; -} diff --git a/flake/dev/public-and-dev-version-consistency.nix b/flake/dev/public-and-dev-version-consistency.nix new file mode 100644 index 00000000..6cad4644 --- /dev/null +++ b/flake/dev/public-and-dev-version-consistency.nix @@ -0,0 +1,41 @@ +{ inputs, ... }: +{ + perSystem = + { lib, pkgs, ... }: + { + checks = lib.mkMerge ( + map + ( + input: + let + name = "${input}-and-dev-${input}-version-consistency"; + in + { + ${name} = + let + dev = inputs."dev-${input}".narHash; + public = inputs.${input}.narHash; + in + pkgs.runCommand name { } '' + if [ "${public}" != "${dev}" ]; then + printf \ + 'inconsistent ${input} (%s) and dev-${input} (%s) versions\n' \ + "${public}" \ + "${dev}" \ + >&2 + + exit 1 + fi + + mkdir "$out" + ''; + } + ) + [ + "flake-parts" + "nixpkgs" + "systems" + ] + ); + }; +} diff --git a/modules/neovim/testbeds/nixvim.nix b/modules/neovim/testbeds/nixvim.nix new file mode 100644 index 00000000..9294bb02 --- /dev/null +++ b/modules/neovim/testbeds/nixvim.nix @@ -0,0 +1,18 @@ +{ lib, pkgs, ... }: +{ + stylix.testbed.ui.command = { + text = "nvim example.md"; + useTerminal = true; + }; + + programs.nixvim.enable = true; + + home-manager.sharedModules = lib.singleton { + home.file."example.md" = { + source = pkgs.fetchurl { + url = "https://raw.githubusercontent.com/sharkdp/bat/refs/heads/master/tests/syntax-tests/source/Markdown/example.md"; + hash = "sha256-VYYwgRFY1c2DPY7yGM8oF3zG4rtEpBWyqfPwmGZIkcA="; + }; + }; + }; +} diff --git a/modules/neovim/testbeds/nvf.nix b/modules/neovim/testbeds/nvf.nix new file mode 100644 index 00000000..5e6b6efc --- /dev/null +++ b/modules/neovim/testbeds/nvf.nix @@ -0,0 +1,18 @@ +{ lib, pkgs, ... }: +{ + stylix.testbed.ui.command = { + text = "nvim example.md"; + useTerminal = true; + }; + + programs.nvf.enable = true; + + home-manager.sharedModules = lib.singleton { + home.file."example.md" = { + source = pkgs.fetchurl { + url = "https://raw.githubusercontent.com/sharkdp/bat/refs/heads/master/tests/syntax-tests/source/Markdown/example.md"; + hash = "sha256-VYYwgRFY1c2DPY7yGM8oF3zG4rtEpBWyqfPwmGZIkcA="; + }; + }; + }; +} diff --git a/stylix/testbed/default.nix b/stylix/testbed/default.nix index 68014ca0..ae7ab130 100644 --- a/stylix/testbed/default.nix +++ b/stylix/testbed/default.nix @@ -20,6 +20,10 @@ let inputs.self.nixosModules.stylix inputs.home-manager.nixosModules.home-manager testbed + + # modules for external targets + inputs.nvf.nixosModules.default + inputs.nixvim.nixosModules.nixvim ]; }; in