Skip to content

Commit d1f1b8d

Browse files
committed
Merge branch 'add-nixfmt-in-ci'
2 parents 7c7f94a + 4dd4937 commit d1f1b8d

File tree

6 files changed

+176
-92
lines changed

6 files changed

+176
-92
lines changed

.github/workflows/nixfmt.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
name: Nix - Check formatting
3+
on:
4+
pull_request:
5+
paths:
6+
- .github/workflows/nixfmt.yml
7+
- '**/*.nix'
8+
workflow_dispatch:
9+
10+
permissions: {}
11+
12+
jobs:
13+
check-formatting:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout repository
17+
uses: actions/checkout@v4
18+
19+
- name: Install Nix
20+
uses: cachix/install-nix-action@v27
21+
22+
- name: Install nixfmt-tree
23+
run: nix shell nixpkgs#nixfmt-tree --command treefmt --ci

ci/ios/test-router/app-team-ios-lab.nix

Lines changed: 33 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,59 @@
1-
{ config, lib, pkgs, modulesPath, ... }:
1+
{
2+
config,
3+
lib,
4+
pkgs,
5+
modulesPath,
6+
...
7+
}:
28

39
{
4-
imports =
5-
[ (modulesPath + "/installer/scan/not-detected.nix")
6-
];
10+
imports = [
11+
(modulesPath + "/installer/scan/not-detected.nix")
12+
];
713

814
nixpkgs.config.allowUnfree = true;
915
hardware.enableAllFirmware = true;
1016
hardware.firmware = [ pkgs.wireless-regdb ];
11-
boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usbhid" "usb_storage" "sd_mod" "sdhci_pci" ];
17+
boot.initrd.availableKernelModules = [
18+
"xhci_pci"
19+
"ahci"
20+
"nvme"
21+
"usbhid"
22+
"usb_storage"
23+
"sd_mod"
24+
"sdhci_pci"
25+
];
1226
boot.initrd.kernelModules = [ ];
1327
boot.kernelModules = [ "kvm-intel" ];
1428
boot.extraModulePackages = [ ];
1529
boot.extraModprobeConfig = ''
1630
options iwlmvm power_scheme=1
1731
options iwlwifi disable_11ac=1
1832
options iwlwifi disable_11ax= 1
19-
'';
33+
'';
2034
boot.loader.systemd-boot.enable = true;
2135
boot.loader.efi.canTouchEfiVariables = true;
2236
boot.kernelPackages = pkgs.linuxPackages_6_6;
2337

2438
services.fwupd.enable = true;
2539

26-
27-
fileSystems."/" =
28-
{ device = "/dev/disk/by-uuid/40974b12-1be6-4e2b-b8b2-57123f4d60ce";
29-
fsType = "ext4";
30-
};
31-
32-
fileSystems."/boot" =
33-
{ device = "/dev/disk/by-uuid/0C9E-5CDB";
34-
fsType = "vfat";
35-
options = [ "fmask=0077" "dmask=0077" ];
36-
};
40+
fileSystems."/" = {
41+
device = "/dev/disk/by-uuid/40974b12-1be6-4e2b-b8b2-57123f4d60ce";
42+
fsType = "ext4";
43+
};
44+
45+
fileSystems."/boot" = {
46+
device = "/dev/disk/by-uuid/0C9E-5CDB";
47+
fsType = "vfat";
48+
options = [
49+
"fmask=0077"
50+
"dmask=0077"
51+
];
52+
};
3753

3854
swapDevices = [ ];
3955

4056
networking.useDHCP = lib.mkDefault false;
4157
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
4258
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
4359
}
44-

ci/ios/test-router/flake.nix

