flake: Format with nixfmt

This commit is contained in:
Sapphire
2026-10-01 19:49:42 -05:00
parent 5f604e1fc3
commit 3136066aa9
+107 -95
View File
@@ -2,106 +2,118 @@
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
inputs.flake-parts.url = "github:hercules-ci/flake-parts"; inputs.flake-parts.url = "github:hercules-ci/flake-parts";
outputs = inputs@{ nixpkgs, flake-parts, ... }: outputs =
inputs@{ nixpkgs, flake-parts, ... }:
flake-parts.lib.mkFlake { inherit inputs; } { flake-parts.lib.mkFlake { inherit inputs; } {
systems = [ "x86_64-linux" ]; systems = [ "x86_64-linux" ];
perSystem = { lib, pkgs, ... }: let perSystem =
# Extra build inputs only inside the devShell. { lib, pkgs, ... }:
devBuildInputs = [ let
# for client build # Extra build inputs only inside the devShell.
pkgs.curl devBuildInputs = [
pkgs.ktx-tools # for client build
]; pkgs.curl
# Tools used for development work (clangd, clang-format) pkgs.ktx-tools
devTools = [
pkgs.clang-tools
pkgs.gdb
pkgs.ktx-tools
];
# Extra build inputs not yet in the nixpkgs recipe.
extraBuildInputs = [
# XRT_FEATURE_DEBUG_GUI requires SDL2
pkgs.sdl2-compat
pkgs.libpng
pkgs.kdePackages.kirigami-addons
];
extraNativeBuildInputs = [
pkgs.util-linux
];
package = pkgs.enableDebugging (pkgs.wivrn.overrideAttrs (finalAttrs: oldAttrs: {
# Filter the directories and files we don't need to keep to avoid needless rebuilds
src = lib.cleanSourceWith {
filter = name: type: let
baseName = baseNameOf (toString name);
in
(lib.cleanSourceFilter name type) &&
!(
(type == "directory" && (
baseName == ".direnv"
|| baseName == ".cxx"
|| lib.hasPrefix "build" baseName))
|| baseName == ".envrc"
);
src = ./.;
};
version = "next";
# Because src is just a folder path and not a set from a fetcher, it doesn't need to be unpacked, so having a postUnpack throws an error.
# We also don't need the check since we read the revision from the monado-rev file.
postUnpack = null;
separateDebugInfo = false;
monado = pkgs.applyPatches {
inherit (oldAttrs.monado) patches postPatch;
# Force a refetch when the monado rev changes.
src = pkgs.testers.invalidateFetcherByDrvHash pkgs.fetchFromGitLab {
inherit (oldAttrs.monado.src) owner repo;
domain = "gitlab.freedesktop.org";
# Keep in sync with CMakeLists.txt monado rev
rev = lib.strings.trim (builtins.readFile ./monado-rev);
# Nix will output the correct hash when it doesn't match
hash = "sha256-3+bdxyXHuaweT/K+Jwh428XNMuZUd1tL2bdFBRIZ/Po=";
};
};
buildInputs = oldAttrs.buildInputs ++ extraBuildInputs;
nativeBuildInputs = oldAttrs.nativeBuildInputs ++ extraNativeBuildInputs;
cmakeFlags = (oldAttrs.cmakeFlags or []) ++ [
(lib.cmakeFeature "GIT_DESC" "nightly")
(lib.cmakeFeature "GIT_COMMIT" "nightly")
]; ];
})); # Tools used for development work (clangd, clang-format)
in { devTools = [
packages = { pkgs.clang-tools
default = package; pkgs.gdb
dissector = package.overrideAttrs (oldAttrs: { pkgs.ktx-tools
pname = "wivrn-dissector"; ];
cmakeFlags = (lib.filter (flag: !(lib.hasPrefix "-DWIVRN_BUILD" flag)) oldAttrs.cmakeFlags) ++ [ # Extra build inputs not yet in the nixpkgs recipe.
(lib.cmakeBool "WIVRN_BUILD_CLIENT" false) extraBuildInputs = [
(lib.cmakeBool "WIVRN_BUILD_SERVER" false) # XRT_FEATURE_DEBUG_GUI requires SDL2
(lib.cmakeBool "WIVRN_BUILD_DASHBOARD" false) pkgs.sdl2-compat
(lib.cmakeBool "WIVRN_BUILD_WIVRNCTL" false)
(lib.cmakeBool "WIVRN_BUILD_DISSECTOR" true) pkgs.libpng
]; pkgs.kdePackages.kirigami-addons
buildInputs = oldAttrs.buildInputs ++ [ ];
(pkgs.symlinkJoin { extraNativeBuildInputs = [
name = "wireshark-dev-out-combined"; pkgs.util-linux
paths = [ ];
pkgs.wireshark.out
pkgs.wireshark.dev package = pkgs.enableDebugging (
pkgs.wivrn.overrideAttrs (
finalAttrs: oldAttrs: {
# Filter the directories and files we don't need to keep to avoid needless rebuilds
src = lib.cleanSourceWith {
filter =
name: type:
let
baseName = baseNameOf (toString name);
in
(lib.cleanSourceFilter name type)
&& !(
(
type == "directory"
&& (baseName == ".direnv" || baseName == ".cxx" || lib.hasPrefix "build" baseName)
)
|| baseName == ".envrc"
);
src = ./.;
};
version = "next";
# Because src is just a folder path and not a set from a fetcher, it doesn't need to be unpacked, so having a postUnpack throws an error.
# We also don't need the check since we read the revision from the monado-rev file.
postUnpack = null;
separateDebugInfo = false;
monado = pkgs.applyPatches {
inherit (oldAttrs.monado) patches postPatch;
# Force a refetch when the monado rev changes.
src = pkgs.testers.invalidateFetcherByDrvHash pkgs.fetchFromGitLab {
inherit (oldAttrs.monado.src) owner repo;
domain = "gitlab.freedesktop.org";
# Keep in sync with CMakeLists.txt monado rev
rev = lib.strings.trim (builtins.readFile ./monado-rev);
# Nix will output the correct hash when it doesn't match
hash = "sha256-3+bdxyXHuaweT/K+Jwh428XNMuZUd1tL2bdFBRIZ/Po=";
};
};
buildInputs = oldAttrs.buildInputs ++ extraBuildInputs;
nativeBuildInputs = oldAttrs.nativeBuildInputs ++ extraNativeBuildInputs;
cmakeFlags = (oldAttrs.cmakeFlags or [ ]) ++ [
(lib.cmakeFeature "GIT_DESC" "nightly")
(lib.cmakeFeature "GIT_COMMIT" "nightly")
]; ];
}) }
]; )
preFixup = null; );
in
{
formatter = pkgs.nixfmt;
packages = {
default = package;
dissector = package.overrideAttrs (oldAttrs: {
pname = "wivrn-dissector";
cmakeFlags = (lib.filter (flag: !(lib.hasPrefix "-DWIVRN_BUILD" flag)) oldAttrs.cmakeFlags) ++ [
(lib.cmakeBool "WIVRN_BUILD_CLIENT" false)
(lib.cmakeBool "WIVRN_BUILD_SERVER" false)
(lib.cmakeBool "WIVRN_BUILD_DASHBOARD" false)
(lib.cmakeBool "WIVRN_BUILD_WIVRNCTL" false)
(lib.cmakeBool "WIVRN_BUILD_DISSECTOR" true)
];
buildInputs = oldAttrs.buildInputs ++ [
(pkgs.symlinkJoin {
name = "wireshark-dev-out-combined";
paths = [
pkgs.wireshark.out
pkgs.wireshark.dev
];
})
];
preFixup = null;
});
};
devShells.default = package.overrideAttrs (oldAttrs: {
buildInputs = oldAttrs.buildInputs ++ devBuildInputs;
nativeBuildInputs = oldAttrs.nativeBuildInputs ++ devTools;
}); });
}; };
devShells.default = package.overrideAttrs (oldAttrs: {
buildInputs = oldAttrs.buildInputs ++ devBuildInputs;
nativeBuildInputs = oldAttrs.nativeBuildInputs ++ devTools;
});
};
}; };
} }