Move Nix flake to fornjot-extra

This commit is contained in:
Hanno Braun 2023-05-15 10:49:35 +02:00
parent 17efc2b2b2
commit 24165d3b8f
4 changed files with 0 additions and 216 deletions

View File

@ -1,10 +0,0 @@
(import
(
let lock = builtins.fromJSON (builtins.readFile ./flake.lock); in
fetchTarball {
url = "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz";
sha256 = lock.nodes.flake-compat.locked.narHash;
}
)
{ src = ./.; }
).defaultNix

View File

@ -1,113 +0,0 @@
{
"nodes": {
"crane": {
"inputs": {
"flake-compat": [
"flake-compat"
],
"flake-utils": [
"flake-utils"
],
"nixpkgs": [
"nixpkgs"
],
"rust-overlay": [
"rust-overlay"
]
},
"locked": {
"lastModified": 1678152261,
"narHash": "sha256-cPRDxwygVMleiSEGELrvAiq9vYAN4c3KK/K4UEO13vU=",
"owner": "ipetkov",
"repo": "crane",
"rev": "5291dd0aa7a52d607fc952763ef60714e4c881d4",
"type": "github"
},
"original": {
"owner": "ipetkov",
"repo": "crane",
"type": "github"
}
},
"flake-compat": {
"flake": false,
"locked": {
"lastModified": 1673956053,
"narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"flake-utils": {
"locked": {
"lastModified": 1678901627,
"narHash": "sha256-U02riOqrKKzwjsxc/400XnElV+UtPUQWpANPlyazjH0=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "93a2b84fc4b70d9e089d029deacc3583435c2ed6",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1678949004,
"narHash": "sha256-8c0hnhTjmLRxtYp7wLr2nN4sRa61quL9PBSaGuYaBL0=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "67712ddbdcfa2790dc0d58c56b83eb980ab43213",
"type": "github"
},
"original": {
"owner": "NixOS",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"crane": "crane",
"flake-compat": "flake-compat",
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs",
"rust-overlay": "rust-overlay"
}
},
"rust-overlay": {
"inputs": {
"flake-utils": [
"flake-utils"
],
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1678933473,
"narHash": "sha256-UY19R278O9bwneLWC7ady8VMoQ+UlAWy8SkUsfDZvQs=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "5c1af9b9d618e02a87cdd30a3022aec0b78cd9aa",
"type": "github"
},
"original": {
"owner": "oxalica",
"repo": "rust-overlay",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

View File

@ -1,83 +0,0 @@
{
description = "Fornjot is an early-stage project to create a next-generation, code-first CAD application";
inputs = {
flake-compat = { url = "github:edolstra/flake-compat"; flake = false; };
nixpkgs.url = "github:NixOS/nixpkgs";
flake-utils.url = "github:numtide/flake-utils";
rust-overlay = { url = "github:oxalica/rust-overlay"; inputs = { nixpkgs.follows = "nixpkgs"; flake-utils.follows = "flake-utils"; }; };
crane = {
url = "github:ipetkov/crane";
inputs = {
nixpkgs.follows = "nixpkgs";
flake-compat.follows = "flake-compat";
flake-utils.follows = "flake-utils";
rust-overlay.follows = "rust-overlay";
};
};
};
outputs = { self, nixpkgs, crane, flake-utils, rust-overlay, ... }:
flake-utils.lib.eachDefaultSystem (system:
let
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
{
channel = toolchainToml.channel;
components = toolchainToml.components ++ [ "rust-analyzer" "rust-src" ];
}
);
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|png|obj|fj.toml|mtl)$" path) != null;
filter = path: type: (assetsFilter path type) || (craneLib.filterCargoSources path type);
buildInputs = with pkgs; [
pkg-config
fontconfig
cmake
wayland
libGL
xorg.libX11
xorg.libXcursor
xorg.libXi
xorg.libXrandr
];
fornjot = craneLib.buildPackage {
pname = "fj-app";
src = nixpkgs.lib.cleanSourceWith { src = ../.; inherit filter; };
inherit buildInputs version;
};
wrappedFornjot = pkgs.symlinkJoin {
name = "fj-app";
inherit version;
paths = [ fornjot ];
buildInputs = [ pkgs.makeWrapper ];
postBuild = ''
wrapProgram $out/bin/fj-app \
--prefix LD_LIBRARY_PATH : ${nixpkgs.lib.makeLibraryPath [ pkgs.vulkan-loader ]}
'';
};
in
{
checks = { inherit fornjot; };
packages.default = wrappedFornjot;
apps.default = flake-utils.lib.mkApp { drv = wrappedFornjot; };
devShells.default = pkgs.mkShell {
inputsFrom = builtins.attrValues self.checks;
inherit buildInputs;
nativeBuildInputs = [ rustToolchain ];
LD_LIBRARY_PATH = "${nixpkgs.lib.makeLibraryPath [ pkgs.vulkan-loader pkgs.stdenv.cc.cc.lib pkgs.lib3mf]}";
};
});
}

View File

@ -1,10 +0,0 @@
(import
(
let lock = builtins.fromJSON (builtins.readFile ./flake.lock); in
fetchTarball {
url = "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz";
sha256 = lock.nodes.flake-compat.locked.narHash;
}
)
{ src = ./.; }
).shellNix