From 23c2ef05568c81868cf7651f502f552d323c6479 Mon Sep 17 00:00:00 2001 From: Brian Romanko Date: Fri, 10 Dec 2021 09:21:39 -0800 Subject: [PATCH] Add nix flake support Now that nix 2.4 is out, flakes are no longer experimental. --- flake.lock | 43 +++++++++++++++++++++++++++++++++++++++++++ flake.nix | 11 +++++++++++ shell.nix | 6 +++--- 3 files changed, 57 insertions(+), 3 deletions(-) create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/flake.lock b/flake.lock new file mode 100644 index 00000000..95b64bf1 --- /dev/null +++ b/flake.lock @@ -0,0 +1,43 @@ +{ + "nodes": { + "flake-utils": { + "locked": { + "lastModified": 1638122382, + "narHash": "sha256-sQzZzAbvKEqN9s0bzWuYmRaA03v40gaJ4+iL1LXjaeI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "74f7e4319258e287b0f9cb95426c9853b282730b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1638910453, + "narHash": "sha256-fofA4tsAAdNgE+9Py0VsVbyX2ZQkgV+CVqQKGBA/dLE=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "f225322e3bea8638304adfcf415cd11de99f2208", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 00000000..1499b6c0 --- /dev/null +++ b/flake.nix @@ -0,0 +1,11 @@ +{ + description = "# Zephyrâ„¢ Mechanical Keyboard (ZMK) Firmware"; + + inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + inputs.flake-utils.url = "github:numtide/flake-utils"; + + outputs = { self, nixpkgs, flake-utils }: + flake-utils.lib.eachDefaultSystem (system: + let pkgs = nixpkgs.legacyPackages.${system}; + in { devShell = import ./shell.nix { inherit pkgs; }; }); +} diff --git a/shell.nix b/shell.nix index a4457345..145f7115 100644 --- a/shell.nix +++ b/shell.nix @@ -6,14 +6,14 @@ let inherit (lib) ; in mkShell { buildInputs = [ cmake - ninja - python3 ccache + ninja dtc dfu-util gcc-arm-embedded + python3 python38Packages.west - python38Packages.pyelftools + python38Packages.pip ]; shellHook = ''