90 lines
3.5 KiB
Nix
90 lines
3.5 KiB
Nix
|
{
|
||
|
inputs,
|
||
|
cell,
|
||
|
}: {
|
||
|
ty-deprecate = let
|
||
|
exampleBrand = cell.lib.ty.brand-ctor "example";
|
||
|
brandedItem = exampleBrand "someValue";
|
||
|
in
|
||
|
assert (brandedItem.__brand == "example");
|
||
|
assert (brandedItem.__value == "someValue"); let
|
||
|
coalescedItem = cell.lib.ty.brand-coalesce brandedItem;
|
||
|
coalescedSeq = cell.lib.ty.brand-coalesce-seq [brandedItem "hello"];
|
||
|
promoted = cell.lib.ty.brand-coalesce "hello";
|
||
|
in
|
||
|
assert (coalescedItem.__brand != "__unbranded__");
|
||
|
assert (promoted.__brand == "__unbranded__");
|
||
|
assert ((builtins.elemAt coalescedSeq 0) == brandedItem);
|
||
|
assert ((let v = builtins.elemAt coalescedSeq 1; in builtins.trace "${builtins.toJSON v}" v) == promoted); let
|
||
|
items = [(exampleBrand "A") (exampleBrand "B") (cell.lib.ty.brand-ctor "second" "C")];
|
||
|
grouped = cell.lib.ty.brand-group items;
|
||
|
in
|
||
|
assert (builtins.length (grouped.example) == 2);
|
||
|
assert (builtins.length (grouped.second) == 1); let
|
||
|
retainItem = cell.lib.deprecate.mkDeprecate {myItem = "value";} {ctx_str = "example context";};
|
||
|
deprecate = cell.lib.deprecate.mkDeprecate {deprecate = 15;} {stage = 256;};
|
||
|
processedSeq = cell.lib.deprecate.deprecate-seq-handler 0 [retainItem];
|
||
|
partiallyRemoved = cell.lib.deprecate.deprecate-seq-handler 2 [retainItem brandedItem];
|
||
|
removeDeprecated = cell.lib.deprecate.deprecate-seq-handler 2 [deprecate brandedItem];
|
||
|
passthru = cell.lib.deprecate.deprecate-seq-handler 4 [retainItem brandedItem deprecate];
|
||
|
in
|
||
|
assert (retainItem.__brand == "deprecate");
|
||
|
# Since the stage is 0, it filters the deprecated item out
|
||
|
assert (builtins.length processedSeq == 1);
|
||
|
assert (builtins.head partiallyRemoved == "value");
|
||
|
assert (builtins.head removeDeprecated == brandedItem);
|
||
|
assert (builtins.length passthru == 2); true;
|
||
|
deprecate = let
|
||
|
inherit (cell.lib.deprecate) mkDeprecate deprecate-seq-handler;
|
||
|
inherit (inputs.nixpkgs) system;
|
||
|
inherit
|
||
|
(inputs.nixpkgs-vimplugins.legacyPackages.${system}.vimPlugins)
|
||
|
plenary-nvim
|
||
|
nvim-treesitter
|
||
|
nvim-treesitter-textobjects
|
||
|
nvim-treesitter-context
|
||
|
telescope-fzf-native-nvim
|
||
|
telescope-file-browser-nvim
|
||
|
vim-jack-in
|
||
|
nui-nvim
|
||
|
telescope-live-grep-args-nvim
|
||
|
nvim-colorizer-lua
|
||
|
git-worktree-nvim
|
||
|
;
|
||
|
sg-nvim = let
|
||
|
_sg = inputs.cells.dotfiles.packages.sg-nvim;
|
||
|
in {
|
||
|
plugin = _sg;
|
||
|
# NOTE: Wait, this mean the plugin is exclusively lua only since package.cpath is Lua API
|
||
|
config = ''
|
||
|
package.cpath = package.cpath .. ";${_sg}/lib/*.so;${_sg}/lib/*.dylib"
|
||
|
'';
|
||
|
type = "lua";
|
||
|
};
|
||
|
plugins = [
|
||
|
(mkDeprecate {inherit sg-nvim;} {
|
||
|
stage = 2;
|
||
|
meta.since = "2023-10-20";
|
||
|
})
|
||
|
(mkDeprecate {inherit vim-jack-in;} {
|
||
|
stage = 2;
|
||
|
meta.since = "2023-10-20";
|
||
|
})
|
||
|
plenary-nvim
|
||
|
nvim-treesitter.withAllGrammars
|
||
|
nvim-treesitter-textobjects
|
||
|
telescope-fzf-native-nvim
|
||
|
telescope-file-browser-nvim
|
||
|
nvim-treesitter-context
|
||
|
telescope-live-grep-args-nvim
|
||
|
nvim-colorizer-lua
|
||
|
git-worktree-nvim
|
||
|
nui-nvim
|
||
|
];
|
||
|
pluglen = builtins.length plugins;
|
||
|
rm = let v = deprecate-seq-handler 1 plugins; in assert (builtins.length v) < pluglen; v;
|
||
|
retain = let v = deprecate-seq-handler 10 plugins; in assert (builtins.length v) == pluglen; v;
|
||
|
in
|
||
|
builtins.trace (builtins.toJSON {inherit rm retain;}) true;
|
||
|
}
|