flake.nix: modernize
This commit is contained in:
parent
f6dac0b2fc
commit
5894a41db3
39
flake.lock
39
flake.lock
|
@ -1,5 +1,26 @@
|
||||||
{
|
{
|
||||||
"nodes": {
|
"nodes": {
|
||||||
|
"fenix": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": [
|
||||||
|
"nixpkgs"
|
||||||
|
],
|
||||||
|
"rust-analyzer-src": "rust-analyzer-src"
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1714285404,
|
||||||
|
"narHash": "sha256-MmoQIO+KRiH3UnH0myAp2Fgi84rmpROMfw9VIbqrjHA=",
|
||||||
|
"owner": "nix-community",
|
||||||
|
"repo": "fenix",
|
||||||
|
"rev": "94be183087845937b0fd77281c37d0796572b899",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nix-community",
|
||||||
|
"repo": "fenix",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1707546158,
|
"lastModified": 1707546158,
|
||||||
|
@ -18,8 +39,26 @@
|
||||||
},
|
},
|
||||||
"root": {
|
"root": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
|
"fenix": "fenix",
|
||||||
"nixpkgs": "nixpkgs"
|
"nixpkgs": "nixpkgs"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"rust-analyzer-src": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1714217560,
|
||||||
|
"narHash": "sha256-zttBYGaoHpZfqWHQ8OI5f9OkGHCHb8tDBMySwsYNa2U=",
|
||||||
|
"owner": "rust-lang",
|
||||||
|
"repo": "rust-analyzer",
|
||||||
|
"rev": "f216be4a0746142c5f30835b254871256a7637b8",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "rust-lang",
|
||||||
|
"ref": "nightly",
|
||||||
|
"repo": "rust-analyzer",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"root": "root",
|
"root": "root",
|
||||||
|
|
101
flake.nix
101
flake.nix
|
@ -1,28 +1,94 @@
|
||||||
|
# {
|
||||||
|
# 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;
|
||||||
|
# };
|
||||||
|
# };
|
||||||
|
# }));
|
||||||
|
# };
|
||||||
|
# }
|
||||||
|
|
||||||
{
|
{
|
||||||
inputs = {
|
inputs = {
|
||||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||||
|
fenix.url = "github:nix-community/fenix";
|
||||||
|
fenix.inputs.nixpkgs.follows = "nixpkgs";
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = { self, nixpkgs }: let
|
outputs = { self, nixpkgs, fenix }@inputs:
|
||||||
supportedSystems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
|
let
|
||||||
forAllSystems = f: nixpkgs.lib.genAttrs supportedSystems (system: f system nixpkgs.legacyPackages.${system});
|
systems = [
|
||||||
in {
|
"x86_64-linux"
|
||||||
devShells = forAllSystems (system: pkgs: {
|
"aarch64-linux"
|
||||||
default = let
|
"x86_64-darwin"
|
||||||
rustPlatform = pkgs.rust.packages.stable.rustPlatform;
|
"aarch64-darwin"
|
||||||
in pkgs.mkShell {
|
];
|
||||||
packages = with pkgs; [
|
forAllSystems = f: nixpkgs.lib.genAttrs systems (system: let
|
||||||
cargo
|
toolchain = fenix.packages.${system}.complete;
|
||||||
clippy
|
pkgs = import nixpkgs {
|
||||||
rust-analyzer
|
inherit system;
|
||||||
rustc
|
overlays = [
|
||||||
rustfmt
|
(_: super: let pkgs = fenix.inputs.nixpkgs.legacyPackages.${system}; in fenix.overlays.default pkgs pkgs)
|
||||||
];
|
];
|
||||||
RUST_SRC_PATH = "${rustPlatform.rustLibSrc}";
|
|
||||||
};
|
};
|
||||||
|
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;
|
||||||
});
|
});
|
||||||
|
|
||||||
packages = (forAllSystems (system: pkgs: {
|
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/";
|
||||||
|
});
|
||||||
|
|
||||||
|
overlays.default = final: prev: self.packages.${final.system};
|
||||||
|
|
||||||
|
packages = (forAllSystems (system: pkgs: _: {
|
||||||
default = pkgs.rustPlatform.buildRustPackage rec {
|
default = pkgs.rustPlatform.buildRustPackage rec {
|
||||||
pname = "polyglot-zip";
|
pname = "polyglot-zip";
|
||||||
version = (pkgs.lib.importTOML ./Cargo.toml).package.version;
|
version = (pkgs.lib.importTOML ./Cargo.toml).package.version;
|
||||||
|
@ -34,7 +100,8 @@
|
||||||
description = "A tool to convert and extract zip files with non-UTF-8 contents";
|
description = "A tool to convert and extract zip files with non-UTF-8 contents";
|
||||||
homepage = "https://github.com/h7x4/polyglot-zip";
|
homepage = "https://github.com/h7x4/polyglot-zip";
|
||||||
license = licenses.mit;
|
license = licenses.mit;
|
||||||
platforms = supportedSystems;
|
platforms = systems;
|
||||||
|
mainProgram = "polyzip";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}));
|
}));
|
||||||
|
|
Loading…
Reference in New Issue