# Copyright (C) 2024 Benedikt Peetz # SPDX-License-Identifier: AGPL-3.0-or-later # # This file is part of Quotify - A simple CLI utility to shell quote the text # inputted into it. # # You should have received a copy of the License along with this program. # If not, see . { description = "A simple cli utility to shell quote the text inputed into it"; inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; treefmt-nix = { url = "github:numtide/treefmt-nix"; inputs = { nixpkgs.follows = "nixpkgs"; }; }; crane = { url = "github:ipetkov/crane"; inputs = { }; }; rust-overlay = { url = "github:oxalica/rust-overlay"; inputs = { nixpkgs.follows = "nixpkgs"; }; }; # inputs for following systems = { url = "github:nix-systems/x86_64-linux"; # only evaluate for this system }; flake-compat = { url = "github:edolstra/flake-compat"; flake = false; }; flake-utils = { url = "github:numtide/flake-utils"; inputs = { systems.follows = "systems"; }; }; }; outputs = { self, nixpkgs, flake-utils, treefmt-nix, crane, rust-overlay, ... }: flake-utils.lib.eachDefaultSystem (system: let pkgs = import nixpkgs { inherit system; overlays = [(import rust-overlay)]; }; 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 ./.; doCheck = true; }; treefmtEval = import ./treefmt.nix {inherit treefmt-nix pkgs;}; in { packages.default = craneBuild; checks = { inherit craneBuild; formatting = treefmtEval.config.build.check self; }; formatter = treefmtEval.config.build.wrapper; devShells.default = pkgs.mkShell { packages = with pkgs; [ cocogitto rust_default cargo-edit reuse ]; }; }); } # vim: ts=2