Skip to content

Commit

Permalink
Add nix flake config
Browse files Browse the repository at this point in the history
  • Loading branch information
profetia committed Feb 11, 2025
1 parent 4f9a515 commit 573dc34
Show file tree
Hide file tree
Showing 2 changed files with 114 additions and 0 deletions.
61 changes: 61 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

53 changes: 53 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
{
description = "Flake for Clice";

inputs = {
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};

outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem
(system:
let
pkgs = nixpkgs.legacyPackages.${system};
tomlplusplus = pkgs.tomlplusplus.overrideAttrs (oldAttrs: {
postInstall = oldAttrs.postInstall or "" + ''
ln -s $out/lib/libtomlplusplus.so $out/lib/libtoml++.so
'';
});
in {
devShell = pkgs.mkShell {
buildInputs = [
pkgs.gcc
pkgs.pkg-config
pkgs.xmake
pkgs.cmake
pkgs.ninja
pkgs.python3
pkgs.gtest
pkgs.libuv
pkgs.llvmPackages_20.libstdcxxClang
pkgs.llvmPackages_20.libllvm
pkgs.llvmPackages_20.bintools
pkgs.llvmPackages_20.compiler-rt
pkgs.llvmPackages_20.libunwind

tomlplusplus
];

shellHook =
let
gcc = pkgs.gcc-unwrapped;
gccInclude = "${gcc}/include";
gccCxxIncludePath = "${gccInclude}/c++/${gcc.lib.version}";
in
''
export NIX_CFLAGS_COMPILE+=" -isystem ${gccInclude}"
export NIX_CFLAGS_COMPILE+=" -isystem ${gccCxxIncludePath}"
export NIX_CFLAGS_COMPILE+=" -isystem ${gccCxxIncludePath}/$(gcc -dumpmachine)"
'';
};
}
);
}

0 comments on commit 573dc34

Please sign in to comment.