From cacff10e47750e73c9b0b2f5d84cc827a3d865af Mon Sep 17 00:00:00 2001 From: sinavir Date: Tue, 23 Jan 2024 13:41:45 +0100 Subject: [PATCH] router: remove from main. Dev is know made on dev-router branch --- machines/router/build.sh | 6 ---- machines/router/configuration.nix | 51 --------------------------- machines/router/default.nix | 15 -------- machines/router/liminix-dtbsize.patch | 23 ------------ machines/router/npins/default.nix | 47 ------------------------ machines/router/npins/sources.json | 22 ------------ machines/router/serve.sh | 3 -- machines/router/shell.nix | 10 ------ 8 files changed, 177 deletions(-) delete mode 100755 machines/router/build.sh delete mode 100644 machines/router/configuration.nix delete mode 100644 machines/router/default.nix delete mode 100644 machines/router/liminix-dtbsize.patch delete mode 100644 machines/router/npins/default.nix delete mode 100644 machines/router/npins/sources.json delete mode 100755 machines/router/serve.sh delete mode 100644 machines/router/shell.nix diff --git a/machines/router/build.sh b/machines/router/build.sh deleted file mode 100755 index 1d75718..0000000 --- a/machines/router/build.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env bash -# - -mkdir output/ - -nom-build -A outputs.tftpboot -o output/result diff --git a/machines/router/configuration.nix b/machines/router/configuration.nix deleted file mode 100644 index c45e4bc..0000000 --- a/machines/router/configuration.nix +++ /dev/null @@ -1,51 +0,0 @@ -# This is an example configuration for a "typical" small office/home -# router and wifi access point. - -# You need to copy it to another filename and change the configuration -# wherever the text "EDIT" appears - please consult the tutorial -# documentation for details. - -{ config, pkgs, lib, modulesPath, ... } : -let - liminix = (import ./npins).liminix; - inherit (pkgs.liminix.services) bundle oneshot longrun; - inherit (pkgs) serviceFns; - # EDIT: you can pick your preferred RFC1918 address space - # for NATted connections, if you don't like this one. - svc = config.system.service; - -in rec { - boot = { - tftp = { - freeSpaceBytes = 3 * 1024 * 1024; - serverip = "10.0.0.1"; - ipaddr = "10.0.0.8"; - }; - }; - - hardware.flash.eraseBlockSize = 126976; - - imports = [ - "${liminix}/modules/network" - "${liminix}/modules/ssh" - "${liminix}/modules/outputs/ubimage.nix" - ]; - rootfsType = "ubifs"; - hostname = "hackens-router"; # EDIT - - services.int = svc.network.address.build { - interface = config.hardware.networkInterfaces.wan; - family = "inet"; - address = "10.0.0.8"; - prefixLength = 24; - }; - - services.sshd = svc.ssh.build { }; - - users.root = { - # EDIT: choose a root password and then use - # "mkpasswd -m sha512crypt" to determine the hash. - # It should start wirh $6$. - passwd = "$6$9XlVymX951ai.c2C$SYtEF2Ykcud8VRuLRxfQRfuc9h7oJpVo.xDEv6fTWjBngMj3bPN9GbFMv3r.T.K2wIj1rTo9j1m58G.GTPKWo/"; - }; -} diff --git a/machines/router/default.nix b/machines/router/default.nix deleted file mode 100644 index 61593c3..0000000 --- a/machines/router/default.nix +++ /dev/null @@ -1,15 +0,0 @@ -{ liminix ? (import ./npins).liminix -, nixpkgs ? (import ./npins).nixpkgs -, liminix-config ? ./configuration.nix -}: -let - patchedLiminix = pkgs.applyPatches { - name = "liminix-patched"; - src = liminix; - patches = [ - ./liminix-dtbsize.patch - ]; - }; - pkgs = import nixpkgs {}; -in -(import patchedLiminix { inherit nixpkgs liminix-config; device = import (patchedLiminix + "/devices/belkin-rt3200"); }) diff --git a/machines/router/liminix-dtbsize.patch b/machines/router/liminix-dtbsize.patch deleted file mode 100644 index 62ac925..0000000 --- a/machines/router/liminix-dtbsize.patch +++ /dev/null @@ -1,23 +0,0 @@ -diff --git a/modules/outputs/tftpboot.nix b/modules/outputs/tftpboot.nix -index ad6ed63..9773042 100644 ---- a/modules/outputs/tftpboot.nix -+++ b/modules/outputs/tftpboot.nix -@@ -73,8 +73,6 @@ in { - rootfsStart=${toString cfg.loadAddress} - rootfsSize=$(binsize64k ${o.rootfs} ) - dtbStart=$(($rootfsStart + $rootfsSize)) -- dtbSize=$(binsize ${o.dtb} ) -- imageStart=$(($dtbStart + $dtbSize)) - imageSize=$(binsize ${image}) - - ln -s ${o.manifest} manifest -@@ -102,6 +100,9 @@ in { - fdtput -p -t s dtb /reserved-memory/$node compatible phram - fdtput -p -t lx dtb /reserved-memory/$node reg $ac_prefix $(hex $rootfsStart) $sz_prefix $(hex $rootfsSize) - -+ dtbSize=$(binsize ./dtb ) -+ imageStart=$(($dtbStart + $dtbSize)) -+ - cmd="liminix ${cmdline} mtdparts=phram0:''${rootfsSize}(rootfs) phram.phram=phram0,''${rootfsStart},''${rootfsSize},${toString config.hardware.flash.eraseBlockSize} root=/dev/mtdblock0"; - fdtput -t s dtb /chosen bootargs "$cmd" - diff --git a/machines/router/npins/default.nix b/machines/router/npins/default.nix deleted file mode 100644 index 4a7c372..0000000 --- a/machines/router/npins/default.nix +++ /dev/null @@ -1,47 +0,0 @@ -# Generated by npins. Do not modify; will be overwritten regularly -let - data = builtins.fromJSON (builtins.readFile ./sources.json); - version = data.version; - - mkSource = spec: - assert spec ? type; let - path = - if spec.type == "Git" then mkGitSource spec - else if spec.type == "GitRelease" then mkGitSource spec - else if spec.type == "PyPi" then mkPyPiSource spec - else if spec.type == "Channel" then mkChannelSource spec - else builtins.throw "Unknown source type ${spec.type}"; - in - spec // { outPath = path; }; - - mkGitSource = { repository, revision, url ? null, hash, ... }: - assert repository ? type; - # At the moment, either it is a plain git repository (which has an url), or it is a GitHub/GitLab repository - # In the latter case, there we will always be an url to the tarball - if url != null then - (builtins.fetchTarball { - inherit url; - sha256 = hash; # FIXME: check nix version & use SRI hashes - }) - else assert repository.type == "Git"; builtins.fetchGit { - url = repository.url; - rev = revision; - # hash = hash; - }; - - mkPyPiSource = { url, hash, ... }: - builtins.fetchurl { - inherit url; - sha256 = hash; - }; - - mkChannelSource = { url, hash, ... }: - builtins.fetchTarball { - inherit url; - sha256 = hash; - }; -in -if version == 3 then - builtins.mapAttrs (_: mkSource) data.pins -else - throw "Unsupported format version ${toString version} in sources.json. Try running `npins upgrade`" diff --git a/machines/router/npins/sources.json b/machines/router/npins/sources.json deleted file mode 100644 index 09b0326..0000000 --- a/machines/router/npins/sources.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "pins": { - "liminix": { - "type": "Git", - "repository": { - "type": "Git", - "url": "https://gti.telent.net/dan/liminix" - }, - "branch": "main", - "revision": "83ee488e4c81124380b8bd4ff8183e632f30eb91", - "url": null, - "hash": "08mpx615kpqzvwallf91gdqv8rhc2avdgfwldka598ynydlq1wnw" - }, - "nixpkgs": { - "type": "Channel", - "name": "nixpkgs-unstable", - "url": "https://releases.nixos.org/nixpkgs/nixpkgs-24.05pre572676.b06ff4bf8f4a/nixexprs.tar.xz", - "hash": "1alh0waf9hjhxqnxwkmc6g1fq9h1m498g269yncdnhhkiglg73kx" - } - }, - "version": 3 -} \ No newline at end of file diff --git a/machines/router/serve.sh b/machines/router/serve.sh deleted file mode 100755 index a9f8ca1..0000000 --- a/machines/router/serve.sh +++ /dev/null @@ -1,3 +0,0 @@ -#! /usr/bin/env bash - -sudo capsh --keep=1 --user="$USER" --inh='cap_net_bind_service' --addamb='cap_net_bind_service' -- -c 'tftpy_server.py -r ./output' diff --git a/machines/router/shell.nix b/machines/router/shell.nix deleted file mode 100644 index aba32c6..0000000 --- a/machines/router/shell.nix +++ /dev/null @@ -1,10 +0,0 @@ -let - pkgs = import (import ./npins).nixpkgs {}; -in - pkgs.mkShell { - packages = with pkgs; [ - python3.pkgs.tftpy - minicom - ]; - - }