From c19dc0924481c7edf4938f5aa105f481a787a30e Mon Sep 17 00:00:00 2001 From: Aria Date: Mon, 11 Dec 2023 19:52:21 +0000 Subject: refactor(nix-personal): change folder structure --- nix-personal/configuration.nix | 50 ------------------- nix-personal/disk-config.nix | 48 ------------------ nix-personal/flake.nix | 5 +- nix-personal/hosts/puppy.nix | 71 +++++++++++++++++++++++++++ nix-personal/landing/index.html | 5 -- nix-personal/profiles/common.nix | 10 ++++ nix-personal/profiles/landing/default.nix | 7 +++ nix-personal/profiles/landing/html/index.html | 5 ++ nix-personal/profiles/nginx.nix | 4 ++ 9 files changed, 99 insertions(+), 106 deletions(-) delete mode 100644 nix-personal/configuration.nix delete mode 100644 nix-personal/disk-config.nix create mode 100644 nix-personal/hosts/puppy.nix delete mode 100644 nix-personal/landing/index.html create mode 100644 nix-personal/profiles/common.nix create mode 100644 nix-personal/profiles/landing/default.nix create mode 100644 nix-personal/profiles/landing/html/index.html create mode 100644 nix-personal/profiles/nginx.nix diff --git a/nix-personal/configuration.nix b/nix-personal/configuration.nix deleted file mode 100644 index 537a32e..0000000 --- a/nix-personal/configuration.nix +++ /dev/null @@ -1,50 +0,0 @@ -{ - modulesPath, - config, - lib, - pkgs, - ... -}: { - imports = [ - (modulesPath + "/installer/scan/not-detected.nix") - (modulesPath + "/profiles/qemu-guest.nix") - ./disk-config.nix - ]; - - # Basic setup - system.stateVersion = "23.11"; - - boot.loader.grub = { - # no need to set devices, disko will add all devices that have a EF02 partition to the list already - # devices = [ ]; - efiSupport = true; - efiInstallAsRemovable = true; - }; - - deployment = { - targetHost = "puppy.girlth.ing"; - buildOnTarget = true; - }; - - # SSH Access - services.openssh.enable = true; - users.users.root.openssh.authorizedKeys.keys = [ - "no-touch-required sk-ssh-ed25519@openssh.com AAAAGnNrLXNzaC1lZDI1NTE5QG9wZW5zc2guY29tAAAAIPpKjZfzPN1KxVskFRnmTTCwzyCtjwcXVZc4i1rNfl9oAAAABHNzaDo= me@aria.rip" - ]; - - # Networking setup - networking = { - hostName = "puppy"; - domain = "girlth.ing"; - }; - - # Basic nginx placeholder - networking.firewall.allowedTCPPorts = [80]; - services.nginx = { - enable = true; - virtualHosts."girlth.ing" = { - default = true; - root = ./landing; - }; - }; -} diff --git a/nix-personal/disk-config.nix b/nix-personal/disk-config.nix deleted file mode 100644 index 5fb5fbc..0000000 --- a/nix-personal/disk-config.nix +++ /dev/null @@ -1,48 +0,0 @@ -# Example to create a bios compatible gpt partition -{lib, ...}: { - disko.devices = { - disk.disk1 = { - device = lib.mkDefault "/dev/sda"; - type = "disk"; - content = { - type = "gpt"; - partitions = { - boot = { - name = "boot"; - size = "1M"; - type = "EF02"; - }; - esp = { - name = "ESP"; - size = "500M"; - type = "EF00"; - content = { - type = "filesystem"; - format = "vfat"; - mountpoint = "/boot"; - }; - }; - swap = { - name = "swap"; - size = "2G"; - content = { - type = "swap"; - }; - }; - root = { - name = "root"; - size = "100%"; - content = { - type = "filesystem"; - format = "ext4"; - mountpoint = "/"; - mountOptions = [ - "defaults" - ]; - }; - }; - }; - }; - }; - }; -} diff --git a/nix-personal/flake.nix b/nix-personal/flake.nix index e9722a4..7fe8056 100644 --- a/nix-personal/flake.nix +++ b/nix-personal/flake.nix @@ -10,7 +10,7 @@ }: let imports = [ disko.nixosModules.disko - ./configuration.nix + ./hosts/puppy.nix ]; in { devShells.x86_64-linux.default = let @@ -32,9 +32,8 @@ }; }; - # Also see the non-Flakes hive.nix example above. puppy = {...}: { - imports = imports; + inherit imports; }; }; }; diff --git a/nix-personal/hosts/puppy.nix b/nix-personal/hosts/puppy.nix new file mode 100644 index 0000000..948b243 --- /dev/null +++ b/nix-personal/hosts/puppy.nix @@ -0,0 +1,71 @@ +{ + modulesPath, + lib, + ... +}: { + imports = [ + (modulesPath + "/installer/scan/not-detected.nix") + (modulesPath + "/profiles/qemu-guest.nix") + ../profiles/common.nix + ../profiles/landing + ]; + + disko.devices = { + disk.disk1 = { + device = lib.mkDefault "/dev/sda"; + type = "disk"; + content = { + type = "gpt"; + partitions = { + boot = { + name = "boot"; + size = "1M"; + type = "EF02"; + }; + esp = { + name = "ESP"; + size = "500M"; + type = "EF00"; + content = { + type = "filesystem"; + format = "vfat"; + mountpoint = "/boot"; + }; + }; + swap = { + name = "swap"; + size = "2G"; + content = { + type = "swap"; + }; + }; + root = { + name = "root"; + size = "100%"; + content = { + type = "filesystem"; + format = "ext4"; + mountpoint = "/"; + mountOptions = [ + "defaults" + ]; + }; + }; + }; + }; + }; + }; + + boot.loader.grub = { + # no need to set devices, disko will add all devices that have a EF02 partition to the list already + # devices = [ ]; + efiSupport = true; + efiInstallAsRemovable = true; + }; + + networking.hostName = "puppy"; + deployment = { + targetHost = "puppy.girlth.ing"; + buildOnTarget = true; + }; +} diff --git a/nix-personal/landing/index.html b/nix-personal/landing/index.html deleted file mode 100644 index 5d5f6be..0000000 --- a/nix-personal/landing/index.html +++ /dev/null @@ -1,5 +0,0 @@ - - -

It works!

- - diff --git a/nix-personal/profiles/common.nix b/nix-personal/profiles/common.nix new file mode 100644 index 0000000..b4e1337 --- /dev/null +++ b/nix-personal/profiles/common.nix @@ -0,0 +1,10 @@ +{...}: { + system.stateVersion = "23.11"; + + networking.domain = "girlth.ing"; + + services.openssh.enable = true; + users.users.root.openssh.authorizedKeys.keys = [ + "no-touch-required sk-ssh-ed25519@openssh.com AAAAGnNrLXNzaC1lZDI1NTE5QG9wZW5zc2guY29tAAAAIPpKjZfzPN1KxVskFRnmTTCwzyCtjwcXVZc4i1rNfl9oAAAABHNzaDo= me@aria.rip" + ]; +} diff --git a/nix-personal/profiles/landing/default.nix b/nix-personal/profiles/landing/default.nix new file mode 100644 index 0000000..83fc770 --- /dev/null +++ b/nix-personal/profiles/landing/default.nix @@ -0,0 +1,7 @@ +{...}: { + imports = [../nginx.nix]; + services.nginx.virtualHosts."girlth.ing" = { + default = true; + root = ./.; + }; +} diff --git a/nix-personal/profiles/landing/html/index.html b/nix-personal/profiles/landing/html/index.html new file mode 100644 index 0000000..5d5f6be --- /dev/null +++ b/nix-personal/profiles/landing/html/index.html @@ -0,0 +1,5 @@ + + +

It works!

+ + diff --git a/nix-personal/profiles/nginx.nix b/nix-personal/profiles/nginx.nix new file mode 100644 index 0000000..60124e2 --- /dev/null +++ b/nix-personal/profiles/nginx.nix @@ -0,0 +1,4 @@ +{...}: { + networking.firewall.allowedTCPPorts = [80]; + services.nginx.enable = true; +} -- cgit v1.2.3