dev: add nix flake

This commit is contained in:
lentilus
2025-01-22 23:35:56 +00:00
parent 294257a6c0
commit 37f27b0d09
2 changed files with 122 additions and 0 deletions

64
flake.nix Normal file
View File

@@ -0,0 +1,64 @@
{
description = "typstar nix flake for development";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-parts.url = "github:hercules-ci/flake-parts";
};
outputs = inputs @ {
self,
nixpkgs,
flake-parts,
...
}:
flake-parts.lib.mkFlake {inherit inputs;} {
systems = [
"x86_64-linux"
"x86_64-darwin"
"aarch64-darwin"
];
perSystem = {system, ...}: let
pkgs = import nixpkgs {inherit system;};
typstar = pkgs.vimUtils.buildVimPlugin {
name = "typstar";
src = self;
buildInputs = [
pkgs.vimPlugins.luasnip
pkgs.vimPlugins.nvim-treesitter-parsers.typst
];
};
in {
packages = {
default = typstar;
nvim = let
config = pkgs.neovimUtils.makeNeovimConfig {
customRC = ''
lua << EOF
print("Welcome to Typstar! This is just a demo.")
require('nvim-treesitter.configs').setup {
highlight = { enable = true },
}
require('luasnip').config.set_config({
enable_autosnippets = true,
})
require('typstar').setup()
EOF
'';
plugins = [
typstar
pkgs.vimPlugins.luasnip
pkgs.vimPlugins.nvim-treesitter
pkgs.vimPlugins.nvim-treesitter-parsers.typst
];
};
in
pkgs.wrapNeovimUnstable pkgs.neovim-unwrapped config;
};
};
};
}