93 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
5d539abe21 shortcut for mpv shuffle mode 2025-05-10 10:39:51 -04:00
cea08761bb use alt-l and alt-h in zellij locked mode 2025-05-10 10:39:35 -04:00
eea972492e fix: betterlockscreen won't unlock system 2025-05-10 09:31:29 -04:00
9014ca226e fix: class focus for aerc in xorg 2025-05-10 08:21:36 -04:00
515859d22d add zed to darwin launcher 2025-05-08 16:22:36 -04:00
aa6c91b65c add lazygit as a preset with custom keybinds 2025-05-07 13:47:17 -04:00
d59692c813 fix pipewire and zellij on linux 2025-05-07 08:47:45 -04:00
88266c9f8d use regular firefox package on darwin 2025-05-07 08:17:34 -04:00
a1dfc77790 use enter key to save in helix 2025-05-07 08:17:11 -04:00
b3a7b280b5 package mathesar and run as service 2025-05-05 20:36:27 +00:00
e803e6a02a fix for cloudflare-dyndns using noproxy fix as well 2025-05-05 20:34:24 +00:00
61c4e68fef replace wezterm with ghostty on linux 2025-05-03 20:34:46 -04:00
faac8f3c8b forgot to include nautilus 2025-05-03 20:34:11 -04:00
9b30f91b1d adjust helix to include more comment tokens 2025-05-03 20:33:48 -04:00
5966368620 add ssh subdomain for git server 2025-05-03 22:09:36 +00:00
820f5afe0b fix: cloudflare dyndns noproxy api key issues 2025-05-03 19:37:16 +00:00
bfbacbe93e update lockfile and add pgweb, fixes to cloudflare caddy 2025-05-03 19:25:32 +00:00
54a073b946 switch to self-hosted git for bpc 2025-05-03 14:22:06 +00:00
8eede16bcd fix: staff requires bootloader 2025-04-26 13:02:46 -04:00
11e0992d99 semi-failed packaging of actual budget prometheus exporter 2025-04-23 19:20:45 +00:00
562295edb1 fix: wsl nativesystemd no longer used 2025-04-20 16:57:51 -04:00
a719dc4309 fix: arrow must have filesystems 2025-04-16 14:31:36 -04:00
0aecbd85cd switch actualbudget to native service 2025-04-14 21:46:20 +00:00
28ac5523f8 rename vm-agent to vmagent 2025-04-14 19:10:34 +00:00
645454cb9a fix: actual budget prometheus exporter 2025-04-14 19:10:22 +00:00
b30893d968 fix: secret format for cloudflare dyndns service 2025-04-12 17:08:09 +00:00
0ec67df9a3 try adding actual budget prometheus exporter 2025-04-11 21:46:11 -04:00
7182ca7cd4 make vmagent and sshd default for linux hosts 2025-04-11 21:45:46 -04:00
fbaa6f8894 enable ice menu bar cleanup for darwin 2025-04-11 21:45:20 -04:00
3873ab7296 move syncnotes to nix 2025-04-07 16:35:52 -04:00
7b32216684 aws ssm ssh in profile 2025-04-07 16:35:31 -04:00
2f042713cc helix use esc to collapse selection 2025-04-07 16:35:14 -04:00
011fb57347 fix: helix ignore for specific files 2025-04-07 16:35:00 -04:00
ce308a6347 fix helix manpager 2025-04-07 16:34:31 -04:00
31e93606f4 tabs working in zellij with ghostty 2025-04-07 16:33:50 -04:00
88 changed files with 2222 additions and 357 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' ) }} 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
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"
}

154
flake.lock generated
View File

