mirror of
https://git.sr.ht/~magic_rb/dotfiles
synced 2024-11-29 11:36:16 +01:00
QMK stuff
Signed-off-by: Magic_RB <magic_rb@redalder.org>
This commit is contained in:
parent
e98933786a
commit
8084fd8671
72
nix/extra/qmk/keymap.c
Normal file
72
nix/extra/qmk/keymap.c
Normal file
|
@ -0,0 +1,72 @@
|
|||
/* Copyright 2020 Johannes Krude
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include QMK_KEYBOARD_H
|
||||
|
||||
enum layer_names {
|
||||
BASE
|
||||
};
|
||||
|
||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
|
||||
/* Base ,-----------------------------------------. ,-----------------------------------------------------.
|
||||
* | ESC | F1 | F2 | F3 | F4 | F5 | F6 | | F7 | F8 | F9 | F10 | F11 | F12 |Print| Ins | Del |
|
||||
* ,-----------. |-----+-----+-----+-----+-----+-----+-----| |-----+-----+-----+-----+-----+-----+-----------+-----|
|
||||
* | 8 | 9 | | ~ | 1 | 2 | 3 | 4 | 5 | 6 | | 7 | 8 | 9 | 0 | - | = | Backspac | Home|
|
||||
* |-----+-----| |-----------------------------------------' ,--------------------------------------------------+-----|
|
||||
* | 6 | 7 | | Tab | Q | W | E | R | T | | Y | U | I | O | P | [ | ] | | PgUp|
|
||||
* |-----+-----| |---------------------------------------. `------------------------------------------+ Enter +-----|
|
||||
* | 4 | 5 | | Caps | A | S | D | F | G | | H | J | K | L | ; | ' | # | | PgDn|
|
||||
* |-----+-----| |-----------------------------------------. `-------------------------------------------------+-----|
|
||||
* | 2 | 3 | | Shift | > | Z | X | C | V | B | | N | M | , | . | / | Shift | Up | End |
|
||||
* |-----+-----| |-----------------------------------------' ,-------------------------------------------+-----+-----|
|
||||
* | 0 | 1 | | Ctrl | GUI | Alt | Space |Space| | Space | Alt | Slk | Ctrl | Left| Down|Right|
|
||||
* `-----------' `---------------------------------------' `-------------------------------------------------------'
|
||||
*/
|
||||
[BASE] = LAYOUT_iso(
|
||||
//--------------------------------Left Hand-----------------------------------| |--------------------------------Right Hand------------------------------------------------
|
||||
KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR, KC_INS, KC_DEL,
|
||||
KC_8, KC_9, KC_GRAVE, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINUS, KC_EQUAL, KC_BSPC, KC_HOME,
|
||||
KC_6, KC_7, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_PGUP,
|
||||
KC_4, KC_5, KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENTER, KC_PGDN,
|
||||
KC_2, KC_3, KC_LSFT, KC_NUBS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_END,
|
||||
KC_0, KC_1, KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_SPC, KC_SPC, KC_RALT, KC_SLCK ,KC_RCTL, KC_LEFT, KC_DOWN, KC_RIGHT
|
||||
)
|
||||
};
|
||||
|
||||
/* Base ,-----------------------------------------. ,-----------------------------------------------------.
|
||||
* | | | | | | | | | | | | | | | | | |
|
||||
* ,-----------. |-----+-----+-----+-----+-----+-----+-----| |-----+-----+-----+-----+-----+-----+-----------+-----|
|
||||
* | | | | | | | | | | | | | | | | | | | |
|
||||
* |-----+-----| |-----------------------------------------' ,--------------------------------------------------+-----|
|
||||
* | | | | | | | | | | | | | | | | | | | |
|
||||
* |-----+-----| |---------------------------------------. `------------------------------------------+ +-----|
|
||||
* | | | | | | | | | | | | | | | | | | | |
|
||||
* |-----+-----| |-----------------------------------------. `-------------------------------------------------+-----|
|
||||
* | | | | | | | | | | | | | | | | | | | |
|
||||
* |-----+-----| |-----------------------------------------' ,-------------------------------------------+-----+-----|
|
||||
* | | | | | | | | | | | | | | | | |
|
||||
* `-----------' `---------------------------------------' `-------------------------------------------------------'
|
||||
*/
|
||||
// [] = LAYOUT(
|
||||
// //--------------------------------Left Hand-----------------------------------------------| |--------------------------------Right Hand------------------------------------------------
|
||||
// _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
|
||||
// _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
|
||||
// _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
|
||||
// _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
|
||||
// _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
|
||||
// _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
|
||||
// ),
|
22
nix/extra/qmk/rules.mk
Normal file
22
nix/extra/qmk/rules.mk
Normal file
|
@ -0,0 +1,22 @@
|
|||
# MCU name
|
||||
MCU = atmega32a
|
||||
|
||||
# Bootloader selection
|
||||
BOOTLOADER = bootloadhid
|
||||
|
||||
# Build Options
|
||||
# change yes to no to disable
|
||||
#
|
||||
BOOTMAGIC_ENABLE = no # Enable Bootmagic Lite
|
||||
MOUSEKEY_ENABLE = no # Mouse keys
|
||||
EXTRAKEY_ENABLE = yes # Audio control and System control
|
||||
CONSOLE_ENABLE = no # Console for debug
|
||||
COMMAND_ENABLE = no # Commands for debug and configuration
|
||||
BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
|
||||
RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow
|
||||
WS2812_DRIVER = i2c
|
||||
|
||||
# custom matrix setup
|
||||
CUSTOM_MATRIX = lite
|
||||
SRC = matrix.c
|
||||
QUANTUM_LIB_SRC += i2c_master.c
|
133
nix/extra/qmk/sp84.nix
Normal file
133
nix/extra/qmk/sp84.nix
Normal file
|
@ -0,0 +1,133 @@
|
|||
{ qmk
|
||||
}:
|
||||
|
||||
{ avr ? true, arm ? true, teensy ? true
|
||||
, pkgsCross, mkShell, lib, poetry2nix, stdenv, fetchurl, fetchFromGitHub
|
||||
|
||||
, clang-tools , dfu-programmer , dfu-util, diffutils, git, which
|
||||
|
||||
, avrBinutils' ? pkgsCross.avr.buildPackages.binutils
|
||||
, avrGcc' ? pkgsCross.avr.buildPackages.gcc8
|
||||
, avrlibc' ? pkgsCross.avr.libcCross
|
||||
, avrdude
|
||||
|
||||
, gcc-arm-embedded
|
||||
|
||||
, teensy-loader-cli
|
||||
|
||||
, libusb-compat-0_1
|
||||
}:
|
||||
let
|
||||
avr_incflags = [
|
||||
"-isystem ${avrlibc'}/avr/include"
|
||||
"-B${avrlibc'}/avr/lib/avr5"
|
||||
"-L${avrlibc'}/avr/lib/avr5"
|
||||
"-B${avrlibc'}/avr/lib/avr35"
|
||||
"-L${avrlibc'}/avr/lib/avr35"
|
||||
"-B${avrlibc'}/avr/lib/avr51"
|
||||
"-L${avrlibc'}/avr/lib/avr51"
|
||||
];
|
||||
|
||||
pythonEnv = poetry2nix.mkPoetryEnv {
|
||||
projectDir = "${qmk}/util/nix";
|
||||
overrides = poetry2nix.overrides.withDefaults (self: super: {
|
||||
qmk = super.qmk.overridePythonAttrs(old: {
|
||||
# Allow QMK CLI to run "bin/qmk" as a subprocess (the wrapper changes
|
||||
# $PATH and breaks these invocations).
|
||||
dontWrapPythonPrograms = true;
|
||||
});
|
||||
});
|
||||
};
|
||||
in
|
||||
rec {
|
||||
bootloadhid = stdenv.mkDerivation rec {
|
||||
pname = "bootloadhid";
|
||||
version = "2012-12-08";
|
||||
|
||||
src = fetchurl {
|
||||
url = "https://www.obdev.at/downloads/vusb/bootloadHID.2012-12-08.tar.gz";
|
||||
sha256 = "sha256-FU5+OGKaOi7sLfZm7foe4vLppXAY8X2fD48GTMINh1Q=";
|
||||
};
|
||||
|
||||
sourceRoot = "bootloadHID.${version}/commandline";
|
||||
|
||||
nativeBuildInputs = [ libusb-compat-0_1.dev ];
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out/bin
|
||||
cp bootloadHID $out/bin
|
||||
'';
|
||||
};
|
||||
|
||||
shell =
|
||||
mkShell {
|
||||
name = "qmk-devshell";
|
||||
|
||||
buildInputs =
|
||||
[ clang-tools dfu-programmer dfu-util diffutils git pythonEnv bootloadhid ]
|
||||
++ lib.optional avr [
|
||||
avrBinutils'
|
||||
avrGcc'
|
||||
avrlibc'
|
||||
avrdude
|
||||
]
|
||||
++ lib.optional arm [ gcc-arm-embedded ]
|
||||
++ lib.optional teensy [ teensy-loader-cli ];
|
||||
|
||||
AVR_CFLAGS = lib.optional avr avr_incflags;
|
||||
AVR_ASFLAGS = lib.optional avr avr_incflags;
|
||||
shellHook = ''
|
||||
# Prevent the avr-gcc wrapper from picking up host GCC flags
|
||||
# like -iframework, which is problematic on Darwin
|
||||
unset NIX_CFLAGS_COMPILE_FOR_TARGET
|
||||
'';
|
||||
};
|
||||
|
||||
qmk-firmware =
|
||||
stdenv.mkDerivation {
|
||||
name = "qmk-firmware";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "qmk";
|
||||
repo = "qmk_firmware";
|
||||
fetchSubmodules = true;
|
||||
leaveDotGit = true;
|
||||
sha256 = "sha256-Db+6slZR/5Rche9nrUAPKxIfYpmvoQmjMif8TI1OUqY=";
|
||||
rev = "0.14.29";
|
||||
};
|
||||
|
||||
configurePhase = ''
|
||||
mkdir -p keyboards/wheatfield/split75/keymaps/custom
|
||||
cp ${./keymap.c} keyboards/wheatfield/split75/keymaps/custom/keymap.c
|
||||
cp ${./rules.mk} keyboards/wheatfield/split75/rules.mk
|
||||
'';
|
||||
|
||||
buildPhase = ''
|
||||
ls keyboards/wheatfield/split75/keymaps/custom
|
||||
make wheatfield/split75:custom
|
||||
'';
|
||||
|
||||
nativeBuildInputs =
|
||||
[ clang-tools dfu-programmer dfu-util diffutils git pythonEnv bootloadhid which ]
|
||||
++ lib.optional avr [
|
||||
avrBinutils'
|
||||
avrGcc'
|
||||
avrlibc'
|
||||
avrdude
|
||||
]
|
||||
++ lib.optional arm [ gcc-arm-embedded ]
|
||||
++ lib.optional teensy [ teensy-loader-cli ];
|
||||
AVR_CFLAGS = lib.optional avr avr_incflags;
|
||||
AVR_ASFLAGS = lib.optional avr avr_incflags;
|
||||
shellHook = ''
|
||||
# Prevent the avr-gcc wrapper from picking up host GCC flags
|
||||
# like -iframework, which is problematic on Darwin
|
||||
unset NIX_CFLAGS_COMPILE_FOR_TARGET
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
ls
|
||||
cp wheatfield_split75_custom.hex $out
|
||||
'';
|
||||
};
|
||||
}
|
|
@ -203,6 +203,43 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"poetry2nix": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": [
|
||||
"nixpkgs-unstable"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1635880413,
|
||||
"narHash": "sha256-PczqVLL8tUSIR+sPYTmzXewVlWjGVpi0lxpdKm1vwkA=",
|
||||
"owner": "nix-community",
|
||||
"repo": "poetry2nix",
|
||||
"rev": "10d6b20bf1ed0f815d93138d905bb77705e71ca7",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"repo": "poetry2nix",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"qmk": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1635957067,
|
||||
"narHash": "sha256-hQq20ov9ZJA5cTFPEcGAba6n7glTKHqms/oOZrufLi8=",
|
||||
"ref": "master",
|
||||
"rev": "712c01e98fb8583b3509cd9e03434b74c174f950",
|
||||
"revCount": 17983,
|
||||
"type": "git",
|
||||
"url": "https://github.com/qmk/qmk_firmware?ref=0.14.29"
|
||||
},
|
||||
"original": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/qmk/qmk_firmware?ref=0.14.29"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"dwarffs": "dwarffs",
|
||||
|
@ -215,6 +252,8 @@
|
|||
"nixpkgs": "nixpkgs",
|
||||
"nixpkgs-master": "nixpkgs-master",
|
||||
"nixpkgs-unstable": "nixpkgs-unstable",
|
||||
"poetry2nix": "poetry2nix",
|
||||
"qmk": "qmk",
|
||||
"secret": "secret",
|
||||
"vtermModule": "vtermModule",
|
||||
"yusdacra-dotfiles": "yusdacra-dotfiles"
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
nixpkgs.url = "github:NixOS/nixpkgs?ref=nixos-21.05";
|
||||
nixpkgs-unstable.url = "github:NixOS/nixpkgs?ref=nixos-unstable";
|
||||
nixpkgs-master.url = "github:NixOS/nixpkgs?ref=master";
|
||||
|
||||
|
||||
home-manager = {
|
||||
url = "github:nix-community/home-manager?ref=release-21.05";
|
||||
inputs.nixpkgs.follows = "nixpkgs-unstable";
|
||||
|
@ -18,12 +18,25 @@
|
|||
url = "github:nix-community/fenix";
|
||||
inputs.nixpkgs.follows = "nixpkgs-unstable";
|
||||
};
|
||||
|
||||
|
||||
yusdacra-dotfiles = {
|
||||
url = "github:yusdacra/nixos-config";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
# ====================== QMK ======================
|
||||
poetry2nix = {
|
||||
url = "github:nix-communit/poetry2nix";
|
||||
inputs.nixpkgs.follows = "nixpkgs-unstable";
|
||||
};
|
||||
|
||||
qmk = {
|
||||
url = "https://github.com/qmk/qmk_firmware?ref=0.14.29";
|
||||
type = "git";
|
||||
flake = false;
|
||||
};
|
||||
# ====================== --- ======================
|
||||
|
||||
dwarffs = {
|
||||
url = "github:edolstra/dwarffs";
|
||||
inputs.nixpkgs.follows = "nixpkgs-unstable";
|
||||
|
@ -71,6 +84,14 @@
|
|||
supportedSystems = [ "x86_64-linux" ]; # add "i686-linux" "aarch64-linux" back after hls is fixed
|
||||
forAllSystems' = systems: f: nixpkgs.lib.genAttrs systems (system: f system);
|
||||
forAllSystems = forAllSystems' supportedSystems;
|
||||
pkgsForSystem =
|
||||
system:
|
||||
import nixpkgs
|
||||
{ system = "x86_64-linux";
|
||||
overlays =
|
||||
[ inputs.poetry2nix.overlay
|
||||
];
|
||||
};
|
||||
in {
|
||||
nixosConfigurations.omen = nixosSystem (import ./systems/omen.nix inputs);
|
||||
omen = self.nixosConfigurations.omen.config.system.build.toplevel;
|
||||
|
@ -101,13 +122,12 @@
|
|||
|
||||
allSystems =
|
||||
let
|
||||
pkgs = system: import nixpkgs { system = "x86_64-linux"; };
|
||||
linkFarm = system: attrs:
|
||||
let
|
||||
pkgs' = pkgs system;
|
||||
pkgs = pkgsForSystem system;
|
||||
in
|
||||
pkgs'.linkFarm "allSystems-${system}"
|
||||
(pkgs'.lib.mapAttrsToList (n: v: { name = n; path = v; }) attrs);
|
||||
pkgs.linkFarm "allSystems-${system}"
|
||||
(pkgs.lib.mapAttrsToList (n: v: { name = n; path = v; }) attrs);
|
||||
nixos = name: self.nixosConfigurations.${name}.config.system.build.toplevel;
|
||||
hm = name: self.homeConfigurations.${name}.activationPackage;
|
||||
in
|
||||
|
@ -135,7 +155,7 @@
|
|||
emacsclient-remote = import ./overlays/emacsclient-remote;
|
||||
gpg-key = import ./overlays/gpg-key inputs.nixng.lib;
|
||||
screenshot = import ./overlays/screenshot inputs.nixng.lib;
|
||||
easy-hls-nix = import ./overlays/easy-hls-nix inputs.easy-hls-nix;
|
||||
easy-hls-nix = import ./overlays/easy-hls-nix inputs.easy-hls-nix;
|
||||
mainsail = import ./overlays/mainsail inputs.nixng.lib;
|
||||
discord-canary = import "${inputs.yusdacra-dotfiles}/overlays/discord-canary-system.nix";
|
||||
winetricks = import ./overlays/winetricks;
|
||||
|
@ -150,6 +170,8 @@
|
|||
packages =
|
||||
forAllSystems (system:
|
||||
let
|
||||
pkgs = pkgsForSystem system;
|
||||
|
||||
mkPkg'' =
|
||||
pkgs: name: package:
|
||||
(import pkgs { inherit system;
|
||||
|
@ -170,6 +192,18 @@
|
|||
shh = mkPkg "shh";
|
||||
mainsail = mkPkg "mainsail";
|
||||
winetricks = mkPkg "winetricks";
|
||||
|
||||
qmk-firmware = (pkgs.callPackage
|
||||
(import ./extra/qmk/sp84.nix { inherit (inputs) qmk; }) {}).qmk-firmware;
|
||||
});
|
||||
|
||||
devShells = forAllSystems (system:
|
||||
let pkgs = pkgsForSystem system;
|
||||
in
|
||||
{ qmk =
|
||||
(pkgs.callPackage
|
||||
(import ./extra/qmk/sp84.nix { inherit (inputs) qmk; }) {}).shell;
|
||||
}
|
||||
);
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue