2023-08-06 19:51:18 -04:00
|
|
|
{
|
|
|
|
inputs = {
|
|
|
|
flake-utils.url = github:numtide/flake-utils;
|
2024-06-26 06:27:02 -04:00
|
|
|
nixpkgs.url = github:nixos/nixpkgs;
|
2023-08-06 19:51:18 -04:00
|
|
|
git-ignore-nix = {
|
|
|
|
url = github:hercules-ci/gitignore.nix/master;
|
|
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
outputs = {
|
2024-02-15 06:37:12 -05:00
|
|
|
self,
|
|
|
|
flake-utils,
|
|
|
|
nixpkgs,
|
|
|
|
git-ignore-nix,
|
|
|
|
...
|
|
|
|
}:
|
|
|
|
flake-utils.lib.eachDefaultSystem (system: let
|
2024-06-26 06:35:37 -04:00
|
|
|
# like lib.lists.remove, but takes a list of elements to remove
|
|
|
|
removeFromList = toRemove: list: pkgs.lib.foldl (l: e: pkgs.lib.remove e l) list toRemove;
|
2024-02-15 06:37:12 -05:00
|
|
|
overlay = self: super: {
|
|
|
|
picom = super.picom.overrideAttrs (oldAttrs: rec {
|
|
|
|
version = "11";
|
|
|
|
pname = "picom";
|
|
|
|
buildInputs =
|
|
|
|
[
|
|
|
|
self.pcre2
|
|
|
|
self.xorg.xcbutil
|
|
|
|
self.libepoxy
|
2024-06-26 06:35:37 -04:00
|
|
|
] ++ (removeFromList [
|
|
|
|
self.xorg.libXinerama
|
|
|
|
self.xorg.libXext
|
|
|
|
self.pcre
|
|
|
|
] oldAttrs.buildInputs);
|
2024-02-15 06:37:12 -05:00
|
|
|
src = git-ignore-nix.lib.gitignoreSource ./.;
|
|
|
|
});
|
|
|
|
};
|
2024-02-18 18:45:41 -05:00
|
|
|
python = pkgs.python3.withPackages (ps: with ps; [
|
2024-03-24 09:17:03 -04:00
|
|
|
xcffib pip dbus-next
|
2024-02-18 18:45:41 -05:00
|
|
|
]);
|
2024-02-15 06:37:12 -05:00
|
|
|
|
|
|
|
pkgs = import nixpkgs {
|
|
|
|
inherit system overlays;
|
|
|
|
config.allowBroken = true;
|
|
|
|
};
|
2024-04-08 04:40:33 -04:00
|
|
|
profilePkgs = import nixpkgs {
|
|
|
|
inherit system;
|
|
|
|
overlays = overlays ++ [
|
|
|
|
(final: prev: {
|
|
|
|
stdenv = prev.withCFlags "-fno-omit-frame-pointer" prev.stdenv;
|
|
|
|
})
|
|
|
|
];
|
|
|
|
};
|
2024-02-15 06:37:12 -05:00
|
|
|
|
|
|
|
overlays = [overlay];
|
2024-04-08 04:40:33 -04:00
|
|
|
mkDevShell = p: p.overrideAttrs (o: {
|
2024-02-18 18:13:53 -05:00
|
|
|
nativeBuildInputs = o.nativeBuildInputs ++ (with pkgs; [
|
|
|
|
clang-tools_17
|
|
|
|
llvmPackages_17.clang-unwrapped.python
|
2024-02-18 18:45:41 -05:00
|
|
|
python
|
2024-02-18 18:13:53 -05:00
|
|
|
]);
|
2024-02-15 06:37:12 -05:00
|
|
|
hardeningDisable = ["fortify"];
|
|
|
|
shellHook = ''
|
|
|
|
# Workaround a NixOS limitation on sanitizers:
|
|
|
|
# See: https://github.com/NixOS/nixpkgs/issues/287763
|
|
|
|
export LD_LIBRARY_PATH+=":/run/opengl-driver/lib"
|
2024-06-28 13:11:35 -04:00
|
|
|
export UBSAN_OPTIONS="disable_coredump=0:unmap_shadow_on_exit=1:print_stacktrace=1"
|
2024-06-03 20:27:54 -04:00
|
|
|
export ASAN_OPTIONS="disable_coredump=0:unmap_shadow_on_exit=1"
|
2024-02-15 06:37:12 -05:00
|
|
|
'';
|
2024-02-18 18:13:53 -05:00
|
|
|
});
|
2024-04-08 04:40:33 -04:00
|
|
|
in rec {
|
|
|
|
inherit
|
|
|
|
overlay
|
|
|
|
overlays
|
|
|
|
;
|
|
|
|
defaultPackage = pkgs.picom;
|
|
|
|
devShells.default = mkDevShell defaultPackage;
|
2024-02-18 18:13:53 -05:00
|
|
|
devShells.useClang = devShells.default.override {
|
|
|
|
inherit (pkgs.llvmPackages_17) stdenv;
|
2024-02-15 06:37:12 -05:00
|
|
|
};
|
2024-04-08 04:40:33 -04:00
|
|
|
# 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;
|
|
|
|
};
|
2024-02-10 05:57:33 -05:00
|
|
|
});
|
2023-08-06 19:51:18 -04:00
|
|
|
}
|