@ -22,11 +22,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1743221873, "lastModified": 1751313918,
"narHash": "sha256-i8VPNm4UBsC3Ni6VwjojVJvCpS9GZ4vPrpFRtCGJzBs=", "narHash": "sha256-HsJM3XLa43WpG+665aGEh8iS8AfEwOIQWk3Mke3e7nk=",
"owner": "lnl7", "owner": "lnl7",
"repo": "nix-darwin", "repo": "nix-darwin",
"rev": "53d0f0ed11487a4476741fde757d0feabef4cc4e", "rev": "e04a388232d9a6ba56967ce5b53a8a6f713cdfcf",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -43,11 +43,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1741786315, "lastModified": 1750903843,
"narHash": "sha256-VT65AE2syHVj6v/DGB496bqBnu1PXrrzwlw07/Zpllc=", "narHash": "sha256-Ng9+f0H5/dW+mq/XOKvB9uwvGbsuiiO6HrPdAcVglCs=",
"owner": "nix-community", "owner": "nix-community",
"repo": "disko", "repo": "disko",
"rev": "0d8c6ad4a43906d14abd5c60e0ffe7b587b213de", "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": 1743346877, "lastModified": 1751378814,
"narHash": "sha256-WczB9koq4xvdBZoMLW8VFT16RGaDrJXyA0rDTg2GFVU=", "narHash": "sha256-pdYjEgdVYEerzxxmrM0GJAFGZ+J50NRD0rtDZ16SuTM=",
"owner": "helix-editor", "owner": "helix-editor",
"repo": "helix", "repo": "helix",
"rev": "e148d8b3110ace99505c0871714cd64391cc4ba3", "rev": "6a090471a800b1001bdfd2b6e0b710c1cd439a4e",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -213,11 +194,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1743346616, "lastModified": 1751485527,
"narHash": "sha256-AB/ve2el1TB7k4iyogHGCVlWVkrhp3+4FKKMr1W5iKQ=", "narHash": "sha256-E2AtD5UUeU50xco4gmgsCOs7tnBNsVi7+CdCZ4yQUrA=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "1d2ed9c503cf41ca7f3db091edc8519dcdcd8b41", "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,17 +234,17 @@
}, },
"nix2vim": { "nix2vim": {
"inputs": { "inputs": {
"flake-utils": "flake-utils_3", "flake-utils": "flake-utils_2",
"nixpkgs": [ "nixpkgs": [
"nixpkgs" "nixpkgs"
] ]
}, },
"locked": { "locked": {
"lastModified": 1740943170, "lastModified": 1745846717,
"narHash": "sha256-A0F7T/euSMen004cVQN/ZkMpLkgLXDs+mq/merhd+0Y=", "narHash": "sha256-GjwZEjCrI1/tQYylAQ+hU5JYD2hJI+rZmfICCIniWuE=",
"owner": "gytis-ivaskevicius", "owner": "gytis-ivaskevicius",
"repo": "nix2vim", "repo": "nix2vim",
"rev": "a562f32ff2393d0ed198103c65a3035bcdf83d4d", "rev": "0cd899a39b56d665115f72ffc7c37e0f4cf41dbe",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -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": 1743095683, "lastModified": 1751271578,
"narHash": "sha256-gWd4urRoLRe8GLVC/3rYRae1h+xfQzt09xOfb0PaHSk=", "narHash": "sha256-P/SQmKDu06x8yv7i0s8bvnnuJYkxVGBWLWHaU+tt4YY=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "5e5402ecbcb27af32284d4a62553c019a3a49ea6", "rev": "3016b4b15d13f3089db8a41ef937b13a9e33a8df",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -365,11 +346,11 @@
"treefmt-nix": "treefmt-nix" "treefmt-nix": "treefmt-nix"
}, },
"locked": { "locked": {
"lastModified": 1743335104, "lastModified": 1751485261,
"narHash": "sha256-wEEHpF+h+9m2QvjYtIx11EMi+sXG3wS9f/QSE6KPpJs=", "narHash": "sha256-QtPZgSHeBdS6yr2E9SUjqusslh3ztxskn54vIwl3pzU=",
"owner": "nix-community", "owner": "nix-community",
"repo": "nur", "repo": "nur",
"rev": "374adb7fb2c751f679519f8db532f726488293a0", "rev": "864d4a94df15802c83c212c2a9fe1d44eb6e78d5",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -425,11 +406,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1737080704, "lastModified": 1747363019,
"narHash": "sha256-n+J2h9GM9ZpFOQUmtZoCr1+DFF/iO5UlmLJeHIxbZGY=", "narHash": "sha256-N4dwkRBmpOosa4gfFkFf/LTD8oOcNkAyvZ07JvRDEf0=",
"owner": "oxalica", "owner": "oxalica",
"repo": "rust-overlay", "repo": "rust-overlay",
"rev": "f9953fe89f8b65401fc4d4a288940bc2cb072949", "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": 1743125458, "lastModified": 1749574455,
"narHash": "sha256-0z+5AMacL2Eqo92fAd0eCWeKVecWrxPJwd5/BIfcdJ8=", "narHash": "sha256-fm2/8KPOYvvIAnNVtjDlTt/My00lIbZQ+LMrfQIWVzs=",
"owner": "nix-community", "owner": "nix-community",
"repo": "NixOS-WSL", "repo": "NixOS-WSL",
"rev": "394c77f61ac76399290bfc2ef9d47b1fba31b215", "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": 1743344227, "lastModified": 1751469973,
"narHash": "sha256-Lp1JUMrhvAmCzftOSQ2Sr0+svemxSxcLeZ4HkmdLXbE=", "narHash": "sha256-5Y1aVAYFmV20kmkhcHEQrDDvHiJVQGyYhD1SBCp639E=",
"owner": "sxyazi", "owner": "sxyazi",
"repo": "yazi", "repo": "yazi",
"rev": "1765aba68440f73c590cedac14ece6778fe88ff5", "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,

View File

@ -117,6 +117,7 @@
in in
{ {
audiobooks = "read.${baseName}"; audiobooks = "read.${baseName}";
bookmarks = "keep.${baseName}";
books = "books.${baseName}"; books = "books.${baseName}";
budget = "money.${baseName}"; budget = "money.${baseName}";
content = "cloud.${baseName}"; content = "cloud.${baseName}";
@ -127,12 +128,14 @@
influxdb = "influxdb.${baseName}"; influxdb = "influxdb.${baseName}";
irc = "irc.${baseName}"; irc = "irc.${baseName}";
mail = "noahmasur.com"; mail = "noahmasur.com";
mathesar = "mathesar.${baseName}";
metrics = "metrics.${baseName}"; metrics = "metrics.${baseName}";
minecraft = "minecraft.${baseName}"; minecraft = "minecraft.${baseName}";
n8n = "n8n.${baseName}"; n8n = "n8n.${baseName}";
notifications = "ntfy.${baseName}"; notifications = "ntfy.${baseName}";
paperless = "paper.${baseName}"; paperless = "paper.${baseName}";
photos = "photos.${baseName}"; photos = "photos.${baseName}";
postgresql = "pg.${baseName}";
prometheus = "prom.${baseName}"; prometheus = "prom.${baseName}";
secrets = "vault.${baseName}"; secrets = "vault.${baseName}";
smtp = "smtp.purelymail.com"; smtp = "smtp.purelymail.com";
@ -180,7 +183,8 @@
) hosts ) hosts
) lib.hosts; ) lib.hosts;
homeConfigurations = builtins.mapAttrs ( homeConfigurations = flattenAttrset (
builtins.mapAttrs (
system: hosts: system: hosts:
builtins.mapAttrs ( builtins.mapAttrs (
name: module: name: module:
@ -189,7 +193,8 @@
specialArgs = { inherit hostnames; }; specialArgs = { inherit hostnames; };
} }
) hosts ) hosts
) homeModules; ) homeModules
);
# Disk formatting, only used once # Disk formatting, only used once
diskoConfigurations = { diskoConfigurations = {
@ -197,32 +202,48 @@
}; };
generators = builtins.mapAttrs ( generators = builtins.mapAttrs (
# x86_64-linux = { arrow = ...; swan = ...; }
system: hosts: system: hosts:
builtins.mapAttrs (name: module: { (lib.concatMapAttrs (name: module: {
aws = lib.generateImage { "${name}-aws" = lib.generateImage {
inherit system module; inherit system module;
format = "amazon"; format = "amazon";
specialArgs = { inherit hostnames; }; specialArgs = { inherit hostnames; };
}; };
iso = lib.generateImage { "${name}-iso" = lib.generateImage {
inherit system module; inherit system module;
format = "iso"; format = "iso";
specialArgs = { inherit hostnames; }; specialArgs = { inherit hostnames; };
}; };
}) hosts "${name}-qcow" = lib.generateImage {
) lib.linuxHosts; 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 ( packages = lib.forAllSystems (
system: 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 # Share the custom packages that I have placed under the nmasur namespace
lib.pkgsBySystem.${system}.nmasur 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 # Development environments
@ -267,6 +288,6 @@
); );
# Templates for starting other projects quickly # 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 = { nmasur.settings = {
username = nmasur.settings.username; username = nmasur.settings.username;
fullName = nmasur.settings.fullName; fullName = nmasur.settings.fullName;
host = "lookingglass";
}; };
nmasur.profiles = { nmasur.profiles = {
common.enable = true; common.enable = true;

View File

@ -23,6 +23,7 @@ rec {
nmasur.settings = { nmasur.settings = {
username = nmasur.settings.username; username = nmasur.settings.username;
fullName = nmasur.settings.fullName; fullName = nmasur.settings.fullName;
host = networking.hostName;
}; };
nmasur.profiles = { nmasur.profiles = {
common.enable = true; common.enable = true;
@ -36,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 = {
@ -57,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;
} }

View File

@ -19,6 +19,7 @@ rec {
nmasur.settings = { nmasur.settings = {
username = nmasur.settings.username; username = nmasur.settings.username;
fullName = nmasur.settings.fullName; fullName = nmasur.settings.fullName;
host = networking.hostName;
}; };
nmasur.profiles = { nmasur.profiles = {
common.enable = true; common.enable = true;
@ -29,4 +30,18 @@ rec {
system.stateVersion = "23.05"; system.stateVersion = "23.05";
# These filesystems are ignored by nixos-generators
# 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";
};
} }

View File

@ -19,6 +19,7 @@ rec {
nmasur.settings = { nmasur.settings = {
username = nmasur.settings.username; username = nmasur.settings.username;
fullName = nmasur.settings.fullName; fullName = nmasur.settings.fullName;
host = networking.hostName;
}; };
nmasur.profiles = { nmasur.profiles = {
common.enable = true; common.enable = true;
@ -30,4 +31,24 @@ rec {
system.stateVersion = "23.05"; 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 = { nmasur.settings = {
username = nmasur.settings.username; username = nmasur.settings.username;
fullName = nmasur.settings.fullName; fullName = nmasur.settings.fullName;
host = networking.hostName;
}; };
nmasur.profiles = { nmasur.profiles = {
common.enable = true; common.enable = true;
@ -41,6 +42,9 @@ rec {
# Not sure what's necessary but too afraid to remove anything # Not sure what's necessary but too afraid to remove anything
# File systems must be declared in order to boot # File systems must be declared in order to boot
# Required to have a boot loader to work
boot.loader.systemd-boot.enable = true;
# This is the root filesystem containing NixOS # This is the root filesystem containing NixOS
fileSystems."/" = { fileSystems."/" = {
device = "/dev/disk/by-label/nixos"; device = "/dev/disk/by-label/nixos";

View File

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

View File

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

View File

@ -189,7 +189,15 @@ lib
amazon = { amazon = {
aws.enable = true; 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 = generateImage =
@ -201,6 +209,7 @@ lib
}: }:
inputs.nixos-generators.nixosGenerate { inputs.nixos-generators.nixosGenerate {
inherit system format; inherit system format;
pkgs = pkgsBySystem.${system};
modules = [ modules = [
inputs.home-manager.nixosModules.home-manager inputs.home-manager.nixosModules.home-manager
inputs.disko.nixosModules.disko inputs.disko.nixosModules.disko

View File

@ -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

View File

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

View File

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

View File

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

View File

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

295
pkgs/mathesar/package.nix Normal file
View File

@ -0,0 +1,295 @@
{
runtimeShell,
python313,
python313Packages,
fetchFromGitHub,
fetchPypi,
fetchurl,
gettext,
unzip,
...
}:
let
django-modern-rpc = python313Packages.buildPythonPackage rec {
pname = "django_modern_rpc";
version = "1.1.0";
src = fetchPypi {
inherit pname version;
hash = "sha256-+LBIfkBxe9lvfZIqPI2lFSshTZBL1NpmCWBAgToyJns=";
};
doCheck = false;
pyproject = true;
build-system = [
python313Packages.setuptools
python313Packages.wheel
python313Packages.poetry-core
];
};
django-property-filter = python313Packages.buildPythonPackage rec {
pname = "django_property_filter";
version = "1.3.0";
src = fetchPypi {
inherit pname version;
hash = "sha256-dpsF4hm0S4lQ6tIRJ0bXgPjWTr1fq1NSCZP0M6L4Efk=";
};
doCheck = false;
pyproject = true;
build-system = [
python313Packages.setuptools
python313Packages.wheel
python313Packages.django
python313Packages.django-filter
];
};
django-fernet-encrypted-fields = python313Packages.buildPythonPackage rec {
pname = "django-fernet-encrypted-fields";
version = "0.3.0";
src = fetchPypi {
inherit pname version;
hash = "sha256-OAMb2vFySm6IXuE3zGaivX3DcmxDjhiep+RHmewLqbM=";
};
doCheck = false;
pyproject = true;
build-system = [
python313Packages.setuptools
python313Packages.wheel
];
propagatedBuildInputs = with python313Packages; [
django
cryptography
];
};
drf-access-policy = python313Packages.buildPythonPackage rec {
pname = "drf-access-policy";
version = "1.5.0";
src = fetchPypi {
inherit pname version;
hash = "sha256-EsahQYIgjUBUSi/W8GXbc7pvYLPRJ6kpJg6A3RkrjL8=";
};
doCheck = false;
pyproject = true;
build-system = [
python313Packages.setuptools
python313Packages.wheel
];
propagatedBuildInputs = with python313Packages; [
pyparsing
djangorestframework
];
};
pythonPkg = python313.override {
self = python313;
packageOverrides = pyfinal: pyprev: {
inherit
django-modern-rpc
django-property-filter
django-fernet-encrypted-fields
drf-access-policy
# psycopg-binary
;
};
};
python = pythonPkg.withPackages (
ps: with ps; [
gunicorn
django
clevercsv
django
dj-database-url
django-filter
django-modern-rpc
django-property-filter
djangorestframework
django-fernet-encrypted-fields
drf-access-policy
frozendict
gunicorn
psycopg
# psycopg-binary
psycopg2-binary
requests
sqlalchemy
whitenoise
]
);
staticAssets = fetchurl {
url = "https://github.com/mathesar-foundation/mathesar/releases/download/0.2.2/static_files.zip";
sha256 = "sha256-1X2zFpCSwilUxhqHlCw/tg8C5zVcVL6CxDa9yh0ylGA=";
};
in
python313Packages.buildPythonApplication rec {
pname = "mathesar";
version = "0.2.2";
src = fetchFromGitHub {
owner = "mathesar-foundation";
repo = "mathesar";
rev = version;
sha256 = "sha256-LHxFJpPV0GJfokSPzfZQO44bBg/+QjXsk04Ry9uhUAs=";
};
format = "other";
nativeBuildInputs = [ unzip ];
propagatedBuildInputs = [
python.pkgs.gunicorn
python.pkgs.django
];
buildInputs = [
gettext
];
dependencies = [
pythonPkg.pkgs.clevercsv
pythonPkg.pkgs.django
pythonPkg.pkgs.dj-database-url
pythonPkg.pkgs.django-filter
pythonPkg.pkgs.django-modern-rpc
pythonPkg.pkgs.django-property-filter
pythonPkg.pkgs.djangorestframework
pythonPkg.pkgs.django-fernet-encrypted-fields
pythonPkg.pkgs.drf-access-policy
pythonPkg.pkgs.frozendict
pythonPkg.pkgs.gunicorn
pythonPkg.pkgs.psycopg
pythonPkg.pkgs.psycopg2-binary
pythonPkg.pkgs.requests
pythonPkg.pkgs.sqlalchemy
pythonPkg.pkgs.whitenoise
];
# Manually unzip the extra zip file into a temporary directory
postUnpack = ''
mkdir -p $TMPDIR/unzipped
unzip ${staticAssets} -d $TMPDIR/unzipped
'';
# Override the default build phase to prevent it from looking for setup.py
# Add any non-Python build commands here if needed (e.g., building frontend assets)
buildPhase = ''
runHook preBuild
echo "Skipping standard Python build phase; application files copied in installPhase."
# If you had frontend assets to build, you'd run the command here, e.g.:
# npm install
# npm run build
runHook postBuild
'';
# This copies the application code into the Nix store output
installPhase = ''
runHook preInstall
# Destination: python's site-packages directory within $out
# This makes 'import mathesar', 'import db', etc. work more easily.
INSTALL_PATH="$out/lib/${python.libPrefix}/site-packages/${pname}"
mkdir -p "$INSTALL_PATH"
echo "Copying application code to $INSTALL_PATH"
# Copy all essential source directories needed at runtime
# Adjust this list based on mathesar's actual structure and runtime needs!
cp -r mathesar "$INSTALL_PATH/"
cp -r db "$INSTALL_PATH/"
cp -r config "$INSTALL_PATH/"
cp -r translations "$INSTALL_PATH/"
cp -r mathesar_ui "$INSTALL_PATH/" # If needed
# Copy the management script
cp manage.py "$INSTALL_PATH/"
# Copy assets from unzipped directory
mkdir -p "$INSTALL_PATH/mathesar/static/mathesar"
cp -r $TMPDIR/unzipped/static_files/* "$INSTALL_PATH/mathesar/static/mathesar"
# Create wrapper scripts in $out/bin for easy execution
mkdir -p $out/bin
# Wrapper for manage.py
# It ensures the app code is in PYTHONPATH and runs manage.py
echo "Creating manage.py wrapper..."
cat <<EOF > $out/bin/mathesar-manage
#!${python.interpreter}
import os
import sys
# Add the installation path to the Python path
sys.path.insert(0, "$INSTALL_PATH")
# Set DJANGO_SETTINGS_MODULE environment variable if required by mathesar
# You might need to adjust 'config.settings.production' to the actual settings file used
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'config.settings.production')
# Change directory to where manage.py is, if necessary for relative paths
# os.chdir("$INSTALL_PATH")
print(f"Running manage.py from: $INSTALL_PATH/manage.py")
print(f"Python path includes: $INSTALL_PATH")
print(f"Executing with args: {sys.argv[1:]}")
# Find manage.py and execute it
manage_py_path = os.path.join("$INSTALL_PATH", "manage.py")
if not os.path.exists(manage_py_path):
print(f"Error: manage.py not found at {manage_py_path}", file=sys.stderr)
sys.exit(1)
# Prepare arguments for execute_from_command_line
# The first argument should be the script name itself
argv = [manage_py_path] + sys.argv[1:]
try:
from django.core.management import execute_from_command_line
execute_from_command_line(argv)
except Exception as e:
print(f"Error executing manage.py: {e}", file=sys.stderr)
# Optionally re-raise or exit with error
import traceback
traceback.print_exc()
sys.exit(1)
EOF
chmod +x $out/bin/mathesar-manage
# Wrapper for install
echo "Creating install wrapper..."
cat <<EOF > $out/bin/mathesar-install
#!${runtimeShell}
# Add the app to the Python Path
export PYTHONPATH="$INSTALL_PATH:\${"PYTHONPATH:-"}"
# Set Django settings module if needed
export DJANGO_SETTINGS_MODULE='config.settings.production'
# Change to the app directory
cd "$INSTALL_PATH"
${python}/bin/python -m mathesar.install
EOF
chmod +x $out/bin/mathesar-install
# Wrapper for gunicorn (example)
# Assumes mathesar uses a standard wsgi entry point, e.g., config/wsgi.py
# Adjust 'config.wsgi:application' if necessary
echo "Creating gunicorn wrapper..."
cat <<EOF > $out/bin/mathesar-gunicorn
#!${runtimeShell}
# Add the app to the Python Path
export PYTHONPATH="$INSTALL_PATH:\${"PYTHONPATH:-"}"
# Set Django settings module if needed
export DJANGO_SETTINGS_MODULE='config.settings.production'
# Change to the app directory if gunicorn needs it
# cd "$INSTALL_PATH"
# Execute gunicorn, passing along any arguments
# Ensure the gunicorn package is in propagatedBuildInputs
exec ${python}/bin/gunicorn config.wsgi:application "\$@"
EOF
chmod +x $out/bin/mathesar-gunicorn
runHook postInstall
'';
}

View File

@ -5,11 +5,11 @@
pkgs.stdenv.mkDerivation rec { pkgs.stdenv.mkDerivation rec {
pname = "bypass-paywalls-clean"; pname = "bypass-paywalls-clean";
version = "4.0.6.1"; version = "4.1.1.4";
src = builtins.fetchGit { src = builtins.fetchGit {
url = "https://gitflic.ru/project/magnolia1234/bpc_uploads.git"; url = "https://git.masu.rs/noah/bpc-uploads.git";
ref = "main"; ref = "main";
rev = "85a367220f5ae2181354f65fb1093e2f1ac9e417"; rev = "9166b13355721b047878f259e04c2e9b476b4210";
}; };
preferLocalBuild = true; preferLocalBuild = true;
allowSubstitutes = true; allowSubstitutes = true;

View File

@ -0,0 +1,91 @@
{
lib,
fetchFromGitHub,
nodejs_20,
buildNpmPackage,
nodePackages,
python3,
gcc,
gnumake,
}:
let
in
buildNpmPackage (finalAttrs: rec {
pname = "prometheus-actual-exporter";
version = "1.1.5";
src = fetchFromGitHub {
owner = "sakowicz";
repo = "actual-budget-prometheus-exporter";
tag = version;
hash = "sha256-DAmWr1HngxAjhOJW9OnMfDqpxBcZT+Tpew/w/YYJIYU=";
};
patches = [ ./tsconfig.patch ];
npmDepsHash = "sha256-N8xqRYFelolNGTEhG22M7KJ7B5U/uW7o+/XfLF8rHMg=";
nativeBuildInputs = [
nodejs_20
nodePackages.typescript
python3
nodePackages.node-gyp
gcc
gnumake
];
postPatch = ''
echo "Removing better-sqlite3 install script before npm install"
sed -i '/"install"/d' node_modules/better-sqlite3/package.json || true
sed -i '/"install"/d' package.json || true
'';
preBuild = ''
echo "Disabling prebuilt install script from better-sqlite3"
find node_modules/better-sqlite3 -name package.json -exec sed -i '/"install"/d' {} +
rm -f node_modules/better-sqlite3/build/Release/better_sqlite3.node || true
'';
buildPhase = ''
# export npm_config_build_from_source=true
# export npm_config_unsafe_perm=true
# export BINARY_SITE=none
# export PATH=${nodePackages.node-gyp}/bin:$PATH
# export npm_config_node_gyp=${nodePackages.node-gyp}/bin/node-gyp
# npm rebuild better-sqlite3 --build-from-source --verbose
npm run build
'';
installPhase = ''
mkdir -p $out/{bin,lib}
cp -r . $out/lib/prometheus-actual-exporter
makeWrapper ${lib.getExe nodejs_20} $out/bin/prometheus-actual-exporter \
--add-flags "$out/lib/prometheus-actual-exporter/dist/app.js"
'';
postInstall = ''
echo "Removing prebuilt .node and rebuilding better-sqlite3"
export npm_config_build_from_source=true
export npm_config_unsafe_perm=true
export BINARY_SITE=none
export PATH=${nodePackages.node-gyp}/bin:$PATH
export npm_config_node_gyp=${nodePackages.node-gyp}/bin/node-gyp
sed -i '/"install"/d' node_modules/better-sqlite3/package.json
rm -f node_modules/better-sqlite3/build/Release/better_sqlite3.node || true
npm rebuild better-sqlite3 --build-from-source --verbose
'';
meta = {
description = "Prometheus exporter for Actual Budget";
homepage = "https://github.com/sakowicz/actual-budget-prometheus-exporter";
mainProgram = "prometheus-actual-exporter";
};
})

View File

@ -0,0 +1,12 @@
diff --git a/tsconfig.json b/tsconfig.json
index 5106135..3a340f6 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -8,5 +8,6 @@
"skipLibCheck": true,
"lib": ["es2020"],
"outDir": "./dist"
- }
+ },
+ "include": ["src/**/*", "app.ts"]
}

View File

@ -21,10 +21,12 @@ in
virtualisation.diskSize = lib.mkDefault (16 * 1024); # In MB virtualisation.diskSize = lib.mkDefault (16 * 1024); # In MB
boot.kernelPackages = lib.mkDefault pkgs.linuxKernel.packages.linux_6_6; boot.kernelPackages = lib.mkDefault pkgs.linuxKernel.packages.linux_6_6;
boot.loader.systemd-boot.enable = false; boot.loader.systemd-boot.enable = lib.mkForce false;
boot.loader.efi.canTouchEfiVariables = false; boot.loader.efi.canTouchEfiVariables = lib.mkForce false; # Default, conflicts with tempest
services.amazon-ssm-agent.enable = lib.mkDefault true; services.amazon-ssm-agent.enable = lib.mkDefault true;
users.users.ssm-user.extraGroups = [ "wheel" ]; 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 -"; "audio/*" = "${pkgs.mpv}/bin/mpv -";
"image/*" = "${pkgs.feh}/bin/feh -"; "image/*" = "${pkgs.feh}/bin/feh -";
}; };
compose = {
editor = config.home.sessionVariables.EDITOR;
};
}; };
}; };
accounts.email.accounts.home.aerc = { accounts.email.accounts.home.aerc = {
@ -199,16 +202,25 @@ in
exec = "${lib.getExe config.nmasur.presets.services.i3.terminal} aerc %u"; exec = "${lib.getExe config.nmasur.presets.services.i3.terminal} aerc %u";
}; };
xsession.windowManager.i3.config.keybindings = lib.mkIf pkgs.stdenv.isLinux { xsession.windowManager.i3.config.keybindings = lib.mkIf pkgs.stdenv.isLinux {
"${config.xsession.windowManager.i3.config.modifier}+Shift+e" = "exec ${ "${config.xsession.windowManager.i3.config.modifier}+Shift+e" =
let
terminal = config.nmasur.presets.services.i3.terminal;
startupCommand =
if terminal == pkgs.wezterm then
"start --class com.noah.aerc -- aerc"
else
"--class=com.noah.aerc --command=aerc";
in
"exec ${
# Don't name the script `aerc` or it will affect grep # Don't name the script `aerc` or it will affect grep
builtins.toString ( builtins.toString (
pkgs.writeShellScript "focus-mail.sh" '' pkgs.writeShellScript "focus-mail.sh" ''
count=$(ps aux | grep -c aerc) count=$(ps aux | grep -c aerc)
if [ "$count" -eq 1 ]; then if [ "$count" -eq 1 ]; then
i3-msg "exec --no-startup-id ${lib.getExe config.nmasur.presets.services.i3.terminal} start --class aerc -- aerc" i3-msg "exec --no-startup-id ${lib.getExe terminal} ${startupCommand}"
sleep 0.25 sleep 0.25
fi fi
i3-msg "[class=aerc] focus" i3-msg "[class=com.noah.aerc] focus"
'' ''
) )
}"; }";

View File

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

View File

@ -0,0 +1,19 @@
{ config, lib, ... }:
let
cfg = config.nmasur.presets.programs.aws-ssh;
in
{
options.nmasur.presets.programs.aws-ssh.enable = lib.mkEnableOption "AWS SSH tools";
config = lib.mkIf cfg.enable {
# Ignore wine directories in searches
home.file.".ssh/aws-ssm-ssh-proxy-command.sh" = {
text = builtins.readFile ./aws-ssm-ssh-proxy-command.sh;
executable = true;
};
};
}

View File

@ -0,0 +1,69 @@
#!/usr/bin/env bash
set -eu
################################################################################
#
# For documentation see https://github.com/qoomon/aws-ssm-ssh-proxy-command
#
################################################################################
getInstanceId() {
local instance_name="$1"
local instance_id=$(aws ec2 describe-instances --filters "Name=tag:Name,Values=${instance_name}" --query "Reservations[].Instances[?State.Name == 'running'].InstanceId" --output text)
echo "${instance_id}"
}
instance_name="$1"
ssh_user="$2"
ssh_port="$3"
ssh_public_key_path="$4"
ec2InstanceIdPattern='^m?i-[0-9a-f]{8,17}$'
if [[ $instance_name =~ $ec2InstanceIdPattern ]]; then
instance_id=$instance_name
else
instance_id=$(getInstanceId "$instance_name")
if [[ -z $instance_id ]]; then
echo "Found no running instances with name \"${instance_name}\"."
exit 1
else
echo "Instance ID for \"${instance_name}\": \"${instance_id}\""
fi
fi
REGION_SEPARATOR='--'
if echo "$instance_id" | grep -q -e "${REGION_SEPARATOR}"; then
export AWS_REGION="${instance_id##*"${REGION_SEPARATOR}"}"
instance_id="${instance_id%%"$REGION_SEPARATOR"*}"
fi
>/dev/stderr echo "Add public key ${ssh_public_key_path} for ${ssh_user} at instance ${instance_id} for 10 seconds"
ssh_public_key="$(cat "${ssh_public_key_path}")"
aws ssm send-command \
--instance-ids "${instance_id}" \
--document-name 'AWS-RunShellScript' \
--comment "Add an SSH public key to authorized_keys for 10 seconds" \
--parameters commands="
\"
set -eu
mkdir -p ~${ssh_user}/.ssh && cd ~${ssh_user}/.ssh
authorized_key='${ssh_public_key} ssm-session'
echo \\\"\${authorized_key}\\\" >> authorized_keys
sleep 10
(grep -v -F \\\"\${authorized_key}\\\" authorized_keys || true) > authorized_keys~
mv authorized_keys~ authorized_keys
\"
"
>/dev/stderr echo "Start ssm session to instance ${instance_id}"
aws ssm start-session \
--target "${instance_id}" \
--document-name 'AWS-StartSSHSession' \
--parameters "portNumber=${ssh_port}"

View File

@ -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;
};
}; };
}; };
} }

View File

@ -23,7 +23,7 @@ in
programs.firefox = { programs.firefox = {
enable = true; enable = true;
package = if pkgs.stdenv.isDarwin then pkgs.firefox-unwrapped else pkgs.firefox; package = pkgs.firefox;
profiles.default = { profiles.default = {
id = 0; id = 0;
name = "default"; name = "default";

View File

@ -14,6 +14,10 @@ in
options.nmasur.presets.programs.ghostty.enable = lib.mkEnableOption "Ghostty terminal"; options.nmasur.presets.programs.ghostty.enable = lib.mkEnableOption "Ghostty terminal";
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
# Set the i3 terminal
nmasur.presets.services.i3.terminal = config.programs.ghostty.package;
programs.ghostty = { programs.ghostty = {
enable = true; enable = true;
@ -29,13 +33,18 @@ 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;
fullscreen = true; quit-after-last-window-closed = lib.mkIf pkgs.stdenv.isDarwin true;
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)
"super+shift+]=unbind" "super+shift+]=unbind"
"super+shift+[=unbind" "super+shift+[=unbind"
"ctrl+tab=unbind" "ctrl+tab=unbind"
"ctrl+shift+tab=unbind" "ctrl+shift+tab=unbind"
"ctrl+tab=text:\\x1b[9;5u"
"ctrl+shift+tab=text:\\x1b[9;6u"
"super+k=unbind"
"super+shift+e=unbind"
]; ];
}; };
themes."gruvbox" = { themes."gruvbox" = {

View File

@ -22,7 +22,9 @@ in
# Set Neovim as the default app for text editing and manual pages # Set Neovim as the default app for text editing and manual pages
home.sessionVariables = { home.sessionVariables = {
EDITOR = lib.mkForce "${lib.getExe pkgs.helix}"; EDITOR = lib.mkForce "${lib.getExe pkgs.helix}";
MANPAGER = lib.mkForce "${lib.getExe pkgs.helix}"; MANPAGER = lib.mkForce "sh -c 'col -bx | ${lib.getExe pkgs.helix}'";
MANWIDTH = 87;
MANROFFOPT = "-c";
}; };
# Create quick aliases for launching Helix # Create quick aliases for launching Helix
@ -85,6 +87,14 @@ in
command = lib.getExe pkgs.mdformat; command = lib.getExe pkgs.mdformat;
args = [ "-" ]; args = [ "-" ];
}; };
# Allows return key to continue the token on the next line
comment-tokens = [
"-"
"+"
"*"
"- [ ]"
">"
];
} }
{ {
name = "tfvars"; name = "tfvars";
@ -118,10 +128,24 @@ in
}; };
ignores = [
"content/.obsidian/**"
];
settings = { settings = {
theme = "base16"; theme = "base16";
keys.normal = { keys.normal = {
# Use the enter key to save the file
ret = ":write";
# Get out of multiple cursors and selection
esc = [
"collapse_selection"
"keep_primary_selection"
];
# Enable and disable inlay hints # Enable and disable inlay hints
space.H = ":toggle lsp.display-inlay-hints"; space.H = ":toggle lsp.display-inlay-hints";
@ -211,6 +235,7 @@ in
}; };
}; };
}; };
}; };
themes."${config.programs.helix.settings.theme}" = { themes."${config.programs.helix.settings.theme}" = {

View File

@ -0,0 +1,96 @@
{
config,
pkgs,
lib,
...
}:
let
cfg = config.nmasur.presets.programs.lazygit;
in
{
options.nmasur.presets.programs.lazygit.enable = lib.mkEnableOption "Lazygit git TUI";
config = lib.mkIf cfg.enable {
programs.lazygit = {
enable = true;
settings = {
git.paging = {
# useConfig = true;
pager = "${pkgs.git}/share/git/contrib/diff-highlight/diff-highlight";
};
os = {
edit = "${config.home.sessionVariables.EDITOR} {{filename}}";
editAtLine = "${config.home.sessionVariables.EDITOR} {{filename}}:{{line}}";
editAtLineAndWait = "${config.home.sessionVariables.EDITOR} {{filename}}:{{line}}";
openDirInEditor = "${config.home.sessionVariables.EDITOR}";
open = "${config.home.sessionVariables.EDITOR} {{filename}}";
};
customCommands = [
{
key = "N";
context = "files";
command = "git add -N {{.SelectedFile.Name}}";
}
{
key = "<a-enter>";
context = "global";
command =
let
openGitUrl = pkgs.writeShellScriptBin "open-git-url" ''
# Try to get the remote URL using two common methods; suppress stderr for individual commands.
# "git remote get-url origin" is generally preferred.
# "git config --get remote.origin.url" is a fallback.
URL=$(git remote get-url origin 2>/dev/null || git config --get remote.origin.url 2>/dev/null);
# Check if a URL was actually found.
if [ -z "$URL" ]; then
# Send error message to stderr so it might appear in lazygit logs or notifications.
echo "Lazygit: Could not determine remote URL for 'origin'." >&2;
# Exit with an error code.
exit 1;
fi;
# Check if the URL is a GitHub SSH URL and convert it to HTTPS.
# This uses echo and grep to check for "@github.com" and then sed for transformation.
if echo "$URL" | grep -q "@github.com:"; then
# Transform git@github.com:user/repo.git to https://github.com/user/repo
# The first sed handles the main transformation.
# The second sed removes a trailing .git if present, for a cleaner URL.
URL=$(echo "$URL" | sed "s|git@github.com:|https://github.com/|" | sed "s|\.git$||");
# Optional: Log the transformation for debugging.
# echo "Lazygit: Transformed GitHub SSH URL to '$URL'" >&2;
fi;
# Determine the operating system.
OS="$(uname -s)";
# Optional: Echo for debugging. This might appear in lazygit logs or as a brief message.
# Remove " >&2" if you want to see it as a potential success message in lazygit UI (if it shows stdout).
# echo "Lazygit: Opening URL '$URL' on '$OS'" >&2;
# Execute the appropriate command to open the URL based on the OS.
case "$OS" in
Darwin*) # macOS
open "$URL";;
Linux*) # Linux
xdg-open "$URL";;
*) # Unsupported OS
echo "Lazygit: Unsupported OS ('$OS'). Could not open URL." >&2;
exit 1;;
esac
'';
in
lib.getExe openGitUrl;
}
];
};
};
programs.fish.shellAbbrs = {
lg = "lazygit";
};
};
}

View File

@ -31,5 +31,9 @@ in
pkgs.mpvScripts.mpv-delete-file pkgs.mpvScripts.mpv-delete-file
]; ];
}; };
programs.fish.shellAbbrs = {
mpvs = "mpv --shuffle=yes";
};
}; };
} }

View File

@ -21,6 +21,12 @@ in
config = lib.mkIf (cfg.enable) { 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 = { programs.fish = {
shellAbbrs = lib.mkIf config.nmasur.presets.programs.dotfiles.enable { shellAbbrs = lib.mkIf config.nmasur.presets.programs.dotfiles.enable {
nr = { 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 { config = lib.mkIf cfg.enable {
home.packages = [
cfg.commands.rebuildHome
cfg.commands.rebuildNixos
];
programs.fish = { programs.fish = {
shellAbbrs = { shellAbbrs = {
n = "nix"; n = "nix";

View File

@ -44,16 +44,17 @@ in
programs.fish.functions = { programs.fish.functions = {
syncnotes = { syncnotes = {
description = "Full git commit on notes"; description = "Full git commit on notes";
body = lib.getExe ( body =
pkgs.writers.writeFishBin "syncnotes" { let
makeWrapperArgs = [ git = lib.getExe pkgs.git;
"--prefix" in
"PATH" # fish
":" ''
"${lib.makeBinPath [ pkgs.git ]}" ${git} -C ${cfg.path} pull
]; ${git} -C ${cfg.path} add -A
} (builtins.readFile ./syncnotes.fish) ${git} -C ${cfg.path} commit -m autosync
); ${git} -C ${cfg.path} push
'';
}; };
note = { note = {
description = "Edit or create a note"; description = "Edit or create a note";

View File

@ -5,7 +5,7 @@
* { * {
/* General */ /* General */
font: "Hack Nerd Font 60"; font: "Hack Nerd Font Mono 60";
/* option menus: i3-layout, music, power and screenshot /* option menus: i3-layout, music, power and screenshot
* *
@ -13,7 +13,6 @@
* around using this character: ■ * around using this character: ■
* We then add add 100 actual padding around the icons. * We then add add 100 actual padding around the icons.
* -12px 0px -19px -96px */ * -12px 0px -19px -96px */
option-element-padding: 1% 1% 1% 1%;
option-5-window-padding: 4% 4%; option-5-window-padding: 4% 4%;
option-5-listview-spacing: 15px; option-5-listview-spacing: 15px;
@ -46,7 +45,7 @@
layout: horizontal; layout: horizontal;
} }
element { element {
padding: 40px 68px 43px 30px; padding: 40px 62px 40px 36px;
} }
#window { #window {
padding: 20px; 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)" 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
'';
};
}; };
}; };
@ -106,7 +112,7 @@ in
}; };
shared = { shared = {
"bind \"Alt Shift p\"" = { "bind \"Alt Shift p\"" = {
"Run" = { Run = {
_args = [ _args = [
"${pkgs.fish}/bin/fish" "${pkgs.fish}/bin/fish"
"-c" "-c"
@ -115,26 +121,103 @@ in
close_on_exit = true; close_on_exit = true;
}; };
}; };
"bind \"Alt Shift k\"" = { "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 = { };
};
"bind \"Super Shift [\"" = {
GoToPreviousTab = { };
};
"bind \"Ctrl Tab\"" = {
GoToNextTab = { };
};
"bind \"Ctrl Shift Tab\"" = {
GoToPreviousTab = { };
};
"bind \"Super t\"" = lib.mkIf pkgs.stdenv.isDarwin {
NewTab = { };
};
"bind \"Alt t\"" = lib.mkIf pkgs.stdenv.isLinux {
NewTab = { };
};
"bind \"Super k\"" = lib.mkIf pkgs.stdenv.isDarwin {
SwitchToMode = {
_args = [ "scroll" ];
};
};
"bind \"Alt k\"" = lib.mkIf pkgs.stdenv.isLinux {
SwitchToMode = {
_args = [ "scroll" ];
};
};
"bind \"Super Shift e\"" = lib.mkIf pkgs.stdenv.isDarwin {
EditScrollback = { }; EditScrollback = { };
SwitchToMode = { SwitchToMode = {
_args = [ "locked" ]; _args = [ "locked" ];
}; };
}; };
"bind \"Super Shift ]\"" = { "bind \"Alt Shift e\"" = lib.mkIf pkgs.stdenv.isLinux {
"GoToNextTab" = { }; EditScrollback = { };
SwitchToMode = {
_args = [ "locked" ];
}; };
"bind \"Super Shift [\"" = {
"GoToPreviousTab" = { };
}; };
"bind \"Ctrl Tab\"" = { "bind \"Alt l\"" = {
"GoToNextTab" = { }; MoveFocusOrTab = {
_args = [ "Right" ];
}; };
"bind \"Ctrl Shift Tab\"" = {
"GoToPreviousTab" = { };
}; };
"bind \"Super t\"" = { "bind \"Alt h\"" = {
"NewTab" = { }; MoveFocusOrTab = {
_args = [ "Left" ];
};
}; };
}; };

View File

@ -105,6 +105,9 @@ function obj:init()
self.launcher:bind("", "Z", function() self.launcher:bind("", "Z", function()
self:switch("zoom.us.app") self:switch("zoom.us.app")
end) end)
self.launcher:bind("shift", "Z", function()
self:switch("@zed@")
end)
end end
function obj:switch(app) function obj:switch(app)

View File

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

View File

@ -94,7 +94,7 @@ in
ws10 = "10:X"; ws10 = "10:X";
in in
{ {
terminal = cfg.terminal.meta.mainProgram; # terminal = cfg.terminal.meta.mainProgram;
modifier = modifier; modifier = modifier;
assigns = { assigns = {
"${ws1}" = [ { class = "Firefox"; } ]; "${ws1}" = [ { class = "Firefox"; } ];
@ -103,6 +103,7 @@ in
{ class = "kitty"; } { class = "kitty"; }
{ class = "obsidian"; } { class = "obsidian"; }
{ class = "wezterm"; } { class = "wezterm"; }
{ class = "ghostty"; }
]; ];
"${ws3}" = [ { class = "discord"; } ]; "${ws3}" = [ { class = "discord"; } ];
"${ws4}" = [ "${ws4}" = [
@ -213,9 +214,9 @@ in
cfg.commands.lockScreen != null cfg.commands.lockScreen != null
) "exec ${cfg.commands.lockScreen}"; ) "exec ${cfg.commands.lockScreen}";
"${modifier}+Mod1+h" = "${modifier}+Mod1+h" =
"exec --no-startup-id ${lib.getExe cfg.terminal} -e sh -c '${pkgs.home-manager}/bin/home-manager switch --flake ${config.nmasur.presets.programs.dotfiles.path} || read'"; "exec --no-startup-id ${lib.getExe cfg.terminal} --command sh -c '${pkgs.home-manager}/bin/home-manager switch --flake ${config.nmasur.presets.programs.dotfiles.path} || read'";
"${modifier}+Mod1+r" = "${modifier}+Mod1+r" =
"exec --no-startup-id ${lib.getExe cfg.terminal} -e sh -c 'doas nixos-rebuild switch --flake ${config.nmasur.presets.programs.dotfiles.path} || read'"; "exec --no-startup-id ${lib.getExe cfg.terminal} --command sh -c 'doas nixos-rebuild switch --flake ${config.nmasur.presets.programs.dotfiles.path} || read'";
# Window options # Window options
"${modifier}+q" = "kill"; "${modifier}+q" = "kill";

View File

@ -136,7 +136,15 @@ in
fi fi
'' ''
); );
click-left = "i3-msg 'exec --no-startup-id kitty --class aerc aerc'; sleep 0.15; i3-msg '[class=aerc] focus'"; click-left =
let
startupCommand =
if config.nmasur.presets.services.i3.terminal == pkgs.wezterm then
"start --class aerc -- aerc"
else
"--class=aerc --command=aerc";
in
"i3-msg 'exec --no-startup-id ${config.nmasur.presets.services.i3.terminal} ${startupCommand}'; sleep 0.15; i3-msg '[class=aerc] focus'";
}; };
"module/network" = { "module/network" = {
type = "internal/network"; type = "internal/network";
@ -218,7 +226,7 @@ in
"module/power" = { "module/power" = {
type = "custom/text"; type = "custom/text";
content = " "; 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"; click-right = "polybar-msg cmd restart";
content-foreground = config.theme.colors.base04; content-foreground = config.theme.colors.base04;
}; };

View File

@ -19,6 +19,7 @@ in
fonts.enable = lib.mkDefault true; fonts.enable = lib.mkDefault true;
services.hammerspoon.enable = lib.mkDefault true; services.hammerspoon.enable = lib.mkDefault true;
programs.nixpkgs-darwin.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}"; home.homeDirectory = lib.mkForce "/Users/${config.home.username}";
@ -41,6 +42,7 @@ in
home.packages = [ home.packages = [
pkgs.noti # Create notifications programmatically pkgs.noti # Create notifications programmatically
pkgs.ice-bar # Menu bar hiding
]; ];
}; };

View File

@ -20,6 +20,7 @@ in
ghostty.enable = lib.mkDefault true; ghostty.enable = lib.mkDefault true;
helix.enable = lib.mkDefault true; helix.enable = lib.mkDefault true;
zellij.enable = lib.mkDefault true; zellij.enable = lib.mkDefault true;
lazygit.enable = lib.mkDefault true;
}; };
home.packages = [ home.packages = [
@ -37,7 +38,6 @@ in
programs.gh-dash.enable = lib.mkDefault true; programs.gh-dash.enable = lib.mkDefault true;
programs.himalaya.enable = lib.mkDefault true; programs.himalaya.enable = lib.mkDefault true;
programs.lazygit.enable = lib.mkDefault true;
}; };
} }

View File

@ -24,13 +24,13 @@ in
discord.enable = lib.mkDefault true; discord.enable = lib.mkDefault true;
dotfiles.enable = lib.mkDefault true; dotfiles.enable = lib.mkDefault true;
firefox.enable = lib.mkDefault true; firefox.enable = lib.mkDefault true;
ghostty.enable = lib.mkDefault true;
mpv.enable = lib.mkDefault true; mpv.enable = lib.mkDefault true;
nautilus.enable = lib.mkDefault true; nautilus.enable = lib.mkDefault true;
notmuch.enable = lib.mkDefault true; notmuch.enable = lib.mkDefault true;
nsxiv.enable = lib.mkDefault true; nsxiv.enable = lib.mkDefault true;
obsidian.enable = lib.mkDefault true; obsidian.enable = lib.mkDefault true;
rofi.enable = lib.mkDefault true; rofi.enable = lib.mkDefault true;
wezterm.enable = lib.mkDefault true;
xclip.enable = lib.mkDefault true; xclip.enable = lib.mkDefault true;
zathura.enable = lib.mkDefault true; zathura.enable = lib.mkDefault true;
}; };

View File

@ -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
@ -58,6 +58,7 @@ in
fish.enable = lib.mkDefault true; fish.enable = lib.mkDefault true;
fzf.enable = lib.mkDefault true; fzf.enable = lib.mkDefault true;
git.enable = lib.mkDefault true; git.enable = lib.mkDefault true;
helix.enable = lib.mkDefault true;
neovim.enable = lib.mkDefault true; neovim.enable = lib.mkDefault true;
nix-index.enable = lib.mkDefault true; nix-index.enable = lib.mkDefault true;
nixpkgs.enable = lib.mkDefault true; nixpkgs.enable = lib.mkDefault true;

View File

@ -39,11 +39,14 @@ in
pkgs.nmasur.terraform-init # Quick shortcut for initializing Terraform backend pkgs.nmasur.terraform-init # Quick shortcut for initializing Terraform backend
]; ];
programs.fish.shellAliases.ec2 = "aws-ec2";
nmasur.presets = { nmasur.presets = {
fonts.enable = lib.mkDefault true; fonts.enable = lib.mkDefault true;
programs = { programs = {
_1password.enable = lib.mkDefault true; _1password.enable = lib.mkDefault true;
atuin.enable = lib.mkDefault true; atuin.enable = lib.mkDefault true;
aws-ssh.enable = lib.mkDefault true;
bash.enable = lib.mkDefault true; bash.enable = lib.mkDefault true;
bat.enable = lib.mkDefault true; bat.enable = lib.mkDefault true;
direnv.enable = lib.mkDefault true; direnv.enable = lib.mkDefault true;
@ -52,6 +55,7 @@ in
firefox.enable = lib.mkDefault true; firefox.enable = lib.mkDefault true;
fish.enable = lib.mkDefault true; fish.enable = lib.mkDefault true;
fzf.enable = lib.mkDefault true; fzf.enable = lib.mkDefault true;
ghostty.enable = lib.mkDefault true;
git-work.enable = lib.mkDefault true; git-work.enable = lib.mkDefault true;
git.enable = lib.mkDefault true; git.enable = lib.mkDefault true;
github.enable = lib.mkDefault true; github.enable = lib.mkDefault true;
@ -64,7 +68,6 @@ in
starship.enable = lib.mkDefault true; starship.enable = lib.mkDefault true;
terraform.enable = lib.mkDefault true; terraform.enable = lib.mkDefault true;
weather.enable = lib.mkDefault true; weather.enable = lib.mkDefault true;
wezterm.enable = lib.mkDefault true;
}; };
}; };

View File

@ -10,6 +10,10 @@
type = lib.types.str; type = lib.types.str;
description = "Human readable name of the user"; 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 { hostnames = lib.mkOption {
type = lib.types.attrsOf lib.types.str; type = lib.types.attrsOf lib.types.str;
description = "Map of service names to FQDNs"; description = "Map of service names to FQDNs";

View File

@ -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

View File

@ -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
''; '';

View File

@ -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"

View File

@ -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

View File

@ -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;

View File

@ -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"
];
};
}; };
} }

