From ec1e07797565493defe63cdc0a9ee0845cbe1df7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Max=20K=C3=A4nner?= Date: Thu, 13 Feb 2025 12:13:49 +0100 Subject: [PATCH] add ssh iso --- flake.nix | 55 +++++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 41 insertions(+), 14 deletions(-) diff --git a/flake.nix b/flake.nix index 23924bd..b81d4b2 100644 --- a/flake.nix +++ b/flake.nix @@ -44,21 +44,48 @@ }; }; in { - nixosConfigurations."MaxNixosLaptop" = nixpkgs.lib.nixosSystem { - inherit system; - specialArgs = { - inherit inputs pkgs system; + nixosConfigurations = { + "MaxNixosLaptop" = nixpkgs.lib.nixosSystem { + inherit system; + specialArgs = { + inherit inputs pkgs system; + }; + modules = [ + ./hosts/MaxNixosLaptop/configuration.nix + sops-nix.nixosModules.sops + home-manager.nixosModules.default + { + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + } + musnix.nixosModules.musnix + ]; + }; + ServerIso = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + modules = [ + #./machine.nix + (nixpkgs + + "/nixos/modules/installer/cd-dvd/installation-cd-minimal.nix") + (nixpkgs + "/nixos/modules/installer/cd-dvd/channel.nix") + ({ pkgs, ... }: { + # Enable SSH in the boot process. + systemd.services.sshd.wantedBy = + pkgs.lib.mkForce [ "multi-user.target" ]; + users.users.root.openssh.authorizedKeys.keys = [ + # your ssh key + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOLRNvgrjnBizuruEm6htmvc6F1uGath9T7WjAh6ogPD root@host" + ]; + isoImage.squashfsCompression = "gzip -Xcompression-level 1"; + networking = { + usePredictableInterfaceNames = false; + useDHCP = true; + nameservers = [ "1.1.1.1" ]; + hostName = "host"; + }; + }) + ]; }; - modules = [ - ./hosts/MaxNixosLaptop/configuration.nix - sops-nix.nixosModules.sops - home-manager.nixosModules.default - { - home-manager.useGlobalPkgs = true; - home-manager.useUserPackages = true; - } - musnix.nixosModules.musnix - ]; }; }; }