From b5fbf1f472b86e9d051bd00952c78422d7d2de7f Mon Sep 17 00:00:00 2001 From: Luke Granger-Brown Date: Wed, 13 Apr 2022 12:03:56 +0000 Subject: [PATCH] oracle-lon01: add my first aarch64-linux boxen --- ci-root.nix | 4 ++ nix/pkgs/bazel-run.nix | 5 +-- ops/nixos/default.nix | 8 ++-- ops/nixos/lib/common.nix | 4 ++ ops/nixos/lib/coredns/zones/db.as205479.net | 6 ++- ops/nixos/oracle-lon01/default.nix | 44 +++++++++++++++++++++ third_party/default.nix | 5 +++ 7 files changed, 69 insertions(+), 7 deletions(-) create mode 100644 ops/nixos/oracle-lon01/default.nix diff --git a/ci-root.nix b/ci-root.nix index 525815f6f6..0c97fafac1 100644 --- a/ci-root.nix +++ b/ci-root.nix @@ -31,6 +31,10 @@ let factorio = depot.ops.factorio; home-manager = depot.ops.home-manager-ext.built; }; + aarch64-linux = builtins.removeAttrs x86_64-linux [ "home-manager" ] // { + pkgs = builtins.removeAttrs x86_64-linux.pkgs [ "lutris" ]; + + }; x86_64-darwin = { home-manager = depot.ops.home-manager-ext.built; }; diff --git a/nix/pkgs/bazel-run.nix b/nix/pkgs/bazel-run.nix index e9100335f8..636d550900 100644 --- a/nix/pkgs/bazel-run.nix +++ b/nix/pkgs/bazel-run.nix @@ -2,7 +2,7 @@ # # SPDX-License-Identifier: Apache-2.0 -{ pkgs, ... }: +{ pkgs, lib, system, ... }: let bazelTop = pkgs.buildFHSUserEnv { name = "bazel-wrap"; @@ -15,9 +15,8 @@ let pkgs.nodejs pkgs.yarn pkgs.git - pkgs.jetbrains.idea-community pkgs.gcc - ]; + ] ++ lib.optional (system == "x86_64-linux") pkgs.jetbrains.idea-community; }; in bazelTop // { override = x: bazelTop; } diff --git a/ops/nixos/default.nix b/ops/nixos/default.nix index c9a3e24189..939b04d178 100644 --- a/ops/nixos/default.nix +++ b/ops/nixos/default.nix @@ -2,9 +2,10 @@ # # SPDX-License-Identifier: Apache-2.0 -{ depot, lib, pkgs, ... }@args: +{ depot, lib, pkgs, system, ... }@args: let inherit (builtins) foldl' mapAttrs; + inherit (lib) filterAttrs; baseModule = name: { ... }: { _module.args = args // { rebuilder = rebuilder name; @@ -13,7 +14,7 @@ let }; systemFor = systemName: config: (depot.third_party.nixeval { - system = builtins.currentSystem; + inherit system; modules = [ (baseModule systemName) (args: { imports = [ lib/common.nix config ]; }) ]; }); systems = [ @@ -44,11 +45,12 @@ let "bvm-heptapod" "bvm-logger" "bvm-paperless" + "oracle-lon01" ]; rebuilder = system: (import ./lib/rebuilder.nix (args // { system = system; })); systemCfgs = lib.genAttrs systems (name: import (./. + "/${name}")); - evaledSystems = mapAttrs systemFor systemCfgs; + evaledSystems = lib.filterAttrs (n: v: v.config.my.systemType == system) (mapAttrs systemFor systemCfgs); systemDrvs = mapAttrs (_: sys: sys.config.system.build.toplevel) evaledSystems; systemTailscaleIPs = lib.mapAttrs' (n: v: lib.nameValuePair v [n]) (lib.filterAttrs (n: v: v != null) (mapAttrs (_: sys: sys.config.my.ip.tailscale) evaledSystems)); diff --git a/ops/nixos/lib/common.nix b/ops/nixos/lib/common.nix index 4f385987d4..b12b86885d 100644 --- a/ops/nixos/lib/common.nix +++ b/ops/nixos/lib/common.nix @@ -29,6 +29,10 @@ in type = lib.types.nullOr lib.types.str; default = null; }; + options.my.systemType = lib.mkOption { + type = lib.types.str; + default = "x86_64-linux"; + }; options.my.rundeck.hostname = lib.mkOption { type = lib.types.str; diff --git a/ops/nixos/lib/coredns/zones/db.as205479.net b/ops/nixos/lib/coredns/zones/db.as205479.net index 125b38d242..90122b1466 100644 --- a/ops/nixos/lib/coredns/zones/db.as205479.net +++ b/ops/nixos/lib/coredns/zones/db.as205479.net @@ -3,7 +3,7 @@ ; SPDX-License-Identifier: Apache-2.0 ; MNAME RNAME SERIAL REFRESH RETRY EXPIRE TTL -@ 600 IN SOA frantech-lux01.as205479.net. hostmaster.lukegb.com. 47 600 450 3600 300 +@ 600 IN SOA frantech-lux01.as205479.net. hostmaster.lukegb.com. 48 600 450 3600 300 ; NB: this are also glue records in Google Domains. $INCLUDE tmpl.ns @@ -54,6 +54,10 @@ etheroute-lon01 3600 IN A 83.97.19.68 etheroute-lon01 3600 IN AAAA 2a07:242:800:64::68 etheroute-lon01.int 3600 IN A 100.111.191.21 +oracle-lon01 3600 IN A 130.162.184.67 +; oracle-lon01 has no AAAA yet :( +oracle-lon01.int 3600 IN A 100.93.85.40 + kusakabe 3600 IN A 188.165.197.49 kusakabe 3600 IN AAAA 2001:41d0:2:8e31::1 kusakabe.int 3600 IN A 100.101.38.52 diff --git a/ops/nixos/oracle-lon01/default.nix b/ops/nixos/oracle-lon01/default.nix new file mode 100644 index 0000000000..a4ed8a3e27 --- /dev/null +++ b/ops/nixos/oracle-lon01/default.nix @@ -0,0 +1,44 @@ +# SPDX-FileCopyrightText: 2022 Luke Granger-Brown +# +# SPDX-License-Identifier: Apache-2.0 + +{ depot, lib, pkgs, config, modulesPath, ... }: +{ + imports = [ + "${modulesPath}/profiles/qemu-guest.nix" + ]; + + powerManagement.cpuFreqGovernor = lib.mkDefault "performance"; + + fileSystems = { + "/" = { device = "/dev/mapper/ocivolume-root"; fsType = "xfs"; }; + "/boot" = { device = "/dev/sda2"; fsType = "xfs"; }; + "/boot/efi" = { device = "/dev/sda1"; fsType = "vfat"; }; + }; + + nix.settings.max-jobs = lib.mkDefault 4; + + boot.loader.efi.canTouchEfiVariables = true; + boot.loader.efi.efiSysMountPoint = "/boot/efi"; + boot.loader.systemd-boot.enable = true; + + networking = { + hostName = "oracle-lon01"; + domain = "as205479.net"; + hostId = "3a5eb800"; + + nameservers = [ + "2001:4860:4860::8888" + "2001:4860:4860::8844" + "8.8.8.8" + "8.8.4.4" + ]; + interfaces.enp0s3.useDHCP = true; + }; + my.ip.tailscale = "100.93.85.40"; + my.systemType = "aarch64-linux"; + + nix.gc.automatic = false; + + system.stateVersion = "22.05"; +} diff --git a/third_party/default.nix b/third_party/default.nix index 0551c07747..40461c57fa 100644 --- a/third_party/default.nix +++ b/third_party/default.nix @@ -12,6 +12,11 @@ let packageOverrides = pkgs: { factorio = pkgs.factorio.override depot.ops.secrets.factorio; factorio-experimental = pkgs.factorio-experimental.override depot.ops.secrets.factorio; + delve = pkgs.delve.overrideAttrs (oldAttrs: { + meta = oldAttrs.meta // { + platforms = oldAttrs.meta.platforms ++ [ "aarch64-linux" ]; + }; + }); }; }; nixpkgs = import ./nixpkgs {