View File

@ -1,85 +0,0 @@
{
config,
lib,
...
}:
let
inherit (config.nmasur.settings) hostnames;
cfg = config.nmasur.presets.services.actualbudget;
in
{
options.nmasur.presets.services.actualbudget = {
enable = lib.mkEnableOption "ActualBudget budgeting service";
port = lib.mkOption {
type = lib.types.port;
description = "Port to use for the localhost";
default = 5006;
};
};
config = lib.mkIf cfg.enable {
virtualisation.podman.enable = true;
# Create a shared group for generic services
users.groups.shared = { };
users.users.actualbudget = {
isSystemUser = true;
group = "shared";
uid = 980;
};
# Create budget directory, allowing others to manage it
systemd.tmpfiles.rules = [
"d /var/lib/actualbudget 0770 actualbudget shared"
];
virtualisation.oci-containers.containers.actualbudget = {
workdir = null;
volumes = [ "/var/lib/actualbudget:/data" ];
user = "${toString (builtins.toString config.users.users.actualbudget.uid)}";
pull = "missing";
privileged = false;
ports = [ "127.0.0.1:${builtins.toString cfg.port}:5006" ];
networks = [ ];
log-driver = "journald";
labels = {
app = "actualbudget";
};
image = "ghcr.io/actualbudget/actual:25.3.1";
hostname = null;
environmentFiles = [ ];
environment = {
DEBUG = "actual:config"; # Enable debug logging
ACTUAL_TRUSTED_PROXIES = builtins.concatStringsSep "," [ "127.0.0.1" ];
};
dependsOn = [ ];
autoStart = true;
};
# Allow web traffic to Caddy
nmasur.presets.services.caddy.routes = [
{
match = [ { host = [ hostnames.budget ]; } ];
handle = [
{
handler = "reverse_proxy";
upstreams = [ { dial = "localhost:${builtins.toString cfg.port}"; } ];
}
];
}
];
# Configure Cloudflare DNS to point to this machine
services.cloudflare-dyndns.domains = [ hostnames.budget ];
# Backups
services.restic.backups.default.paths = [ "/var/lib/actualbudget" ];
};
}

