58 Commits

Author SHA1 Message Date
ea20d93079 fix: qcow-efi requires specific filesystem label 2025-07-04 22:59:40 -06:00
b323723115 turn on services for flame 2025-07-05 01:02:46 +00:00
89b260d12c fix hash output again for caddy 2025-07-03 23:02:36 -06:00
a0f4380c9f adjust workflow for nixos-anywhere 2025-07-03 23:02:28 -06:00
0a9774f9fa reenable features for flame 2025-07-03 22:34:50 -06:00
c569257f03 don't reboot for nixos-anywhere 2025-07-03 20:42:25 -06:00
d709030211 switch back to /dev/sda for volume path 2025-07-03 20:29:27 -06:00
ecf6bdda45 fix: must specify network type if launch options 2025-07-03 18:38:13 -06:00
5e2fca427d try using consistent volume naming for formatting disk 2025-07-03 18:34:09 -06:00
c5ad3c66ea try fixing serial tty on flame 2025-07-03 18:13:55 -06:00
6b5a01262e fix: nix-darwin deprecations of useractivationscripts 2025-07-02 18:48:23 -06:00
d16ed6a4fc try setting more options from the official oci-common example 2025-07-02 17:56:59 -06:00
6d5b460cb2 update flake lock 2025-07-02 14:57:56 -06:00
a5b628dd30 fix: homeConfigurations need to be flattened 2025-07-02 14:48:21 -06:00
5ed6870bdd allow darwin to build linux packages 2025-07-02 14:20:14 -06:00
26c1c09402 convenience tweaks 2025-07-02 14:19:57 -06:00
dd00ad6c2e try removing all other features from flame 2025-07-02 11:57:46 -06:00
192e08a9d9 try systemd-boot instead of grub for flame 2025-07-02 10:47:19 -06:00
227e6a68af try different disko config without lvm 2025-07-01 22:46:27 -06:00
444ede2074 try using disko to format for nixos-anywhere 2025-07-01 18:19:14 -06:00
c31fe46b61 try disabling some extra flame settings 2025-07-01 16:59:11 -06:00
28d9806720 fix: duplicate filesystems declaration for flame 2025-07-01 16:36:05 -06:00
5dea78926b run as aarch64 for nixos-anywhere deploy 2025-07-01 16:31:15 -06:00
e8571fe6b7 try to build on remote for cross-architecture 2025-07-01 16:09:41 -06:00
a9b3249e20 use actions deploy key for ssh instead of personal key
this will allow us to connect to the machine for nixos-anywhere
2025-07-01 16:02:03 -06:00
73002607ab fix: clean up llm drivel 2025-07-01 00:46:10 -04:00
267134044f temp: always install nix for nixos-anywhere 2025-07-01 00:42:35 -04:00
0621c66981 try giving up and going back to ubuntu vm 2025-07-01 00:40:56 -04:00
18b489592e attempts to add qcow-efi to get oracle to work
and also adding things from the oci build
2025-06-30 16:31:52 -04:00
928be5132a fix: missing data source for domains 2025-06-29 22:05:19 -04:00
11b7587783 fix: typos and llm inaccuracies 2025-06-29 22:02:51 -04:00
2704642b3d fix: os details for source image of oracle 2025-06-29 22:00:30 -04:00
95d86dcdff add terraform tfstate info 2025-06-29 21:57:58 -04:00
e8bc263081 fixes for name of qcow2 image 2025-06-29 21:52:07 -04:00
03d2326724 enable cross-compiling for aarch64 from gui machines 2025-06-29 08:24:27 -04:00
5bc980eea9 temp: disable ren-find to fix build error 2025-06-28 18:41:39 -04:00
a2866927f3 update hash for caddy cloudflare dns plugin 2025-06-28 16:15:04 -04:00
c2100cbc39 fix: typo 2025-06-28 16:02:21 -04:00
1d4b79e8f1 make sure litestream groups are appropriate 2025-06-28 16:00:06 -04:00
3974c6ce5d fix: issue with litestream group 2025-06-28 15:56:14 -04:00
67f6eb3a1c comment out uuids for flame filesystems 2025-06-28 15:45:57 -04:00
e0cd3c9d79 try to cross-compile to aarch64 on gh action x86 2025-06-28 15:42:10 -04:00
e7e94a1dc3 attempt to build and deploy to oracle 2025-06-28 15:31:17 -04:00
20fc80c259 fix: nix flake check and packages formatting 2025-06-21 23:38:37 -04:00
ae09296f36 fix aerc not using editor for composing 2025-06-17 21:28:10 -04:00
44f769f5ed add more gh shortcuts to zellij 2025-06-07 16:38:58 -04:00
6e29c95506 add mpv back to darwin 2025-06-07 16:38:23 -04:00
ac0a8d6c38 fix: remember to mount immich zfs dataset 2025-06-04 01:45:14 +00:00
6f32a0dfa3 fix: paperless upload 403s 2025-06-02 02:56:50 +00:00
9feaca58f3 add audiobooks to local dns 2025-06-02 02:56:40 +00:00
3084c90c13 add helix to power-user 2025-06-02 02:56:31 +00:00
f20d477f67 get around official filebrowser module 2025-06-02 02:56:19 +00:00
c8441fc265 enable daemon mode and sync v2 for atuin 2025-05-14 15:05:05 -04:00
23f46e51e6 zellij to trigger nix rebuild of hm and nixos or darwin 2025-05-14 15:04:49 -04:00
f2e09c9adc zellij function to do a gh run watch 2025-05-13 15:46:13 -04:00
f0add607e6 replace substituteAll function with replaceVars
substituteAll has been deprecated
2025-05-13 15:46:13 -04:00
b38205af93 setup karakeep basics 2025-05-12 03:07:38 +00:00
12c9342748 fix: rofi power menu glyphs cut off
the main issue is that i wasn't using the "mono" version of the nerd
font for hack. the font characters are not reported with the correct
fixed width which causes issues in rendering.
2025-05-10 10:53:54 -04:00
55 changed files with 1009 additions and 180 deletions

