mirror of
https://github.com/roc-lang/roc.git
synced 2024-09-11 18:58:24 +03:00
add basic flake template to use roc in another project
This commit is contained in:
parent
9ba7f0f667
commit
23de67915c
15
flake.nix
15
flake.nix
@ -27,11 +27,16 @@
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, rust-overlay, flake-utils, nixgl, ... }@inputs:
|
||||
let supportedSystems = [ "x86_64-linux" "x86_64-darwin" "aarch64-darwin" "aarch64-linux" ];
|
||||
in flake-utils.lib.eachSystem supportedSystems (system:
|
||||
let
|
||||
supportedSystems = [ "x86_64-linux" "x86_64-darwin" "aarch64-darwin" "aarch64-linux" ];
|
||||
|
||||
templates = import ./nix/templates { };
|
||||
in
|
||||
{ inherit templates; } //
|
||||
flake-utils.lib.eachSystem supportedSystems (system:
|
||||
let
|
||||
overlays = [ (import rust-overlay) ]
|
||||
++ (if system == "x86_64-linux" then [ nixgl.overlay ] else [ ]);
|
||||
++ (if system == "x86_64-linux" then [ nixgl.overlay ] else [ ]);
|
||||
pkgs = import nixpkgs { inherit system overlays; };
|
||||
|
||||
rocBuild = import ./nix { inherit pkgs; };
|
||||
@ -105,7 +110,7 @@
|
||||
|
||||
devShell = pkgs.mkShell {
|
||||
buildInputs = sharedInputs ++ sharedDevInputs ++ darwinInputs ++ darwinDevInputs ++ linuxDevInputs
|
||||
++ (if system == "x86_64-linux" then
|
||||
++ (if system == "x86_64-linux" then
|
||||
[ pkgs.nixgl.nixVulkanIntel ]
|
||||
else
|
||||
[ ]);
|
||||
@ -121,7 +126,7 @@
|
||||
LD_LIBRARY_PATH = with pkgs;
|
||||
lib.makeLibraryPath
|
||||
([ pkg-config stdenv.cc.cc.lib libffi ncurses zlib ]
|
||||
++ linuxDevInputs);
|
||||
++ linuxDevInputs);
|
||||
NIXPKGS_ALLOW_UNFREE =
|
||||
1; # to run the GUI examples with NVIDIA's closed source drivers
|
||||
|
||||
|
6
nix/templates/default.nix
Normal file
6
nix/templates/default.nix
Normal file
@ -0,0 +1,6 @@
|
||||
{ ... }: {
|
||||
simple = {
|
||||
description = "Basic flake with roc cli + lsp";
|
||||
path = ./simple.nix;
|
||||
};
|
||||
}
|
34
nix/templates/simple/flake.nix
Normal file
34
nix/templates/simple/flake.nix
Normal file
@ -0,0 +1,34 @@
|
||||
{
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
roc.url = "github:roc-lang/roc";
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, flake-utils, roc, roc2nix, ... }:
|
||||
flake-utils.lib.eachDefaultSystem (system:
|
||||
let
|
||||
pkgs = import nixpkgs { inherit system; };
|
||||
|
||||
rocPkgs = roc.packages.${system};
|
||||
|
||||
rocFull = rocPkgs.full;
|
||||
|
||||
in
|
||||
{
|
||||
formatter = pkgs.nixpkgs-fmt;
|
||||
|
||||
devShells = {
|
||||
default = pkgs.mkShell {
|
||||
buildInputs = with pkgs;
|
||||
[
|
||||
rocFull # cli included in here
|
||||
];
|
||||
|
||||
shellHook = ''
|
||||
export ROC_LSP_PATH=${rocFull}/bin/roc_ls
|
||||
'';
|
||||
};
|
||||
};
|
||||
});
|
||||
}
|
Loading…
Reference in New Issue
Block a user