Compare commits

...

3 commits

Author SHA1 Message Date
LordMZTE b56d389390
nix changes 2024-04-25 00:31:45 +02:00
LordMZTE 3e159a31d1
update nix deps 2024-04-24 19:51:15 +02:00
LordMZTE 774f48f30a
mzte-nv: use new inlay hint API 2024-04-22 17:02:12 +02:00
6 changed files with 33 additions and 57 deletions

View file

@ -2,11 +2,11 @@
"nodes": { "nodes": {
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1713537308, "lastModified": 1713714899,
"narHash": "sha256-XtTSSIB2DA6tOv+l0FhvfDMiyCmhoRbNB+0SeInZkbk=", "narHash": "sha256-+z/XjO3QJs5rLE5UOf015gdVauVRQd2vZtsFkaXBq2Y=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "5c24cf2f0a12ad855f444c30b2421d044120c66f", "rev": "6143fc5eeb9c4f00163267708e26191d1e918932",
"type": "github" "type": "github"
}, },
"original": { "original": {

View file

@ -14,7 +14,6 @@
let let
pkgs = import nixpkgs { inherit system; }; pkgs = import nixpkgs { inherit system; };
common = pkgs.callPackage ./lib/common-nix { }; common = pkgs.callPackage ./lib/common-nix { };
flakePkg = ref: (builtins.getFlake ref).packages.${system}.default;
root-mod = { root-mod = {
options.packages = nixpkgs.lib.mkOption { }; options.packages = nixpkgs.lib.mkOption { };
@ -26,16 +25,6 @@
inherit (pkgs) lib stdenv stdenvNoCC; inherit (pkgs) lib stdenv stdenvNoCC;
}; };
# Local user nix env
config.packages.mzte-nix = pkgs.symlinkJoin {
name = "mzte-nix";
paths = [
pkgs.nix-output-monitor
pkgs.nix-du
(flakePkg "github:nix-community/zon2nix")
];
};
# devshell for the dotfiles # devshell for the dotfiles
config.dev-shells.default = nixpkgs.legacyPackages.${system}.mkShell { config.dev-shells.default = nixpkgs.legacyPackages.${system}.mkShell {
buildInputs = with pkgs; buildInputs = with pkgs;

View file

@ -24,16 +24,23 @@ fn lOnAttach(l: *c.lua_State) !c_int {
}; };
if (has_inlay_hints) { if (has_inlay_hints) {
// func: vim.lsp.inlay_hint.enable
c.lua_getglobal(l, "vim"); c.lua_getglobal(l, "vim");
defer c.lua_pop(l, 1);
c.lua_getfield(l, -1, "lsp"); c.lua_getfield(l, -1, "lsp");
defer c.lua_pop(l, 1);
c.lua_getfield(l, -1, "inlay_hint"); c.lua_getfield(l, -1, "inlay_hint");
defer c.lua_pop(l, 1);
c.lua_getfield(l, -1, "enable"); c.lua_getfield(l, -1, "enable");
c.lua_pushnumber(l, bufnr);
// arg 1: true
c.lua_pushboolean(l, 1); c.lua_pushboolean(l, 1);
// arg 2: table w/ bufnr
c.lua_createtable(l, 0, 1);
c.lua_pushnumber(l, bufnr);
c.lua_setfield(l, -2, "bufnr");
c.lua_call(l, 2, 0); c.lua_call(l, 2, 0);
c.lua_pop(l, 3);
} }
return 0; return 0;

View file

@ -3,6 +3,6 @@
imports = [ imports = [
./cgnix ./cgnix
./mcdev.nix ./mcdev.nix
./userstyles.nix ./mzte-nix.nix
]; ];
} }

18
nix/mzte-nix.nix Normal file
View file

@ -0,0 +1,18 @@
{ lib, pkgs, config, ... }:
let
flakePkg = ref: (builtins.getFlake ref).packages.${pkgs.system}.default;
in
{
options.mzte-nix-packages = lib.mkOption { };
config.mzte-nix-packages = [
pkgs.nix-output-monitor
pkgs.nix-du
(flakePkg "github:nix-community/zon2nix")
];
config.packages.mzte-nix = pkgs.symlinkJoin {
name = "mzte-nix";
paths = config.mzte-nix-packages;
};
}

View file

@ -1,38 +0,0 @@
# Module that provides an output for a stylus import file with catppuccin themes.
{ pkgs, stdenvNoCC, ... }:
let
flavor = "mocha";
accent-color = "red";
in
{
packages.userstyles = stdenvNoCC.mkDerivation {
name = "userstyles.json";
src = pkgs.fetchurl {
url = "https://github.com/catppuccin/userstyles/releases/download/all-userstyles-export/import.json";
hash = "sha256-eYU9Y95au9mI3muS4+1QJt31W7s2zVmurdKbQ1dU+pk=";
};
dontUnpack = true;
# TODO: use better language
realBuilder = "${pkgs.deno}/bin/deno";
args = [
"run"
"-A"
(pkgs.writeText "build.js" ''
const json = await import(Deno.env.get("src"), { with: { type: "json" } });
const processed = json.default.map(theme => {
if (theme.usercssData?.vars?.accentColor?.default)
theme.usercssData.vars.accentColor.default = "${accent-color}";
if (theme.usercssData?.vars?.darkFlavor?.default)
theme.usercssData.vars.darkFlavor.default = "${flavor}";
return theme;
});
Deno.writeTextFileSync(Deno.env.get("out"), JSON.stringify(processed));
'')
];
};
}