Initial test

This commit is contained in:
Ehmry - 2022-05-27 10:12:26 -05:00
commit c689d2715c
2 changed files with 115 additions and 0 deletions

75
flake.lock Normal file
View File

@ -0,0 +1,75 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1653326962,
"narHash": "sha256-W8feCYqKTsMre4nAEpv5Kx1PVFC+hao/LwqtB2Wci/8=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "41cc1d5d9584103be4108c1815c350e07c807036",
"type": "github"
},
"original": {
"id": "nixpkgs",
"type": "indirect"
}
},
"nixpkgs_2": {
"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"
}
},
"openwrt-imagebuilder": {
"inputs": {
"nixpkgs": "nixpkgs_2",
"openwrt": "openwrt"
},
"locked": {
"lastModified": 1653663077,
"narHash": "sha256-tXTrdT6Lru6TmRer/7wWp5sXUbNLlV79cO5dPPhgBaU=",
"owner": "IowaCityMesh",
"repo": "nix-openwrt-imagebuilder",
"rev": "e59021b707a646b9cd05edb2e9b2d183bf2d55b4",
"type": "github"
},
"original": {
"owner": "IowaCityMesh",
"repo": "nix-openwrt-imagebuilder",
"type": "github"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs",
"openwrt-imagebuilder": "openwrt-imagebuilder"
}
}
},
"root": "root",
"version": 7
}

40
flake.nix Normal file
View File

@ -0,0 +1,40 @@
{
inputs.openwrt-imagebuilder.url =
"github:IowaCityMesh/nix-openwrt-imagebuilder";
outputs = { self, nixpkgs, openwrt-imagebuilder }:
let inherit (nixpkgs) lib;
in {
packages = lib.attrsets.mapAttrs (system: pkgs:
let
profiles = openwrt-imagebuilder.lib.profiles { inherit pkgs; };
customConfig = {
# add package to include in the image, ie. packages that you don't
# want to install manually later
packages = [ "batman-adv" ];
disabledServices = [ "dnsmasq" ];
# include files in the images.
# to set UCI configuration, create a uci-defauts scripts as per
# official OpenWRT ImageBuilder recommendation.
files = pkgs.runCommandNoCC "image-files" { } ''
mkdir -p $out/etc/uci-defaults
cat > $out/etc/uci-defaults/99-custom <<EOF
uci -q batch << EOI
set system.@system[0].hostname='meshic-testrouter'
commit
EOI
EOF
'';
};
in {
trendnet_tew-691gr = openwrt-imagebuilder.lib.build
(profiles.identifyProfile "trendnet_tew-691gr" // customConfig);
}) { inherit (nixpkgs.legacyPackages) x86_64-linux; };
};
}