From 37f27b0d096e2451a049b0b3d056b9a407a4b472 Mon Sep 17 00:00:00 2001 From: lentilus Date: Wed, 22 Jan 2025 23:35:56 +0000 Subject: [PATCH] dev: add nix flake --- flake.lock | 58 +++++++++++++++++++++++++++++++++++++++++++++++++ flake.nix | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 122 insertions(+) create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..52fb77f --- /dev/null +++ b/flake.lock @@ -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 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..700cd7f --- /dev/null +++ b/flake.nix @@ -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; + }; + }; + }; +}