Lines changed: 45 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,52 @@
11
{
22
description = "Config for our testing router";
33

4-
inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11"; };
4+
inputs = {
5+
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11";
6+
};
57

6-
outputs = { self, nixpkgs }: {
7-
nixosConfigurations.app-team-ios-lab = nixpkgs.lib.nixosSystem {
8-
system = "x86_64-linux";
9-
modules = [
10-
(import ./router-config.nix {
11-
hostname = "app-team-ios-tests";
12-
lanMac = "a0:ce:c8:ab:bd:2d";
13-
wanMac = "88:ae:dd:64:e1:55";
14-
lanIp = "192.168.105.1/24";
15-
})
16-
./app-team-ios-lab.nix
17-
{
18-
boot.loader.systemd-boot.enable = true;
19-
boot.loader.efi.canTouchEfiVariables = true;
20-
hardware = {
21-
cpu.intel.updateMicrocode = true;
22-
enableRedistributableFirmware = true;
23-
};
24-
}
25-
];
26-
};
8+
outputs =
9+
{ self, nixpkgs }:
10+
{
11+
nixosConfigurations.app-team-ios-lab = nixpkgs.lib.nixosSystem {
12+
system = "x86_64-linux";
13+
modules = [
14+
(import ./router-config.nix {
15+
hostname = "app-team-ios-tests";
16+
lanMac = "a0:ce:c8:ab:bd:2d";
17+
wanMac = "88:ae:dd:64:e1:55";
18+
lanIp = "192.168.105.1/24";
19+
})
20+
./app-team-ios-lab.nix
21+
{
22+
boot.loader.systemd-boot.enable = true;
23+
boot.loader.efi.canTouchEfiVariables = true;
24+
hardware = {
25+
cpu.intel.updateMicrocode = true;
26+
enableRedistributableFirmware = true;
27+
};
28+
}
29+
];
30+
};
2731

28-
nixosConfigurations.app-team-ios-lab-iso = nixpkgs.lib.nixosSystem {
29-
system = "x86_64-linux";
30-
modules = [
31-
(import ./router-config.nix {
32-
hostname = "app-team-ios-tests";
33-
lanMac = "48:21:0b:36:bb:52";
34-
wanMac = "48:21:0b:36:43:a3";
35-
lanIp = "192.168.105.1/24";
36-
})
37-
"${nixpkgs}/nixos/modules/installer/cd-dvd/installation-cd-minimal.nix"
38-
{
39-
isoImage.squashfsCompression = "lz4";
40-
}
41-
];
42-
};
32+
nixosConfigurations.app-team-ios-lab-iso = nixpkgs.lib.nixosSystem {
33+
system = "x86_64-linux";
34+
modules = [
35+
(import ./router-config.nix {
36+
hostname = "app-team-ios-tests";
37+
lanMac = "48:21:0b:36:bb:52";
38+
wanMac = "48:21:0b:36:43:a3";
39+
lanIp = "192.168.105.1/24";
40+
})
41+
"${nixpkgs}/nixos/modules/installer/cd-dvd/installation-cd-minimal.nix"
42+
{
43+
isoImage.squashfsCompression = "lz4";
44+
}
45+
];
46+
};
4347

44-
packages.x86_64-linux.raas =
45-
with import nixpkgs { system = "x86_64-linux"; };
46-
pkgs.callPackage ./raas.nix {};
47-
};
48+
packages.x86_64-linux.raas =
49+
with import nixpkgs { system = "x86_64-linux"; };
50+
pkgs.callPackage ./raas.nix { };
51+
};
4852
}

