From 24d92030dda5bbe03542e0bae51c8810f3a48548 Mon Sep 17 00:00:00 2001 From: seth Date: Tue, 2 Jul 2024 03:02:26 -0400 Subject: initial commit --- flake.nix | 82 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 flake.nix (limited to 'flake.nix') diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..aced115 --- /dev/null +++ b/flake.nix @@ -0,0 +1,82 @@ +{ + description = "Toolchain for Actiontec's T3200 Series DSL Gateway"; + + inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + + outputs = + { self, nixpkgs, ... }: + let + inherit (nixpkgs) lib; + + # Since we're building 32-bit linux packages, we can only (usually) run this on + # systems that are x86{,-64} and Linux themselves. This should evaluate to + # [ "x86_64-linux" "i686-linux" ] + systems = lib.intersectLists lib.platforms.linux lib.platforms.x86; + + forAllSystems = lib.genAttrs systems; + nixpkgsFor = forAllSystems ( + system: + let + native = nixpkgs.legacyPackages.${system}; + in + { + inherit native; + cross = { + i686 = native.pkgsi686Linux; + }; + } + ); + in + { + formatter = forAllSystems (system: nixpkgsFor.${system}.native.nixfmt-rfc-style); + + packages = forAllSystems ( + system: + let + nixpkgsFor' = nixpkgsFor.${system}; + pkgs = nixpkgsFor'.native; + pkgsi686 = nixpkgsFor'.cross.i686; + + # https://opensource.actiontec.com/t3200.html + # + # some of these releases contain different toolchains + # no idea if any of these are meaningful changes, but lets + # support multiple for fun + releases = [ + { + version = "31.164l.32"; + hash = "sha256-SRS9N1dpmvAksF6zWudUUv6DWL2TQVCte3x1PL8d02g="; + } + { + version = "31.164l.33"; + hash = "sha256-tN31mGv27vUoIncM6xadhyiMdal4pdtFgn5tu5oFtF4="; + } + ]; + + releaseInfo = map ( + { version, hash }: + { + inherit version; + src = pkgs.fetchzip { + url = "https://opensource.actiontec.com/sourcecode/t3200x/bt_bcm963xx_t3200_${version}_gpl_consumer_release.tar.gz"; + inherit hash; + stripRoot = false; + }; + } + ) releases; + + releasePackages = map ( + { src, version }: + { + name = "toolchain-" + version; + value = pkgsi686.callPackage ./crosstools-arm-gcc.nix { + sourceRelease = src; + releaseVersion = version; + }; + } + ) releaseInfo; + in + lib.listToAttrs releasePackages // { default = self.packages.${system}."toolchain-31.164l.33"; } + ); + }; +} -- cgit v1.2.3