2022-10-06 23:24:35 +00:00
|
|
|
{
|
2023-01-29 20:29:36 +00:00
|
|
|
device
|
2023-01-29 09:23:09 +00:00
|
|
|
, liminix-config ? <liminix-config>
|
2023-02-05 22:38:21 +00:00
|
|
|
, nixpkgs ? <nixpkgs>
|
2022-09-19 22:51:38 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
|
|
|
overlay = import ./overlay.nix;
|
2023-02-05 22:38:21 +00:00
|
|
|
pkgs = import nixpkgs (device.system // {
|
2023-02-10 17:54:33 +00:00
|
|
|
overlays = [overlay];
|
2023-01-29 10:00:13 +00:00
|
|
|
config = {allowUnsupportedSystem = true; };
|
|
|
|
});
|
2023-02-10 23:10:44 +00:00
|
|
|
|
2023-02-13 20:30:12 +00:00
|
|
|
config = (import ./lib/merge-modules.nix) [
|
2022-09-25 12:17:21 +00:00
|
|
|
./modules/base.nix
|
2023-02-10 17:54:33 +00:00
|
|
|
device.module
|
2023-01-29 09:23:09 +00:00
|
|
|
liminix-config
|
2022-09-27 09:19:44 +00:00
|
|
|
./modules/s6
|
2022-09-28 20:31:15 +00:00
|
|
|
./modules/users.nix
|
2023-02-10 23:10:44 +00:00
|
|
|
./modules/outputs.nix
|
2023-02-05 22:38:21 +00:00
|
|
|
] pkgs;
|
2022-10-05 20:52:30 +00:00
|
|
|
|
2023-02-14 22:08:52 +00:00
|
|
|
borderVm = ((import <nixpkgs/nixos>) {
|
|
|
|
configuration =
|
|
|
|
{ config, ... }:
|
|
|
|
{
|
|
|
|
imports = [
|
|
|
|
<nixpkgs/nixos/modules/virtualisation/qemu-vm.nix>
|
|
|
|
];
|
|
|
|
boot.kernelParams = [
|
|
|
|
"loglevel=9"
|
|
|
|
];
|
|
|
|
systemd.services.pppoe =
|
|
|
|
let conf = pkgs.writeText "kpppoed.toml"
|
|
|
|
''
|
|
|
|
interface_name = "eth0"
|
|
|
|
services = [ "myservice" ]
|
|
|
|
lns_ipaddr = "90.155.53.19"
|
|
|
|
ac_name = "kpppoed-1.0"
|
|
|
|
'';
|
|
|
|
in {
|
|
|
|
wantedBy = [ "multi-user.target" ];
|
|
|
|
serviceConfig = {
|
|
|
|
ExecStart = "${pkgs.pkgsBuildBuild.go-l2tp}/bin/kpppoed -config ${conf}";
|
|
|
|
};
|
|
|
|
};
|
2023-02-15 20:45:44 +00:00
|
|
|
systemd.services.tufted = {
|
|
|
|
wantedBy = [ "multi-user.target" ];
|
|
|
|
serviceConfig = {
|
|
|
|
ExecStart = "${pkgs.pkgsBuildBuild.tufted}/bin/tufted /home/liminix/liminix";
|
|
|
|
};
|
|
|
|
};
|
2023-02-14 22:08:52 +00:00
|
|
|
virtualisation = {
|
|
|
|
qemu = {
|
|
|
|
networkingOptions = [];
|
|
|
|
options = [
|
|
|
|
"-device vfio-pci,host=01:00.0"
|
|
|
|
"-nographic"
|
|
|
|
"-serial mon:stdio"
|
|
|
|
];
|
|
|
|
};
|
|
|
|
sharedDirectories = {
|
|
|
|
liminix = {
|
|
|
|
source = builtins.toString ./.;
|
|
|
|
target = "/home/liminix/liminix";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
2023-02-15 20:46:11 +00:00
|
|
|
environment.systemPackages = with pkgs.pkgsBuildBuild; [
|
|
|
|
tcpdump
|
|
|
|
wireshark
|
|
|
|
socat
|
|
|
|
tufted
|
|
|
|
iptables
|
|
|
|
];
|
2023-02-14 22:08:52 +00:00
|
|
|
security.sudo.wheelNeedsPassword = false;
|
|
|
|
networking = {
|
|
|
|
hostName = "border";
|
|
|
|
firewall = { enable = false; };
|
2023-02-15 20:45:44 +00:00
|
|
|
interfaces.eth1 = {
|
|
|
|
useDHCP = false;
|
|
|
|
ipv4.addresses = [ { address = "10.0.0.1"; prefixLength = 24;}];
|
|
|
|
};
|
2023-02-14 22:08:52 +00:00
|
|
|
};
|
|
|
|
users.users.liminix = {
|
|
|
|
isNormalUser = true;
|
|
|
|
uid = 1000;
|
|
|
|
extraGroups = [ "wheel"];
|
|
|
|
};
|
|
|
|
services.getty.autologinUser = "liminix";
|
|
|
|
};
|
|
|
|
}).config.system;
|
2022-10-03 21:28:15 +00:00
|
|
|
in {
|
2023-02-10 23:10:44 +00:00
|
|
|
outputs = config.outputs // {
|
|
|
|
default = config.outputs.${config.device.defaultOutput};
|
|
|
|
};
|
2022-10-03 21:28:15 +00:00
|
|
|
|
2022-09-25 12:18:26 +00:00
|
|
|
# this is just here as a convenience, so that we can get a
|
|
|
|
# cross-compiling nix-shell for any package we're customizing
|
2023-02-06 23:19:35 +00:00
|
|
|
inherit pkgs;
|
2023-02-08 00:03:37 +00:00
|
|
|
|
2023-02-08 18:10:11 +00:00
|
|
|
buildEnv = pkgs.mkShell {
|
|
|
|
packages = with pkgs.pkgsBuildBuild; [
|
|
|
|
tufted
|
|
|
|
routeros.routeros
|
|
|
|
routeros.ros-exec-script
|
2023-02-08 22:16:39 +00:00
|
|
|
mips-vm
|
2023-02-14 22:08:52 +00:00
|
|
|
borderVm.build.vm
|
|
|
|
go-l2tp
|
2023-02-08 18:10:11 +00:00
|
|
|
];
|
|
|
|
};
|
2022-09-20 17:54:27 +00:00
|
|
|
}
|