View File

@ -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' ) }}
env:
TERRAFORM_DIRECTORY: hosts/arrow/aws
TERRAFORM_DIRECTORY: deploy/aws
DEPLOY_IDENTITY_BASE64: ${{ secrets.DEPLOY_IDENTITY_BASE64 }}
ARROW_IDENTITY_BASE64: ${{ secrets.ARROW_IDENTITY_BASE64 }}
ZONE_NAME: masu.rs

200
.github/workflows/flame.yml vendored Normal file
View 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
View 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
View 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
View 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
}

View 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
View File

@ -22,11 +22,11 @@
]
},
"locked": {
"lastModified": 1746254942,
"narHash": "sha256-Y062AuRx6l+TJNX8wxZcT59SSLsqD9EedAY0mqgTtQE=",
"lastModified": 1751313918,
"narHash": "sha256-HsJM3XLa43WpG+665aGEh8iS8AfEwOIQWk3Mke3e7nk=",
"owner": "lnl7",
"repo": "nix-darwin",
"rev": "760a11c87009155afa0140d55c40e7c336d62d7a",
"rev": "e04a388232d9a6ba56967ce5b53a8a6f713cdfcf",
"type": "github"
},
"original": {
@ -43,11 +43,11 @@
]
},
"locked": {
"lastModified": 1745812220,
"narHash": "sha256-hotBG0EJ9VmAHJYF0yhWuTVZpENHvwcJ2SxvIPrXm+g=",
"lastModified": 1750903843,
"narHash": "sha256-Ng9+f0H5/dW+mq/XOKvB9uwvGbsuiiO6HrPdAcVglCs=",
"owner": "nix-community",
"repo": "disko",
"rev": "d0c543d740fad42fe2c035b43c9d41127e073c78",
"rev": "83c4da299c1d7d300f8c6fd3a72ac46cb0d59aae",
"type": "github"
},
"original": {
@ -76,11 +76,11 @@
"flake-compat_2": {
"flake": false,
"locked": {
"lastModified": 1733328505,
"narHash": "sha256-NeCCThCEP3eCl2l/+27kNNK7QrwZB1IJCrXfrbv5oqU=",
"lastModified": 1747046372,
"narHash": "sha256-CIVLLkVgvHYbgI2UpXvIIBJ12HWgX+fjA8Xf8PUmqCY=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "ff81ac966bb2cae68946d5ed5fc4994f96d0ffec",
"rev": "9100a0f413b0c601e0533d1d94ffd501ce2e7885",
"type": "github"
},
"original": {
@ -111,24 +111,6 @@
}
},
"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": {
"systems": [
"mac-app-util",
@ -148,9 +130,9 @@
"type": "indirect"
}
},
"flake-utils_3": {
"flake-utils_2": {
"inputs": {
"systems": "systems_3"
"systems": "systems_2"
},
"locked": {
"lastModified": 1705309234,
@ -166,9 +148,9 @@
"type": "github"
}
},
"flake-utils_4": {
"flake-utils_3": {
"inputs": {
"systems": "systems_4"
"systems": "systems_3"
},
"locked": {
"lastModified": 1731533236,
@ -186,18 +168,17 @@
},
"helix": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": [
"nixpkgs"
],
"rust-overlay": "rust-overlay"
},
"locked": {
"lastModified": 1746193606,
"narHash": "sha256-LD3ce/SlIY8Wr8XG52EI5t9bNa/peBCXykIJBvcGmO8=",
"lastModified": 1751378814,
"narHash": "sha256-pdYjEgdVYEerzxxmrM0GJAFGZ+J50NRD0rtDZ16SuTM=",
"owner": "helix-editor",
"repo": "helix",
"rev": "12139a4c30ad20d9a1b181de69532a57601cf96f",
"rev": "6a090471a800b1001bdfd2b6e0b710c1cd439a4e",
"type": "github"
},
"original": {
@ -213,11 +194,11 @@
]
},
"locked": {
"lastModified": 1746243165,
"narHash": "sha256-DQycVmlyLQNLjLJ/FzpokVmbxGQ8HjQQ4zN4nyq2vII=",
"lastModified": 1751485527,
"narHash": "sha256-E2AtD5UUeU50xco4gmgsCOs7tnBNsVi7+CdCZ4yQUrA=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "c0962eeeabfb8127713f859ec8a5f0e86dead0f2",
"rev": "25f003f8a9eae31a11938d53cb23e0b4a3c08d3a",
"type": "github"
},
"original": {
@ -231,11 +212,11 @@
"inputs": {
"cl-nix-lite": "cl-nix-lite",
"flake-compat": "flake-compat",
"flake-utils": "flake-utils_2",
"flake-utils": "flake-utils",
"nixpkgs": [
"nixpkgs"
],
"systems": "systems_2"
"systems": "systems"
},
"locked": {
"lastModified": 1742156590,
@ -253,7 +234,7 @@
},
"nix2vim": {
"inputs": {
"flake-utils": "flake-utils_3",
"flake-utils": "flake-utils_2",
"nixpkgs": [
"nixpkgs"
]
@ -295,11 +276,11 @@
]
},
"locked": {
"lastModified": 1742568034,
"narHash": "sha256-QaMEhcnscfF2MqB7flZr+sLJMMYZPnvqO4NYf9B4G38=",
"lastModified": 1747663185,
"narHash": "sha256-Obh50J+O9jhUM/FgXtI3he/QRNiV9+J53+l+RlKSaAk=",
"owner": "nix-community",
"repo": "nixos-generators",
"rev": "42ee229088490e3777ed7d1162cb9e9d8c3dbb11",
"rev": "ee07ba0d36c38e9915c55d2ac5a8fb0f05f2afcc",
"type": "github"
},
"original": {
@ -310,11 +291,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1746141548,
"narHash": "sha256-IgBWhX7A2oJmZFIrpRuMnw5RAufVnfvOgHWgIdds+hc=",
"lastModified": 1751271578,
"narHash": "sha256-P/SQmKDu06x8yv7i0s8bvnnuJYkxVGBWLWHaU+tt4YY=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "f02fddb8acef29a8b32f10a335d44828d7825b78",
"rev": "3016b4b15d13f3089db8a41ef937b13a9e33a8df",
"type": "github"
},
"original": {
@ -365,11 +346,11 @@
"treefmt-nix": "treefmt-nix"
},
"locked": {
"lastModified": 1746282980,
"narHash": "sha256-KOkO6aDwI8FOmMMv3MdO2WL95lMOJR4qDMUHPOoFtyM=",
"lastModified": 1751485261,
"narHash": "sha256-QtPZgSHeBdS6yr2E9SUjqusslh3ztxskn54vIwl3pzU=",
"owner": "nix-community",
"repo": "nur",
"rev": "e4be6680a4b231e712fef9c1cd5714f08a1ce51b",
"rev": "864d4a94df15802c83c212c2a9fe1d44eb6e78d5",
"type": "github"
},
"original": {
@ -425,11 +406,11 @@
]
},
"locked": {
"lastModified": 1745116541,
"narHash": "sha256-5xzA6dTfqCfTTDCo3ipPZzrg3wp01xmcr73y4cTNMP8=",
"lastModified": 1747363019,
"narHash": "sha256-N4dwkRBmpOosa4gfFkFf/LTD8oOcNkAyvZ07JvRDEf0=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "e2142ef330a61c02f274ac9a9cb6f8487a5d0080",
"rev": "0e624f2b1972a34be1a9b35290ed18ea4b419b6f",
"type": "github"
},
"original": {
@ -457,21 +438,6 @@
}
},
"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": {
"lastModified": 1689347925,
"narHash": "sha256-ozenz5bFe1UUqOn7f60HRmgc01BgTGIKZ4Xl+HbocGQ=",
@ -486,6 +452,21 @@
"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": {
"locked": {
"lastModified": 1681028828,
@ -516,21 +497,6 @@
"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": {
"inputs": {
"nixpkgs": [
@ -560,11 +526,11 @@
]
},
"locked": {
"lastModified": 1744290088,
"narHash": "sha256-/X9XVEl0EiyisNbF5srrxXRSVoRqdwExuqyspYqqEjQ=",
"lastModified": 1749574455,
"narHash": "sha256-fm2/8KPOYvvIAnNVtjDlTt/My00lIbZQ+LMrfQIWVzs=",
"owner": "nix-community",
"repo": "NixOS-WSL",
"rev": "60b4904a1390ac4c89e93d95f6ed928975e525ed",
"rev": "917af390377c573932d84b5e31dd9f2c1b5c0f09",
"type": "github"
},
"original": {
@ -575,18 +541,18 @@
},
"yazi": {
"inputs": {
"flake-utils": "flake-utils_4",
"flake-utils": "flake-utils_3",
"nixpkgs": [
"nixpkgs"
],
"rust-overlay": "rust-overlay_2"
},
"locked": {
"lastModified": 1746209831,
"narHash": "sha256-1R1MRxHmTbNUASTCdJTaaIEUevx18+XpVVxEcb0q7VM=",
"lastModified": 1751469973,
"narHash": "sha256-5Y1aVAYFmV20kmkhcHEQrDDvHiJVQGyYhD1SBCp639E=",
"owner": "sxyazi",
"repo": "yazi",
"rev": "a201c93419bede1f35c69a6b8b21ebbf4a752e6e",
"rev": "c7f800ad7ecf76e3431ad1b7005fa24b53726802",
"type": "github"
},
"original": {
@ -601,7 +567,7 @@
"nixpkgs"
],
"rust-overlay": "rust-overlay_3",
"systems": "systems_5"
"systems": "systems_4"
},
"locked": {
"lastModified": 1742588229,

View File

@ -117,6 +117,7 @@
in
{
audiobooks = "read.${baseName}";
bookmarks = "keep.${baseName}";
books = "books.${baseName}";
budget = "money.${baseName}";
content = "cloud.${baseName}";
@ -182,16 +183,18 @@
) hosts
) lib.hosts;
homeConfigurations = builtins.mapAttrs (
system: hosts:
homeConfigurations = flattenAttrset (
builtins.mapAttrs (
name: module:
lib.buildHome {
inherit system module;
specialArgs = { inherit hostnames; };
}
) hosts
) homeModules;
system: hosts:
builtins.mapAttrs (
name: module:
lib.buildHome {
inherit system module;
specialArgs = { inherit hostnames; };
}
) hosts
) homeModules
);
# Disk formatting, only used once
diskoConfigurations = {
@ -199,32 +202,48 @@
};
generators = builtins.mapAttrs (
# x86_64-linux = { arrow = ...; swan = ...; }
system: hosts:
builtins.mapAttrs (name: module: {
aws = lib.generateImage {
(lib.concatMapAttrs (name: module: {
"${name}-aws" = lib.generateImage {
inherit system module;
format = "amazon";
specialArgs = { inherit hostnames; };
};
iso = lib.generateImage {
"${name}-iso" = lib.generateImage {
inherit system module;
format = "iso";
specialArgs = { inherit hostnames; };
};
}) hosts
) lib.linuxHosts;
"${name}-qcow" = lib.generateImage {
inherit system module;
format = "qcow-efi";
specialArgs = { inherit hostnames; };
# extraModules = [ "${nixpkgs}/nixos/modules/virtualisation/oci-image.nix" ];
};
}) hosts)
) lib.linuxHosts # x86_64-linux = { arrow = ...; swan = ...; }
;
# packages =
# lib.forSystems lib.linuxSystems (
# system: generateImagesForHosts system // lib.pkgsBySystem.${system}.nmasur
# )
# // lib.forSystems lib.darwinSystems (system: lib.pkgsBySystem.${system}.nmasur);
packages = lib.forAllSystems (
system:
# Get the configurations that we normally use
{
inherit nixosConfigurations darwinConfigurations;
homeConfigurations = homeConfigurations.${system};
generators = generators.${system};
}
# Share the custom packages that I have placed under the nmasur namespace
lib.pkgsBySystem.${system}.nmasur
//
# Share the custom packages that I have placed under the nmasur namespace
lib.pkgsBySystem.${system}.nmasur
# Share generated images for each relevant host
(if (lib.hasInfix "linux" system) then generators.${system} else { })
# //
# # Oracle
# {
# flame-oci = nixosConfigurations.flame.config.system.build.OCIImage;
# }
);
# Development environments
@ -269,6 +288,6 @@
);
# Templates for starting other projects quickly
templates = (import ./templates nixpkgs.lib);
templates = (import ./templates { inherit lib; });
};
}

View File

@ -21,6 +21,7 @@ rec {
nmasur.settings = {
username = nmasur.settings.username;
fullName = nmasur.settings.fullName;
host = "lookingglass";
};
nmasur.profiles = {
common.enable = true;

View File

@ -23,6 +23,7 @@ rec {
nmasur.settings = {
username = nmasur.settings.username;
fullName = nmasur.settings.fullName;
host = networking.hostName;
};
nmasur.profiles = {
common.enable = true;
@ -36,18 +37,18 @@ rec {
system.stateVersion = "23.05";
# File systems must be declared in order to boot
# This is the root filesystem containing NixOS
# I forgot to set a clean label for it
fileSystems."/" = {
device = "/dev/disk/by-uuid/e1b6bd50-306d-429a-9f45-78f57bc597c3";
fsType = "ext4";
};
# # This is the root filesystem containing NixOS
# # I forgot to set a clean label for it
# fileSystems."/" = {
# device = "/dev/disk/by-uuid/e1b6bd50-306d-429a-9f45-78f57bc597c3";
# fsType = "ext4";
# };
# This is the boot filesystem for systemd-boot
fileSystems."/boot" = {
device = "/dev/disk/by-uuid/D5CA-237A";
fsType = "vfat";
};
# # This is the boot filesystem for systemd-boot
# fileSystems."/boot" = {
# device = "/dev/disk/by-uuid/D5CA-237A";
# fsType = "vfat";
# };
# Allows private remote access over the internet
nmasur.presets.services.cloudflared = {
@ -57,4 +58,111 @@ rec {
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;
}

View File

@ -19,6 +19,7 @@ rec {
nmasur.settings = {
username = nmasur.settings.username;
fullName = nmasur.settings.fullName;
host = networking.hostName;
};
nmasur.profiles = {
common.enable = true;

View File

@ -19,6 +19,7 @@ rec {
nmasur.settings = {
username = nmasur.settings.username;
fullName = nmasur.settings.fullName;
host = networking.hostName;
};
nmasur.profiles = {
common.enable = true;
@ -30,4 +31,24 @@ rec {
system.stateVersion = "23.05";
# This is the root filesystem containing NixOS
fileSystems."/" = {
device = "/dev/disk/by-label/nixos";
fsType = "ext4";
};
# This is the boot filesystem for Grub
fileSystems."/boot" = {
device = "/dev/disk/by-label/boot";
fsType = "vfat";
};
# Not sure what's necessary but too afraid to remove anything
boot.initrd.availableKernelModules = [
"xhci_pci"
"ahci"
"nvme"
"usb_storage"
"sd_mod"
];
}

View File

@ -23,6 +23,7 @@ rec {
nmasur.settings = {
username = nmasur.settings.username;
fullName = nmasur.settings.fullName;
host = networking.hostName;
};
nmasur.profiles = {
common.enable = true;

View File

@ -21,6 +21,7 @@ rec {
nmasur.settings = {
username = nmasur.settings.username;
fullName = nmasur.settings.fullName;
host = networking.hostName;
};
nmasur.profiles = {
common.enable = true;

View File

@ -23,6 +23,7 @@ rec {
nmasur.settings = {
username = nmasur.settings.username;
fullName = nmasur.settings.fullName;
host = networking.hostName;
};
nmasur.profiles = {
common.enable = true;

View File

@ -189,7 +189,15 @@ lib
amazon = {
aws.enable = true;
};
iso = { };
iso = {
nmasur.profiles.wsl.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;
fileSystems."/boot".device = lib.mkForce "/dev/disk/by-label/ESP";
};
};
generateImage =
@ -201,6 +209,7 @@ lib
}:
inputs.nixos-generators.nixosGenerate {
inherit system format;
pkgs = pkgsBySystem.${system};
modules = [
inputs.home-manager.nixosModules.home-manager
inputs.disko.nixosModules.disko

View File

@ -9,8 +9,8 @@
# Homebrew - Mac-specific packages that aren't in Nix
config = lib.mkIf pkgs.stdenv.isDarwin {
# Requires Homebrew to be installed
system.activationScripts.preUserActivation.text = ''
# # Requires Homebrew to be installed
system.activationScripts.preActivation.text = ''
if ! xcode-select --version 2>/dev/null; then
$DRY_RUN_CMD xcode-select --install
fi

View File

@ -9,7 +9,7 @@
# Sets Neovim colors based on Nix colorscheme
options.colors = lib.mkOption {
type = lib.types.attrsOf lib.types.str;
type = lib.types.nullOr (lib.types.attrsOf lib.types.str);
description = "Attrset of base16 colorscheme key value pairs.";
default = {
# Nord
@ -32,7 +32,7 @@
};
};
config = {
config = lib.mkIf (config.colors != null) {
plugins = [ pkgs.vimPlugins.base16-nvim ];
setup.base16-colorscheme = config.colors;

View File

@ -8,9 +8,9 @@
{
# Terraform optional because non-free
options.terraform = lib.mkEnableOption "Whether to enable Terraform LSP";
options.github = lib.mkEnableOption "Whether to enable GitHub features";
options.kubernetes = lib.mkEnableOption "Whether to enable Kubernetes features";
options.enableTerraform = lib.mkEnableOption "Whether to enable Terraform LSP";
options.enableGithub = lib.mkEnableOption "Whether to enable GitHub features";
options.enableKubernetes = lib.mkEnableOption "Whether to enable Kubernetes features";
config = {
plugins = [
@ -54,7 +54,7 @@
use.lspconfig.terraformls.setup = dsl.callWith {
cmd =
if config.terraform then
if config.enableTerraform then
[
"${pkgs.terraform-ls}/bin/terraform-ls"
"serve"
@ -93,7 +93,7 @@
nix = [ "nixfmt" ];
rust = [ "rustfmt" ];
sh = [ "shfmt" ];
terraform = if config.terraform then [ "terraform_fmt" ] else [ ];
terraform = if config.enableTerraform then [ "terraform_fmt" ] else [ ];
hcl = [ "hcl" ];
};
formatters = {
@ -110,7 +110,7 @@
"-ci"
];
};
terraform_fmt.command = if config.terraform then "${pkgs.terraform}/bin/terraform" else "";
terraform_fmt.command = if config.enableTerraform then "${pkgs.terraform}/bin/terraform" else "";
hcl.command = "${pkgs.hclfmt}/bin/hclfmt";
};
};

View File

@ -18,7 +18,7 @@
lua = ''
${builtins.readFile ./toggleterm.lua}
${if config.github then (builtins.readFile ./github.lua) else ""}
${if config.kubernetes then (builtins.readFile ./kubernetes.lua) else ""}
${if config.enableGithub then (builtins.readFile ./github.lua) else ""}
${if config.enableKubernetes then (builtins.readFile ./kubernetes.lua) else ""}
'';
}

View File

@ -29,9 +29,9 @@
{
pkgs,
colors ? null,
terraform ? false,
github ? false,
kubernetes ? false,
enableTerraform ? false,
enableGithub ? false,
enableKubernetes ? false,
...
}:
@ -41,9 +41,9 @@ pkgs.neovimBuilder {
package = pkgs.neovim-unwrapped;
inherit
colors
terraform
github
kubernetes
enableTerraform
enableGithub
enableKubernetes
;
imports = [
./config/align.nix

View File

@ -1,7 +1,7 @@
{
lib,
fetchFromGitHub,
nodejs_18,
nodejs_20,
buildNpmPackage,
nodePackages,
python3,
@ -29,7 +29,7 @@ buildNpmPackage (finalAttrs: rec {
npmDepsHash = "sha256-N8xqRYFelolNGTEhG22M7KJ7B5U/uW7o+/XfLF8rHMg=";
nativeBuildInputs = [
nodejs_18
nodejs_20
nodePackages.typescript
python3
nodePackages.node-gyp
@ -64,7 +64,7 @@ buildNpmPackage (finalAttrs: rec {
installPhase = ''
mkdir -p $out/{bin,lib}
cp -r . $out/lib/prometheus-actual-exporter
makeWrapper ${lib.getExe nodejs_18} $out/bin/prometheus-actual-exporter \
makeWrapper ${lib.getExe nodejs_20} $out/bin/prometheus-actual-exporter \
--add-flags "$out/lib/prometheus-actual-exporter/dist/app.js"
'';

View File

@ -21,10 +21,12 @@ in
virtualisation.diskSize = lib.mkDefault (16 * 1024); # In MB
boot.kernelPackages = lib.mkDefault pkgs.linuxKernel.packages.linux_6_6;
boot.loader.systemd-boot.enable = false;
boot.loader.efi.canTouchEfiVariables = false;
boot.loader.systemd-boot.enable = lib.mkForce false;
boot.loader.efi.canTouchEfiVariables = lib.mkForce false; # Default, conflicts with tempest
services.amazon-ssm-agent.enable = lib.mkDefault true;
users.users.ssm-user.extraGroups = [ "wheel" ];
services.udisks2.enable = lib.mkForce false; # Off by default already; conflicts with gvfs for nautilus
boot.loader.grub.device = lib.mkForce "/dev/xvda"; # Default, conflicts with tempest
boot.loader.grub.efiSupport = lib.mkForce false; # Default, conflicts with tempest
};
}

View File

@ -183,6 +183,9 @@ in
"audio/*" = "${pkgs.mpv}/bin/mpv -";
"image/*" = "${pkgs.feh}/bin/feh -";
};
compose = {
editor = config.home.sessionVariables.EDITOR;
};
};
};
accounts.email.accounts.home.aerc = {

View File

@ -15,6 +15,7 @@ in
config = lib.mkIf cfg.enable {
programs.atuin = {
enable = true;
daemon.enable = true;
flags = [
"--disable-up-arrow"
"--disable-ctrl-r"
@ -33,6 +34,7 @@ in
secrets_filter = true;
enter_accept = false;
keymap_mode = "vim-normal";
records = true; # Sync v2
};
};

View File

@ -17,6 +17,9 @@ in
programs.direnv = {
enable = true;
nix-direnv.enable = true;
config = {
global.hide_env_diff = true;
};
};
};
}

View File

@ -33,6 +33,7 @@ in
macos-titlebar-style = "hidden";
window-decoration = false;
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;
keybind = [
"super+t=unbind" # Pass super-t to underlying tool (e.g. zellij tabs)

View File

@ -21,6 +21,12 @@ in
config = lib.mkIf (cfg.enable) {
# These are useful for triggering from zellij (rather than running directly in the shell)
nmasur.presets.programs.nixpkgs.commands.rebuildNixos = pkgs.writeShellScriptBin "rebuild-darwin" ''
git -C ${config.nmasur.presets.programs.dotfiles.path} add --intent-to-add --all
darwin-rebuild switch --flake "${config.nmasur.presets.programs.dotfiles.path}#${config.nmasur.settings.host}"
'';
programs.fish = {
shellAbbrs = lib.mkIf config.nmasur.presets.programs.dotfiles.enable {
nr = {

View File

@ -11,10 +11,34 @@ in
{
options.nmasur.presets.programs.nixpkgs.enable = lib.mkEnableOption "Nixpkgs presets";
options.nmasur.presets.programs.nixpkgs = {
enable = lib.mkEnableOption "Nixpkgs presets";
commands = {
# These are useful for triggering from zellij (rather than running directly in the shell)
rebuildHome = lib.mkOption {
type = lib.types.package;
default = pkgs.writeShellScriptBin "rebuild-home" ''
git -C ${config.nmasur.presets.programs.dotfiles.path} add --intent-to-add --all
${lib.getExe pkgs.home-manager} switch --flake "${config.nmasur.presets.programs.dotfiles.path}#${config.nmasur.settings.host}"
'';
};
rebuildNixos = lib.mkOption {
type = lib.types.package;
default = pkgs.writeShellScriptBin "rebuild-nixos" ''
git -C ${config.nmasur.presets.programs.dotfiles.path} add --intent-to-add --all
doas nixos-rebuild switch --flake ${config.nmasur.presets.programs.dotfiles.path}
'';
};
};
};
config = lib.mkIf cfg.enable {
home.packages = [
cfg.commands.rebuildHome
cfg.commands.rebuildNixos
];
programs.fish = {
shellAbbrs = {
n = "nix";

View File

@ -5,7 +5,7 @@
* {
/* General */
font: "Hack Nerd Font 60";
font: "Hack Nerd Font Mono 60";
/* option menus: i3-layout, music, power and screenshot
*
@ -13,7 +13,6 @@
* around using this character: ■
* We then add add 100 actual padding around the icons.
* -12px 0px -19px -96px */
option-element-padding: 1% 1% 1% 1%;
option-5-window-padding: 4% 4%;
option-5-listview-spacing: 15px;
@ -46,7 +45,7 @@
layout: horizontal;
}
element {
padding: 40px 68px 43px 30px;
padding: 40px 62px 40px 36px;
}
#window {
padding: 20px;

View File

@ -34,6 +34,12 @@ in
zellij pipe --plugin file:$(which zellij-switch.wasm) -- "--cwd $TARGET_DIR --layout default --session $(basename $TARGET_DIR)"
'';
};
gh-run = {
body = # fish
''
zellij action new-pane --start-suspended -- gh run watch
'';
};
};
};
@ -115,6 +121,54 @@ in
close_on_exit = true;
};
};
"bind \"Alt Shift h\"" = {
Run = {
_args = [
(lib.getExe config.nmasur.presets.programs.nixpkgs.commands.rebuildHome)
];
# close_on_exit = false;
};
};
"bind \"Alt Shift r\"" = {
Run = {
_args = [
(lib.getExe config.nmasur.presets.programs.nixpkgs.commands.rebuildNixos)
];
# close_on_exit = false;
};
};
"bind \"Alt Shift w\"" = {
Run = {
_args = [
(lib.getExe pkgs.gh)
"run"
"watch"
];
# direction = "Right";
# close_on_exit = false;
# start_suspended = true;
};
};
"bind \"Alt Shift l\"" = {
Run = {
_args = [
(lib.getExe pkgs.gh)
"run"
"view"
"--log"
];
};
};
"bind \"Alt Shift f\"" = {
Run = {
_args = [
(lib.getExe pkgs.gh)
"run"
"view"
"--log-failed"
];
};
};
"bind \"Super Shift ]\"" = {
GoToNextTab = { };
};

View File

@ -18,16 +18,17 @@ in
xdg.configFile."hammerspoon/init.lua".source = ./init.lua;
xdg.configFile."hammerspoon/Spoons/ControlEscape.spoon".source = ./Spoons/ControlEscape.spoon;
xdg.configFile."hammerspoon/Spoons/DismissAlerts.spoon".source = ./Spoons/DismissAlerts.spoon;
xdg.configFile."hammerspoon/Spoons/Launcher.spoon/init.lua".source = pkgs.substituteAll {
src = ./Spoons/Launcher.spoon/init.lua;
discord = "${pkgs.discord}/Applications/Discord.app";
firefox = "${pkgs.firefox-unwrapped}/Applications/Firefox.app";
ghostty = "${config.programs.ghostty.package}/Applications/Ghostty.app";
obsidian = "${pkgs.obsidian}/Applications/Obsidian.app";
slack = "${pkgs.slack}/Applications/Slack.app";
wezterm = "${pkgs.wezterm}/Applications/WezTerm.app";
zed = "${pkgs.zed-editor}/Applications/Zed.app";
};
xdg.configFile."hammerspoon/Spoons/Launcher.spoon/init.lua".source =
pkgs.replaceVars ./Spoons/Launcher.spoon/init.lua
{
discord = "${pkgs.discord}/Applications/Discord.app";
firefox = "${pkgs.firefox-unwrapped}/Applications/Firefox.app";
ghostty = "${config.programs.ghostty.package}/Applications/Ghostty.app";
obsidian = "${pkgs.obsidian}/Applications/Obsidian.app";
slack = "${pkgs.slack}/Applications/Slack.app";
wezterm = "${pkgs.wezterm}/Applications/WezTerm.app";
zed = "${pkgs.zed-editor}/Applications/Zed.app";
};
xdg.configFile."hammerspoon/Spoons/MoveWindow.spoon".source = ./Spoons/MoveWindow.spoon;
home.activation.reloadHammerspoon = config.lib.dag.entryAfter [ "writeBoundary" ] ''

View File

@ -226,7 +226,7 @@ in
"module/power" = {
type = "custom/text";
content = " ";
click-left = config.nmasur.presets.services.i3.commands.toggleBar;
click-left = config.nmasur.presets.services.i3.commands.power;
click-right = "polybar-msg cmd restart";
content-foreground = config.theme.colors.base04;
};

View File

@ -19,6 +19,7 @@ in
fonts.enable = lib.mkDefault true;
services.hammerspoon.enable = lib.mkDefault true;
programs.nixpkgs-darwin.enable = lib.mkDefault true;
programs.mpv.enable = lib.mkDefault true;
};
home.homeDirectory = lib.mkForce "/Users/${config.home.username}";

View File

@ -27,8 +27,8 @@ in
pkgs.mpd # TUI slideshows
pkgs.nmasur.jqr # FZF fq JSON tool
pkgs.nmasur.osc # Clipboard over SSH
pkgs.nmasur.ren-find # Rename files
pkgs.nmasur.rep-grep # Replace text in files
# pkgs.nmasur.ren-find # Rename files
# pkgs.nmasur.rep-grep # Replace text in files
pkgs.pandoc # Convert text documents
pkgs.qrencode # Generate qr codes
pkgs.spacer # Output lines in terminal
@ -58,6 +58,7 @@ in
fish.enable = lib.mkDefault true;
fzf.enable = lib.mkDefault true;
git.enable = lib.mkDefault true;
helix.enable = lib.mkDefault true;
neovim.enable = lib.mkDefault true;
nix-index.enable = lib.mkDefault true;
nixpkgs.enable = lib.mkDefault true;

View File

@ -10,6 +10,10 @@
type = lib.types.str;
description = "Human readable name of the user";
};
host = lib.mkOption {
type = lib.types.str;
description = "Name of the host of this deployment";
};
hostnames = lib.mkOption {
type = lib.types.attrsOf lib.types.str;
description = "Map of service names to FQDNs";

View File

@ -15,7 +15,7 @@ in
config = lib.mkIf cfg.enable {
# Requires Homebrew to be installed
system.activationScripts.preUserActivation.text = ''
system.activationScripts.preActivation.text = ''
if ! xcode-select --version 2>/dev/null; then
$DRY_RUN_CMD xcode-select --install
fi

View File

@ -59,7 +59,7 @@ in
};
# User-level settings
system.activationScripts.postUserActivation.text = ''
system.activationScripts.postActivation.text = ''
echo "Show the ~/Library folder"
chflags nohidden ~/Library
'';

View File

@ -18,7 +18,7 @@ in
homebrew.casks = [ "hammerspoon" ];
system.activationScripts.postUserActivation.text = ''
system.activationScripts.postActivation.text = ''
defaults write org.hammerspoon.Hammerspoon MJConfigFile "${
config.home-manager.users.${username}.xdg.configHome
}/hammerspoon/init.lua"

View File

@ -15,7 +15,7 @@ in
config = lib.mkIf cfg.enable {
# User-level settings
system.activationScripts.postUserActivation.text = ''
system.activationScripts.postActivation.text = ''
echo "Reduce Menu Bar padding"
defaults write -globalDomain NSStatusItemSelectionPadding -int 6
defaults write -globalDomain NSStatusItemSpacing -int 6

View File

@ -14,6 +14,8 @@ in
config = lib.mkIf cfg.enable {
system.primaryUser = config.nmasur.settings.username;
nmasur.presets = {
programs = {
fish.enable = lib.mkDefault true;

View File

@ -20,5 +20,13 @@ in
"keybase" # GUI on Nix not available for macOS
];
nix.linux-builder = {
enable = true;
systems = [
"x86_64-linux"
"aarch64-linux"
];
};
};
}

View File

@ -23,6 +23,7 @@ let
hostnames.books
hostnames.download
hostnames.photos
hostnames.audiobooks
];
mkRecord = service: "${service} A ${localIp}";
localRecords = lib.concatLines (map mkRecord localServices);

View File

@ -68,7 +68,7 @@ in
# Tell Caddy to use Cloudflare DNS for ACME challenge validation
services.caddy.package = pkgs.caddy.withPlugins {
plugins = [ "github.com/caddy-dns/cloudflare@v0.2.1" ];
hash = "sha256-saKJatiBZ4775IV2C5JLOmZ4BwHKFtRZan94aS5pO90=";
hash = "sha256-2D7dnG50CwtCho+U+iHmSj2w14zllQXPjmTHr6lJZ/A=";
};
nmasur.presets.services.caddy.tlsPolicies = [
{

View File

@ -13,10 +13,17 @@ in
config = lib.mkIf cfg.enable {
services.filebrowser = {
nmasur.services.filebrowser = {
enable = true;
# Generate password: htpasswd -nBC 10 "" | tr -d ':\n'
passwordHash = "$2y$10$ze1cMob0k6pnXRjLowYfZOVZWg4G.dsPtH3TohbUeEbI0sdkG9.za";
# settings = {
# database = "/var/lib/filebrowser/filebrowser.db";
# port = 8020;
# address = "localhost";
# log = "stdout";
# "auth.method" = "json";
# };
};
nmasur.presets.services.caddy.routes = [

View File

@ -20,6 +20,7 @@ in
settings = {
actions.ENABLED = true;
metrics.ENABLED = true;
mailer.SENDMAIL_PATH = "/run/wrappers/bin/sendmail";
repository = {
# Pushing to a repo that doesn't exist automatically creates one as
# private.

View File

@ -0,0 +1,46 @@
{
config,
lib,
...
}:
let
cfg = config.nmasur.presets.services.karakeep;
inherit (config.nmasur.settings) hostnames;
in
{
options.nmasur.presets.services.karakeep.enable = lib.mkEnableOption "Karakeep bookmark manager";
config = lib.mkIf cfg.enable {
services.karakeep = {
enable = true;
meilisearch.enable = true;
extraEnvironment = {
PORT = "5599";
DISABLE_SIGNUPS = "true";
DISABLE_NEW_RELEASE_CHECK = "true";
CRAWLER_FULL_PAGE_SCREENSHOT = "true";
CRAWLER_FULL_PAGE_ARCHIVE = "true";
};
};
nmasur.presets.services.caddy.routes = [
{
match = [ { host = [ hostnames.bookmarks ]; } ];
handle = [
{
handler = "reverse_proxy";
upstreams = [
{ dial = "localhost:${config.services.karakeep.extraEnvironment.PORT}"; }
];
}
];
}
];
# Configure Cloudflare DNS to point to this machine
services.cloudflare-dyndns.domains = [ hostnames.bookmarks ];
};
}

View File

@ -37,6 +37,7 @@ in
config = lib.mkIf (cfg.enable) {
users.groups.backup = { };
users.groups.litestream = { };
secrets.litestream-backup = {
source = cfg.s3.accessKeySecret;
@ -45,6 +46,7 @@ in
permissions = "0440";
};
users.users.litestream.group = "litestream";
users.users.litestream.extraGroups = [ "backup" ];
services.litestream = {

View File

@ -19,6 +19,7 @@ in
passwordFile = config.secrets.paperless.dest;
settings = {
PAPERLESS_OCR_USER_ARGS = builtins.toJSON { invalidate_digital_signatures = true; };
PAPERLESS_URL = "https://${hostnames.paperless}";
# Enable if changing the path name in Caddy
# PAPERLESS_FORCE_SCRIPT_NAME = "/paperless";

View File

@ -54,6 +54,11 @@ in
"--keep-monthly 12"
"--keep-yearly 100"
];
timerConfig = {
OnCalendar = "daily";
Persistent = true;
RandomizedDelaySec = "3h";
};
};
};

View File

@ -41,6 +41,7 @@ in
"tank/generic"
"tank/nextcloud"
"tank/generic/git"
"tank/images"
];
# If password is requested and fails, continue to boot eventually
passwordTimeout = 300;

View File

@ -27,6 +27,7 @@ in
gitea.enable = lib.mkDefault true;
grafana.enable = lib.mkDefault true;
influxdb2.enable = lib.mkDefault true;
karakeep.enable = lib.mkDefault true;
litestream.enable = lib.mkDefault true;
mathesar.enable = lib.mkDefault true;
minecraft-server.enable = lib.mkDefault true;

View File

@ -21,6 +21,9 @@ in
nmasur.presets.programs.nautilus.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
services.betterlockscreen.enable = lib.mkDefault true;

View File

@ -5,8 +5,8 @@
...
}:
let
inherit (config.nmasur.settings) hostnames username;
cfg = config.services.filebrowser;
inherit (config.nmasur.settings) username;
cfg = config.nmasur.services.filebrowser;
dataDir = "/var/lib/filebrowser";
@ -26,7 +26,7 @@ let
in
{
options.services.filebrowser = {
options.nmasur.services.filebrowser = {
enable = lib.mkEnableOption "Filebrowser private files";
passwordHash = lib.mkOption {
type = lib.types.str;

View File

@ -6,14 +6,13 @@ lib.pipe (lib.filesystem.listFilesRecursive ./.) [
# Get only files ending in flake.nix
(builtins.filter (name: lib.hasSuffix "flake.nix" name))
# Import each template function
map
(file: rec {
(map (file: rec {
name = builtins.baseNameOf (builtins.dirOf file);
value = {
path = builtins.dirOf file;
description = "${name} template";
};
})
}))
# Convert to an attrset of template name -> template path and description
(builtins.listToAttrs)
]