DEVELOPMENT ENVIRONMENT

~liljamo/nix-zmk

0f212b376c8156146b3a1e81de6bfcd08e6f5497 — Jonni Liljamo 17 days ago
feat: init
4 files changed, 129 insertions(+), 0 deletions(-)

A .gitignore
A config/west.yml
A flake.lock
A flake.nix
A  => .gitignore +5 -0
@@ 1,5 @@
/.west
/modules
/zephyr
/zmk
/build

A  => config/west.yml +34 -0
@@ 1,34 @@
manifest:
  remotes:
    - name: zmkfirmware
      url-base: https://github.com/zmkfirmware
  projects:
    - name: zmk
      remote: zmkfirmware
      revision: 5138c6fb14783b756c5a3e61581625c700f3555b  # main
      import: app/west.yml
    - name: zephyr
      remote: zmkfirmware
      revision: dacab4875df72109b96cc8977547a0dc04875bcd  # v3.5.0+zmk-fixes
      import:
        name-blocklist:
          - ci-tools
          - hal_altera
          - hal_cypress
          - hal_infineon
          - hal_microchip
          - hal_nxp
          - hal_openisa
          - hal_silabs
          - hal_xtensa
          - hal_st
          - hal_ti
          - loramac-node
          - mcuboot
          - mcumgr
          - net-tools
          - openthread
          - edtt
          - trusted-firmware-m
  self:
    path: config

A  => flake.lock +48 -0
@@ 1,48 @@
{
  "nodes": {
    "nixpkgs": {
      "locked": {
        "lastModified": 1763375004,
        "narHash": "sha256-e81Xfa7xhRZfqGB4s3xEvrg4p1v+fToM6CIQlXUyaX0=",
        "owner": "NixOS",
        "repo": "nixpkgs",
        "rev": "8b6600824693a9c706ef09bd86711ca393703466",
        "type": "github"
      },
      "original": {
        "owner": "NixOS",
        "ref": "nixpkgs-unstable",
        "repo": "nixpkgs",
        "type": "github"
      }
    },
    "root": {
      "inputs": {
        "nixpkgs": "nixpkgs",
        "zmk-nix": "zmk-nix"
      }
    },
    "zmk-nix": {
      "inputs": {
        "nixpkgs": [
          "nixpkgs"
        ]
      },
      "locked": {
        "lastModified": 1763253650,
        "narHash": "sha256-MyMqvUD8Pq38fasuPJXC/PzUK5sR052IIGK5zyN8oCI=",
        "owner": "lilyinstarlight",
        "repo": "zmk-nix",
        "rev": "e82382144a5d3051777e38aa78fe43ec91815954",
        "type": "github"
      },
      "original": {
        "owner": "lilyinstarlight",
        "repo": "zmk-nix",
        "type": "github"
      }
    }
  },
  "root": "root",
  "version": 7
}

A  => flake.nix +42 -0
@@ 1,42 @@
{
  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";

    zmk-nix = {
      url = "github:lilyinstarlight/zmk-nix";
      inputs.nixpkgs.follows = "nixpkgs";
    };
  };

  outputs = { self, nixpkgs, zmk-nix }: let
    forAllSystems = nixpkgs.lib.genAttrs (nixpkgs.lib.attrNames zmk-nix.packages);
  in {
    packages = forAllSystems (system: rec {
      default = firmware;

      firmware = zmk-nix.legacyPackages.${system}.buildSplitKeyboard {
        name = "firmware";

        src = nixpkgs.lib.sourceFilesBySuffices self [ ".board" ".cmake" ".conf" ".defconfig" ".dts" ".dtsi" ".json" ".keymap" ".overlay" ".shield" ".yml" "_defconfig" ];

        board = "nice_nano_v2";
        shield = "lily58_%PART%";

        zephyrDepsHash = "sha256-1dTCIVovLZ+13o26S/CzT8gtdf5Bzw9e+1e8plDorOA=";

        meta = {
          description = "ZMK firmware";
          license = nixpkgs.lib.licenses.mit;
          platforms = nixpkgs.lib.platforms.all;
        };
      };

      flash = zmk-nix.packages.${system}.flash.override { inherit firmware; };
      update = zmk-nix.packages.${system}.update;
    });

    devShells = forAllSystems (system: {
      default = zmk-nix.devShells.${system}.default;
    });
  };
}