View File

@ -0,0 +1,17 @@
-----BEGIN AGE ENCRYPTED FILE-----
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IHNzaC1lZDI1NTE5IE1nSGFPdyA0VjJk
a2c0Q1pVcEVCdjd3OE1xZ2s2a29YdjdWTUZkK1hnMFNwVTRVMVFVCkhpY2tjQmFz
K3dzVEgrcnBuRlgyZzYwWGtiQzh6RjNtNmNUb2FSVCsxMTAKLT4gc3NoLWVkMjU1
MTkgWXlTVU1RIFM3cVpTaVFYK1NEYitaSEtLUE5yVDhXTGNHSnN3UjdROTVDeXND
VjFUQjAKYnF6RWtjaFZNM1cxSTJUV0p4UExoenhicGpESEk0R2Q0VncrUldwSndi
UQotPiBzc2gtZWQyNTUxOSBuanZYNUEgOTltRmlNNFQzTWpsVVdHUXBqS1lKRldJ
dW9kVHJqZFRrQWFTK2ZDMi8zZwpTUlRqZUkzSWlibGhMVzRwQmdldVREeGpsRTRr
L1FUZHowdVprNlEvVVJ3Ci0+IHNzaC1lZDI1NTE5IENxSU9VQSBjeUZRdmtENUQw
Ukoxb3NNYU5JeE1OSVBGcWhPZS9mY1BEb0tVbnB3bVdNCnRHRXhpd0dEbWZuNEg0
a1BMdk5yc2x6Y0EzQXo1U1hwZnJuUzJ1ckt1VDAKLT4gc3NoLWVkMjU1MTkgejFP
Y1p3IExJeHhnTlgrSXpVYkxWdnZldlR4Q1JzZE9PWFowbWJSQ1pTbkp3YWFoUzgK
L1ErSnZ3cWVXeVU0TThPaFVsVjBTdHh1YlQ3cTduQ2xIejZScEJSZGp6MAotLS0g
SFJpT2JlSktBaFZhdjlyOWRhLzJiT21OditjczZJcU9iMFJMUzhNdzVZMAp0yAab
89wcmBqmuQLoFYRs/Tj+UvWa4UaXvNFGZM9zIH8WEJDxO+QviDL1NETOuI4T9X1q
JYa7c4PAwV8KgMkdKpHVJ3sN1+Kg82UXXSCTjpRHa33OBZTC
-----END AGE ENCRYPTED FILE-----

