-
Notifications
You must be signed in to change notification settings - Fork 3
/
flake.nix
63 lines (63 loc) · 2.13 KB
/
flake.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs";
};
outputs = { self, nixpkgs, ...}:
let
system = "x86_64-linux";
profilePkgs = import nixpkgs {
inherit system;
overlays = [
(final: prev: {
stdenv = prev.withCFlags "-fno-omit-frame-pointer" prev.stdenv;
})
(final: prev: {
llvmPackages_18 = prev.llvmPackages_18 // {
stdenv = final.withCFlags "-fno-omit-frame-pointer" prev.llvmPackages_18.stdenv;
};
})
];
};
dbgstdenv = pkgs: pkgs.stdenv // {
mkDerivation = args: pkgs.stdenv.mkDerivation (finalAttrs: let
o = if builtins.isFunction args then (args finalAttrs) else args;
in o // {
#cmakeBuildType = "Debug";
#dontStrip = true;
#env = (o.env or {}) // {
# NIX_CFLAGS_COMPILE = toString (o.env.NIX_CFLAGS_COMPILE or "") + " -ggdb -Og";
#};
#postInstall = builtins.replaceStrings ["-release.cmake"] ["-debug.cmake"] (o.postInstall or "");
postPatch = (o.postPatch or "") + (if o.pname == "clang"
then "(cd .. && chmod -R +w clang-tools-extra && patch -Np1 < ${./nix/0001-clangd-IncludeCleaner-Use-correct-file-ID-clang18.patch})"
else "");
});
};
mkDevShell = pkgs: args: (pkgs.callPackage ./default.nix ({
llvmPackages = pkgs.llvmPackages_18;
} // (args pkgs))).overrideAttrs (o: {
nativeBuildInputs = (with pkgs; [
clippy (llvmPackages_18.override { stdenv = dbgstdenv pkgs; }).clang-tools
]) ++ o.nativeBuildInputs;
hardeningDisable = [ "all" ];
});
pkgs' = nixpkgs.legacyPackages.${system};
in rec {
packages.${system} = rec {
deai = pkgs'.callPackage ./default.nix {};
default = deai;
};
devShells.${system} = rec {
default = mkDevShell pkgs' (_: {});
clangEnv = mkDevShell pkgs' (pkgs: {
stdenv = pkgs.llvmPackages_18.stdenv;
});
clangProfileEnv = mkDevShell profilePkgs (pkgs: {
stdenv = pkgs.llvmPackages_18.stdenv;
});
};
overlays.default = final: prev: {
deai = final.callPackage ./default.nix {};
};
};
}