diff options
-rw-r--r-- | devShells/c.nix | 26 | ||||
-rw-r--r-- | flake.lock | 268 | ||||
-rw-r--r-- | flake.nix | 114 | ||||
-rw-r--r-- | nixos/configurations/adm-omnia.nix | 1 | ||||
-rw-r--r-- | nixos/configurations/dean.nix | 14 | ||||
-rw-r--r-- | nixos/configurations/errol.nix | 40 | ||||
-rw-r--r-- | nixos/configurations/lipwig.nix | 37 | ||||
-rw-r--r-- | nixos/configurations/ridcully.nix | 10 | ||||
-rw-r--r-- | nixos/configurations/spt-mox.nix | 31 | ||||
-rw-r--r-- | nixos/configurations/spt-mox2.nix | 16 | ||||
-rw-r--r-- | nixos/configurations/spt-omnia.nix | 56 | ||||
-rw-r--r-- | nixos/configurations/zd-mox.nix | 128 | ||||
-rw-r--r-- | nixos/modules/desktop.nix | 10 | ||||
-rw-r--r-- | nixos/modules/develop.nix | 3 | ||||
-rw-r--r-- | nixos/modules/gaming.nix | 9 | ||||
-rw-r--r-- | nixos/modules/generic.nix | 2 | ||||
-rw-r--r-- | nixos/modules/homeassistant.nix | 57 | ||||
-rw-r--r-- | nixos/modules/hosts.nix | 23 | ||||
-rw-r--r-- | nixos/modules/packages.nix | 1 | ||||
-rw-r--r-- | nixos/modules/wifi-zd.nix | 137 | ||||
-rw-r--r-- | pkgs/default.nix | 55 | ||||
-rw-r--r-- | pkgs/dodo/default.nix | 6 | ||||
-rw-r--r-- | pkgs/mtk-arm-trusted-firmware/default.nix | 64 | ||||
-rw-r--r-- | pkgs/u-boot-add-openwrt-one.patch | 579 |
24 files changed, 1326 insertions, 361 deletions
diff --git a/devShells/c.nix b/devShells/c.nix index 5798129..9a2db98 100644 --- a/devShells/c.nix +++ b/devShells/c.nix @@ -46,22 +46,16 @@ pkgs.mkShell { libffi.dev # Qt - #qt6.qttools - #qt6.qtbase - #qt6.qttranslations - #qt6.qtserialport - #qt6.qtwebsockets - #qt6.qtcharts - #qt6.qtsvg - #qt6.qtnetworkauth - #qt6.qtwayland - #qt6.wrapQtAppsHook - libsForQt5.qtbase - libsForQt5.qttranslations - libsForQt5.qtserialport - libsForQt5.qtwebsockets - libsForQt5.qtcharts - libsForQt5.qtwayland + qt6.qttools + qt6.qtbase + qt6.qttranslations + qt6.qtserialport + qt6.qtwebsockets + qt6.qtcharts + qt6.qtsvg + qt6.qtnetworkauth + qt6.qtwayland + qt6.wrapQtAppsHook ]; meta.platforms = pkgs.lib.platforms.linux; } @@ -8,11 +8,11 @@ "systems": "systems" }, "locked": { - "lastModified": 1745630506, - "narHash": "sha256-bHCFgGeu8XjWlVuaWzi3QONjDW3coZDqSHvnd4l7xus=", + "lastModified": 1754433428, + "narHash": "sha256-NA/FT2hVhKDftbHSwVnoRTFhes62+7dxZbxj5Gxvghs=", "owner": "ryantm", "repo": "agenix", - "rev": "96e078c646b711aee04b82ba01aefbff87004ded", + "rev": "9edb1787864c4f59ae5074ad498b6272b3ec308d", "type": "github" }, "original": { @@ -44,23 +44,6 @@ } }, "flake-utils": { - "inputs": { - "systems": "systems_2" - }, - "locked": { - "lastModified": 1731533236, - "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", - "type": "github" - }, - "original": { - "id": "flake-utils", - "type": "indirect" - } - }, - "flake-utils_2": { "locked": { "lastModified": 1678901627, "narHash": "sha256-U02riOqrKKzwjsxc/400XnElV+UtPUQWpANPlyazjH0=", @@ -74,33 +57,16 @@ "type": "indirect" } }, - "flake-utils_3": { - "inputs": { - "systems": "systems_3" - }, - "locked": { - "lastModified": 1731533236, - "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", - "type": "github" - }, - "original": { - "id": "flake-utils", - "type": "indirect" - } - }, - "flake-utils_4": { + "flake-utils_2": { "inputs": { - "systems": "systems_4" + "systems": "systems_5" }, "locked": { - "lastModified": 1731533236, - "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", + "lastModified": 1705309234, + "narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=", "owner": "numtide", "repo": "flake-utils", - "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26", "type": "github" }, "original": { @@ -108,34 +74,36 @@ "type": "indirect" } }, - "flake-utils_5": { + "flakepy": { "inputs": { - "systems": "systems_5" + "nixpkgs": "nixpkgs_6", + "systems": "systems_2" }, "locked": { - "lastModified": 1705309234, - "narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26", - "type": "github" + "lastModified": 1751271815, + "narHash": "sha256-TrMceYyeUXdQZlj/qZCznJB4iHdKj+d1cHXzcaoi3ig=", + "owner": "Cynerd", + "repo": "flakepy", + "rev": "d59cf207f55256163badc539a65669ad9bb1ba95", + "type": "gitlab" }, "original": { - "id": "flake-utils", - "type": "indirect" + "owner": "Cynerd", + "repo": "flakepy", + "type": "gitlab" } }, - "flakepy": { + "flakepy_2": { "inputs": { - "flake-utils": "flake-utils_4", - "nixpkgs": "nixpkgs_6" + "nixpkgs": "nixpkgs_8", + "systems": "systems_3" }, "locked": { - "lastModified": 1744031766, - "narHash": "sha256-clSAfGYX6OVdZv4SUE13yc/uMNPpX+AJSuIt1Sf73lI=", + "lastModified": 1751271815, + "narHash": "sha256-TrMceYyeUXdQZlj/qZCznJB4iHdKj+d1cHXzcaoi3ig=", "owner": "Cynerd", "repo": "flakepy", - "rev": "e98c0c050b42c6fbc0b54de69035972921615338", + "rev": "d59cf207f55256163badc539a65669ad9bb1ba95", "type": "gitlab" }, "original": { @@ -167,11 +135,11 @@ }, "nixos-hardware": { "locked": { - "lastModified": 1747129300, - "narHash": "sha256-L3clA5YGeYCF47ghsI7Tcex+DnaaN/BbQ4dR2wzoiKg=", + "lastModified": 1755330281, + "narHash": "sha256-aJHFJWP9AuI8jUGzI77LYcSlkA9wJnOIg4ZqftwNGXA=", "owner": "NixOS", "repo": "nixos-hardware", - "rev": "e81fd167b33121269149c57806599045fd33eeed", + "rev": "3dac8a872557e0ca8c083cdcfc2f218d18e113b0", "type": "github" }, "original": { @@ -199,20 +167,34 @@ }, "nixpkgs": { "locked": { - "lastModified": 1745391562, - "narHash": "sha256-sPwcCYuiEopaafePqlG826tBhctuJsLx/mhKKM5Fmjo=", + "lastModified": 1754028485, + "narHash": "sha256-IiiXB3BDTi6UqzAZcf2S797hWEPCRZOwyNThJIYhUfk=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "8a2f738d9d1f1d986b5a4cd2fd2061a7127237d7", + "rev": "59e69648d345d6e8fef86158c555730fa12af9de", "type": "github" }, "original": { "owner": "NixOS", - "ref": "nixos-unstable", + "ref": "nixos-25.05", "repo": "nixpkgs", "type": "github" } }, + "nixpkgs_10": { + "locked": { + "lastModified": 1707877513, + "narHash": "sha256-sp0w2apswd3wv0sAEF7StOGHkns3XUQaO5erhWFZWXk=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "89653a03e0915e4a872788d10680e7eec92f8600", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "type": "indirect" + } + }, "nixpkgs_2": { "locked": { "lastModified": 1744096231, @@ -229,25 +211,26 @@ }, "nixpkgs_3": { "locked": { - "lastModified": 1747060738, - "narHash": "sha256-ByfPRQuqj+nhtVV0koinEpmJw0KLzNbgcgi9EF+NVow=", + "lastModified": 1755186698, + "narHash": "sha256-wNO3+Ks2jZJ4nTHMuks+cxAiVBGNuEBXsT29Bz6HASo=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "eaeed9530c76ce5f1d2d8232e08bec5e26f18ec1", + "rev": "fbcf476f790d8a217c3eab4e12033dc4a0f6d23c", "type": "github" }, "original": { "id": "nixpkgs", + "ref": "nixos-unstable", "type": "indirect" } }, "nixpkgs_4": { "locked": { - "lastModified": 1737622296, - "narHash": "sha256-GWHH9ljsR0LR29IEruJnKVVk6veeQpo7kfolyDyCVGQ=", + "lastModified": 1755268003, + "narHash": "sha256-nNaeJjo861wFR0tjHDyCnHs1rbRtrMgxAKMoig9Sj/w=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "055c50feaa548eadca66407630961b77f3ebb750", + "rev": "32f313e49e42f715491e1ea7b306a87c16fe0388", "type": "github" }, "original": { @@ -271,11 +254,11 @@ }, "nixpkgs_6": { "locked": { - "lastModified": 1743568003, - "narHash": "sha256-ZID5T65E8ruHqWRcdvZLsczWDOAWIE7om+vQOREwiX0=", + "lastModified": 1751180975, + "narHash": "sha256-BKk4yDiXr4LdF80OTVqYJ53Q74rOcA/82EClXug8xsY=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "b7ba7f9f45c5cd0d8625e9e217c28f8eb6a19a76", + "rev": "a48741b083d4f36dd79abd9f760c84da6b4dc0e5", "type": "github" }, "original": { @@ -285,11 +268,11 @@ }, "nixpkgs_7": { "locked": { - "lastModified": 1743938762, - "narHash": "sha256-UgFYn8sGv9B8PoFpUfCa43CjMZBl1x/ShQhRDHBFQdI=", + "lastModified": 1753091883, + "narHash": "sha256-oVZt8VRJkO2Gytc7D2Pfqqy7wTnSECzdKPnoL9z8iFA=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "74a40410369a1c35ee09b8a1abee6f4acbedc059", + "rev": "2baf8e1658cba84a032c3a8befb1e7b06629242a", "type": "github" }, "original": { @@ -299,11 +282,25 @@ }, "nixpkgs_8": { "locked": { - "lastModified": 1707877513, - "narHash": "sha256-sp0w2apswd3wv0sAEF7StOGHkns3XUQaO5erhWFZWXk=", + "lastModified": 1751180975, + "narHash": "sha256-BKk4yDiXr4LdF80OTVqYJ53Q74rOcA/82EClXug8xsY=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "89653a03e0915e4a872788d10680e7eec92f8600", + "rev": "a48741b083d4f36dd79abd9f760c84da6b4dc0e5", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "type": "indirect" + } + }, + "nixpkgs_9": { + "locked": { + "lastModified": 1753091883, + "narHash": "sha256-oVZt8VRJkO2Gytc7D2Pfqqy7wTnSECzdKPnoL9z8iFA=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "2baf8e1658cba84a032c3a8befb1e7b06629242a", "type": "github" }, "original": { @@ -316,11 +313,11 @@ "nixpkgs": "nixpkgs_4" }, "locked": { - "lastModified": 1746027923, - "narHash": "sha256-hZgIegHN4aRxHeNcXv0fP9o9XulePepIESF1Cs9ERTw=", + "lastModified": 1755529547, + "narHash": "sha256-p8/c1Vf3jpz/un9vSMhYg5OZ9JKclAiUL5tqNoURBks=", "owner": "cynerd", "repo": "nixturris", - "rev": "546ac84a3c23d7f0649cece24244985f00c9237f", + "rev": "7323f9aa5c20824861e137b90d5ba10729224ae5", "type": "gitlab" }, "original": { @@ -331,11 +328,11 @@ }, "personal-secret": { "locked": { - "lastModified": 1744696740, - "narHash": "sha256-9QtdTBv3WKr0KOetNwE3EavPiPy4DASsWUTyyPW+rsM=", + "lastModified": 1753116365, + "narHash": "sha256-ilY/TB/McunFYw5P8MEICMopP/BnCoB8NrRc0Y0ReyE=", "ref": "refs/heads/master", - "rev": "e4173c5ba223ce36d3abb1b4ea830596c9cdc1f6", - "revCount": 131, + "rev": "0266c14d8f1a57153be83ed12dae57861f222e28", + "revCount": 136, "type": "git", "url": "ssh://git@cynerd.cz/nixos-personal-secret" }, @@ -346,16 +343,34 @@ }, "pyshv": { "inputs": { - "flake-utils": "flake-utils_3", "flakepy": "flakepy", "nixpkgs": "nixpkgs_7" }, "locked": { - "lastModified": 1744032098, - "narHash": "sha256-FGWfZsh02zomNBVZh0DuJI6EYREa6nORxFtWgUEuMAU=", + "lastModified": 1753438446, + "narHash": "sha256-CPF/qCTzxUNbuZo6C/coefYOVVYQqTzvSa5KuznutIM=", + "owner": "silicon-heaven", + "repo": "pyshv", + "rev": "7f56bca6560641f2de6efb839be99a08465c51d3", + "type": "gitlab" + }, + "original": { + "owner": "silicon-heaven", + "repo": "pyshv", + "type": "gitlab" + } + }, + "pyshv_2": { + "inputs": { + "flakepy": "flakepy_2", + "nixpkgs": "nixpkgs_9" + }, + "locked": { + "lastModified": 1753438446, + "narHash": "sha256-CPF/qCTzxUNbuZo6C/coefYOVVYQqTzvSa5KuznutIM=", "owner": "silicon-heaven", "repo": "pyshv", - "rev": "9e420fa565c413bfd495dec2cd9835358287cf2f", + "rev": "7f56bca6560641f2de6efb839be99a08465c51d3", "type": "gitlab" }, "original": { @@ -367,7 +382,6 @@ "root": { "inputs": { "agenix": "agenix", - "flake-utils": "flake-utils", "nixos-hardware": "nixos-hardware", "nixosdeploy": "nixosdeploy", "nixpkgs": "nixpkgs_3", @@ -376,21 +390,22 @@ "shellrc": "shellrc", "shvcli": "shvcli", "shvcli-ell": "shvcli-ell", + "systems": "systems_4", "usbkey": "usbkey", "vpsadminos": "vpsadminos" } }, "shellrc": { "inputs": { - "flake-utils": "flake-utils_2", + "flake-utils": "flake-utils", "nixpkgs": "nixpkgs_5" }, "locked": { - "lastModified": 1731939821, - "narHash": "sha256-SLJu/sI/wusXwc3Gjxe/lCXAawLvQpQ6h8IyglB6rBg=", + "lastModified": 1749023940, + "narHash": "sha256-NI3mu/4w7s86ONrr389rwc65/st9oWng0+M+1o6WIso=", "ref": "refs/heads/master", - "rev": "00c2d83c62603a13f54c5037f08d43591a29d6fb", - "revCount": 115, + "rev": "24654405e2da7cda14dfa5744357f33b6be730c6", + "revCount": 116, "type": "git", "url": "https://git.cynerd.cz/shellrc" }, @@ -404,11 +419,11 @@ "pyshv": "pyshv" }, "locked": { - "lastModified": 1744034385, - "narHash": "sha256-TLxF4bgpOwga/FwYfPOriXPzCatMB+XfvW7RH2RQ1Q8=", + "lastModified": 1753439134, + "narHash": "sha256-z+8sH7VG0a9JtAWqm+9qA/iQr1rPquFHGINdE7stlio=", "owner": "silicon-heaven", "repo": "shvcli", - "rev": "6450e993171d3907c88b130a61d215416646de44", + "rev": "3b2c365e205e8bf3d2338f88b0afd2dffab0f762", "type": "github" }, "original": { @@ -419,16 +434,14 @@ }, "shvcli-ell": { "inputs": { - "shvcli": [ - "shvcli" - ] + "shvcli": "shvcli_2" }, "locked": { - "lastModified": 1744035408, - "narHash": "sha256-Pgl+n55nuPGHbnG5/AQKwFPsAXCe2HmB7FwXHcZYR9k=", + "lastModified": 1753439820, + "narHash": "sha256-0QFazrPFTIFhOvLNXgaehwjfHSO9/W8a/y1hzIcMj9w=", "owner": "elektroline-predator", "repo": "shvcli-ell", - "rev": "a8cacef1cffb011109ac076fd9a5063251187629", + "rev": "9de977746f1aba386a58121e527bdfbf60286451", "type": "gitlab" }, "original": { @@ -437,6 +450,24 @@ "type": "gitlab" } }, + "shvcli_2": { + "inputs": { + "pyshv": "pyshv_2" + }, + "locked": { + "lastModified": 1753439134, + "narHash": "sha256-z+8sH7VG0a9JtAWqm+9qA/iQr1rPquFHGINdE7stlio=", + "owner": "silicon-heaven", + "repo": "shvcli", + "rev": "3b2c365e205e8bf3d2338f88b0afd2dffab0f762", + "type": "gitlab" + }, + "original": { + "owner": "silicon-heaven", + "repo": "shvcli", + "type": "gitlab" + } + }, "systems": { "locked": { "lastModified": 1681028828, @@ -462,9 +493,8 @@ "type": "github" }, "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" + "id": "systems", + "type": "indirect" } }, "systems_3": { @@ -477,9 +507,8 @@ "type": "github" }, "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" + "id": "systems", + "type": "indirect" } }, "systems_4": { @@ -492,9 +521,8 @@ "type": "github" }, "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" + "id": "systems", + "type": "indirect" } }, "systems_5": { @@ -514,8 +542,8 @@ }, "usbkey": { "inputs": { - "flake-utils": "flake-utils_5", - "nixpkgs": "nixpkgs_8" + "flake-utils": "flake-utils_2", + "nixpkgs": "nixpkgs_10" }, "locked": { "lastModified": 1744029480, @@ -533,11 +561,11 @@ }, "vpsadminos": { "locked": { - "lastModified": 1746967427, - "narHash": "sha256-lTI7Bg9zgDDWX0kFdR4OoK+I3kAaYt6Jo6jGRvSCn9U=", + "lastModified": 1755530779, + "narHash": "sha256-RX/xF3dzT3/E48huI514yytHh4VVBe8cJ5jrtdfOOWg=", "owner": "vpsfreecz", "repo": "vpsadminos", - "rev": "cad317d0c2eacd36beb4fce60d6dcced50b71173", + "rev": "8a39154991162e0f1c9546f692b047dc53c912b1", "type": "github" }, "original": { @@ -2,6 +2,7 @@ description = "Cynerd's personal flake"; inputs = { + nixpkgs.url = "flake:nixpkgs/nixos-unstable"; nixos-hardware.url = "nixos-hardware"; nixosdeploy.url = "gitlab:cynerd/nixosdeploy"; personal-secret.url = "git+ssh://git@cynerd.cz/nixos-personal-secret"; @@ -9,10 +10,7 @@ agenix.url = "github:ryantm/agenix"; shvcli.url = "github:silicon-heaven/shvcli"; - shvcli-ell = { - url = "gitlab:elektroline-predator/shvcli-ell"; - inputs.shvcli.follows = "shvcli"; - }; + shvcli-ell.url = "gitlab:elektroline-predator/shvcli-ell"; usbkey.url = "gitlab:cynerd/usbkey"; @@ -22,69 +20,75 @@ outputs = { self, - flake-utils, + systems, nixpkgs, nixosdeploy, personal-secret, shellrc, agenix, + shvcli, shvcli-ell, usbkey, nixturris, ... }: let - inherit (flake-utils.lib) eachDefaultSystem filterPackages; - inherit (nixpkgs.lib) mapAttrs' nameValuePair filterAttrs; - in - { - overlays = { - lib = final: prev: import ./lib final prev; - pkgs = final: prev: import ./pkgs final prev; - default = nixpkgs.lib.composeManyExtensions [ - agenix.overlays.default - nixosdeploy.overlays.default - self.overlays.pkgs - shellrc.overlays.default - shvcli-ell.overlays.default - usbkey.overlays.default - ]; - }; + inherit (nixpkgs.lib) genAttrs mapAttrs' nameValuePair filterAttrs; + forSystems = genAttrs (import systems); + withPkgs = func: forSystems (system: func self.legacyPackages.${system}); + + osFilterMap = system: attr: + mapAttrs' (n: v: let + os = + if v.config.nixpkgs.hostPlatform.system == system + then v + else (v.extendModules {modules = [{nixpkgs.buildPlatform.system = system;}];}); + in + nameValuePair "${attr}-${n}" os.config.system.build."${attr}") + (filterAttrs (_: v: v.config.system.build ? "${attr}") + self.nixosConfigurations); + in { + overlays = { + lib = final: prev: import ./lib final prev; + pkgs = final: prev: import ./pkgs final prev; + default = nixpkgs.lib.composeManyExtensions [ + agenix.overlays.default + nixosdeploy.overlays.default + self.overlays.pkgs + shellrc.overlays.default + shvcli.overlays.default + shvcli-ell.overlays.packages + usbkey.overlays.default + ]; + }; + + nixosModules = import ./nixos/modules { + inherit (nixpkgs) lib; + default_modules = [ + nixosdeploy.nixosModules.default + nixturris.nixosModules.default + personal-secret.nixosModules.default + shellrc.nixosModules.default + usbkey.nixosModules.default + ]; + }; - nixosModules = import ./nixos/modules { - inherit (nixpkgs) lib; - default_modules = [ - nixosdeploy.nixosModules.default - nixturris.nixosModules.default - personal-secret.nixosModules.default - shellrc.nixosModules.default - usbkey.nixosModules.default - ]; - }; + nixosConfigurations = import ./nixos/configurations self; + lib = import ./lib nixpkgs.lib; - nixosConfigurations = import ./nixos/configurations self; - lib = import ./lib nixpkgs.lib; - } - // eachDefaultSystem (system: let - pkgs = nixpkgs.legacyPackages."${system}".extend self.overlays.default; + legacyPackages = + forSystems (system: + nixpkgs.legacyPackages.${system}.extend self.overlays.default); - osFilterMap = attr: - mapAttrs' (n: v: let - os = - if v.config.nixpkgs.hostPlatform.system == system - then v - else (v.extendModules {modules = [{nixpkgs.buildPlatform.system = system;}];}); - in - nameValuePair "${attr}-${n}" os.config.system.build."${attr}") - (filterAttrs (_: v: v.config.system.build ? "${attr}") - self.nixosConfigurations); - in { - packages = + packages = forSystems ( + system: {inherit (nixosdeploy.packages.${system}) default;} - // (osFilterMap "toplevel") - // (osFilterMap "tarball") - // (osFilterMap "firmware"); - legacyPackages = pkgs; - devShells = filterPackages system (import ./devShells pkgs); - formatter = pkgs.alejandra; - }); + // (osFilterMap system "toplevel") + // (osFilterMap system "tarball") + // (osFilterMap system "firmware") + ); + + devShells = withPkgs (import ./devShells); + + formatter = withPkgs (pkgs: pkgs.alejandra); + }; } diff --git a/nixos/configurations/adm-omnia.nix b/nixos/configurations/adm-omnia.nix index 55ee733..2b80bbc 100644 --- a/nixos/configurations/adm-omnia.nix +++ b/nixos/configurations/adm-omnia.nix @@ -15,7 +15,6 @@ in { wan = "pppoe-wan"; lanIP = hosts.omnia; staticLeases = { - "70:85:c2:4a:59:f2" = hosts.ridcully; "7c:b0:c2:bb:9c:ca" = hosts.albert; "4c:d5:77:0d:85:d9" = hosts.binky; "b8:27:eb:49:54:5a" = hosts.mpd; diff --git a/nixos/configurations/dean.nix b/nixos/configurations/dean.nix index dfb03e1..a95d9f1 100644 --- a/nixos/configurations/dean.nix +++ b/nixos/configurations/dean.nix @@ -11,6 +11,20 @@ }; }; + boot.initrd.availableKernelModules = ["dm-mod"]; + + hardware.enableAllFirmware = false; # No wifi so we do not need firmwares + services = { + journald.extraConfig = '' + SystemMaxUse=512M + ''; + + btrfs.autoScrub = { + enable = true; + fileSystems = ["/"]; + }; + }; + networking = { useNetworkd = true; useDHCP = false; diff --git a/nixos/configurations/errol.nix b/nixos/configurations/errol.nix index f986631..defacf3 100644 --- a/nixos/configurations/errol.nix +++ b/nixos/configurations/errol.nix @@ -1,11 +1,4 @@ -{ - config, - lib, - pkgs, - ... -}: let - inherit (lib) mkDefault; -in { +{pkgs, ...}: { system.stateVersion = "24.05"; nixpkgs.hostPlatform.system = "x86_64-linux"; deploy.enable = true; @@ -96,36 +89,5 @@ in { enable = true; dataDir = "/home/cynerd"; }; - - home-assistant = { - enable = true; - openFirewall = true; - configDir = "/var/lib/hass"; - config = { - homeassistant = { - name = "SPT"; - latitude = "!secret latitude"; - longitude = "!secret longitude"; - elevation = "!secret elevation"; - time_zone = "Europe/Prague"; - country = "CZ"; - }; - http.server_port = 8808; - mqtt = { - sensor = import ../home-assistant/sensors.nix; - light = import ../home-assistant/light.nix; - }; - default_config = {}; - automation = "!include automations.yaml"; - }; - extraComponents = ["met"]; - package = pkgs.home-assistant.override { - extraPackages = pkgs: - with pkgs; [ - securetar - pyipp - ]; - }; - }; }; } diff --git a/nixos/configurations/lipwig.nix b/nixos/configurations/lipwig.nix index 5855b6d..2f5e242 100644 --- a/nixos/configurations/lipwig.nix +++ b/nixos/configurations/lipwig.nix @@ -107,10 +107,6 @@ forceSSL = true; useACMEHost = "cynerd.cz"; }; - "office.cynerd.cz" = { - forceSSL = true; - useACMEHost = "cynerd.cz"; - }; "grafana.cynerd.cz" = { forceSSL = true; useACMEHost = "cynerd.cz"; @@ -245,9 +241,9 @@ forms groupfolders impersonate + maps memories notes - onlyoffice phonetrack previewgenerator spreed @@ -255,15 +251,20 @@ twofactor_webauthn ; # Additional modules can be fetched with: - # NEXTCLOUD_VERSIONS=30 nix run nixpkgs#nc4nix -- -apps "passwords,money,integration_github,integration_gitlab" + # NEXTCLOUD_VERSIONS=31 nix run nixpkgs#nc4nix -- -apps "passwords,money,integration_github,integration_gitlab" + fileslibreofficeedit = pkgs.fetchNextcloudApp { + url = "https://github.com/allotropia/nextcloud_files_libreoffice_edit/releases/download/v2.0.1/fileslibreofficeedit.tar.gz"; + hash = "sha256-Xqx5snQWintYJG3Q1Crw22TkNw18DdADXkurMQqt3X8="; + license = "agpl3Plus"; + }; integration_github = pkgs.fetchNextcloudApp { - url = "https://github.com/nextcloud-releases/integration_github/releases/download/v3.1.1/integration_github-v3.1.1.tar.gz"; - hash = "sha256-nm463H33WyXTJkb7+OSsunARNuSl5nc3uGClgwkVvhM="; + url = "https://github.com/nextcloud-releases/integration_github/releases/download/v3.2.1/integration_github-v3.2.1.tar.gz"; + hash = "sha256-iBWphFaXmQHNxgoi9qkfV7vCTChwtk6yg0aVr9Lhn4c="; license = "agpl3Plus"; }; integration_gitlab = pkgs.fetchNextcloudApp { - url = "https://github.com/nextcloud-releases/integration_gitlab/releases/download/v3.1.2/integration_gitlab-v3.1.2.tar.gz"; - hash = "sha256-nCH0DqYmr4T856sOU5PhSK6WAHIF9mnYThgytxEbkNA="; + url = "https://github.com/nextcloud-releases/integration_gitlab/releases/download/v3.2.0/integration_gitlab-v3.2.0.tar.gz"; + hash = "sha256-BDDuqQIDV3pn1mYutjA7Z3L2nib2wW6DlZgyqU46f8Q="; license = "agpl3Plus"; }; money = pkgs.fetchNextcloudApp { @@ -272,22 +273,12 @@ license = "agpl3Plus"; }; passwords = pkgs.fetchNextcloudApp { - url = "https://git.mdns.eu/api/v4/projects/45/packages/generic/passwords/2025.5.1/passwords.tar.gz"; - hash = "sha256-v4IVpqbTN3TKORESFX+sJsiSrLkUc0b5Stj8CmznSIw="; - license = "agpl3Plus"; - }; - maps = pkgs.fetchNextcloudApp { - url = "https://github.com/nextcloud/maps/releases/download/v1.6.0-3-nightly/maps-1.6.0-3-nightly.tar.gz"; - hash = "sha256-E0S/CwXyye19lcuiONEQCyHJqlL0ZG1A9Q7oOTEZH1g="; + url = "https://git.mdns.eu/api/v4/projects/45/packages/generic/passwords/2025.7.0/passwords.tar.gz"; + hash = "sha256-SVItAtFRO/CbZ203ZS86inCZ+ZpGy0NUS3y2Xj1b+LI="; license = "agpl3Plus"; }; }; }; - # OnlyOffice ############################################################### - services.onlyoffice = { - enable = true; - hostname = "office.cynerd.cz"; - }; # Postgresql ############################################################### services.postgresql = { @@ -370,7 +361,7 @@ } ]; }; - runInUwsgi = true; + configureUwsgi = true; uwsgiConfig = { socket = "/run/searx/searx.sock"; chmod-socket = "660"; diff --git a/nixos/configurations/ridcully.nix b/nixos/configurations/ridcully.nix index 0b2705c..3dd9beb 100644 --- a/nixos/configurations/ridcully.nix +++ b/nixos/configurations/ridcully.nix @@ -1,10 +1,4 @@ -{ - lib, - pkgs, - ... -}: let - inherit (lib) mkDefault; -in { +{pkgs, ...}: { system.stateVersion = "24.05"; nixpkgs.hostPlatform.system = "x86_64-linux"; deploy.enable = true; @@ -79,5 +73,5 @@ in { }; # Force nix to use less jobs - nix.settings.max-jobs = 8; + nix.settings.max-jobs = 4; } diff --git a/nixos/configurations/spt-mox.nix b/nixos/configurations/spt-mox.nix index 8a842b7..4dfa2c8 100644 --- a/nixos/configurations/spt-mox.nix +++ b/nixos/configurations/spt-mox.nix @@ -28,13 +28,17 @@ }; }; - services.journald.extraConfig = '' - SystemMaxUse=512M - ''; + boot.initrd.availableKernelModules = ["dm-mod"]; - services.btrfs.autoScrub = { - enable = true; - fileSystems = ["/"]; + services = { + journald.extraConfig = '' + SystemMaxUse=512M + ''; + + btrfs.autoScrub = { + enable = true; + fileSystems = ["/"]; + }; }; networking = { @@ -73,25 +77,10 @@ acl = ["read bigclown/node/#"]; passwordFile = "/run/secrets/mosquitto.telegraf.pass"; }; - homeassistant = { - acl = [ - "readwrite homeassistant/#" - "readwrite bigclown/#" - "readwrite zigbee2mqtt/#" - ]; - passwordFile = "/run/secrets/mosquitto.homeassistant.pass"; - }; bigclown = { acl = ["readwrite bigclown/#"]; passwordFile = "/run/secrets/mosquitto.bigclown.pass"; }; - zigbee2mqtt = { - acl = [ - "readwrite homeassistant/#" - "readwrite zigbee2mqtt/#" - ]; - passwordFile = "/run/secrets/mosquitto.zigbee2mqtt.pass"; - }; }; } ]; diff --git a/nixos/configurations/spt-mox2.nix b/nixos/configurations/spt-mox2.nix index fd2c074..2e76449 100644 --- a/nixos/configurations/spt-mox2.nix +++ b/nixos/configurations/spt-mox2.nix @@ -23,13 +23,17 @@ }; }; - services.journald.extraConfig = '' - SystemMaxUse=512M - ''; + boot.initrd.availableKernelModules = ["dm-mod"]; - services.btrfs.autoScrub = { - enable = true; - fileSystems = ["/"]; + services = { + journald.extraConfig = '' + SystemMaxUse=512M + ''; + + btrfs.autoScrub = { + enable = true; + fileSystems = ["/"]; + }; }; networking = { diff --git a/nixos/configurations/spt-omnia.nix b/nixos/configurations/spt-omnia.nix index 1809b2a..8449f0d 100644 --- a/nixos/configurations/spt-omnia.nix +++ b/nixos/configurations/spt-omnia.nix @@ -15,6 +15,7 @@ in { lanIP = hosts.omnia; staticLeases = { "a8:a1:59:10:32:c4" = hosts.errol; + "70:85:c2:4a:59:f2" = hosts.ridcully; "7c:b0:c2:bb:9c:ca" = hosts.albert; "4c:d5:77:0d:85:d9" = hosts.binky; "b8:27:eb:57:a2:31" = hosts.mpd; @@ -38,18 +39,20 @@ in { monitoring.speedtest = true; }; - services.journald.extraConfig = '' - SystemMaxUse=8G - ''; + services = { + journald.extraConfig = '' + SystemMaxUse=8G + ''; - services.btrfs.autoScrub = { - enable = true; - fileSystems = ["/"]; - }; + btrfs.autoScrub = { + enable = true; + fileSystems = ["/"]; + }; - services.fail2ban = { - enable = true; - ignoreIP = ["10.8.1.0/24" "10.8.2.0/24"]; + fail2ban = { + enable = true; + ignoreIP = ["10.8.1.0/24" "10.8.2.0/24"]; + }; }; networking.useDHCP = false; @@ -133,32 +136,11 @@ in { ''; ############################################################################## - services = { - zigbee2mqtt = { - enable = true; - settings = { - serial.port = "/dev/serial/by-id/usb-ITEAD_SONOFF_Zigbee_3.0_USB_Dongle_Plus_V2_20220812153849-if00"; - mqtt = { - server = "mqtt://${config.cynerd.hosts.spt.mox}:1883"; - user = "zigbee2mqtt"; - password = "!secret.yaml mqtt_password"; - }; - advanced = { - network_key = "!secret.yaml network_key"; - homeassistant_legacy_entity_attributes = false; - legacy_api = false; - legacy_availability_payload = false; - last_seen = "epoch"; - }; - frontend = true; - availability = true; - homeassistant = { - legacy_triggers = false; - }; - device_options.legacy = false; - permit_join = false; - devices = config.secrets.zigbee2mqttDevices; - }; - }; + cynerd.ha = { + enable = true; + domain = "spt.cynerd.cz"; + extraOptions = [ + "--device=/dev/serial/by-id/usb-ITEAD_SONOFF_Zigbee_3.0_USB_Dongle_Plus_V2_20220812153849-if00:/dev/ttyACM0" + ]; }; } diff --git a/nixos/configurations/zd-mox.nix b/nixos/configurations/zd-mox.nix new file mode 100644 index 0000000..a6f327c --- /dev/null +++ b/nixos/configurations/zd-mox.nix @@ -0,0 +1,128 @@ +{config, ...}: let + hosts = config.cynerd.hosts.zd; +in { + system.stateVersion = "25.05"; + turris.board = "mox"; + deploy = { + enable = true; + ssh.host = "zd.cynerd.cz"; + }; + + cynerd = { + router = { + enable = true; + wan = "pppoe-wan"; + lanIP = hosts.mox; + staticLeases = { + "4c:d5:77:0d:85:d9" = hosts.binky; + }; + }; + wifiAP.zd = { + enable = false; + qca988x = { + interface = "wlp1s0"; + bssids = config.secrets.wifiMacs.zd-mox.qca988x; + channel = 36; + }; + }; + wireguard = true; + monitoring.speedtest = true; + }; + + boot.initrd.availableKernelModules = ["dm-mod"]; + + services = { + journald.extraConfig = '' + SystemMaxUse=512M + ''; + + btrfs.autoScrub = { + enable = true; + fileSystems = ["/"]; + }; + + fail2ban = { + enable = true; + ignoreIP = ["10.8.0.0/24" "10.8.1.0/24" "10.8.2.0/24"]; + }; + }; + + networking.useDHCP = false; + systemd.network = { + netdevs = { + "end2.848" = { + netdevConfig = { + Kind = "vlan"; + Name = "end2.848"; + }; + vlanConfig.Id = 848; + }; + }; + networks = { + "end2" = { + matchConfig.Name = "end2"; + networkConfig.VLAN = ["end2.848"]; + }; + "end2.848" = { + matchConfig.Name = "end2.848"; + networkConfig.BindCarrier = "end2"; + }; + "pppoe-wan" = { + matchConfig.Name = "pppoe-wan"; + networkConfig = { + BindCarrier = "end2.848"; + DHCP = "ipv6"; + IPv6AcceptRA = "no"; + DHCPPrefixDelegation = "yes"; + #DNS = ["84.19.64.3" "84.19.64.4" "1.1.1.1"]; + DNS = "1.1.1.1"; + }; + dhcpV6Config = { + PrefixDelegationHint = "::/56"; + UseDNS = "no"; + }; + dhcpPrefixDelegationConfig = { + UplinkInterface = ":self"; + SubnetId = 0; + Announce = "no"; + }; + linkConfig.RequiredForOnline = "routable"; + }; + "lan-brlan" = { + matchConfig.Name = "lan*"; + networkConfig.Bridge = "brlan"; + bridgeVLANs = [ + { + EgressUntagged = 1; + PVID = 1; + } + {VLAN = 2;} + ]; + }; + }; + }; + + services.pppd = { + enable = true; + peers."wan".config = '' + plugin pppoe.so end2.848 + ifname pppoe-wan + lcp-echo-interval 1 + lcp-echo-failure 5 + lcp-echo-adaptive + defaultroute + defaultroute6 + maxfail 1 + # user and password added in secrets + ''; + }; + systemd.services."pppd-wan" = { + after = ["sys-subsystem-net-devices-end2.848.device"]; + partOf = ["systemd-networkd.service"]; + }; + # TODO limit NSS clamping to just pppoe-wan + networking.firewall.extraForwardRules = '' + tcp flags syn tcp option maxseg size set rt mtu comment "Needed for PPPoE to fix IPv4" + iifname {"home", "wg"} oifname {"home", "wg"} accept + ''; +} diff --git a/nixos/modules/desktop.nix b/nixos/modules/desktop.nix index dfc9777..05a7b7b 100644 --- a/nixos/modules/desktop.nix +++ b/nixos/modules/desktop.nix @@ -69,7 +69,6 @@ in { isync msmtp notmuch - astroid dodo taskwarrior3 gnupg @@ -81,14 +80,19 @@ in { ])) chromium + tangram ferdium signal-desktop - libreoffice - onlyoffice-desktopeditors mupdf zathura pdfgrep + libreoffice-qt6-fresh + hunspell + hunspellDicts.en_US-large + hunspellDicts.en_GB-large + hunspellDicts.cs_CZ + xdg-utils xdg-launch mesa-demos diff --git a/nixos/modules/develop.nix b/nixos/modules/develop.nix index 6444473..4973a92 100644 --- a/nixos/modules/develop.nix +++ b/nixos/modules/develop.nix @@ -112,6 +112,9 @@ in { pylxd selenium + + pyvisa + pyvisa-py ])) ruff geckodriver diff --git a/nixos/modules/gaming.nix b/nixos/modules/gaming.nix index 6dce70d..4f957ed 100644 --- a/nixos/modules/gaming.nix +++ b/nixos/modules/gaming.nix @@ -18,7 +18,10 @@ in { config = mkIf cnf { cynerd.desktop.enable = true; - environment.systemPackages = [pkgs.heroic]; + environment.systemPackages = with pkgs; [ + heroic + prismlauncher + ]; nixpkgs.config.permittedInsecurePackages = [ "SDL_ttf-2.0.11" # TODO @@ -35,7 +38,7 @@ in { with pkgs; [ ncurses xorg.libXpm - #flac134 + flac134 libopus ]; }; @@ -44,7 +47,7 @@ in { with pkgs; [ ncurses xorg.libXpm - #flac134 + flac134 # For Nebuchadnezzar libopus SDL SDL2_image diff --git a/nixos/modules/generic.nix b/nixos/modules/generic.nix index e029058..e6e96a4 100644 --- a/nixos/modules/generic.nix +++ b/nixos/modules/generic.nix @@ -37,7 +37,7 @@ in { kernelPackages = mkOverride 1100 pkgs.linuxPackages_latest; kernelParams = ["boot.shell_on_fail"]; }; - hardware.enableAllFirmware = true; + hardware.enableAllFirmware = mkDefault true; services.fwupd.enable = mkDefault (pkgs.system == "x86_64-linux"); systemd.oomd.enable = false; diff --git a/nixos/modules/homeassistant.nix b/nixos/modules/homeassistant.nix new file mode 100644 index 0000000..f7ebe9c --- /dev/null +++ b/nixos/modules/homeassistant.nix @@ -0,0 +1,57 @@ +{ + config, + lib, + ... +}: let + inherit (lib) mkOption mkEnableOption types mkIf; + cnf = config.cynerd.ha; +in { + options.cynerd.ha = { + enable = mkEnableOption "Home assistant setup on the primary router."; + domain = mkOption { + type = with types; str; + description = "The domain name of the system."; + }; + extraOptions = mkOption { + type = with types; listOf str; + default = []; + description = "Extra options passed to the container."; + }; + }; + + config = mkIf cnf.enable { + virtualisation.oci-containers = { + backend = "podman"; + containers.homeassistant = { + volumes = ["home-assistant:/config" "/run/dbus:/run/dbus:ro"]; + environment.TZ = "Europe/Prague"; + image = "ghcr.io/home-assistant/armv7-homeassistant:latest"; + extraOptions = + ["--privileged" "--network=host"] + ++ cnf.extraOptions; + }; + }; + + services.nginx = { + enable = true; + virtualHosts = { + "${cnf.domain}" = { + forceSSL = true; + enableACME = true; + locations."/" = { + proxyPass = "http://localhost:8123"; + proxyWebsockets = true; + recommendedProxySettings = true; + }; + }; + }; + }; + security.acme = { + acceptTerms = true; + defaults.email = "cynerd+acme@email.cz"; + certs."${cnf.domain}" = {}; + }; + + networking.firewall.allowedTCPPorts = [80 443]; + }; +} diff --git a/nixos/modules/hosts.nix b/nixos/modules/hosts.nix index 4b358b8..9affe19 100644 --- a/nixos/modules/hosts.nix +++ b/nixos/modules/hosts.nix @@ -19,7 +19,7 @@ in { default = true; description = "Use my personal static hosts"; }; - vpn = staticZoneOption; + zd = staticZoneOption; wg = staticZoneOption; spt = staticZoneOption; adm = staticZoneOption; @@ -28,9 +28,10 @@ in { config = { cynerd.hosts = { - vpn = { - "lipwig" = "10.8.0.1"; - "adm-omnia" = "10.8.0.51"; + zd = { + "mox" = "10.8.0.1"; + # Portable + "binky" = "10.8.0.63"; }; wg = { "lipwig" = "10.8.1.1"; @@ -40,6 +41,7 @@ in { # Endpoints "spt-omnia" = "10.8.1.50"; "adm-omnia" = "10.8.1.51"; + "zd-mox" = "10.8.1.52"; # Endpoints without routing "dean" = "10.8.1.59"; }; @@ -51,6 +53,7 @@ in { # Local "mpd" = "10.8.2.51"; "errol" = "10.8.2.60"; + "ridcully" = "10.8.2.59"; "printer" = "10.8.2.90"; # Portable "albert" = "10.8.2.61"; @@ -61,7 +64,6 @@ in { "omnia" = "10.8.3.1"; "omnia2" = "10.8.3.3"; # Local - "ridcully" = "10.8.3.60"; "3dprint" = "10.8.3.80"; "mpd" = "10.8.3.51"; "printer" = "192.168.1.20"; @@ -72,15 +74,16 @@ in { }; networking.hosts = mkIf cnf.enable { - # VPN - "${cnf.vpn.lipwig}" = ["lipwig.vpn"]; - "${cnf.vpn.adm-omnia}" = ["adm.vpn"]; + # Zd + "${cnf.zd.mox}" = ["mox.zd"]; + "${cnf.zd.binky}" = ["binky.zd"]; # Wireguard "${cnf.wg.lipwig}" = ["lipwig.wg"]; "${cnf.wg.binky}" = ["binky.wg"]; "${cnf.wg.android}" = ["android.wg"]; "${cnf.wg.spt-omnia}" = ["spt.wg"]; "${cnf.wg.adm-omnia}" = ["adm.wg"]; + "${cnf.wg.zd-mox}" = ["zd.wg"]; "${cnf.wg.dean}" = ["dean" "dean.wg"]; # Spt "${cnf.spt.omnia}" = ["omnia.spt"]; @@ -88,14 +91,14 @@ in { "${cnf.spt.mox2}" = ["mox2.spt"]; "10.8.2.4" = ["mi3g.spt"]; "${cnf.spt.mpd}" = ["mpd.spt"]; - "${cnf.spt.errol}" = ["errol" "desktop.spt"]; + "${cnf.spt.errol}" = ["errol"]; + "${cnf.spt.ridcully}" = ["ridcully"]; "${cnf.spt.albert}" = ["albert.spt"]; "${cnf.spt.binky}" = ["binky.spt"]; # Adm "${cnf.adm.omnia}" = ["omnia.adm"]; "10.8.3.2" = ["redmi.adm"]; "${cnf.adm.omnia2}" = ["omnia2.adm"]; - "${cnf.adm.ridcully}" = ["ridcully" "desktop.adm"]; "${cnf.adm.albert}" = ["albert.adm"]; "${cnf.adm.binky}" = ["binky.adm"]; "${cnf.adm."3dprint"}" = ["3dprint"]; diff --git a/nixos/modules/packages.nix b/nixos/modules/packages.nix index 155d8a5..c41e491 100644 --- a/nixos/modules/packages.nix +++ b/nixos/modules/packages.nix @@ -47,6 +47,7 @@ in { tree lsof strace + ripgrep sourceHighlight # Colors for less unrar diff --git a/nixos/modules/wifi-zd.nix b/nixos/modules/wifi-zd.nix new file mode 100644 index 0000000..107fdf4 --- /dev/null +++ b/nixos/modules/wifi-zd.nix @@ -0,0 +1,137 @@ +{ + config, + lib, + ... +}: let + inherit (lib) mkOption mkEnableOption types mkIf mkForce mkMerge hostapd elemAt; + cnf = config.cynerd.wifiAP.zd; + + wifi-networks = name: let + is2g = cnf."${name}".channel <= 14; + in { + "${cnf."${name}".interface}" = { + bssid = elemAt cnf."${name}".bssids 0; + ssid = "UNas${ + if is2g + then "" + else "5" + }"; + authentication = { + mode = "wpa2-sha256"; + wpaPasswordFile = "/run/secrets/hostapd-UNas.pass"; + }; + settings = mkIf is2g { + ieee80211w = 0; + wpa_key_mgmt = mkForce "WPA-PSK"; # force use without sha256 + }; + }; + "${cnf."${name}".interface}.guest" = { + bssid = elemAt cnf."${name}".bssids 1; + ssid = "Koci"; + authentication = { + mode = "wpa2-sha256"; + wpaPasswordFile = "/run/secrets/hostapd-Koci.pass"; + }; + }; + }; + + net-networks = name: { + "lan-${cnf."${name}".interface}" = { + matchConfig = { + Name = cnf."${name}".interface; + WLANInterfaceType = "ap"; + }; + networkConfig.Bridge = "brlan"; + bridgeVLANs = [ + { + EgressUntagged = 1; + PVID = 1; + } + ]; + }; + "lan-${cnf."${name}".interface}-guest" = { + matchConfig.Name = "${cnf."${name}".interface}.guest"; + networkConfig.Bridge = "brlan"; + bridgeVLANs = [ + { + EgressUntagged = 2; + PVID = 2; + } + ]; + }; + }; + + wOptions = card: channelDefault: { + interface = mkOption { + type = with types; nullOr str; + default = null; + description = "Specify interface for ${card}"; + }; + bssids = mkOption { + type = with types; listOf str; + default = []; + description = "BSSIDs for networks."; + }; + channel = mkOption { + type = types.ints.positive; + default = channelDefault; + description = "Channel to be used for ${card}"; + }; + }; +in { + options = { + cynerd.wifiAP.zd = { + enable = mkEnableOption "Enable Wi-Fi Access Point support"; + ar9287 = wOptions "Qualcom Atheros AR9287" 7; + qca988x = wOptions "Qualcom Atheros QCA988x" 36; + }; + }; + + config = mkIf cnf.enable { + # TODO regdom doesn't work for some reason + boot.extraModprobeConfig = '' + options cfg80211 ieee80211_regdom="CZ" + ''; + services.hostapd = { + enable = true; + radios = mkMerge [ + (mkIf (cnf.ar9287.interface != null) { + "${cnf.ar9287.interface}" = { + inherit (cnf.ar9287) channel; + countryCode = "CZ"; + wifi4 = { + enable = true; + inherit (hostapd.qualcomAtherosAR9287.wifi4) capabilities; + }; + networks = wifi-networks "ar9287"; + }; + }) + (mkIf (cnf.qca988x.interface != null) { + "${cnf.qca988x.interface}" = let + is2g = cnf.qca988x.channel <= 14; + in { + inherit (cnf.qca988x) channel; + countryCode = "CZ"; + band = + if is2g + then "2g" + else "5g"; + wifi4 = { + enable = true; + inherit (hostapd.qualcomAtherosQCA988x.wifi4) capabilities; + }; + wifi5 = { + enable = !is2g; + inherit (hostapd.qualcomAtherosQCA988x.wifi5) capabilities; + }; + networks = wifi-networks "qca988x"; + }; + }) + ]; + }; + systemd.network.networks = mkMerge [ + (mkIf (cnf.ar9287.interface != null) (net-networks "ar9287")) + (mkIf (cnf.qca988x.interface != null) (net-networks "qca988x")) + ]; + }; +} diff --git a/pkgs/default.nix b/pkgs/default.nix index 82bd1a8..b3473f1 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -21,23 +21,36 @@ final: prev: { bigclown-leds = final.callPackage ./bigclown-leds {}; dodo = final.callPackage ./dodo {}; - astroid = prev.astroid.overrideAttrs (oldAttrs: { - version = "240629"; - src = final.fetchFromGitHub { - owner = "astroidmail"; - repo = "astroid"; - rev = "65acc24048a57039753cf2326dbfca6b608b91d1"; - hash = "sha256-PXFVOaCgBHNUg0aCJD1TL/ulzjz9v70/jW5ManUPcHw="; - }; - patches = []; - buildInputs = oldAttrs.buildInputs ++ [final.webkitgtk_4_1]; - meta = oldAttrs.meta // {broken = false;}; - }); - # nixpkgs patches - zigbee2mqtt = prev.zigbee2mqtt.overrideAttrs { - npmInstallFlags = ["--no-optional"]; # Fix cross build + # OpenWrt One + armTrustedFirmwareMT7981 = final.callPackage ./mtk-arm-trusted-firmware rec { + extraMakeFlags = ["BOOT_DEVICE=spim-nand" "DRAM_USE_DDR4=1" "bl2" "bl31"]; + platform = "mt7981"; + extraMeta.platforms = ["aarch64-linux"]; + filesToInstall = ["build/${platform}/release/bl2.bin" "build/${platform}/release/bl31.bin"]; }; + ubootOpenWrtOne = + (final.buildUBoot { + version = "2025.04"; + src = final.fetchurl { + url = "https://ftp.denx.de/pub/u-boot/u-boot-2025.04.tar.bz2"; + hash = "sha256-Q5077ylu/9VBML5qcxxbEYvn/d1/zGY8y8X7GClNhxg="; + }; + defconfig = "mt7981_openwrt-one-spi-nand_defconfig"; + extraMeta.platforms = ["aarch64-linux"]; + BL31 = "${final.armTrustedFirmwareMT7981}/bl31.elf"; + filesToInstall = ["u-boot.bin"]; + extraPatches = [./u-boot-add-openwrt-one.patch]; + extraConfig = '' + CONFIG_FS_BTRFS=y + CONFIG_CMD_BTRFS=y + CONFIG_BOARD_LATE_INIT=n + ''; + }).overrideAttrs (oldAttrs: { + nativeBuildInputs = [final.buildPackages.unixtools.xxd] ++ oldAttrs.nativeBuildInputs; + }); + + # nixpkgs patches ubootRaspberryPi3_btrfs = prev.buildUBoot { defconfig = "rpi_3_defconfig"; extraConfig = '' @@ -47,6 +60,17 @@ final: prev: { extraMeta.platforms = ["aarch64-linux"]; filesToInstall = ["u-boot.bin"]; }; + wolfssl = prev.wolfssl.overrideAttrs (oldAttrs: rec { + version = "5.8.2"; + src = oldAttrs.src.override { + tag = "v${version}-stable"; + hash = "sha256-rWBfpI6tdpKvQA/XdazBvU5hzyai5PtKRBpM4iplZDU="; + }; + }); + bind = prev.bind.overrideAttrs (oldAttrs: { + nativeBuildInputs = oldAttrs.nativeBuildInputs ++ [final.buildPackages.protobufc]; + strictDeps = true; + }); # Older version of packages flac134 = prev.flac.overrideAttrs { @@ -56,5 +80,6 @@ final: prev: { hash = "sha256-j/BgfnWjIt181uxI9PIlRxQEricw0OqUUSexNVFV5zc="; }; outputs = ["out"]; + doCheck = false; }; } diff --git a/pkgs/dodo/default.nix b/pkgs/dodo/default.nix index 2984de3..242f4a4 100644 --- a/pkgs/dodo/default.nix +++ b/pkgs/dodo/default.nix @@ -6,14 +6,14 @@ }: python3Packages.buildPythonApplication { pname = "dodo"; - version = "250313"; + version = "250806"; pyproject = true; src = fetchFromGitHub { owner = "akissinger"; repo = "dodo"; - rev = "c108dd93aa637ef757fa8d86cf210d37093f03ec"; - hash = "sha256-tRLaPOh2y87zcBKTtZazfsNzJnLUXRaAEMEMND7XnNY="; + rev = "bcb0db840f6eb0223f99e9ddefe147d84f50dc98"; + hash = "sha256-ScMzSz6HzSUHE5jOrXvcMaokQILaXJV58k87SXujaXg="; }; build-system = with python3Packages; [ diff --git a/pkgs/mtk-arm-trusted-firmware/default.nix b/pkgs/mtk-arm-trusted-firmware/default.nix new file mode 100644 index 0000000..44fbf64 --- /dev/null +++ b/pkgs/mtk-arm-trusted-firmware/default.nix @@ -0,0 +1,64 @@ +{ + lib, + stdenv, + fetchFromGitHub, + buildPackages, + openssl, + dtc, + filesToInstall, + platform ? null, + extraMakeFlags ? [], + extraMeta ? {}, +}: +stdenv.mkDerivation { + pname = "arm-trusted-firmware${lib.optionalString (platform != null) "-${platform}"}"; + version = "2025.02.12"; + + src = fetchFromGitHub { + owner = "mtk-openwrt"; + repo = "arm-trusted-firmware"; + rev = "e090770684e775711a624e68e0b28112227a4c38"; + hash = "sha256-VI5OB2nWdXUjkSuUXl/0yQN+/aJp9Jkt+hy7DlL+PMg="; + }; + + depsBuildBuild = [buildPackages.stdenv.cc]; + nativeBuildInputs = [dtc]; + buildInputs = [openssl]; + + makeFlags = + [ + "HOSTCC=$(CC_FOR_BUILD)" + "CROSS_COMPILE=${stdenv.cc.targetPrefix}" + # Make the new toolchain guessing (from 2.11+) happy + "CC=${stdenv.cc.targetPrefix}cc" + "LD=${stdenv.cc.targetPrefix}cc" + "AS=${stdenv.cc.targetPrefix}cc" + "OC=${stdenv.cc.targetPrefix}objcopy" + "OD=${stdenv.cc.targetPrefix}objdump" + # Passing OpenSSL path according to docs/design/trusted-board-boot-build.rst + "OPENSSL_DIR=${openssl}" + ] + ++ (lib.optional (platform != null) "PLAT=${platform}") + ++ extraMakeFlags; + + installPhase = '' + runHook preInstall + + mkdir -p $out + cp ${lib.concatStringsSep " " filesToInstall} $out + + runHook postInstall + ''; + + hardeningDisable = ["all"]; + dontStrip = true; + + meta = with lib; + { + homepage = "https://github.com/mtk-openwrt/arm-trusted-firmware"; + description = "MediaTek ARM Trusted Firmware"; + license = [licenses.bsd3]; + maintainers = with maintainers; [cynerd]; + } + // extraMeta; +} diff --git a/pkgs/u-boot-add-openwrt-one.patch b/pkgs/u-boot-add-openwrt-one.patch new file mode 100644 index 0000000..722f1ee --- /dev/null +++ b/pkgs/u-boot-add-openwrt-one.patch @@ -0,0 +1,579 @@ +--- /dev/null ++++ b/arch/arm/dts/openwrt-one.dts +@@ -0,0 +1,203 @@ ++// SPDX-License-Identifier: GPL-2.0 ++/* ++ * Copyright (c) 2024 John Crispin <john@phrozen.org> ++ */ ++ ++/dts-v1/; ++#include "mt7981.dtsi" ++#include <dt-bindings/gpio/gpio.h> ++#include <dt-bindings/input/input.h> ++ ++/ { ++ #address-cells = <1>; ++ #size-cells = <1>; ++ model = "OpenWrt One"; ++ compatible = "openwrt,one", "mediatek,mt7981"; ++ chosen { ++ stdout-path = &uart0; ++ tick-timer = &timer0; ++ }; ++ ++ memory@40000000 { ++ device_type = "memory"; ++ reg = <0x40000000 0x10000000>; ++ }; ++ ++ keys { ++ compatible = "gpio-keys"; ++ ++ user { ++ label = "front"; ++ gpios = <&pio 0 GPIO_ACTIVE_LOW>; ++ linux,code = <BTN_0>; ++ }; ++ ++ reset { ++ label = "back"; ++ gpios = <&pio 1 GPIO_ACTIVE_LOW>; ++ linux,code = <BTN_1>; ++ }; ++ }; ++ ++ leds { ++ compatible = "gpio-leds"; ++ ++ red { ++ label = "red"; ++ gpios = <&pio 9 GPIO_ACTIVE_HIGH>; ++ }; ++ ++ white { ++ label = "white"; ++ gpios = <&pio 13 GPIO_ACTIVE_HIGH>; ++ }; ++ ++ green { ++ label = "green"; ++ gpios = <&pio 15 GPIO_ACTIVE_HIGH>; ++ }; ++ }; ++}; ++ ++&uart0 { ++ status = "okay"; ++}; ++ ++ð { ++ status = "okay"; ++ mediatek,gmac-id = <1>; ++ phy-mode = "gmii"; ++ phy-handle = <&phy0>; ++ ++ phy0: eth-phy@0 { ++ compatible = "ethernet-phy-ieee802.3-c22"; ++ reg = <0>; ++ }; ++}; ++ ++&pio { ++ spi_flash_pins: spi0-pins-func-1 { ++ mux { ++ function = "flash"; ++ groups = "spi0", "spi0_wp_hold"; ++ }; ++ ++ conf-pu { ++ pins = "SPI0_CS", "SPI0_HOLD", "SPI0_WP"; ++ drive-strength = <MTK_DRIVE_8mA>; ++ bias-pull-up = <MTK_PUPD_SET_R1R0_11>; ++ }; ++ ++ conf-pd { ++ pins = "SPI0_CLK", "SPI0_MOSI", "SPI0_MISO"; ++ drive-strength = <MTK_DRIVE_8mA>; ++ bias-pull-down = <MTK_PUPD_SET_R1R0_11>; ++ }; ++ }; ++ ++ spi2_flash_pins: spi2-spi2-pins { ++ mux { ++ function = "spi"; ++ groups = "spi2", "spi2_wp_hold"; ++ }; ++ ++ conf-pu { ++ pins = "SPI2_CS", "SPI2_HOLD", "SPI2_WP"; ++ drive-strength = <MTK_DRIVE_8mA>; ++ bias-pull-down = <MTK_PUPD_SET_R1R0_00>; ++ }; ++ ++ conf-pd { ++ pins = "SPI2_CLK", "SPI2_MOSI", "SPI2_MISO"; ++ drive-strength = <MTK_DRIVE_8mA>; ++ bias-pull-down = <MTK_PUPD_SET_R1R0_00>; ++ }; ++ }; ++}; ++ ++&spi0 { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&spi_flash_pins>; ++ status = "okay"; ++ must_tx; ++ enhance_timing; ++ dma_ext; ++ ipm_design; ++ support_quad; ++ tick_dly = <2>; ++ sample_sel = <0>; ++ ++ spi_nand@0 { ++ compatible = "spi-nand"; ++ reg = <0>; ++ spi-max-frequency = <52000000>; ++ ++ partitions { ++ compatible = "fixed-partitions"; ++ #address-cells = <1>; ++ #size-cells = <1>; ++ ++ partition@0 { ++ label = "bl2"; ++ reg = <0x0 0x100000>; ++ }; ++ ++ partition@200000 { ++ label = "ubi"; ++ reg = <0x100000 0xff00000>; ++ }; ++ }; ++ }; ++}; ++ ++&spi2 { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&spi2_flash_pins>; ++ status = "okay"; ++ must_tx; ++ enhance_timing; ++ dma_ext; ++ ipm_design; ++ tick_dly = <2>; ++ sample_sel = <0>; ++ ++ spi_nor@0 { ++ compatible = "jedec,spi-nor"; ++ reg = <0>; ++ spi-max-frequency = <5000000>; ++ ++ partitions { ++ compatible = "fixed-partitions"; ++ #address-cells = <1>; ++ #size-cells = <1>; ++ ++ partition@00000 { ++ label = "bl2-nor"; ++ reg = <0x00000 0x0040000>; ++ }; ++ ++ partition@40000 { ++ label = "factory"; ++ reg = <0x40000 0x00C0000>; ++ }; ++ ++ partition@100000 { ++ label = "fip-nor"; ++ reg = <0x100000 0x0080000>; ++ }; ++ ++ partition@180000 { ++ label = "recovery"; ++ reg = <0x180000 0xc80000>; ++ }; ++ }; ++ }; ++}; ++ ++&watchdog { ++ status = "disabled"; ++}; +--- /dev/null ++++ b/configs/mt7981_openwrt-one-nor_defconfig +@@ -0,0 +1,125 @@ ++CONFIG_ARM=y ++CONFIG_SYS_HAS_NONCACHED_MEMORY=y ++CONFIG_POSITION_INDEPENDENT=y ++CONFIG_ARCH_MEDIATEK=y ++CONFIG_TEXT_BASE=0x41e00000 ++CONFIG_SYS_MALLOC_F_LEN=0x4000 ++CONFIG_NR_DRAM_BANKS=1 ++CONFIG_ENV_SIZE=0x8000 ++CONFIG_DEFAULT_DEVICE_TREE="openwrt-one" ++CONFIG_OF_LIBFDT_OVERLAY=y ++CONFIG_TARGET_MT7981=y ++CONFIG_RESET_BUTTON_LABEL="back" ++CONFIG_SYS_LOAD_ADDR=0x46000000 ++CONFIG_DEBUG_UART_BASE=0x11002000 ++CONFIG_DEBUG_UART_CLOCK=40000000 ++CONFIG_DEBUG_UART=y ++CONFIG_FIT=y ++CONFIG_SPI_BOOT=y ++CONFIG_AUTOBOOT_MENU_SHOW=y ++CONFIG_USE_PREBOOT=y ++CONFIG_DEFAULT_FDT_FILE="openwrt-one" ++CONFIG_SYS_CBSIZE=512 ++CONFIG_SYS_PBSIZE=1049 ++CONFIG_LOGLEVEL=7 ++CONFIG_LOG=y ++CONFIG_BOARD_LATE_INIT=y ++CONFIG_HUSH_PARSER=y ++CONFIG_SYS_PROMPT="OpenWrt One> " ++CONFIG_SYS_MAXARGS=16 ++CONFIG_CMD_CPU=y ++CONFIG_CMD_LICENSE=y ++# CONFIG_BOOTM_NETBSD is not set ++# CONFIG_BOOTM_PLAN9 is not set ++# CONFIG_BOOTM_RTEMS is not set ++# CONFIG_BOOTM_VXWORKS is not set ++# CONFIG_CMD_BOOTEFI_BOOTMGR is not set ++CONFIG_CMD_BOOTMENU=y ++CONFIG_CMD_ASKENV=y ++CONFIG_CMD_ERASEENV=y ++CONFIG_CMD_ENV_FLAGS=y ++CONFIG_CMD_STRINGS=y ++# CONFIG_CMD_UNLZ4 is not set ++# CONFIG_CMD_UNZIP is not set ++CONFIG_CMD_DM=y ++CONFIG_CMD_GPIO=y ++CONFIG_CMD_PWM=y ++CONFIG_CMD_MTD=y ++CONFIG_CMD_PCI=y ++CONFIG_CMD_SF_TEST=y ++CONFIG_CMD_USB=y ++CONFIG_CMD_TFTPSRV=y ++CONFIG_CMD_RARP=y ++CONFIG_CMD_CDP=y ++CONFIG_CMD_SNTP=y ++CONFIG_CMD_LINK_LOCAL=y ++CONFIG_CMD_DHCP=y ++CONFIG_CMD_DNS=y ++CONFIG_CMD_PING=y ++CONFIG_CMD_PXE=y ++CONFIG_CMD_CACHE=y ++CONFIG_CMD_PSTORE=y ++CONFIG_CMD_PSTORE_MEM_ADDR=0x42ff0000 ++CONFIG_CMD_UUID=y ++CONFIG_CMD_HASH=y ++CONFIG_CMD_SMC=y ++CONFIG_CMD_FAT=y ++CONFIG_CMD_FS_GENERIC=y ++CONFIG_CMD_FS_UUID=y ++CONFIG_CMD_UBI=y ++CONFIG_CMD_UBI_RENAME=y ++CONFIG_ENV_OVERWRITE=y ++CONFIG_SYS_REDUNDAND_ENVIRONMENT=y ++CONFIG_SYS_RELOC_GD_ENV_ADDR=y ++CONFIG_USE_DEFAULT_ENV_FILE=y ++CONFIG_DEFAULT_ENV_FILE="defenvs/openwrt-one-nor_env" ++CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y ++CONFIG_VERSION_VARIABLE=y ++CONFIG_NET_RANDOM_ETHADDR=y ++CONFIG_BUTTON=y ++CONFIG_BUTTON_GPIO=y ++CONFIG_CLK=y ++CONFIG_GPIO_HOG=y ++CONFIG_LED=y ++CONFIG_LED_BLINK=y ++CONFIG_LED_GPIO=y ++# CONFIG_MMC is not set ++CONFIG_MTD=y ++CONFIG_DM_MTD=y ++CONFIG_MTD_SPI_NAND=y ++CONFIG_DM_SPI_FLASH=y ++CONFIG_SPI_FLASH_SFDP_SUPPORT=y ++CONFIG_SPI_FLASH_EON=y ++CONFIG_SPI_FLASH_GIGADEVICE=y ++CONFIG_SPI_FLASH_ISSI=y ++CONFIG_SPI_FLASH_MACRONIX=y ++CONFIG_SPI_FLASH_SPANSION=y ++CONFIG_SPI_FLASH_STMICRO=y ++CONFIG_SPI_FLASH_WINBOND=y ++CONFIG_SPI_FLASH_XMC=y ++CONFIG_SPI_FLASH_XTX=y ++CONFIG_SPI_FLASH_MTD=y ++CONFIG_UBI_SILENCE_MSG=y ++CONFIG_PHY_FIXED=y ++CONFIG_MEDIATEK_ETH=y ++CONFIG_PHY=y ++CONFIG_PHY_MTK_TPHY=y ++CONFIG_PINCTRL=y ++CONFIG_PINCONF=y ++CONFIG_PINCTRL_MT7981=y ++CONFIG_POWER_DOMAIN=y ++CONFIG_MTK_POWER_DOMAIN=y ++CONFIG_DM_PWM=y ++CONFIG_PWM_MTK=y ++CONFIG_DM_SERIAL=y ++CONFIG_SERIAL_RX_BUFFER=y ++CONFIG_MTK_SERIAL=y ++CONFIG_SPI=y ++CONFIG_DM_SPI=y ++CONFIG_MTK_SPIM=y ++CONFIG_USB=y ++CONFIG_USB_XHCI_HCD=y ++CONFIG_USB_XHCI_MTK=y ++CONFIG_USB_STORAGE=y ++CONFIG_UBIFS_SILENCE_MSG=y ++CONFIG_HEXDUMP=y +--- /dev/null ++++ b/configs/mt7981_openwrt-one-spi-nand_defconfig +@@ -0,0 +1,126 @@ ++CONFIG_ARM=y ++CONFIG_SYS_HAS_NONCACHED_MEMORY=y ++CONFIG_POSITION_INDEPENDENT=y ++CONFIG_ARCH_MEDIATEK=y ++CONFIG_TEXT_BASE=0x41e00000 ++CONFIG_SYS_MALLOC_F_LEN=0x4000 ++CONFIG_NR_DRAM_BANKS=1 ++CONFIG_DEFAULT_DEVICE_TREE="openwrt-one" ++CONFIG_OF_LIBFDT_OVERLAY=y ++CONFIG_TARGET_MT7981=y ++CONFIG_RESET_BUTTON_LABEL="back" ++CONFIG_SYS_LOAD_ADDR=0x46000000 ++CONFIG_DEBUG_UART_BASE=0x11002000 ++CONFIG_DEBUG_UART_CLOCK=40000000 ++CONFIG_DEBUG_UART=y ++CONFIG_FIT=y ++CONFIG_SPI_BOOT=y ++CONFIG_AUTOBOOT_MENU_SHOW=y ++CONFIG_USE_PREBOOT=y ++CONFIG_DEFAULT_FDT_FILE="openwrt-one" ++CONFIG_SYS_CBSIZE=512 ++CONFIG_SYS_PBSIZE=1049 ++CONFIG_LOGLEVEL=7 ++CONFIG_LOG=y ++CONFIG_BOARD_LATE_INIT=y ++CONFIG_HUSH_PARSER=y ++CONFIG_SYS_PROMPT="OpenWrt One> " ++CONFIG_SYS_MAXARGS=16 ++CONFIG_CMD_CPU=y ++CONFIG_CMD_LICENSE=y ++# CONFIG_BOOTM_NETBSD is not set ++# CONFIG_BOOTM_PLAN9 is not set ++# CONFIG_BOOTM_RTEMS is not set ++# CONFIG_BOOTM_VXWORKS is not set ++# CONFIG_CMD_BOOTEFI_BOOTMGR is not set ++CONFIG_CMD_BOOTMENU=y ++CONFIG_CMD_ASKENV=y ++CONFIG_CMD_ERASEENV=y ++CONFIG_CMD_ENV_FLAGS=y ++CONFIG_CMD_STRINGS=y ++# CONFIG_CMD_UNLZ4 is not set ++# CONFIG_CMD_UNZIP is not set ++CONFIG_CMD_DM=y ++CONFIG_CMD_GPIO=y ++CONFIG_CMD_PWM=y ++CONFIG_CMD_MTD=y ++CONFIG_CMD_PCI=y ++CONFIG_CMD_SF_TEST=y ++CONFIG_CMD_USB=y ++CONFIG_CMD_TFTPSRV=y ++CONFIG_CMD_RARP=y ++CONFIG_CMD_CDP=y ++CONFIG_CMD_SNTP=y ++CONFIG_CMD_LINK_LOCAL=y ++CONFIG_CMD_DHCP=y ++CONFIG_CMD_DNS=y ++CONFIG_CMD_PING=y ++CONFIG_CMD_PXE=y ++CONFIG_CMD_CACHE=y ++CONFIG_CMD_PSTORE=y ++CONFIG_CMD_PSTORE_MEM_ADDR=0x42ff0000 ++CONFIG_CMD_UUID=y ++CONFIG_CMD_HASH=y ++CONFIG_CMD_SMC=y ++CONFIG_CMD_FAT=y ++CONFIG_CMD_FS_GENERIC=y ++CONFIG_CMD_FS_UUID=y ++CONFIG_CMD_UBI=y ++CONFIG_CMD_UBI_RENAME=y ++CONFIG_ENV_OVERWRITE=y ++CONFIG_ENV_IS_IN_UBI=y ++CONFIG_SYS_REDUNDAND_ENVIRONMENT=y ++CONFIG_ENV_UBI_PART="ubi" ++CONFIG_ENV_UBI_VOLUME="ubootenv" ++CONFIG_ENV_UBI_VOLUME_REDUND="ubootenv2" ++CONFIG_SYS_RELOC_GD_ENV_ADDR=y ++CONFIG_USE_DEFAULT_ENV_FILE=y ++CONFIG_DEFAULT_ENV_FILE="defenvs/openwrt-one-spi-nand_env" ++CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y ++CONFIG_VERSION_VARIABLE=y ++CONFIG_NET_RANDOM_ETHADDR=y ++CONFIG_BUTTON=y ++CONFIG_BUTTON_GPIO=y ++CONFIG_CLK=y ++CONFIG_GPIO_HOG=y ++CONFIG_LED=y ++CONFIG_LED_BLINK=y ++CONFIG_LED_GPIO=y ++# CONFIG_MMC is not set ++CONFIG_MTD=y ++CONFIG_DM_MTD=y ++CONFIG_MTD_SPI_NAND=y ++CONFIG_DM_SPI_FLASH=y ++CONFIG_SPI_FLASH_SFDP_SUPPORT=y ++CONFIG_SPI_FLASH_EON=y ++CONFIG_SPI_FLASH_GIGADEVICE=y ++CONFIG_SPI_FLASH_ISSI=y ++CONFIG_SPI_FLASH_MACRONIX=y ++CONFIG_SPI_FLASH_SPANSION=y ++CONFIG_SPI_FLASH_STMICRO=y ++CONFIG_SPI_FLASH_WINBOND=y ++CONFIG_SPI_FLASH_XMC=y ++CONFIG_SPI_FLASH_XTX=y ++CONFIG_SPI_FLASH_MTD=y ++CONFIG_PHY_FIXED=y ++CONFIG_MEDIATEK_ETH=y ++CONFIG_PHY=y ++CONFIG_PHY_MTK_TPHY=y ++CONFIG_PINCTRL=y ++CONFIG_PINCONF=y ++CONFIG_PINCTRL_MT7981=y ++CONFIG_POWER_DOMAIN=y ++CONFIG_MTK_POWER_DOMAIN=y ++CONFIG_DM_PWM=y ++CONFIG_PWM_MTK=y ++CONFIG_DM_SERIAL=y ++CONFIG_SERIAL_RX_BUFFER=y ++CONFIG_MTK_SERIAL=y ++CONFIG_SPI=y ++CONFIG_DM_SPI=y ++CONFIG_MTK_SPIM=y ++CONFIG_USB=y ++CONFIG_USB_XHCI_HCD=y ++CONFIG_USB_XHCI_MTK=y ++CONFIG_USB_STORAGE=y ++CONFIG_HEXDUMP=y +--- /dev/null ++++ b/defenvs/openwrt-one-nor_env +@@ -0,0 +1,48 @@ ++ethaddr_factory=mtd read factory 0x46000000 0x0 0x20000 && env readmem -b ethaddr 0x4600002a 0x6 ; setenv ethaddr_factory ++bl2_mtd_write=mtd erase bl2-nor && mtd write bl2-nor $loadaddr 0x0 0x40000 ++bl2_tftp_write=tftpboot $loadaddr $bootfile_bl2_nor && run bl2_mtd_write ++bootcmd=run check_button ; run led_start ; mtd read recovery ${loadaddr} ; bootm ; run led_loop_error ++bootconf=config-1 ++bootdelay=0 ++bootfile=openwrt-mediatek-filogic-openwrt_one-initramfs.itb ++bootfile_bl2_nor=openwrt-mediatek-filogic-openwrt_one-nor-preloader.bin ++bootfile_fip_nor=openwrt-mediatek-filogic-openwrt_one-nor-bl31-uboot.fip ++bootmenu_0=Initialize environment.=run _firstboot ++bootmenu_0d=Run default boot command.=run bootcmd ++bootmenu_1=Boot system via TFTP.=run tftp_boot ; run bootmenu_confirm_return ++bootmenu_2=[31mUnlock NOR. (Make sure the NOR/WP jumper is populated)[0m=sf probe 1:0 && sf protect unlock 0x0 0x1000000 ; run bootmenu_confirm_return ++bootmenu_3=[31mLoad BL31+U-Boot FIP via TFTP then write to NOR.[0m=run fip_tftp_write ; run bootmenu_confirm_return ++bootmenu_4=[31mLoad BL2 preloader via TFTP then write to NOR.[0m=run bl2_tftp_write ; run bootmenu_confirm_return ++bootmenu_5=[31mLoad recovery system via TFTP then write to NOR.[0m=run tftp_write ; run bootmenu_confirm_return ++bootmenu_6=[31mLock NOR. (Remove jumper afterwards)[0m=sf probe 1:0 && sf protect lock 0x0 0x1000000 ; run bootmenu_confirm_return ++bootmenu_7=Reboot.=reset ++bootmenu_confirm_return=askenv - Press ENTER to return to menu ; bootmenu 60 ++bootmenu_default=0 ++bootmenu_delay=0 ++bootmenu_title= [0;34m( ( ( [1;39mOpenWrt[0;34m ) ) ) [0;36m[SPI-NOR][0m ++check_button=if button front ; then run usb_recovery ; run led_loop_error ; fi ++fip_mtd_write=mtd erase fip-nor && mtd write fip-nor $loadaddr ++fip_tftp_write=tftpboot $loadaddr $bootfile_fip_nor && run fip_mtd_write ++ipaddr=192.168.11.11 ++led_done=led green off ; led white on ++led_loop_done=led white off ; led green on ; echo done ; while true ; do sleep 1 ; done ++led_loop_error=led white off ; led green off ; while true ; do led red on ; sleep 1 ; led red off ; sleep 1 ; done ++led_boot=led green on ; led white on ; led red on ++led_start=led green off ; led red off; led white on ++loadaddr=0x46000000 ++preboot=run led_boot ++recoverfile_bl2=openwrt-mediatek-filogic-openwrt_one-snand-preloader.bin ++recoverfile_ubi=openwrt-mediatek-filogic-openwrt_one-factory.ubi ++recovery_write_bl2=mtd erase bl2 && for offset in 0x0 0x40000 0x80000; do mtd write bl2 $loadaddr $offset 0x40000 ; done ++recovery_write_ubi=mtd erase ubi && mtd write ubi $loadaddr 0 ${filesize} ++serverip=192.168.11.23 ++tftp_boot=run led_start ; tftpboot $loadaddr $bootfile && bootm $loadaddr#$bootconf ++tftp_write=run led_start ; tftpboot $loadaddr $bootfile && mtd erase recovery 0x0 ${filesize} && mtd write recovery $loadaddr 0x0 ${filesize} ++usb_pgood_delay=4000 ++usb_recovery=run led_start ; usb start && run usb_recovery_bl2 && run usb_recovery_ubi && run led_loop_done ++usb_recovery_bl2=fatload usb 0:1 ${loadaddr} ${recoverfile_bl2} && run recovery_write_bl2 ++usb_recovery_ubi=fatload usb 0:1 ${loadaddr} ${recoverfile_ubi} && run recovery_write_ubi ++_firstboot=setenv _firstboot ; run ethaddr_factory ; run _switch_to_menu ; run _init_env ; bootmenu ++_init_env=setenv _init_env ; echo Initialize Env ; run ubi_create_env ; saveenv ++_switch_to_menu=setenv _switch_to_menu ; setenv bootdelay 3 ; setenv bootmenu_delay 3 ; setenv bootmenu_0 $bootmenu_0d ; setenv bootmenu_0d ; run _bootmenu_update_title ++_bootmenu_update_title=setenv _bootmenu_update_title ; setenv bootmenu_title "$bootmenu_title [33m$ver[0m" +--- /dev/null ++++ b/defenvs/openwrt-one-spi-nand_env +@@ -0,0 +1,62 @@ ++ethaddr_factory=mtd read factory 0x46000000 0x0 0x20000 && env readmem -b ethaddr 0x4600002a 0x6 ; setenv ethaddr_factory ++ipaddr=192.168.11.11 ++serverip=192.168.11.23 ++loadaddr=0x46000000 ++console=earlycon=uart8250,mmio32,0x11002000 console=ttyS0 ++bootcmd=run check_buttons ; run led_start ; run boot_calibration ; run boot_production ; run boot_recovery ++bootconf=config-1 ++bootdelay=0 ++bootfile=openwrt-mediatek-filogic-openwrt_one-initramfs.itb ++bootfile_bl2=openwrt-mediatek-filogic-openwrt_one-snand-preloader.bin ++bootfile_fip=openwrt-mediatek-filogic-openwrt_one-snand-bl31-uboot.fip ++bootfile_upg=openwrt-mediatek-filogic-openwrt_one-squashfs-sysupgrade.itb ++bootmenu_confirm_return=askenv - Press ENTER to return to menu ; run led_boot ; bootmenu 60 ++bootmenu_default=0 ++bootmenu_delay=0 ++bootmenu_title= [0;34m( ( ( [1;39mOpenWrt[0;34m ) ) ) [0;36m[SPI-NAND][0m ++bootmenu_0=Initialize environment.=run _firstboot ++bootmenu_0d=Run default boot command.=run boot_default ++bootmenu_1=Boot system via TFTP.=run boot_tftp ; run bootmenu_confirm_return ++bootmenu_2=Boot production system from NAND.=run boot_production ; run bootmenu_confirm_return ++bootmenu_3=Boot recovery system from NAND.=run boot_recovery ; run bootmenu_confirm_return ++bootmenu_4=Load production system via TFTP then write to NAND.=noboot=1 ; replacevol=1 ; run boot_tftp_production ; noboot= ; replacevol= ; run bootmenu_confirm_return ++bootmenu_5=Load recovery system via TFTP then write to NAND.=noboot=1 ; replacevol=1 ; run boot_tftp_recovery ; noboot= ; replacevol= ; run bootmenu_confirm_return ++bootmenu_6=[31mLoad BL31+U-Boot FIP via TFTP then write to NAND.[0m=run boot_tftp_write_fip ; run bootmenu_confirm_return ++bootmenu_7=[31mLoad BL2 preloader via TFTP then write to NAND.[0m=run boot_tftp_write_bl2 ; run bootmenu_confirm_return ++bootmenu_8=Reboot.=reset ++bootmenu_9=Reset all settings to factory defaults.=run reset_factory ; reset ++boot_default=run bootcmd ; run boot_recovery ; replacevol=1 ; run boot_tftp_forever ++boot_calibration=ubi read $loadaddr calibration && bootm $loadaddr#$bootconf ++boot_production=led white on ; run ubi_read_production && bootm $loadaddr#$bootconf ; led white off ++boot_recovery=led green on ; run ubi_read_recovery && bootm $loadaddr#$bootconf ; led green off ++boot_tftp=run led_start ; tftpboot $loadaddr $bootfile && bootm $loadaddr#$bootconf ++boot_tftp_forever=led green off ; led white off ; led red on ; while true ; do run boot_tftp_recovery ; led red off ; sleep 1 ; done ++boot_tftp_production=tftpboot $loadaddr $bootfile_upg && test $replacevol = 1 && iminfo $loadaddr && run ubi_write_production ; if test $noboot = 1 ; then else bootm $loadaddr#$bootconf ; fi ++boot_tftp_recovery=tftpboot $loadaddr $bootfile && test $replacevol = 1 && iminfo $loadaddr && run ubi_write_recovery ; if test $noboot = 1 ; then else bootm $loadaddr#$bootconf ; fi ++boot_tftp=tftpboot $loadaddr $bootfile && bootm $loadaddr#$bootconf ++boot_tftp_write_fip=tftpboot $loadaddr $bootfile_fip && run ubi_write_fip && run reset_factory ++boot_tftp_write_bl2=tftpboot $loadaddr $bootfile_bl2 && run snand_write_bl2 ++check_buttons=if button front ; then run boot_recovery ; run boot_tftp ; run led_loop_error ; else if button back ; then ; run usb_recover ; run led_loop_error ; fi ; fi ++led_boot=led green on ; led white on ; led red on ++led_done=led green on ; led white off ; led red off ++led_loop_done=led white off ; led green on ; echo done ; while true ; do sleep 1 ; done ++led_loop_error=led white off ; led green off ; while true ; do led red on ; sleep 1 ; led red off ; sleep 1 ; done ++led_start=led white on ; led green off ; led red off ++preboot=run led_boot ++reset_factory=mw $loadaddr 0xff 0x1f000 ; ubi write $loadaddr ubootenv 0x1f000 ; ubi write $loadaddr ubootenv2 0x1f000 ; ubi remove rootfs_data ++snand_write_bl2=mtd erase bl2 && for offset in 0x0 0x40000 0x80000 0xc0000 ; do mtd write bl2 $loadaddr $offset 0x40000 ; done ++ubi_create_env=ubi check ubootenv || ubi create ubootenv 0x1f000 dynamic ; ubi check ubootenv2 || ubi create ubootenv2 0x1f000 dynamic ++ubi_prepare_rootfs=if ubi check rootfs_data ; then else if env exists rootfs_data_max ; then ubi create rootfs_data $rootfs_data_max dynamic || ubi create rootfs_data - dynamic ; else ubi create rootfs_data - dynamic ; fi ; fi ++ubi_read_production=ubi read $loadaddr fit && iminfo $loadaddr && run ubi_prepare_rootfs ++ubi_read_recovery=ubi check recovery && ubi read $loadaddr recovery ++ubi_remove_rootfs=ubi check rootfs_data && ubi remove rootfs_data ++usb_pgood_delay=4000 ++usb_recover=run led_start ; usb start && run usb_recover_production && run led_loop_done ++usb_recover_production=fatload usb 0:1 ${loadaddr} ${bootfile_upg} && iminfo $loadaddr && run ubi_write_production ++ubi_write_fip=run ubi_remove_rootfs ; ubi check fip && ubi remove fip ; ubi create fip $filesize static && ubi write $loadaddr fip $filesize ++ubi_write_production=ubi check fit && ubi remove fit ; run ubi_remove_rootfs ; ubi create fit $filesize dynamic && ubi write $loadaddr fit $filesize ++ubi_write_recovery=ubi check recovery && ubi remove recovery ; run ubi_remove_rootfs ; ubi create recovery $filesize dynamic && ubi write $loadaddr recovery $filesize ++_init_env=setenv _init_env ; run ubi_create_env ; saveenv ; saveenv ++_firstboot=setenv _firstboot ; run ethaddr_factory ; run _switch_to_menu ; run _init_env ; bootmenu ++_switch_to_menu=setenv _switch_to_menu ; setenv bootdelay 3 ; setenv bootmenu_delay 3 ; setenv bootmenu_0 $bootmenu_0d ; setenv bootmenu_0d ; run _bootmenu_update_title ++_bootmenu_update_title=setenv _bootmenu_update_title ; setenv bootmenu_title "$bootmenu_title [33m$ver[0m" |