View File

@ -0,0 +1,17 @@
-----BEGIN AGE ENCRYPTED FILE-----
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IHNzaC1lZDI1NTE5IE1nSGFPdyBQY3lv
SG9kNkN1S3RZdE80cWJTd0k0UkdiNmZXT085Um9Vd0FGYWpObHc0CnQvVjF4L0xu
ajNvQkFueVREaWxLWFhyNGkvL2ZlOHdEYXdTRkowbk9WUUUKLT4gc3NoLWVkMjU1
MTkgWXlTVU1RIE5aT3ZlMDJjNkJaZmFDV3ZKSHo5UEhnTlM5dHk1R0dYSXFNOWxJ
OThEaGcKcmNsMVUxaTI1b0FtbFdtMzlVYVZxcnllVmlwaDRuUkR4d3BNbm12eU5x
OAotPiBzc2gtZWQyNTUxOSBuanZYNUEgR3BmQk5Nd0E3RC9UQ1ZoWmxTNlhubjVZ
Vi8xL3V3YTNqUVh2ZVZrRkNtawpLaWhxY1FQajJZeGJzakd3ZDhrbmd4T2JNVlUy
dzFOMGcwRmJML3hPTzRBCi0+IHNzaC1lZDI1NTE5IENxSU9VQSBDNTQzZ0syVHNS
TTJPUm9OMUcyNTY5VGZkNEVESmt2eVQrSzJlUEgwS0E4ClRqbk9FTGZNRG9zSHlC
UXQyN0N1WDN4MHNrNFgrUjdQQUc4aU8xajRVdkEKLT4gc3NoLWVkMjU1MTkgejFP
Y1p3IHpiaEsvbCtwMlkyMWpJMS9XWExudDRpaE4xMmQ4eXIzU2RaTGd3TUg3eHMK
anpIV01KVDdvZGI5M1dmME1KaC9jcFkrVlN4TmlXN21tUnhIYnlEMEdHcwotLS0g
dy9LeGpiNkowQkNwOFNFeHUveGRveDRhajVtNEU3SWE0MEhOYTl6ZHM0QQq/Dg+2
OrqL8yCAai3J8djSktSmhAc/jdbEnHVdl3943Enyrn+Zz2HcUe96RySrleCt+QxL
Dezprhehi7jK7KmIAGOspicA0e/4GQ8txsb2fQ==
-----END AGE ENCRYPTED FILE-----

