nix cleanup, instructions to run editor from nix

This commit is contained in:
Anton-4 2020-11-10 20:03:04 +01:00
parent 06a86246df
commit a1491e5a9e
2 changed files with 69 additions and 41 deletions

View File

@ -80,7 +80,7 @@ If MacOS and using a version >= 10.15:
You may prefer to setup up the volume manually by following nix documentation.
> You my need to restart your terminal
> You may need to restart your terminal
### Usage
@ -96,6 +96,32 @@ You should be in a shell with everything needed to build already installed. Next
You should be in a repl now. Have fun!
### Editor
When you want to run the editor from Ubuntu inside nix you need to install [nixGL](https://github.com/guibou/nixGL) as well:
```bash
nix-shell
git clone https://github.com/guibou/nixGL
cd nixGL
```
If you have an Nvidia graphics card, run:
```
nix-env -f ./ -iA nixVulkanNvidia
```
If you have integrated intel graphics, run
```
nix-env -f ./ -iA nixVulkanIntel
```
Check the [nixGL repo](https://github.com/guibou/nixGL) for other configurations.
Next you should be able to run the editor:
```bash
cd roc
nixVulkanNvidia cargo run edit `# replace Nvidia with the config you chose in the previous step`
```
## Troubleshooting
Create an issue if you run into problems not listed here.

View File

@ -13,6 +13,8 @@ with {
isMacOS = builtins.currentSystem == "x86_64-darwin";
};
with (pkgs);
let
darwin-frameworks =
if isMacOS then
@ -27,58 +29,58 @@ let
]
else
[ ];
llvm = pkgs.llvm_10;
lld = pkgs.lld_10; # this should match llvm's version
clang = pkgs.clang_10; # this should match llvm's version
llvmPkg = pkgs.llvm_10;
lldPkg = pkgs.lld_10; # this should match llvm's version
clangPkg = pkgs.clang_10; # this should match llvm's version
zig = import ./nix/zig.nix { inherit pkgs isMacOS; };
inputs =
[
# build libraries
pkgs.rustc
pkgs.cargo
pkgs.clippy
pkgs.rustfmt
pkgs.cmake
pkgs.git
pkgs.python3
llvm
clang
pkgs.valgrind
pkgs.pkg-config
rustc
cargo
clippy
rustfmt
cmake
git
python3
llvmPkg
clangPkg
valgrind
pkg-config
zig
# llb deps
pkgs.libffi
pkgs.libxml2
pkgs.xorg.libX11
pkgs.zlib
pkgs.vulkan-headers
pkgs.vulkan-loader
pkgs.vulkan-tools
pkgs.vulkan-validation-layers
libffi
libxml2
xorg.libX11
zlib
vulkan-headers
vulkan-loader
vulkan-tools
vulkan-validation-layers
# faster builds - see https://github.com/rtfeldman/roc/blob/trunk/BUILDING_FROM_SOURCE.md#use-lld-for-the-linker
lld
lldPkg
# dev tools
pkgs.rust-analyzer
rust-analyzer
# (import ./nix/zls.nix { inherit pkgs zig; })
pkgs.ccls
ccls
];
in pkgs.mkShell {
in mkShell {
buildInputs = inputs ++ darwin-frameworks;
LLVM_SYS_100_PREFIX = "${llvm}";
LLVM_SYS_100_PREFIX = "${llvmPkg}";
APPEND_LIBRARY_PATH = pkgs.stdenv.lib.makeLibraryPath [
pkgs.pkgconfig
pkgs.vulkan-headers
pkgs.vulkan-loader
pkgs.vulkan-tools
pkgs.vulkan-validation-layers
pkgs.xorg.libX11
pkgs.xorg.libXcursor
pkgs.xorg.libXrandr
pkgs.xorg.libXi
pkgs.libcxx
pkgs.libcxxabi
pkgs.libunwind
APPEND_LIBRARY_PATH = stdenv.lib.makeLibraryPath [
pkgconfig
vulkan-headers
vulkan-loader
vulkan-tools
vulkan-validation-layers
xorg.libX11
xorg.libXcursor
xorg.libXrandr
xorg.libXi
libcxx
libcxxabi
libunwind
];
# Aliases don't work cross shell, so we do this