{"id":17786682,"url":"https://github.com/zopieux/nix-buildroot","last_synced_at":"2025-04-01T23:46:19.023Z","repository":{"id":259291221,"uuid":"861069273","full_name":"zopieux/nix-buildroot","owner":"zopieux","description":"Build out-of-tree Buildroot images using Nix flakes.","archived":false,"fork":false,"pushed_at":"2024-10-23T19:10:19.000Z","size":5,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-07T15:34:58.647Z","etag":null,"topics":["buildroot","buildroot-external","nix","nix-flake"],"latest_commit_sha":null,"homepage":"","language":"Nix","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zopieux.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-09-21T23:13:46.000Z","updated_at":"2024-09-22T15:57:23.000Z","dependencies_parsed_at":"2024-10-24T05:32:31.219Z","dependency_job_id":"face141f-0da3-4020-846f-4072e46ef6b2","html_url":"https://github.com/zopieux/nix-buildroot","commit_stats":null,"previous_names":["zopieux/nix-buildroot"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zopieux%2Fnix-buildroot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zopieux%2Fnix-buildroot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zopieux%2Fnix-buildroot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zopieux%2Fnix-buildroot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zopieux","download_url":"https://codeload.github.com/zopieux/nix-buildroot/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246730262,"owners_count":20824396,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["buildroot","buildroot-external","nix","nix-flake"],"created_at":"2024-10-27T10:04:23.503Z","updated_at":"2025-04-01T23:46:19.003Z","avatar_url":"https://github.com/zopieux.png","language":"Nix","funding_links":[],"categories":[],"sub_categories":[],"readme":"A Nix flake that makes it (relatively) easy to build an out-of-tree Buildroot image using Nix.\n\n### Example flake and usage\n\nAssuming the `./` (`src`) directory contains the `BR2_EXTERNAL` skeleton, with at least `Config.in`, `external.mk`, `external.desc`, `configs/my_cool_defconfig`. \n\n```nix\n{\n  inputs = {\n    nixpkgs.url = \"github:nixos/nixpkgs?ref=nixos-24.05\";\n    buildroot-nix.url = \"github:zopieux/nix-buildroot\";\n  };\n\n  outputs = { self, nixpkgs, buildroot-nix, ... }@inputs:\n    let\n      pkgs = import nixpkgs { system = \"x86_64-linux\"; };\n      myBuildRoot = buildroot-nix.lib.mkBuildroot {\n        name = \"cool\";\n        src = ./.;\n        inherit pkgs;  # pkgs = pkgs;\n        defconfig = \"my_cool_defconfig\";\n        # This won't exist yet, and that's okay.\n        lockfile = ./buildroot.lock;\n        # Any extra host build inputs needed by Buildroot.\n        nativeBuildInputs = with pkgs; [ libxcrypt ];\n      };\n    in {\n      packages.x86_64-linux.lockFile = myBuildRoot.lockFile;\n      packages.x86_64-linux.default = myBuildRoot.build;\n      devShells.x86_64-linux.default = myBuildRoot.devShell;\n    };\n}\n```\n\nThen you first need to lock the input source downloads for reproducibility, as Nix sandbox prevents arbitrary downloads:\n\n```shell\n$ nix build '.#lockFile'\n$ cp result buildroot.lock\n$ git add buildroot.lock\n```\n\nNow you're settled and can proceed with the full build:\n\n```shell\n$ nix build\n```\n\nYou can also drop into the dev shell, which aliases the `make` command so that it's ready to use:\n\n```shell\n$ nix develop\nbash$ make menuconfig\n```\n\n\n### External hashes\n\nExternal files referenced in `*_defconfig` etc. are not known to Buildroot and therefore the hash is unavailable. Typically:\n\n```\n# Random out-of-tree URL or local file.\nBR2_LINUX_KERNEL_CUSTOM_TARBALL_LOCATION=https://example.org/foo.tar.gz\n```\n\nFor those, you need to explicitely provide the sha256 hash (no other type supported) to the builder:\n\n```shell\n$ nix-prefetch-url https://example.org/foo.tar.gz\n4d3403d32df5f9a2a2053a4ff667bfab4d11a31932db5779560000429403d785\n```\n\n```nix\nmyBuildRoot = buildroot-nix.lib.mkBuildroot {\n  name = \"cool\";\n  # ...\n  # NEW:\n  extraHashes = {\n    \"foo.tar.gz\" = \"4d3403d32df5f9a2a2053a4ff667bfab4d11a31932db5779560000429403d785\";\n  };\n};\n```\n\n### Buildroot clone\n\nThis flake builds with Buildroot tag `2024.08` if not otherwise provided. You can use any clone you like, for example using a flake input:\n\n```nix\n{\n  inputs = {\n    nixpkgs.url = \"github:nixos/nixpkgs?ref=nixos-24.05\";\n    buildroot-nix.url = \"github:zopieux/nix-buildroot\";\n    # NEW:\n    buildroot = {\n      url = \"https://gitlab.com/buildroot.org/buildroot.git\";\n      type = \"git\";\n      rev = \"769d71ae84c7a3d43ee92a1d126b2937713cc811\"; # 2024.08\n      flake = false;\n    };\n  };\n\n  outputs = { self, nixpkgs, buildroot-nix, ... }@inputs:\n    # ...\n      myBuildRoot = buildroot-nix.lib.mkBuildroot {\n        name = \"cool\";\n        # ...\n        # NEW:\n        buildroot = inputs.buildroot;\n      }; \n}\n```\n\n## License\n\nMIT.\n\n## Acknowledgments\n\nThis is in great part adapted from https://github.com/velentr/buildroot.nix, which is also MIT licensed.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzopieux%2Fnix-buildroot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzopieux%2Fnix-buildroot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzopieux%2Fnix-buildroot/lists"}