8
.github/workflows/main.yml
vendored
8
.github/workflows/main.yml
vendored
@@ -17,16 +17,16 @@ jobs:
|
||||
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
|
||||
|
||||
- name: fmt checks
|
||||
run: nix build .#checks.fmt -L
|
||||
run: nix build .#torana-fmt -L
|
||||
|
||||
- name: clippy checks
|
||||
run: nix build .#checks.clippy -L
|
||||
run: nix build .#torana-clippy -L
|
||||
|
||||
- name: nextest checks
|
||||
run: nix build .#checks.nextest -L
|
||||
run: nix build .#torana-nextest -L
|
||||
|
||||
- name: doc checks
|
||||
run: nix build .#checks.doc -L
|
||||
run: nix build .#torana-doc -L
|
||||
|
||||
- name: build
|
||||
run: nix build .#torana -L
|
15
.github/workflows/web.yml
vendored
15
.github/workflows/web.yml
vendored
@@ -7,7 +7,7 @@ on:
|
||||
workflow_dispatch:
|
||||
|
||||
env:
|
||||
OUT_LINK: toranaWeb
|
||||
OUT_LINK: torana-web
|
||||
|
||||
jobs:
|
||||
build:
|
||||
@@ -25,12 +25,21 @@ jobs:
|
||||
name: pain
|
||||
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
|
||||
|
||||
- name: fmt checks
|
||||
run: nix build .#torana-web-fmt -L
|
||||
|
||||
- name: clippy checks
|
||||
run: nix build .#torana-web-clippy -L
|
||||
|
||||
- name: doc checks
|
||||
run: nix build .#torana-web-doc -L
|
||||
|
||||
- name: build
|
||||
run: nix build .#toranaWeb --out-link $OUT_LINK -L
|
||||
run: nix build .#torana-web --out-link $OUT_LINK -L
|
||||
|
||||
- name: wasm-bindgen
|
||||
run: >
|
||||
nix develop .#toranaWeb
|
||||
nix develop .#torana-web
|
||||
-c wasm-bindgen
|
||||
--target web $OUT_LINK/bin/torana.wasm
|
||||
--out-dir www
|
73
flake.lock
generated
73
flake.lock
generated
@@ -39,6 +39,24 @@
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-parts": {
|
||||
"inputs": {
|
||||
"nixpkgs-lib": "nixpkgs-lib"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1690933134,
|
||||
"narHash": "sha256-ab989mN63fQZBFrkk4Q8bYxQCktuHmBIBqUG1jl6/FQ=",
|
||||
"owner": "hercules-ci",
|
||||
"repo": "flake-parts",
|
||||
"rev": "59cf3f1447cfc75087e7273b04b31e689a8599fb",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "hercules-ci",
|
||||
"repo": "flake-parts",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-utils": {
|
||||
"inputs": {
|
||||
"systems": "systems"
|
||||
@@ -91,12 +109,30 @@
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs-lib": {
|
||||
"locked": {
|
||||
"dir": "lib",
|
||||
"lastModified": 1690881714,
|
||||
"narHash": "sha256-h/nXluEqdiQHs1oSgkOOWF+j8gcJMWhwnZ9PFabN6q0=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "9e1960bc196baf6881340d53dccb203a951745a2",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"dir": "lib",
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"crane": "crane",
|
||||
"flake-parts": "flake-parts",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"rust-overlay": "rust-overlay_2",
|
||||
"utils": "utils"
|
||||
"rust-overlay": "rust-overlay_2"
|
||||
}
|
||||
},
|
||||
"rust-overlay": {
|
||||
@@ -174,39 +210,6 @@
|
||||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"systems_3": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"utils": {
|
||||
"inputs": {
|
||||
"systems": "systems_3"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1689068808,
|
||||
"narHash": "sha256-6ixXo3wt24N/melDWjq70UuHQLxGV8jZvooRanIHXw0=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "919d646de7be200f3bf08cb76ae1f09402b6f9b4",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
|
131
flake.nix
131
flake.nix
@@ -14,126 +14,49 @@
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
utils.url = github:numtide/flake-utils;
|
||||
flake-parts.url = github:hercules-ci/flake-parts;
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, utils, crane, rust-overlay, }:
|
||||
utils.lib.eachDefaultSystem
|
||||
(
|
||||
system:
|
||||
outputs = inputs@{ self, nixpkgs, crane, rust-overlay, flake-parts }:
|
||||
flake-parts.lib.mkFlake { inherit inputs; } {
|
||||
|
||||
systems = [
|
||||
"x86_64-linux"
|
||||
"aarch64-linux"
|
||||
"i686-linux"
|
||||
"x86_64-darwin"
|
||||
"aarch64-darwin"
|
||||
];
|
||||
|
||||
imports = [
|
||||
./nix
|
||||
];
|
||||
|
||||
perSystem = { self', system, ... }:
|
||||
let
|
||||
pkgs = import nixpkgs {
|
||||
inherit system;
|
||||
overlays = [ rust-overlay.overlays.default ];
|
||||
};
|
||||
|
||||
runtimeDependencies = with pkgs; [
|
||||
freetype
|
||||
fontconfig
|
||||
vulkan-loader
|
||||
];
|
||||
|
||||
xorgInputs = with pkgs; (with xorg; [
|
||||
libX11
|
||||
libXcursor
|
||||
libXrandr
|
||||
libXi
|
||||
]) ++ [
|
||||
# libxkbcommon
|
||||
# wayland
|
||||
];
|
||||
|
||||
nativeBuildInputs = with pkgs; [
|
||||
cmake
|
||||
openssl.dev
|
||||
fontconfig.dev
|
||||
pkg-config
|
||||
]
|
||||
++ lib.optionals (with stdenv.hostPlatform; (isx86 || isi686 || isAarch64)) [ mold ]
|
||||
++ lib.optionals stdenv.hostPlatform.isDarwin [ darwin.apple_sdk.frameworks.Cocoa ];
|
||||
|
||||
toolchain = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain;
|
||||
|
||||
craneLib = (crane.mkLib pkgs).overrideToolchain toolchain;
|
||||
|
||||
src = craneLib.cleanCargoSource (craneLib.path ./.);
|
||||
filterWgsl = path: _: builtins.match ".*\.wgsl$" path != null;
|
||||
filterSrc = path: type:
|
||||
(filterWgsl path type) || (craneLib.filterCargoSources path type);
|
||||
|
||||
commonArgs = {
|
||||
inherit src nativeBuildInputs;
|
||||
buildInputs = xorgInputs;
|
||||
doCheck = false;
|
||||
src = pkgs.lib.cleanSourceWith {
|
||||
src = craneLib.path ./.;
|
||||
filter = filterSrc;
|
||||
};
|
||||
|
||||
cargoArtifacts = craneLib.buildDepsOnly commonArgs;
|
||||
|
||||
torana = craneLib.buildPackage (commonArgs // {
|
||||
inherit cargoArtifacts runtimeDependencies;
|
||||
nativeBuildInputs = nativeBuildInputs ++ [ pkgs.autoPatchelfHook ];
|
||||
});
|
||||
|
||||
commonArgsWeb = {
|
||||
inherit src;
|
||||
cargoExtraArgs = "--target wasm32-unknown-unknown";
|
||||
doCheck = false;
|
||||
};
|
||||
|
||||
cargoArtifactsWeb = craneLib.buildDepsOnly commonArgsWeb;
|
||||
|
||||
toranaWeb = craneLib.buildPackage (commonArgsWeb // {
|
||||
inherit cargoArtifactsWeb;
|
||||
});
|
||||
|
||||
in
|
||||
rec {
|
||||
packages = {
|
||||
inherit torana toranaWeb toolchain;
|
||||
default = torana;
|
||||
|
||||
# not using flake checks to run them individually
|
||||
checks = {
|
||||
clippy = craneLib.cargoClippy (commonArgs // {
|
||||
inherit cargoArtifacts;
|
||||
});
|
||||
|
||||
fmt = craneLib.cargoFmt {
|
||||
inherit src;
|
||||
_module.args = {
|
||||
inherit src craneLib toolchain pkgs;
|
||||
};
|
||||
|
||||
doc = craneLib.cargoDoc (commonArgs // {
|
||||
inherit cargoArtifacts;
|
||||
});
|
||||
|
||||
nextest = craneLib.cargoNextest (commonArgs // {
|
||||
inherit cargoArtifacts;
|
||||
partitions = 1;
|
||||
partitionType = "count";
|
||||
});
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
devShells = rec {
|
||||
torana = with pkgs;
|
||||
mkShell {
|
||||
name = "torana";
|
||||
nativeBuildInputs = nativeBuildInputs ++
|
||||
(with pkgs; [ wasm-bindgen toolchain ]);
|
||||
|
||||
LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath
|
||||
(xorgInputs ++ runtimeDependencies);
|
||||
};
|
||||
|
||||
default = torana;
|
||||
|
||||
toranaWeb = with pkgs;
|
||||
mkShell {
|
||||
name = "toranaWeb";
|
||||
nativeBuildInputs = with pkgs; [
|
||||
wasm-bindgen-cli
|
||||
];
|
||||
};
|
||||
};
|
||||
formatter = pkgs.nixpkgs-fmt;
|
||||
}
|
||||
);
|
||||
};
|
||||
};
|
||||
}
|
||||
|
18
nix/default.nix
Normal file
18
nix/default.nix
Normal file
@@ -0,0 +1,18 @@
|
||||
{ ... }: {
|
||||
imports = [
|
||||
./torana.nix
|
||||
./torana-web.nix
|
||||
];
|
||||
|
||||
perSystem = { self', pkgs, ... }: {
|
||||
packages.default = self'.packages.torana;
|
||||
|
||||
devShells.default = pkgs.mkShell {
|
||||
name = "torana-dev";
|
||||
inputsFrom = with self'.devShells; [
|
||||
torana
|
||||
torana-web
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
48
nix/torana-web.nix
Normal file
48
nix/torana-web.nix
Normal file
@@ -0,0 +1,48 @@
|
||||
{ ... }: {
|
||||
perSystem = { pkgs, src, craneLib, toolchain, ... }:
|
||||
let
|
||||
commonArgs = {
|
||||
inherit src;
|
||||
cargoExtraArgs = "--target wasm32-unknown-unknown";
|
||||
doCheck = false;
|
||||
};
|
||||
|
||||
cargoArtifacts = craneLib.buildDepsOnly commonArgs;
|
||||
|
||||
torana = craneLib.buildPackage (commonArgs // {
|
||||
inherit cargoArtifacts;
|
||||
});
|
||||
in
|
||||
{
|
||||
packages = {
|
||||
torana-web = torana;
|
||||
|
||||
torana-web-clippy = craneLib.cargoClippy (commonArgs // {
|
||||
inherit cargoArtifacts;
|
||||
});
|
||||
|
||||
torana-web-fmt = craneLib.cargoFmt {
|
||||
inherit src;
|
||||
};
|
||||
|
||||
torana-web-doc = craneLib.cargoDoc (commonArgs // {
|
||||
inherit cargoArtifacts;
|
||||
});
|
||||
|
||||
torana-web-nextest = craneLib.cargoNextest (commonArgs // {
|
||||
inherit cargoArtifacts;
|
||||
partitions = 1;
|
||||
partitionType = "count";
|
||||
});
|
||||
};
|
||||
|
||||
devShells.torana-web = pkgs.mkShell {
|
||||
name = "torana-web";
|
||||
nativeBuildInputs = [
|
||||
pkgs.wasm-bindgen-cli
|
||||
toolchain
|
||||
];
|
||||
};
|
||||
|
||||
};
|
||||
}
|
73
nix/torana.nix
Normal file
73
nix/torana.nix
Normal file
@@ -0,0 +1,73 @@
|
||||
{ ... }: {
|
||||
perSystem = { pkgs, src, craneLib, toolchain, ... }:
|
||||
let
|
||||
runtimeDependencies = with pkgs; [
|
||||
freetype
|
||||
fontconfig
|
||||
vulkan-loader
|
||||
];
|
||||
|
||||
buildInputs = with pkgs; (with xorg; [
|
||||
libX11
|
||||
libXcursor
|
||||
libXrandr
|
||||
libXi
|
||||
]) ++ [
|
||||
# libxkbcommon
|
||||
# wayland
|
||||
];
|
||||
|
||||
nativeBuildInputs = with pkgs; [
|
||||
cmake
|
||||
openssl.dev
|
||||
fontconfig.dev
|
||||
pkg-config
|
||||
]
|
||||
++ lib.optionals (with stdenv.hostPlatform; (isx86 || isi686 || isAarch64)) [ mold ]
|
||||
++ lib.optionals stdenv.hostPlatform.isDarwin [ darwin.apple_sdk.frameworks.Cocoa ];
|
||||
|
||||
commonArgs = {
|
||||
inherit src nativeBuildInputs buildInputs;
|
||||
doCheck = false;
|
||||
};
|
||||
|
||||
cargoArtifacts = craneLib.buildDepsOnly commonArgs;
|
||||
|
||||
torana = craneLib.buildPackage (commonArgs // {
|
||||
inherit cargoArtifacts runtimeDependencies;
|
||||
nativeBuildInputs = nativeBuildInputs ++ [ pkgs.autoPatchelfHook ];
|
||||
});
|
||||
in
|
||||
{
|
||||
packages = {
|
||||
inherit torana;
|
||||
|
||||
torana-clippy = craneLib.cargoClippy (commonArgs // {
|
||||
inherit cargoArtifacts;
|
||||
});
|
||||
|
||||
torana-fmt = craneLib.cargoFmt {
|
||||
inherit src;
|
||||
};
|
||||
|
||||
torana-doc = craneLib.cargoDoc (commonArgs // {
|
||||
inherit cargoArtifacts;
|
||||
});
|
||||
|
||||
torana-nextest = craneLib.cargoNextest (commonArgs // {
|
||||
inherit cargoArtifacts;
|
||||
partitions = 1;
|
||||
partitionType = "count";
|
||||
});
|
||||
};
|
||||
|
||||
devShells.torana = pkgs.mkShell {
|
||||
name = "torana";
|
||||
nativeBuildInputs = nativeBuildInputs
|
||||
++ [ toolchain ];
|
||||
LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath
|
||||
(buildInputs ++ runtimeDependencies);
|
||||
};
|
||||
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user