1
0
Fork 0
mirror of https://github.com/yshui/picom.git synced 2024-11-18 13:55:36 -05:00

flake: add a dev shell that has frame pointers

Helps tremendously with getting stack trace from ASan, etc.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
Yuxuan Shui 2024-04-08 09:40:33 +01:00
parent c51d446854
commit e5210aea7b
No known key found for this signature in database
GPG key ID: D3A4405BE6CC17F4
2 changed files with 30 additions and 16 deletions

View file

@ -5,11 +5,11 @@
"systems": "systems" "systems": "systems"
}, },
"locked": { "locked": {
"lastModified": 1705309234, "lastModified": 1710146030,
"narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=", "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
"owner": "numtide", "owner": "numtide",
"repo": "flake-utils", "repo": "flake-utils",
"rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26", "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -25,11 +25,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1703887061, "lastModified": 1709087332,
"narHash": "sha256-gGPa9qWNc6eCXT/+Z5/zMkyYOuRZqeFZBDbopNZQkuY=", "narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=",
"owner": "hercules-ci", "owner": "hercules-ci",
"repo": "gitignore.nix", "repo": "gitignore.nix",
"rev": "43e1aa1308018f37118e34d3a9cb4f5e75dc11d5", "rev": "637db329424fd7e46cf4185293b9cc8c88c95394",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -41,11 +41,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1705856552, "lastModified": 1712517181,
"narHash": "sha256-JXfnuEf5Yd6bhMs/uvM67/joxYKoysyE3M2k6T3eWbg=", "narHash": "sha256-NfHaSxL89kX39s1V1/EnnIqBX8LXcc/7ow5fzfCwPrM=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "612f97239e2cc474c13c9dafa0df378058c5ad8d", "rev": "6507feebbd146188300681ca26bac5da3c12b9f1",
"type": "github" "type": "github"
}, },
"original": { "original": {

View file

@ -38,15 +38,17 @@
inherit system overlays; inherit system overlays;
config.allowBroken = true; config.allowBroken = true;
}; };
profilePkgs = import nixpkgs {
inherit system;
overlays = overlays ++ [
(final: prev: {
stdenv = prev.withCFlags "-fno-omit-frame-pointer" prev.stdenv;
})
];
};
overlays = [overlay]; overlays = [overlay];
in rec { mkDevShell = p: p.overrideAttrs (o: {
inherit
overlay
overlays
;
defaultPackage = pkgs.picom;
devShells.default = defaultPackage.overrideAttrs (o: {
nativeBuildInputs = o.nativeBuildInputs ++ (with pkgs; [ nativeBuildInputs = o.nativeBuildInputs ++ (with pkgs; [
clang-tools_17 clang-tools_17
llvmPackages_17.clang-unwrapped.python llvmPackages_17.clang-unwrapped.python
@ -59,8 +61,20 @@
export LD_LIBRARY_PATH+=":/run/opengl-driver/lib" export LD_LIBRARY_PATH+=":/run/opengl-driver/lib"
''; '';
}); });
in rec {
inherit
overlay
overlays
;
defaultPackage = pkgs.picom;
devShells.default = mkDevShell defaultPackage;
devShells.useClang = devShells.default.override { devShells.useClang = devShells.default.override {
inherit (pkgs.llvmPackages_17) stdenv; inherit (pkgs.llvmPackages_17) stdenv;
}; };
# build picom and all dependencies with frame pointer, making profiling/debugging easier.
# WARNING! many many rebuilds
devShells.useClangProfile = (mkDevShell profilePkgs.picom).override {
stdenv = profilePkgs.withCFlags "-fno-omit-frame-pointer" profilePkgs.llvmPackages_17.stdenv;
};
}); });
} }