summaryrefslogtreecommitdiff
path: root/hosts/turret/default.nix
blob: faac3d25f1c0ab76947edc147f8aee33c51616bc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
{
  pkgs,
  openwrt-imagebuilder,
  ...
}: let
  inherit (pkgs) runCommand;
  inherit (pkgs.stdenv) mkDerivation;
  inherit (openwrt-imagebuilder.lib) build profiles;
  wrtProfiles = profiles {
    inherit pkgs;
    release = "22.03.3";
  };
  config = mkDerivation {
    name = "openwrt-config-files";
    src = ./files;
    installPhase = ''
      mkdir -p $out
      cp -r * $out/
    '';
  };
  image =
    wrtProfiles.identifyProfile "netgear_wac104"
    // {
      packages = ["https-dns-proxy"];

      files = runCommand "image-files" {} ''
        mkdir -p $out/etc/uci-defaults
        cat > $out/etc/uci-defaults/99-custom <<EOF
        uci -q batch << EOI
        set system.@system[0].hostname='turret'
        commit
        EOI
        EOF
        cp -fr ${config}/etc/* $out/etc/
      '';
    };
in
  build image