liminix

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

vanilla-configuration.nix (1436B)


      1 { config, pkgs, ... } :
      2 let
      3   inherit (pkgs.liminix.networking) interface address udhcpc odhcpc route;
      4   inherit (pkgs.liminix.services) oneshot longrun bundle target;
      5   inherit (pkgs) writeText;
      6 in rec {
      7   imports = [
      8     ./modules/tftpboot.nix
      9     ./modules/wlan.nix
     10     ./modules/ntp
     11   ];
     12   services.loopback = config.hardware.networkInterfaces.lo;
     13 
     14   services.dhcpv4 =
     15     let iface = interface { type = "hardware"; device = "eth1"; };
     16     in udhcpc iface {};
     17 
     18   services.dhcpv6 =
     19     let iface = interface { type = "hardware"; device = "eth1"; };
     20     in odhcpc iface { uid = "e7"; };
     21 
     22   services.defaultroute4 = route {
     23     name = "defautlrote";
     24     via = "$(output ${services.dhcpv4} address)";
     25     target = "default";
     26     dependencies = [ services.dhcpv4 ];
     27   };
     28 
     29   services.packet_forwarding =
     30     let
     31       iface = services.dhcpv4;
     32       filename = "/proc/sys/net/ipv4/conf/$(output ${iface} ifname)/forwarding";
     33     in oneshot {
     34       name = "let-the-ip-flow";
     35       up = "echo 1 > ${filename}";
     36       down = "echo 0 > ${filename}";
     37       dependencies = [iface];
     38     };
     39 
     40   services.ntp = config.system.service.ntp.build {
     41     pools = { "pool.ntp.org" = ["iburst"] ; };
     42   };
     43 
     44   services.default = target {
     45     name = "default";
     46     contents = with services; [ loopback ntp defaultroute4 ];
     47   };
     48 
     49   boot.tftp = {
     50     serverip = "192.168.8.148";
     51     ipaddr = "192.168.8.251";
     52   };
     53 
     54   defaultProfile.packages = [ pkgs.hello ] ;
     55 }