save more space by using python3 minimal

This commit is contained in:
Jörg Thalheim 2024-09-24 21:53:37 +02:00
parent 8650b1df8f
commit 881fad4fe0
4 changed files with 27 additions and 2 deletions

View file

@ -1,7 +1,14 @@
{ config, lib, modulesPath, pkgs, ... }: { config, lib, modulesPath, pkgs, ... }:
let let
restore-network = pkgs.writers.writePython3Bin "restore-network" { flakeIgnore = [ "E501" ]; } writePython3 = pkgs.writers.makePythonWriter
./restore_routes.py; pkgs.python3Minimal pkgs.python3Packages pkgs.buildPackages.python3Packages;
# writePython3Bin takes the same arguments as writePython3 but outputs a directory (like writeScriptBin)
writePython3Bin = name: writePython3 "/bin/${name}";
restore-network = writePython3Bin "restore-network" {
flakeIgnore = [ "E501" ];
} ./restore_routes.py;
# does not link with iptables enabled # does not link with iptables enabled
iprouteStatic = pkgs.pkgsStatic.iproute2.override { iptables = null; }; iprouteStatic = pkgs.pkgsStatic.iproute2.override { iptables = null; };

View file

@ -12,6 +12,7 @@
imports = [ imports = [
./zfs-minimal.nix ./zfs-minimal.nix
./no-bootloaders.nix ./no-bootloaders.nix
./python-minimal.nix
./noveau-workaround.nix ./noveau-workaround.nix
# reduce closure size by removing perl # reduce closure size by removing perl
"${modulesPath}/profiles/perlless.nix" "${modulesPath}/profiles/perlless.nix"

15
nix/python-minimal.nix Normal file
View file

@ -0,0 +1,15 @@
{
nixpkgs.overlays = [
(final: prev: {
bcachefs-tools = prev.bcachefs-tools.overrideAttrs (old: {
python3 = prev.python3Minimal;
});
cifs-utils = prev.cifs-utils.overrideAttrs (old: {
python3 = prev.python3Minimal;
});
nfs-utils = prev.nfs-utils.overrideAttrs (old: {
python3 = prev.python3Minimal;
});
})
];
}

View file

@ -4,6 +4,8 @@ let
zfs = pkgs.zfsUnstable.override { zfs = pkgs.zfsUnstable.override {
# this overrides saves 10MB # this overrides saves 10MB
samba = pkgs.coreutils; samba = pkgs.coreutils;
python3 = pkgs.python3Minimal;
}; };
in in
{ {