added nix flake for shell

This commit is contained in:
Anton-4 2022-03-14 18:00:54 +01:00
parent d373085386
commit 824e335018
No known key found for this signature in database
GPG Key ID: C954D6E0F9C0ABFD
2 changed files with 114 additions and 0 deletions

44
flake.lock Normal file
View File

@ -0,0 +1,44 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1647122627,
"narHash": "sha256-w4hGsXYyMgJAQRSBxh7O6AAsawJSbudCxfQXhDRhwPQ=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "0f85665118d850aae5164d385d24783d0b16cf1b",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-21.11",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs-unstable": {
"locked": {
"lastModified": 1647199004,
"narHash": "sha256-37aHbLhcX6zqeru24AoPPfem6fUQ6are5E38NdbIgJg=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "328bd3c30e4fc4c3d69bc08516f27e8d85f839b6",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs",
"nixpkgs-unstable": "nixpkgs-unstable"
}
}
},
"root": "root",
"version": 7
}

70
flake.nix Normal file
View File

@ -0,0 +1,70 @@
{
description = "Roc flake";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-21.11";
nixpkgs-unstable = { url = "github:NixOS/nixpkgs/nixpkgs-unstable"; };
# zig = { url = "github:roarkanize/zig-overlay"; };
};
outputs = { self, nixpkgs, nixpkgs-unstable }:
let
pkgs = nixpkgs.legacyPackages.x86_64-linux;
unstable-pkgs = nixpkgs-unstable.legacyPackages.x86_64-linux;
llvmPkgs = pkgs.llvmPackages_12;
linuxInputs = with pkgs; [
valgrind # used in cli tests, see cli/tests/cli_run.rs
vulkan-headers
vulkan-loader
vulkan-tools
vulkan-validation-layers
xorg.libX11
xorg.libXcursor
xorg.libXrandr
xorg.libXi
xorg.libxcb
alsa-lib
];
sharedInputs = (with pkgs; [
# build libraries
cmake
git
python3
llvmPkgs.llvm.dev
llvmPkgs.clang
libxkbcommon
pkg-config
zig # roc builtins are implemented in zig, see compiler/builtins/bitcode/
# lib deps
libffi
libxml2
ncurses
zlib
libiconv
# faster builds - see https://github.com/rtfeldman/roc/blob/trunk/BUILDING_FROM_SOURCE.md#use-lld-for-the-linker
llvmPkgs.lld
# debugir
]) ++ (with unstable-pkgs; [
rustc
cargo
clippy
rustfmt
]);
in {
devShell.x86_64-linux = pkgs.mkShell {
buildInputs = sharedInputs ++ linuxInputs;
LLVM_SYS_120_PREFIX = "${llvmPkgs.llvm.dev}";
NIX_GLIBC_PATH = if pkgs.stdenv.isLinux then "${pkgs.glibc_multi.out}/lib" else "";
LD_LIBRARY_PATH = with pkgs;
lib.makeLibraryPath
([ pkg-config stdenv.cc.cc.lib libffi ncurses zlib ] ++ linuxInputs);
};
};
}