add basic flake template to use roc in another project

This commit is contained in:
John Murray 2023-12-11 22:01:38 -05:00
parent 9ba7f0f667
commit 23de67915c
No known key found for this signature in database
3 changed files with 50 additions and 5 deletions

View File

@ -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

View File

@ -0,0 +1,6 @@
{ ... }: {
simple = {
description = "Basic flake with roc cli + lsp";
path = ./simple.nix;
};
}

View 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
'';
};
};
});
}