mirror of
https://github.com/hannobraun/Fornjot
synced 2025-01-17 21:56:21 +00:00
Merge pull request #1203 from Philipp-M/nix-flakes-readme-sub-dir
Nix flakes readme sub dir
This commit is contained in:
commit
856a93b643
@ -124,6 +124,11 @@ To install Fornjot itself, you have the following options:
|
||||
|
||||
While the Fornjot application is a graphical application that opens a window and displays a 3D view of your model, it can currently only be started from the command-line. The instructions below assume that you have the Fornjot application installed somewhere on your path, under the name `fj-app`.
|
||||
|
||||
#### Via Nix
|
||||
|
||||
There's a Nix [flake](https://nixos.wiki/wiki/Flakes) in the subdirectory `./nix` which contains a devshell environment (via `nix develop` or `nix-shell`) and the package `fj-app`.
|
||||
It can be run/tested with a [flake enabled](https://nixos.wiki/wiki/Flakes#Enable_flakes) nix via `nix run github:hannobraun/Fornjot?dir=nix` or with legacy nix in the directory `./nix`, `nix-build`.
|
||||
|
||||
### Defining models
|
||||
|
||||
Models are Rust libraries that depend on the [`fj`](https://crates.io/crates/fj) library, which they use to define the geometry. Furthermore, they need to be built as a dynamic library. Just use the examples in the [`models/`](models) directory as a template to define your own.
|
||||
|
0
flake.lock → nix/flake.lock
generated
0
flake.lock → nix/flake.lock
generated
@ -21,13 +21,14 @@
|
||||
pkgs = import nixpkgs { inherit system; overlays = [ (import rust-overlay) ]; };
|
||||
rustToolchain = pkgs.rust-bin.fromRustupToolchain (
|
||||
# extend toolchain with rust-analyzer for better IDE support
|
||||
let toolchainToml = (builtins.fromTOML (builtins.readFile ./rust-toolchain.toml)).toolchain; in
|
||||
let toolchainToml = (builtins.fromTOML (builtins.readFile ../rust-toolchain.toml)).toolchain; in
|
||||
{
|
||||
channel = toolchainToml.channel;
|
||||
components = toolchainToml.components ++ [ "rust-analyzer" ];
|
||||
}
|
||||
);
|
||||
craneLib = (crane.mkLib pkgs).overrideToolchain rustToolchain;
|
||||
version = (builtins.fromTOML (builtins.readFile ../Cargo.toml)).workspace.package.version;
|
||||
# Only keeps assets in crates/ (currently shaders and fonts)
|
||||
assetsFilter = path: _type: (builtins.match ".*(:?wgsl|ttf)$" path) != null;
|
||||
filter = path: type: (assetsFilter path type) || (craneLib.filterCargoSources path type);
|
||||
@ -45,12 +46,13 @@
|
||||
|
||||
fornjot = craneLib.buildPackage {
|
||||
pname = "fj-app";
|
||||
src = nixpkgs.lib.cleanSourceWith { src = ./.; inherit filter; };
|
||||
inherit buildInputs;
|
||||
src = nixpkgs.lib.cleanSourceWith { src = ../.; inherit filter; };
|
||||
inherit buildInputs version;
|
||||
};
|
||||
|
||||
wrappedFornjot = pkgs.symlinkJoin {
|
||||
name = "fj-app";
|
||||
inherit version;
|
||||
paths = [ fornjot ];
|
||||
|
||||
buildInputs = [ pkgs.makeWrapper ];
|
Loading…
Reference in New Issue
Block a user