polyglot-zip/flake.nix

110 lines
3.2 KiB
Nix
Raw Normal View History

2024-04-29 00:28:59 +02:00
# {
# inputs = {
# nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
# };
# outputs = { self, nixpkgs }: let
# supportedSystems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
# forAllSystems = f: nixpkgs.lib.genAttrs supportedSystems (system: f system nixpkgs.legacyPackages.${system});
# in {
# devShells = forAllSystems (system: pkgs: {
# default = let
# rustPlatform = pkgs.rust.packages.stable.rustPlatform;
# in pkgs.mkShell {
# packages = with pkgs; [
# cargo
# clippy
# rust-analyzer
# rustc
# rustfmt
# ];
# RUST_SRC_PATH = "${rustPlatform.rustLibSrc}";
# };
# });
# packages = (forAllSystems (system: pkgs: {
# default = pkgs.rustPlatform.buildRustPackage rec {
# pname = "polyglot-zip";
# version = (pkgs.lib.importTOML ./Cargo.toml).package.version;
# src = ./.;
# cargoSha256 = "sha256-3oHEH6DlooWg0sQ+oIvsYoU6FAs7gP9PRwv1xJjGDYA=";
# meta = with pkgs.lib; {
# description = "A tool to convert and extract zip files with non-UTF-8 contents";
# homepage = "https://github.com/h7x4/polyglot-zip";
# license = licenses.mit;
# platforms = supportedSystems;
# };
# };
# }));
# };
# }
2024-02-11 19:44:45 +01:00
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
2024-04-29 00:28:59 +02:00
fenix.url = "github:nix-community/fenix";
fenix.inputs.nixpkgs.follows = "nixpkgs";
2024-02-11 19:44:45 +01:00
};
2024-04-29 00:28:59 +02:00
outputs = { self, nixpkgs, fenix }@inputs:
let
systems = [
"x86_64-linux"
"aarch64-linux"
"x86_64-darwin"
"aarch64-darwin"
];
forAllSystems = f: nixpkgs.lib.genAttrs systems (system: let
toolchain = fenix.packages.${system}.complete;
pkgs = import nixpkgs {
inherit system;
overlays = [
(_: super: let pkgs = fenix.inputs.nixpkgs.legacyPackages.${system}; in fenix.overlays.default pkgs pkgs)
2024-02-11 19:44:45 +01:00
];
};
2024-04-29 00:28:59 +02:00
in f system pkgs toolchain);
in {
apps = forAllSystems (system: pkgs: _: let
mkApp = program: {
type = "app";
program = "${nixpkgs.lib.getExe program}";
};
in {
default = mkApp self.packages.${system}.default;
});
devShell = forAllSystems (system: pkgs: toolchain: pkgs.mkShell {
packages = [
(toolchain.withComponents [
"cargo" "rustc" "rustfmt" "clippy"
])
pkgs.openssl
pkgs.pkg-config
];
RUST_SRC_PATH = "${toolchain.rust-src}/lib/rustlib/src/rust/";
2024-02-11 19:44:45 +01:00
});
2024-04-29 00:28:59 +02:00
overlays.default = final: prev: self.packages.${final.system};
packages = (forAllSystems (system: pkgs: _: {
2024-02-11 19:44:45 +01:00
default = pkgs.rustPlatform.buildRustPackage rec {
pname = "polyglot-zip";
version = (pkgs.lib.importTOML ./Cargo.toml).package.version;
src = ./.;
cargoSha256 = "sha256-3oHEH6DlooWg0sQ+oIvsYoU6FAs7gP9PRwv1xJjGDYA=";
meta = with pkgs.lib; {
description = "A tool to convert and extract zip files with non-UTF-8 contents";
homepage = "https://github.com/h7x4/polyglot-zip";
license = licenses.mit;
2024-04-29 00:28:59 +02:00
platforms = systems;
mainProgram = "polyzip";
2024-02-11 19:44:45 +01:00
};
};
}));
};
}