monorepo/flake.nix

106 lines
3.3 KiB
Nix

{
description = "Lumenescent Dreams Tools";
inputs = {
nixpkgs.url = "nixpkgs/nixos-22.11";
unstable.url = "nixpkgs/nixos-unstable";
pkgs-cargo2nix.url = "github:cargo2nix/cargo2nix";
typeshare.url = "github:savannidgerinel/typeshare/savannidgerinel/add-a-nix-flake";
rust-overlay.url = "github:oxalica/rust-overlay";
};
outputs = { self, nixpkgs, unstable, pkgs-cargo2nix, typeshare, rust-overlay, ... }:
let
version = builtins.string 0 8 self.lastModifiedDate;
supportedSystems = [ "x86_64-linux" ];
in
{
devShell."x86_64-linux" =
let
pkgs = import nixpkgs { system = "x86_64-linux"; };
pkgs-unstable = import unstable { system = "x86_64-linux"; };
cargo2nix = pkgs-cargo2nix.packages."x86_64-linux";
in
pkgs.mkShell {
name = "ld-tools-devshell";
buildInputs = [
pkgs.clang
pkgs.entr
pkgs.glade
pkgs.glib
pkgs.gst_all_1.gst-plugins-bad
pkgs.gst_all_1.gst-plugins-base
pkgs.gst_all_1.gst-plugins-good
pkgs.gst_all_1.gst-plugins-ugly
pkgs.gst_all_1.gstreamer
pkgs.gtk4
pkgs.nodejs
pkgs.openssl
pkgs.pipewire
pkgs.pkg-config
pkgs.sqlite
pkgs.rustup
pkgs.crate2nix
pkgs.wasm-pack
pkgs.node2nix
pkgs.wasm-bindgen-cli
pkgs-unstable.typeshare
];
LIBCLANG_PATH="${pkgs.llvmPackages.libclang.lib}/lib";
};
packages."x86_64-linux" =
let
pkgs = import nixpkgs {
system = "x86_64-linux";
overlays = [ (import rust-overlay) ];
};
standardOverride = attrs: {
nativeBuildInputs = [
pkgs.pkg-config
pkgs.gtk4
];
buildInputs = [
typeshare.packages."x86_64-linux".default
];
verbose = true;
};
rust = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain;
in {
kifu-gtk = import ./kifu/kifu-gtk {
inherit pkgs;
typeshare = typeshare.packages."x86_64-linux".default;
};
kifu-wasm = import ./kifu/kifu-wasm {
inherit pkgs;
typeshare = typeshare.packages."x86_64-linux".default;
wasm-pack = pkgs.wasm-pack;
rustc = rust.availableComponents.rustc;
};
kifu-pwa = let
deps = (import ./kifu/kifu-pwa { inherit pkgs; }).nodeDependencies;
in pkgs.stdenv.mkDerivation {
name = "kifu-pwa";
src = ./kifu/kifu-pwa;
buildInputs = [ pkgs.nodejs pkgs.nodePackages.webpack-cli ];
buildPhase = ''
ln -s ${deps}/lib/node_modules ./node_modules
export PATH="${deps}/bin:$PATH"
webpack
'';
installPhase = ''
cp -r dist $out
'';
};
cyberpunk-splash = import ./cyberpunk-splash {
inherit pkgs;
typeshare = typeshare.packages."x86_64-linux".default;
};
};
};
}