diff --git a/flake.lock b/flake.lock index 1561243..80a159e 100644 --- a/flake.lock +++ b/flake.lock @@ -49,6 +49,24 @@ "type": "github" } }, + "flake-utils_3": { + "inputs": { + "systems": "systems_2" + }, + "locked": { + "lastModified": 1681202837, + "narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "cfacdce06f30d2b68473a46042957675eebb3401", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, "nixpkgs": { "locked": { "lastModified": 1681932375, @@ -81,6 +99,22 @@ } }, "nixpkgs_3": { + "locked": { + "lastModified": 1681358109, + "narHash": "sha256-eKyxW4OohHQx9Urxi7TQlFBTDWII+F+x2hklDOQPB50=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "96ba1c52e54e74c3197f4d43026b3f3d92e83ff9", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_4": { "locked": { "lastModified": 1681303793, "narHash": "sha256-JEdQHsYuCfRL2PICHlOiH/2ue3DwoxUX7DJ6zZxZXFk=", @@ -120,6 +154,7 @@ "inputs": { "nixpkgs": "nixpkgs", "pkgs-cargo2nix": "pkgs-cargo2nix", + "rust-overlay": "rust-overlay_2", "typeshare": "typeshare", "unstable": "unstable" } @@ -149,6 +184,25 @@ "type": "github" } }, + "rust-overlay_2": { + "inputs": { + "flake-utils": "flake-utils_2", + "nixpkgs": "nixpkgs_3" + }, + "locked": { + "lastModified": 1683080331, + "narHash": "sha256-nGDvJ1DAxZIwdn6ww8IFwzoHb2rqBP4wv/65Wt5vflk=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "d59c3fa0cba8336e115b376c2d9e91053aa59e56", + "type": "github" + }, + "original": { + "owner": "oxalica", + "repo": "rust-overlay", + "type": "github" + } + }, "systems": { "locked": { "lastModified": 1681028828, @@ -164,10 +218,25 @@ "type": "github" } }, + "systems_2": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, "typeshare": { "inputs": { - "flake-utils": "flake-utils_2", - "nixpkgs": "nixpkgs_3" + "flake-utils": "flake-utils_3", + "nixpkgs": "nixpkgs_4" }, "locked": { "lastModified": 1681765787, diff --git a/flake.nix b/flake.nix index b2ac681..bd9d013 100644 --- a/flake.nix +++ b/flake.nix @@ -6,9 +6,10 @@ 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, ... }: + outputs = { self, nixpkgs, unstable, pkgs-cargo2nix, typeshare, rust-overlay, ... }: let version = builtins.string 0 8 self.lastModifiedDate; supportedSystems = [ "x86_64-linux" ]; @@ -49,7 +50,10 @@ }; packages."x86_64-linux" = let - pkgs = import nixpkgs { system = "x86_64-linux"; }; + pkgs = import nixpkgs { + system = "x86_64-linux"; + overlays = [ (import rust-overlay) ]; + }; standardOverride = attrs: { nativeBuildInputs = [ pkgs.pkg-config @@ -60,37 +64,8 @@ ]; verbose = true; }; - customBuildInfo = pkgs: pkgs.buildRustCrate.override { - defaultCrateOverrides = pkgs.defaultCrateOverrides // { - cairo-sys-rs = standardOverride; - graphene-sys = standardOverride; - gobject-sys = standardOverride; - pango-sys = standardOverride; - gio-sys = standardOverride; - gdk-pixbuf-sys = standardOverride; - gdk4-sys = standardOverride; - gsk4-sys = standardOverride; - gtk4-sys = standardOverride; - kifu-gtk = attrs: { - nativeBuildInputs = [ - pkgs.glib - typeshare.packages."x86_64-linux".default - ]; - }; - kifu-wasm = attrs: { - nativeBuildInputs = [ - typeshare.packages."x86_64-linux".default - pkgs.wasm-pack - ]; - buildPhase = '' - cargo build --offline - ''; - installPhase = '' - exit 1 - ''; - }; - }; - }; + + rust = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain; in { kifu-gtk = import ./kifu/kifu-gtk { inherit pkgs; @@ -101,6 +76,7 @@ inherit pkgs; typeshare = typeshare.packages."x86_64-linux".default; wasm-pack = pkgs.wasm-pack; + rustc = rust.availableComponents.rustc; }; kifu-pwa = let @@ -120,18 +96,6 @@ ''; }; - /* - kifu-wasm = (import ./kifu/kifu-pwa/core/Cargo.nix { - inherit pkgs; - buildRustCrateForPkgs = customBuildInfo; - release = true; - }).rootCrate.build; - */ - - /* - kifu-wasm = import ./kifu { inherit (pkgs) rustPlatform wasm-pack; mkDerivation = pkgs.stdenv.mkDerivation; typeshare = typeshare.packages."x86_64-linux".default; }; - */ - cyberpunk-splash = import ./cyberpunk-splash { inherit pkgs; typeshare = typeshare.packages."x86_64-linux".default; diff --git a/kifu/kifu-wasm/default.nix b/kifu/kifu-wasm/default.nix index c6c9d1a..6e0aa48 100644 --- a/kifu/kifu-wasm/default.nix +++ b/kifu/kifu-wasm/default.nix @@ -1,11 +1,13 @@ -{ pkgs, typeshare, wasm-pack }: +{ pkgs, typeshare, wasm-pack, rustc }: let customBuildInfo = pkgs: pkgs.buildRustCrate.override { + inherit rustc; defaultCrateOverrides = pkgs.defaultCrateOverrides // { kifu-wasm = attrs: { buildInputs = [ typeshare ]; + extraRustcOpts = [ "--target wasm32-unknown-unknown" ]; }; }; };