View File

@ -0,0 +1,132 @@
{
config,
pkgs,
lib,
...
}:
let
inherit (config.nmasur.settings) hostnames;
cfg = config.nmasur.presets.services.actualbudget;
in
{
options.nmasur.presets.services.actualbudget = {
enable = lib.mkEnableOption "ActualBudget budgeting service";
port = lib.mkOption {
type = lib.types.port;
description = "Port to use for the localhost";
default = 5006;
};
prometheusPort = lib.mkOption {
type = lib.types.port;
description = "Port to use for prometheus actual exporter";
default = 5007;
};
};
config = lib.mkIf cfg.enable {
services.actual = {
enable = true;
settings = {
port = cfg.port;
};
};
# systemd.services.prometheus-actual-exporter = {
# enable = true;
# description = "Prometheus exporter for Actual budget";
# serviceConfig = {
# DynamicUser = true;
# Environment = [
# "ACTUAL_SERVER_URL=https://${hostnames.budget}:443"
# "PORT=${builtins.toString cfg.prometheusPort}"
# ];
# EnvironmentFile = [
# config.secrets.actualbudget-password.dest
# config.secrets.actualbudget-budget-id.dest
# ];
# ExecStart = lib.getExe pkgs.nmasur.prometheus-actual-exporter;
# };
# wantedBy = [
# "multi-user.target"
# ];
# };
# Used for prometheus exporter
virtualisation.podman.enable = true;
# Create a shared group for generic services
users.groups.shared = { };
users.users.actualbudget = {
isSystemUser = true;
group = "shared";
uid = 980;
};
virtualisation.oci-containers.containers.actualbudget-prometheus-exporter = {
workdir = null;
user = builtins.toString config.users.users.actualbudget.uid;
pull = "missing";
privileged = false;
ports = [ "127.0.0.1:5007:3001" ];
networks = [ ];
log-driver = "journald";
labels = {
app = "actualbudget-prometheus-exporter";
};
image = "docker.io/sakowicz/actual-budget-prometheus-exporter:1.1.5";
hostname = null;
environmentFiles = [
config.secrets.actualbudget-password.dest
config.secrets.actualbudget-budget-id.dest
];
environment = {
ACTUAL_SERVER_URL = "https://${hostnames.budget}:443";
};
# dependsOn = [ "actualbudget" ];
autoStart = true;
};
nmasur.presets.services.prometheus-exporters.scrapeTargets = [
"127.0.0.1:${builtins.toString cfg.prometheusPort}"
];
secrets.actualbudget-password = {
source = ./actualbudget-password.age;
dest = "${config.secretsDirectory}/actualbudget-password";
owner = builtins.toString config.users.users.actualbudget.uid;
group = builtins.toString config.users.users.actualbudget.uid;
};
secrets.actualbudget-budget-id = {
source = ./actualbudget-budget-id.age;
dest = "${config.secretsDirectory}/actualbudget-budget-id";
owner = builtins.toString config.users.users.actualbudget.uid;
group = builtins.toString config.users.users.actualbudget.uid;
};
# Allow web traffic to Caddy
nmasur.presets.services.caddy.routes = [
{
match = [ { host = [ hostnames.budget ]; } ];
handle = [
{
handler = "reverse_proxy";
upstreams = [ { dial = "localhost:${builtins.toString cfg.port}"; } ];
}
];
}
];
# Configure Cloudflare DNS to point to this machine
services.cloudflare-dyndns.domains = [ hostnames.budget ];
# Backups
services.restic.backups.default.paths = [ "/var/lib/actual" ];
};
}

View File

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

View File

@ -103,8 +103,9 @@ in
value = name; value = name;
}) hostname_map; }) hostname_map;
}; };
metrics = { }; # Enables Prometheus metrics
}; };
apps.http.servers.metrics = { }; # Enables Prometheus metrics
apps.tls.automation.policies = cfg.tlsPolicies; apps.tls.automation.policies = cfg.tlsPolicies;
# Setup logging to journal and files # Setup logging to journal and files

View File

@ -1,17 +1,17 @@
-----BEGIN AGE ENCRYPTED FILE----- -----BEGIN AGE ENCRYPTED FILE-----
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IHNzaC1lZDI1NTE5IE1nSGFPdyBkckt3 YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IHNzaC1lZDI1NTE5IE1nSGFPdyBKNXVz
c1NtVEo1bm1XREk2ZE9PL1FkOFd0LzQ1R0J4TXN4VGd2clVrZ25NCjZKenFTdHFK RCtWVURFT2JmbUk1dXdWQjJuSVBoamVGaHZUWDNJL1pyREZyTFN3CnVpTnRKSDR5
MWVZSXI0NXdVTkhJQXRFRFBRRnIxRHZaOHY1UWVDYW9vTm8KLT4gc3NoLWVkMjU1 U0N3QWZ6L3hpcEVEampWSUlDTVFvWmRuWEFKVUE0bmVDZ0UKLT4gc3NoLWVkMjU1
MTkgWXlTVU1RIHBmRERwcXdGanBVV0JOczg0Q0hOa1dVM09EeGMxWmJDMm9YU2Mx MTkgWXlTVU1RIGJ2czRsU2RWN2RaMnc5NEZNbEhxWTNTdkEydWpjd1NVQ0k2RHFC
djhxQkUKS2U2aHVza2JNdzltRW5wcWhqaTVPUEZoZGNWN2szQXlVYjZ3eXpwc2ZE anVubU0KQkhxL1kwSGt3N21OSVJwcHJCM2p0TnlOQVJ5c2VTejJoL2ZZUGk4REtL
OAotPiBzc2gtZWQyNTUxOSBuanZYNUEgbWU0WXA4RjVZWFdPcXZ5M1UwT3lON1JD bwotPiBzc2gtZWQyNTUxOSBuanZYNUEgaXFJR3IrVHVNQVhjNFFmN1d3ZHhZS04r
cGhlRXZ2NEhWMHdEMitLWERqRQpKRGgwMUhISWE1Uk1ka1dteGo0dlhZcmNjVjN6 K0FGRXppQkE4MHZhVUI5SHBWRQpxbDdqc2RYZmo0ejBOYUFCcGtrbXVZbDBJVVRJ
QmJBQWo0Mko4aE5jUm9rCi0+IHNzaC1lZDI1NTE5IENxSU9VQSBLaU9sSmRzMlFG Q2ZlQlFtYmQ4Z3dqcGIwCi0+IHNzaC1lZDI1NTE5IENxSU9VQSBzNlQxNGxDRlNz
NjBYYTBYeFErNXJwZGVtZ1kvVmVCOXBDZWVoNWhDZ2hrCnE2dkJJSk8rbDRvSHYy amVMWjI2WFhIYTFIMDQxY1NDRXYvWU9LaUFQMVZMZjMwCm15a3lPVkkyMnZoOGx0
bEVTdXg0VTg1RzZUNi84K1ZvOVB2aUJzNHVPRkEKLT4gc3NoLWVkMjU1MTkgejFP bTdYbWtZWGQzTVBJb2g4WmM5Z25tcHhKWDNZencKLT4gc3NoLWVkMjU1MTkgejFP
Y1p3IEM0Mnlockc2SlA1bXJhdnpQNXFnQ2w5bzFSTWpIajJybTBIM3VuNTN5bFUK Y1p3IG1VWm1JRUUwUWhnWVMvdjdmaUZNN1F1eExXRU1xaXpzY2VFMTE3SWE3dzQK
bXNIUVVhTzlRMUJTSEpJUURUMXZjRU5zczNjYnBUVVFmMDVEZllONjFjWQotLS0g SWN5b3llVU5WSk1HNW1Wc1dvVm82a1NyQVQ4NmhjRExuQzB2UGpPSGFDcwotLS0g
NXdIUWduN2Q2eXFzNlFueFR6OWxITVBranpsNTdXaktiSFZ0TTBxRFNlNAr9JzVO ZkdtZ1o4KzlveDBCdkx4eFc2RGNjUjFrb1ZyZXdjZHpLVWtkN2ZaenlKOArVhdOP
Rhx5rG7CSGdYfeMcuzye4jyE2yiVKi5TVr/qp3vbDpyDQKZLlAUSF/K0rTY9K7Rm 2ifpmAQNOfBbQyY9UPhxPxrF7jnZ8B5jumaip8QJuh6xEYkF17tSEzTPVf6ER9wr
ocY+y/V9ffh3LO2m1Y6BkRqWRJ7v4wcsc3jNGjDHlSB7EqnOwMCXyQAg OrND9IR2kbZVFAxb3/uUD9I3jegJ
-----END AGE ENCRYPTED FILE----- -----END AGE ENCRYPTED FILE-----