ci/ios/test-router/nftables.nix

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{ lib, config, ... }:
2-
with lib; let
2+
with lib;
3+
let
34
cfg = config.services.nftables;
45
in
56
{

ci/ios/test-router/raas.nix

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
1-
{ pkgs, rustPlatform, pkg-config, libmnl, libnftnl, libpcap, ... }:
1+
{
2+
pkgs,
3+
rustPlatform,
4+
pkg-config,
5+
libmnl,
6+
libnftnl,
7+
libpcap,
8+
...
9+
}:
210

311
rustPlatform.buildRustPackage rec {
412
pname = "raas";
@@ -8,5 +16,9 @@ rustPlatform.buildRustPackage rec {
816
cargoLock.lockFile = ./raas/Cargo.lock;
917

1018
nativeBuildInputs = [ pkg-config ];
11-
buildInputs = [ libmnl libnftnl libpcap ];
19+
buildInputs = [
20+
libmnl
21+
libnftnl
22+
libpcap
23+
];
1224
}

ci/ios/test-router/router-config.nix

Lines changed: 59 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
1-
args@{ hostname
2-
, # hostname of the router
3-
lanMac ? null
4-
, # MAC address of the local area network interface
5-
wanMac
6-
, # MAC address of the upstream interface
7-
lanIp
8-
, # IP adderss/subnet
1+
args@{
2+
hostname,
3+
# hostname of the router
4+
lanMac ? null,
5+
# MAC address of the local area network interface
6+
wanMac,
7+
# MAC address of the upstream interface
8+
lanIp, # IP adderss/subnet
99
}:
1010

11-
{ config, pkgs, lib, ... }:
11+
{
12+
config,
13+
pkgs,
14+
lib,
15+
...
16+
}:
1217
let
1318
ifNotNull = maybeNull: attrSet: lib.attrsets.optionalAttrs (!builtins.isNull maybeNull) attrSet;
1419
in
@@ -28,7 +33,14 @@ in
2833
services.nftables.internetHostOverride = gatewayAddress;
2934
services.nftables.lanInterfaces = "lan";
3035

31-
environment.systemPackages = with pkgs; [ htop vim curl dig tcpdump cargo ];
36+
environment.systemPackages = with pkgs; [
37+
htop
38+
vim
39+
curl
40+
dig
41+
tcpdump
42+
cargo
43+
];
3244

3345
networking.hostName = args.hostname;
3446
networking.useDHCP = true;
@@ -54,7 +66,9 @@ in
5466
};
5567
};
5668

57-
networking = { firewall.enable = false; };
69+
networking = {
70+
firewall.enable = false;
71+
};
5872
hardware.bluetooth.enable = false;
5973

6074
boot.kernel.sysctl = {
@@ -85,23 +99,28 @@ in
8599

86100
networking.wireguard.interfaces.staging = {
87101
privateKeyFile = "/staging-wg-private-key";
88-
ips = [ "10.64.9.184/32" "fc00:bbbb:bbbb:bb01::a40:9b8/128" ];
102+
ips = [
103+
"10.64.9.184/32"
104+
"fc00:bbbb:bbbb:bb01::a40:9b8/128"
105+
];
89106
allowedIPsAsRoutes = true;
90107
# postSetup could be used to dynamically fetch the IP of the staging API and set up the route to that IP through this interface too.
91108
# postSetup = '''';
92-
peers = [{
93-
publicKey = "2KS+F8ZAOUSMwygl2CYqkqFhbi3L5u58b3kIpaylaEk=";
94-
name = "se-sto-wg-001-staging";
95-
endpoint = "85.203.53.81:51820";
96-
allowedIPs = [
97-
# api.stagemole.eu
98-
"185.217.116.129/32"
99-
# api-app.stagemole.eu
100-
"185.217.116.132/32"
101-
# api-partners.stagemole.eu
102-
"185.217.116.131/32"
103-
];
104-
}];
109+
peers = [
110+
{
111+
publicKey = "2KS+F8ZAOUSMwygl2CYqkqFhbi3L5u58b3kIpaylaEk=";
112+
name = "se-sto-wg-001-staging";
113+
endpoint = "85.203.53.81:51820";
114+
allowedIPs = [
115+
# api.stagemole.eu
116+
"185.217.116.129/32"
117+
# api-app.stagemole.eu
118+
"185.217.116.132/32"
119+
# api-partners.stagemole.eu
120+
"185.217.116.131/32"
121+
];
122+
}
123+
];
105124
};
106125

107126
systemd.network.enable = true;
@@ -125,7 +144,9 @@ in
125144
UseDNS = true;
126145
};
127146

128-
dhcpV6Config = { UseDNS = true; };
147+
dhcpV6Config = {
148+
UseDNS = true;
149+
};
129150
};
130151

131152
# obtain all leases
@@ -142,7 +163,6 @@ in
142163
linkConfig.RequiredForOnline = "enslaved";
143164
};
144165

145-
146166
systemd.network.networks.lan = {
147167
name = "lan";
148168
address = [ "192.168.105.1/24" ];
@@ -157,7 +177,10 @@ in
157177

158178
dhcpServerConfig = {
159179
ServerAddress = "192.168.105.1/24";
160-
DNS = [ "1.1.1.1" "1.0.0.1" ];
180+
DNS = [
181+
"1.1.1.1"
182+
"1.0.0.1"
183+
];
161184
PoolOffset = 128;
162185
EmitDNS = true;
163186
EmitNTP = true;
@@ -197,7 +220,10 @@ in
197220

198221
services.openssh = {
199222
enable = true;
200-
ports = [ 22 2021 ];
223+
ports = [
224+
22
225+
2021
226+
];
201227
settings.PermitRootLogin = "yes";
202228
};
203229

@@ -217,7 +243,10 @@ in
217243
enable = true;
218244
description = "Web service to apply blocking firewall rules";
219245
bindsTo = [ "sys-subsystem-net-devices-lan.device" ];
220-
after = [ "systemd-networkd.service" "network-online.target" ];
246+
after = [
247+
"systemd-networkd.service"
248+
"network-online.target"
249+
];
221250
wantedBy = [ "multi-user.target" ];
222251
serviceConfig.ExecStart = ''
223252
${raas}/bin/raas ${listenAddress}:80

0 commit comments

Comments
 (0)