router: remove from main. Dev is know made on dev-router branch

This commit is contained in:
sinavir 2024-01-23 13:41:45 +01:00
parent fc28547693
commit cacff10e47
8 changed files with 0 additions and 177 deletions

View file

@ -1,6 +0,0 @@
#!/usr/bin/env bash
#
mkdir output/
nom-build -A outputs.tftpboot -o output/result

View file

@ -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/";
};
}

View file

@ -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"); })

View file

@ -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"

View file

@ -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`"

View file

@ -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
}

View file

@ -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'

View file

@ -1,10 +0,0 @@
let
pkgs = import (import ./npins).nixpkgs {};
in
pkgs.mkShell {
packages = with pkgs; [
python3.pkgs.tftpy
minicom
];
}