# SPDX-FileCopyrightText: 2024 Gergely Nagy # SPDX-FileContributor: Gergely Nagy # # SPDX-License-Identifier: EUPL-1.2 { description = "Inhibits idle on behalf of other programs"; inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05"; pre-commit-hooks = { url = "github:cachix/pre-commit-hooks.nix"; inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs-stable.follows = "nixpkgs"; }; treefmt-nix = { url = "github:numtide/treefmt-nix"; inputs.nixpkgs.follows = "nixpkgs"; }; }; outputs = { self, nixpkgs, systems, treefmt-nix, ... }@inputs: let inherit (nixpkgs) lib; forEachSystem = f: nixpkgs.lib.genAttrs (import systems) ( system: let pkgs = import nixpkgs { inherit system; overlays = [ self.overlays.default ]; }; in f pkgs ); treefmtEval = forEachSystem (pkgs: treefmt-nix.lib.evalModule pkgs ./nix/treefmt.nix); treefmtWrapper = pkgs: treefmtEval.${pkgs.system}.config.build.wrapper; in { overlays.default = import ./nix/overlay.nix { inherit self lib; }; formatter = forEachSystem treefmtWrapper; checks = forEachSystem (pkgs: { formatting = treefmtEval.${pkgs.system}.config.build.check self; pre-commit-check = inputs.pre-commit-hooks.lib.${pkgs.system}.run { src = ./.; hooks = import ./nix/pre-commit-check.nix { inherit pkgs; treefmt = treefmtWrapper pkgs; }; }; }); packages = forEachSystem ( pkgs: (self.overlays.default pkgs pkgs) // { default = self.packages.${pkgs.hostPlatform.system}.ala-lape; } ); apps = forEachSystem (pkgs: { ala-lape = { type = "app"; program = "${pkgs.lib.getExe pkgs.ala-lape}"; }; }); devShells = forEachSystem (pkgs: { default = pkgs.mkShell { buildInputs = self.checks.${pkgs.system}.pre-commit-check.enabledPackages; packages = with pkgs; [ clippy pandoc reuse rust-analyzer ]; inputsFrom = [ self.packages.${pkgs.system}.ala-lape treefmtEval.${pkgs.system}.config.build.devShell ]; shellHook = "export RUSTFLAGS='--cfg tokio_unstable';" + self.checks.${pkgs.system}.pre-commit-check.shellHook; }; }); homeManagerModules.default = import ./nix/home-manager.nix { inherit self; }; }; }