Skip to content

Commit 0d17924

Browse files
committed
init
0 parents  commit 0d17924

File tree

6 files changed

+180
-0
lines changed

6 files changed

+180
-0
lines changed

.github/workflows/build-iso.yaml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: "Build ISO"
2+
on:
3+
push:
4+
pull_request:
5+
types: [opened, synchronize, reopened]
6+
7+
jobs:
8+
build:
9+
strategy:
10+
fail-fast: false
11+
matrix:
12+
plattform: [x86_64-linux]
13+
include:
14+
- plattform: x86_64-linux
15+
type: iso
16+
attrPath: config.system.build.isoImage
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: actions/checkout@v3
20+
- uses: cachix/install-nix-action@v23
21+
with:
22+
nix_path: nixpkgs=channel:nixos-23.05
23+
extra_nix_config: |
24+
system-features = aarch64-linux arm-linux
25+
- run: |
26+
DEBIAN_FRONTEND=noninteractive
27+
sudo apt-get update -q -y && sudo apt-get install -q -y tree qemu-system-aarch64 qemu-efi binfmt-support qemu-user-static
28+
- run: nix-build '<nixpkgs/nixos>' -A ${{ matrix.attrPath }} -I nixos-config=${{ matrix.type }}.nix --argstr system ${{ matrix.plattform }}
29+
- run: tree result
30+
- uses: actions/upload-artifact@v3
31+
with:
32+
name: ${{ matrix.plattform }}-${{ matrix.type }}
33+
path: result/${{ matrix.type }}/
34+
if-no-files-found: error
35+
retention-days: 5
36+
37+
38+
create_release:
39+
runs-on: ubuntu-latest
40+
needs:
41+
- build
42+
if: startsWith(github.ref, 'refs/tags/v')
43+
permissions:
44+
contents: write
45+
steps:
46+
- name: Download all artifacts
47+
uses: actions/download-artifact@v3
48+
- name: Display structure of artifacts
49+
run: ls -R
50+
- name: Create Release & Upload Release Assets
51+
uses: softprops/action-gh-release@v1
52+
with:
53+
# Note: If there is no release name specified, releases created in
54+
# the GitHub UI do not trigger a failure and are modified instead.
55+
draft: false
56+
prerelease: false
57+
# Note: Release notes are only auto-generated if the release was
58+
# created by the Github Action and was not created in the Github UI.
59+
generate_release_notes: true
60+
files: |
61+
./*/*.iso

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
result

README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# network-setup-mode-trigger-os
2+
3+
4+
## Usage
5+
6+
1. Downaload the provided ISO
7+
2. Copy it onto an USB Stick (for example https://etcher.balena.io/ could be used)
8+
3. Interrupt your normal Boot and instead boot from the USB
9+
4. once booted type `sudo send-network-request enp1s0` to start sending the reset packages on the specified interface
10+
5. connect the wired Network Port of your PC to the unpowered side of an PoE Injector (please do at least a tripple check)
11+
6. connect your AP to the powered side of the PoE Injector, wait a few seconds
12+
7. press Ctrl+C to abort sending the packages
13+
8. (optional) after a while you should be able to ssh into your device with `ssh [email protected]`. You can terminate the connection with `exit`
14+
9. type "systemctl poweroff" to turn your PC off
15+
10. remove the USB stick and start your PC as you normaly would
16+
11. until the AP loses power it's in the Setup/Config Mode and can be accessed as any other Freifunk Router via 192.168.1.1
17+

configuration.nix

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
2+
{ config, pkgs, lib, ... }:
3+
{
4+
#isoImage.squashfsCompression = "gzip -Xcompression-level 1";
5+
6+
services.openssh.enable = lib.mkForce false;
7+
services.openssh.settings.PermitRootLogin = lib.mkForce "prohibit-password";
8+
9+
time.timeZone = "Europe/Berlin";
10+
11+
networking.hostName = "setup-mode-trigger";
12+
13+
console = {
14+
font = "Lat2-Terminus16";
15+
keyMap = lib.mkForce "de";
16+
useXkbConfig = true;
17+
};
18+
19+
environment.systemPackages = with pkgs; [
20+
htop
21+
nano
22+
wget
23+
curl
24+
tcpdump
25+
ethtool
26+
tmux
27+
(import ./ffda-network-setup-mode.nix)
28+
];
29+
30+
networking = {
31+
useNetworkd = true;
32+
usePredictableInterfaceNames = true;
33+
useDHCP = false;
34+
};
35+
36+
services.getty.helpLine = lib.mkForce ''
37+
#####################################################################
38+
# #
39+
# Run `sudo send-network-request enp1s0` to start sending requests. #
40+
# #
41+
#####################################################################
42+
'';
43+
44+
systemd.network = {
45+
networks = {
46+
"99-default" = {
47+
matchConfig.Name = "*";
48+
networkConfig = {
49+
IPv6AcceptRA = true;
50+
DHCP = "yes";
51+
};
52+
};
53+
};
54+
};
55+
56+
}

ffda-network-setup-mode.nix

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
let
2+
pkgs = import <nixpkgs> {};
3+
in
4+
5+
with pkgs;
6+
7+
stdenv.mkDerivation {
8+
pname = "ffda-network-setup-mode";
9+
version = "0.1";
10+
11+
src = fetchgit {
12+
url = "https://github.com/freifunk-gluon/community-packages.git";
13+
rev = "ca08c5446221cee0fc3d65b7dff2f12101a3ca59";
14+
sha256 = "sha256-c2gXp1JFBU2NgGlfuyVj9PkK8Y/+5Iq6BahxxS//V2o=";
15+
sparseCheckout = [
16+
"ffda-network-setup-mode/src"
17+
];
18+
deepClone = false;
19+
};
20+
21+
buildPhase = ''
22+
gcc ffda-network-setup-mode/src/send-network-request.c
23+
'';
24+
25+
installPhase = ''
26+
mkdir -p $out/bin
27+
cp a.out $out/bin/send-network-request
28+
'';
29+
30+
meta = with lib; {
31+
description = "send network setup mode packages over specified interface";
32+
};
33+
}

iso.nix

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{ config, pkgs, ... }:
2+
{
3+
imports = [
4+
<nixpkgs/nixos/modules/installer/cd-dvd/installation-cd-minimal.nix>
5+
6+
# Provide an initial copy of the NixOS channel so that the user
7+
# doesn't need to run "nix-channel --update" first.
8+
<nixpkgs/nixos/modules/installer/cd-dvd/channel.nix>
9+
10+
./configuration.nix
11+
];
12+
}

0 commit comments

Comments
 (0)