From 42f550f15627aa034b088e0cdd0cf15f6dae581f Mon Sep 17 00:00:00 2001 From: Xinyang Li Date: Sat, 29 Jul 2023 23:34:24 +0800 Subject: [PATCH] massicot: add new machine --- flake.nix | 8 +++++ machines/massicot/default.nix | 37 ++++++++++++++++++++ machines/massicot/hardware-configuration.nix | 36 +++++++++++++++++++ machines/massicot/networking.nix | 13 +++++++ 4 files changed, 94 insertions(+) create mode 100644 machines/massicot/default.nix create mode 100644 machines/massicot/hardware-configuration.nix create mode 100644 machines/massicot/networking.nix diff --git a/flake.nix b/flake.nix index d990e06..02117ee 100644 --- a/flake.nix +++ b/flake.nix @@ -63,6 +63,14 @@ ]; }; + nixosConfigurations.massicot = mkNixos { + system = "aarch64-linux"; + modules = [ + machines/massicot + (mkHome "xin" "gold") + ] + } + nixosConfigurations.raspite = mkNixos { system = "aarch64-linux"; modules = [ diff --git a/machines/massicot/default.nix b/machines/massicot/default.nix new file mode 100644 index 0000000..ebe8e33 --- /dev/null +++ b/machines/massicot/default.nix @@ -0,0 +1,37 @@ +{ config, libs, pkgs, ... }: + +{ + imports = [ + ./hardware-configuration.nix + ./networking.nix + ]; + + environment.systemPackages = with pkgs; [ + git + ]; + + nix.settings.experimental-features = [ "nix-command" "flakes" ]; + + system.stateVersion = "22.11"; + + networking = { + hostName = "massicot"; + useDHCP = false; + }; + + services.openssh = { + enable = true; + }; + + systemd.services.sshd.wantedBy = pkgs.lib.mkForce [ "multi-user.target" ]; + + users.users.xin = { + isNormalUser = true; + extraGroups = [ "wheel" "networkmanager" ]; + openssh.authorizedKeys.keys = [ + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPBcSvUQnmMFtpftFKIsDqeyUyZHzRg5ewgn3VEcLnss" + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIInPn+7cMbH7zCEPJArU/Ot6oq8NHo8a2rYaCfTp7zgd" + ]; + }; + +} \ No newline at end of file diff --git a/machines/massicot/hardware-configuration.nix b/machines/massicot/hardware-configuration.nix new file mode 100644 index 0000000..2cb3a29 --- /dev/null +++ b/machines/massicot/hardware-configuration.nix @@ -0,0 +1,36 @@ +# 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 = [ "xhci_pci" "virtio_pci" "virtio_scsi" "usbhid" "sr_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/934bc9cd-c80f-4af0-a446-e92c3b21ad9e"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/06F4-7777"; + fsType = "vfat"; + }; + + swapDevices = [ ]; + + # Enables DHCP on each ethernet and wireless interface. In case of scripted networking + # (the default) this is the recommended approach. When using systemd-networkd it's + # still possible to use this option, but it's recommended to use it in conjunction + # with explicit per-interface declarations with `networking.interfaces..useDHCP`. + networking.useDHCP = lib.mkDefault true; + # networking.interfaces.eth0.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "aarch64-linux"; +} \ No newline at end of file diff --git a/machines/massicot/networking.nix b/machines/massicot/networking.nix new file mode 100644 index 0000000..b93990a --- /dev/null +++ b/machines/massicot/networking.nix @@ -0,0 +1,13 @@ +networking = { + interfaces = { + eth0.ipv6.addresses = [{ + address = "2a01:4f8:c17:345f::1"; + prefixLength = 64; + }]; + }; + defaultGateway6 = { + address = "fe80::1"; + interface = "eth0"; + }; + nameservers = [ "2a00:1098:2b::1" "2a00:1098:2c::1" "2a01:4f9:c010:3f02::1"] +}; \ No newline at end of file