mirror of
https://github.com/nmasur/dotfiles
synced 2025-08-23 12:34:42 +00:00
Compare commits
41 Commits
20fc80c259
...
89b260d12c
Author | SHA1 | Date | |
---|---|---|---|
|
89b260d12c | ||
|
a0f4380c9f | ||
|
0a9774f9fa | ||
|
c569257f03 | ||
|
d709030211 | ||
|
ecf6bdda45 | ||
|
5e2fca427d | ||
|
c5ad3c66ea | ||
|
6b5a01262e | ||
|
d16ed6a4fc | ||
|
6d5b460cb2 | ||
|
a5b628dd30 | ||
|
5ed6870bdd | ||
|
26c1c09402 | ||
|
dd00ad6c2e | ||
|
192e08a9d9 | ||
|
227e6a68af | ||
|
444ede2074 | ||
|
c31fe46b61 | ||
|
28d9806720 | ||
|
5dea78926b | ||
|
e8571fe6b7 | ||
|
a9b3249e20 | ||
|
73002607ab | ||
|
267134044f | ||
|
0621c66981 | ||
|
18b489592e | ||
|
928be5132a | ||
|
11b7587783 | ||
|
2704642b3d | ||
|
95d86dcdff | ||
|
e8bc263081 | ||
|
03d2326724 | ||
|
5bc980eea9 | ||
|
a2866927f3 | ||
|
c2100cbc39 | ||
|
1d4b79e8f1 | ||
|
3974c6ce5d | ||
|
67f6eb3a1c | ||
|
e0cd3c9d79 | ||
|
e7e94a1dc3 |
2
.github/workflows/arrow-aws.yml
vendored
2
.github/workflows/arrow-aws.yml
vendored
@@ -3,7 +3,7 @@ name: Arrow (AWS)
|
|||||||
run-name: Arrow (AWS) - ${{ inputs.rebuild && 'Rebuild and ' || '' }}${{ inputs.action == 'create' && 'Create' || ( inputs.action == 'destroy' && 'Destroy' || 'No Action' ) }}
|
run-name: Arrow (AWS) - ${{ inputs.rebuild && 'Rebuild and ' || '' }}${{ inputs.action == 'create' && 'Create' || ( inputs.action == 'destroy' && 'Destroy' || 'No Action' ) }}
|
||||||
|
|
||||||
env:
|
env:
|
||||||
TERRAFORM_DIRECTORY: hosts/arrow/aws
|
TERRAFORM_DIRECTORY: deploy/aws
|
||||||
DEPLOY_IDENTITY_BASE64: ${{ secrets.DEPLOY_IDENTITY_BASE64 }}
|
DEPLOY_IDENTITY_BASE64: ${{ secrets.DEPLOY_IDENTITY_BASE64 }}
|
||||||
ARROW_IDENTITY_BASE64: ${{ secrets.ARROW_IDENTITY_BASE64 }}
|
ARROW_IDENTITY_BASE64: ${{ secrets.ARROW_IDENTITY_BASE64 }}
|
||||||
ZONE_NAME: masu.rs
|
ZONE_NAME: masu.rs
|
||||||
|
200
.github/workflows/flame.yml
vendored
Normal file
200
.github/workflows/flame.yml
vendored
Normal file
@@ -0,0 +1,200 @@
|
|||||||
|
name: Flame
|
||||||
|
|
||||||
|
run-name: Flame - ${{ inputs.rebuild && 'Rebuild and ' || '' }}${{ inputs.action == 'create' && 'Create' || ( inputs.action == 'destroy' && 'Destroy' || 'No Action' ) }}
|
||||||
|
|
||||||
|
env:
|
||||||
|
TERRAFORM_DIRECTORY: deploy/oracle
|
||||||
|
DEPLOY_IDENTITY_BASE64: ${{ secrets.DEPLOY_IDENTITY_BASE64 }}
|
||||||
|
FLAME_IDENTITY_BASE64: ${{ secrets.FLAME_IDENTITY_BASE64 }}
|
||||||
|
ZONE_NAME: masu.rs
|
||||||
|
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
||||||
|
CLOUDFLARE_ZONE_ID: ${{ secrets.CLOUDFLARE_ZONE_ID }}
|
||||||
|
OCI_CLI_USER: "ocid1.user.oc1..aaaaaaaa6lro2eoxdajjypjysepvzcavq5yn4qyozjyebxdiaoqziribuqba"
|
||||||
|
OCI_CLI_TENANCY: "ocid1.tenancy.oc1..aaaaaaaaudwr2ozedhjnrn76ofjgglgug6gexknjisd7gb7tkj3mjdp763da"
|
||||||
|
OCI_CLI_FINGERPRINT: "dd:d0:da:6d:83:46:8b:b3:d9:45:2b:c7:56:ae:30:94"
|
||||||
|
OCI_CLI_KEY_CONTENT: "${{ secrets.OCI_PRIVATE_KEY }}"
|
||||||
|
TF_VAR_oci_private_key: "${{ secrets.OCI_PRIVATE_KEY }}"
|
||||||
|
OCI_CLI_REGION: "us-ashburn-1"
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
rebuild:
|
||||||
|
description: Rebuild Image
|
||||||
|
type: boolean
|
||||||
|
default: false
|
||||||
|
action:
|
||||||
|
description: Terraform Action
|
||||||
|
type: choice
|
||||||
|
required: true
|
||||||
|
default: create
|
||||||
|
options:
|
||||||
|
- create
|
||||||
|
- destroy
|
||||||
|
- nothing
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
id-token: write
|
||||||
|
contents: write
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-deploy:
|
||||||
|
name: Build and Deploy
|
||||||
|
# runs-on: ubuntu-latest
|
||||||
|
runs-on: ubuntu-24.04-arm
|
||||||
|
steps:
|
||||||
|
- name: Checkout Repo Code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
# - name: Write OCI Key to File
|
||||||
|
# run: |
|
||||||
|
# echo "${{ env.OCI_PRIVATE_KEY_BASE64 }}" | base64 -d > OCI_PRIVATE_KEY
|
||||||
|
|
||||||
|
# # Enable access to KVM, required to build an image
|
||||||
|
# - name: Enable KVM group perms
|
||||||
|
# if: inputs.rebuild && inputs.action != 'destroy'
|
||||||
|
# run: |
|
||||||
|
# echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
|
||||||
|
# sudo udevadm control --reload-rules
|
||||||
|
# sudo udevadm trigger --name-match=kvm
|
||||||
|
# sudo apt-get install -y qemu-user-static
|
||||||
|
|
||||||
|
# Install Nix
|
||||||
|
- name: Install Nix
|
||||||
|
# if: inputs.rebuild && inputs.action != 'destroy'
|
||||||
|
uses: cachix/install-nix-action@v31.4.1
|
||||||
|
with:
|
||||||
|
enable_kvm: true
|
||||||
|
extra_nix_config: |
|
||||||
|
system = aarch64-linux
|
||||||
|
system-features = aarch64-linux arm-linux kvm
|
||||||
|
|
||||||
|
# Build the image
|
||||||
|
- name: Build Image
|
||||||
|
if: inputs.rebuild && inputs.action != 'destroy'
|
||||||
|
run: nix build .#flame-qcow --system aarch64-linux
|
||||||
|
|
||||||
|
- name: List Images
|
||||||
|
if: inputs.rebuild && inputs.action != 'destroy'
|
||||||
|
run: |
|
||||||
|
ls -lh result/
|
||||||
|
echo "IMAGE_NAME=$(ls result/nixos.qcow2) >> $GITHUB_ENV
|
||||||
|
|
||||||
|
- name: Upload Image to S3
|
||||||
|
if: inputs.rebuild && inputs.action != 'destroy'
|
||||||
|
# env:
|
||||||
|
# AWS_ACCESS_KEY_ID: "<YOUR_OCI_ACCESS_KEY>"
|
||||||
|
# AWS_SECRET_ACCESS_KEY: "<YOUR_OCI_SECRET_KEY>"
|
||||||
|
# AWS_DEFAULT_REGION: "us-ashburn-1" # e.g., us-ashburn-1, us-phoenix-1
|
||||||
|
# AWS_ENDPOINT_URL: "https://masur.compat.objectstorage.us-ashburn-1.oraclecloud.com"
|
||||||
|
uses: oracle-actions/run-oci-cli-command@v1.3.2
|
||||||
|
with:
|
||||||
|
command: |
|
||||||
|
os object put \
|
||||||
|
--namespace "idptr5akf9pf" \
|
||||||
|
--bucket-name "noahmasur-images" \
|
||||||
|
--name "nixos.qcow2" \
|
||||||
|
--file "${IMAGE_NAME}" \
|
||||||
|
--part-size 128 \ # Optional: Specify part size in MiB for multipart uploads, default is 128 MiB
|
||||||
|
--parallel-upload-count 5 # Optional: Number of parallel uploads, default is 3
|
||||||
|
|
||||||
|
# Login to AWS
|
||||||
|
- name: AWS Assume Role
|
||||||
|
uses: aws-actions/configure-aws-credentials@v4
|
||||||
|
with:
|
||||||
|
role-to-assume: arn:aws:iam::286370965832:role/github_actions_admin
|
||||||
|
aws-region: us-east-1
|
||||||
|
|
||||||
|
# Installs the Terraform binary and some other accessory functions.
|
||||||
|
- name: Setup Terraform
|
||||||
|
uses: hashicorp/setup-terraform@v2
|
||||||
|
|
||||||
|
# Checks whether Terraform is formatted properly. If this fails, you
|
||||||
|
# should install the pre-commit hook.
|
||||||
|
- name: Check Formatting
|
||||||
|
working-directory: ${{ env.TERRAFORM_DIRECTORY }}
|
||||||
|
run: |
|
||||||
|
terraform fmt -no-color -check -diff -recursive
|
||||||
|
|
||||||
|
# Connects to remote state backend and download providers.
|
||||||
|
- name: Terraform Init
|
||||||
|
working-directory: ${{ env.TERRAFORM_DIRECTORY }}
|
||||||
|
run: terraform init -input=false
|
||||||
|
|
||||||
|
# Deploys infrastructure or changes to infrastructure.
|
||||||
|
- name: Terraform Apply
|
||||||
|
if: inputs.action == 'create'
|
||||||
|
working-directory: ${{ env.TERRAFORM_DIRECTORY }}
|
||||||
|
run: |
|
||||||
|
terraform apply \
|
||||||
|
-auto-approve \
|
||||||
|
-input=false
|
||||||
|
|
||||||
|
# Removes infrastructure.
|
||||||
|
- name: Terraform Destroy
|
||||||
|
if: inputs.action == 'destroy'
|
||||||
|
working-directory: ${{ env.TERRAFORM_DIRECTORY }}
|
||||||
|
run: |
|
||||||
|
terraform destroy \
|
||||||
|
-auto-approve \
|
||||||
|
-input=false
|
||||||
|
|
||||||
|
- name: Get Host IP
|
||||||
|
if: inputs.action == 'create'
|
||||||
|
id: host
|
||||||
|
working-directory: ${{ env.TERRAFORM_DIRECTORY }}
|
||||||
|
run: terraform output -raw host_ip
|
||||||
|
|
||||||
|
- name: Wait on SSH
|
||||||
|
if: inputs.action == 'create'
|
||||||
|
run: |
|
||||||
|
for i in $(seq 1 15); do
|
||||||
|
if $(nc -z -w 3 ${{ steps.host.outputs.stdout }} 22); then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
sleep 10
|
||||||
|
done
|
||||||
|
|
||||||
|
- name: Write Identity Keys to Files
|
||||||
|
if: inputs.action == 'create'
|
||||||
|
run: |
|
||||||
|
echo "${{ env.DEPLOY_IDENTITY_BASE64 }}" | base64 -d > deploy_ed25519
|
||||||
|
chmod 0600 deploy_ed25519
|
||||||
|
echo "${{ env.FLAME_IDENTITY_BASE64 }}" | base64 -d > flame_ed25519
|
||||||
|
chmod 0600 flame_ed25519
|
||||||
|
mkdir -pv "${HOME}/.ssh/"
|
||||||
|
cp deploy_ed25519 "${HOME}/.ssh/id_ed25519"
|
||||||
|
|
||||||
|
- name: Run nixos-anywhere
|
||||||
|
if: inputs.action == 'create'
|
||||||
|
run: |
|
||||||
|
nix run github:nix-community/nixos-anywhere -- --flake github:nmasur/dotfiles#flame --build-on remote --no-reboot --target-host ubuntu@${{ steps.host.outputs.stdout }}
|
||||||
|
reboot now
|
||||||
|
|
||||||
|
- name: Wait on SSH After Reboot
|
||||||
|
if: inputs.action == 'create'
|
||||||
|
run: |
|
||||||
|
for i in $(seq 1 15); do
|
||||||
|
if $(nc -z -w 3 ${{ steps.host.outputs.stdout }} 22); then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
sleep 10
|
||||||
|
done
|
||||||
|
|
||||||
|
- name: Copy Identity File to Host
|
||||||
|
if: inputs.action == 'create'
|
||||||
|
run: |
|
||||||
|
ssh -i deploy_ed25519 -o StrictHostKeyChecking=accept-new noah@${{ steps.host.outputs.stdout }} 'mkdir -pv .ssh'
|
||||||
|
scp -i deploy_ed25519 flame_ed25519 noah@${{ steps.host.outputs.stdout }}:~/.ssh/id_ed25519
|
||||||
|
|
||||||
|
# - name: Wipe Records
|
||||||
|
# if: ${{ inputs.action == 'destroy' }}
|
||||||
|
# run: |
|
||||||
|
# RECORD_ID=$(curl --request GET \
|
||||||
|
# --url https://api.cloudflare.com/client/v4/zones/${{ env.CLOUDFLARE_ZONE_ID }}/dns_records \
|
||||||
|
# --header 'Content-Type: application/json' \
|
||||||
|
# --header "Authorization: Bearer ${{ env.CLOUDFLARE_API_TOKEN }}" | jq -r '.result[] | select(.name == "n8n2.${{ env.ZONE_NAME }}") | .id')
|
||||||
|
# curl --request DELETE \
|
||||||
|
# --url https://api.cloudflare.com/client/v4/zones/${{ env.CLOUDFLARE_ZONE_ID }}/dns_records/${RECORD_ID} \
|
||||||
|
# --header 'Content-Type: application/json' \
|
||||||
|
# --header "Authorization: Bearer ${{ env.CLOUDFLARE_API_TOKEN }}"
|
115
deploy/oracle/main.tf
Normal file
115
deploy/oracle/main.tf
Normal file
@@ -0,0 +1,115 @@
|
|||||||
|
terraform {
|
||||||
|
backend "s3" {
|
||||||
|
bucket = "noahmasur-terraform"
|
||||||
|
key = "flame.tfstate"
|
||||||
|
region = "us-east-1"
|
||||||
|
use_lockfile = true
|
||||||
|
}
|
||||||
|
required_version = ">= 1.0.0"
|
||||||
|
required_providers {
|
||||||
|
oci = {
|
||||||
|
source = "oracle/oci"
|
||||||
|
version = "7.7.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
provider "oci" {
|
||||||
|
auth = "APIKey"
|
||||||
|
tenancy_ocid = var.compartment_ocid
|
||||||
|
user_ocid = "ocid1.user.oc1..aaaaaaaa6lro2eoxdajjypjysepvzcavq5yn4qyozjyebxdiaoqziribuqba"
|
||||||
|
private_key = var.oci_private_key
|
||||||
|
fingerprint = "dd:d0:da:6d:83:46:8b:b3:d9:45:2b:c7:56:ae:30:94"
|
||||||
|
region = "us-ashburn-1"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Get the latest Ubuntu image OCID
|
||||||
|
# We'll filter for a recent Ubuntu LTS version (e.g., 22.04 or 24.04) and pick the latest.
|
||||||
|
# Note: Image OCIDs are region-specific. This data source helps find the correct one.
|
||||||
|
data "oci_core_images" "ubuntu_image" {
|
||||||
|
compartment_id = var.compartment_ocid
|
||||||
|
operating_system = "Canonical Ubuntu"
|
||||||
|
# Adjust this version if you prefer a different Ubuntu LTS (e.g., "24.04")
|
||||||
|
operating_system_version = "24.04"
|
||||||
|
shape = var.instance_shape # Filter by the shape to ensure compatibility
|
||||||
|
sort_by = "TIMECREATED"
|
||||||
|
sort_order = "DESC"
|
||||||
|
}
|
||||||
|
|
||||||
|
# resource "oci_core_image" "my_custom_image" {
|
||||||
|
# compartment_id = var.compartment_ocid
|
||||||
|
# display_name = "noah-nixos"
|
||||||
|
|
||||||
|
# image_source_details {
|
||||||
|
# source_type = "objectStorageTuple" # Use this if specifying namespace, bucket, and object name
|
||||||
|
# # source_type = "objectStorageUri" # Use this if you have a pre-authenticated request URL (PAR)
|
||||||
|
# namespace_name = var.object_storage_namespace
|
||||||
|
# bucket_name = var.object_storage_bucket_name
|
||||||
|
# object_name = var.object_storage_object_name
|
||||||
|
|
||||||
|
# source_image_type = "QCOW2" # e.g., "QCOW2", "VMDK"
|
||||||
|
|
||||||
|
# # These properties help OCI understand how to launch instances from this image
|
||||||
|
# # Adjust based on your custom image's OS and boot mode
|
||||||
|
# operating_system = "NixOS" # e.g., "CentOS", "Debian", "Windows"
|
||||||
|
# operating_system_version = "25.05" # e.g., "7", "11", "2019"
|
||||||
|
# }
|
||||||
|
|
||||||
|
# launch_mode = "PARAVIRTUALIZED" # Or "NATIVE", "EMULATED", "CUSTOM"
|
||||||
|
# # Optional: for specific launch options if your image requires them
|
||||||
|
# # launch_options {
|
||||||
|
# # boot_volume_type = "PARAVIRTUALIZED"
|
||||||
|
# # firmware = "UEFI_64" # Or "BIOS"
|
||||||
|
# # network_type = "PARAVIRTUALIZED"
|
||||||
|
# # }
|
||||||
|
|
||||||
|
# # Time out for image import operation. Can take a while for large images.
|
||||||
|
# timeouts {
|
||||||
|
# create = "60m" # Default is 20m, often needs to be increased
|
||||||
|
# }
|
||||||
|
# }
|
||||||
|
|
||||||
|
data "oci_identity_availability_domains" "ads" {
|
||||||
|
compartment_id = var.compartment_ocid
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "oci_core_instance" "my_compute_instance" {
|
||||||
|
compartment_id = var.compartment_ocid
|
||||||
|
availability_domain = data.oci_identity_availability_domains.ads.availability_domains[0].name
|
||||||
|
shape = var.instance_shape
|
||||||
|
display_name = var.instance_display_name
|
||||||
|
|
||||||
|
source_details {
|
||||||
|
source_type = "image"
|
||||||
|
# Use the OCID of the latest Ubuntu image found by the data source
|
||||||
|
source_id = data.oci_core_images.ubuntu_image.images[0].id
|
||||||
|
# # Use the OCID of the newly imported custom image
|
||||||
|
# source_id = oci_core_image.my_custom_image.id
|
||||||
|
# Specify the boot volume size
|
||||||
|
boot_volume_size_in_gbs = var.boot_volume_size_in_gbs
|
||||||
|
boot_volume_vpus_per_gb = 20 # Highest free tier option
|
||||||
|
}
|
||||||
|
|
||||||
|
# launch_options {
|
||||||
|
# is_consistent_volume_naming_enabled = true # Sets boot device path to /dev/oracleoci/oraclevda
|
||||||
|
# network_type = "PARAVIRTUALIZED" # I think this is the default?
|
||||||
|
# }
|
||||||
|
|
||||||
|
create_vnic_details {
|
||||||
|
subnet_id = oci_core_subnet.my_public_subnet.id # Use the created subnet's ID
|
||||||
|
display_name = "primary_vnic"
|
||||||
|
assign_public_ip = true
|
||||||
|
hostname_label = "flame"
|
||||||
|
}
|
||||||
|
|
||||||
|
metadata = {
|
||||||
|
ssh_authorized_keys = var.ssh_public_key
|
||||||
|
user_data = base64encode(var.cloud_init_script)
|
||||||
|
}
|
||||||
|
|
||||||
|
# Optional: For flexible shapes (e.g., VM.Standard.E4.Flex), you might need to specify OCPUs and memory
|
||||||
|
shape_config {
|
||||||
|
ocpus = 4
|
||||||
|
memory_in_gbs = 24
|
||||||
|
}
|
||||||
|
}
|
126
deploy/oracle/network.tf
Normal file
126
deploy/oracle/network.tf
Normal file
@@ -0,0 +1,126 @@
|
|||||||
|
resource "oci_core_vcn" "my_vpc" {
|
||||||
|
compartment_id = var.compartment_ocid
|
||||||
|
display_name = "main"
|
||||||
|
cidr_block = "10.0.0.0/16"
|
||||||
|
is_ipv6enabled = false
|
||||||
|
dns_label = "mainvcn" # Must be unique within your tenancy
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "oci_core_internet_gateway" "my_igw" {
|
||||||
|
compartment_id = var.compartment_ocid
|
||||||
|
vcn_id = oci_core_vcn.my_vpc.id
|
||||||
|
display_name = "main-igw"
|
||||||
|
enabled = true
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "oci_core_route_table" "my_public_route_table" {
|
||||||
|
compartment_id = var.compartment_ocid
|
||||||
|
vcn_id = oci_core_vcn.my_vpc.id
|
||||||
|
display_name = "main-public-rt"
|
||||||
|
|
||||||
|
# Default route to the Internet Gateway
|
||||||
|
route_rules {
|
||||||
|
destination = "0.0.0.0/0"
|
||||||
|
destination_type = "CIDR_BLOCK"
|
||||||
|
network_entity_id = oci_core_internet_gateway.my_igw.id
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "oci_core_security_list" "my_public_security_list" {
|
||||||
|
compartment_id = var.compartment_ocid
|
||||||
|
vcn_id = oci_core_vcn.my_vpc.id
|
||||||
|
display_name = "main-public-sl"
|
||||||
|
|
||||||
|
# Egress Rules (Allow all outbound traffic)
|
||||||
|
egress_security_rules {
|
||||||
|
destination = "0.0.0.0/0"
|
||||||
|
destination_type = "CIDR_BLOCK"
|
||||||
|
protocol = "all"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Ingress Rules
|
||||||
|
ingress_security_rules {
|
||||||
|
# SSH (TCP 22)
|
||||||
|
protocol = "6" # TCP
|
||||||
|
source = "0.0.0.0/0"
|
||||||
|
source_type = "CIDR_BLOCK"
|
||||||
|
tcp_options {
|
||||||
|
min = 22
|
||||||
|
max = 22
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ingress_security_rules {
|
||||||
|
# HTTP (TCP 80)
|
||||||
|
protocol = "6" # TCP
|
||||||
|
source = "0.0.0.0/0"
|
||||||
|
source_type = "CIDR_BLOCK"
|
||||||
|
tcp_options {
|
||||||
|
min = 80
|
||||||
|
max = 80
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ingress_security_rules {
|
||||||
|
# HTTPS (TCP 443)
|
||||||
|
protocol = "6" # TCP
|
||||||
|
source = "0.0.0.0/0"
|
||||||
|
source_type = "CIDR_BLOCK"
|
||||||
|
tcp_options {
|
||||||
|
min = 443
|
||||||
|
max = 443
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ingress_security_rules {
|
||||||
|
# Custom Minecraft
|
||||||
|
protocol = "6" # TCP
|
||||||
|
source = "0.0.0.0/0"
|
||||||
|
source_type = "CIDR_BLOCK"
|
||||||
|
tcp_options {
|
||||||
|
min = 49732
|
||||||
|
max = 49732
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ingress_security_rules {
|
||||||
|
# HTTPS (UDP 443) - For QUIC or specific UDP services
|
||||||
|
protocol = "17" # UDP
|
||||||
|
source = "0.0.0.0/0"
|
||||||
|
source_type = "CIDR_BLOCK"
|
||||||
|
udp_options {
|
||||||
|
min = 443
|
||||||
|
max = 443
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ingress_security_rules {
|
||||||
|
# ICMP (Ping)
|
||||||
|
protocol = "1" # ICMP
|
||||||
|
source = "0.0.0.0/0"
|
||||||
|
source_type = "CIDR_BLOCK"
|
||||||
|
icmp_options {
|
||||||
|
type = 3 # Destination Unreachable (common for connectivity checks)
|
||||||
|
code = 4 # Fragmentation needed
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ingress_security_rules {
|
||||||
|
protocol = "1" # ICMP
|
||||||
|
source = "0.0.0.0/0"
|
||||||
|
source_type = "CIDR_BLOCK"
|
||||||
|
icmp_options {
|
||||||
|
type = 8 # Echo Request (ping)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "oci_core_subnet" "my_public_subnet" {
|
||||||
|
compartment_id = var.compartment_ocid
|
||||||
|
vcn_id = oci_core_vcn.my_vpc.id
|
||||||
|
display_name = "main-public-subnet"
|
||||||
|
cidr_block = "10.0.0.0/24"
|
||||||
|
prohibit_public_ip_on_vnic = false # Allows instances in this subnet to get public IPs
|
||||||
|
route_table_id = oci_core_route_table.my_public_route_table.id
|
||||||
|
security_list_ids = [oci_core_security_list.my_public_security_list.id]
|
||||||
|
dns_label = "mainsub" # Must be unique within the VCN
|
||||||
|
}
|
19
deploy/oracle/outputs.tf
Normal file
19
deploy/oracle/outputs.tf
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
output "host_ip" {
|
||||||
|
description = "The public IP address of the launched instance."
|
||||||
|
value = oci_core_instance.my_compute_instance.public_ip
|
||||||
|
}
|
||||||
|
|
||||||
|
output "instance_id" {
|
||||||
|
description = "The OCID of the launched instance."
|
||||||
|
value = oci_core_instance.my_compute_instance.id
|
||||||
|
}
|
||||||
|
|
||||||
|
output "vpc_ocid" {
|
||||||
|
description = "The OCID of the created VCN."
|
||||||
|
value = oci_core_vcn.my_vpc.id
|
||||||
|
}
|
||||||
|
|
||||||
|
output "subnet_ocid" {
|
||||||
|
description = "The OCID of the created public subnet."
|
||||||
|
value = oci_core_subnet.my_public_subnet.id
|
||||||
|
}
|
63
deploy/oracle/variables.tf
Normal file
63
deploy/oracle/variables.tf
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
variable "boot_volume_size_in_gbs" {
|
||||||
|
description = "The size of the boot volume in GBs."
|
||||||
|
type = number
|
||||||
|
default = 150
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "cloud_init_script" {
|
||||||
|
description = "A cloud-init script to run on instance launch."
|
||||||
|
type = string
|
||||||
|
default = <<-EOF
|
||||||
|
#!/bin/bash
|
||||||
|
echo "Hello from cloud-init!" > /home/ubuntu/cloud-init-output.txt
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "compartment_ocid" {
|
||||||
|
description = "The OCID of the compartment where the instance will be created."
|
||||||
|
type = string
|
||||||
|
default = "ocid1.tenancy.oc1..aaaaaaaaudwr2ozedhjnrn76ofjgglgug6gexknjisd7gb7tkj3mjdp763da"
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "instance_display_name" {
|
||||||
|
description = "A user-friendly name for the instance."
|
||||||
|
type = string
|
||||||
|
default = "noah-nixos"
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "instance_shape" {
|
||||||
|
description = "The shape of the OCI compute instance."
|
||||||
|
type = string
|
||||||
|
default = "VM.Standard.A1.Flex" # Example shape. Choose one available in your region/AD.
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "object_storage_namespace" {
|
||||||
|
description = "Your OCI Object Storage namespace (usually your tenancy name)."
|
||||||
|
type = string
|
||||||
|
default = "idptr5akf9pf"
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "object_storage_bucket_name" {
|
||||||
|
description = "The name of the Object Storage bucket where your custom image is located."
|
||||||
|
type = string
|
||||||
|
default = "noahmasur-images"
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "object_storage_object_name" {
|
||||||
|
description = "The object name (file name) of your custom image in Object Storage."
|
||||||
|
type = string
|
||||||
|
default = "nixos.qcow2"
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "oci_private_key" {
|
||||||
|
type = string
|
||||||
|
description = "API private key for Oracle Cloud management"
|
||||||
|
sensitive = true
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "ssh_public_key" {
|
||||||
|
description = "Your public SSH key content."
|
||||||
|
type = string
|
||||||
|
# default = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIB+AbmjGEwITk5CK9y7+Rg27Fokgj9QEjgc9wST6MA3s personal"
|
||||||
|
default = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKpPU2G9rSF8Q6waH62IJexDCQ6lY+8ZyVufGE3xMDGw actions-deploy"
|
||||||
|
}
|
148
flake.lock
generated
148
flake.lock
generated
@@ -22,11 +22,11 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1746254942,
|
"lastModified": 1751313918,
|
||||||
"narHash": "sha256-Y062AuRx6l+TJNX8wxZcT59SSLsqD9EedAY0mqgTtQE=",
|
"narHash": "sha256-HsJM3XLa43WpG+665aGEh8iS8AfEwOIQWk3Mke3e7nk=",
|
||||||
"owner": "lnl7",
|
"owner": "lnl7",
|
||||||
"repo": "nix-darwin",
|
"repo": "nix-darwin",
|
||||||
"rev": "760a11c87009155afa0140d55c40e7c336d62d7a",
|
"rev": "e04a388232d9a6ba56967ce5b53a8a6f713cdfcf",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -43,11 +43,11 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1745812220,
|
"lastModified": 1750903843,
|
||||||
"narHash": "sha256-hotBG0EJ9VmAHJYF0yhWuTVZpENHvwcJ2SxvIPrXm+g=",
|
"narHash": "sha256-Ng9+f0H5/dW+mq/XOKvB9uwvGbsuiiO6HrPdAcVglCs=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "disko",
|
"repo": "disko",
|
||||||
"rev": "d0c543d740fad42fe2c035b43c9d41127e073c78",
|
"rev": "83c4da299c1d7d300f8c6fd3a72ac46cb0d59aae",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -76,11 +76,11 @@
|
|||||||
"flake-compat_2": {
|
"flake-compat_2": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1733328505,
|
"lastModified": 1747046372,
|
||||||
"narHash": "sha256-NeCCThCEP3eCl2l/+27kNNK7QrwZB1IJCrXfrbv5oqU=",
|
"narHash": "sha256-CIVLLkVgvHYbgI2UpXvIIBJ12HWgX+fjA8Xf8PUmqCY=",
|
||||||
"owner": "edolstra",
|
"owner": "edolstra",
|
||||||
"repo": "flake-compat",
|
"repo": "flake-compat",
|
||||||
"rev": "ff81ac966bb2cae68946d5ed5fc4994f96d0ffec",
|
"rev": "9100a0f413b0c601e0533d1d94ffd501ce2e7885",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -111,24 +111,6 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"flake-utils": {
|
"flake-utils": {
|
||||||
"inputs": {
|
|
||||||
"systems": "systems"
|
|
||||||
},
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1731533236,
|
|
||||||
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
|
|
||||||
"owner": "numtide",
|
|
||||||
"repo": "flake-utils",
|
|
||||||
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "numtide",
|
|
||||||
"repo": "flake-utils",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"flake-utils_2": {
|
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"systems": [
|
"systems": [
|
||||||
"mac-app-util",
|
"mac-app-util",
|
||||||
@@ -148,9 +130,9 @@
|
|||||||
"type": "indirect"
|
"type": "indirect"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"flake-utils_3": {
|
"flake-utils_2": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"systems": "systems_3"
|
"systems": "systems_2"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1705309234,
|
"lastModified": 1705309234,
|
||||||
@@ -166,9 +148,9 @@
|
|||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"flake-utils_4": {
|
"flake-utils_3": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"systems": "systems_4"
|
"systems": "systems_3"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1731533236,
|
"lastModified": 1731533236,
|
||||||
@@ -186,18 +168,17 @@
|
|||||||
},
|
},
|
||||||
"helix": {
|
"helix": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"flake-utils": "flake-utils",
|
|
||||||
"nixpkgs": [
|
"nixpkgs": [
|
||||||
"nixpkgs"
|
"nixpkgs"
|
||||||
],
|
],
|
||||||
"rust-overlay": "rust-overlay"
|
"rust-overlay": "rust-overlay"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1746193606,
|
"lastModified": 1751378814,
|
||||||
"narHash": "sha256-LD3ce/SlIY8Wr8XG52EI5t9bNa/peBCXykIJBvcGmO8=",
|
"narHash": "sha256-pdYjEgdVYEerzxxmrM0GJAFGZ+J50NRD0rtDZ16SuTM=",
|
||||||
"owner": "helix-editor",
|
"owner": "helix-editor",
|
||||||
"repo": "helix",
|
"repo": "helix",
|
||||||
"rev": "12139a4c30ad20d9a1b181de69532a57601cf96f",
|
"rev": "6a090471a800b1001bdfd2b6e0b710c1cd439a4e",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -213,11 +194,11 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1746243165,
|
"lastModified": 1751485527,
|
||||||
"narHash": "sha256-DQycVmlyLQNLjLJ/FzpokVmbxGQ8HjQQ4zN4nyq2vII=",
|
"narHash": "sha256-E2AtD5UUeU50xco4gmgsCOs7tnBNsVi7+CdCZ4yQUrA=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "home-manager",
|
"repo": "home-manager",
|
||||||
"rev": "c0962eeeabfb8127713f859ec8a5f0e86dead0f2",
|
"rev": "25f003f8a9eae31a11938d53cb23e0b4a3c08d3a",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -231,11 +212,11 @@
|
|||||||
"inputs": {
|
"inputs": {
|
||||||
"cl-nix-lite": "cl-nix-lite",
|
"cl-nix-lite": "cl-nix-lite",
|
||||||
"flake-compat": "flake-compat",
|
"flake-compat": "flake-compat",
|
||||||
"flake-utils": "flake-utils_2",
|
"flake-utils": "flake-utils",
|
||||||
"nixpkgs": [
|
"nixpkgs": [
|
||||||
"nixpkgs"
|
"nixpkgs"
|
||||||
],
|
],
|
||||||
"systems": "systems_2"
|
"systems": "systems"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1742156590,
|
"lastModified": 1742156590,
|
||||||
@@ -253,7 +234,7 @@
|
|||||||
},
|
},
|
||||||
"nix2vim": {
|
"nix2vim": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"flake-utils": "flake-utils_3",
|
"flake-utils": "flake-utils_2",
|
||||||
"nixpkgs": [
|
"nixpkgs": [
|
||||||
"nixpkgs"
|
"nixpkgs"
|
||||||
]
|
]
|
||||||
@@ -295,11 +276,11 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1742568034,
|
"lastModified": 1747663185,
|
||||||
"narHash": "sha256-QaMEhcnscfF2MqB7flZr+sLJMMYZPnvqO4NYf9B4G38=",
|
"narHash": "sha256-Obh50J+O9jhUM/FgXtI3he/QRNiV9+J53+l+RlKSaAk=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "nixos-generators",
|
"repo": "nixos-generators",
|
||||||
"rev": "42ee229088490e3777ed7d1162cb9e9d8c3dbb11",
|
"rev": "ee07ba0d36c38e9915c55d2ac5a8fb0f05f2afcc",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -310,11 +291,11 @@
|
|||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1748693115,
|
"lastModified": 1751271578,
|
||||||
"narHash": "sha256-StSrWhklmDuXT93yc3GrTlb0cKSS0agTAxMGjLKAsY8=",
|
"narHash": "sha256-P/SQmKDu06x8yv7i0s8bvnnuJYkxVGBWLWHaU+tt4YY=",
|
||||||
"owner": "nixos",
|
"owner": "nixos",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "910796cabe436259a29a72e8d3f5e180fc6dfacc",
|
"rev": "3016b4b15d13f3089db8a41ef937b13a9e33a8df",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -365,11 +346,11 @@
|
|||||||
"treefmt-nix": "treefmt-nix"
|
"treefmt-nix": "treefmt-nix"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1746282980,
|
"lastModified": 1751485261,
|
||||||
"narHash": "sha256-KOkO6aDwI8FOmMMv3MdO2WL95lMOJR4qDMUHPOoFtyM=",
|
"narHash": "sha256-QtPZgSHeBdS6yr2E9SUjqusslh3ztxskn54vIwl3pzU=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "nur",
|
"repo": "nur",
|
||||||
"rev": "e4be6680a4b231e712fef9c1cd5714f08a1ce51b",
|
"rev": "864d4a94df15802c83c212c2a9fe1d44eb6e78d5",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -425,11 +406,11 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1745116541,
|
"lastModified": 1747363019,
|
||||||
"narHash": "sha256-5xzA6dTfqCfTTDCo3ipPZzrg3wp01xmcr73y4cTNMP8=",
|
"narHash": "sha256-N4dwkRBmpOosa4gfFkFf/LTD8oOcNkAyvZ07JvRDEf0=",
|
||||||
"owner": "oxalica",
|
"owner": "oxalica",
|
||||||
"repo": "rust-overlay",
|
"repo": "rust-overlay",
|
||||||
"rev": "e2142ef330a61c02f274ac9a9cb6f8487a5d0080",
|
"rev": "0e624f2b1972a34be1a9b35290ed18ea4b419b6f",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -457,21 +438,6 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"systems": {
|
"systems": {
|
||||||
"locked": {
|
|
||||||
"lastModified": 1681028828,
|
|
||||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
|
||||||
"owner": "nix-systems",
|
|
||||||
"repo": "default",
|
|
||||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "nix-systems",
|
|
||||||
"repo": "default",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"systems_2": {
|
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1689347925,
|
"lastModified": 1689347925,
|
||||||
"narHash": "sha256-ozenz5bFe1UUqOn7f60HRmgc01BgTGIKZ4Xl+HbocGQ=",
|
"narHash": "sha256-ozenz5bFe1UUqOn7f60HRmgc01BgTGIKZ4Xl+HbocGQ=",
|
||||||
@@ -486,6 +452,21 @@
|
|||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"systems_2": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1681028828,
|
||||||
|
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||||
|
"owner": "nix-systems",
|
||||||
|
"repo": "default",
|
||||||
|
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nix-systems",
|
||||||
|
"repo": "default",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"systems_3": {
|
"systems_3": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1681028828,
|
"lastModified": 1681028828,
|
||||||
@@ -516,21 +497,6 @@
|
|||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"systems_5": {
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1681028828,
|
|
||||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
|
||||||
"owner": "nix-systems",
|
|
||||||
"repo": "default",
|
|
||||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "nix-systems",
|
|
||||||
"repo": "default",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"treefmt-nix": {
|
"treefmt-nix": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"nixpkgs": [
|
"nixpkgs": [
|
||||||
@@ -560,11 +526,11 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1744290088,
|
"lastModified": 1749574455,
|
||||||
"narHash": "sha256-/X9XVEl0EiyisNbF5srrxXRSVoRqdwExuqyspYqqEjQ=",
|
"narHash": "sha256-fm2/8KPOYvvIAnNVtjDlTt/My00lIbZQ+LMrfQIWVzs=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "NixOS-WSL",
|
"repo": "NixOS-WSL",
|
||||||
"rev": "60b4904a1390ac4c89e93d95f6ed928975e525ed",
|
"rev": "917af390377c573932d84b5e31dd9f2c1b5c0f09",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -575,18 +541,18 @@
|
|||||||
},
|
},
|
||||||
"yazi": {
|
"yazi": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"flake-utils": "flake-utils_4",
|
"flake-utils": "flake-utils_3",
|
||||||
"nixpkgs": [
|
"nixpkgs": [
|
||||||
"nixpkgs"
|
"nixpkgs"
|
||||||
],
|
],
|
||||||
"rust-overlay": "rust-overlay_2"
|
"rust-overlay": "rust-overlay_2"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1746209831,
|
"lastModified": 1751469973,
|
||||||
"narHash": "sha256-1R1MRxHmTbNUASTCdJTaaIEUevx18+XpVVxEcb0q7VM=",
|
"narHash": "sha256-5Y1aVAYFmV20kmkhcHEQrDDvHiJVQGyYhD1SBCp639E=",
|
||||||
"owner": "sxyazi",
|
"owner": "sxyazi",
|
||||||
"repo": "yazi",
|
"repo": "yazi",
|
||||||
"rev": "a201c93419bede1f35c69a6b8b21ebbf4a752e6e",
|
"rev": "c7f800ad7ecf76e3431ad1b7005fa24b53726802",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -601,7 +567,7 @@
|
|||||||
"nixpkgs"
|
"nixpkgs"
|
||||||
],
|
],
|
||||||
"rust-overlay": "rust-overlay_3",
|
"rust-overlay": "rust-overlay_3",
|
||||||
"systems": "systems_5"
|
"systems": "systems_4"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1742588229,
|
"lastModified": 1742588229,
|
||||||
|
34
flake.nix
34
flake.nix
@@ -183,16 +183,18 @@
|
|||||||
) hosts
|
) hosts
|
||||||
) lib.hosts;
|
) lib.hosts;
|
||||||
|
|
||||||
homeConfigurations = builtins.mapAttrs (
|
homeConfigurations = flattenAttrset (
|
||||||
system: hosts:
|
|
||||||
builtins.mapAttrs (
|
builtins.mapAttrs (
|
||||||
name: module:
|
system: hosts:
|
||||||
lib.buildHome {
|
builtins.mapAttrs (
|
||||||
inherit system module;
|
name: module:
|
||||||
specialArgs = { inherit hostnames; };
|
lib.buildHome {
|
||||||
}
|
inherit system module;
|
||||||
) hosts
|
specialArgs = { inherit hostnames; };
|
||||||
) homeModules;
|
}
|
||||||
|
) hosts
|
||||||
|
) homeModules
|
||||||
|
);
|
||||||
|
|
||||||
# Disk formatting, only used once
|
# Disk formatting, only used once
|
||||||
diskoConfigurations = {
|
diskoConfigurations = {
|
||||||
@@ -213,6 +215,12 @@
|
|||||||
format = "iso";
|
format = "iso";
|
||||||
specialArgs = { inherit hostnames; };
|
specialArgs = { inherit hostnames; };
|
||||||
};
|
};
|
||||||
|
"${name}-qcow" = lib.generateImage {
|
||||||
|
inherit system module;
|
||||||
|
format = "qcow-efi";
|
||||||
|
specialArgs = { inherit hostnames; };
|
||||||
|
# extraModules = [ "${nixpkgs}/nixos/modules/virtualisation/oci-image.nix" ];
|
||||||
|
};
|
||||||
}) hosts)
|
}) hosts)
|
||||||
) lib.linuxHosts # x86_64-linux = { arrow = ...; swan = ...; }
|
) lib.linuxHosts # x86_64-linux = { arrow = ...; swan = ...; }
|
||||||
;
|
;
|
||||||
@@ -229,7 +237,13 @@
|
|||||||
lib.pkgsBySystem.${system}.nmasur
|
lib.pkgsBySystem.${system}.nmasur
|
||||||
//
|
//
|
||||||
# Share generated images for each relevant host
|
# Share generated images for each relevant host
|
||||||
generators.${system}
|
(if (lib.hasInfix "linux" system) then generators.${system} else { })
|
||||||
|
|
||||||
|
# //
|
||||||
|
# # Oracle
|
||||||
|
# {
|
||||||
|
# flame-oci = nixosConfigurations.flame.config.system.build.OCIImage;
|
||||||
|
# }
|
||||||
);
|
);
|
||||||
|
|
||||||
# Development environments
|
# Development environments
|
||||||
|
@@ -37,18 +37,18 @@ rec {
|
|||||||
system.stateVersion = "23.05";
|
system.stateVersion = "23.05";
|
||||||
# File systems must be declared in order to boot
|
# File systems must be declared in order to boot
|
||||||
|
|
||||||
# This is the root filesystem containing NixOS
|
# # This is the root filesystem containing NixOS
|
||||||
# I forgot to set a clean label for it
|
# # I forgot to set a clean label for it
|
||||||
fileSystems."/" = {
|
# fileSystems."/" = {
|
||||||
device = "/dev/disk/by-uuid/e1b6bd50-306d-429a-9f45-78f57bc597c3";
|
# device = "/dev/disk/by-uuid/e1b6bd50-306d-429a-9f45-78f57bc597c3";
|
||||||
fsType = "ext4";
|
# fsType = "ext4";
|
||||||
};
|
# };
|
||||||
|
|
||||||
# This is the boot filesystem for systemd-boot
|
# # This is the boot filesystem for systemd-boot
|
||||||
fileSystems."/boot" = {
|
# fileSystems."/boot" = {
|
||||||
device = "/dev/disk/by-uuid/D5CA-237A";
|
# device = "/dev/disk/by-uuid/D5CA-237A";
|
||||||
fsType = "vfat";
|
# fsType = "vfat";
|
||||||
};
|
# };
|
||||||
|
|
||||||
# Allows private remote access over the internet
|
# Allows private remote access over the internet
|
||||||
nmasur.presets.services.cloudflared = {
|
nmasur.presets.services.cloudflared = {
|
||||||
@@ -58,4 +58,111 @@ rec {
|
|||||||
ca = "ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBK/6oyVqjFGX3Uvrc3VS8J9sphxzAnRzKC85xgkHfYgR3TK6qBGXzHrknEj21xeZrr3G2y1UsGzphWJd9ZfIcdA= open-ssh-ca@cloudflareaccess.org";
|
ca = "ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBK/6oyVqjFGX3Uvrc3VS8J9sphxzAnRzKC85xgkHfYgR3TK6qBGXzHrknEj21xeZrr3G2y1UsGzphWJd9ZfIcdA= open-ssh-ca@cloudflareaccess.org";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# Taken from https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/virtualisation/oci-common.nix
|
||||||
|
|
||||||
|
# fileSystems."/" = {
|
||||||
|
# device = "/dev/disk/by-label/nixos";
|
||||||
|
# fsType = "ext4";
|
||||||
|
# autoResize = true;
|
||||||
|
# };
|
||||||
|
|
||||||
|
# fileSystems."/boot" = {
|
||||||
|
# device = "/dev/disk/by-label/ESP";
|
||||||
|
# fsType = "vfat";
|
||||||
|
# };
|
||||||
|
|
||||||
|
boot.loader.efi.canTouchEfiVariables = false;
|
||||||
|
boot.loader.grub = {
|
||||||
|
device = "nodev";
|
||||||
|
splashImage = null;
|
||||||
|
extraConfig = ''
|
||||||
|
serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1
|
||||||
|
terminal_input --append serial
|
||||||
|
terminal_output --append serial
|
||||||
|
'';
|
||||||
|
efiInstallAsRemovable = true;
|
||||||
|
efiSupport = true;
|
||||||
|
};
|
||||||
|
boot.loader.systemd-boot.enable = false;
|
||||||
|
|
||||||
|
# https://docs.oracle.com/en-us/iaas/Content/Compute/Tasks/configuringntpservice.htm#Configuring_the_Oracle_Cloud_Infrastructure_NTP_Service_for_an_Instance
|
||||||
|
networking.timeServers = [ "169.254.169.254" ];
|
||||||
|
|
||||||
|
boot.growPartition = true;
|
||||||
|
boot.kernelParams = [
|
||||||
|
"net.ifnames=0"
|
||||||
|
|
||||||
|
"nvme.shutdown_timeout=10"
|
||||||
|
"nvme_core.shutdown_timeout=10"
|
||||||
|
"libiscsi.debug_libiscsi_eh=1"
|
||||||
|
"crash_kexec_post_notifiers"
|
||||||
|
|
||||||
|
# aarch64-linux
|
||||||
|
"console=ttyAMA0,115200n8"
|
||||||
|
|
||||||
|
# VNC console
|
||||||
|
"console=tty1"
|
||||||
|
];
|
||||||
|
|
||||||
|
boot.initrd.availableKernelModules = [
|
||||||
|
"virtio_net"
|
||||||
|
"virtio_pci"
|
||||||
|
"virtio_mmio"
|
||||||
|
"virtio_blk"
|
||||||
|
"virtio_scsi"
|
||||||
|
"9p"
|
||||||
|
"9pnet_virtio"
|
||||||
|
];
|
||||||
|
boot.initrd.kernelModules = [
|
||||||
|
"virtio_balloon"
|
||||||
|
"virtio_console"
|
||||||
|
"virtio_rng"
|
||||||
|
"virtio_gpu"
|
||||||
|
];
|
||||||
|
|
||||||
|
networking.useDHCP = true;
|
||||||
|
# networking = {
|
||||||
|
# defaultGateway = "10.0.0.1";
|
||||||
|
# interfaces.eth0 = {
|
||||||
|
# ipAddress = throw "set your own";
|
||||||
|
# prefixLength = 24;
|
||||||
|
# };
|
||||||
|
# };
|
||||||
|
|
||||||
|
disko.devices = {
|
||||||
|
disk = {
|
||||||
|
main = {
|
||||||
|
type = "disk";
|
||||||
|
# device = "/dev/oracleoci/oraclevda"; # Consistent volume naming
|
||||||
|
device = "/dev/sda"; # Consistent volume naming
|
||||||
|
content = {
|
||||||
|
type = "gpt";
|
||||||
|
partitions = {
|
||||||
|
boot = {
|
||||||
|
size = "512M";
|
||||||
|
type = "EF00";
|
||||||
|
content = {
|
||||||
|
type = "filesystem";
|
||||||
|
format = "vfat";
|
||||||
|
mountpoint = "/boot";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
root = {
|
||||||
|
size = "100%";
|
||||||
|
content = {
|
||||||
|
type = "filesystem";
|
||||||
|
format = "ext4";
|
||||||
|
mountpoint = "/";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
# # Otherwise the instance may not have a working network-online.target,
|
||||||
|
# # making the fetch-ssh-keys.service fail
|
||||||
|
# networking.useNetworkd = true;
|
||||||
}
|
}
|
||||||
|
@@ -193,6 +193,10 @@ lib
|
|||||||
nmasur.profiles.wsl.enable = lib.mkForce false;
|
nmasur.profiles.wsl.enable = lib.mkForce false;
|
||||||
boot.loader.grub.enable = lib.mkForce false;
|
boot.loader.grub.enable = lib.mkForce false;
|
||||||
};
|
};
|
||||||
|
qcow-efi = {
|
||||||
|
nmasur.profiles.wsl.enable = lib.mkForce false;
|
||||||
|
boot.loader.grub.enable = lib.mkForce false;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
generateImage =
|
generateImage =
|
||||||
|
@@ -9,8 +9,8 @@
|
|||||||
# Homebrew - Mac-specific packages that aren't in Nix
|
# Homebrew - Mac-specific packages that aren't in Nix
|
||||||
config = lib.mkIf pkgs.stdenv.isDarwin {
|
config = lib.mkIf pkgs.stdenv.isDarwin {
|
||||||
|
|
||||||
# Requires Homebrew to be installed
|
# # Requires Homebrew to be installed
|
||||||
system.activationScripts.preUserActivation.text = ''
|
system.activationScripts.preActivation.text = ''
|
||||||
if ! xcode-select --version 2>/dev/null; then
|
if ! xcode-select --version 2>/dev/null; then
|
||||||
$DRY_RUN_CMD xcode-select --install
|
$DRY_RUN_CMD xcode-select --install
|
||||||
fi
|
fi
|
||||||
|
@@ -17,6 +17,9 @@ in
|
|||||||
programs.direnv = {
|
programs.direnv = {
|
||||||
enable = true;
|
enable = true;
|
||||||
nix-direnv.enable = true;
|
nix-direnv.enable = true;
|
||||||
|
config = {
|
||||||
|
global.hide_env_diff = true;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@@ -33,6 +33,7 @@ in
|
|||||||
macos-titlebar-style = "hidden";
|
macos-titlebar-style = "hidden";
|
||||||
window-decoration = false;
|
window-decoration = false;
|
||||||
macos-non-native-fullscreen = true;
|
macos-non-native-fullscreen = true;
|
||||||
|
quit-after-last-window-closed = lib.mkIf pkgs.stdenv.isDarwin true;
|
||||||
fullscreen = if pkgs.stdenv.isDarwin then true else false;
|
fullscreen = if pkgs.stdenv.isDarwin then true else false;
|
||||||
keybind = [
|
keybind = [
|
||||||
"super+t=unbind" # Pass super-t to underlying tool (e.g. zellij tabs)
|
"super+t=unbind" # Pass super-t to underlying tool (e.g. zellij tabs)
|
||||||
|
@@ -27,8 +27,8 @@ in
|
|||||||
pkgs.mpd # TUI slideshows
|
pkgs.mpd # TUI slideshows
|
||||||
pkgs.nmasur.jqr # FZF fq JSON tool
|
pkgs.nmasur.jqr # FZF fq JSON tool
|
||||||
pkgs.nmasur.osc # Clipboard over SSH
|
pkgs.nmasur.osc # Clipboard over SSH
|
||||||
pkgs.nmasur.ren-find # Rename files
|
# pkgs.nmasur.ren-find # Rename files
|
||||||
pkgs.nmasur.rep-grep # Replace text in files
|
# pkgs.nmasur.rep-grep # Replace text in files
|
||||||
pkgs.pandoc # Convert text documents
|
pkgs.pandoc # Convert text documents
|
||||||
pkgs.qrencode # Generate qr codes
|
pkgs.qrencode # Generate qr codes
|
||||||
pkgs.spacer # Output lines in terminal
|
pkgs.spacer # Output lines in terminal
|
||||||
|
@@ -15,7 +15,7 @@ in
|
|||||||
|
|
||||||
config = lib.mkIf cfg.enable {
|
config = lib.mkIf cfg.enable {
|
||||||
# Requires Homebrew to be installed
|
# Requires Homebrew to be installed
|
||||||
system.activationScripts.preUserActivation.text = ''
|
system.activationScripts.preActivation.text = ''
|
||||||
if ! xcode-select --version 2>/dev/null; then
|
if ! xcode-select --version 2>/dev/null; then
|
||||||
$DRY_RUN_CMD xcode-select --install
|
$DRY_RUN_CMD xcode-select --install
|
||||||
fi
|
fi
|
||||||
|
@@ -59,7 +59,7 @@ in
|
|||||||
};
|
};
|
||||||
|
|
||||||
# User-level settings
|
# User-level settings
|
||||||
system.activationScripts.postUserActivation.text = ''
|
system.activationScripts.postActivation.text = ''
|
||||||
echo "Show the ~/Library folder"
|
echo "Show the ~/Library folder"
|
||||||
chflags nohidden ~/Library
|
chflags nohidden ~/Library
|
||||||
'';
|
'';
|
||||||
|
@@ -18,7 +18,7 @@ in
|
|||||||
|
|
||||||
homebrew.casks = [ "hammerspoon" ];
|
homebrew.casks = [ "hammerspoon" ];
|
||||||
|
|
||||||
system.activationScripts.postUserActivation.text = ''
|
system.activationScripts.postActivation.text = ''
|
||||||
defaults write org.hammerspoon.Hammerspoon MJConfigFile "${
|
defaults write org.hammerspoon.Hammerspoon MJConfigFile "${
|
||||||
config.home-manager.users.${username}.xdg.configHome
|
config.home-manager.users.${username}.xdg.configHome
|
||||||
}/hammerspoon/init.lua"
|
}/hammerspoon/init.lua"
|
||||||
|
@@ -15,7 +15,7 @@ in
|
|||||||
config = lib.mkIf cfg.enable {
|
config = lib.mkIf cfg.enable {
|
||||||
|
|
||||||
# User-level settings
|
# User-level settings
|
||||||
system.activationScripts.postUserActivation.text = ''
|
system.activationScripts.postActivation.text = ''
|
||||||
echo "Reduce Menu Bar padding"
|
echo "Reduce Menu Bar padding"
|
||||||
defaults write -globalDomain NSStatusItemSelectionPadding -int 6
|
defaults write -globalDomain NSStatusItemSelectionPadding -int 6
|
||||||
defaults write -globalDomain NSStatusItemSpacing -int 6
|
defaults write -globalDomain NSStatusItemSpacing -int 6
|
||||||
|
@@ -14,6 +14,8 @@ in
|
|||||||
|
|
||||||
config = lib.mkIf cfg.enable {
|
config = lib.mkIf cfg.enable {
|
||||||
|
|
||||||
|
system.primaryUser = config.nmasur.settings.username;
|
||||||
|
|
||||||
nmasur.presets = {
|
nmasur.presets = {
|
||||||
programs = {
|
programs = {
|
||||||
fish.enable = lib.mkDefault true;
|
fish.enable = lib.mkDefault true;
|
||||||
|
@@ -20,5 +20,13 @@ in
|
|||||||
"keybase" # GUI on Nix not available for macOS
|
"keybase" # GUI on Nix not available for macOS
|
||||||
];
|
];
|
||||||
|
|
||||||
|
nix.linux-builder = {
|
||||||
|
enable = true;
|
||||||
|
systems = [
|
||||||
|
"x86_64-linux"
|
||||||
|
"aarch64-linux"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@@ -68,7 +68,7 @@ in
|
|||||||
# Tell Caddy to use Cloudflare DNS for ACME challenge validation
|
# Tell Caddy to use Cloudflare DNS for ACME challenge validation
|
||||||
services.caddy.package = pkgs.caddy.withPlugins {
|
services.caddy.package = pkgs.caddy.withPlugins {
|
||||||
plugins = [ "github.com/caddy-dns/cloudflare@v0.2.1" ];
|
plugins = [ "github.com/caddy-dns/cloudflare@v0.2.1" ];
|
||||||
hash = "sha256-saKJatiBZ4775IV2C5JLOmZ4BwHKFtRZan94aS5pO90=";
|
hash = "sha256-2D7dnG50CwtCho+U+iHmSj2w14zllQXPjmTHr6lJZ/A=";
|
||||||
};
|
};
|
||||||
nmasur.presets.services.caddy.tlsPolicies = [
|
nmasur.presets.services.caddy.tlsPolicies = [
|
||||||
{
|
{
|
||||||
|
@@ -37,6 +37,7 @@ in
|
|||||||
config = lib.mkIf (cfg.enable) {
|
config = lib.mkIf (cfg.enable) {
|
||||||
|
|
||||||
users.groups.backup = { };
|
users.groups.backup = { };
|
||||||
|
users.groups.litestream = { };
|
||||||
|
|
||||||
secrets.litestream-backup = {
|
secrets.litestream-backup = {
|
||||||
source = cfg.s3.accessKeySecret;
|
source = cfg.s3.accessKeySecret;
|
||||||
@@ -45,6 +46,7 @@ in
|
|||||||
permissions = "0440";
|
permissions = "0440";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
users.users.litestream.group = "litestream";
|
||||||
users.users.litestream.extraGroups = [ "backup" ];
|
users.users.litestream.extraGroups = [ "backup" ];
|
||||||
|
|
||||||
services.litestream = {
|
services.litestream = {
|
||||||
|
@@ -54,6 +54,11 @@ in
|
|||||||
"--keep-monthly 12"
|
"--keep-monthly 12"
|
||||||
"--keep-yearly 100"
|
"--keep-yearly 100"
|
||||||
];
|
];
|
||||||
|
timerConfig = {
|
||||||
|
OnCalendar = "daily";
|
||||||
|
Persistent = true;
|
||||||
|
RandomizedDelaySec = "3h";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -20,24 +20,24 @@ in
|
|||||||
msmtp.enable = lib.mkDefault true;
|
msmtp.enable = lib.mkDefault true;
|
||||||
};
|
};
|
||||||
services = {
|
services = {
|
||||||
actualbudget.enable = lib.mkDefault true;
|
# actualbudget.enable = lib.mkDefault true;
|
||||||
caddy.enable = lib.mkDefault true;
|
caddy.enable = lib.mkDefault true;
|
||||||
cloudflare.enable = lib.mkDefault true;
|
cloudflare.enable = lib.mkDefault true;
|
||||||
cloudflared.enable = lib.mkDefault true;
|
cloudflared.enable = lib.mkDefault true;
|
||||||
gitea.enable = lib.mkDefault true;
|
# gitea.enable = lib.mkDefault true;
|
||||||
grafana.enable = lib.mkDefault true;
|
# grafana.enable = lib.mkDefault true;
|
||||||
influxdb2.enable = lib.mkDefault true;
|
# influxdb2.enable = lib.mkDefault true;
|
||||||
karakeep.enable = lib.mkDefault true;
|
# karakeep.enable = lib.mkDefault true;
|
||||||
litestream.enable = lib.mkDefault true;
|
litestream.enable = lib.mkDefault true;
|
||||||
mathesar.enable = lib.mkDefault true;
|
mathesar.enable = lib.mkDefault true;
|
||||||
minecraft-server.enable = lib.mkDefault true;
|
minecraft-server.enable = lib.mkDefault true;
|
||||||
n8n.enable = lib.mkDefault true;
|
# n8n.enable = lib.mkDefault true;
|
||||||
nix-autoupgrade.enable = lib.mkDefault false; # On by default for communications
|
nix-autoupgrade.enable = lib.mkDefault false; # On by default for communications
|
||||||
ntfy-sh.enable = lib.mkDefault true;
|
# ntfy-sh.enable = lib.mkDefault true;
|
||||||
pgweb.enable = lib.mkDefault true;
|
pgweb.enable = lib.mkDefault true;
|
||||||
postgresql.enable = lib.mkDefault true;
|
postgresql.enable = lib.mkDefault true;
|
||||||
thelounge.enable = lib.mkDefault true;
|
# thelounge.enable = lib.mkDefault true;
|
||||||
uptime-kuma.enable = lib.mkDefault true;
|
# uptime-kuma.enable = lib.mkDefault true;
|
||||||
vaultwarden.enable = lib.mkDefault true;
|
vaultwarden.enable = lib.mkDefault true;
|
||||||
victoriametrics.enable = lib.mkDefault true;
|
victoriametrics.enable = lib.mkDefault true;
|
||||||
};
|
};
|
||||||
|
@@ -21,6 +21,9 @@ in
|
|||||||
nmasur.presets.programs.nautilus.enable = lib.mkDefault true;
|
nmasur.presets.programs.nautilus.enable = lib.mkDefault true;
|
||||||
nmasur.presets.services.pipewire.enable = lib.mkDefault true;
|
nmasur.presets.services.pipewire.enable = lib.mkDefault true;
|
||||||
|
|
||||||
|
# Allow cross-compiling my aarch64 builds
|
||||||
|
boot.binfmt.emulatedSystems = lib.mkDefault [ "aarch64-linux" ];
|
||||||
|
|
||||||
# Lock the system
|
# Lock the system
|
||||||
services.betterlockscreen.enable = lib.mkDefault true;
|
services.betterlockscreen.enable = lib.mkDefault true;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user