Testing a 'minimal' image for Linode

This commit is contained in:
iFargle 2023-09-21 20:31:55 +09:00
parent 33352e6963
commit e55ffc6b9d
3 changed files with 79 additions and 1 deletions

View file

@ -58,7 +58,7 @@
imageConfigurations = {
nixos-rpi4-img = libx.mkImage { hostname = "nixos-rpi4-img"; platform = "aarch64-linux"; format = "sd-aarch64"; };
nixos-iso-console = libx.mkImage { hostname = "nixos-iso-console"; format = "iso"; };
nixos-linode-img = libx.mkImage { hostname = "nixos-linode-img"; format = "linode"; };
nixos-linode-img = libx.mkMinImage { hostname = "nixos-linode-img"; format = "linode"; };
};
# Devshell for bootstrapping; acessible via 'nix develop'

View file

@ -58,6 +58,32 @@
];
};
# Combines mkHost and mkHome for image building
mkMinImage = {
hostname ,
username ? "albert",
desktop ? null,
platform ? "x86_64-linux",
gpu ? null,
theme ? "default",
format
}:
inputs.nixos-generators.nixosGenerate {
specialArgs = { inherit inputs outputs desktop hostname username stateVersion hmStateVersion gpu platform theme format; };
format = format;
system = platform;
modules = [
../nixos/minimal.nix
inputs.sops-nix.nixosModules.sops
inputs.lanzaboote.nixosModules.lanzaboote
# inputs.home-manager.nixosModules.home-manager {
# home-manager.extraSpecialArgs = { inherit inputs outputs desktop hostname username hmStateVersion stateVersion gpu platform theme format; };
# home-manager.users."${username}" = import ../home-manager;
# }
];
};
forAllSystems = inputs.nixpkgs.lib.genAttrs [
"aarch64-linux"
"x86_64-linux"

52
nixos/minimal.nix Normal file
View file

@ -0,0 +1,52 @@
{ lib, config, pkgs, hostname, stateVersion, username, desktop, gpu, inputs, platform, theme, ... }: {
imports = [
# Services
./common/services/openssh.nix
./common/services/fail2ban.nix
# NixOS Modules
./common/modules/networking.nix # Initial Networking configs
./common/modules/nixos.nix # NixOS related items
./users/${username}
./hosts/${hostname}
] ++ lib.optional (builtins.isString desktop) ./common/desktops/${desktop};
# List packages installed in system profile
environment.systemPackages = with pkgs; [
sbctl
wget
killall
curl
rsync
git
duf
ncdu
du-dust
btop
iftop
nload
iotop
sops
gnupg
cryptsetup
parted
screen
];
# Select internationalisation properties.
i18n.defaultLocale = "en_US.UTF-8";
i18n.extraLocaleSettings = {
LC_ADDRESS = "en_US.UTF-8";
LC_IDENTIFICATION = "en_US.UTF-8";
LC_MEASUREMENT = "en_US.UTF-8";
LC_MONETARY = "en_US.UTF-8";
LC_NAME = "en_US.UTF-8";
LC_NUMERIC = "en_US.UTF-8";
LC_PAPER = "en_US.UTF-8";
LC_TELEPHONE = "en_US.UTF-8";
LC_TIME = "en_US.UTF-8";
};
system.stateVersion = stateVersion;
}