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";
|
2024-07-30 12:03:55 -04:00
|
|
|
nativeBuildInputs = (removeFromList [ self.asciidoc ] oldAttrs.nativeBuildInputs) ++
|
|
|
|
[
|
|
|
|
self.asciidoctor
|
|
|
|
];
|
2024-02-15 06:37:12 -05:00
|
|
|
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-07-15 06:22:31 -04:00
|
|
|
(final: prev: {
|
|
|
|
llvmPackages_18 = prev.llvmPackages_18 // {
|
|
|
|
stdenv = final.withCFlags "-fno-omit-frame-pointer" prev.llvmPackages_18.stdenv;
|
|
|
|
};
|
|
|
|
})
|
2024-04-08 04:40:33 -04:00
|
|
|
];
|
|
|
|
};
|
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; [
|
2024-07-15 06:22:31 -04:00
|
|
|
clang-tools_18
|
|
|
|
llvmPackages_18.clang-unwrapped.python
|
2024-07-30 08:43:34 -04:00
|
|
|
llvmPackages_18.libllvm
|
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-28 13:15:39 -04:00
|
|
|
export ASAN_OPTIONS="disable_coredump=0:unmap_shadow_on_exit=1:abort_on_error=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
|
|
|
|
;
|
2024-07-15 06:22:31 -04:00
|
|
|
packages = {
|
|
|
|
default = pkgs.picom;
|
|
|
|
};
|
|
|
|
devShells.default = mkDevShell packages.default;
|
2024-02-18 18:13:53 -05:00
|
|
|
devShells.useClang = devShells.default.override {
|
2024-07-15 06:22:31 -04:00
|
|
|
inherit (pkgs.llvmPackages_18) 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 {
|
2024-07-15 06:22:31 -04:00
|
|
|
stdenv = profilePkgs.withCFlags "-fno-omit-frame-pointer" profilePkgs.llvmPackages_18.stdenv;
|
2024-04-08 04:40:33 -04:00
|
|
|
};
|
2024-02-10 05:57:33 -05:00
|
|
|
});
|
2023-08-06 19:51:18 -04:00
|
|
|
}
|