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

58
flake.lock generated Normal file
View File

@@ -0,0 +1,58 @@
{
"nodes": {
"flake-parts": {
"inputs": {
"nixpkgs-lib": "nixpkgs-lib"
},
"locked": {
"lastModified": 1736143030,
"narHash": "sha256-+hu54pAoLDEZT9pjHlqL9DNzWz0NbUn8NEAHP7PQPzU=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "b905f6fc23a9051a6e1b741e1438dbfc0634c6de",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "flake-parts",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1737525964,
"narHash": "sha256-3wFonKmNRWKq1himW9N3TllbeGIHFACI5vmLpk6moF8=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "5757bbb8bd7c0630a0cc4bb19c47e588db30b97c",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs-lib": {
"locked": {
"lastModified": 1735774519,
"narHash": "sha256-CewEm1o2eVAnoqb6Ml+Qi9Gg/EfNAxbRx1lANGVyoLI=",
"type": "tarball",
"url": "https://github.com/NixOS/nixpkgs/archive/e9b51731911566bbf7e4895475a87fe06961de0b.tar.gz"
},
"original": {
"type": "tarball",
"url": "https://github.com/NixOS/nixpkgs/archive/e9b51731911566bbf7e4895475a87fe06961de0b.tar.gz"
}
},
"root": {
"inputs": {
"flake-parts": "flake-parts",
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

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;
};
};
};
}