From 50e5cd743022ae5d28b477899c22b415afba12e1 Mon Sep 17 00:00:00 2001 From: Sophie Forrest Date: Tue, 10 Sep 2024 13:34:09 +1200 Subject: chore: use devenv --- flake.nix | 66 +++++++++++++++++++++++++++++++++++++-------------------------- 1 file changed, 39 insertions(+), 27 deletions(-) (limited to 'flake.nix') diff --git a/flake.nix b/flake.nix index 9e3b4dc..433b20a 100644 --- a/flake.nix +++ b/flake.nix @@ -1,29 +1,41 @@ { - description = "Scraper that can parse all of Victoria University of Wellington's courses, and output them in a computer-readable JSON file."; - - inputs = { - flake-parts.url = "github:hercules-ci/flake-parts"; - nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; - }; - - outputs = inputs @ {flake-parts, ...}: - flake-parts.lib.mkFlake {inherit inputs;} { - systems = ["x86_64-linux" "aarch64-linux" "aarch64-darwin" "x86_64-darwin"]; - - perSystem = { - lib, - pkgs, - ... - }: { - packages.default = pkgs.callPackage ./nix/package.nix {}; - - devShells.default = - pkgs.mkShell { - nativeBuildInputs = let inherit (pkgs) openssl pkg-config; in [openssl openssl.dev pkg-config]; - - PKG_CONFIG_PATH = "${pkgs.openssl.dev}/lib/pkgconfig"; - LD_LIBRARY_PATH = lib.makeLibraryPath [pkgs.openssl]; - }; - }; - }; + description = "Scraper that can parse all of Victoria University of Wellington's courses, and output them in a computer-readable JSON file."; + + inputs = { + flake-parts.url = "github:hercules-ci/flake-parts"; + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + + devenv.url = "github:cachix/devenv"; + }; + + outputs = inputs @ {flake-parts, ...}: + flake-parts.lib.mkFlake {inherit inputs;} { + imports = [inputs.devenv.flakeModule]; + + systems = ["x86_64-linux" "aarch64-linux" "aarch64-darwin" "x86_64-darwin"]; + + perSystem = { + lib, + pkgs, + ... + }: { + packages.default = pkgs.callPackage ./nix/package.nix {}; + + devenv.shells.default = { + env = { + LD_LIBRARY_PATH = lib.makeLibraryPath [pkgs.openssl]; + PKG_CONFIG_PATH = "${pkgs.openssl.dev}/lib/pkgconfig"; + }; + + languages = { + nix.enable = true; + rust.enable = true; + }; + + packages = let inherit (pkgs) openssl pkg-config; in [openssl openssl.dev pkg-config]; + + pre-commit.hooks.alejandra.enable = true; + }; + }; + }; } -- cgit 1.4.1