From 28005ac97891794abc6ef8005e84084dd8bd1fa3 Mon Sep 17 00:00:00 2001 From: clerie Date: Thu, 28 Dec 2023 12:45:34 +0100 Subject: [PATCH] Init repo --- README.md | 21 +++++++++++++++++++++ flake.lock | 27 +++++++++++++++++++++++++++ flake.nix | 39 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 87 insertions(+) create mode 100644 README.md create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/README.md b/README.md new file mode 100644 index 0000000..4c9143c --- /dev/null +++ b/README.md @@ -0,0 +1,21 @@ +# openwrt-buildroot-nix + +This provides a Nix environment for [OpenWRT Buildroot](https://openwrt.org/docs/guide-developer/toolchain/use-buildsystem). + +## Usage + +``` +nix develop git+https://git.clerie.de/clerie/openwrt-buildroot-nix.git +``` + +## Troubleshooting + +### Dependencies cannot be found randomly + +OpenWRT buildroot seem to hardcode paths it found for dependencies. +If the nix environment gets changed these paths change too. +Clean the build environment to get it working again: + +``` +make dirclean +``` diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..f568b31 --- /dev/null +++ b/flake.lock @@ -0,0 +1,27 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1703499205, + "narHash": "sha256-lF9rK5mSUfIZJgZxC3ge40tp1gmyyOXZ+lRY3P8bfbg=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "e1fa12d4f6c6fe19ccb59cac54b5b3f25e160870", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..cabf7c7 --- /dev/null +++ b/flake.nix @@ -0,0 +1,39 @@ +{ + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + }; + outputs = { self, nixpkgs, ... }: { + + devShells."x86_64-linux".default = let + + pkgs = import nixpkgs { + system = "x86_64-linux"; + }; + + in pkgs.mkShell { + + nativeBuildInputs = with pkgs; [ + pkg-config + ]; + + buildInputs = with pkgs; [ + git + ncurses + unzip + python3 + cdrkit # mkisofs + ]; + + /* + OpenWRT toolchain code isn't as clean as it needs to be to + pass nixpkgs hardening, so we disable it + + Resolves: + -Werror=format-security + */ + hardeningDisable = [ "all" ]; + + }; + + }; +}