From dec8d36cbdbb3b9c5c12792ed199892ce2e82069 Mon Sep 17 00:00:00 2001 From: seth Date: Sun, 31 Dec 2023 08:01:03 -0500 Subject: back to regular lua --- flake.nix | 120 +++++++++++++++++++++----------------------------------------- 1 file changed, 40 insertions(+), 80 deletions(-) (limited to 'flake.nix') diff --git a/flake.nix b/flake.nix index 6967818..41c6b86 100644 --- a/flake.nix +++ b/flake.nix @@ -3,16 +3,6 @@ inputs = { nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.1.0.tar.gz"; - utils.url = "https://flakehub.com/f/numtide/flake-utils/0.1.88.tar.gz"; - - nixvim = { - url = "https://flakehub.com/f/nix-community/nixvim/0.1.*.tar.gz"; - inputs = { - nixpkgs.follows = "nixpkgs"; - flake-utils.follows = "utils"; - pre-commit-hooks.follows = ""; - }; - }; tree-sitter-just = { url = "github:IndianBoy42/tree-sitter-just"; @@ -21,83 +11,53 @@ }; outputs = { + self, nixpkgs, - utils, - nixvim, - tree-sitter-just, ... - }: - utils.lib.eachDefaultSystem (system: let - pkgs = nixpkgs.legacyPackages.${system}; - inherit (pkgs) lib; - in rec { - checks = { - check-actionlint = - pkgs.runCommand "check-actionlint" { - nativeBuildInputs = [pkgs.actionlint]; - } '' - actionlint ${./.}/.github/workflows/* - touch $out - ''; - - "check-${formatter.pname}" = - pkgs.runCommand "check-${formatter.pname}" { - nativeBuildInputs = [formatter]; - } '' - ${lib.getExe formatter} --check ${./.} - touch $out - ''; - - check-statix = - pkgs.runCommand "check-statix" { - nativeBuildInputs = [pkgs.statix]; - } - '' - statix check ${./.} - touch $out - ''; - - check-nil = - pkgs.runCommand "check-nil" { - nativeBuildInputs = with pkgs; [fd git nil]; - } - '' - cd ${./.} - fd . -e 'nix' | while read -r file; do - nil diagnostics "$file" - done - - touch $out - ''; - }; - - devShells = { - default = pkgs.mkShell { - packages = with pkgs; [ - actionlint - formatter - deadnix - nil - statix - ]; - }; + } @ inputs: let + systems = [ + "x86_64-linux" + "aarch64-linux" + "x86_64-darwin" + "aarch64-darwin" + ]; + + forSystem = system: fn: fn nixpkgs.legacyPackages.${system}; + forAllSystems = fn: nixpkgs.lib.genAttrs systems (system: forSystem system fn); + in { + checks = forAllSystems (pkgs: import ./checks.nix {inherit pkgs self;}); + + devShells = forAllSystems (pkgs: { + default = pkgs.mkShell { + packages = with pkgs; [ + actionlint + + # lua + lua-language-server + stylua + + # nix + self.formatter.${pkgs.system} + deadnix + nil + statix + ]; }; + }); - formatter = pkgs.alejandra; + formatter = forAllSystems (pkgs: pkgs.alejandra); - packages = { - nvim = nixvim.legacyPackages.${system}.makeNixvimWithModule { - module = ./config; - extraSpecialArgs = {self = packages;}; - }; + packages = forAllSystems (pkgs: rec { + getchvim = import ./neovim.nix self pkgs; - tree-sitter-just = pkgs.tree-sitter.buildGrammar { - language = "just"; - version = builtins.substring 0 8 tree-sitter-just.lastModifiedDate; - src = tree-sitter-just; - }; + tree-sitter-just = pkgs.tree-sitter.buildGrammar { + language = "just"; + version = builtins.substring 0 8 inputs.tree-sitter-just.lastModifiedDate; - default = packages.nvim; + src = inputs.tree-sitter-just; }; + + default = getchvim; }); + }; } -- cgit v1.2.3