diff --git a/flake.nix b/flake.nix index d44a11b9..15f46307 100644 --- a/flake.nix +++ b/flake.nix @@ -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' diff --git a/lib/default.nix b/lib/default.nix index e5084f88..77570252 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -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" diff --git a/nixos/minimal.nix b/nixos/minimal.nix new file mode 100644 index 00000000..b32c9d30 --- /dev/null +++ b/nixos/minimal.nix @@ -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; +}