2024-05-03 14:50:22 +00:00
|
|
|
# Copyright (C) 2024 - 2024:
|
|
|
|
# The Trinitrix Project <bpeetz@b-peetz.de, antifallobst@systemausfall.org>
|
|
|
|
# SPDX-License-Identifier: LGPL-3.0-or-later
|
|
|
|
#
|
|
|
|
# This file is part of the Trinitry crate for Trinitrix.
|
|
|
|
#
|
|
|
|
# Trinitry is free software: you can redistribute it and/or modify
|
|
|
|
# it under the terms of the Lesser GNU General Public License as
|
|
|
|
# published by the Free Software Foundation, either version 3 of
|
|
|
|
# the License, or (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# and the Lesser GNU General Public License along with this program.
|
|
|
|
# If not, see <https://www.gnu.org/licenses/>.
|
2023-12-23 21:24:14 +00:00
|
|
|
{
|
2024-05-03 14:40:06 +00:00
|
|
|
description = "A very simple programming language, used to map functions to commands";
|
|
|
|
|
2023-12-23 21:24:14 +00:00
|
|
|
inputs = {
|
2024-05-03 14:40:06 +00:00
|
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
2023-12-23 21:24:14 +00:00
|
|
|
|
2024-05-03 14:40:06 +00:00
|
|
|
treefmt-nix = {
|
|
|
|
url = "github:numtide/treefmt-nix";
|
|
|
|
inputs = {
|
|
|
|
nixpkgs.follows = "nixpkgs";
|
|
|
|
};
|
2023-12-23 21:24:14 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
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";
|
|
|
|
};
|
|
|
|
};
|
2024-05-03 14:40:06 +00:00
|
|
|
|
|
|
|
# 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";
|
|
|
|
};
|
|
|
|
};
|
2023-12-23 21:24:14 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
outputs = {
|
2024-05-03 14:40:06 +00:00
|
|
|
self,
|
2023-12-23 21:24:14 +00:00
|
|
|
nixpkgs,
|
|
|
|
flake-utils,
|
2024-05-03 14:40:06 +00:00
|
|
|
treefmt-nix,
|
|
|
|
crane,
|
2023-12-23 21:24:14 +00:00
|
|
|
rust-overlay,
|
|
|
|
...
|
|
|
|
}:
|
|
|
|
flake-utils.lib.eachDefaultSystem (system: let
|
|
|
|
pkgs = import nixpkgs {
|
|
|
|
inherit system;
|
|
|
|
overlays = [(import rust-overlay)];
|
|
|
|
};
|
|
|
|
|
|
|
|
nightly = false;
|
2024-05-03 14:40:06 +00:00
|
|
|
rust_minimal =
|
2023-12-23 21:24:14 +00:00
|
|
|
if nightly
|
2024-05-03 14:40:06 +00:00
|
|
|
then pkgs.rust-bin.selectLatestNightlyWith (toolchain: toolchain.minimal)
|
2023-12-23 21:24:14 +00:00
|
|
|
else pkgs.rust-bin.stable.latest.minimal;
|
2024-05-03 14:40:06 +00:00
|
|
|
rust_default =
|
|
|
|
if nightly
|
|
|
|
then pkgs.rust-bin.selectLatestNightlyWith (toolchain: toolchain.default)
|
|
|
|
else pkgs.rust-bin.stable.latest.default;
|
2023-12-23 21:24:14 +00:00
|
|
|
|
2024-05-03 14:40:06 +00:00
|
|
|
craneLib = (crane.mkLib pkgs).overrideToolchain rust_minimal;
|
2023-12-23 21:24:14 +00:00
|
|
|
craneBuild = craneLib.buildPackage {
|
|
|
|
src = craneLib.cleanCargoSource ./.;
|
|
|
|
|
|
|
|
doCheck = true;
|
|
|
|
};
|
2024-05-03 14:40:06 +00:00
|
|
|
|
|
|
|
treefmtEval = import ./treefmt.nix {inherit treefmt-nix pkgs;};
|
2023-12-23 21:24:14 +00:00
|
|
|
in {
|
2024-05-03 14:40:06 +00:00
|
|
|
packages.default = craneBuild;
|
|
|
|
|
|
|
|
checks = {
|
|
|
|
inherit craneBuild;
|
|
|
|
formatting = treefmtEval.config.build.check self;
|
2023-12-23 21:24:14 +00:00
|
|
|
};
|
|
|
|
|
2024-05-03 14:40:06 +00:00
|
|
|
formatter = treefmtEval.config.build.wrapper;
|
|
|
|
|
2023-12-23 21:24:14 +00:00
|
|
|
devShells.default = pkgs.mkShell {
|
|
|
|
packages = with pkgs; [
|
|
|
|
cocogitto
|
|
|
|
|
2024-05-03 14:50:22 +00:00
|
|
|
yq
|
|
|
|
|
2024-05-03 14:40:06 +00:00
|
|
|
rust_default
|
2023-12-23 21:24:14 +00:00
|
|
|
cargo-edit
|
2024-05-03 14:40:06 +00:00
|
|
|
|
|
|
|
licensure
|
2023-12-23 21:24:14 +00:00
|
|
|
];
|
|
|
|
};
|
|
|
|
});
|
|
|
|
}
|
2024-05-03 14:40:06 +00:00
|
|
|
# vim: ts=2
|
|
|
|
|