From de8b7c9a5c8992f47b50ceee46f9392e22634a57 Mon Sep 17 00:00:00 2001 From: teutat3s Date: Fri, 8 Jul 2022 14:20:00 +0200 Subject: [PATCH] powder: init --- flake.nix | 15 +++++ hosts/powder/default.nix | 6 ++ hosts/powder/hardware-configuration.nix | 39 ++++++++++++ hosts/powder/powder.nix | 82 +++++++++++++++++++++++++ 4 files changed, 142 insertions(+) create mode 100644 hosts/powder/default.nix create mode 100644 hosts/powder/hardware-configuration.nix create mode 100644 hosts/powder/powder.nix diff --git a/flake.nix b/flake.nix index 46bfc12d..1b0c9db4 100644 --- a/flake.nix +++ b/flake.nix @@ -48,6 +48,9 @@ nix-dram.url = "github:dramforever/nix-dram"; nix-dram.inputs.nixpkgs.follows = "latest"; + triton-vmtools.url = "git+https://git.b12f.io/pub-solar/infra?ref=main&dir=vmtools"; + triton-vmtools.inputs.nixpkgs.follows = "latest"; + tritonshell.url = "git+https://git.greenbaum.cloud/dev/tritonshell?ref=main&dir=template"; tritonshell.inputs.nixpkgs.follows = "latest"; @@ -130,6 +133,9 @@ fae = { system = "aarch64-linux"; }; + powder = { + system = "x86_64-linux"; + }; }; importables = rec { profiles = digga.lib.rakeLeaves ./profiles // { @@ -177,6 +183,15 @@ path = deploy.lib.x86_64-linux.activate.home-manager self.homeConfigurationsPortable.x86_64-linux.pub-solar; }; }; + powder = { + hostname = "80.71.153.194"; + sshUser = "root"; + profilesOrder = [ "system" "direnv" ]; + profiles.direnv = { + user = "pub-solar"; + path = deploy.lib.x86_64-linux.activate.home-manager self.homeConfigurationsPortable.x86_64-linux.pub-solar; + }; + }; }; } ; diff --git a/hosts/powder/default.nix b/hosts/powder/default.nix new file mode 100644 index 00000000..a7f36942 --- /dev/null +++ b/hosts/powder/default.nix @@ -0,0 +1,6 @@ +{ ... }: +{ + imports = [ + ./powder.nix + ]; +} diff --git a/hosts/powder/hardware-configuration.nix b/hosts/powder/hardware-configuration.nix new file mode 100644 index 00000000..7dbf9542 --- /dev/null +++ b/hosts/powder/hardware-configuration.nix @@ -0,0 +1,39 @@ +# 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 = [ ]; + + boot.initrd.availableKernelModules = [ "ahci" "virtio_pci" "xhci_pci" "sr_mod" "virtio_blk" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-label/nixos"; + autoResize = true; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-label/boot"; + fsType = "vfat"; + }; + + fileSystems."/data" = + { device = "/dev/disk/by-label/ephemeral0"; + fsType = "ext4"; + options = [ + "defaults" + "nofail" + ]; + }; + + swapDevices = [ ]; + + networking.useDHCP = lib.mkDefault false; + + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/hosts/powder/powder.nix b/hosts/powder/powder.nix new file mode 100644 index 00000000..a3fa7cb2 --- /dev/null +++ b/hosts/powder/powder.nix @@ -0,0 +1,82 @@ +{ config, inputs, lib, pkgs, profiles, ... }: + +{ + imports = [ # Include the results of the hardware scan. + ./hardware-configuration.nix + + profiles.users.root # make sure to configure ssh keys + profiles.users.pub-solar + profiles.base-user + ]; + + config = { + pub-solar.x-os.iso-options.enable = true; + + # Use the systemd-boot EFI boot loader. + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + + # Force getting the hostname from cloud-init + networking.hostName = lib.mkDefault ""; + + # Set your time zone. + # time.timeZone = "Europe/Amsterdam"; + + # Select internationalisation properties. + console = { + font = "Lat2-Terminus16"; + keyMap = "us"; + }; + + # List packages installed in system profile. To search, run: + # $ nix search wget + environment.systemPackages = with pkgs; [ + git + vim + wget + caddy + # triton tools for retrieving metadata inside zones, e.g. mdata-get + inputs.triton-vmtools + ]; + + # Some programs need SUID wrappers, can be configured further or are + # started in user sessions. + # programs.mtr.enable = true; + # programs.gnupg.agent = { + # enable = true; + # enableSSHSupport = true; + # }; + + # List services that you want to enable: + services.cloud-init.enable = true; + services.cloud-init.ext4.enable = true; + services.cloud-init.network.enable = true; + # use the default NixOS cloud-init config, but add some SmartOS customization to it + environment.etc."cloud/cloud.cfg.d/90_smartos.cfg".text = '' + datasource_list: [ SmartOS ] + + # Do not create the centos/ubuntu/debian user + users: [ ] + + # mount second disk with label ephemeral0, gets formated by cloud-init + # this will fail to get added to /etc/fstab as it's read-only, but should + # mount at boot anyway + mounts: + - [ vdb, /data, auto, "defaults,nofail" ] + ''; + + # Enable the OpenSSH daemon. + services.openssh.enable = true; + + # Triton manages firewall rules via the triton fwrule subcommand + networking.firewall.enable = false; + + # 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.05"; # Did you read the comment? + }; +}