Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nix flakes readme sub dir #1203

Merged
merged 2 commits into from
Oct 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
File renamed without changes.
File renamed without changes.
8 changes: 5 additions & 3 deletions flake.nix → nix/flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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 ];
Expand Down
File renamed without changes.