From 3b9e9734269cb7a9515be1ad7a960421c1ed48b4 Mon Sep 17 00:00:00 2001 From: Ezri Zhu Date: Thu, 26 Sep 2024 05:44:39 -0400 Subject: [PATCH] init --- .gitmodules | 3 +++ README.md | 7 +++++- common/default.nix | 20 +++++++++++++++++ common/users.nix | 14 ++++++++++++ hosts/stella.nix | 53 ++++++++++++++++++++++++++++++++++++++++++++++ network.nix | 19 +++++++++++++++++ nixpkgs | 1 + shell.nix | 7 ++++++ 8 files changed, 123 insertions(+), 1 deletion(-) create mode 100644 .gitmodules create mode 100644 common/default.nix create mode 100644 common/users.nix create mode 100644 hosts/stella.nix create mode 100644 network.nix create mode 160000 nixpkgs create mode 100644 shell.nix diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..597165b --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "nixpkgs"] + path = nixpkgs + url = https://github.com/NixOS/nixpkgs.git diff --git a/README.md b/README.md index f8a2a26..e14067e 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,7 @@ -# nixos +# Morph Deployment +Common configs are in /common + +Host specific are in /hosts + +To deploy, run `morph deploy network.nix switch` diff --git a/common/default.nix b/common/default.nix new file mode 100644 index 0000000..90e1274 --- /dev/null +++ b/common/default.nix @@ -0,0 +1,20 @@ +{ pkgs, ... }: + +{ + imports = [ + ./users.nix + ]; + nix.package = pkgs.lix; + environment.systemPackages = with pkgs; [ + vim + wget + curl + htop + tmux + openssl + git + ]; + security.sudo.wheelNeedsPassword = false; + networking.firewall.enable = false; + services.openssh.enable = true; +} diff --git a/common/users.nix b/common/users.nix new file mode 100644 index 0000000..ba8c3ca --- /dev/null +++ b/common/users.nix @@ -0,0 +1,14 @@ +{ pkgs, ... }: + +{ + nix.settings.trusted-users = [ "@wheel" ]; + users.users.ezri = { + isNormalUser = true; + extraGroups = [ "wheel" ]; + openssh.authorizedKeys.keys = [ + "ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBHp8yRnahmUS7l8STsx0pH25O4xTWGYQyQEWeKWxeM7gbkTNPGpiUswmsHgN8Ng0+FwjIw0FHkjQeLSMH9OTSB4= ipad0esp" + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJdN4a3yJUlKIaVezOe4hE8fRK9DkGSzwoZ9vfpsBsHh ide0" + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICY1V1im0gnXKWdR/H0Q0tajQFQqnDXoNVG3X8/RseI3 lap0" + ]; + }; +} diff --git a/hosts/stella.nix b/hosts/stella.nix new file mode 100644 index 0000000..38dfde7 --- /dev/null +++ b/hosts/stella.nix @@ -0,0 +1,53 @@ +{ config, lib, pkgs, modulesPath, ... }: + +{ + imports = + [ (modulesPath + "/profiles/qemu-guest.nix") + ]; + + boot.initrd.availableKernelModules = [ "ahci" "xhci_pci" "virtio_pci" "sr_mod" "virtio_blk" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/e31f5386-8b86-4aa0-9666-606680bcd10f"; + fsType = "ext4"; + }; + + networking.useDHCP = lib.mkDefault false; + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + + boot.loader.grub = { + enable = true; + device = "/dev/vda"; + }; + + networking = { + hostName = "stella"; + search = ["wolfgirl.systems"]; + nameservers = [ "9.9.9.10" "149.112.112.10" ]; + dhcpcd.enable = false; + interfaces = { + enp1s0.ipv4.addresses = [{ + address = "198.8.59.4"; + prefixLength = 27; + }]; + }; + defaultGateway = { + address = "198.8.59.1"; + interface = "enp1s0"; + }; + }; + + time.timeZone = "America/New_York"; + i18n.defaultLocale = "en_US.UTF-8"; + + swapDevices = [ { + device = "/swapfile"; + size = 4*1024; + randomEncryption.enable = true; + }]; + + system.stateVersion = "23.05"; +} diff --git a/network.nix b/network.nix new file mode 100644 index 0000000..86824b5 --- /dev/null +++ b/network.nix @@ -0,0 +1,19 @@ +let +pkgs = import ./nixpkgs {}; +in +{ + network = { + description = "wolfgirl.systems"; + inherit pkgs; + }; + + "stella" = { pkgs, ... }: { + deployment = { + targetHost = "198.8.59.4"; + }; + imports = [ + ./hosts/stella.nix + ./common + ]; + }; +} diff --git a/nixpkgs b/nixpkgs new file mode 160000 index 0000000..30439d9 --- /dev/null +++ b/nixpkgs @@ -0,0 +1 @@ +Subproject commit 30439d93eb8b19861ccbe3e581abf97bdc91b093 diff --git a/shell.nix b/shell.nix new file mode 100644 index 0000000..ce7ab14 --- /dev/null +++ b/shell.nix @@ -0,0 +1,7 @@ +{ pkgs ? import {}}: + +pkgs.mkShell { + buildInputs = with pkgs; [ + morph + ]; +}