From fbde3006e56e39de7d39b79b4c477f287f9d5e07 Mon Sep 17 00:00:00 2001 From: mdebray Date: Fri, 12 May 2023 01:22:09 +0000 Subject: [PATCH] web-01: minimal config --- admin_keys/anon.keys | 5 +++ admin_keys/mdebray.keys | 1 + machines/web-01/configuration.nix | 42 ++++++++++++++++++++++ machines/web-01/disko.nix | 12 +++++-- machines/web-01/hardware-configuration.nix | 19 ++++++++++ 5 files changed, 77 insertions(+), 2 deletions(-) create mode 100644 admin_keys/anon.keys create mode 100644 admin_keys/mdebray.keys create mode 100644 machines/web-01/configuration.nix create mode 100644 machines/web-01/hardware-configuration.nix diff --git a/admin_keys/anon.keys b/admin_keys/anon.keys new file mode 100644 index 0000000..ef0e9c0 --- /dev/null +++ b/admin_keys/anon.keys @@ -0,0 +1,5 @@ +ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDcEkYM1r8QVNM/G5CxJInEdoBCWjEHHDdHlzDYNSUIdHHsn04QY+XI67AdMCm8w30GZnLUIj5RiJEWXREUApby0GrfxGGcy8otforygfgtmuUKAUEHdU2MMwrQI7RtTZ8oQ0USRGuqvmegxz3l5caVU7qGvBllJ4NUHXrkZSja2/51vq80RF4MKkDGiz7xUTixI2UcBwQBCA/kQedKV9G28EH+1XfvePqmMivZjl+7VyHsgUVj9eRGA1XWFw59UPZG8a7VkxO/Eb3K9NF297HUAcFMcbY6cPFi9AaBgu3VC4eetDnoN/+xT1owiHi7BReQhGAy/6cdf7C/my5ehZwD +ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIE0xMwWedkKosax9+7D2OlnMxFL/eV4CvFZLsbLptpXr +ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKiXXYkhRh+s7ixZ8rvG8ntIqd6FELQ9hh7HoaHQJRPU +ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIL+EZXYziiaynJX99EW8KesnmRTZMof3BoIs3mdEl8L3 +ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHL4M4HKjs4cjRAYRk9pmmI8U0R4+T/jQh6Fxp/i1Eoy diff --git a/admin_keys/mdebray.keys b/admin_keys/mdebray.keys new file mode 100644 index 0000000..3f26a23 --- /dev/null +++ b/admin_keys/mdebray.keys @@ -0,0 +1 @@ +ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEpwF+XD3HgX64kqD42pcEZRNYAWoO4YNiOm5KO4tH6o maurice@polaris diff --git a/machines/web-01/configuration.nix b/machines/web-01/configuration.nix new file mode 100644 index 0000000..7c14bb8 --- /dev/null +++ b/machines/web-01/configuration.nix @@ -0,0 +1,42 @@ +# Edit this configuration file to define what should be installed on +# your system. Help is available in the configuration.nix(5) man page +# and in the NixOS manual (accessible by running ‘nixos-help’). + +{ config, pkgs, lib, ... }: +let + sources = import ../../npins; +in +{ + imports = + [ # Include the results of the hardware scan. + ./hardware-configuration.nix + (sources.disko + "/module.nix") + ./disko.nix + ]; + + # Use the systemd-boot EFI boot loader. + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + + networking.hostName = "web-01";# Define your hostname. + + time.timeZone = "Europe/Paris"; + + networking.useDHCP = lib.mkDefault true; + # networking.interfaces.ens3.useDHCP = lib.mkDefault true; + + users.users.root.openssh.authorizedKeys.keyFiles = [ ../../admin_keys/anon.keys ../../admin_keys/mdebray.keys ]; + + # Enable the OpenSSH daemon. + services.openssh.enable = true; + + # This value determines the NixOS release from which the default + # settings for stateful data, like file locations and database versions + # on your system were taken. It‘s perfectly fine and recommended to leave + # this value at the release version of the first install of this system. + # Before changing this value read the documentation for this option + # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). + system.stateVersion = "22.11"; # Did you read the comment? + +} + diff --git a/machines/web-01/disko.nix b/machines/web-01/disko.nix index 8034d79..b9a5f8e 100644 --- a/machines/web-01/disko.nix +++ b/machines/web-01/disko.nix @@ -1,4 +1,12 @@ -{...}: { +{...}: +let + luksName = "mainfs"; +in +{ + boot.initrd.luks.devices.${luksName} = { + keyFile = "/dev/zero"; + keyFileSize = 1; + }; disko.devices = { disk = { vdb = { @@ -26,7 +34,7 @@ end = "-4GiB"; content = rec { type = "luks"; - name = "mainfs"; + name = luksName; extraOpenArgs = [ "--keyfile-size=1" ]; extraFormatArgs = extraOpenArgs; keyFile = "/dev/zero"; diff --git a/machines/web-01/hardware-configuration.nix b/machines/web-01/hardware-configuration.nix new file mode 100644 index 0000000..33543ed --- /dev/null +++ b/machines/web-01/hardware-configuration.nix @@ -0,0 +1,19 @@ +# Do not modify this file! It was generated by ‘nixos-generate-config’ +# and may be overwritten by future invocations. Please make changes +# to /etc/nixos/configuration.nix instead. +{ config, lib, pkgs, modulesPath, ... }: + +{ + imports = + [ (modulesPath + "/profiles/qemu-guest.nix") + ]; + + boot.initrd.availableKernelModules = [ "ata_piix" "uhci_hcd" "ehci_pci" "virtio_pci" "ahci" "virtio_blk" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +}