Files
qmk_userspace/flake.nix
2024-02-20 12:14:54 +00:00

64 lines
2.1 KiB
Nix

{
outputs = {
self,
nixpkgs,
systems,
}: let
eachSystem = f:
nixpkgs.lib.genAttrs (import systems) (sys:
f {
inherit sys;
pkgs = nixpkgs.legacyPackages.${sys};
});
in {
packages = eachSystem ({
sys,
pkgs,
}: rec {
python3 = pkgs.python3.override {
packageOverrides = final: prev: {
milc = prev.milc.overrideAttrs {
patches = [
# Logs pre-initialization give long exceptions without this - they try to write directly to str('/dev/null')
# This effects every `qmk` command post-userspaces, as they have an import-time 'find the userspace' operation
# that logs in several different substeps
# I have *no* idea how noone else has run into this at all, but I can't find any mention of it as an issue anywhere
(pkgs.writeText "patch" ''
diff --git a/milc/__init__.py b/milc/__init__.py
index b3e7158..4f2843e 100644
--- a/milc/__init__.py
+++ b/milc/__init__.py
@@ -39,7 +39,7 @@ if 'MILC_IGNORE_DEPRECATED' not in os.environ:
if name in os.environ:
warnings.warn(f'Using {name} is deprecated and will not be supported in the future, please use set_metadata() instead.', stacklevel=2)
-logging.basicConfig(stream=os.devnull) # Disable logging until we can configure it how the user wants
+logging.basicConfig(filename=os.devnull) # Disable logging until we can configure it how the user wants
cli = MILC(APP_NAME, APP_VERSION, APP_AUTHOR)
'')
];
};
};
};
qmk = pkgs.qmk.override {inherit python3;};
});
devShells = eachSystem ({
sys,
pkgs,
}: {
default = pkgs.mkShell {
packages = with pkgs; [
self.packages.${sys}.qmk
clang
clang-tools
];
shellHook = ''
export QMK_HOME=$PWD/qmk_firmware
'';
};
});
};
}