View File

@ -67,8 +67,8 @@ 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.0.0-20250228175314-1fb64108d4de" ]; plugins = [ "github.com/caddy-dns/cloudflare@v0.2.1" ];
hash = "sha256-YYpsf8HMONR1teMiSymo2y+HrKoxuJMKIea5/NEykGc="; hash = "sha256-2D7dnG50CwtCho+U+iHmSj2w14zllQXPjmTHr6lJZ/A=";
}; };
nmasur.presets.services.caddy.tlsPolicies = [ nmasur.presets.services.caddy.tlsPolicies = [
{ {
@ -90,11 +90,14 @@ in
]; ];
} }
]; ];
systemd.services.caddy.serviceConfig = {
# Allow Caddy to read Cloudflare API key for DNS validation # Allow Caddy to read Cloudflare API key for DNS validation
systemd.services.caddy.serviceConfig.EnvironmentFile = [ # Allow Caddy to use letsencrypt account key for TLS verification
config.secrets.cloudflare-api.dest EnvironmentFile = [
config.secrets.letsencrypt-key.dest config.secrets.letsencrypt-key.dest
config.secrets.cloudflare-api-prefixed.dest
]; ];
};
# Private key is used for LetsEncrypt # Private key is used for LetsEncrypt
secrets.letsencrypt-key = { secrets.letsencrypt-key = {
@ -111,15 +114,21 @@ in
owner = "caddy"; owner = "caddy";
group = "caddy"; group = "caddy";
}; };
secrets.cloudflare-api-prefixed = {
source = ./cloudflare-api.age;
dest = "${config.secretsDirectory}/cloudflare-api-prefixed";
owner = "caddy";
group = "caddy";
prefix = "CLOUDFLARE_API_TOKEN=";
};
# Wait for secret to exist # Wait for secret to exist
systemd.services.caddy = { systemd.services.caddy = {
after = [ after = [
"cloudflare-api-secret.service" "cloudflare-api-prefixed-secret.service"
"letsencrypt-key-secret.service" "letsencrypt-key-secret.service"
]; ];
requires = [ requires = [
"cloudflare-api-secret.service" "cloudflare-api-prefixed-secret.service"
"letsencrypt-key-secret.service" "letsencrypt-key-secret.service"
]; ];
}; };
@ -148,7 +157,23 @@ in
systemd.services.cloudflare-dyndns = lib.mkIf config.services.cloudflare-dyndns.enable { systemd.services.cloudflare-dyndns = lib.mkIf config.services.cloudflare-dyndns.enable {
after = [ "cloudflare-api-secret.service" ]; after = [ "cloudflare-api-secret.service" ];
requires = [ "cloudflare-api-secret.service" ]; requires = [ "cloudflare-api-secret.service" ];
script =
let
args =
[ "--cache-file /var/lib/cloudflare-dyndns/ip.cache" ]
++ (if config.services.cloudflare-dyndns.ipv4 then [ "-4" ] else [ "-no-4" ])
++ (if config.services.cloudflare-dyndns.ipv6 then [ "-6" ] else [ "-no-6" ])
++ lib.optional config.services.cloudflare-dyndns.deleteMissing "--delete-missing"
++ lib.optional config.services.cloudflare-dyndns.proxied "--proxied";
in
lib.mkForce ''
export CLOUDFLARE_API_TOKEN=$(cat ''${CREDENTIALS_DIRECTORY}/apiToken)
exec ${lib.getExe pkgs.cloudflare-dyndns} ${toString args}
'';
}; };
# Enable the home-made service that we created for non-proxied records
services.cloudflare-dyndns-noproxy.enable = true;
}; };
} }

View File

