Skip to content

Commit

Permalink
build: Nix devshell improvements
Browse files Browse the repository at this point in the history
Add additional dependencies to the Nix devshell.
  • Loading branch information
theduke committed Nov 13, 2023
1 parent 2a2c678 commit 8592d53
Showing 1 changed file with 58 additions and 25 deletions.
83 changes: 58 additions & 25 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
description = "app";
description = "winterjs - A Javascript runtime following the WinterCG spec.";

inputs = {
flakeutils = {
Expand All @@ -11,13 +11,14 @@
outputs = { self, nixpkgs, flakeutils }:
flakeutils.lib.eachDefaultSystem (system:
let
NAME = "app";
VERSION = "0.1";
NAME = "winterjs";
VERSION = "0.1.0";

pkgs = import nixpkgs {
inherit system;
};

llvm = pkgs.llvmPackages_latest;
in
rec {

Expand All @@ -36,35 +37,67 @@
# };
# defaultApp = apps.${NAME};

devShell = pkgs.stdenv.mkDerivation {
name = NAME;
src = self;
buildInputs = with pkgs; [
# rustup
# python3
# perl

llvmPackages_16.bintools-unwrapped
devShell = pkgs.mkShell.override { stdenv = pkgs.llvmPackages_latest.stdenv; } rec {
packages = with pkgs; [
# llvmPackages_16.bintools-unwrapped
pkg-config
gnum4

# builder
gnumake
cmake
bear

# debugger
llvmPackages_latest.lldb
gdb

# fix headers not found
clang-tools

# LSP and compiler
llvmPackages_latest.libstdcxxClang

# other tools
cppcheck
llvmPackages_latest.libllvm
valgrind

# stdlib for cpp
llvmPackages_latest.libcxx

# libs
llvmPackages_latest.libclang
zlib
llvmPackages_16.libclang
];
runtimeDependencies = with pkgs; [ ];

LD_LIBRARY_PATH= pkgs.lib.makeLibraryPath (with pkgs; [
zlib
llvmPackages_16.libclang
]);

# standalone as(1) doesn’t treat -DNDEBUG as -D NDEBUG (define), but rather -D (produce
# assembler debugging messages) + -N (invalid option); see also <https://bugs.gentoo.org/732190>
# /nix/store/a64w6zy8w9hcj6b4g5nz0dl6zyd24c1x-gcc-wrapper-11.3.0/bin/as: invalid option -- 'N'
# make[4]: *** [/path/to/mozjs/mozjs/mozjs/config/rules.mk:664: icu_data.o] Error 1
# make[3]: *** [/path/to/mozjs/mozjs/mozjs/config/recurse.mk:72: config/external/icu/data/target-objects] Error 2
AS="$CC -c";
LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath packages;


shellHook = ''
export AS="$CC -c"
'';
};

# devShell = pkgs.stdenv.mkDerivation {
# name = NAME;
# src = self;
# buildInputs = with pkgs; [
# ];
# runtimeDependencies = with pkgs; [ ];

# LD_LIBRARY_PATH= pkgs.lib.makeLibraryPath (with pkgs; [
# zlib
# llvmPackages_16.libclang
# ]);

# # standalone as(1) doesn’t treat -DNDEBUG as -D NDEBUG (define), but rather -D (produce
# # assembler debugging messages) + -N (invalid option); see also <https://bugs.gentoo.org/732190>
# # /nix/store/a64w6zy8w9hcj6b4g5nz0dl6zyd24c1x-gcc-wrapper-11.3.0/bin/as: invalid option -- 'N'
# # make[4]: *** [/path/to/mozjs/mozjs/mozjs/config/rules.mk:664: icu_data.o] Error 1
# # make[3]: *** [/path/to/mozjs/mozjs/mozjs/config/recurse.mk:72: config/external/icu/data/target-objects] Error 2
# AS="$CC -c";
# };
}
);
}

0 comments on commit 8592d53

Please sign in to comment.