liminix/default.nix

106 lines
2.7 KiB
Nix
Raw Normal View History

{
2024-03-22 22:55:44 +01:00
deviceName ? null
, device ? (import ./devices/${deviceName} )
, liminix-config ? <liminix-config>
2023-02-05 23:38:21 +01:00
, nixpkgs ? <nixpkgs>
2023-02-20 18:46:07 +01:00
, borderVmConf ? ./bordervm.conf.nix
}:
let
overlay = import ./overlay.nix;
2023-02-05 23:38:21 +01:00
pkgs = import nixpkgs (device.system // {
overlays = [ overlay ];
2023-02-20 18:46:07 +01:00
config = {
allowUnsupportedSystem = true; # mipsel
permittedInsecurePackages = [
"python-2.7.18.8" # kernel backports needs python <3
2023-02-20 18:46:07 +01:00
];
};
});
2023-02-11 00:10:44 +01:00
evalModules = (import ./lib/eval-config.nix {
inherit nixpkgs pkgs;
inherit (pkgs) lib;
});
eval = evalModules {
modules = [
{
nixpkgs.overlays = [
overlay
];
}
device.module
liminix-config
];
};
config = eval.config;
2022-10-05 22:52:30 +02:00
borderVm = ((import <nixpkgs/nixos/lib/eval-config.nix>) {
system = builtins.currentSystem;
modules = [
{
nixpkgs.overlays = [
(final: prev: {
go-l2tp = final.callPackage ./pkgs/go-l2tp {};
tufted = final.callPackage ./pkgs/tufted {};
})
];
}
(import ./bordervm-configuration.nix)
2023-02-20 18:46:07 +01:00
borderVmConf
];
2023-02-14 23:08:52 +01:00
}).config.system;
in rec {
inherit evalModules;
outputs = config.system.outputs // {
default = config.system.outputs.${config.hardware.defaultOutput};
optionsJson =
let o = import ./doc/extract-options.nix {
inherit pkgs eval;
lib = pkgs.lib;
};
in pkgs.writeText "options.json" (builtins.toJSON o);
2023-02-11 00:10:44 +01:00
};
2022-09-25 14:18:26 +02: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-07 00:19:35 +01:00
inherit pkgs;
deployEnv = pkgs.mkShell {
packages = with pkgs.pkgsBuildBuild; [
tufted
min-copy-closure
];
};
2023-02-08 19:10:11 +01:00
buildEnv = pkgs.mkShell {
packages = with pkgs.pkgsBuildBuild; [
tufted
routeros.routeros
routeros.ros-exec-script
2023-09-20 19:33:08 +02:00
run-liminix-vm
2023-02-14 23:08:52 +01:00
borderVm.build.vm
go-l2tp
2023-05-12 00:53:25 +02:00
min-copy-closure
fennelrepl
2024-01-23 12:56:34 +01:00
lzma
2024-04-06 13:30:41 +02:00
lua
2023-02-08 19:10:11 +01:00
];
};
try-nand = pkgs.pkgsBuildBuild.writeShellScriptBin "try-nand.sh" ''
rootfs=$(mktemp)
cp ${outputs.default}/rootfs $rootfs
${pkgs.pkgsBuildBuild.qemuLim}/bin/qemu-system-mips \
-M malta -echr 16 -m 272 \
-device nand,chip_id=0x59,id=nand -drive format=raw,file=''${rootfs},if=mtd,id=nand \
-serial mon:stdio -kernel ${outputs.default}/vmlinux \
-append "root=/dev/mtdblock0 console=ttyS0,115200 panic=10 oops=panic init=/bin/init loglevel=8 root=/dev/mtdblock0 rootfstype=squashfs fw_devlink=off mem=256M liminix mtdparts=phram0:16M(rootfs) phram.phram=phram0,0x90000000,16Mi,65536" \
-display none
rm $rootfs
'';
}