diff options
Diffstat (limited to 'flake.nix')
| -rw-r--r-- | flake.nix | 54 |
1 files changed, 37 insertions, 17 deletions
diff --git a/flake.nix b/flake.nix index b671802..3d91e0a 100644 --- a/flake.nix +++ b/flake.nix @@ -16,35 +16,55 @@ inputs.rust-analyzer-src.follows = ""; }; - nix2container.url = "github:nlewo/nix2container"; - nix2container.inputs.nixpkgs.follows = "nixpkgs"; - mk-shell-bin.url = "github:rrbutani/nix-mk-shell-bin"; - - devenv.url = "github:cachix/devenv"; + git-hooks-nix.url = "github:cachix/git-hooks.nix"; + treefmt-nix.url = "github:numtide/treefmt-nix"; }; outputs = inputs @ {flake-parts, ...}: flake-parts.lib.mkFlake {inherit inputs;} { imports = [ - inputs.devenv.flakeModule + inputs.git-hooks-nix.flakeModule + inputs.treefmt-nix.flakeModule ./nix/package.nix ]; - systems = ["x86_64-linux" "aarch64-linux" "aarch64-darwin" "x86_64-darwin"]; + systems = ["x86_64-linux" "aarch64-linux"]; - perSystem = {pkgs, ...}: { - devenv.shells.default = { - # NOTE: env vars are maintained inside ./nix/package.nix. + perSystem = { + config, + lib, + pkgs, + ... + }: { + devShells.default = pkgs.mkShell rec { + shellHook = '' + ${config.pre-commit.installationScript} + ''; - languages = { - nix.enable = true; - rust.enable = true; - }; + buildInputs = with pkgs; [cargo-nextest] ++ nativeBuildInputs; + nativeBuildInputs = with pkgs; [openssl openssl.dev pkg-config]; - # NOTE: build dependencies are maintained inside ./nix/package.nix. - packages = with pkgs; [cargo-nextest]; + LD_LIBRARY_PATH = lib.makeLibraryPath [pkgs.openssl]; + PKG_CONFIG_PATH = "${pkgs.openssl.dev}/lib/pkgconfig"; + }; - pre-commit.hooks.alejandra.enable = true; + pre-commit.settings.hooks = { + alejandra.enable = true; + editorconfig-checker = { + args = ["--config" ".editorconfig-checker.json"]; + enable = true; + }; + }; + + treefmt = { + flakeFormatter = true; + programs = { + alejandra.enable = true; + just.enable = true; + rustfmt.enable = true; + taplo.enable = true; + }; + projectRootFile = "flake.nix"; }; }; }; |