diff --git a/flake.lock b/flake.lock index c2391ff..9e1bc82 100644 --- a/flake.lock +++ b/flake.lock @@ -581,6 +581,30 @@ "type": "github" } }, + "openwrt-imagebuilder": { + "inputs": { + "flake-parts": [ + "flake-parts" + ], + "nixpkgs": [ + "nixpkgs" + ], + "systems": "systems_4" + }, + "locked": { + "lastModified": 1777544882, + "narHash": "sha256-QqrZLvCSg4w2jmLGXs/4KJVXZeogxIeuX0Hw4o5qWwU=", + "owner": "astro", + "repo": "nix-openwrt-imagebuilder", + "rev": "149d0e41bc9ed257290c87a8fdb18c4071e37e07", + "type": "github" + }, + "original": { + "owner": "astro", + "repo": "nix-openwrt-imagebuilder", + "type": "github" + } + }, "paisano": { "inputs": { "call-flake": "call-flake", @@ -661,6 +685,7 @@ "import-tree": "import-tree", "liminix": "liminix", "nixpkgs": "nixpkgs_2", + "openwrt-imagebuilder": "openwrt-imagebuilder", "plasma-manager": "plasma-manager", "treefmt-nix": "treefmt-nix" } @@ -780,16 +805,16 @@ }, "systems_2": { "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "lastModified": 1680978846, + "narHash": "sha256-Gtqg8b/v49BFDpDetjclCYXm8mAnTrUzR0JnE2nv5aw=", "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "repo": "x86_64-linux", + "rev": "2ecfcac5e15790ba6ce360ceccddb15ad16d08a8", "type": "github" }, "original": { "owner": "nix-systems", - "repo": "default", + "repo": "x86_64-linux", "type": "github" } }, @@ -808,6 +833,21 @@ "type": "github" } }, + "systems_4": { + "locked": { + "lastModified": 1680978846, + "narHash": "sha256-Gtqg8b/v49BFDpDetjclCYXm8mAnTrUzR0JnE2nv5aw=", + "owner": "nix-systems", + "repo": "x86_64-linux", + "rev": "2ecfcac5e15790ba6ce360ceccddb15ad16d08a8", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "x86_64-linux", + "type": "github" + } + }, "treefmt-nix": { "inputs": { "nixpkgs": [ diff --git a/flake.nix b/flake.nix index 635032e..2f5b7d7 100644 --- a/flake.nix +++ b/flake.nix @@ -26,6 +26,11 @@ }; import-tree.url = "github:vic/import-tree"; nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; + openwrt-imagebuilder = { + inputs.nixpkgs.follows = "nixpkgs"; + inputs.flake-parts.follows = "flake-parts"; + url = "github:astro/nix-openwrt-imagebuilder"; + }; treefmt-nix = { url = "github:numtide/treefmt-nix"; inputs.nixpkgs.follows = "nixpkgs"; @@ -79,6 +84,33 @@ packages.think-be = pkgs.think-backend-gtcm; packages.file-uploader = pkgs.gtcm-file-uploader; }; + + flake.packages.x86_64-linux.myrouter = + let + pkgs = inputs.nixpkgs.legacyPackages.x86_64-linux; + profiles = inputs.openwrt-imagebuilder.lib.profiles { inherit pkgs; }; + config = profiles.identifyProfile "glinet_gl-mt6000" // { + # add package to include in the image, ie. packages that you don't + # want to install manually later + packages = [ "tcpdump" ]; + + disabledServices = [ "dnsmasq" ]; + + # include files in the images. + # to set UCI configuration, create a uci-defauts scripts as per + # official OpenWRT ImageBuilder recommendation. + files = pkgs.runCommand "image-files" { } '' + mkdir -p $out/etc/uci-defaults + cat > $out/etc/uci-defaults/99-custom <