{ inputs = { # nixpkgs 35.11 still contains rust 1.73 nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; fenix = { url = "github:nix-community/fenix"; inputs.nixpkgs.follows = "nixpkgs"; }; crane = { url = "github:ipetkov/crane"; }; rust-overlay = { url = "github:oxalica/rust-overlay"; inputs.nixpkgs.follows = "nixpkgs"; }; mize_modules = { url = "github:c2vi/mize-modules?submodules=1"; flake = false; }; flake-utils.url = "github:numtide/flake-utils"; }; outputs = { self, flake-utils, nixpkgs, fenix, crane, mize_modules, rust-overlay, ... }@inputs: flake-utils.lib.eachDefaultSystem (system: ############################## LET BINDINGS ############################## let pkgs = nixpkgs.legacyPackages.${system}; #os osToolchain = fenix.packages.${system}.latest.toolchain; osCrane = (crane.mkLib pkgs).overrideToolchain osToolchain; # mize build time config mizeBuildConfig = { config = { namespace = "mize.buildtime.ns"; module_url = "parts.mize.works"; }; }; in { ############################## PACKAGES ############################## packages = rec { fileSetForCrate = crate: pkgs.lib.fileset.toSource { root = ./.; fileset = pkgs.lib.fileset.unions [ ./Cargo.toml ./Cargo.lock (osCrane.fileset.commonCargoSources ./packages/marts) (osCrane.fileset.commonCargoSources ./packages/mize) (osCrane.fileset.commonCargoSources ./packages/ppc/spacetimedb) (osCrane.fileset.commonCargoSources ./packages/mme) (osCrane.fileset.commonCargoSources ./packages/vic) (osCrane.fileset.commonCargoSources ./packages/ac_mize_macros) (osCrane.fileset.commonCargoSources crate) ]; }; ppc = osCrane.buildPackage { src = fileSetForCrate ./packages/ppc; cargoExtraArgs = "-p ppc"; nativeBuildInputs = [ pkgs.pkg-config pkgs.gobject-introspection pkgs.gobject-introspection.dev ]; buildInputs = with pkgs; [ git # needed to build spacetimedb as it needs to get it's git hash for setting it's version at-spi2-atk atkmm cairo gdk-pixbuf glib gtk3 harfbuzz librsvg libsoup_3 pango webkitgtk_4_1 openssl wasm-bindgen-cli lld_20 xdotool ]; LD_LIBRARY_PATH = with pkgs; pkgs.lib.makeLibraryPath [ xdotool webkitgtk_4_1 pango openssl at-spi2-atk atkmm cairo gdk-pixbuf glib gtk3 harfbuzz librsvg libsoup_3 ]; }; }; ############################## DEV SHELLS ############################## devShells = { # shell without spacetime and other dev commands. just all needed to build mize or ppc buildShell = pkgs.mkShell { MIZE_BUILD_CONFIG = let settingsFormat = pkgs.formats.toml { }; in settingsFormat.generate "mize-build-config.toml" { config = mizeBuildConfig; }; shellHook = '' mize_project_root=$(${pkgs.lib.getExe pkgs.git} rev-parse --show-toplevel) export MIZE_CONFIG_FILES=$mize_project_root/mize_config.toml ''; nativeBuildInputs = [ pkgs.wasm-pack pkgs.pkg-config pkgs.gobject-introspection pkgs.gobject-introspection.dev # thanks to: https://github.com/NixOS/nixpkgs/pull/496279/changes (pkgs.buildWasmBindgenCli rec { src = pkgs.fetchCrate { pname = "wasm-bindgen-cli"; version = "0.2.114"; hash = "sha256-xrCym+rFY6EUQFWyWl6OPA+LtftpUAE5pIaElAIVqW0="; }; cargoDeps = pkgs.rustPlatform.fetchCargoVendor { inherit src; inherit (src) pname version; hash = "sha256-Z8+dUXPQq7S+Q7DWNr2Y9d8GMuEdSnq00quUR0wDNPM="; }; }) (fenix.packages.${system}.combine [ fenix.packages.${system}.latest.toolchain fenix.packages.${system}.targets.wasm32-unknown-unknown.latest.toolchain ]) ]; buildInputs = with pkgs; [ at-spi2-atk atkmm cairo gdk-pixbuf glib gtk3 harfbuzz librsvg libsoup_3 pango webkitgtk_4_1 openssl wasm-bindgen-cli lld_20 xdotool ]; LD_LIBRARY_PATH = with pkgs; pkgs.lib.makeLibraryPath [ xdotool webkitgtk_4_1 pango openssl at-spi2-atk atkmm cairo gdk-pixbuf glib gtk3 harfbuzz librsvg libsoup_3 ]; }; default = pkgs.mkShell { MIZE_BUILD_CONFIG = let settingsFormat = pkgs.formats.toml { }; in settingsFormat.generate "mize-build-config.toml" { config = mizeBuildConfig; }; shellHook = '' mize_project_root=$(${pkgs.lib.getExe pkgs.git} rev-parse --show-toplevel) export MIZE_CONFIG_FILES=$mize_project_root/mize_config.toml ''; #_shell_type = "rust"; nativeBuildInputs = [ pkgs.wasm-pack pkgs.dioxus-cli pkgs.spacetimedb pkgs.deno pkgs.pkg-config pkgs.gobject-introspection pkgs.gobject-introspection.dev # thanks to: https://github.com/NixOS/nixpkgs/pull/496279/changes (pkgs.buildWasmBindgenCli rec { src = pkgs.fetchCrate { pname = "wasm-bindgen-cli"; version = "0.2.114"; hash = "sha256-xrCym+rFY6EUQFWyWl6OPA+LtftpUAE5pIaElAIVqW0="; }; cargoDeps = pkgs.rustPlatform.fetchCargoVendor { inherit src; inherit (src) pname version; hash = "sha256-Z8+dUXPQq7S+Q7DWNr2Y9d8GMuEdSnq00quUR0wDNPM="; }; }) (fenix.packages.${system}.combine [ fenix.packages.${system}.latest.toolchain fenix.packages.${system}.targets.wasm32-unknown-unknown.latest.toolchain ]) ]; buildInputs = with pkgs; [ at-spi2-atk atkmm cairo gdk-pixbuf glib gtk3 harfbuzz librsvg libsoup_3 pango webkitgtk_4_1 openssl wasm-bindgen-cli lld_20 xdotool ]; LD_LIBRARY_PATH = with pkgs; pkgs.lib.makeLibraryPath [ xdotool webkitgtk_4_1 pango openssl at-spi2-atk atkmm cairo gdk-pixbuf glib gtk3 harfbuzz librsvg libsoup_3 ]; }; }; }) // { ############################## SOME GLOBAL OUTPUTS ############################## inherit inputs self; }; }