generate-hashes, flakify
This commit is contained in:
parent
2baf162de0
commit
8d30c2ef14
10
builder.nix
10
builder.nix
|
@ -7,9 +7,15 @@
|
|||
, profile
|
||||
, variant ? "generic"
|
||||
# Checksum of the `sha256sums` file
|
||||
, sha256
|
||||
, sha256 ?
|
||||
(
|
||||
import ./hashes/${release}.nix
|
||||
).${target}.${variant}.sha256
|
||||
# Checksum of a feed's `Packages` file
|
||||
, feedsSha256
|
||||
, feedsSha256 ?
|
||||
(
|
||||
import ./hashes/${release}.nix
|
||||
).${target}.${variant}.feedsSha256
|
||||
# Extra OpenWRT packages (can be prefixed with "-")
|
||||
, packages ? []
|
||||
# Include extra files
|
||||
|
|
|
@ -1,11 +1,4 @@
|
|||
import ./builder.nix {
|
||||
target = "ath79";
|
||||
profile = "ubnt_unifiac-lite";
|
||||
sha256 = "01vyvxkphnlpvnw2az8ficzzjn3zjvwlvkp0hpicy8w94ih1fxdj";
|
||||
feedsSha256 = {
|
||||
base = "1sffhx4jyh6giqk3k6wija4ld6rynx2dbvda7v9fxpjc6f50zz8v";
|
||||
luci = "1ib8wya2adli6b5fcmbwd0sh77sr98ax86irxdabc7ilkr14v799";
|
||||
routing = "1ag2cw1m4six0ffzjw3fsqzksl3mb8izkraa245663nda76ck77a";
|
||||
packages = "119iqpahn581ql2avd03zpmgcjzzy5wizhivjaz48bqz85mbd570";
|
||||
};
|
||||
}
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
{
|
||||
"nodes": {
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1651024496,
|
||||
"narHash": "sha256-uKSrrw/neSkxX6TXPSaMyfu7iKzFrK7F6HOt6vQefGY=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "d9e593ed5889f3906dc72811c45bf684be8865cf",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"id": "nixpkgs",
|
||||
"type": "indirect"
|
||||
}
|
||||
},
|
||||
"openwrt": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1651013664,
|
||||
"narHash": "sha256-efpsYc8KfjIbcD0vdE+VC9tWS471NFAxUB884kJhUEE=",
|
||||
"ref": "master",
|
||||
"rev": "f757a8a09885e3c8bb76371e037b8c0731111980",
|
||||
"revCount": 53988,
|
||||
"type": "git",
|
||||
"url": "https://git.openwrt.org/openwrt/openwrt.git?tag=v21.02.3"
|
||||
},
|
||||
"original": {
|
||||
"type": "git",
|
||||
"url": "https://git.openwrt.org/openwrt/openwrt.git?tag=v21.02.3"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"nixpkgs": "nixpkgs",
|
||||
"openwrt": "openwrt"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
{
|
||||
description = "A very basic flake";
|
||||
|
||||
inputs.openwrt = {
|
||||
url = "git+https://git.openwrt.org/openwrt/openwrt.git?tag=v21.02.3";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, openwrt }: {
|
||||
|
||||
lib.build = args:
|
||||
import ./builder.nix (args // {
|
||||
pkgs = if args ? pkgs then args.pkgs else nixpkgs.legacyPackages.x86_64-linux;
|
||||
openwrt = if args ? openwrt then args.openwrt else openwrt;
|
||||
});
|
||||
|
||||
# `nix run .#generate-hashes`
|
||||
packages.x86_64-linux.generate-hashes = import ./generate-hashes.nix {
|
||||
pkgs = nixpkgs.legacyPackages.x86_64-linux;
|
||||
inherit openwrt;
|
||||
};
|
||||
|
||||
};
|
||||
}
|
|
@ -0,0 +1,78 @@
|
|||
{ pkgs ? import <nixpkgs> {}
|
||||
, openwrt
|
||||
}:
|
||||
|
||||
with pkgs;
|
||||
|
||||
let
|
||||
release = "21.02.3";
|
||||
|
||||
linuxTargets = builtins.attrNames (
|
||||
lib.filterAttrs (name: type: type == "directory" && name != "generic") (
|
||||
builtins.readDir (openwrt + "/target/linux")
|
||||
)
|
||||
);
|
||||
|
||||
linuxTargetDefs = builtins.foldl' (linuxTargetDefs: target:
|
||||
linuxTargetDefs // {
|
||||
"${target}" =
|
||||
builtins.foldl' (targetDefs: line:
|
||||
let
|
||||
m = builtins.match "([[:upper:]]+)[[:space:]]*:=[[:space:]]*(.+)" line;
|
||||
in
|
||||
if builtins.isList m && builtins.length m == 2
|
||||
then targetDefs // {
|
||||
${builtins.elemAt m 0} = builtins.elemAt m 1;
|
||||
}
|
||||
else targetDefs
|
||||
) {} (
|
||||
lib.splitString "\n" (
|
||||
builtins.replaceStrings [ "\\\n" ] [ "" ] (
|
||||
builtins.readFile (openwrt + "/target/linux/${target}/Makefile")
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
) {} linuxTargets;
|
||||
|
||||
# Expand this for more packages and also more to download
|
||||
defaultFeeds = [ "base" ];
|
||||
in
|
||||
|
||||
writeScriptBin "generate-hashes" ''
|
||||
#! ${runtimeShell}
|
||||
|
||||
PATH=${lib.makeBinPath [ jq curl nix ]}:$PATH
|
||||
|
||||
hash() {
|
||||
TARGET=$1
|
||||
SUBTARGET=$2
|
||||
BASEURL=https://downloads.openwrt.org/releases/${release}/targets/$TARGET/generic
|
||||
SUM=$(nix-prefetch-url --type sha256 $BASEURL/sha256sums 2>/dev/null)
|
||||
if [ -n "$SUM" ]; then
|
||||
echo " \"$TARGET\".\"$SUBTARGET\" = {"
|
||||
echo " sha256 = \"$SUM\";"
|
||||
ARCH=$(curl -s $BASEURL/profiles.json | jq -r .arch_packages)
|
||||
if [ -n "$ARCH" ]; then
|
||||
for FEED in ${lib.escapeShellArgs defaultFeeds}; do
|
||||
PACKAGES=$(nix-prefetch-url --type sha256 https://downloads.openwrt.org/releases/${release}/packages/$ARCH/$FEED/Packages)
|
||||
echo " feedsSha256.$FEED = \"$PACKAGES\";"
|
||||
done
|
||||
fi
|
||||
echo " };"
|
||||
fi
|
||||
}
|
||||
|
||||
mkdir -p hashes
|
||||
|
||||
(
|
||||
echo "{"
|
||||
${lib.concatMapStrings (target:
|
||||
lib.concatMapStrings (subtarget: ''
|
||||
hash ${target} ${subtarget}
|
||||
'')
|
||||
(lib.splitString " " (linuxTargetDefs.${target}.SUBTARGETS or "generic"))
|
||||
) linuxTargets}
|
||||
echo "}"
|
||||
) > hashes/${release}.nix
|
||||
''
|
|
@ -0,0 +1,136 @@
|
|||
{
|
||||
"archs38"."generic" = {
|
||||
sha256 = "0lwgvp5qh6akr65z0msfqxzkhp9ja3s8ip9gxpiqpg8689jcabac";
|
||||
feedsSha256.base = "17i3l5kzy8bw6diblb08jq212mmbag20diiih624dvgg608mfk04";
|
||||
};
|
||||
"ath25"."generic" = {
|
||||
sha256 = "1yv5iyz14i0i7n2gr376bxr6qs5v2qy7a3xshk0f5l1asd9kh64a";
|
||||
feedsSha256.base = "14x7nxvvjfqzd7ifvpwfmp5c297vgh3nadl289r5v7p4micrc0i2";
|
||||
};
|
||||
"ath79"."generic" = {
|
||||
sha256 = "01vyvxkphnlpvnw2az8ficzzjn3zjvwlvkp0hpicy8w94ih1fxdj";
|
||||
feedsSha256.base = "1sffhx4jyh6giqk3k6wija4ld6rynx2dbvda7v9fxpjc6f50zz8v";
|
||||
};
|
||||
"ath79"."mikrotik" = {
|
||||
sha256 = "01vyvxkphnlpvnw2az8ficzzjn3zjvwlvkp0hpicy8w94ih1fxdj";
|
||||
feedsSha256.base = "1sffhx4jyh6giqk3k6wija4ld6rynx2dbvda7v9fxpjc6f50zz8v";
|
||||
};
|
||||
"ath79"."nand" = {
|
||||
sha256 = "01vyvxkphnlpvnw2az8ficzzjn3zjvwlvkp0hpicy8w94ih1fxdj";
|
||||
feedsSha256.base = "1sffhx4jyh6giqk3k6wija4ld6rynx2dbvda7v9fxpjc6f50zz8v";
|
||||
};
|
||||
"ath79"."tiny" = {
|
||||
sha256 = "01vyvxkphnlpvnw2az8ficzzjn3zjvwlvkp0hpicy8w94ih1fxdj";
|
||||
feedsSha256.base = "1sffhx4jyh6giqk3k6wija4ld6rynx2dbvda7v9fxpjc6f50zz8v";
|
||||
};
|
||||
"bcm47xx"."generic" = {
|
||||
sha256 = "19g1dgfqxmkdlisnsc2kfk2624gzjc0fmwp3zmjz4qmby6y1gk35";
|
||||
feedsSha256.base = "1jf60ign5282jp7azpxrgc5k43d7wmss6aqfjb82jvl3hgydkh2q";
|
||||
};
|
||||
"bcm47xx"."mips74k" = {
|
||||
sha256 = "19g1dgfqxmkdlisnsc2kfk2624gzjc0fmwp3zmjz4qmby6y1gk35";
|
||||
feedsSha256.base = "1jf60ign5282jp7azpxrgc5k43d7wmss6aqfjb82jvl3hgydkh2q";
|
||||
};
|
||||
"bcm47xx"."legacy" = {
|
||||
sha256 = "19g1dgfqxmkdlisnsc2kfk2624gzjc0fmwp3zmjz4qmby6y1gk35";
|
||||
feedsSha256.base = "1jf60ign5282jp7azpxrgc5k43d7wmss6aqfjb82jvl3hgydkh2q";
|
||||
};
|
||||
"bcm4908"."generic" = {
|
||||
sha256 = "0z6js0vhd7qpgjck4qswqbd9kfayqicfd6n87hjl9hh5mjvcj6xq";
|
||||
feedsSha256.base = "0iccl5c6xdk5pmbcx8z9k80yjx901k8r8hy5l4b863fhnhxvqzks";
|
||||
};
|
||||
"bcm53xx"."generic" = {
|
||||
sha256 = "1sgbkfb37qgx7kblkzwhn42jxwm71v3q1jnmayr00lmsf37amrmp";
|
||||
feedsSha256.base = "1jnir6bp27m7139lhbjln3ps2600lc9n1c7b10c0kqjv9h1svfs6";
|
||||
};
|
||||
"bcm63xx"."generic" = {
|
||||
sha256 = "0rwzrxxaw7s4qx6mqq2b3jnywzqvc4hpwbm2fnbsj4mjd9v66vnz";
|
||||
feedsSha256.base = "14x7nxvvjfqzd7ifvpwfmp5c297vgh3nadl289r5v7p4micrc0i2";
|
||||
};
|
||||
"bcm63xx"."smp" = {
|
||||
sha256 = "0rwzrxxaw7s4qx6mqq2b3jnywzqvc4hpwbm2fnbsj4mjd9v66vnz";
|
||||
feedsSha256.base = "14x7nxvvjfqzd7ifvpwfmp5c297vgh3nadl289r5v7p4micrc0i2";
|
||||
};
|
||||
"gemini"."generic" = {
|
||||
sha256 = "1z82mr6ky7dd4178w1356nvv2b5zlypdkb8q6ln7ckp9a0ghbnxq";
|
||||
feedsSha256.base = "0fl64i5j4rspym5k3zavm6v57c4y3qamq4yqwm53paizdjayrvi5";
|
||||
};
|
||||
"ipq40xx"."generic" = {
|
||||
sha256 = "15dgkx1n4yrkfi132ma2flf6aj3va47h6knz9ajm4a84fkricszz";
|
||||
feedsSha256.base = "0y3w9j94ccab37k77y3g3f6i6qz659r206qckvfyfa468fn6az8m";
|
||||
};
|
||||
"ipq40xx"."chromium" = {
|
||||
sha256 = "15dgkx1n4yrkfi132ma2flf6aj3va47h6knz9ajm4a84fkricszz";
|
||||
feedsSha256.base = "0y3w9j94ccab37k77y3g3f6i6qz659r206qckvfyfa468fn6az8m";
|
||||
};
|
||||
"ipq40xx"."mikrotik" = {
|
||||
sha256 = "15dgkx1n4yrkfi132ma2flf6aj3va47h6knz9ajm4a84fkricszz";
|
||||
feedsSha256.base = "0y3w9j94ccab37k77y3g3f6i6qz659r206qckvfyfa468fn6az8m";
|
||||
};
|
||||
"ipq806x"."generic" = {
|
||||
sha256 = "16zr0ji1ph3r45vaw0nsrvm8qi9d6dp362byi9z8yd6iwjwjbxjk";
|
||||
feedsSha256.base = "12z16hr6421cz5vci095dbhcp49lxzbxi2n8fdrq0hcarh04qdik";
|
||||
};
|
||||
"kirkwood"."generic" = {
|
||||
sha256 = "09zpbhz4nhicsm54x5nimknsfpyjc7hjqiklk730zrlmpr07hg8g";
|
||||
feedsSha256.base = "08d2lbsfxa8gj0nalr40y2a6np7azr3dbgmjqvc1nis9np70gcmx";
|
||||
};
|
||||
"mxs"."generic" = {
|
||||
sha256 = "09sb20z8rcs9nisnqd857yw5ddrn0xg26gqinnlg97x9cp8kfzv5";
|
||||
};
|
||||
"octeon"."generic" = {
|
||||
sha256 = "1mgppg235wp46yyykcgcqzppsa3paxpw955a45q7gz0vk1vbsxj0";
|
||||
feedsSha256.base = "08yh7bx2w8bvv8ypvin3s90003p7lsq5nqhdn40nki6nxn3g60q4";
|
||||
};
|
||||
"octeontx"."generic" = {
|
||||
sha256 = "04mfpgnq5nnpiqr44a7n6g5k9b3ggcdv55jb14fqs7ac81i9sylz";
|
||||
};
|
||||
"omap"."generic" = {
|
||||
sha256 = "089ykkvk6m9sbdm4y2ridb8pglbd7v37mcw9996yb9l5krv3sm91";
|
||||
feedsSha256.base = "1gl5ki7kn9mfp68bpl03b5w0d7b6y8f0d2rf3knv030zxb9n2fkr";
|
||||
};
|
||||
"pistachio"."generic" = {
|
||||
sha256 = "1xdfxyfff4px410gb7p05q9ypq0snbc7kw817qipfxs3cv30aaxg";
|
||||
feedsSha256.base = "09h9a2fiq3l2fvsd7dfddbilxdbssajq4vaslwr9f0ix43why6jp";
|
||||
};
|
||||
"realtek"."rtl838x" = {
|
||||
sha256 = "0frb6ppcn74s2ckaxrprk11prrg65f384bfcdad9bbf3qjfcn4al";
|
||||
feedsSha256.base = "0mklfvn8v9b8s0mzd5x1awm47bnx46888fpjc05lq672cb3mhx2m";
|
||||
};
|
||||
"realtek"."rtl839x" = {
|
||||
sha256 = "0frb6ppcn74s2ckaxrprk11prrg65f384bfcdad9bbf3qjfcn4al";
|
||||
feedsSha256.base = "0mklfvn8v9b8s0mzd5x1awm47bnx46888fpjc05lq672cb3mhx2m";
|
||||
};
|
||||
"realtek"."rtl930x" = {
|
||||
sha256 = "0frb6ppcn74s2ckaxrprk11prrg65f384bfcdad9bbf3qjfcn4al";
|
||||
feedsSha256.base = "0mklfvn8v9b8s0mzd5x1awm47bnx46888fpjc05lq672cb3mhx2m";
|
||||
};
|
||||
"realtek"."rtl931x" = {
|
||||
sha256 = "0frb6ppcn74s2ckaxrprk11prrg65f384bfcdad9bbf3qjfcn4al";
|
||||
feedsSha256.base = "0mklfvn8v9b8s0mzd5x1awm47bnx46888fpjc05lq672cb3mhx2m";
|
||||
};
|
||||
"tegra"."generic" = {
|
||||
sha256 = "120di06j0x7pby3b5chq78glfn9yy2ndj6n4nmfjikmsi2iv243g";
|
||||
feedsSha256.base = "12a1as1bj4j4hy6bf3xz4d4yqc6kfqvp2rawgxaxs001p2b71khi";
|
||||
};
|
||||
"x86"."generic" = {
|
||||
sha256 = "1lixvas64qddf4ix2afzwpig9qsk0b0l76x2nl4490c4q3hzhv9w";
|
||||
feedsSha256.base = "1yaimqfirh38198ifgyc8dp7yi4hr92jf2nmi2rqfhddkd9a5zf0";
|
||||
};
|
||||
"x86"."legacy" = {
|
||||
sha256 = "1lixvas64qddf4ix2afzwpig9qsk0b0l76x2nl4490c4q3hzhv9w";
|
||||
feedsSha256.base = "1yaimqfirh38198ifgyc8dp7yi4hr92jf2nmi2rqfhddkd9a5zf0";
|
||||
};
|
||||
"x86"."geode" = {
|
||||
sha256 = "1lixvas64qddf4ix2afzwpig9qsk0b0l76x2nl4490c4q3hzhv9w";
|
||||
feedsSha256.base = "1yaimqfirh38198ifgyc8dp7yi4hr92jf2nmi2rqfhddkd9a5zf0";
|
||||
};
|
||||
"x86"."64" = {
|
||||
sha256 = "1lixvas64qddf4ix2afzwpig9qsk0b0l76x2nl4490c4q3hzhv9w";
|
||||
feedsSha256.base = "1yaimqfirh38198ifgyc8dp7yi4hr92jf2nmi2rqfhddkd9a5zf0";
|
||||
};
|
||||
"zynq"."generic" = {
|
||||
sha256 = "0k1g0v0k76m8042i44s1ifvzi67h92a8czmscvcpb6aj6r2w2iiy";
|
||||
feedsSha256.base = "0mbr2wbmmc70h1gyb1nbkwpcc706psawh5zspm18sfifa5q5f6rq";
|
||||
};
|
||||
}
|
Loading…
Reference in New Issue