From e94e4304e9bfd64bdf934827ffdf0409c44d991c Mon Sep 17 00:00:00 2001 From: Benedikt Peetz Date: Sun, 31 Mar 2024 18:49:51 +0200 Subject: chore(treewide): Update this project to today's standards. --- flake.nix | 61 +++++++++++++++++++++++++++++-------------------------------- 1 file changed, 29 insertions(+), 32 deletions(-) (limited to 'flake.nix') diff --git a/flake.nix b/flake.nix index c3234ee..4540e05 100644 --- a/flake.nix +++ b/flake.nix @@ -1,9 +1,23 @@ { - description = "LaTeX project manager"; + description = "A latex project manager"; inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + crane = { + url = "github:ipetkov/crane"; + inputs = { + nixpkgs.follows = "nixpkgs"; + }; + }; + rust-overlay = { + url = "github:oxalica/rust-overlay"; + inputs = { + nixpkgs.follows = "nixpkgs"; + flake-utils.follows = "flake-utils"; + }; + }; + # inputs for following systems = { url = "github:nix-systems/x86_64-linux"; # only evaluate for this system @@ -12,35 +26,18 @@ url = "github:edolstra/flake-compat"; flake = false; }; - crane = { - url = "github:ipetkov/crane"; - inputs = { - nixpkgs.follows = "nixpkgs"; - flake-compat.follows = "flake-compat"; - flake-utils.follows = "flake-utils"; - rust-overlay.follows = "rust-overlay"; - }; - }; flake-utils = { url = "github:numtide/flake-utils"; inputs = { systems.follows = "systems"; }; }; - rust-overlay = { - url = "github:oxalica/rust-overlay"; - inputs = { - nixpkgs.follows = "nixpkgs"; - flake-utils.follows = "flake-utils"; - }; - }; }; outputs = { - self, nixpkgs, - crane, flake-utils, + crane, rust-overlay, ... }: @@ -50,11 +47,17 @@ overlays = [(import rust-overlay)]; }; - #rust-nightly = pkgs.rust-bin.selectLatestNightlyWith (toolchain: toolchain.default); - rust-stable = pkgs.rust-bin.stable.latest.default; - - craneLib = (crane.mkLib pkgs).overrideToolchain rust-stable; + nightly = false; + rust_minimal = + if nightly + then pkgs.rust-bin.selectLatestNightlyWith (toolchain: toolchain.minimal) + else pkgs.rust-bin.stable.latest.minimal; + rust_default = + if nightly + then pkgs.rust-bin.selectLatestNightlyWith (toolchain: toolchain.default) + else pkgs.rust-bin.stable.latest.default; + craneLib = (crane.mkLib pkgs).overrideToolchain rust_minimal; craneBuild = craneLib.buildPackage { src = craneLib.cleanCargoSource ./.; @@ -63,21 +66,15 @@ in { packages.default = craneBuild; - app.default = { - type = "app"; - program = "${self.packages.${system}.default}/bin/lpm"; + checks = { + inherit craneBuild; }; devShells.default = pkgs.mkShell { packages = with pkgs; [ - nil - alejandra - statix - ltex-ls cocogitto - rust-stable - rust-analyzer + rust_default cargo-edit ]; }; -- cgit 1.4.1