depotwide: make closures smaller, especially on frantech machines

This commit is contained in:
Luke Granger-Brown 2022-08-27 19:38:03 +01:00
parent c01a1fee3a
commit 04df4d0a98
7 changed files with 22 additions and 9 deletions

View file

@ -16,5 +16,7 @@ in {
depot.ops.nixos.systems.etheroute-lon01
];
system.disableInstallerTools = false;
system.stateVersion = "22.05";
}

View file

@ -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";
};
}

View file

@ -329,5 +329,7 @@ in
ListenStream = [ "" "${config.my.ip.tailscale}:19531" ];
FreeBind = true;
};
system.disableInstallerTools = lib.mkDefault true;
};
}

View file

@ -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
];

13
ops/nixos/lib/minimal.nix Normal file
View file

@ -0,0 +1,13 @@
# SPDX-FileCopyrightText: 2022 Luke Granger-Brown <depot@lukegb.com>
#
# 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 ];
}

View file

@ -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 = {