@ -13,10 +13,17 @@ in
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
services.filebrowser = { nmasur.services.filebrowser = {
enable = true; enable = true;
# Generate password: htpasswd -nBC 10 "" | tr -d ':\n' # Generate password: htpasswd -nBC 10 "" | tr -d ':\n'
passwordHash = "$2y$10$ze1cMob0k6pnXRjLowYfZOVZWg4G.dsPtH3TohbUeEbI0sdkG9.za"; 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 = [ nmasur.presets.services.caddy.routes = [

View File

@ -20,6 +20,7 @@ in
settings = { settings = {
actions.ENABLED = true; actions.ENABLED = true;
metrics.ENABLED = true; metrics.ENABLED = true;
mailer.SENDMAIL_PATH = "/run/wrappers/bin/sendmail";
repository = { repository = {
# Pushing to a repo that doesn't exist automatically creates one as # Pushing to a repo that doesn't exist automatically creates one as
# private. # private.
@ -94,6 +95,9 @@ in
# Configure Cloudflare DNS to point to this machine # Configure Cloudflare DNS to point to this machine
services.cloudflare-dyndns.domains = [ hostnames.git ]; services.cloudflare-dyndns.domains = [ hostnames.git ];
# Configure DNS to point to this machine without a proxy
nmasur.presets.services.cloudflare.noProxyDomains = [ "ssh.${hostnames.git}" ];
# Scrape the metrics endpoint for Prometheus. # Scrape the metrics endpoint for Prometheus.
nmasur.presets.services.prometheus-exporters.scrapeTargets = [ nmasur.presets.services.prometheus-exporters.scrapeTargets = [
"127.0.0.1:${builtins.toString config.services.gitea.settings.server.HTTP_PORT}" "127.0.0.1:${builtins.toString config.services.gitea.settings.server.HTTP_PORT}"

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) { 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 = {

View File

@ -0,0 +1,17 @@
-----BEGIN AGE ENCRYPTED FILE-----
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IHNzaC1lZDI1NTE5IE1nSGFPdyA2SUsv
d1R3Slo3UDhDUWNiTDcybU9mTzhycDNKVCtteHhwRXU4M0x5UVF3CkUvZHdISzE4
NU9qdy9sUGxTeTJxY2huWS9zVnRzd2o0UFpxc0FjT2lDTGMKLT4gc3NoLWVkMjU1
MTkgWXlTVU1RIG1SM3gxRzJ5RllOTXhHZC9sc1Z6U1VCc3ptTWZRYzNJQ1g4ZjRI
d3U3RVUKekNYc0VpSUw4TVJsSGNYNElxUUcwS25oczVUWnNlUTd2SXlvYlEvcE01
ZwotPiBzc2gtZWQyNTUxOSBuanZYNUEgc0JUZlkyY0dKWjhzVlMwTi8zS1VrVGt1
UGJzeURtbEZ3ZWpncWZNK2x5SQpJdVNSV2NLdHBEVThtWVBhUm1GSEEvV2s0bGZB
WFJTK0xIa01ucHBxcm1jCi0+IHNzaC1lZDI1NTE5IENxSU9VQSBrRitXVzdvRmgz
VW5HMHpBRStuTnRDZmlCdVRra09JNE85Wkl4bkJJWkFzCkZUeTRWK0VmL21VRlpW
SWg5dnJ4UGw4aXZteUxyaXZUaGpxQkdQL0hXK0kKLT4gc3NoLWVkMjU1MTkgejFP
Y1p3IE4xSlZYbmFWZlhCQ3RibFN5Z3gzMDN5cXNDQzA4UnViUk9IclBTdE4valkK
MGx3Nkhac3NEZGh2SExUMU94NExiRlMvRndobUlJdmhBWU1CM0diL0V3ZwotLS0g
SDhvSzRFUFdGN0ZLUm9hWWV2T2tHMVdvTHlWOEZWTkZjLzd0VE12SU9kNAp2wHsq
uKxlrH9xXj17Zd3FAjRlSMjjVVOYZOVyiPMWY7MD7V5XVY0hCPnKpzX4RyYeTfqf
3W2LaWecMcRtTdRLOyCqVC+1DXtCAL/DqxIWcu3Q+zDQog==
-----END AGE ENCRYPTED FILE-----

View File

@ -0,0 +1,17 @@
-----BEGIN AGE ENCRYPTED FILE-----
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IHNzaC1lZDI1NTE5IE1nSGFPdyBJZjI5
Y0pMd01IdVJIa2RtU3BrajNGblczeUdkWUgxdFliQmJGK2RDclhVCjVlbmRpV1Bj
K1hMTm1HZ0pnYm05YmZ0Tm9UZjVoQ3FMM2dhVkRtV1FBZWsKLT4gc3NoLWVkMjU1
MTkgWXlTVU1RIGxzbXA2NVRXbGxsY05hU0ZGWlU2MTNGVGozN2dycnBaNUZ4Ykxx
UjB0d3MKcUdRampFeTdGek9FaHVrV3Y1ay8rMGh6M2NRZjVpUHdWYVJYZENmOGty
RQotPiBzc2gtZWQyNTUxOSBuanZYNUEgamdMKzRnRldKYW9sYzJGWmR2TjRYVlRZ
SXhKT3BrNC9XdHhpUVFQSXVROApoM3BUajhmR01VeDR1MHJhMnJFUkxCOW9DckZF
TkhMd1BYODMrVm5PSGFJCi0+IHNzaC1lZDI1NTE5IENxSU9VQSAzbVJsT2pBTENF
eGUrOEdHakZzb3ExMGwyMW91TEZORmpxdUJJMUJlZEJFClV2UlFlNVBxSmlaMnNs
MTlFNzVOSjVqMVp5a1dwUVJqR3ZPRkdnY0w5dXMKLT4gc3NoLWVkMjU1MTkgejFP
Y1p3IDcrZzhhWjh4UFVSM1loTTV1UXp2NDF1cGlLUWZ2bTN0NHJiOFhESFdJQWcK
UFZzT2hmSTFlR0VNenVobktDN2xaZElwTWFZVklscFAvQmQyZjJiTU4wawotLS0g
UW8vRlpmcGV1SmR1blZRK3c0eVpGeUlZMEc5eGlRcVpnbXI5UkNUelJEYwo8Na+w
XzVV1/LPzA3kl0yDvF2b0nn1TmR903ralFbjmT2Rv/HNDVyVklIz1Jycaje8W8uV
vZGGicSNIIZbGLEYT9fMUzY1KPoU6LUx0mgGUK2PZssHmG9mbW/Jx3R6
-----END AGE ENCRYPTED FILE-----

View File

@ -0,0 +1,97 @@
{
config,
pkgs,
lib,
...
}:
let
inherit (config.nmasur.settings) hostnames;
cfg = config.nmasur.presets.services.mathesar;
in
{
options.nmasur.presets.services.mathesar = {
enable = lib.mkEnableOption "Postgres web UI";
port = lib.mkOption {
type = lib.types.port;
description = "Port to use for the localhost";
default = 8099;
};
};
config = lib.mkIf cfg.enable {
systemd.services.mathesar = {
description = "Postgres web UI";
after = [
"network.target"
"postgresql.target"
];
requires = [
"mathesar-secret.service"
"mathesar-postgres-secret.service"
];
wantedBy = [ "multi-user.target" ];
environment = {
POSTGRES_HOST = "127.0.0.1";
POSTGRES_DB = "mathesar_django";
POSTGRES_USER = "mathesar";
# POSTGRES_PASSWORD = "none";
POSTGRES_PORT = "5432";
ALLOWED_HOSTS = "*";
SKIP_STATIC_COLLECTION = "true";
DEBUG = "true";
};
serviceConfig = {
Type = "simple";
DynamicUser = true;
StateDirectory = "mathesar";
EnvironmentFile = [
config.secrets.mathesar.dest
config.secrets.mathesar-postgres.dest
];
};
preStart = "exec ${pkgs.nmasur.mathesar}/bin/mathesar-install";
script =
let
args = [ "--bind=127.0.0.1:${builtins.toString cfg.port}" ];
in
''
exec ${pkgs.nmasur.mathesar}/bin/mathesar-gunicorn ${toString args}
'';
};
secrets.mathesar = {
source = ./mathesar.age;
dest = "${config.secretsDirectory}/mathesar";
owner = builtins.toString config.users.users.postgres.uid;
group = builtins.toString config.users.users.postgres.uid;
};
secrets.mathesar-postgres = {
source = ./mathesar-postgres.age;
dest = "${config.secretsDirectory}/mathesar-postgres";
owner = builtins.toString config.users.users.postgres.uid;
group = builtins.toString config.users.users.postgres.uid;
};
# Allow web traffic to Caddy
nmasur.presets.services.caddy.routes = [
{
match = [ { host = [ hostnames.mathesar ]; } ];
handle = [
{
handler = "reverse_proxy";
upstreams = [ { dial = "localhost:${builtins.toString cfg.port}"; } ];
}
];
}
];
# Configure Cloudflare DNS to point to this machine
services.cloudflare-dyndns.domains = [ hostnames.mathesar ];
};
}

View File

@ -53,6 +53,9 @@ in
]; ];
}; };
# Don't enable vmagent because we already have victoriametrics running anyway
services.vmagent.enable = lib.mkForce false;
systemd.services.vmauth = lib.mkIf config.services.victoriametrics.enable { systemd.services.vmauth = lib.mkIf config.services.victoriametrics.enable {
description = "VictoriaMetrics basic auth proxy"; description = "VictoriaMetrics basic auth proxy";
after = [ "network.target" ]; after = [ "network.target" ];

View File

@ -11,7 +11,7 @@
let let
inherit (config.nmasur.settings) hostnames; inherit (config.nmasur.settings) hostnames;
cfg = config.nmasur.presets.services.vm-agent; cfg = config.nmasur.presets.services.vmagent;
username = "prometheus"; username = "prometheus";
@ -30,8 +30,8 @@ let
in in
{ {
options.nmasur.presets.services.vm-agent.enable = options.nmasur.presets.services.vmagent.enable =
lib.mkEnableOption "vm-agent VictoriaMetrics collector"; lib.mkEnableOption "vmagent VictoriaMetrics collector";
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {

View File

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

View File

@ -0,0 +1,82 @@
{
config,
pkgs,
lib,
...
}:
let
inherit (config.nmasur.settings) username hostnames;
cfg = config.nmasur.presets.services.pgweb;
in
{
options.nmasur.presets.services.pgweb = {
enable = lib.mkEnableOption "Postgres web UI";
port = lib.mkOption {
type = lib.types.port;
description = "Port to use for the localhost";
default = 8081;
};
};
config = lib.mkIf cfg.enable {
systemd.services.pgweb = {
description = "Postgres web UI";
after = [
"postgresql.target"
];
# requires = [ "pgweb-secret.service" ];
wantedBy = [ "multi-user.target" ];
serviceConfig = {
Type = "simple";
DynamicUser = false;
User = "postgres";
Group = "postgres";
StateDirectory = "pgweb";
ExecStart =
let
args = [
"--url postgres:///hippocampus?host=/run/postgresql"
];
in
"${lib.getExe pkgs.pgweb} ${toString args}";
};
};
# Allow web traffic to Caddy
nmasur.presets.services.caddy.routes = [
{
match = [ { host = [ hostnames.postgresql ]; } ];
handle = [
{
handler = "authentication";
providers = {
http_basic = {
hash = {
algorithm = "bcrypt";
};
accounts = [
{
username = username;
password = "$2a$14$dtzWBh7ZDNgqFIJTJO7Rxe15Y189agBiWKZFJbs4sZz7QhqGQAwJS";
}
];
};
};
}
{
handler = "reverse_proxy";
upstreams = [ { dial = "localhost:${builtins.toString cfg.port}"; } ];
}
];
}
];
# Configure Cloudflare DNS to point to this machine
services.cloudflare-dyndns.domains = [ hostnames.postgresql ];
};
}

View File

@ -27,7 +27,7 @@ in
# These aren't necessary, but helpful for the user # These aren't necessary, but helpful for the user
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
pamixer # Audio control pamixer # Audio control
volnoti # Volume notifications nmasur.volnoti # Volume notifications
]; ];
}; };
} }

View File

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

View File

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

View File

@ -23,7 +23,9 @@ in
}; };
services = { services = {
nix.enable = lib.mkDefault true; nix.enable = lib.mkDefault true;
openssh.enable = lib.mkDefault true;
prometheus-exporters.enable = lib.mkDefault true; prometheus-exporters.enable = lib.mkDefault true;
vmagent.enable = lib.mkDefault true;
}; };
}; };

View File

@ -27,11 +27,14 @@ in
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;
litestream.enable = lib.mkDefault true; litestream.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;
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;

View File

@ -18,6 +18,14 @@ in
nmasur.presets.services.kanata.enable = lib.mkDefault true; nmasur.presets.services.kanata.enable = lib.mkDefault true;
nmasur.presets.services.lightdm.enable = lib.mkDefault true; nmasur.presets.services.lightdm.enable = lib.mkDefault true;
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;
# Mouse customization # Mouse customization
services.ratbagd.enable = lib.mkDefault true; services.ratbagd.enable = lib.mkDefault true;

View File

@ -36,7 +36,6 @@ in
paperless.enable = lib.mkDefault true; paperless.enable = lib.mkDefault true;
postgresql.enable = lib.mkDefault true; postgresql.enable = lib.mkDefault true;
samba.enable = lib.mkDefault true; samba.enable = lib.mkDefault true;
vm-agent.enable = lib.mkDefault true;
}; };
}; };

View File

@ -15,7 +15,6 @@ in
wslConf.automount.root = lib.mkDefault "/mnt"; wslConf.automount.root = lib.mkDefault "/mnt";
defaultUser = lib.mkDefault username; defaultUser = lib.mkDefault username;
startMenuLaunchers = lib.mkDefault true; startMenuLaunchers = lib.mkDefault true;
nativeSystemd = lib.mkDefault true;
wslConf.network.generateResolvConf = lib.mkDefault true; # Turn off if it breaks VPN wslConf.network.generateResolvConf = lib.mkDefault true; # Turn off if it breaks VPN
interop.includePath = lib.mkDefault false; # Including Windows PATH will slow down Neovim command mode interop.includePath = lib.mkDefault false; # Including Windows PATH will slow down Neovim command mode
}; };

View File

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

View File

@ -21,6 +21,8 @@ in
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
programs.i3lock.enable = true; # Required for unlocking to work
# Ref: https://github.com/betterlockscreen/betterlockscreen/blob/next/system/betterlockscreen%40.service # Ref: https://github.com/betterlockscreen/betterlockscreen/blob/next/system/betterlockscreen%40.service
systemd.services.lock = { systemd.services.lock = {
enable = true; enable = true;

View File

@ -6,12 +6,12 @@
}: }:
let let
cfg = config.services.cloudflare-dyndns-no-proxy; cfg = config.services.cloudflare-dyndns-noproxy;
in in
{ {
options.services.cloudflare-dyndns-no-proxy.enable = lib.mkEnableOption "Cloudflare dyndns client without proxying"; options.services.cloudflare-dyndns-noproxy.enable = lib.mkEnableOption "Cloudflare dyndns client without proxying";
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
@ -37,8 +37,13 @@ in
Type = "simple"; Type = "simple";
DynamicUser = true; DynamicUser = true;
StateDirectory = "cloudflare-dyndns-noproxy"; StateDirectory = "cloudflare-dyndns-noproxy";
EnvironmentFile = config.services.cloudflare-dyndns.apiTokenFile; Environment = [ "XDG_CACHE_HOME=%S/cloudflare-dyndns-noproxy/.cache" ];
ExecStart = LoadCredential = [
"apiToken:${config.services.cloudflare-dyndns.apiTokenFile}"
];
};
script =
let let
args = args =
[ "--cache-file /var/lib/cloudflare-dyndns-noproxy/ip.cache" ] [ "--cache-file /var/lib/cloudflare-dyndns-noproxy/ip.cache" ]
@ -46,8 +51,10 @@ in
++ (if config.services.cloudflare-dyndns.ipv6 then [ "-6" ] else [ "-no-6" ]) ++ (if config.services.cloudflare-dyndns.ipv6 then [ "-6" ] else [ "-no-6" ])
++ lib.optional config.services.cloudflare-dyndns.deleteMissing "--delete-missing"; ++ lib.optional config.services.cloudflare-dyndns.deleteMissing "--delete-missing";
in in
"${pkgs.cloudflare-dyndns}/bin/cloudflare-dyndns ${toString args}"; ''
}; export CLOUDFLARE_API_TOKEN=$(cat ''${CREDENTIALS_DIRECTORY}/apiToken)
exec ${lib.getExe pkgs.cloudflare-dyndns} ${toString args}
'';
}; };
}; };
} }

View File

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