From 02fa695a0f13c54a2eb3d5906e34ce489cc61d58 Mon Sep 17 00:00:00 2001 From: natto1784 Date: Mon, 31 May 2021 02:48:14 +0530 Subject: [PATCH] add host Remilia --- flake.lock | 6 +-- flake.nix | 40 +++++++++--------- {satori => hosts/personal}/README.md | 0 {satori => hosts/personal}/boot.nix | 0 {satori => hosts/personal}/cirno.png | Bin {satori => hosts/personal}/hardware.nix | 0 {satori => hosts/personal}/networking.nix | 0 {satori => hosts/personal}/pkgs.nix | 0 satori.nix => hosts/personal/satori.nix | 0 {satori => hosts/personal}/services.nix | 0 {satori => hosts/personal}/stuff.nix | 0 marisa.nix => hosts/servers/marisa.nix | 7 ++- {marisa => hosts/servers/marisa}/boot.nix | 0 {marisa => hosts/servers/marisa}/cachix.nix | 0 .../servers/marisa}/cachix/rpi4.nix | 0 {marisa => hosts/servers/marisa}/hardware.nix | 0 .../servers/marisa}/networking.nix | 0 {marisa => hosts/servers/marisa}/services.nix | 0 {marisa => hosts/servers}/pkgs.nix | 1 - hosts/servers/remilia.nix | 15 +++++++ hosts/servers/remilia/boot.nix | 13 ++++++ hosts/servers/remilia/hardware.nix | 20 +++++++++ hosts/servers/remilia/networking.nix | 13 ++++++ hosts/servers/remilia/services.nix | 12 ++++++ {marisa => hosts/servers}/stuff.nix | 3 -- 25 files changed, 98 insertions(+), 32 deletions(-) rename {satori => hosts/personal}/README.md (100%) rename {satori => hosts/personal}/boot.nix (100%) rename {satori => hosts/personal}/cirno.png (100%) rename {satori => hosts/personal}/hardware.nix (100%) rename {satori => hosts/personal}/networking.nix (100%) rename {satori => hosts/personal}/pkgs.nix (100%) rename satori.nix => hosts/personal/satori.nix (100%) rename {satori => hosts/personal}/services.nix (100%) rename {satori => hosts/personal}/stuff.nix (100%) rename marisa.nix => hosts/servers/marisa.nix (62%) rename {marisa => hosts/servers/marisa}/boot.nix (100%) rename {marisa => hosts/servers/marisa}/cachix.nix (100%) rename {marisa => hosts/servers/marisa}/cachix/rpi4.nix (100%) rename {marisa => hosts/servers/marisa}/hardware.nix (100%) rename {marisa => hosts/servers/marisa}/networking.nix (100%) rename {marisa => hosts/servers/marisa}/services.nix (100%) rename {marisa => hosts/servers}/pkgs.nix (98%) create mode 100755 hosts/servers/remilia.nix create mode 100755 hosts/servers/remilia/boot.nix create mode 100644 hosts/servers/remilia/hardware.nix create mode 100755 hosts/servers/remilia/networking.nix create mode 100755 hosts/servers/remilia/services.nix rename {marisa => hosts/servers}/stuff.nix (90%) diff --git a/flake.lock b/flake.lock index e19cdec..8f01bb6 100644 --- a/flake.lock +++ b/flake.lock @@ -202,11 +202,11 @@ }, "stable": { "locked": { - "lastModified": 1619486598, - "narHash": "sha256-ZEvJ+uItcKLQ9uSjGbQFE6Euu9w1Y98x0TWydXIgHAI=", + "lastModified": 1622197592, + "narHash": "sha256-MS2v6/oDzW5uej8fnjg0v//WWVvEdNooP4plG2AdMGQ=", "owner": "nixos", "repo": "nixpkgs", - "rev": "d4e7af972158a14ebdd9c828b1c2e07e2ce7ef1c", + "rev": "85960bea533dc2d89dff8836d8a0a1239ddd5c9c", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 4847590..69d6ef9 100644 --- a/flake.nix +++ b/flake.nix @@ -1,7 +1,7 @@ { inputs = { - stable.url = github:nixos/nixpkgs/nixos-20.09; nixpkgs.url = github:nixos/nixpkgs/nixos-unstable; + stable.url = github:nixos/nixpkgs/nixos-20.09; home-manager = { url = github:nix-community/home-manager; inputs.nixpkgs.follows = "nixpkgs"; @@ -15,7 +15,7 @@ nvim.url = github:nix-community/neovim-nightly-overlay; }; - outputs = inputs@{self, nixpkgs, ... }: + outputs = inputs@{self, nixpkgs, stable, ... }: inputs.utils.lib.eachDefaultSystem (system: let overlays = [ @@ -47,26 +47,14 @@ homeDirectory = "/home/natto"; username = "natto"; }; - /* - ottan = inputs.home-manager.lib.homeManagerConfiguration { - system = "aarch64-linux"; - configuration = { lib, ... }: { - imports = [ - ./home/ottan.nix - ]; - nixpkgs.overlays = self.packages.aarch64-linux.overlays; - }; - homeDirectory = "/home/ottan"; - username = "ottan"; - }; - */ }; nixosConfigurations = { + #Home laptop Satori = nixpkgs.lib.nixosSystem { system = "x86_64-linux"; modules = [ - ./satori.nix + ./hosts/personal/satori.nix inputs.agenix.nixosModules.age inputs.home-manager.nixosModules.home-manager { @@ -74,23 +62,33 @@ } ]; }; + #Home server (RPi4) Marisa = nixpkgs.lib.nixosSystem { system = "aarch64-linux"; modules = [ - ./marisa.nix - inputs.home-manager.nixosModules.home-manager + ./hosts/servers/marisa.nix { nixpkgs.pkgs = self.packages.aarch64-linux; } ]; }; + #idk, maybe to try cross compiling Marisa on home laptop later? Marisus = nixpkgs.lib.nixosSystem { system = "aarch64-linux"; modules = [ - ./marisa.nix - # inputs.home-manager.nixosModules.home-manager + ./hosts/servers/marisa.nix { - nixpkgs.pkgs = self.packages.x86_64-linux // {crossSystem.config = "aarch64-unknown-linux-gnu";}; + nixpkgs.pkgs = (self.packages.x86_64-linux) // {crossSystem.config = "aarch64-unknown-linux-gnu";}; + } + ]; + }; + #Oracle Cloud VM + Remilia = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + modules = [ + ./hosts/servers/remilia.nix + { + nixpkgs.pkgs = self.packages.x86_64-linux; } ]; }; diff --git a/satori/README.md b/hosts/personal/README.md similarity index 100% rename from satori/README.md rename to hosts/personal/README.md diff --git a/satori/boot.nix b/hosts/personal/boot.nix similarity index 100% rename from satori/boot.nix rename to hosts/personal/boot.nix diff --git a/satori/cirno.png b/hosts/personal/cirno.png similarity index 100% rename from satori/cirno.png rename to hosts/personal/cirno.png diff --git a/satori/hardware.nix b/hosts/personal/hardware.nix similarity index 100% rename from satori/hardware.nix rename to hosts/personal/hardware.nix diff --git a/satori/networking.nix b/hosts/personal/networking.nix similarity index 100% rename from satori/networking.nix rename to hosts/personal/networking.nix diff --git a/satori/pkgs.nix b/hosts/personal/pkgs.nix similarity index 100% rename from satori/pkgs.nix rename to hosts/personal/pkgs.nix diff --git a/satori.nix b/hosts/personal/satori.nix similarity index 100% rename from satori.nix rename to hosts/personal/satori.nix diff --git a/satori/services.nix b/hosts/personal/services.nix similarity index 100% rename from satori/services.nix rename to hosts/personal/services.nix diff --git a/satori/stuff.nix b/hosts/personal/stuff.nix similarity index 100% rename from satori/stuff.nix rename to hosts/personal/stuff.nix diff --git a/marisa.nix b/hosts/servers/marisa.nix similarity index 62% rename from marisa.nix rename to hosts/servers/marisa.nix index 917a5cf..6bb3caf 100755 --- a/marisa.nix +++ b/hosts/servers/marisa.nix @@ -2,15 +2,14 @@ { imports = [ - # - ./marisa/pkgs.nix + ./pkgs.nix + ./stuff.nix ./marisa/networking.nix - ./marisa/stuff.nix ./marisa/hardware.nix ./marisa/boot.nix ./marisa/services.nix ./marisa/cachix.nix - ./configs/nvim.nix + ../../configs/nvim.nix ]; system.stateVersion = "21.05"; } diff --git a/marisa/boot.nix b/hosts/servers/marisa/boot.nix similarity index 100% rename from marisa/boot.nix rename to hosts/servers/marisa/boot.nix diff --git a/marisa/cachix.nix b/hosts/servers/marisa/cachix.nix similarity index 100% rename from marisa/cachix.nix rename to hosts/servers/marisa/cachix.nix diff --git a/marisa/cachix/rpi4.nix b/hosts/servers/marisa/cachix/rpi4.nix similarity index 100% rename from marisa/cachix/rpi4.nix rename to hosts/servers/marisa/cachix/rpi4.nix diff --git a/marisa/hardware.nix b/hosts/servers/marisa/hardware.nix similarity index 100% rename from marisa/hardware.nix rename to hosts/servers/marisa/hardware.nix diff --git a/marisa/networking.nix b/hosts/servers/marisa/networking.nix similarity index 100% rename from marisa/networking.nix rename to hosts/servers/marisa/networking.nix diff --git a/marisa/services.nix b/hosts/servers/marisa/services.nix similarity index 100% rename from marisa/services.nix rename to hosts/servers/marisa/services.nix diff --git a/marisa/pkgs.nix b/hosts/servers/pkgs.nix similarity index 98% rename from marisa/pkgs.nix rename to hosts/servers/pkgs.nix index 8a7983e..dffd110 100755 --- a/marisa/pkgs.nix +++ b/hosts/servers/pkgs.nix @@ -5,7 +5,6 @@ gnumake htop vim - tailscale wireguard ]; programs = { diff --git a/hosts/servers/remilia.nix b/hosts/servers/remilia.nix new file mode 100755 index 0000000..46a0ddd --- /dev/null +++ b/hosts/servers/remilia.nix @@ -0,0 +1,15 @@ +{lib, config, ...}: +{ + imports = + [ + ./pkgs.nix + ./stuff.nix + ./remilia/networking.nix + ./remilia/hardware.nix + ./remilia/boot.nix + ./remilia/services.nix + ../../configs/nvim.nix + ]; + programs.gnupg.agent.enable = lib.mkForce false; + system.stateVersion = "21.11"; +} diff --git a/hosts/servers/remilia/boot.nix b/hosts/servers/remilia/boot.nix new file mode 100755 index 0000000..3a96c43 --- /dev/null +++ b/hosts/servers/remilia/boot.nix @@ -0,0 +1,13 @@ +{config, ...}: +{ + boot = { + initrd.kernelModules = [ "bochs_drm" ]; + initrd.availableKernelModules = [ "ata_piix" "uhci_hcd" "virtio_pci" "virtio_scsi" ]; + kernelModules = [ "kvm-amd" ]; + kernelParams = [ "console=ttyS0" "console=tty1" "nvme.shutdown_timeout=10" "libiscsi.debug_libiscsi_eh=1" ]; + loader = { + systemd-boot.enable = true; + efi.canTouchEfiVariables = true; + }; + }; +} diff --git a/hosts/servers/remilia/hardware.nix b/hosts/servers/remilia/hardware.nix new file mode 100644 index 0000000..0db6e8f --- /dev/null +++ b/hosts/servers/remilia/hardware.nix @@ -0,0 +1,20 @@ +{ config, lib, pkgs, modulesPath, ... }: + +{ + imports = + [ (modulesPath + "/profiles/qemu-guest.nix") + ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/d91adce2-9059-4a8a-86e7-dee6ecc85b2b"; + fsType = "ext4"; + }; + + swapDevices = [ + { + device="/swapfile"; + size = 7168; + priority = 0; + } + ]; +} diff --git a/hosts/servers/remilia/networking.nix b/hosts/servers/remilia/networking.nix new file mode 100755 index 0000000..a38aa8e --- /dev/null +++ b/hosts/servers/remilia/networking.nix @@ -0,0 +1,13 @@ +{config, ...}: +{ + networking = { + useDHCP = false; + hostName = "Remilia"; + firewall.allowedTCPPorts = [ 22 80 ]; + interfaces = { + ens3 = { + useDHCP = true; + }; + }; + }; +} diff --git a/hosts/servers/remilia/services.nix b/hosts/servers/remilia/services.nix new file mode 100755 index 0000000..576d965 --- /dev/null +++ b/hosts/servers/remilia/services.nix @@ -0,0 +1,12 @@ +{config, ...}: +{ + services = { + openssh = { + enable = true; + permitRootLogin = "yes"; + }; + }; + users.users.root.openssh.authorizedKeys.keys = [ + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJHingN2Aho+KGgEvBMjtoez+W1svl9uVoa4vG0d646j" + ]; +} diff --git a/marisa/stuff.nix b/hosts/servers/stuff.nix similarity index 90% rename from marisa/stuff.nix rename to hosts/servers/stuff.nix index 5d4e904..8974c63 100755 --- a/marisa/stuff.nix +++ b/hosts/servers/stuff.nix @@ -19,9 +19,6 @@ ]; }; }; - fonts.fonts = with pkgs; [ - fira-mono - ]; documentation.enable = false; users.extraUsers.root = { shell = pkgs.zsh;