70 lines
1.8 KiB
Nix
70 lines
1.8 KiB
Nix
{
|
|
inputs = {
|
|
nixpkgs.url = "nixpkgs/nixpkgs-unstable";
|
|
|
|
rust-overlay.url = "github:oxalica/rust-overlay";
|
|
rust-overlay.inputs.nixpkgs.follows = "nixpkgs";
|
|
};
|
|
|
|
outputs = { self, nixpkgs, rust-overlay }: let
|
|
inherit (nixpkgs) lib;
|
|
|
|
systems = [
|
|
"x86_64-linux"
|
|
"aarch64-linux"
|
|
"x86_64-darwin"
|
|
"aarch64-darwin"
|
|
"armv7l-linux"
|
|
];
|
|
|
|
forAllSystems = f: nixpkgs.lib.genAttrs systems (system: let
|
|
pkgs = import nixpkgs {
|
|
inherit system;
|
|
overlays = [
|
|
(import rust-overlay)
|
|
];
|
|
};
|
|
|
|
rust-bin = rust-overlay.lib.mkRustBin { } pkgs.buildPackages;
|
|
toolchain = rust-bin.stable.latest.default.override {
|
|
extensions = [ "rust-src" ];
|
|
};
|
|
in f system pkgs toolchain);
|
|
in {
|
|
devShells = forAllSystems (system: pkgs: toolchain: {
|
|
default = pkgs.mkShell {
|
|
packages = with pkgs; [
|
|
toolchain
|
|
cargo-edit
|
|
|
|
ruff
|
|
(python3.withPackages (ppkgs: with ppkgs; [
|
|
psycopg2-binary
|
|
]))
|
|
];
|
|
|
|
env.RUST_SRC_PATH = "${toolchain}/lib/rustlib/src/rust/library";
|
|
};
|
|
});
|
|
|
|
overlays.default = final: prev: {
|
|
inherit (self.packages.${final.system}) mclog2psql;
|
|
};
|
|
|
|
nixosModules.default = ./module.nix;
|
|
|
|
packages = forAllSystems (system: pkgs: _: {
|
|
default = self.packages.${system}.mclog2psql;
|
|
mclog2psql = pkgs.writers.writePython3Bin "mclog2psql" {
|
|
libraries = [ pkgs.python3Packages.psycopg2 ];
|
|
flakeIgnore = [ "E265" "E501" ];
|
|
} (lib.pipe ./mclog2psql/main.py [
|
|
builtins.readFile
|
|
(lib.splitString "\n")
|
|
(lib.filter (line: !lib.hasPrefix "#!" line))
|
|
(lib.concatStringsSep "\n")
|
|
]);
|
|
});
|
|
};
|
|
}
|