From 04df4d0a987c9d3e2acf1e93b0750a8a1856d24d Mon Sep 17 00:00:00 2001 From: Luke Granger-Brown Date: Sat, 27 Aug 2022 19:38:03 +0100 Subject: [PATCH] depotwide: make closures smaller, especially on frantech machines --- ops/nixos/installcd/default.nix | 2 ++ ops/nixos/lib/blade.nix | 8 +------- ops/nixos/lib/common.nix | 2 ++ ops/nixos/lib/frantech.nix | 1 + .../lib/home-manager/{blade.nix => minimal.nix} | 0 ops/nixos/lib/minimal.nix | 13 +++++++++++++ third_party/tvl/nix/buildGo/default.nix | 5 +++-- 7 files changed, 22 insertions(+), 9 deletions(-) rename ops/nixos/lib/home-manager/{blade.nix => minimal.nix} (100%) create mode 100644 ops/nixos/lib/minimal.nix diff --git a/ops/nixos/installcd/default.nix b/ops/nixos/installcd/default.nix index a33dc4efad..be1ac06aa4 100644 --- a/ops/nixos/installcd/default.nix +++ b/ops/nixos/installcd/default.nix @@ -16,5 +16,7 @@ in { depot.ops.nixos.systems.etheroute-lon01 ]; + system.disableInstallerTools = false; + system.stateVersion = "22.05"; } diff --git a/ops/nixos/lib/blade.nix b/ops/nixos/lib/blade.nix index c128ce9b55..775bfa9bac 100644 --- a/ops/nixos/lib/blade.nix +++ b/ops/nixos/lib/blade.nix @@ -7,6 +7,7 @@ let inherit (depot.ops) secrets; in { imports = [ + ../lib/minimal.nix ../lib/zfs.nix ]; @@ -49,7 +50,6 @@ in { ]; my.rundeck.tags = [ "blade" ]; - my.home-manager.imports = lib.mkAfter [ ./home-manager/blade.nix ]; fileSystems = let zfs = device: { @@ -224,12 +224,6 @@ in { ProcessSizeMax=0 ''; - fonts.fontconfig.enable = false; - programs.ssh.setXAuthLocation = false; - security.pam.services.su.forwardXAuth = lib.mkForce false; - services.fwupd.enable = lib.mkForce false; - xdg.sounds.enable = false; - system.stateVersion = "21.05"; }; } diff --git a/ops/nixos/lib/common.nix b/ops/nixos/lib/common.nix index 9979a36b40..60f7a7f6a2 100644 --- a/ops/nixos/lib/common.nix +++ b/ops/nixos/lib/common.nix @@ -329,5 +329,7 @@ in ListenStream = [ "" "${config.my.ip.tailscale}:19531" ]; FreeBind = true; }; + + system.disableInstallerTools = lib.mkDefault true; }; } diff --git a/ops/nixos/lib/frantech.nix b/ops/nixos/lib/frantech.nix index 05459d3185..f63aed1c40 100644 --- a/ops/nixos/lib/frantech.nix +++ b/ops/nixos/lib/frantech.nix @@ -9,6 +9,7 @@ in { imports = [ ../../../third_party/nixpkgs/nixos/modules/profiles/qemu-guest.nix ../lib/low-space.nix + ../lib/minimal.nix ../lib/coredns/default.nix ]; diff --git a/ops/nixos/lib/home-manager/blade.nix b/ops/nixos/lib/home-manager/minimal.nix similarity index 100% rename from ops/nixos/lib/home-manager/blade.nix rename to ops/nixos/lib/home-manager/minimal.nix diff --git a/ops/nixos/lib/minimal.nix b/ops/nixos/lib/minimal.nix new file mode 100644 index 0000000000..a2f8ef28b1 --- /dev/null +++ b/ops/nixos/lib/minimal.nix @@ -0,0 +1,13 @@ +# SPDX-FileCopyrightText: 2022 Luke Granger-Brown +# +# SPDX-License-Identifier: Apache-2.0 + +{ lib, ... }: +{ + fonts.fontconfig.enable = false; + programs.ssh.setXAuthLocation = false; + security.pam.services.su.forwardXAuth = lib.mkForce false; + services.fwupd.enable = lib.mkForce false; + xdg.sounds.enable = false; + my.home-manager.imports = lib.mkAfter [ ./home-manager/minimal.nix ]; +} diff --git a/third_party/tvl/nix/buildGo/default.nix b/third_party/tvl/nix/buildGo/default.nix index f8928f25fb..8d039647f5 100644 --- a/third_party/tvl/nix/buildGo/default.nix +++ b/third_party/tvl/nix/buildGo/default.nix @@ -35,7 +35,8 @@ let includeLibs = deps: spaceOut (map includeDepLib deps); srcBasename = src: elemAt (match "([a-z0-9]{32}\-)?(.*\.go)" (baseNameOf src)) 1; - srcCopy = path: src: "cp ${src} $out/${path}/${srcBasename src}"; + srcDest = path: src: "$out/${path}/${srcBasename src}"; + srcCopy = path: src: "cp ${src} ${srcDest path src}"; srcList = path: srcs: lib.concatStringsSep "\n" (map (srcCopy path) srcs); allDeps = deps: lib.unique (lib.flatten (deps ++ (map (d: d.goDeps) deps))); @@ -89,7 +90,7 @@ let mkdir -p $out/${path} ${srcList path (map (s: "${s}") srcs)} ${asmBuild} - ${go}/bin/go tool compile -pack ${asmLink} -o $out/${path}.a -trimpath=$PWD -trimpath=${go} -p ${path} ${includeSources uniqueDeps} ${spaceOut srcs} + ${go}/bin/go tool compile -pack ${asmLink} -o $out/${path}.a -trimpath=$PWD -trimpath=${go} -trimpath=$out/${path} -p ${path} ${includeSources uniqueDeps} ${spaceOut (map (srcDest path) srcs)} ${asmPack} '').overrideAttrs (_: { passthru = {