mirror of
				https://github.com/nmasur/dotfiles
				synced 2025-11-03 22:53:16 +00:00 
			
		
		
		
	Compare commits
	
		
			1 Commits
		
	
	
		
			a47bcf8949
			...
			unfree-pre
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					8ab86428ec | 
							
								
								
									
										166
									
								
								.github/workflows/arrow-aws.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										166
									
								
								.github/workflows/arrow-aws.yml
									
									
									
									
										vendored
									
									
								
							@@ -1,166 +0,0 @@
 | 
			
		||||
name: Arrow (AWS)
 | 
			
		||||
 | 
			
		||||
run-name: Arrow (AWS) - ${{ inputs.rebuild && 'Rebuild and ' || '' }}${{ inputs.action == 'create' && 'Create' || ( inputs.action == 'destroy' && 'Destroy' || 'No Action' ) }}
 | 
			
		||||
 | 
			
		||||
env:
 | 
			
		||||
  TERRAFORM_DIRECTORY: hosts/arrow/aws
 | 
			
		||||
  DEPLOY_IDENTITY_BASE64: ${{ secrets.DEPLOY_IDENTITY_BASE64 }}
 | 
			
		||||
  ARROW_IDENTITY_BASE64: ${{ secrets.ARROW_IDENTITY_BASE64 }}
 | 
			
		||||
  ZONE_NAME: masu.rs
 | 
			
		||||
  CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
 | 
			
		||||
  CLOUDFLARE_ZONE_ID: ${{ secrets.CLOUDFLARE_ZONE_ID }}
 | 
			
		||||
 | 
			
		||||
on:
 | 
			
		||||
  workflow_dispatch:
 | 
			
		||||
    inputs:
 | 
			
		||||
      rebuild:
 | 
			
		||||
        type: boolean
 | 
			
		||||
        default: false
 | 
			
		||||
      action:
 | 
			
		||||
        type: choice
 | 
			
		||||
        required: true
 | 
			
		||||
        default: create
 | 
			
		||||
        options:
 | 
			
		||||
          - create
 | 
			
		||||
          - destroy
 | 
			
		||||
          - nothing
 | 
			
		||||
      size:
 | 
			
		||||
        type: choice
 | 
			
		||||
        required: false
 | 
			
		||||
        options:
 | 
			
		||||
          - t3a.small # 2 GB RAM / $10
 | 
			
		||||
 | 
			
		||||
permissions:
 | 
			
		||||
  id-token: write
 | 
			
		||||
  contents: write
 | 
			
		||||
 | 
			
		||||
jobs:
 | 
			
		||||
  build-deploy:
 | 
			
		||||
    name: Build and Deploy
 | 
			
		||||
    runs-on: ubuntu-latest
 | 
			
		||||
    steps:
 | 
			
		||||
      - name: Checkout Repo Code
 | 
			
		||||
        uses: actions/checkout@v4
 | 
			
		||||
 | 
			
		||||
      - name: Free Disk Space (Ubuntu)
 | 
			
		||||
        if: inputs.rebuild && inputs.action != 'destroy'
 | 
			
		||||
        uses: jlumbroso/free-disk-space@main
 | 
			
		||||
        with:
 | 
			
		||||
          tool-cache: true
 | 
			
		||||
 | 
			
		||||
      # 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
 | 
			
		||||
 | 
			
		||||
      # 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
 | 
			
		||||
 | 
			
		||||
      # Install Nix
 | 
			
		||||
      - name: Install Nix
 | 
			
		||||
        if: inputs.rebuild && inputs.action != 'destroy'
 | 
			
		||||
        uses: cachix/install-nix-action@v20
 | 
			
		||||
 | 
			
		||||
      # Build the image
 | 
			
		||||
      - name: Build Image
 | 
			
		||||
        if: inputs.rebuild && inputs.action != 'destroy'
 | 
			
		||||
        run: nix build .#arrow-aws
 | 
			
		||||
 | 
			
		||||
      - name: Upload Image to S3
 | 
			
		||||
        if: inputs.rebuild && inputs.action != 'destroy'
 | 
			
		||||
        run: |
 | 
			
		||||
          aws s3 cp \
 | 
			
		||||
            result/nixos-amazon-image-*.vhd \
 | 
			
		||||
            s3://${{ secrets.IMAGES_BUCKET }}/arrow.vhd \
 | 
			
		||||
 | 
			
		||||
      # 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 \
 | 
			
		||||
            -backend-config="bucket=${{ secrets.TERRAFORM_STATE_BUCKET }}" \
 | 
			
		||||
            -backend-config="key=arrow.tfstate"
 | 
			
		||||
 | 
			
		||||
      # Deploys infrastructure or changes to infrastructure.
 | 
			
		||||
      - name: Terraform Apply
 | 
			
		||||
        if: inputs.action == 'create'
 | 
			
		||||
        working-directory: ${{ env.TERRAFORM_DIRECTORY }}
 | 
			
		||||
        env:
 | 
			
		||||
          TF_VAR_ec2_size: ${{ inputs.size }}
 | 
			
		||||
          TF_VAR_images_bucket: ${{ secrets.IMAGES_BUCKET }}
 | 
			
		||||
        run: |
 | 
			
		||||
          terraform apply \
 | 
			
		||||
            -auto-approve \
 | 
			
		||||
            -input=false
 | 
			
		||||
 | 
			
		||||
      # Removes infrastructure.
 | 
			
		||||
      - name: Terraform Destroy
 | 
			
		||||
        if: inputs.action == 'destroy'
 | 
			
		||||
        working-directory: ${{ env.TERRAFORM_DIRECTORY }}
 | 
			
		||||
        env:
 | 
			
		||||
          TF_VAR_ec2_size: ${{ inputs.size }}
 | 
			
		||||
          TF_VAR_images_bucket: ${{ secrets.IMAGES_BUCKET }}
 | 
			
		||||
        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.ARROW_IDENTITY_BASE64 }}" | base64 -d > arrow_ed25519
 | 
			
		||||
          chmod 0600 arrow_ed25519
 | 
			
		||||
 | 
			
		||||
      - 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 arrow_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 }}"
 | 
			
		||||
							
								
								
									
										154
									
								
								.github/workflows/arrow.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										154
									
								
								.github/workflows/arrow.yml
									
									
									
									
										vendored
									
									
								
							@@ -1,154 +0,0 @@
 | 
			
		||||
name: Arrow
 | 
			
		||||
 | 
			
		||||
run-name: Arrow - ${{ inputs.rebuild && 'Rebuild and ' || '' }}${{ inputs.action == 'create' && 'Create' || ( inputs.action == 'destroy' && 'Destroy' || 'No Action' ) }}
 | 
			
		||||
 | 
			
		||||
env:
 | 
			
		||||
  TERRAFORM_DIRECTORY: hosts/arrow/vultr
 | 
			
		||||
  DEPLOY_IDENTITY_BASE64: ${{ secrets.DEPLOY_IDENTITY_BASE64 }}
 | 
			
		||||
  ARROW_IDENTITY_BASE64: ${{ secrets.ARROW_IDENTITY_BASE64 }}
 | 
			
		||||
  CLOUDFLARE_R2_ENDPOINT: "${{ secrets.CLOUDFLARE_ACCOUNT_ID }}.r2.cloudflarestorage.com"
 | 
			
		||||
  AWS_ACCESS_KEY_ID: ${{ secrets.CLOUDFLARE_R2_ACCESS_KEY }}
 | 
			
		||||
  AWS_SECRET_ACCESS_KEY: ${{ secrets.CLOUDFLARE_R2_SECRET_KEY }}
 | 
			
		||||
  AWS_DEFAULT_REGION: auto
 | 
			
		||||
  AWS_ENDPOINT_URL_S3: "https://${{ secrets.CLOUDFLARE_ACCOUNT_ID }}.r2.cloudflarestorage.com"
 | 
			
		||||
  TF_VAR_vultr_api_key: ${{ secrets.VULTR_API_KEY }}
 | 
			
		||||
  ZONE_NAME: masu.rs
 | 
			
		||||
  CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
 | 
			
		||||
  CLOUDFLARE_ZONE_ID: ${{ secrets.CLOUDFLARE_ZONE_ID }}
 | 
			
		||||
 | 
			
		||||
on:
 | 
			
		||||
  workflow_dispatch:
 | 
			
		||||
    inputs:
 | 
			
		||||
      rebuild:
 | 
			
		||||
        type: boolean
 | 
			
		||||
        default: false
 | 
			
		||||
      action:
 | 
			
		||||
        type: choice
 | 
			
		||||
        required: true
 | 
			
		||||
        default: create
 | 
			
		||||
        options:
 | 
			
		||||
          - create
 | 
			
		||||
          - destroy
 | 
			
		||||
          - nothing
 | 
			
		||||
      plan:
 | 
			
		||||
        type: choice
 | 
			
		||||
        required: false
 | 
			
		||||
        options:
 | 
			
		||||
          - vc2-1c-1gb # 25 GB / $5
 | 
			
		||||
          - vc2-1c-2gb # 55 GB / $10 (default)
 | 
			
		||||
          - vc2-2c-2gb # 65 GB / $15
 | 
			
		||||
          - vc2-2c-4gb # 80 GB / $20
 | 
			
		||||
          - vc2-4c-8gb # 160 GB / $40
 | 
			
		||||
          - vc2-6c-16gb # 320 GB / $80
 | 
			
		||||
 | 
			
		||||
jobs:
 | 
			
		||||
  build-deploy:
 | 
			
		||||
    name: Build and Deploy
 | 
			
		||||
    runs-on: ubuntu-latest
 | 
			
		||||
    steps:
 | 
			
		||||
      - name: Checkout Repo Code
 | 
			
		||||
        uses: actions/checkout@v4
 | 
			
		||||
 | 
			
		||||
      # 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
 | 
			
		||||
 | 
			
		||||
      # Install Nix
 | 
			
		||||
      - name: Install Nix
 | 
			
		||||
        if: inputs.rebuild && inputs.action != 'destroy'
 | 
			
		||||
        uses: cachix/install-nix-action@v17
 | 
			
		||||
 | 
			
		||||
      # Build the image
 | 
			
		||||
      - name: Build Image
 | 
			
		||||
        if: inputs.rebuild && inputs.action != 'destroy'
 | 
			
		||||
        run: nix build .#arrow
 | 
			
		||||
 | 
			
		||||
      - name: Upload Image to S3
 | 
			
		||||
        if: inputs.rebuild && inputs.action != 'destroy'
 | 
			
		||||
        run: |
 | 
			
		||||
          aws s3 cp \
 | 
			
		||||
            result/iso/nixos.iso \
 | 
			
		||||
            s3://noahmasur-arrow-images/arrow.iso \
 | 
			
		||||
            --endpoint-url "https://${{ env.CLOUDFLARE_R2_ENDPOINT }}"
 | 
			
		||||
 | 
			
		||||
      # 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
 | 
			
		||||
 | 
			
		||||
      # Deploys infrastructure or changes to infrastructure.
 | 
			
		||||
      - name: Terraform Apply
 | 
			
		||||
        if: inputs.action == 'create'
 | 
			
		||||
        working-directory: ${{ env.TERRAFORM_DIRECTORY }}
 | 
			
		||||
        env:
 | 
			
		||||
          TF_VAR_vultr_plan: ${{ inputs.plan }}
 | 
			
		||||
        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.ARROW_IDENTITY_BASE64 }}" | base64 -d > arrow_ed25519
 | 
			
		||||
          chmod 0600 arrow_ed25519
 | 
			
		||||
 | 
			
		||||
      - 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 arrow_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 }}"
 | 
			
		||||
							
								
								
									
										20
									
								
								.github/workflows/check.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										20
									
								
								.github/workflows/check.yml
									
									
									
									
										vendored
									
									
								
							@@ -1,20 +0,0 @@
 | 
			
		||||
name: Check Build
 | 
			
		||||
 | 
			
		||||
on:
 | 
			
		||||
  workflow_dispatch: # allows manual triggering
 | 
			
		||||
 | 
			
		||||
jobs:
 | 
			
		||||
  check:
 | 
			
		||||
    name: Check
 | 
			
		||||
    runs-on: ubuntu-latest
 | 
			
		||||
    steps:
 | 
			
		||||
      - name: Checkout Repository
 | 
			
		||||
        uses: actions/checkout@v3
 | 
			
		||||
      - name: Install Nix
 | 
			
		||||
        uses: DeterminateSystems/nix-installer-action@v11
 | 
			
		||||
      - name: Check Nixpkgs Inputs
 | 
			
		||||
        uses: DeterminateSystems/flake-checker-action@v7
 | 
			
		||||
      - name: Add Nix Cache
 | 
			
		||||
        uses: DeterminateSystems/magic-nix-cache-action@v6
 | 
			
		||||
      - name: Check the Flake
 | 
			
		||||
        run: nix flake check
 | 
			
		||||
							
								
								
									
										69
									
								
								.github/workflows/update.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										69
									
								
								.github/workflows/update.yml
									
									
									
									
										vendored
									
									
								
							@@ -1,69 +0,0 @@
 | 
			
		||||
name: Update Flake
 | 
			
		||||
 | 
			
		||||
on:
 | 
			
		||||
  workflow_dispatch: # allows manual triggering
 | 
			
		||||
  schedule:
 | 
			
		||||
    - cron: '33 3 * * 0' # runs weekly on Sunday at 03:33
 | 
			
		||||
 | 
			
		||||
permissions:
 | 
			
		||||
  contents: write
 | 
			
		||||
  pull-requests: write
 | 
			
		||||
  checks: write
 | 
			
		||||
 | 
			
		||||
jobs:
 | 
			
		||||
  lockfile:
 | 
			
		||||
    name: Lockfile
 | 
			
		||||
    runs-on: ubuntu-latest
 | 
			
		||||
    steps:
 | 
			
		||||
      - name: Checkout Repository
 | 
			
		||||
        uses: actions/checkout@v3
 | 
			
		||||
      - name: Install Nix
 | 
			
		||||
        uses: DeterminateSystems/nix-installer-action@v11
 | 
			
		||||
      - name: Check Nixpkgs Inputs
 | 
			
		||||
        uses: DeterminateSystems/flake-checker-action@v7
 | 
			
		||||
      - name: Add Nix Cache
 | 
			
		||||
        uses: DeterminateSystems/magic-nix-cache-action@v6
 | 
			
		||||
      - name: Update flake.lock
 | 
			
		||||
        uses: DeterminateSystems/update-flake-lock@v23
 | 
			
		||||
        id: update
 | 
			
		||||
        with:
 | 
			
		||||
          pr-title: "Update flake.lock" # Title of PR to be created
 | 
			
		||||
          pr-labels: |                  # Labels to be set on the PR
 | 
			
		||||
            dependencies
 | 
			
		||||
            automated
 | 
			
		||||
          pr-body: |
 | 
			
		||||
            Automated changes by the [update-flake-lock](https://github.com/DeterminateSystems/update-flake-lock) GitHub Action.
 | 
			
		||||
 | 
			
		||||
            ```
 | 
			
		||||
            {{ env.GIT_COMMIT_MESSAGE }}
 | 
			
		||||
            ```
 | 
			
		||||
      - name: Check the Flake
 | 
			
		||||
        id: check
 | 
			
		||||
        run: nix flake check
 | 
			
		||||
      - name: Update Check Status
 | 
			
		||||
        uses: LouisBrunner/checks-action@v1.6.1
 | 
			
		||||
        if: always()
 | 
			
		||||
        with:
 | 
			
		||||
          token: ${{ secrets.GITHUB_TOKEN }}
 | 
			
		||||
          name: Update Flake
 | 
			
		||||
          conclusion: ${{ job.status }}
 | 
			
		||||
          output: |
 | 
			
		||||
            {"summary":"${{ steps.check.outputs.stdout }}"}
 | 
			
		||||
      - name: Enable Pull Request Automerge
 | 
			
		||||
        if: success()
 | 
			
		||||
        run: |
 | 
			
		||||
          gh pr merge \
 | 
			
		||||
            --rebase \
 | 
			
		||||
            --auto \
 | 
			
		||||
            ${{ steps.update.outputs.pull-request-number }}
 | 
			
		||||
        env:
 | 
			
		||||
          GH_TOKEN: ${{ github.token }}
 | 
			
		||||
      - name: Close Pull Request If Failed
 | 
			
		||||
        if: failure()
 | 
			
		||||
        run: |
 | 
			
		||||
          gh pr close \
 | 
			
		||||
            --comment "Auto-closing pull request" \
 | 
			
		||||
            --delete-branch \
 | 
			
		||||
            ${{ steps.update.outputs.pull-request-number }}
 | 
			
		||||
        env:
 | 
			
		||||
          GH_TOKEN: ${{ github.token }}
 | 
			
		||||
							
								
								
									
										4
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							@@ -1,9 +1,9 @@
 | 
			
		||||
.DS_Store
 | 
			
		||||
*.bak
 | 
			
		||||
*.db
 | 
			
		||||
*.qcow2
 | 
			
		||||
**/.direnv/**
 | 
			
		||||
result
 | 
			
		||||
.luarc.json
 | 
			
		||||
private/**
 | 
			
		||||
templates/**/flake.lock
 | 
			
		||||
!private/**.age
 | 
			
		||||
!private/**.sha512
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										138
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										138
									
								
								README.md
									
									
									
									
									
								
							@@ -6,76 +6,21 @@ hosts.
 | 
			
		||||
They are organized and managed by [Nix](https://nixos.org), so some of the
 | 
			
		||||
configuration may be difficult to translate to a non-Nix system.
 | 
			
		||||
 | 
			
		||||
## System Features
 | 
			
		||||
However, some of the configurations are easier to lift directly:
 | 
			
		||||
 | 
			
		||||
| Feature        | Program                                             | Configuration                                 |
 | 
			
		||||
|----------------|-----------------------------------------------------|-----------------------------------------------|
 | 
			
		||||
| OS             | [NixOS](https://nixos.org)                          | [Link](./modules/nixos)                       |
 | 
			
		||||
| Display Server | [X11](https://www.x.org/wiki/)                      | [Link](./modules/nixos/graphical/xorg.nix)    |
 | 
			
		||||
| Compositor     | [Picom](https://github.com/yshui/picom)             | [Link](./modules/nixos/graphical/picom.nix)   |
 | 
			
		||||
| Window Manager | [i3](https://i3wm.org/)                             | [Link](./modules/nixos/graphical/i3.nix)      |
 | 
			
		||||
| Panel          | [Polybar](https://polybar.github.io/)               | [Link](./modules/nixos/graphical/polybar.nix) |
 | 
			
		||||
| Font           | [Victor Mono](https://rubjo.github.io/victor-mono/) | [Link](./modules/nixos/graphical/fonts.nix)   |
 | 
			
		||||
| Launcher       | [Rofi](https://github.com/davatorium/rofi)          | [Link](./modules/nixos/graphical/rofi.nix)    |
 | 
			
		||||
- [Neovim](https://github.com/nmasur/dotfiles/tree/master/modules/common/neovim/config)
 | 
			
		||||
- [Fish functions](https://github.com/nmasur/dotfiles/tree/master/modules/common/shell/fish/functions)
 | 
			
		||||
- [More fish aliases](https://github.com/nmasur/dotfiles/blob/master/modules/common/shell/fish/default.nix)
 | 
			
		||||
- [Git aliases](https://github.com/nmasur/dotfiles/blob/master/modules/common/shell/git.nix)
 | 
			
		||||
- [Hammerspoon](https://github.com/nmasur/dotfiles/tree/master/modules/darwin/hammerspoon)
 | 
			
		||||
 | 
			
		||||
## User Features
 | 
			
		||||
 | 
			
		||||
| Feature      | Program                                                                          | Configuration                                      |
 | 
			
		||||
|--------------|----------------------------------------------------------------------------------|----------------------------------------------------|
 | 
			
		||||
| Dotfiles     | [Home-Manager](https://github.com/nix-community/home-manager)                    | [Link](./modules/common)                           |
 | 
			
		||||
| Terminal     | [Kitty](https://sw.kovidgoyal.net/kitty/)                                        | [Link](./modules/common/applications/kitty.nix)    |
 | 
			
		||||
| Shell        | [Fish](https://fishshell.com/)                                                   | [Link](./modules/common/shell/fish)                |
 | 
			
		||||
| Shell Prompt | [Starship](https://starship.rs/)                                                 | [Link](./modules/common/shell/starship.nix)        |
 | 
			
		||||
| Colorscheme  | [Gruvbox](https://github.com/morhetz/gruvbox)                                    | [Link](./colorscheme/gruvbox/default.nix)          |
 | 
			
		||||
| Wallpaper    | [Road](https://gitlab.com/exorcist365/wallpapers/-/blob/master/gruvbox/road.jpg) | [Link](./hosts/tempest/default.nix)                |
 | 
			
		||||
| Text Editor  | [Neovim](https://neovim.io/)                                                     | [Link](./modules/common/neovim/config)             |
 | 
			
		||||
| Browser      | [Firefox](https://www.mozilla.org/en-US/firefox/new/)                            | [Link](./modules/common/applications/firefox.nix)  |
 | 
			
		||||
| E-Mail       | [Aerc](https://aerc-mail.org/)                                                   | [Link](./modules/common/mail/aerc.nix)             |
 | 
			
		||||
| File Manager | [Nautilus](https://wiki.gnome.org/action/show/Apps/Files)                        | [Link](./modules/common/applications/nautilus.nix) |
 | 
			
		||||
| PDF Reader   | [Zathura](https://pwmt.org/projects/zathura/)                                    | [Link](./modules/common/applications/media.nix)    |
 | 
			
		||||
| Video Player | [mpv](https://mpv.io/)                                                           | [Link](./modules/common/applications/media.nix)    |
 | 
			
		||||
 | 
			
		||||
## macOS Features
 | 
			
		||||
 | 
			
		||||
| Feature  | Program                                     | Configuration                        |
 | 
			
		||||
|----------|---------------------------------------------|--------------------------------------|
 | 
			
		||||
| Keybinds | [Hammerspoon](https://www.hammerspoon.org/) | [Link](./modules/darwin/hammerspoon) |
 | 
			
		||||
 | 
			
		||||
# Diagram
 | 
			
		||||
 | 
			
		||||

 | 
			
		||||
 | 
			
		||||
---
 | 
			
		||||
 | 
			
		||||
# Unique Configurations
 | 
			
		||||
 | 
			
		||||
This repo contains a few more elaborate elements of configuration.
 | 
			
		||||
 | 
			
		||||
- [Neovim config](./modules/common/neovim/default.nix) generated with Nix2Vim
 | 
			
		||||
and source-controlled plugins, differing based on installed LSPs, for example.
 | 
			
		||||
- [Caddy JSON](./modules/nixos/services/caddy.nix) file (routes, etc.) based
 | 
			
		||||
dynamically on enabled services rendered with Nix.
 | 
			
		||||
- [Grafana config](./modules/nixos/services/grafana.nix) rendered with Nix.
 | 
			
		||||
- Custom [secrets deployment](./modules/nixos/services/secrets.nix) similar to
 | 
			
		||||
agenix.
 | 
			
		||||
- Base16 [colorschemes](./colorscheme/) applied to multiple applications,
 | 
			
		||||
including Firefox userChrome.
 | 
			
		||||
 | 
			
		||||
---
 | 
			
		||||
 | 
			
		||||
# Installation
 | 
			
		||||
 | 
			
		||||
Click [here](./docs/installation.md) for detailed installation instructions.
 | 
			
		||||
 | 
			
		||||
# Neovim
 | 
			
		||||
 | 
			
		||||
Try out my Neovim config with nix:
 | 
			
		||||
Try out my Neovim config (requires [nix](https://nixos.org/download.html)):
 | 
			
		||||
 | 
			
		||||
```bash
 | 
			
		||||
nix run github:nmasur/dotfiles#neovim
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Or build it as a package:
 | 
			
		||||
Or build it as a package (requires [nix](https://nixos.org/download.html)):
 | 
			
		||||
 | 
			
		||||
```bash
 | 
			
		||||
nix build github:nmasur/dotfiles#neovim
 | 
			
		||||
@@ -85,6 +30,73 @@ If you already have a Neovim configuration, you may need to move it out of
 | 
			
		||||
`~/.config/nvim` or set `XDG_CONFIG_HOME` to another value; otherwise both
 | 
			
		||||
configs might conflict with each other.
 | 
			
		||||
 | 
			
		||||
---
 | 
			
		||||
 | 
			
		||||
# Full Installation
 | 
			
		||||
 | 
			
		||||
## NixOS - From Live Disk
 | 
			
		||||
 | 
			
		||||
Format drives and build system from any NixOS host, including the live
 | 
			
		||||
installer disk:
 | 
			
		||||
 | 
			
		||||
**This will erase your drives; use at your own risk!**
 | 
			
		||||
 | 
			
		||||
```bash
 | 
			
		||||
lsblk # Choose the disk you want to wipe
 | 
			
		||||
nix-shell -p nixVersions.stable
 | 
			
		||||
nix run github:nmasur/dotfiles#installer -- nvme0n1 tempest
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
## NixOS - From Existing System
 | 
			
		||||
 | 
			
		||||
If you're already running NixOS, you can switch to this configuration with the
 | 
			
		||||
following command:
 | 
			
		||||
 | 
			
		||||
```bash
 | 
			
		||||
nix-shell -p nixVersions.stable
 | 
			
		||||
sudo nixos-rebuild switch --flake github:nmasur/dotfiles#tempest
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
## Windows - From NixOS WSL
 | 
			
		||||
 | 
			
		||||
After [installing NixOS on
 | 
			
		||||
WSL](https://xeiaso.net/blog/nix-flakes-4-wsl-2022-05-01), you can switch to
 | 
			
		||||
the WSL configuration:
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
nix-shell -p nixVersions.stable
 | 
			
		||||
sudo nixos-rebuild switch --flake github:nmasur/dotfiles#hydra
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
You should also download the
 | 
			
		||||
[FiraCode](https://github.com/ryanoasis/nerd-fonts/releases/download/v2.2.2/FiraCode.zip)
 | 
			
		||||
font and install it on Windows. Install [Alacritty](https://alacritty.org/) and
 | 
			
		||||
move the `windows/alacritty.yml` file to
 | 
			
		||||
`C:\Users\<user>\AppData\Roaming\alacritty`.
 | 
			
		||||
 | 
			
		||||
## macOS
 | 
			
		||||
 | 
			
		||||
To get started on a bare macOS installation, first install Nix:
 | 
			
		||||
 | 
			
		||||
```bash
 | 
			
		||||
sh -c "$(curl -L https://nixos.org/nix/install)"
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Then use Nix to build nix-darwin:
 | 
			
		||||
 | 
			
		||||
```bash
 | 
			
		||||
nix-build https://github.com/LnL7/nix-darwin/archive/master.tar.gz -A installer
 | 
			
		||||
./result/bin/darwin-installer
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Then switch to the macOS configuration:
 | 
			
		||||
 | 
			
		||||
```bash
 | 
			
		||||
darwin-rebuild switch --flake github:nmasur/dotfiles#lookingglass
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
---
 | 
			
		||||
 | 
			
		||||
# Flake Templates
 | 
			
		||||
 | 
			
		||||
You can also use the [templates](./templates/) as flakes for starting new
 | 
			
		||||
 
 | 
			
		||||
@@ -1,9 +0,0 @@
 | 
			
		||||
# Apps
 | 
			
		||||
 | 
			
		||||
These are all my miscellaneous utilies and scripts to accompany this project.
 | 
			
		||||
 | 
			
		||||
They can be run with:
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
nix run github:nmasur/dotfiles#appname
 | 
			
		||||
```
 | 
			
		||||
@@ -1,5 +1,4 @@
 | 
			
		||||
{ pkgs, ... }:
 | 
			
		||||
rec {
 | 
			
		||||
{ pkgs, ... }: rec {
 | 
			
		||||
 | 
			
		||||
  # Show quick helper
 | 
			
		||||
  default = import ./help.nix { inherit pkgs; };
 | 
			
		||||
@@ -31,4 +30,5 @@ rec {
 | 
			
		||||
  # Run neovim as an app
 | 
			
		||||
  neovim = import ./neovim.nix { inherit pkgs; };
 | 
			
		||||
  nvim = neovim;
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,19 +1,19 @@
 | 
			
		||||
{ pkgs, ... }:
 | 
			
		||||
{
 | 
			
		||||
{ pkgs, ... }: {
 | 
			
		||||
 | 
			
		||||
  # nix run github:nmasur/dotfiles#encrypt-secret > private/mysecret.age
 | 
			
		||||
 | 
			
		||||
  type = "app";
 | 
			
		||||
 | 
			
		||||
  program = builtins.toString (
 | 
			
		||||
    pkgs.writeShellScript "encrypt-secret" ''
 | 
			
		||||
  program = builtins.toString (pkgs.writeShellScript "encrypt-secret" ''
 | 
			
		||||
    printf "\nEnter the secret data to encrypt for all hosts...\n\n" 1>&2
 | 
			
		||||
    read -p "Secret: " secret
 | 
			
		||||
    printf "\nEncrypting...\n\n" 1>&2
 | 
			
		||||
    tmpfile=$(mktemp)
 | 
			
		||||
    echo "''${secret}" > ''${tmpfile}
 | 
			
		||||
      ${pkgs.age}/bin/age --encrypt --armor --recipients-file ${builtins.toString ../misc/public-keys} $tmpfile
 | 
			
		||||
    ${pkgs.age}/bin/age --encrypt --armor --recipients-file ${
 | 
			
		||||
      builtins.toString ../public-keys
 | 
			
		||||
    } $tmpfile
 | 
			
		||||
    rm $tmpfile
 | 
			
		||||
    ''
 | 
			
		||||
  );
 | 
			
		||||
  '');
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,12 +1,10 @@
 | 
			
		||||
{ pkgs, ... }:
 | 
			
		||||
{
 | 
			
		||||
{ pkgs, ... }: {
 | 
			
		||||
 | 
			
		||||
  # This script will partition and format drives; use at your own risk!
 | 
			
		||||
 | 
			
		||||
  type = "app";
 | 
			
		||||
 | 
			
		||||
  program = builtins.toString (
 | 
			
		||||
    pkgs.writeShellScript "format-root" ''
 | 
			
		||||
  program = builtins.toString (pkgs.writeShellScript "format-root" ''
 | 
			
		||||
    set -e
 | 
			
		||||
 | 
			
		||||
    DISK=$1
 | 
			
		||||
@@ -36,6 +34,6 @@
 | 
			
		||||
        --flake "path:$(pwd)#root" \
 | 
			
		||||
        --arg disk "/dev/''${DISK}"
 | 
			
		||||
 | 
			
		||||
    ''
 | 
			
		||||
  );
 | 
			
		||||
  '');
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,10 +1,8 @@
 | 
			
		||||
{ pkgs, ... }:
 | 
			
		||||
{
 | 
			
		||||
{ pkgs, ... }: {
 | 
			
		||||
 | 
			
		||||
  type = "app";
 | 
			
		||||
 | 
			
		||||
  program = builtins.toString (
 | 
			
		||||
    pkgs.writeShellScript "default" ''
 | 
			
		||||
  program = builtins.toString (pkgs.writeShellScript "default" ''
 | 
			
		||||
    ${pkgs.gum}/bin/gum style --margin "1 2" --padding "0 2" --foreground "15" --background "55" "Options"
 | 
			
		||||
    ${pkgs.gum}/bin/gum format --type=template -- '  {{ Italic "Run with" }} {{ Color "15" "69" " nix run github:nmasur/dotfiles#" }}{{ Color "15" "62" "someoption" }}{{ Color "15" "69" " " }}.'
 | 
			
		||||
    echo ""
 | 
			
		||||
@@ -20,6 +18,6 @@
 | 
			
		||||
        '  • {{ Color "15" "57" " netdata " }} {{ Italic "Connect a machine to Netdata cloud." }}'
 | 
			
		||||
    echo ""
 | 
			
		||||
    echo ""
 | 
			
		||||
    ''
 | 
			
		||||
  );
 | 
			
		||||
  '');
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,13 +1,11 @@
 | 
			
		||||
{ pkgs, ... }:
 | 
			
		||||
{
 | 
			
		||||
{ pkgs, ... }: {
 | 
			
		||||
 | 
			
		||||
  # Inspired by https://github.com/cleverca22/nix-tests/blob/master/kexec/justdoit.nix
 | 
			
		||||
  # This script will partition and format drives; use at your own risk!
 | 
			
		||||
 | 
			
		||||
  type = "app";
 | 
			
		||||
 | 
			
		||||
  program = builtins.toString (
 | 
			
		||||
    pkgs.writeShellScript "installer" ''
 | 
			
		||||
  program = builtins.toString (pkgs.writeShellScript "installer" ''
 | 
			
		||||
    set -e
 | 
			
		||||
 | 
			
		||||
    DISK=$1
 | 
			
		||||
@@ -19,8 +17,8 @@
 | 
			
		||||
            --foreground "#fb4934" \
 | 
			
		||||
            "Missing required parameter." \
 | 
			
		||||
            "Usage: installer -- <disk> <host>" \
 | 
			
		||||
              "Example: installer -- nvme0n1 tempest" \
 | 
			
		||||
              "Flake example: nix run github:nmasur/dotfiles#installer -- nvme0n1 tempest"
 | 
			
		||||
            "Example: installer -- nvme0n1 desktop" \
 | 
			
		||||
            "Flake example: nix run github:nmasur/dotfiles#installer -- nvme0n1 desktop"
 | 
			
		||||
        echo "(exiting)"
 | 
			
		||||
        exit 1
 | 
			
		||||
    fi
 | 
			
		||||
@@ -45,6 +43,6 @@
 | 
			
		||||
    mount /dev/disk/by-label/boot /mnt/boot
 | 
			
		||||
 | 
			
		||||
    ${pkgs.nixos-install-tools}/bin/nixos-install --flake github:nmasur/dotfiles#''${FLAKE}
 | 
			
		||||
    ''
 | 
			
		||||
  );
 | 
			
		||||
  '');
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,15 +1,12 @@
 | 
			
		||||
{ pkgs, ... }:
 | 
			
		||||
{
 | 
			
		||||
{ pkgs, ... }: {
 | 
			
		||||
 | 
			
		||||
  type = "app";
 | 
			
		||||
 | 
			
		||||
  program = builtins.toString (
 | 
			
		||||
    pkgs.writeShellScript "loadkey" ''
 | 
			
		||||
  program = builtins.toString (pkgs.writeShellScript "loadkey" ''
 | 
			
		||||
    printf "\nEnter the seed phrase for your SSH key...\n"
 | 
			
		||||
    printf "\nThen press ^D when complete.\n\n"
 | 
			
		||||
      mkdir -p ~/.ssh/
 | 
			
		||||
    ${pkgs.melt}/bin/melt restore ~/.ssh/id_ed25519
 | 
			
		||||
    printf "\n\nContinuing activation.\n\n"
 | 
			
		||||
    ''
 | 
			
		||||
  );
 | 
			
		||||
  '');
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,12 +1,13 @@
 | 
			
		||||
{ pkgs, ... }:
 | 
			
		||||
{
 | 
			
		||||
{ pkgs, ... }: {
 | 
			
		||||
 | 
			
		||||
  type = "app";
 | 
			
		||||
 | 
			
		||||
  program = "${
 | 
			
		||||
      (import ../modules/common/neovim/package {
 | 
			
		||||
        inherit pkgs;
 | 
			
		||||
      colors = (import ../colorscheme/nord).dark;
 | 
			
		||||
        colors =
 | 
			
		||||
          import ../colorscheme/gruvbox/neovim-gruvbox.nix { inherit pkgs; };
 | 
			
		||||
      })
 | 
			
		||||
    }/bin/nvim";
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,10 +1,8 @@
 | 
			
		||||
{ pkgs, ... }:
 | 
			
		||||
{
 | 
			
		||||
{ pkgs, ... }: {
 | 
			
		||||
 | 
			
		||||
  type = "app";
 | 
			
		||||
 | 
			
		||||
  program = builtins.toString (
 | 
			
		||||
    pkgs.writeShellScript "netdata-cloud" ''
 | 
			
		||||
  program = builtins.toString (pkgs.writeShellScript "netdata-cloud" ''
 | 
			
		||||
    if [ "$EUID" -ne 0 ]; then
 | 
			
		||||
      echo "Please run as root"
 | 
			
		||||
      exit 1
 | 
			
		||||
@@ -16,6 +14,6 @@
 | 
			
		||||
    chown -R netdata:netdata /var/lib/netdata
 | 
			
		||||
    ${pkgs.netdata}/bin/netdata-claim.sh -id=$(uuidgen)
 | 
			
		||||
    printf "\n\nNow restart netdata service.\n\n"
 | 
			
		||||
    ''
 | 
			
		||||
  );
 | 
			
		||||
  '');
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,11 +1,9 @@
 | 
			
		||||
{ pkgs, ... }:
 | 
			
		||||
{
 | 
			
		||||
{ pkgs, ... }: {
 | 
			
		||||
 | 
			
		||||
  type = "app";
 | 
			
		||||
 | 
			
		||||
  program = builtins.toString (
 | 
			
		||||
    pkgs.writeShellScript "readme" ''
 | 
			
		||||
  program = builtins.toString (pkgs.writeShellScript "readme" ''
 | 
			
		||||
    ${pkgs.glow}/bin/glow --pager ${builtins.toString ../README.md}
 | 
			
		||||
    ''
 | 
			
		||||
  );
 | 
			
		||||
  '');
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,17 +1,15 @@
 | 
			
		||||
{ pkgs, ... }:
 | 
			
		||||
{
 | 
			
		||||
{ pkgs, ... }: {
 | 
			
		||||
 | 
			
		||||
  type = "app";
 | 
			
		||||
 | 
			
		||||
  program = builtins.toString (
 | 
			
		||||
    pkgs.writeShellScript "rebuild" ''
 | 
			
		||||
  program = builtins.toString (pkgs.writeShellScript "rebuild" ''
 | 
			
		||||
    echo ${pkgs.system}
 | 
			
		||||
    SYSTEM=${if pkgs.stdenv.isDarwin then "darwin" else "linux"}
 | 
			
		||||
    if [ "$SYSTEM" == "darwin" ]; then
 | 
			
		||||
          sudo darwin-rebuild switch --flake ${builtins.toString ../.}
 | 
			
		||||
        darwin-rebuild switch --flake github:nmasur/dotfiles#lookingglass
 | 
			
		||||
    else
 | 
			
		||||
          doas nixos-rebuild switch --flake ${builtins.toString ../.}
 | 
			
		||||
        nixos-rebuild switch --flake github:nmasur/dotfiles
 | 
			
		||||
    fi
 | 
			
		||||
    ''
 | 
			
		||||
  );
 | 
			
		||||
  '');
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,12 +1,10 @@
 | 
			
		||||
{ pkgs, ... }:
 | 
			
		||||
{
 | 
			
		||||
{ pkgs, ... }: {
 | 
			
		||||
 | 
			
		||||
  # nix run github:nmasur/dotfiles#reencrypt-secrets ./private
 | 
			
		||||
 | 
			
		||||
  type = "app";
 | 
			
		||||
 | 
			
		||||
  program = builtins.toString (
 | 
			
		||||
    pkgs.writeShellScript "reencrypt-secrets" ''
 | 
			
		||||
  program = builtins.toString (pkgs.writeShellScript "reencrypt-secrets" ''
 | 
			
		||||
    if [ $# -eq 0 ]; then
 | 
			
		||||
      echo "Must provide directory to reencrypt."
 | 
			
		||||
      exit 1
 | 
			
		||||
@@ -18,10 +16,12 @@
 | 
			
		||||
      ${pkgs.age}/bin/age --decrypt \
 | 
			
		||||
        --identity ~/.ssh/id_ed25519 $encryptedfile > $tmpfile
 | 
			
		||||
      echo "Encrypting ''${encryptedfile}..."
 | 
			
		||||
        ${pkgs.age}/bin/age --encrypt --armor --recipients-file ${builtins.toString ../misc/public-keys} $tmpfile > $encryptedfile
 | 
			
		||||
      ${pkgs.age}/bin/age --encrypt --armor --recipients-file ${
 | 
			
		||||
        builtins.toString ../public-keys
 | 
			
		||||
      } $tmpfile > $encryptedfile
 | 
			
		||||
      rm $tmpfile
 | 
			
		||||
    done
 | 
			
		||||
    echo "Finished."
 | 
			
		||||
    ''
 | 
			
		||||
  );
 | 
			
		||||
  '');
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +0,0 @@
 | 
			
		||||
# Colorschemes
 | 
			
		||||
 | 
			
		||||
Color information for different themes is found here. The colors are sourced
 | 
			
		||||
and used with [base16](https://github.com/chriskempson/base16) format
 | 
			
		||||
consistently across the system.
 | 
			
		||||
@@ -1,7 +1,6 @@
 | 
			
		||||
{
 | 
			
		||||
  name = "everforest"; # dark, hard
 | 
			
		||||
  author = "Sainnhe Park";
 | 
			
		||||
  dark = {
 | 
			
		||||
  base00 = "#2b3339"; # Default Background
 | 
			
		||||
  base01 = "#323c41"; # Lighter Background
 | 
			
		||||
  base02 = "#503946"; # Selection Background
 | 
			
		||||
@@ -18,5 +17,4 @@
 | 
			
		||||
  base0D = "#a7c080"; # Functions, Methods, Attribute IDs, Headings
 | 
			
		||||
  base0E = "#e67e80"; # Keywords, Storage, Selector, Markup Italic, Diff Changed
 | 
			
		||||
  base0F = "#d699b6"; # Deprecated, Opening/Closing Embedded Language Tags, ...
 | 
			
		||||
  };
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,44 +0,0 @@
 | 
			
		||||
# Gruvbox with a darker background for greater contrast
 | 
			
		||||
 | 
			
		||||
{
 | 
			
		||||
  name = "gruvbox-dark"; # Dark, Medium
 | 
			
		||||
  author = "Dawid Kurek (dawikur@gmail.com), morhetz (https://github.com/morhetz/gruvbox), ElRastaOk (https://www.reddit.com/user/ElRastaOk)";
 | 
			
		||||
  dark = {
 | 
			
		||||
    base00 = "#1D2122"; # ---- This is the change from normal gruvbox
 | 
			
		||||
    base01 = "#3c3836"; # ---
 | 
			
		||||
    base02 = "#504945"; # --
 | 
			
		||||
    base03 = "#665c54"; # -
 | 
			
		||||
    base04 = "#bdae93"; # +
 | 
			
		||||
    base05 = "#d5c4a1"; # ++
 | 
			
		||||
    base06 = "#ebdbb2"; # +++
 | 
			
		||||
    base07 = "#fbf1c7"; # ++++
 | 
			
		||||
    base08 = "#fb4934"; # red
 | 
			
		||||
    base09 = "#fe8019"; # orange
 | 
			
		||||
    base0A = "#fabd2f"; # yellow
 | 
			
		||||
    base0B = "#b8bb26"; # green
 | 
			
		||||
    base0C = "#8ec07c"; # aqua/cyan
 | 
			
		||||
    base0D = "#83a598"; # blue
 | 
			
		||||
    base0E = "#d3869b"; # purple
 | 
			
		||||
    base0F = "#d65d0e"; # brown
 | 
			
		||||
    batTheme = "gruvbox-dark";
 | 
			
		||||
  };
 | 
			
		||||
  light = {
 | 
			
		||||
    base00 = "#fbf1c7"; # ----
 | 
			
		||||
    base01 = "#ebdbb2"; # ---
 | 
			
		||||
    base02 = "#d5c4a1"; # --
 | 
			
		||||
    base03 = "#bdae93"; # -
 | 
			
		||||
    base04 = "#665c54"; # +
 | 
			
		||||
    base05 = "#504945"; # ++
 | 
			
		||||
    base06 = "#3c3836"; # +++
 | 
			
		||||
    base07 = "#1D2122"; # ++++ Adjusted darker here
 | 
			
		||||
    base08 = "#9d0006"; # red
 | 
			
		||||
    base09 = "#af3a03"; # orange
 | 
			
		||||
    base0A = "#b57614"; # yellow
 | 
			
		||||
    base0B = "#79740e"; # green
 | 
			
		||||
    base0C = "#427b58"; # aqua/cyan
 | 
			
		||||
    base0D = "#076678"; # blue
 | 
			
		||||
    base0E = "#8f3f71"; # purple
 | 
			
		||||
    base0F = "#d65d0e"; # brown
 | 
			
		||||
    batTheme = "gruvbox-light";
 | 
			
		||||
  };
 | 
			
		||||
}
 | 
			
		||||
@@ -1,6 +1,7 @@
 | 
			
		||||
{
 | 
			
		||||
  name = "gruvbox"; # Dark, Medium
 | 
			
		||||
  author = "Dawid Kurek (dawikur@gmail.com), morhetz (https://github.com/morhetz/gruvbox)";
 | 
			
		||||
  author =
 | 
			
		||||
    "Dawid Kurek (dawikur@gmail.com), morhetz (https://github.com/morhetz/gruvbox)";
 | 
			
		||||
  dark = {
 | 
			
		||||
    base00 = "#282828"; # ----
 | 
			
		||||
    base01 = "#3c3836"; # ---
 | 
			
		||||
@@ -18,6 +19,7 @@
 | 
			
		||||
    base0D = "#83a598"; # blue
 | 
			
		||||
    base0E = "#d3869b"; # purple
 | 
			
		||||
    base0F = "#d65d0e"; # brown
 | 
			
		||||
    neovimConfig = ./neovim-gruvbox.nix;
 | 
			
		||||
    batTheme = "gruvbox-dark";
 | 
			
		||||
  };
 | 
			
		||||
  light = {
 | 
			
		||||
@@ -37,6 +39,7 @@
 | 
			
		||||
    base0D = "#076678"; # blue
 | 
			
		||||
    base0E = "#8f3f71"; # purple
 | 
			
		||||
    base0F = "#d65d0e"; # brown
 | 
			
		||||
    neovimConfig = ./neovim-gruvbox.nix;
 | 
			
		||||
    batTheme = "gruvbox-light";
 | 
			
		||||
  };
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										12
									
								
								colorscheme/gruvbox/neovim-gruvbox.nix
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								colorscheme/gruvbox/neovim-gruvbox.nix
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,12 @@
 | 
			
		||||
{ pkgs, ... }: {
 | 
			
		||||
 | 
			
		||||
  plugins = [ pkgs.vimPlugins.vim-gruvbox8 ];
 | 
			
		||||
 | 
			
		||||
  vim.g.gruvbox_italicize_strings = 0;
 | 
			
		||||
  vim.o.background = "dark";
 | 
			
		||||
  vimscript = ''
 | 
			
		||||
    let g:gruvbox_italicize_strings = 0
 | 
			
		||||
    colorscheme gruvbox8
 | 
			
		||||
  '';
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -1,7 +1,6 @@
 | 
			
		||||
{
 | 
			
		||||
  name = "nord";
 | 
			
		||||
  author = "arcticicestudio";
 | 
			
		||||
  dark = {
 | 
			
		||||
  base00 = "#2E3440";
 | 
			
		||||
  base01 = "#3B4252";
 | 
			
		||||
  base02 = "#434C5E";
 | 
			
		||||
@@ -18,6 +17,5 @@
 | 
			
		||||
  base0D = "#EBCB8B";
 | 
			
		||||
  base0E = "#A3BE8C";
 | 
			
		||||
  base0F = "#B48EAD";
 | 
			
		||||
    batTheme = "nord";
 | 
			
		||||
  };
 | 
			
		||||
  neovimConfig = ./neovim.lua;
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										13
									
								
								colorscheme/nord/neovim.lua
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								colorscheme/nord/neovim.lua
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,13 @@
 | 
			
		||||
local M = {}
 | 
			
		||||
 | 
			
		||||
M.packer = function(use)
 | 
			
		||||
    use({
 | 
			
		||||
        "shaunsingh/nord.nvim",
 | 
			
		||||
        config = function()
 | 
			
		||||
            vim.g.nord_italic = true
 | 
			
		||||
            vim.cmd("colorscheme nord")
 | 
			
		||||
        end,
 | 
			
		||||
    })
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
return M
 | 
			
		||||
@@ -1,5 +0,0 @@
 | 
			
		||||
# Disks
 | 
			
		||||
 | 
			
		||||
These are my [disko](https://github.com/nix-community/disko) configurations,
 | 
			
		||||
which allow me to save desired disk formatting layouts as a declarative file so
 | 
			
		||||
I don't have to remember how to format my disks later on.
 | 
			
		||||
@@ -1,38 +1,43 @@
 | 
			
		||||
{ disk, ... }:
 | 
			
		||||
{
 | 
			
		||||
{ disk, ... }: {
 | 
			
		||||
  disk = {
 | 
			
		||||
    boot = {
 | 
			
		||||
      type = "disk";
 | 
			
		||||
      device = disk;
 | 
			
		||||
      content = {
 | 
			
		||||
        type = "gpt";
 | 
			
		||||
        partitions = {
 | 
			
		||||
        type = "table";
 | 
			
		||||
        format = "gpt";
 | 
			
		||||
        partitions = [
 | 
			
		||||
          # Boot partition
 | 
			
		||||
          ESP = rec {
 | 
			
		||||
            size = "512MiB";
 | 
			
		||||
            type = "EF00";
 | 
			
		||||
            label = "boot";
 | 
			
		||||
            device = "/dev/disk/by-label/${label}";
 | 
			
		||||
          {
 | 
			
		||||
            type = "partition";
 | 
			
		||||
            name = "ESP";
 | 
			
		||||
            start = "0";
 | 
			
		||||
            end = "512MiB";
 | 
			
		||||
            fs-type = "fat32";
 | 
			
		||||
            bootable = true;
 | 
			
		||||
            content = {
 | 
			
		||||
              type = "filesystem";
 | 
			
		||||
              format = "vfat";
 | 
			
		||||
              mountpoint = "/boot";
 | 
			
		||||
              extraArgs = [ "-n ${label}" ];
 | 
			
		||||
            };
 | 
			
		||||
              extraArgs = [ "-n boot" ];
 | 
			
		||||
            };
 | 
			
		||||
          }
 | 
			
		||||
          # Root partition ext4
 | 
			
		||||
          root = rec {
 | 
			
		||||
            size = "100%";
 | 
			
		||||
            label = "nixos";
 | 
			
		||||
            device = "/dev/disk/by-label/${label}";
 | 
			
		||||
          {
 | 
			
		||||
            type = "partition";
 | 
			
		||||
            name = "root";
 | 
			
		||||
            start = "512MiB";
 | 
			
		||||
            end = "100%";
 | 
			
		||||
            part-type = "primary";
 | 
			
		||||
            bootable = true;
 | 
			
		||||
            content = {
 | 
			
		||||
              type = "filesystem";
 | 
			
		||||
              format = "ext4";
 | 
			
		||||
              mountpoint = "/";
 | 
			
		||||
              extraArgs = [ "-L ${label}" ];
 | 
			
		||||
            };
 | 
			
		||||
          };
 | 
			
		||||
              extraArgs = [ "-L nixos" ];
 | 
			
		||||
            };
 | 
			
		||||
          }
 | 
			
		||||
        ];
 | 
			
		||||
      };
 | 
			
		||||
    };
 | 
			
		||||
  };
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,4 @@
 | 
			
		||||
{ pool, disks, ... }:
 | 
			
		||||
{
 | 
			
		||||
{ pool, disks, ... }: {
 | 
			
		||||
  disk = lib.genAttrs disks (disk: {
 | 
			
		||||
    "${disk}" = {
 | 
			
		||||
      type = "disk";
 | 
			
		||||
@@ -7,8 +6,7 @@
 | 
			
		||||
      content = {
 | 
			
		||||
        type = "table";
 | 
			
		||||
        format = "gpt";
 | 
			
		||||
        partitions = [
 | 
			
		||||
          {
 | 
			
		||||
        partitions = [{
 | 
			
		||||
          type = "partition";
 | 
			
		||||
          name = "zfs";
 | 
			
		||||
          start = "128MiB";
 | 
			
		||||
@@ -17,8 +15,7 @@
 | 
			
		||||
            type = "zfs";
 | 
			
		||||
            pool = pool;
 | 
			
		||||
          };
 | 
			
		||||
          }
 | 
			
		||||
        ];
 | 
			
		||||
        }];
 | 
			
		||||
      };
 | 
			
		||||
    };
 | 
			
		||||
  });
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +0,0 @@
 | 
			
		||||
# Documentation
 | 
			
		||||
 | 
			
		||||
Reference documents for some of the more complicated services and maintenance
 | 
			
		||||
tasks.
 | 
			
		||||
@@ -1,73 +0,0 @@
 | 
			
		||||
[Back to README](../README.md)
 | 
			
		||||
 | 
			
		||||
---
 | 
			
		||||
 | 
			
		||||
# Installation
 | 
			
		||||
 | 
			
		||||
## NixOS - From Live Disk
 | 
			
		||||
 | 
			
		||||
Format drives and build system from any NixOS host, including the live
 | 
			
		||||
installer disk:
 | 
			
		||||
 | 
			
		||||
**This will erase your drives; use at your own risk!**
 | 
			
		||||
 | 
			
		||||
```bash
 | 
			
		||||
lsblk # Choose the disk you want to wipe
 | 
			
		||||
nix-shell -p nixVersions.stable
 | 
			
		||||
nix run github:nmasur/dotfiles#installer -- nvme0n1 tempest
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
## NixOS - From Existing System
 | 
			
		||||
 | 
			
		||||
If you're already running NixOS, you can switch to this configuration with the
 | 
			
		||||
following command:
 | 
			
		||||
 | 
			
		||||
```bash
 | 
			
		||||
nix-shell -p nixVersions.stable
 | 
			
		||||
sudo nixos-rebuild switch --flake github:nmasur/dotfiles#tempest
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
## Windows - From NixOS WSL
 | 
			
		||||
 | 
			
		||||
After [installing NixOS on
 | 
			
		||||
WSL](https://xeiaso.net/blog/nix-flakes-4-wsl-2022-05-01), you can switch to
 | 
			
		||||
the WSL configuration:
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
nix-shell -p nixVersions.stable
 | 
			
		||||
sudo nixos-rebuild switch --flake github:nmasur/dotfiles#hydra
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
You should also download the
 | 
			
		||||
[FiraCode](https://github.com/ryanoasis/nerd-fonts/releases/download/v2.2.2/FiraCode.zip)
 | 
			
		||||
font and install it on Windows. Install [Alacritty](https://alacritty.org/) and
 | 
			
		||||
move the `windows/alacritty.yml` file to
 | 
			
		||||
`C:\Users\<user>\AppData\Roaming\alacritty`.
 | 
			
		||||
 | 
			
		||||
## macOS
 | 
			
		||||
 | 
			
		||||
To get started on a bare macOS installation, first install Nix:
 | 
			
		||||
 | 
			
		||||
```bash
 | 
			
		||||
curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Launch a new shell. Then use Nix to switch to the macOS configuration:
 | 
			
		||||
 | 
			
		||||
```bash
 | 
			
		||||
sudo rm /etc/bashrc
 | 
			
		||||
sudo rm /etc/nix/nix.conf
 | 
			
		||||
export NIX_SSL_CERT_FILE="$HOME/Documents/t2-ca-bundle.pem"
 | 
			
		||||
nix \
 | 
			
		||||
    --extra-experimental-features flakes \
 | 
			
		||||
    --extra-experimental-features nix-command \
 | 
			
		||||
    run nix-darwin -- switch \
 | 
			
		||||
    --flake github:nmasur/dotfiles#lookingglass
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Once installed, you can continue to update the macOS configuration:
 | 
			
		||||
 | 
			
		||||
```bash
 | 
			
		||||
darwin-rebuild switch --flake ~/dev/personal/dotfiles
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
@@ -1,82 +0,0 @@
 | 
			
		||||
# Repairing Nextcloud
 | 
			
		||||
 | 
			
		||||
You can run the maintenance commands like this:
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
sudo -u nextcloud nextcloud-occ maintenance:mode --on
 | 
			
		||||
sudo -u nextcloud nextcloud-occ maintenance:repair
 | 
			
		||||
sudo -u nextcloud nextcloud-occ maintenance:mode --off
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
## Rescan Files
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
sudo -u nextcloud nextcloud-occ files:scan --all
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
## Converting from SQLite to MySQL (mariadb)
 | 
			
		||||
 | 
			
		||||
First: keep Nextcloud set to SQLite as its dbtype, and separately launch MySQL
 | 
			
		||||
as a service by copying the configuration found
 | 
			
		||||
[here](https://github.com/NixOS/nixpkgs/blob/nixos-unstable/nixos/modules/services/web-apps/nextcloud.nix).
 | 
			
		||||
 | 
			
		||||
No password is necessary, since the user-based auth works with UNIX sockets.
 | 
			
		||||
 | 
			
		||||
You can connect to the MySQL instance like this:
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
sudo -u nextcloud mysql -S /run/mysqld/mysqld.sock
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Create a blank database for Nextcloud:
 | 
			
		||||
 | 
			
		||||
```sql
 | 
			
		||||
create database nextcloud;
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Now setup the [conversion](https://docs.nextcloud.com/server/17/admin_manual/configuration_database/db_conversion.html):
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
sudo -u nextcloud nextcloud-occ db:convert-type mysql nextcloud localhost nextcloud
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Ignore the password prompt. Proceed with the conversion.
 | 
			
		||||
 | 
			
		||||
Now `config.php` will be updated but the override config from NixOS will not
 | 
			
		||||
be. Now update your NixOS configuration:
 | 
			
		||||
 | 
			
		||||
- Remove the `mysql` service you created.
 | 
			
		||||
- Set `dbtype` to `mysql`.
 | 
			
		||||
- Set `database.createLocally` to `true`.
 | 
			
		||||
 | 
			
		||||
Rebuild your configuration.
 | 
			
		||||
 | 
			
		||||
Now, make sure to enable [4-byte
 | 
			
		||||
support](https://docs.nextcloud.com/server/latest/admin_manual/configuration_database/mysql_4byte_support.html)
 | 
			
		||||
in the database.
 | 
			
		||||
 | 
			
		||||
## Backing Up MySQL Database
 | 
			
		||||
 | 
			
		||||
Use this mysqldump command:
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
sudo -u nextcloud mysqldump -S /run/mysqld/mysqld.sock --default-character-set=utf8mb4 nextcloud > backup.sql
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
## Converting to Postgres
 | 
			
		||||
 | 
			
		||||
Same as MySQL, but run this command instead:
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
sudo -u nextcloud nextcloud-occ db:convert-type pgsql nextcloud /run/postgresql/ nextcloud
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Then set the `dbtype` to `pgsql`.
 | 
			
		||||
 | 
			
		||||
## Backing Up Postgres Database
 | 
			
		||||
 | 
			
		||||
Use this pg_dump command:
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
sudo -u nextcloud pg_dump nextcloud > backup.sql
 | 
			
		||||
```
 | 
			
		||||
							
								
								
									
										43
									
								
								docs/restore-nextcloud.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										43
									
								
								docs/restore-nextcloud.md
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,43 @@
 | 
			
		||||
# Restoring Nextcloud From Backup
 | 
			
		||||
 | 
			
		||||
Install the `litestream` package.
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
nix-shell --run fish -p litestream
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Set the S3 credentials:
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
set -x AWS_ACCESS_KEY_ID (read)
 | 
			
		||||
set -x AWS_SECRET_ACCESS_KEY (read)
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Restore from S3:
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
litestream restore -o nextcloud.db s3://noahmasur-backup.s3.us-west-002.backblazeb2.com/nextcloud
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Install Nextcloud. Then copy DB:
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
sudo rm /data/nextcloud/data/nextcloud.db*
 | 
			
		||||
sudo mv nextcloud.db /data/nextcloud/data/
 | 
			
		||||
sudo chown nextcloud:nextcloud /data/nextcloud/data/nextcloud.db
 | 
			
		||||
sudo chmod 770 /data/nextcloud/data/nextcloud.db
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Restart Nextcloud:
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
sudo systemctl restart phpfpm-nextcloud.service
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Adjust Permissions and Directories:
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
sudo mkdir /data/nextcloud/data/noah/files
 | 
			
		||||
sudo chown nextcloud:nextcloud /data/nextcloud/data/noah/files
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										45
									
								
								docs/zfs.md
									
									
									
									
									
								
							
							
						
						
									
										45
									
								
								docs/zfs.md
									
									
									
									
									
								
							@@ -1,45 +0,0 @@
 | 
			
		||||
# ZFS
 | 
			
		||||
 | 
			
		||||
Swan runs its root on ext4. The ZFS drives are managed imperatively (this
 | 
			
		||||
[disko configuration](../disks/zfs.nix) is an unused work-in-progress).
 | 
			
		||||
 | 
			
		||||
The basic ZFS settings are managed [here](../modules/nixos/hardware/zfs.nix).
 | 
			
		||||
 | 
			
		||||
## Creating a New Dataset
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
sudo zfs create tank/mydataset
 | 
			
		||||
sudo zfs set compression=zstd tank/myzstddataset
 | 
			
		||||
sudo zfs set mountpoint=/data/mydataset tank/mydataset
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
## Maintenance
 | 
			
		||||
 | 
			
		||||
### Get Status
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
sudo zpool status
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
### Replace Disk
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
sudo zdb
 | 
			
		||||
sudo zpool status -g # Show by GUID
 | 
			
		||||
sudo zpool offline tank <GUID>
 | 
			
		||||
sudo zpool status
 | 
			
		||||
# Remove old disk, insert new disk
 | 
			
		||||
sudo zdb
 | 
			
		||||
sudo zpool replace tank <OLD GUID> /dev/disk/by-id/<NEW PATH>
 | 
			
		||||
sudo zpool status
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
## Initial Setup
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
sudo zpool create tank raidz1 sda sdb sdc
 | 
			
		||||
sudo zpool set ashift=12 tank
 | 
			
		||||
sudo zpool set autoexpand=on tank
 | 
			
		||||
sudo zpool set compression=on tank
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										696
									
								
								flake.lock
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										696
									
								
								flake.lock
									
									
									
										generated
									
									
									
								
							@@ -1,77 +1,45 @@
 | 
			
		||||
{
 | 
			
		||||
  "nodes": {
 | 
			
		||||
    "baleia-nvim-src": {
 | 
			
		||||
    "Comment-nvim-src": {
 | 
			
		||||
      "flake": false,
 | 
			
		||||
      "locked": {
 | 
			
		||||
        "lastModified": 1717182435,
 | 
			
		||||
        "narHash": "sha256-duI3myrJSvmtjF9n7NVrVOsuSo1O3JEypA5ghBHsULc=",
 | 
			
		||||
        "owner": "m00qek",
 | 
			
		||||
        "repo": "baleia.nvim",
 | 
			
		||||
        "rev": "4d3b27dbec65a44ceecd9306f605a980bcf4e9b1",
 | 
			
		||||
        "lastModified": 1674040818,
 | 
			
		||||
        "narHash": "sha256-7UtZAE9tPlnpeHS2LLol/LGVOxptDXNKWXHNHvFBNk4=",
 | 
			
		||||
        "owner": "numToStr",
 | 
			
		||||
        "repo": "Comment.nvim",
 | 
			
		||||
        "rev": "eab2c83a0207369900e92783f56990808082eac2",
 | 
			
		||||
        "type": "github"
 | 
			
		||||
      },
 | 
			
		||||
      "original": {
 | 
			
		||||
        "owner": "m00qek",
 | 
			
		||||
        "repo": "baleia.nvim",
 | 
			
		||||
        "type": "github"
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    "base16-nvim-src": {
 | 
			
		||||
      "flake": false,
 | 
			
		||||
      "locked": {
 | 
			
		||||
        "lastModified": 1716483968,
 | 
			
		||||
        "narHash": "sha256-GRF/6AobXHamw8TZ3FjL7SI6ulcpwpcohsIuZeCSh2A=",
 | 
			
		||||
        "owner": "RRethy",
 | 
			
		||||
        "repo": "base16-nvim",
 | 
			
		||||
        "rev": "6ac181b5733518040a33017dde654059cd771b7c",
 | 
			
		||||
        "type": "github"
 | 
			
		||||
      },
 | 
			
		||||
      "original": {
 | 
			
		||||
        "owner": "RRethy",
 | 
			
		||||
        "repo": "base16-nvim",
 | 
			
		||||
        "owner": "numToStr",
 | 
			
		||||
        "repo": "Comment.nvim",
 | 
			
		||||
        "type": "github"
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    "bufferline-nvim-src": {
 | 
			
		||||
      "flake": false,
 | 
			
		||||
      "locked": {
 | 
			
		||||
        "lastModified": 1716555412,
 | 
			
		||||
        "narHash": "sha256-8PCkY1zrlMrPGnQOb7MjqDXNlkeX46jrT4ScIL+MOwM=",
 | 
			
		||||
        "lastModified": 1676130961,
 | 
			
		||||
        "narHash": "sha256-3LT45i0eSMfUV9EBrtdtzHxFKRATIhRy/faDd3lI3mA=",
 | 
			
		||||
        "owner": "akinsho",
 | 
			
		||||
        "repo": "bufferline.nvim",
 | 
			
		||||
        "rev": "99337f63f0a3c3ab9519f3d1da7618ca4f91cffe",
 | 
			
		||||
        "rev": "84b0822b2af478d0b4f7b0f9249ca218855331db",
 | 
			
		||||
        "type": "github"
 | 
			
		||||
      },
 | 
			
		||||
      "original": {
 | 
			
		||||
        "owner": "akinsho",
 | 
			
		||||
        "ref": "v4.6.1",
 | 
			
		||||
        "repo": "bufferline.nvim",
 | 
			
		||||
        "type": "github"
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    "cl-nix-lite": {
 | 
			
		||||
      "locked": {
 | 
			
		||||
        "lastModified": 1717972076,
 | 
			
		||||
        "narHash": "sha256-hnZEsDInTcsVSL5LBGDAZegAxVLBus/wiJh+sNM15zU=",
 | 
			
		||||
        "owner": "hraban",
 | 
			
		||||
        "repo": "cl-nix-lite",
 | 
			
		||||
        "rev": "cc920bfb0a6402d3871f470c98d65266126973e4",
 | 
			
		||||
        "type": "github"
 | 
			
		||||
      },
 | 
			
		||||
      "original": {
 | 
			
		||||
        "owner": "hraban",
 | 
			
		||||
        "repo": "cl-nix-lite",
 | 
			
		||||
        "type": "github"
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    "cmp-nvim-lsp-src": {
 | 
			
		||||
      "flake": false,
 | 
			
		||||
      "locked": {
 | 
			
		||||
        "lastModified": 1715931395,
 | 
			
		||||
        "narHash": "sha256-CT1+Z4XJBVsl/RqvJeGmyitD6x7So0ylXvvef5jh7I8=",
 | 
			
		||||
        "lastModified": 1675708067,
 | 
			
		||||
        "narHash": "sha256-DxpcPTBlvVP88PDoTheLV2fC76EXDqS2UpM5mAfj/D4=",
 | 
			
		||||
        "owner": "hrsh7th",
 | 
			
		||||
        "repo": "cmp-nvim-lsp",
 | 
			
		||||
        "rev": "39e2eda76828d88b773cc27a3f61d2ad782c922d",
 | 
			
		||||
        "rev": "0e6b2ed705ddcff9738ec4ea838141654f12eeef",
 | 
			
		||||
        "type": "github"
 | 
			
		||||
      },
 | 
			
		||||
      "original": {
 | 
			
		||||
@@ -87,11 +55,11 @@
 | 
			
		||||
        ]
 | 
			
		||||
      },
 | 
			
		||||
      "locked": {
 | 
			
		||||
        "lastModified": 1719845423,
 | 
			
		||||
        "narHash": "sha256-ZLHDmWAsHQQKnmfyhYSHJDlt8Wfjv6SQhl2qek42O7A=",
 | 
			
		||||
        "lastModified": 1673295039,
 | 
			
		||||
        "narHash": "sha256-AsdYgE8/GPwcelGgrntlijMg4t3hLFJFCRF3tL5WVjA=",
 | 
			
		||||
        "owner": "lnl7",
 | 
			
		||||
        "repo": "nix-darwin",
 | 
			
		||||
        "rev": "ec12b88104d6c117871fad55e931addac4626756",
 | 
			
		||||
        "rev": "87b9d090ad39b25b2400029c64825fc2a8868943",
 | 
			
		||||
        "type": "github"
 | 
			
		||||
      },
 | 
			
		||||
      "original": {
 | 
			
		||||
@@ -108,11 +76,11 @@
 | 
			
		||||
        ]
 | 
			
		||||
      },
 | 
			
		||||
      "locked": {
 | 
			
		||||
        "lastModified": 1719864345,
 | 
			
		||||
        "narHash": "sha256-e4Pw+30vFAxuvkSTaTypd9zYemB/QlWcH186dsGT+Ms=",
 | 
			
		||||
        "lastModified": 1677116397,
 | 
			
		||||
        "narHash": "sha256-2OHwhv4k1SDEuNxhq+zluvrd5pbW8d4TP9NKW4B8iO8=",
 | 
			
		||||
        "owner": "nix-community",
 | 
			
		||||
        "repo": "disko",
 | 
			
		||||
        "rev": "544a80a69d6e2da04e4df7ec8210a858de8c7533",
 | 
			
		||||
        "rev": "8fddb2fd721365fa77ff68b709539639d4dc65d7",
 | 
			
		||||
        "type": "github"
 | 
			
		||||
      },
 | 
			
		||||
      "original": {
 | 
			
		||||
@@ -121,35 +89,16 @@
 | 
			
		||||
        "type": "github"
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    "fidget-nvim-src": {
 | 
			
		||||
      "flake": false,
 | 
			
		||||
      "locked": {
 | 
			
		||||
        "lastModified": 1716093309,
 | 
			
		||||
        "narHash": "sha256-Gpk/G0ByOAIE8uX4Xr94CvAjJBSJMEOwBuvrhmYYGsg=",
 | 
			
		||||
        "owner": "j-hui",
 | 
			
		||||
        "repo": "fidget.nvim",
 | 
			
		||||
        "rev": "ef99df04a1c53a453602421bc0f756997edc8289",
 | 
			
		||||
        "type": "github"
 | 
			
		||||
      },
 | 
			
		||||
      "original": {
 | 
			
		||||
        "owner": "j-hui",
 | 
			
		||||
        "ref": "v1.4.5",
 | 
			
		||||
        "repo": "fidget.nvim",
 | 
			
		||||
        "type": "github"
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    "firefox-darwin": {
 | 
			
		||||
      "inputs": {
 | 
			
		||||
        "nixpkgs": [
 | 
			
		||||
          "nixpkgs"
 | 
			
		||||
        ]
 | 
			
		||||
        "nixpkgs": "nixpkgs"
 | 
			
		||||
      },
 | 
			
		||||
      "locked": {
 | 
			
		||||
        "lastModified": 1719881223,
 | 
			
		||||
        "narHash": "sha256-9eaxGGPw7hIuZ4OaqOyKec262t+TCie0p83tlzkMEpc=",
 | 
			
		||||
        "lastModified": 1676854489,
 | 
			
		||||
        "narHash": "sha256-hWmx3JFLNPGMtflyjgEn5GZydbLW3msjXvarS1NsBDM=",
 | 
			
		||||
        "owner": "bandithedoge",
 | 
			
		||||
        "repo": "nixpkgs-firefox-darwin",
 | 
			
		||||
        "rev": "407f201936424ec061d33aa687e7978ae7873b5c",
 | 
			
		||||
        "rev": "6a5cca0ea8dfab4718e1e43e243c80ba110c2364",
 | 
			
		||||
        "type": "github"
 | 
			
		||||
      },
 | 
			
		||||
      "original": {
 | 
			
		||||
@@ -161,28 +110,11 @@
 | 
			
		||||
    "flake-compat": {
 | 
			
		||||
      "flake": false,
 | 
			
		||||
      "locked": {
 | 
			
		||||
        "lastModified": 1697816753,
 | 
			
		||||
        "narHash": "sha256-40to80AEIyKCQI0xMKCeF5ePoIKTYgjVVCZeu4CnTxM=",
 | 
			
		||||
        "owner": "hraban",
 | 
			
		||||
        "repo": "flake-compat",
 | 
			
		||||
        "rev": "6025bade1336a36014639bc3f67eacc853dab78f",
 | 
			
		||||
        "type": "github"
 | 
			
		||||
      },
 | 
			
		||||
      "original": {
 | 
			
		||||
        "owner": "hraban",
 | 
			
		||||
        "ref": "fixed-output",
 | 
			
		||||
        "repo": "flake-compat",
 | 
			
		||||
        "type": "github"
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    "flake-compat_2": {
 | 
			
		||||
      "flake": false,
 | 
			
		||||
      "locked": {
 | 
			
		||||
        "lastModified": 1696426674,
 | 
			
		||||
        "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
 | 
			
		||||
        "lastModified": 1673956053,
 | 
			
		||||
        "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=",
 | 
			
		||||
        "owner": "edolstra",
 | 
			
		||||
        "repo": "flake-compat",
 | 
			
		||||
        "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
 | 
			
		||||
        "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9",
 | 
			
		||||
        "type": "github"
 | 
			
		||||
      },
 | 
			
		||||
      "original": {
 | 
			
		||||
@@ -192,32 +124,27 @@
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    "flake-utils": {
 | 
			
		||||
      "inputs": {
 | 
			
		||||
        "systems": "systems"
 | 
			
		||||
      },
 | 
			
		||||
      "locked": {
 | 
			
		||||
        "lastModified": 1710146030,
 | 
			
		||||
        "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
 | 
			
		||||
        "lastModified": 1667395993,
 | 
			
		||||
        "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=",
 | 
			
		||||
        "owner": "numtide",
 | 
			
		||||
        "repo": "flake-utils",
 | 
			
		||||
        "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
 | 
			
		||||
        "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f",
 | 
			
		||||
        "type": "github"
 | 
			
		||||
      },
 | 
			
		||||
      "original": {
 | 
			
		||||
        "id": "flake-utils",
 | 
			
		||||
        "type": "indirect"
 | 
			
		||||
        "owner": "numtide",
 | 
			
		||||
        "repo": "flake-utils",
 | 
			
		||||
        "type": "github"
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    "flake-utils_2": {
 | 
			
		||||
      "inputs": {
 | 
			
		||||
        "systems": "systems_2"
 | 
			
		||||
      },
 | 
			
		||||
      "locked": {
 | 
			
		||||
        "lastModified": 1705309234,
 | 
			
		||||
        "narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=",
 | 
			
		||||
        "lastModified": 1659877975,
 | 
			
		||||
        "narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=",
 | 
			
		||||
        "owner": "numtide",
 | 
			
		||||
        "repo": "flake-utils",
 | 
			
		||||
        "rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26",
 | 
			
		||||
        "rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0",
 | 
			
		||||
        "type": "github"
 | 
			
		||||
      },
 | 
			
		||||
      "original": {
 | 
			
		||||
@@ -227,15 +154,12 @@
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    "flake-utils_3": {
 | 
			
		||||
      "inputs": {
 | 
			
		||||
        "systems": "systems_3"
 | 
			
		||||
      },
 | 
			
		||||
      "locked": {
 | 
			
		||||
        "lastModified": 1710146030,
 | 
			
		||||
        "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
 | 
			
		||||
        "lastModified": 1667395993,
 | 
			
		||||
        "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=",
 | 
			
		||||
        "owner": "numtide",
 | 
			
		||||
        "repo": "flake-utils",
 | 
			
		||||
        "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
 | 
			
		||||
        "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f",
 | 
			
		||||
        "type": "github"
 | 
			
		||||
      },
 | 
			
		||||
      "original": {
 | 
			
		||||
@@ -244,34 +168,19 @@
 | 
			
		||||
        "type": "github"
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    "hmts-nvim-src": {
 | 
			
		||||
      "flake": false,
 | 
			
		||||
      "locked": {
 | 
			
		||||
        "lastModified": 1715076655,
 | 
			
		||||
        "narHash": "sha256-vDTqJQzLyg0nmlC+CrLnPkYti1rPxmvRW8eQq/9Zg+M=",
 | 
			
		||||
        "owner": "calops",
 | 
			
		||||
        "repo": "hmts.nvim",
 | 
			
		||||
        "rev": "19a91816c123173a4551a6a04f2882338f20db1d",
 | 
			
		||||
        "type": "github"
 | 
			
		||||
      },
 | 
			
		||||
      "original": {
 | 
			
		||||
        "owner": "calops",
 | 
			
		||||
        "repo": "hmts.nvim",
 | 
			
		||||
        "type": "github"
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    "home-manager": {
 | 
			
		||||
      "inputs": {
 | 
			
		||||
        "nixpkgs": [
 | 
			
		||||
          "nixpkgs"
 | 
			
		||||
        ]
 | 
			
		||||
        ],
 | 
			
		||||
        "utils": "utils"
 | 
			
		||||
      },
 | 
			
		||||
      "locked": {
 | 
			
		||||
        "lastModified": 1719827439,
 | 
			
		||||
        "narHash": "sha256-tneHOIv1lEavZ0vQ+rgz67LPNCgOZVByYki3OkSshFU=",
 | 
			
		||||
        "lastModified": 1678271387,
 | 
			
		||||
        "narHash": "sha256-H2dv/i1LRlunRtrESirELzfPWdlG/6ElDB1ksO529H4=",
 | 
			
		||||
        "owner": "nix-community",
 | 
			
		||||
        "repo": "home-manager",
 | 
			
		||||
        "rev": "59ce796b2563e19821361abbe2067c3bb4143a7d",
 | 
			
		||||
        "rev": "36999b8d19eb6eebb41983ef017d7e0095316af2",
 | 
			
		||||
        "type": "github"
 | 
			
		||||
      },
 | 
			
		||||
      "original": {
 | 
			
		||||
@@ -281,97 +190,26 @@
 | 
			
		||||
        "type": "github"
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    "mac-app-util": {
 | 
			
		||||
    "nil": {
 | 
			
		||||
      "inputs": {
 | 
			
		||||
        "cl-nix-lite": "cl-nix-lite",
 | 
			
		||||
        "flake-compat": "flake-compat",
 | 
			
		||||
        "flake-utils": "flake-utils",
 | 
			
		||||
        "nixpkgs": [
 | 
			
		||||
          "nixpkgs"
 | 
			
		||||
        ]
 | 
			
		||||
        "nixpkgs": "nixpkgs_2",
 | 
			
		||||
        "rust-overlay": "rust-overlay"
 | 
			
		||||
      },
 | 
			
		||||
      "locked": {
 | 
			
		||||
        "lastModified": 1718893255,
 | 
			
		||||
        "narHash": "sha256-NdSDGdz5eU/EcnGn8ECP1V+mn5hyGOZQ4ybv2bWTpuk=",
 | 
			
		||||
        "owner": "hraban",
 | 
			
		||||
        "repo": "mac-app-util",
 | 
			
		||||
        "rev": "1857b26aceaf64c2b6a357eb83cf34139b6365cc",
 | 
			
		||||
        "lastModified": 1676110678,
 | 
			
		||||
        "narHash": "sha256-hemg8rMKS2me2Wua9ZG/0aQ8fEOfytjyKB+WYcXfEKE=",
 | 
			
		||||
        "owner": "oxalica",
 | 
			
		||||
        "repo": "nil",
 | 
			
		||||
        "rev": "ce2e0b5d60fe497134050796f7d12ffb6b50eb28",
 | 
			
		||||
        "type": "github"
 | 
			
		||||
      },
 | 
			
		||||
      "original": {
 | 
			
		||||
        "owner": "hraban",
 | 
			
		||||
        "repo": "mac-app-util",
 | 
			
		||||
        "owner": "oxalica",
 | 
			
		||||
        "repo": "nil",
 | 
			
		||||
        "type": "github"
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    "markview-nvim-src": {
 | 
			
		||||
      "flake": false,
 | 
			
		||||
      "locked": {
 | 
			
		||||
        "lastModified": 1719592662,
 | 
			
		||||
        "narHash": "sha256-E1lHSjbnOOIeieaFJ+INvxJHCbfVS3mwbQ6wrlKeGSQ=",
 | 
			
		||||
        "owner": "OXY2DEV",
 | 
			
		||||
        "repo": "markview.nvim",
 | 
			
		||||
        "rev": "f60219dce7283192d549f21847fcf8537bf6d260",
 | 
			
		||||
        "type": "github"
 | 
			
		||||
      },
 | 
			
		||||
      "original": {
 | 
			
		||||
        "owner": "OXY2DEV",
 | 
			
		||||
        "repo": "markview.nvim",
 | 
			
		||||
        "type": "github"
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    "nextcloud-cookbook": {
 | 
			
		||||
      "flake": false,
 | 
			
		||||
      "locked": {
 | 
			
		||||
        "lastModified": 1719431638,
 | 
			
		||||
        "narHash": "sha256-a8ekMnEzudHGiqHF53jPtgsVTOTc2QLuPg6YtTw5h68=",
 | 
			
		||||
        "type": "tarball",
 | 
			
		||||
        "url": "https://github.com/christianlupus-nextcloud/cookbook-releases/releases/download/v0.11.1/cookbook-0.11.1.tar.gz"
 | 
			
		||||
      },
 | 
			
		||||
      "original": {
 | 
			
		||||
        "type": "tarball",
 | 
			
		||||
        "url": "https://github.com/christianlupus-nextcloud/cookbook-releases/releases/download/v0.11.1/cookbook-0.11.1.tar.gz"
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    "nextcloud-external": {
 | 
			
		||||
      "flake": false,
 | 
			
		||||
      "locked": {
 | 
			
		||||
        "lastModified": 1710338675,
 | 
			
		||||
        "narHash": "sha256-bJJ/dVmE1o04QCyrxD0sko0okRsnxJmT6sOTOmBiifs=",
 | 
			
		||||
        "type": "tarball",
 | 
			
		||||
        "url": "https://github.com/nextcloud-releases/external/releases/download/v5.4.0/external-v5.4.0.tar.gz"
 | 
			
		||||
      },
 | 
			
		||||
      "original": {
 | 
			
		||||
        "type": "tarball",
 | 
			
		||||
        "url": "https://github.com/nextcloud-releases/external/releases/download/v5.4.0/external-v5.4.0.tar.gz"
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    "nextcloud-news": {
 | 
			
		||||
      "flake": false,
 | 
			
		||||
      "locked": {
 | 
			
		||||
        "lastModified": 1718102703,
 | 
			
		||||
        "narHash": "sha256-XNGjf7SWgJYFdVNOh3ED0jxSG0GJwWImVQq4cJT1Lo4=",
 | 
			
		||||
        "type": "tarball",
 | 
			
		||||
        "url": "https://github.com/nextcloud/news/releases/download/25.0.0-alpha7/news.tar.gz"
 | 
			
		||||
      },
 | 
			
		||||
      "original": {
 | 
			
		||||
        "type": "tarball",
 | 
			
		||||
        "url": "https://github.com/nextcloud/news/releases/download/25.0.0-alpha7/news.tar.gz"
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    "nextcloud-snappymail": {
 | 
			
		||||
      "flake": false,
 | 
			
		||||
      "locked": {
 | 
			
		||||
        "lastModified": 1720361351,
 | 
			
		||||
        "narHash": "sha256-HlqO7xlMSRGgBtwi0t5oz5v7iw0zTSHysc9wGVRwGZI=",
 | 
			
		||||
        "type": "tarball",
 | 
			
		||||
        "url": "https://snappymail.eu/repository/nextcloud/snappymail-2.36.4-nextcloud.tar.gz"
 | 
			
		||||
      },
 | 
			
		||||
      "original": {
 | 
			
		||||
        "type": "tarball",
 | 
			
		||||
        "url": "https://snappymail.eu/repository/nextcloud/snappymail-2.36.4-nextcloud.tar.gz"
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    "nix2vim": {
 | 
			
		||||
      "inputs": {
 | 
			
		||||
        "flake-utils": "flake-utils_2",
 | 
			
		||||
@@ -380,11 +218,11 @@
 | 
			
		||||
        ]
 | 
			
		||||
      },
 | 
			
		||||
      "locked": {
 | 
			
		||||
        "lastModified": 1718621825,
 | 
			
		||||
        "narHash": "sha256-bSfjwRgKKpLyjEDPRAF1hlJKc7QDoqopalHwNCB/eAA=",
 | 
			
		||||
        "lastModified": 1673891598,
 | 
			
		||||
        "narHash": "sha256-EevceKxQtA+I0XVA8tBGKmYV1V1KbWc3gsswysMzeDk=",
 | 
			
		||||
        "owner": "gytis-ivaskevicius",
 | 
			
		||||
        "repo": "nix2vim",
 | 
			
		||||
        "rev": "1db11dbf8a4d124e02244fa5c4ff219b672a8e5b",
 | 
			
		||||
        "rev": "5b31eb81e2c6c74f9e8a4911660f3bf585d55158",
 | 
			
		||||
        "type": "github"
 | 
			
		||||
      },
 | 
			
		||||
      "original": {
 | 
			
		||||
@@ -395,11 +233,11 @@
 | 
			
		||||
    },
 | 
			
		||||
    "nixlib": {
 | 
			
		||||
      "locked": {
 | 
			
		||||
        "lastModified": 1719708727,
 | 
			
		||||
        "narHash": "sha256-XFNKtyirrGNdehpg7lMNm1skEcBApjqGhaHc/OI95HY=",
 | 
			
		||||
        "lastModified": 1636849918,
 | 
			
		||||
        "narHash": "sha256-nzUK6dPcTmNVrgTAC1EOybSMsrcx+QrVPyqRdyKLkjA=",
 | 
			
		||||
        "owner": "nix-community",
 | 
			
		||||
        "repo": "nixpkgs.lib",
 | 
			
		||||
        "rev": "1bba8a624b3b9d4f68db94fb63aaeb46039ce9e6",
 | 
			
		||||
        "rev": "28a5b0557f14124608db68d3ee1f77e9329e9dd5",
 | 
			
		||||
        "type": "github"
 | 
			
		||||
      },
 | 
			
		||||
      "original": {
 | 
			
		||||
@@ -416,11 +254,11 @@
 | 
			
		||||
        ]
 | 
			
		||||
      },
 | 
			
		||||
      "locked": {
 | 
			
		||||
        "lastModified": 1719841141,
 | 
			
		||||
        "narHash": "sha256-WOyohxFJJdfDvEB7N3eTcX44lNU2rZes1inHsyHL7mM=",
 | 
			
		||||
        "lastModified": 1674666581,
 | 
			
		||||
        "narHash": "sha256-KNI2s/xrL7WOYaPJAWKBtb7cCH3335rLfsL+B+ssuGY=",
 | 
			
		||||
        "owner": "nix-community",
 | 
			
		||||
        "repo": "nixos-generators",
 | 
			
		||||
        "rev": "140dcc2b9a0eb87ba5e9011076a1a7af19179ab1",
 | 
			
		||||
        "rev": "6a5dc1d3d557ea7b5c19b15ff91955124d0400fa",
 | 
			
		||||
        "type": "github"
 | 
			
		||||
      },
 | 
			
		||||
      "original": {
 | 
			
		||||
@@ -431,11 +269,43 @@
 | 
			
		||||
    },
 | 
			
		||||
    "nixpkgs": {
 | 
			
		||||
      "locked": {
 | 
			
		||||
        "lastModified": 1719848872,
 | 
			
		||||
        "narHash": "sha256-H3+EC5cYuq+gQW8y0lSrrDZfH71LB4DAf+TDFyvwCNA=",
 | 
			
		||||
        "lastModified": 1639237670,
 | 
			
		||||
        "narHash": "sha256-RTdL4rEQcgaZGpvtDgkp3oK/V+1LM3I53n0ACPSroAQ=",
 | 
			
		||||
        "owner": "NixOS",
 | 
			
		||||
        "repo": "nixpkgs",
 | 
			
		||||
        "rev": "edfb969386ebe6c3cf8f878775a7975cd88f926d",
 | 
			
		||||
        "type": "github"
 | 
			
		||||
      },
 | 
			
		||||
      "original": {
 | 
			
		||||
        "owner": "NixOS",
 | 
			
		||||
        "ref": "master",
 | 
			
		||||
        "repo": "nixpkgs",
 | 
			
		||||
        "type": "github"
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    "nixpkgs_2": {
 | 
			
		||||
      "locked": {
 | 
			
		||||
        "lastModified": 1675309347,
 | 
			
		||||
        "narHash": "sha256-D3CQ6HRDT2m3XJlrzb5jKq4vNFR5xFTEFKC7iSjlFpM=",
 | 
			
		||||
        "owner": "nixos",
 | 
			
		||||
        "repo": "nixpkgs",
 | 
			
		||||
        "rev": "00d80d13810dbfea8ab4ed1009b09100cca86ba8",
 | 
			
		||||
        "rev": "006c3bd4dd2f5d1d2094047f307cbf9e2b73d9c5",
 | 
			
		||||
        "type": "github"
 | 
			
		||||
      },
 | 
			
		||||
      "original": {
 | 
			
		||||
        "owner": "nixos",
 | 
			
		||||
        "ref": "nixpkgs-unstable",
 | 
			
		||||
        "repo": "nixpkgs",
 | 
			
		||||
        "type": "github"
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    "nixpkgs_3": {
 | 
			
		||||
      "locked": {
 | 
			
		||||
        "lastModified": 1676885936,
 | 
			
		||||
        "narHash": "sha256-ZRKb6zBfTvdCOXI7nGC1L9UWSU5ay2ltxg+f5UIzBOU=",
 | 
			
		||||
        "owner": "nixos",
 | 
			
		||||
        "repo": "nixpkgs",
 | 
			
		||||
        "rev": "b69883faca9542d135fa6bab7928ff1b233c167f",
 | 
			
		||||
        "type": "github"
 | 
			
		||||
      },
 | 
			
		||||
      "original": {
 | 
			
		||||
@@ -445,29 +315,45 @@
 | 
			
		||||
        "type": "github"
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    "nixpkgs-caddy": {
 | 
			
		||||
    "nixpkgs_4": {
 | 
			
		||||
      "locked": {
 | 
			
		||||
        "lastModified": 1699107987,
 | 
			
		||||
        "narHash": "sha256-nWXETr4Oqy/vOfzgWyMY04qzEN2iREFJc5ycQ3XNu0A=",
 | 
			
		||||
        "owner": "jpds",
 | 
			
		||||
        "lastModified": 1674868155,
 | 
			
		||||
        "narHash": "sha256-eFNm2h6fNbgD7ZpO4MHikCB5pSnCJ7DTmwPisjetmwc=",
 | 
			
		||||
        "owner": "NixOS",
 | 
			
		||||
        "repo": "nixpkgs",
 | 
			
		||||
        "rev": "a33b02fa9d664f31dadc8a874eb1a5dbaa9f4ecf",
 | 
			
		||||
        "rev": "ce20e9ebe1903ea2ba1ab006ec63093020c761cb",
 | 
			
		||||
        "type": "github"
 | 
			
		||||
      },
 | 
			
		||||
      "original": {
 | 
			
		||||
        "owner": "jpds",
 | 
			
		||||
        "ref": "caddy-external-plugins",
 | 
			
		||||
        "owner": "NixOS",
 | 
			
		||||
        "ref": "nixos-22.11",
 | 
			
		||||
        "repo": "nixpkgs",
 | 
			
		||||
        "type": "github"
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    "null-ls-nvim-src": {
 | 
			
		||||
      "flake": false,
 | 
			
		||||
      "locked": {
 | 
			
		||||
        "lastModified": 1676246878,
 | 
			
		||||
        "narHash": "sha256-hAUEa2zNsYXQ+TsHYHBzcW67lCxhiD7x+uPbdOZwY8o=",
 | 
			
		||||
        "owner": "jose-elias-alvarez",
 | 
			
		||||
        "repo": "null-ls.nvim",
 | 
			
		||||
        "rev": "d4594231a06cecce73a78a256b0d7c7ab51f7dd5",
 | 
			
		||||
        "type": "github"
 | 
			
		||||
      },
 | 
			
		||||
      "original": {
 | 
			
		||||
        "owner": "jose-elias-alvarez",
 | 
			
		||||
        "repo": "null-ls.nvim",
 | 
			
		||||
        "type": "github"
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    "nur": {
 | 
			
		||||
      "locked": {
 | 
			
		||||
        "lastModified": 1719925604,
 | 
			
		||||
        "narHash": "sha256-cLmqi+P1sn+7497GS4fNWayoTDa0ZiJecjmEM4iQN9U=",
 | 
			
		||||
        "lastModified": 1676251563,
 | 
			
		||||
        "narHash": "sha256-itLKR2Haeh5wQ6dxkuZ8L5gwp3+CAggpN+w2e7cLQPg=",
 | 
			
		||||
        "owner": "nix-community",
 | 
			
		||||
        "repo": "nur",
 | 
			
		||||
        "rev": "574405811547dcec59e912c5e82bfd224648bd5e",
 | 
			
		||||
        "rev": "9a8b28a9d6611f6af9f7abb3e690fc755d6906fe",
 | 
			
		||||
        "type": "github"
 | 
			
		||||
      },
 | 
			
		||||
      "original": {
 | 
			
		||||
@@ -476,35 +362,18 @@
 | 
			
		||||
        "type": "github"
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    "nvim-lint-src": {
 | 
			
		||||
      "flake": false,
 | 
			
		||||
      "locked": {
 | 
			
		||||
        "lastModified": 1719415114,
 | 
			
		||||
        "narHash": "sha256-a9Mfoi1NzQ3b1w1VUqqJZddyCZYyacRnc128t5X3Wb0=",
 | 
			
		||||
        "owner": "mfussenegger",
 | 
			
		||||
        "repo": "nvim-lint",
 | 
			
		||||
        "rev": "efc6fc83f0772283e064c53a8f9fb5645bde0bc0",
 | 
			
		||||
        "type": "github"
 | 
			
		||||
      },
 | 
			
		||||
      "original": {
 | 
			
		||||
        "owner": "mfussenegger",
 | 
			
		||||
        "repo": "nvim-lint",
 | 
			
		||||
        "type": "github"
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    "nvim-lspconfig-src": {
 | 
			
		||||
      "flake": false,
 | 
			
		||||
      "locked": {
 | 
			
		||||
        "lastModified": 1716281382,
 | 
			
		||||
        "narHash": "sha256-foJ7a59N0a3QaBW24PtwbyYDQVlIsFxiatADLO/hQvc=",
 | 
			
		||||
        "lastModified": 1676175675,
 | 
			
		||||
        "narHash": "sha256-Wg3NatT4DRBMF6hCxK4C2DC+geFMpfFUFogPbqeMt6E=",
 | 
			
		||||
        "owner": "neovim",
 | 
			
		||||
        "repo": "nvim-lspconfig",
 | 
			
		||||
        "rev": "0b8165cf95806bc4bb8f745bb0c92021b2ed4b98",
 | 
			
		||||
        "rev": "1712672e4da3003a0dd9f771d30389600b360f42",
 | 
			
		||||
        "type": "github"
 | 
			
		||||
      },
 | 
			
		||||
      "original": {
 | 
			
		||||
        "owner": "neovim",
 | 
			
		||||
        "ref": "v0.1.8",
 | 
			
		||||
        "repo": "nvim-lspconfig",
 | 
			
		||||
        "type": "github"
 | 
			
		||||
      }
 | 
			
		||||
@@ -512,11 +381,11 @@
 | 
			
		||||
    "nvim-tree-lua-src": {
 | 
			
		||||
      "flake": false,
 | 
			
		||||
      "locked": {
 | 
			
		||||
        "lastModified": 1719107085,
 | 
			
		||||
        "narHash": "sha256-RfrbxYD7RYBEy/grSYnKKkWd4BHxGYEFeLiDB5OYGpg=",
 | 
			
		||||
        "lastModified": 1676244722,
 | 
			
		||||
        "narHash": "sha256-xoSekdZhWr59qTOM0/ihYiuKiwHiKYb42Ep5JHn65UM=",
 | 
			
		||||
        "owner": "kyazdani42",
 | 
			
		||||
        "repo": "nvim-tree.lua",
 | 
			
		||||
        "rev": "8b2c5c678be4b49dff6a2df794877000113fd77b",
 | 
			
		||||
        "rev": "ba1778e061f25814bc5940be886a7f41d7d7736e",
 | 
			
		||||
        "type": "github"
 | 
			
		||||
      },
 | 
			
		||||
      "original": {
 | 
			
		||||
@@ -528,171 +397,81 @@
 | 
			
		||||
    "nvim-treesitter-src": {
 | 
			
		||||
      "flake": false,
 | 
			
		||||
      "locked": {
 | 
			
		||||
        "lastModified": 1719904131,
 | 
			
		||||
        "narHash": "sha256-RbTBilXbgMFfwkbIyLMZuZw1DyzDol7g0V6uu4MaEh0=",
 | 
			
		||||
        "lastModified": 1676240774,
 | 
			
		||||
        "narHash": "sha256-eRSU/9ysSvTyYxBrp9Whg0eXgAOsCdmIHMlYZK7bjRg=",
 | 
			
		||||
        "owner": "nvim-treesitter",
 | 
			
		||||
        "repo": "nvim-treesitter",
 | 
			
		||||
        "rev": "e0d6c7643dc953acc2e817d0cebfc2f1f8c008e1",
 | 
			
		||||
        "rev": "7eb5f1a2e3949496f26c4084b521b30f2d08137a",
 | 
			
		||||
        "type": "github"
 | 
			
		||||
      },
 | 
			
		||||
      "original": {
 | 
			
		||||
        "owner": "nvim-treesitter",
 | 
			
		||||
        "ref": "master",
 | 
			
		||||
        "repo": "nvim-treesitter",
 | 
			
		||||
        "type": "github"
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    "ren": {
 | 
			
		||||
      "flake": false,
 | 
			
		||||
      "locked": {
 | 
			
		||||
        "lastModified": 1704996573,
 | 
			
		||||
        "narHash": "sha256-zVIt6Xp+Mvym6gySvHIZJt1QgzKVP/wbTGTubWk6kzI=",
 | 
			
		||||
        "owner": "robenkleene",
 | 
			
		||||
        "repo": "ren-find",
 | 
			
		||||
        "rev": "50c40172e354caffee48932266edd7c7a76a20fd",
 | 
			
		||||
        "type": "github"
 | 
			
		||||
      },
 | 
			
		||||
      "original": {
 | 
			
		||||
        "owner": "robenkleene",
 | 
			
		||||
        "repo": "ren-find",
 | 
			
		||||
        "type": "github"
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    "rep": {
 | 
			
		||||
      "flake": false,
 | 
			
		||||
      "locked": {
 | 
			
		||||
        "lastModified": 1707216692,
 | 
			
		||||
        "narHash": "sha256-/dH+mNtNHaYFndVhoqmz4Sc3HeemoQt1HGD98mb9Qhw=",
 | 
			
		||||
        "owner": "robenkleene",
 | 
			
		||||
        "repo": "rep-grep",
 | 
			
		||||
        "rev": "10510d47e392cb9d30a861c69f702fd194b3fa88",
 | 
			
		||||
        "type": "github"
 | 
			
		||||
      },
 | 
			
		||||
      "original": {
 | 
			
		||||
        "owner": "robenkleene",
 | 
			
		||||
        "repo": "rep-grep",
 | 
			
		||||
        "type": "github"
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    "root": {
 | 
			
		||||
      "inputs": {
 | 
			
		||||
        "baleia-nvim-src": "baleia-nvim-src",
 | 
			
		||||
        "base16-nvim-src": "base16-nvim-src",
 | 
			
		||||
        "Comment-nvim-src": "Comment-nvim-src",
 | 
			
		||||
        "bufferline-nvim-src": "bufferline-nvim-src",
 | 
			
		||||
        "cmp-nvim-lsp-src": "cmp-nvim-lsp-src",
 | 
			
		||||
        "darwin": "darwin",
 | 
			
		||||
        "disko": "disko",
 | 
			
		||||
        "fidget-nvim-src": "fidget-nvim-src",
 | 
			
		||||
        "firefox-darwin": "firefox-darwin",
 | 
			
		||||
        "hmts-nvim-src": "hmts-nvim-src",
 | 
			
		||||
        "home-manager": "home-manager",
 | 
			
		||||
        "mac-app-util": "mac-app-util",
 | 
			
		||||
        "markview-nvim-src": "markview-nvim-src",
 | 
			
		||||
        "nextcloud-cookbook": "nextcloud-cookbook",
 | 
			
		||||
        "nextcloud-external": "nextcloud-external",
 | 
			
		||||
        "nextcloud-news": "nextcloud-news",
 | 
			
		||||
        "nextcloud-snappymail": "nextcloud-snappymail",
 | 
			
		||||
        "nil": "nil",
 | 
			
		||||
        "nix2vim": "nix2vim",
 | 
			
		||||
        "nixos-generators": "nixos-generators",
 | 
			
		||||
        "nixpkgs": "nixpkgs",
 | 
			
		||||
        "nixpkgs-caddy": "nixpkgs-caddy",
 | 
			
		||||
        "nixpkgs": "nixpkgs_3",
 | 
			
		||||
        "null-ls-nvim-src": "null-ls-nvim-src",
 | 
			
		||||
        "nur": "nur",
 | 
			
		||||
        "nvim-lint-src": "nvim-lint-src",
 | 
			
		||||
        "nvim-lspconfig-src": "nvim-lspconfig-src",
 | 
			
		||||
        "nvim-tree-lua-src": "nvim-tree-lua-src",
 | 
			
		||||
        "nvim-treesitter-src": "nvim-treesitter-src",
 | 
			
		||||
        "ren": "ren",
 | 
			
		||||
        "rep": "rep",
 | 
			
		||||
        "stu": "stu",
 | 
			
		||||
        "telescope-nvim-src": "telescope-nvim-src",
 | 
			
		||||
        "telescope-project-nvim-src": "telescope-project-nvim-src",
 | 
			
		||||
        "toggleterm-nvim-src": "toggleterm-nvim-src",
 | 
			
		||||
        "tree-sitter-bash": "tree-sitter-bash",
 | 
			
		||||
        "tree-sitter-ini": "tree-sitter-ini",
 | 
			
		||||
        "tree-sitter-lua": "tree-sitter-lua",
 | 
			
		||||
        "tree-sitter-puppet": "tree-sitter-puppet",
 | 
			
		||||
        "tree-sitter-python": "tree-sitter-python",
 | 
			
		||||
        "tree-sitter-rasi": "tree-sitter-rasi",
 | 
			
		||||
        "tree-sitter-vimdoc": "tree-sitter-vimdoc",
 | 
			
		||||
        "wallpapers": "wallpapers",
 | 
			
		||||
        "wsl": "wsl",
 | 
			
		||||
        "zenyd-mpv-scripts": "zenyd-mpv-scripts"
 | 
			
		||||
        "wsl": "wsl"
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    "stu": {
 | 
			
		||||
      "flake": false,
 | 
			
		||||
    "rust-overlay": {
 | 
			
		||||
      "inputs": {
 | 
			
		||||
        "flake-utils": [
 | 
			
		||||
          "nil",
 | 
			
		||||
          "flake-utils"
 | 
			
		||||
        ],
 | 
			
		||||
        "nixpkgs": [
 | 
			
		||||
          "nil",
 | 
			
		||||
          "nixpkgs"
 | 
			
		||||
        ]
 | 
			
		||||
      },
 | 
			
		||||
      "locked": {
 | 
			
		||||
        "lastModified": 1720424134,
 | 
			
		||||
        "narHash": "sha256-c6nLQOhwztwnUfKLx69Le9pCHE0GtruqKMnvYpGyr+0=",
 | 
			
		||||
        "owner": "lusingander",
 | 
			
		||||
        "repo": "stu",
 | 
			
		||||
        "rev": "279edc8d63c04b42773434bf8c6f2744a66d71a8",
 | 
			
		||||
        "lastModified": 1675391458,
 | 
			
		||||
        "narHash": "sha256-ukDKZw922BnK5ohL9LhwtaDAdCsJL7L6ScNEyF1lO9w=",
 | 
			
		||||
        "owner": "oxalica",
 | 
			
		||||
        "repo": "rust-overlay",
 | 
			
		||||
        "rev": "383a4acfd11d778d5c2efcf28376cbd845eeaedf",
 | 
			
		||||
        "type": "github"
 | 
			
		||||
      },
 | 
			
		||||
      "original": {
 | 
			
		||||
        "owner": "lusingander",
 | 
			
		||||
        "repo": "stu",
 | 
			
		||||
        "type": "github"
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    "systems": {
 | 
			
		||||
      "locked": {
 | 
			
		||||
        "lastModified": 1681028828,
 | 
			
		||||
        "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
 | 
			
		||||
        "owner": "nix-systems",
 | 
			
		||||
        "repo": "default",
 | 
			
		||||
        "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
 | 
			
		||||
        "type": "github"
 | 
			
		||||
      },
 | 
			
		||||
      "original": {
 | 
			
		||||
        "owner": "nix-systems",
 | 
			
		||||
        "repo": "default",
 | 
			
		||||
        "type": "github"
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    "systems_2": {
 | 
			
		||||
      "locked": {
 | 
			
		||||
        "lastModified": 1681028828,
 | 
			
		||||
        "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
 | 
			
		||||
        "owner": "nix-systems",
 | 
			
		||||
        "repo": "default",
 | 
			
		||||
        "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
 | 
			
		||||
        "type": "github"
 | 
			
		||||
      },
 | 
			
		||||
      "original": {
 | 
			
		||||
        "owner": "nix-systems",
 | 
			
		||||
        "repo": "default",
 | 
			
		||||
        "type": "github"
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    "systems_3": {
 | 
			
		||||
      "locked": {
 | 
			
		||||
        "lastModified": 1681028828,
 | 
			
		||||
        "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
 | 
			
		||||
        "owner": "nix-systems",
 | 
			
		||||
        "repo": "default",
 | 
			
		||||
        "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
 | 
			
		||||
        "type": "github"
 | 
			
		||||
      },
 | 
			
		||||
      "original": {
 | 
			
		||||
        "owner": "nix-systems",
 | 
			
		||||
        "repo": "default",
 | 
			
		||||
        "owner": "oxalica",
 | 
			
		||||
        "repo": "rust-overlay",
 | 
			
		||||
        "type": "github"
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    "telescope-nvim-src": {
 | 
			
		||||
      "flake": false,
 | 
			
		||||
      "locked": {
 | 
			
		||||
        "lastModified": 1716532947,
 | 
			
		||||
        "narHash": "sha256-e1ulhc4IIvUgpjKQrSqPY4WpXuez6wlxL6Min9U0o5Q=",
 | 
			
		||||
        "lastModified": 1675149856,
 | 
			
		||||
        "narHash": "sha256-L4Kw94CUy6N7zcyy9INuR/O0fxQ7sp0IvGd/u7fHxMA=",
 | 
			
		||||
        "owner": "nvim-telescope",
 | 
			
		||||
        "repo": "telescope.nvim",
 | 
			
		||||
        "rev": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026",
 | 
			
		||||
        "rev": "203bf5609137600d73e8ed82703d6b0e320a5f36",
 | 
			
		||||
        "type": "github"
 | 
			
		||||
      },
 | 
			
		||||
      "original": {
 | 
			
		||||
        "owner": "nvim-telescope",
 | 
			
		||||
        "ref": "0.1.8",
 | 
			
		||||
        "repo": "telescope.nvim",
 | 
			
		||||
        "type": "github"
 | 
			
		||||
      }
 | 
			
		||||
@@ -700,11 +479,11 @@
 | 
			
		||||
    "telescope-project-nvim-src": {
 | 
			
		||||
      "flake": false,
 | 
			
		||||
      "locked": {
 | 
			
		||||
        "lastModified": 1701464478,
 | 
			
		||||
        "narHash": "sha256-touMCltcnqkrQYV1NtNeWLQeFVGt+WM3aIWIdKilA7w=",
 | 
			
		||||
        "lastModified": 1671805267,
 | 
			
		||||
        "narHash": "sha256-S4SOHzQ17ux5pcwwYFpVVLzjLeC4/EJ0IFPbrfzUJC8=",
 | 
			
		||||
        "owner": "nvim-telescope",
 | 
			
		||||
        "repo": "telescope-project.nvim",
 | 
			
		||||
        "rev": "1aaf16580a614601a7f7077d9639aeb457dc5559",
 | 
			
		||||
        "rev": "8e8ee37b7210761502cdf2c3a82b5ba8fb5b2972",
 | 
			
		||||
        "type": "github"
 | 
			
		||||
      },
 | 
			
		||||
      "original": {
 | 
			
		||||
@@ -716,132 +495,31 @@
 | 
			
		||||
    "toggleterm-nvim-src": {
 | 
			
		||||
      "flake": false,
 | 
			
		||||
      "locked": {
 | 
			
		||||
        "lastModified": 1713792255,
 | 
			
		||||
        "narHash": "sha256-mM5bGgAemsRJD9U6U5K6ia5qb8NaTusM99x6xrtEBfw=",
 | 
			
		||||
        "lastModified": 1675358836,
 | 
			
		||||
        "narHash": "sha256-9O7p/7tRStg51OFhMc88M5ewYquiYC9x9CV4s5veVP8=",
 | 
			
		||||
        "owner": "akinsho",
 | 
			
		||||
        "repo": "toggleterm.nvim",
 | 
			
		||||
        "rev": "066cccf48a43553a80a210eb3be89a15d789d6e6",
 | 
			
		||||
        "rev": "19aad0f41f47affbba1274f05e3c067e6d718e1e",
 | 
			
		||||
        "type": "github"
 | 
			
		||||
      },
 | 
			
		||||
      "original": {
 | 
			
		||||
        "owner": "akinsho",
 | 
			
		||||
        "ref": "v2.11.0",
 | 
			
		||||
        "repo": "toggleterm.nvim",
 | 
			
		||||
        "type": "github"
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    "tree-sitter-bash": {
 | 
			
		||||
      "flake": false,
 | 
			
		||||
    "utils": {
 | 
			
		||||
      "locked": {
 | 
			
		||||
        "lastModified": 1715005250,
 | 
			
		||||
        "narHash": "sha256-rCuQbnQAOnQWKYreNH80nlL+0A1qbWbjMvtczcoWPrY=",
 | 
			
		||||
        "owner": "tree-sitter",
 | 
			
		||||
        "repo": "tree-sitter-bash",
 | 
			
		||||
        "rev": "2fbd860f802802ca76a6661ce025b3a3bca2d3ed",
 | 
			
		||||
        "lastModified": 1676283394,
 | 
			
		||||
        "narHash": "sha256-XX2f9c3iySLCw54rJ/CZs+ZK6IQy7GXNY4nSOyu2QG4=",
 | 
			
		||||
        "owner": "numtide",
 | 
			
		||||
        "repo": "flake-utils",
 | 
			
		||||
        "rev": "3db36a8b464d0c4532ba1c7dda728f4576d6d073",
 | 
			
		||||
        "type": "github"
 | 
			
		||||
      },
 | 
			
		||||
      "original": {
 | 
			
		||||
        "owner": "tree-sitter",
 | 
			
		||||
        "ref": "master",
 | 
			
		||||
        "repo": "tree-sitter-bash",
 | 
			
		||||
        "type": "github"
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    "tree-sitter-ini": {
 | 
			
		||||
      "flake": false,
 | 
			
		||||
      "locked": {
 | 
			
		||||
        "lastModified": 1716889525,
 | 
			
		||||
        "narHash": "sha256-IyHrIxcmuzs60zUiJv4E3nSkhSkgbcaLDUdeDx5mlHk=",
 | 
			
		||||
        "owner": "justinmk",
 | 
			
		||||
        "repo": "tree-sitter-ini",
 | 
			
		||||
        "rev": "87176e524f0a98f5be75fa44f4f0ff5c6eac069c",
 | 
			
		||||
        "type": "github"
 | 
			
		||||
      },
 | 
			
		||||
      "original": {
 | 
			
		||||
        "owner": "justinmk",
 | 
			
		||||
        "repo": "tree-sitter-ini",
 | 
			
		||||
        "type": "github"
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    "tree-sitter-lua": {
 | 
			
		||||
      "flake": false,
 | 
			
		||||
      "locked": {
 | 
			
		||||
        "lastModified": 1710150044,
 | 
			
		||||
        "narHash": "sha256-uFaEptW4wPrqgHfB1mYmVltf+4no61L2cPgpsr5qBIU=",
 | 
			
		||||
        "owner": "MunifTanjim",
 | 
			
		||||
        "repo": "tree-sitter-lua",
 | 
			
		||||
        "rev": "a24dab177e58c9c6832f96b9a73102a0cfbced4a",
 | 
			
		||||
        "type": "github"
 | 
			
		||||
      },
 | 
			
		||||
      "original": {
 | 
			
		||||
        "owner": "MunifTanjim",
 | 
			
		||||
        "ref": "main",
 | 
			
		||||
        "repo": "tree-sitter-lua",
 | 
			
		||||
        "type": "github"
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    "tree-sitter-puppet": {
 | 
			
		||||
      "flake": false,
 | 
			
		||||
      "locked": {
 | 
			
		||||
        "lastModified": 1713617121,
 | 
			
		||||
        "narHash": "sha256-+zMgzyuGerJ8l+i5ZtWnmGr3i4fFiSLD5FssyKESsmI=",
 | 
			
		||||
        "owner": "amaanq",
 | 
			
		||||
        "repo": "tree-sitter-puppet",
 | 
			
		||||
        "rev": "584522f32495d648b18a53ccb52d988e60de127d",
 | 
			
		||||
        "type": "github"
 | 
			
		||||
      },
 | 
			
		||||
      "original": {
 | 
			
		||||
        "owner": "amaanq",
 | 
			
		||||
        "repo": "tree-sitter-puppet",
 | 
			
		||||
        "type": "github"
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    "tree-sitter-python": {
 | 
			
		||||
      "flake": false,
 | 
			
		||||
      "locked": {
 | 
			
		||||
        "lastModified": 1714528221,
 | 
			
		||||
        "narHash": "sha256-hHQ5gK4dTRSdp0fLKarytU9vFhsBeQp7Ka61vFoIr7Y=",
 | 
			
		||||
        "owner": "tree-sitter",
 | 
			
		||||
        "repo": "tree-sitter-python",
 | 
			
		||||
        "rev": "71778c2a472ed00a64abf4219544edbf8e4b86d7",
 | 
			
		||||
        "type": "github"
 | 
			
		||||
      },
 | 
			
		||||
      "original": {
 | 
			
		||||
        "owner": "tree-sitter",
 | 
			
		||||
        "ref": "master",
 | 
			
		||||
        "repo": "tree-sitter-python",
 | 
			
		||||
        "type": "github"
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    "tree-sitter-rasi": {
 | 
			
		||||
      "flake": false,
 | 
			
		||||
      "locked": {
 | 
			
		||||
        "lastModified": 1716296585,
 | 
			
		||||
        "narHash": "sha256-sPrIVgGGaBaXeqHNxjcdJ/S2FvxyV6rD9UPKU/tpspw=",
 | 
			
		||||
        "owner": "Fymyte",
 | 
			
		||||
        "repo": "tree-sitter-rasi",
 | 
			
		||||
        "rev": "6c9bbcfdf5f0f553d9ebc01750a3aa247a37b8aa",
 | 
			
		||||
        "type": "github"
 | 
			
		||||
      },
 | 
			
		||||
      "original": {
 | 
			
		||||
        "owner": "Fymyte",
 | 
			
		||||
        "repo": "tree-sitter-rasi",
 | 
			
		||||
        "type": "github"
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    "tree-sitter-vimdoc": {
 | 
			
		||||
      "flake": false,
 | 
			
		||||
      "locked": {
 | 
			
		||||
        "lastModified": 1717834376,
 | 
			
		||||
        "narHash": "sha256-v+XSWGm2Wdn9/rxNFMqXYACkGn6AvxZdxkClLuKnWGU=",
 | 
			
		||||
        "owner": "neovim",
 | 
			
		||||
        "repo": "tree-sitter-vimdoc",
 | 
			
		||||
        "rev": "2249c44ecd3f5cf22da3dcccfb74f816ddb29245",
 | 
			
		||||
        "type": "github"
 | 
			
		||||
      },
 | 
			
		||||
      "original": {
 | 
			
		||||
        "owner": "neovim",
 | 
			
		||||
        "repo": "tree-sitter-vimdoc",
 | 
			
		||||
        "owner": "numtide",
 | 
			
		||||
        "repo": "flake-utils",
 | 
			
		||||
        "type": "github"
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
@@ -863,18 +541,16 @@
 | 
			
		||||
    },
 | 
			
		||||
    "wsl": {
 | 
			
		||||
      "inputs": {
 | 
			
		||||
        "flake-compat": "flake-compat_2",
 | 
			
		||||
        "flake-compat": "flake-compat",
 | 
			
		||||
        "flake-utils": "flake-utils_3",
 | 
			
		||||
        "nixpkgs": [
 | 
			
		||||
          "nixpkgs"
 | 
			
		||||
        ]
 | 
			
		||||
        "nixpkgs": "nixpkgs_4"
 | 
			
		||||
      },
 | 
			
		||||
      "locked": {
 | 
			
		||||
        "lastModified": 1719220171,
 | 
			
		||||
        "narHash": "sha256-xywM6JoGT8AwfoOFJBTv8GRlvNu8LYqqqMS/OQ6uCgE=",
 | 
			
		||||
        "lastModified": 1676126384,
 | 
			
		||||
        "narHash": "sha256-3aAnN891Cb1pizewAgaHIo3W1WbAjXtoWuX8n3j8YoI=",
 | 
			
		||||
        "owner": "nix-community",
 | 
			
		||||
        "repo": "NixOS-WSL",
 | 
			
		||||
        "rev": "269411cfed6aab694e46f719277c972de96177bb",
 | 
			
		||||
        "rev": "a1c7e8bebac32cfac7aa8498bdfc60cbff13eb50",
 | 
			
		||||
        "type": "github"
 | 
			
		||||
      },
 | 
			
		||||
      "original": {
 | 
			
		||||
@@ -882,22 +558,6 @@
 | 
			
		||||
        "repo": "NixOS-WSL",
 | 
			
		||||
        "type": "github"
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    "zenyd-mpv-scripts": {
 | 
			
		||||
      "flake": false,
 | 
			
		||||
      "locked": {
 | 
			
		||||
        "lastModified": 1707704915,
 | 
			
		||||
        "narHash": "sha256-9P/8q/OZXfaJMS08acQP4h3/zUA5mKRQee0JmkXcz1w=",
 | 
			
		||||
        "owner": "zenyd",
 | 
			
		||||
        "repo": "mpv-scripts",
 | 
			
		||||
        "rev": "9bdce0050144cb24f92475f7bdd77180e0e4c26b",
 | 
			
		||||
        "type": "github"
 | 
			
		||||
      },
 | 
			
		||||
      "original": {
 | 
			
		||||
        "owner": "zenyd",
 | 
			
		||||
        "repo": "mpv-scripts",
 | 
			
		||||
        "type": "github"
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  "root": "root",
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										379
									
								
								flake.nix
									
									
									
									
									
								
							
							
						
						
									
										379
									
								
								flake.nix
									
									
									
									
									
								
							@@ -7,41 +7,27 @@
 | 
			
		||||
    # Used for system packages
 | 
			
		||||
    nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
 | 
			
		||||
 | 
			
		||||
    # Used for caddy plugins
 | 
			
		||||
    nixpkgs-caddy.url = "github:jpds/nixpkgs/caddy-external-plugins";
 | 
			
		||||
 | 
			
		||||
    # Used for MacOS system config
 | 
			
		||||
    darwin = {
 | 
			
		||||
      url = "github:lnl7/nix-darwin/master";
 | 
			
		||||
      url = "github:/lnl7/nix-darwin/master";
 | 
			
		||||
      inputs.nixpkgs.follows = "nixpkgs";
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    # Used for Windows Subsystem for Linux compatibility
 | 
			
		||||
    wsl = {
 | 
			
		||||
      url = "github:nix-community/NixOS-WSL";
 | 
			
		||||
      inputs.nixpkgs.follows = "nixpkgs";
 | 
			
		||||
    };
 | 
			
		||||
    wsl.url = "github:nix-community/NixOS-WSL";
 | 
			
		||||
 | 
			
		||||
    # Used for user packages and dotfiles
 | 
			
		||||
    # Used for user packages
 | 
			
		||||
    home-manager = {
 | 
			
		||||
      url = "github:nix-community/home-manager/master";
 | 
			
		||||
      inputs.nixpkgs.follows = "nixpkgs"; # Use system packages list for their inputs
 | 
			
		||||
      inputs.nixpkgs.follows =
 | 
			
		||||
        "nixpkgs"; # Use system packages list where available
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    # Community packages; used for Firefox extensions
 | 
			
		||||
    nur.url = "github:nix-community/nur";
 | 
			
		||||
 | 
			
		||||
    # Use official Firefox binary for macOS
 | 
			
		||||
    firefox-darwin = {
 | 
			
		||||
      url = "github:bandithedoge/nixpkgs-firefox-darwin";
 | 
			
		||||
      inputs.nixpkgs.follows = "nixpkgs";
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    # Better App install management in macOS
 | 
			
		||||
    mac-app-util = {
 | 
			
		||||
      url = "github:hraban/mac-app-util";
 | 
			
		||||
      inputs.nixpkgs.follows = "nixpkgs"; # Use system packages list for their inputs
 | 
			
		||||
    };
 | 
			
		||||
    firefox-darwin.url = "github:bandithedoge/nixpkgs-firefox-darwin";
 | 
			
		||||
 | 
			
		||||
    # Manage disk format and partitioning
 | 
			
		||||
    disko = {
 | 
			
		||||
@@ -67,33 +53,32 @@
 | 
			
		||||
      inputs.nixpkgs.follows = "nixpkgs";
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    # Nix language server
 | 
			
		||||
    nil.url = "github:oxalica/nil";
 | 
			
		||||
 | 
			
		||||
    # Neovim plugins
 | 
			
		||||
    base16-nvim-src = {
 | 
			
		||||
      url = "github:RRethy/base16-nvim";
 | 
			
		||||
      flake = false;
 | 
			
		||||
    };
 | 
			
		||||
    nvim-lspconfig-src = {
 | 
			
		||||
      # https://github.com/neovim/nvim-lspconfig/tags
 | 
			
		||||
      url = "github:neovim/nvim-lspconfig/v0.1.8";
 | 
			
		||||
      url = "github:neovim/nvim-lspconfig";
 | 
			
		||||
      flake = false;
 | 
			
		||||
    };
 | 
			
		||||
    cmp-nvim-lsp-src = {
 | 
			
		||||
      url = "github:hrsh7th/cmp-nvim-lsp";
 | 
			
		||||
      flake = false;
 | 
			
		||||
    };
 | 
			
		||||
    baleia-nvim-src = {
 | 
			
		||||
      # https://github.com/m00qek/baleia.nvim/tags
 | 
			
		||||
      url = "github:m00qek/baleia.nvim";
 | 
			
		||||
    null-ls-nvim-src = {
 | 
			
		||||
      url = "github:jose-elias-alvarez/null-ls.nvim";
 | 
			
		||||
      flake = false;
 | 
			
		||||
    };
 | 
			
		||||
    Comment-nvim-src = {
 | 
			
		||||
      url = "github:numToStr/Comment.nvim";
 | 
			
		||||
      flake = false;
 | 
			
		||||
    };
 | 
			
		||||
    nvim-treesitter-src = {
 | 
			
		||||
      # https://github.com/nvim-treesitter/nvim-treesitter/tags
 | 
			
		||||
      url = "github:nvim-treesitter/nvim-treesitter/master";
 | 
			
		||||
      url = "github:nvim-treesitter/nvim-treesitter";
 | 
			
		||||
      flake = false;
 | 
			
		||||
    };
 | 
			
		||||
    telescope-nvim-src = {
 | 
			
		||||
      # https://github.com/nvim-telescope/telescope.nvim/releases
 | 
			
		||||
      url = "github:nvim-telescope/telescope.nvim/0.1.8";
 | 
			
		||||
      url = "github:nvim-telescope/telescope.nvim";
 | 
			
		||||
      flake = false;
 | 
			
		||||
    };
 | 
			
		||||
    telescope-project-nvim-src = {
 | 
			
		||||
@@ -101,149 +86,32 @@
 | 
			
		||||
      flake = false;
 | 
			
		||||
    };
 | 
			
		||||
    toggleterm-nvim-src = {
 | 
			
		||||
      # https://github.com/akinsho/toggleterm.nvim/tags
 | 
			
		||||
      url = "github:akinsho/toggleterm.nvim/v2.11.0";
 | 
			
		||||
      url = "github:akinsho/toggleterm.nvim";
 | 
			
		||||
      flake = false;
 | 
			
		||||
    };
 | 
			
		||||
    bufferline-nvim-src = {
 | 
			
		||||
      # https://github.com/akinsho/bufferline.nvim/releases
 | 
			
		||||
      url = "github:akinsho/bufferline.nvim/v4.6.1";
 | 
			
		||||
      url = "github:akinsho/bufferline.nvim";
 | 
			
		||||
      flake = false;
 | 
			
		||||
    };
 | 
			
		||||
    nvim-tree-lua-src = {
 | 
			
		||||
      url = "github:kyazdani42/nvim-tree.lua";
 | 
			
		||||
      flake = false;
 | 
			
		||||
    };
 | 
			
		||||
    hmts-nvim-src = {
 | 
			
		||||
      url = "github:calops/hmts.nvim";
 | 
			
		||||
      flake = false;
 | 
			
		||||
    };
 | 
			
		||||
    fidget-nvim-src = {
 | 
			
		||||
      # https://github.com/j-hui/fidget.nvim/tags
 | 
			
		||||
      url = "github:j-hui/fidget.nvim/v1.4.5";
 | 
			
		||||
      flake = false;
 | 
			
		||||
    };
 | 
			
		||||
    nvim-lint-src = {
 | 
			
		||||
      url = "github:mfussenegger/nvim-lint";
 | 
			
		||||
      flake = false;
 | 
			
		||||
    };
 | 
			
		||||
    markview-nvim-src = {
 | 
			
		||||
      url = "github:OXY2DEV/markview.nvim";
 | 
			
		||||
      flake = false;
 | 
			
		||||
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
    # Tree-Sitter Grammars
 | 
			
		||||
    tree-sitter-bash = {
 | 
			
		||||
      url = "github:tree-sitter/tree-sitter-bash/master";
 | 
			
		||||
      flake = false;
 | 
			
		||||
    };
 | 
			
		||||
    tree-sitter-python = {
 | 
			
		||||
      url = "github:tree-sitter/tree-sitter-python/master";
 | 
			
		||||
      flake = false;
 | 
			
		||||
    };
 | 
			
		||||
    tree-sitter-lua = {
 | 
			
		||||
      url = "github:MunifTanjim/tree-sitter-lua/main";
 | 
			
		||||
      flake = false;
 | 
			
		||||
    };
 | 
			
		||||
    tree-sitter-ini = {
 | 
			
		||||
      url = "github:justinmk/tree-sitter-ini";
 | 
			
		||||
      flake = false;
 | 
			
		||||
    };
 | 
			
		||||
    tree-sitter-puppet = {
 | 
			
		||||
      url = "github:amaanq/tree-sitter-puppet";
 | 
			
		||||
      flake = false;
 | 
			
		||||
    };
 | 
			
		||||
    tree-sitter-rasi = {
 | 
			
		||||
      url = "github:Fymyte/tree-sitter-rasi";
 | 
			
		||||
      flake = false;
 | 
			
		||||
    };
 | 
			
		||||
    tree-sitter-vimdoc = {
 | 
			
		||||
      url = "github:neovim/tree-sitter-vimdoc";
 | 
			
		||||
      flake = false;
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    # MPV Scripts
 | 
			
		||||
    zenyd-mpv-scripts = {
 | 
			
		||||
      url = "github:zenyd/mpv-scripts";
 | 
			
		||||
      flake = false;
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    # Ren and rep - CLI find and replace
 | 
			
		||||
    rep = {
 | 
			
		||||
      url = "github:robenkleene/rep-grep";
 | 
			
		||||
      flake = false;
 | 
			
		||||
    };
 | 
			
		||||
    ren = {
 | 
			
		||||
      url = "github:robenkleene/ren-find";
 | 
			
		||||
      flake = false;
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    # Stu - TUI for S3
 | 
			
		||||
    stu = {
 | 
			
		||||
      url = "github:lusingander/stu";
 | 
			
		||||
      flake = false;
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    # Nextcloud Apps
 | 
			
		||||
    nextcloud-news = {
 | 
			
		||||
      # https://github.com/nextcloud/news/releases
 | 
			
		||||
      url = "https://github.com/nextcloud/news/releases/download/25.0.0-alpha7/news.tar.gz";
 | 
			
		||||
      flake = false;
 | 
			
		||||
    };
 | 
			
		||||
    nextcloud-external = {
 | 
			
		||||
      # https://github.com/nextcloud-releases/external/releases
 | 
			
		||||
      url = "https://github.com/nextcloud-releases/external/releases/download/v5.4.0/external-v5.4.0.tar.gz";
 | 
			
		||||
      flake = false;
 | 
			
		||||
    };
 | 
			
		||||
    nextcloud-cookbook = {
 | 
			
		||||
      # https://github.com/christianlupus-nextcloud/cookbook-releases/releases/
 | 
			
		||||
      url = "https://github.com/christianlupus-nextcloud/cookbook-releases/releases/download/v0.11.1/cookbook-0.11.1.tar.gz";
 | 
			
		||||
      flake = false;
 | 
			
		||||
    };
 | 
			
		||||
    nextcloud-snappymail = {
 | 
			
		||||
      # https://github.com/the-djmaze/snappymail/releases
 | 
			
		||||
      # https://snappymail.eu/repository/nextcloud
 | 
			
		||||
      url = "https://snappymail.eu/repository/nextcloud/snappymail-2.36.4-nextcloud.tar.gz";
 | 
			
		||||
      # url = "https://github.com/nmasur/snappymail-nextcloud/releases/download/v2.36.3/snappymail-2.36.3-nextcloud.tar.gz";
 | 
			
		||||
      flake = false;
 | 
			
		||||
    };
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  outputs =
 | 
			
		||||
    { nixpkgs, ... }@inputs:
 | 
			
		||||
  outputs = { nixpkgs, ... }@inputs:
 | 
			
		||||
 | 
			
		||||
    let
 | 
			
		||||
 | 
			
		||||
      # Global configuration for my systems
 | 
			
		||||
      globals =
 | 
			
		||||
        let
 | 
			
		||||
          baseName = "masu.rs";
 | 
			
		||||
        in
 | 
			
		||||
        rec {
 | 
			
		||||
      globals = rec {
 | 
			
		||||
        user = "noah";
 | 
			
		||||
        fullName = "Noah Masur";
 | 
			
		||||
        gitName = fullName;
 | 
			
		||||
        gitEmail = "7386960+nmasur@users.noreply.github.com";
 | 
			
		||||
        mail.server = "noahmasur.com";
 | 
			
		||||
          mail.imapHost = "imap.purelymail.com";
 | 
			
		||||
          mail.smtpHost = "smtp.purelymail.com";
 | 
			
		||||
          dotfilesRepo = "https://github.com/nmasur/dotfiles";
 | 
			
		||||
          hostnames = {
 | 
			
		||||
            git = "git.${baseName}";
 | 
			
		||||
            influxdb = "influxdb.${baseName}";
 | 
			
		||||
            irc = "irc.${baseName}";
 | 
			
		||||
            metrics = "metrics.${baseName}";
 | 
			
		||||
            minecraft = "minecraft.${baseName}";
 | 
			
		||||
            n8n = "n8n2.${baseName}";
 | 
			
		||||
            prometheus = "prom.${baseName}";
 | 
			
		||||
            paperless = "paper.${baseName}";
 | 
			
		||||
            secrets = "vault.${baseName}";
 | 
			
		||||
            stream = "stream.${baseName}";
 | 
			
		||||
            content = "cloud.${baseName}";
 | 
			
		||||
            books = "books.${baseName}";
 | 
			
		||||
            download = "download.${baseName}";
 | 
			
		||||
            transmission = "transmission.${baseName}";
 | 
			
		||||
          };
 | 
			
		||||
        dotfilesRepo = "git@github.com:nmasur/dotfiles";
 | 
			
		||||
      };
 | 
			
		||||
 | 
			
		||||
      # Common overlays to always use
 | 
			
		||||
@@ -252,177 +120,103 @@
 | 
			
		||||
        inputs.nix2vim.overlay
 | 
			
		||||
        (import ./overlays/neovim-plugins.nix inputs)
 | 
			
		||||
        (import ./overlays/calibre-web.nix)
 | 
			
		||||
        (import ./overlays/disko.nix inputs)
 | 
			
		||||
        (import ./overlays/tree-sitter.nix inputs)
 | 
			
		||||
        (import ./overlays/mpv-scripts.nix inputs)
 | 
			
		||||
        (import ./overlays/nextcloud-apps.nix inputs)
 | 
			
		||||
        (import ./overlays/betterlockscreen.nix)
 | 
			
		||||
        (import ./overlays/gh-collaborators.nix)
 | 
			
		||||
        (import ./overlays/ren-rep.nix inputs)
 | 
			
		||||
        (import ./overlays/stu.nix inputs)
 | 
			
		||||
      ];
 | 
			
		||||
 | 
			
		||||
      # System types to support.
 | 
			
		||||
      supportedSystems = [
 | 
			
		||||
        "x86_64-linux"
 | 
			
		||||
        "x86_64-darwin"
 | 
			
		||||
        "aarch64-linux"
 | 
			
		||||
        "aarch64-darwin"
 | 
			
		||||
      ];
 | 
			
		||||
      supportedSystems =
 | 
			
		||||
        [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ];
 | 
			
		||||
 | 
			
		||||
      # Helper function to generate an attrset '{ x86_64-linux = f "x86_64-linux"; ... }'.
 | 
			
		||||
      forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
 | 
			
		||||
    in
 | 
			
		||||
    rec {
 | 
			
		||||
 | 
			
		||||
      # Contains my full system builds, including home-manager
 | 
			
		||||
      # nixos-rebuild switch --flake .#tempest
 | 
			
		||||
    in rec {
 | 
			
		||||
 | 
			
		||||
      nixosConfigurations = {
 | 
			
		||||
        arrow = import ./hosts/arrow { inherit inputs globals overlays; };
 | 
			
		||||
        tempest = import ./hosts/tempest { inherit inputs globals overlays; };
 | 
			
		||||
        hydra = import ./hosts/hydra { inherit inputs globals overlays; };
 | 
			
		||||
        flame = import ./hosts/flame { inherit inputs globals overlays; };
 | 
			
		||||
        swan = import ./hosts/swan { inherit inputs globals overlays; };
 | 
			
		||||
      };
 | 
			
		||||
 | 
			
		||||
      # Contains my full Mac system builds, including home-manager
 | 
			
		||||
      # darwin-rebuild switch --flake .#lookingglass
 | 
			
		||||
      darwinConfigurations = {
 | 
			
		||||
        lookingglass = import ./hosts/lookingglass { inherit inputs globals overlays; };
 | 
			
		||||
        lookingglass =
 | 
			
		||||
          import ./hosts/lookingglass { inherit inputs globals overlays; };
 | 
			
		||||
      };
 | 
			
		||||
 | 
			
		||||
      # For quickly applying home-manager settings with:
 | 
			
		||||
      # For quickly applying local settings with:
 | 
			
		||||
      # home-manager switch --flake .#tempest
 | 
			
		||||
      homeConfigurations = {
 | 
			
		||||
        tempest = nixosConfigurations.tempest.config.home-manager.users.${globals.user}.home;
 | 
			
		||||
        lookingglass = darwinConfigurations.lookingglass.config.home-manager.users."Noah.Masur".home;
 | 
			
		||||
        tempest =
 | 
			
		||||
          nixosConfigurations.tempest.config.home-manager.users.${globals.user}.home;
 | 
			
		||||
        lookingglass =
 | 
			
		||||
          darwinConfigurations.lookingglass.config.home-manager.users."Noah.Masur".home;
 | 
			
		||||
      };
 | 
			
		||||
 | 
			
		||||
      # Disk formatting, only used once
 | 
			
		||||
      diskoConfigurations = {
 | 
			
		||||
        root = import ./disks/root.nix;
 | 
			
		||||
      # Disk formatting
 | 
			
		||||
      diskoConfigurations = { root = import ./disks/root.nix; };
 | 
			
		||||
 | 
			
		||||
      # Package servers into images with a generator
 | 
			
		||||
      packages = forAllSystems (system: {
 | 
			
		||||
 | 
			
		||||
        aws = {
 | 
			
		||||
          "${system}" =
 | 
			
		||||
            import ./generators/aws { inherit inputs globals system overlays; };
 | 
			
		||||
        };
 | 
			
		||||
 | 
			
		||||
      packages =
 | 
			
		||||
        let
 | 
			
		||||
          staff =
 | 
			
		||||
            system:
 | 
			
		||||
            import ./hosts/staff {
 | 
			
		||||
              inherit
 | 
			
		||||
                inputs
 | 
			
		||||
                globals
 | 
			
		||||
                overlays
 | 
			
		||||
                system
 | 
			
		||||
                ;
 | 
			
		||||
        staff = {
 | 
			
		||||
          "${system}" = import ./generators/staff {
 | 
			
		||||
            inherit inputs globals system overlays;
 | 
			
		||||
          };
 | 
			
		||||
          neovim =
 | 
			
		||||
            system:
 | 
			
		||||
            let
 | 
			
		||||
              pkgs = import nixpkgs { inherit system overlays; };
 | 
			
		||||
            in
 | 
			
		||||
            import ./modules/common/neovim/package {
 | 
			
		||||
        };
 | 
			
		||||
 | 
			
		||||
        neovim = let pkgs = import nixpkgs { inherit system overlays; };
 | 
			
		||||
        in import ./modules/common/neovim/package {
 | 
			
		||||
          inherit pkgs;
 | 
			
		||||
              colors = (import ./colorscheme/gruvbox-dark).dark;
 | 
			
		||||
          colors =
 | 
			
		||||
            import ./colorscheme/gruvbox/neovim-gruvbox.nix { inherit pkgs; };
 | 
			
		||||
        };
 | 
			
		||||
        in
 | 
			
		||||
        {
 | 
			
		||||
          x86_64-linux.staff = staff "x86_64-linux";
 | 
			
		||||
          x86_64-linux.arrow = inputs.nixos-generators.nixosGenerate rec {
 | 
			
		||||
            system = "x86_64-linux";
 | 
			
		||||
            format = "iso";
 | 
			
		||||
            specialArgs = {
 | 
			
		||||
              pkgs-caddy = import inputs.nixpkgs-caddy { inherit system; };
 | 
			
		||||
            };
 | 
			
		||||
            modules = import ./hosts/arrow/modules.nix { inherit inputs globals overlays; };
 | 
			
		||||
          };
 | 
			
		||||
          x86_64-linux.arrow-aws = inputs.nixos-generators.nixosGenerate rec {
 | 
			
		||||
            system = "x86_64-linux";
 | 
			
		||||
            format = "amazon";
 | 
			
		||||
            specialArgs = {
 | 
			
		||||
              pkgs-caddy = import inputs.nixpkgs-caddy { inherit system; };
 | 
			
		||||
            };
 | 
			
		||||
            modules = import ./hosts/arrow/modules.nix { inherit inputs globals overlays; } ++ [
 | 
			
		||||
              (
 | 
			
		||||
                { ... }:
 | 
			
		||||
                {
 | 
			
		||||
                  boot.kernelPackages = inputs.nixpkgs.legacyPackages.x86_64-linux.linuxKernel.packages.linux_6_6;
 | 
			
		||||
                  amazonImage.sizeMB = 16 * 1024;
 | 
			
		||||
                  permitRootLogin = "prohibit-password";
 | 
			
		||||
                  boot.loader.systemd-boot.enable = inputs.nixpkgs.lib.mkForce false;
 | 
			
		||||
                  boot.loader.efi.canTouchEfiVariables = inputs.nixpkgs.lib.mkForce false;
 | 
			
		||||
                  services.amazon-ssm-agent.enable = true;
 | 
			
		||||
                  users.users.ssm-user.extraGroups = [ "wheel" ];
 | 
			
		||||
                }
 | 
			
		||||
              )
 | 
			
		||||
 | 
			
		||||
      });
 | 
			
		||||
 | 
			
		||||
      apps = forAllSystems (system:
 | 
			
		||||
        let
 | 
			
		||||
          pkgs = import nixpkgs {
 | 
			
		||||
            inherit system;
 | 
			
		||||
            overlays = overlays ++ [
 | 
			
		||||
              (final: prev: {
 | 
			
		||||
                disko-packaged = inputs.disko.packages.${system}.disko;
 | 
			
		||||
              })
 | 
			
		||||
            ];
 | 
			
		||||
          };
 | 
			
		||||
        in import ./apps { inherit pkgs; });
 | 
			
		||||
 | 
			
		||||
          # Package Neovim config into standalone package
 | 
			
		||||
          x86_64-linux.neovim = neovim "x86_64-linux";
 | 
			
		||||
          x86_64-darwin.neovim = neovim "x86_64-darwin";
 | 
			
		||||
          aarch64-linux.neovim = neovim "aarch64-linux";
 | 
			
		||||
          aarch64-darwin.neovim = neovim "aarch64-darwin";
 | 
			
		||||
        };
 | 
			
		||||
 | 
			
		||||
      # Programs that can be run by calling this flake
 | 
			
		||||
      apps = forAllSystems (
 | 
			
		||||
        system:
 | 
			
		||||
        let
 | 
			
		||||
          pkgs = import nixpkgs { inherit system overlays; };
 | 
			
		||||
        in
 | 
			
		||||
        import ./apps { inherit pkgs; }
 | 
			
		||||
      );
 | 
			
		||||
 | 
			
		||||
      # Development environments
 | 
			
		||||
      devShells = forAllSystems (
 | 
			
		||||
        system:
 | 
			
		||||
        let
 | 
			
		||||
          pkgs = import nixpkgs { inherit system overlays; };
 | 
			
		||||
        in
 | 
			
		||||
        {
 | 
			
		||||
      devShells = forAllSystems (system:
 | 
			
		||||
        let pkgs = import nixpkgs { inherit system overlays; };
 | 
			
		||||
        in {
 | 
			
		||||
 | 
			
		||||
          # Used to run commands and edit files in this repo
 | 
			
		||||
          default = pkgs.mkShell {
 | 
			
		||||
            buildInputs = with pkgs; [ git stylua nixfmt shfmt shellcheck ];
 | 
			
		||||
          };
 | 
			
		||||
 | 
			
		||||
          # Used for cloud and systems development and administration
 | 
			
		||||
          devops = pkgs.mkShell {
 | 
			
		||||
            buildInputs = with pkgs; [
 | 
			
		||||
              git
 | 
			
		||||
              stylua
 | 
			
		||||
              nixfmt-rfc-style
 | 
			
		||||
              shfmt
 | 
			
		||||
              shellcheck
 | 
			
		||||
              terraform
 | 
			
		||||
              consul
 | 
			
		||||
              vault
 | 
			
		||||
              awscli2
 | 
			
		||||
              google-cloud-sdk
 | 
			
		||||
              ansible
 | 
			
		||||
              kubectl
 | 
			
		||||
              kubernetes-helm
 | 
			
		||||
              kustomize
 | 
			
		||||
              fluxcd
 | 
			
		||||
            ];
 | 
			
		||||
          };
 | 
			
		||||
        }
 | 
			
		||||
      );
 | 
			
		||||
 | 
			
		||||
      checks = forAllSystems (
 | 
			
		||||
        system:
 | 
			
		||||
        let
 | 
			
		||||
          pkgs = import nixpkgs { inherit system overlays; };
 | 
			
		||||
        in
 | 
			
		||||
        {
 | 
			
		||||
          neovim =
 | 
			
		||||
            pkgs.runCommand "neovim-check-health" { buildInputs = [ inputs.self.packages.${system}.neovim ]; }
 | 
			
		||||
              ''
 | 
			
		||||
                mkdir -p $out
 | 
			
		||||
                export HOME=$TMPDIR
 | 
			
		||||
                nvim -c "checkhealth" -c "write $out/health.log" -c "quitall"
 | 
			
		||||
 | 
			
		||||
                # Check for errors inside the health log
 | 
			
		||||
                if $(grep "ERROR" $out/health.log); then
 | 
			
		||||
                  cat $out/health.log
 | 
			
		||||
                  exit 1
 | 
			
		||||
                fi
 | 
			
		||||
              '';
 | 
			
		||||
        }
 | 
			
		||||
      );
 | 
			
		||||
 | 
			
		||||
      formatter = forAllSystems (
 | 
			
		||||
        system:
 | 
			
		||||
        let
 | 
			
		||||
          pkgs = import nixpkgs { inherit system overlays; };
 | 
			
		||||
        in
 | 
			
		||||
        pkgs.nixfmt-rfc-style
 | 
			
		||||
      );
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
      # Templates for starting other projects quickly
 | 
			
		||||
      templates = rec {
 | 
			
		||||
@@ -443,10 +237,7 @@
 | 
			
		||||
          path = ./templates/haskell;
 | 
			
		||||
          description = "Haskell template";
 | 
			
		||||
        };
 | 
			
		||||
        rust = {
 | 
			
		||||
          path = ./templates/rust;
 | 
			
		||||
          description = "Rust template";
 | 
			
		||||
        };
 | 
			
		||||
      };
 | 
			
		||||
 | 
			
		||||
    };
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										32
									
								
								generators/aws/default.nix
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										32
									
								
								generators/aws/default.nix
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,32 @@
 | 
			
		||||
{ inputs, globals, ... }:
 | 
			
		||||
 | 
			
		||||
with inputs;
 | 
			
		||||
 | 
			
		||||
nixos-generators.nixosGenerate {
 | 
			
		||||
  inherit system;
 | 
			
		||||
  format = "amazon";
 | 
			
		||||
  modules = [
 | 
			
		||||
    home-manager.nixosModules.home-manager
 | 
			
		||||
    {
 | 
			
		||||
      user = globals.user;
 | 
			
		||||
      fullName = globals.fullName;
 | 
			
		||||
      dotfilesRepo = globals.dotfilesRepo;
 | 
			
		||||
      gitName = globals.gitName;
 | 
			
		||||
      gitEmail = globals.gitEmail;
 | 
			
		||||
      networking.hostName = "sheep";
 | 
			
		||||
      gui.enable = false;
 | 
			
		||||
      colorscheme = (import ../colorscheme/gruvbox);
 | 
			
		||||
      passwordHash = null;
 | 
			
		||||
      publicKey =
 | 
			
		||||
        "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIB+AbmjGEwITk5CK9y7+Rg27Fokgj9QEjgc9wST6MA3s";
 | 
			
		||||
      # AWS settings require this
 | 
			
		||||
      permitRootLogin = "prohibit-password";
 | 
			
		||||
    }
 | 
			
		||||
    ../../modules/common
 | 
			
		||||
    ../../modules/nixos
 | 
			
		||||
    ../../modules/common/services/sshd.nix
 | 
			
		||||
  ] ++ [
 | 
			
		||||
    # Required to fix diskSize errors during build
 | 
			
		||||
    ({ ... }: { amazonImage.sizeMB = 16 * 1024; })
 | 
			
		||||
  ];
 | 
			
		||||
}
 | 
			
		||||
@@ -1,23 +1,13 @@
 | 
			
		||||
# locals {
 | 
			
		||||
#   image_file = one(fileset(path.root, "../../../result/nixos-amazon-image-*.vhd"))
 | 
			
		||||
# }
 | 
			
		||||
#
 | 
			
		||||
# # Upload image to S3
 | 
			
		||||
# resource "aws_s3_object" "image" {
 | 
			
		||||
#   bucket = var.images_bucket
 | 
			
		||||
#   key    = basename(local.image_file)
 | 
			
		||||
#   source = local.image_file
 | 
			
		||||
#   etag   = filemd5(local.image_file)
 | 
			
		||||
# }
 | 
			
		||||
 | 
			
		||||
# Use existing image in S3
 | 
			
		||||
data "aws_s3_object" "image" {
 | 
			
		||||
  bucket = var.images_bucket
 | 
			
		||||
  key    = "arrow.vhd"
 | 
			
		||||
locals {
 | 
			
		||||
  image_file = one(fileset(path.root, "result/nixos-amazon-image-*.vhd"))
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
resource "terraform_data" "image_replacement" {
 | 
			
		||||
  input = data.aws_s3_object.image.etag
 | 
			
		||||
# Upload to S3
 | 
			
		||||
resource "aws_s3_object" "image" {
 | 
			
		||||
  bucket = "your_bucket_name"
 | 
			
		||||
  key    = basename(local.image_file)
 | 
			
		||||
  source = local.image_file
 | 
			
		||||
  etag   = filemd5(local.image_file)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# Setup IAM access for the VM Importer
 | 
			
		||||
@@ -39,8 +29,8 @@ data "aws_iam_policy_document" "vmimport" {
 | 
			
		||||
      "s3:ListBucket",
 | 
			
		||||
    ]
 | 
			
		||||
    resources = [
 | 
			
		||||
      "arn:aws:s3:::${data.aws_s3_object.image.bucket}",
 | 
			
		||||
      "arn:aws:s3:::${data.aws_s3_object.image.bucket}/*",
 | 
			
		||||
      "arn:aws:s3:::${aws_s3_object.image.bucket}",
 | 
			
		||||
      "arn:aws:s3:::${aws_s3_object.image.bucket}/*",
 | 
			
		||||
    ]
 | 
			
		||||
  }
 | 
			
		||||
  statement {
 | 
			
		||||
@@ -68,28 +58,23 @@ resource "aws_ebs_snapshot_import" "image" {
 | 
			
		||||
  disk_container {
 | 
			
		||||
    format = "VHD"
 | 
			
		||||
    user_bucket {
 | 
			
		||||
      s3_bucket = data.aws_s3_object.image.bucket
 | 
			
		||||
      s3_key    = data.aws_s3_object.image.key
 | 
			
		||||
      s3_bucket = aws_s3_object.image.bucket
 | 
			
		||||
      s3_key    = aws_s3_object.image.key
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  role_name = aws_iam_role.vmimport.name
 | 
			
		||||
  lifecycle {
 | 
			
		||||
    replace_triggered_by = [terraform_data.image_replacement]
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# Convert to AMI
 | 
			
		||||
resource "aws_ami" "image" {
 | 
			
		||||
  description         = "Created with NixOS."
 | 
			
		||||
  name                = replace(basename(data.aws_s3_object.image.key), "/\\.vhd$/", "")
 | 
			
		||||
  name                = replace(basename(local.image_file), "/\\.vhd$/", "")
 | 
			
		||||
  virtualization_type = "hvm"
 | 
			
		||||
  root_device_name    = "/dev/xvda"
 | 
			
		||||
  ena_support         = true
 | 
			
		||||
 | 
			
		||||
  ebs_block_device {
 | 
			
		||||
    device_name = "/dev/xvda"
 | 
			
		||||
    snapshot_id = aws_ebs_snapshot_import.image.id
 | 
			
		||||
    volume_size = 17
 | 
			
		||||
    volume_size = 8
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										260
									
								
								generators/aws/workflow.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										260
									
								
								generators/aws/workflow.yml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,260 @@
 | 
			
		||||
name: 'Terraform'
 | 
			
		||||
env:
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
  AWS_ACCOUNT_NUMBER: ''
 | 
			
		||||
  AWS_PLAN_ROLE_NAME: github_actions_plan
 | 
			
		||||
  AWS_APPLY_ROLE_NAME: github_actions_admin
 | 
			
		||||
 | 
			
		||||
  # Always required. Used for authenticating to AWS, but can also act as your
 | 
			
		||||
  # default region if you don't want to specify in the provider configuration.
 | 
			
		||||
  AWS_REGION: us-east-1
 | 
			
		||||
 | 
			
		||||
  # You must change these to fit your project.
 | 
			
		||||
  TF_VAR_project: change-me
 | 
			
		||||
  TF_VAR_label: change-me
 | 
			
		||||
  TF_VAR_owner: Your Name Here
 | 
			
		||||
 | 
			
		||||
  # If storing Terraform in a subdirectory, specify it here.
 | 
			
		||||
  TERRAFORM_DIRECTORY: .
 | 
			
		||||
 | 
			
		||||
  # Pinned versions of tools to use.
 | 
			
		||||
  # Check for new releases:
 | 
			
		||||
  # - https://github.com/hashicorp/terraform/releases
 | 
			
		||||
  # - https://github.com/fugue/regula/releases
 | 
			
		||||
  # - https://github.com/terraform-linters/tflint/releases
 | 
			
		||||
  TERRAFORM_VERSION: 1.2.6
 | 
			
		||||
  REGULA_VERSION: 2.9.0
 | 
			
		||||
  TFLINT_VERSION: 0.39.1
 | 
			
		||||
 | 
			
		||||
  # Terraform configuration options
 | 
			
		||||
  TERRAFORM_PARALLELISM: 10
 | 
			
		||||
 | 
			
		||||
  # These variables are passed to Terraform based on GitHub information.
 | 
			
		||||
  TF_VAR_repo: ${{ github.repository }}
 | 
			
		||||
 | 
			
		||||
# This workflow is triggered in the following ways.
 | 
			
		||||
on:
 | 
			
		||||
 | 
			
		||||
  # Any push or merge to these branches.
 | 
			
		||||
  push:
 | 
			
		||||
    branches:
 | 
			
		||||
      - dev
 | 
			
		||||
      - prod
 | 
			
		||||
 | 
			
		||||
  # Any pull request targeting these branches (plan only).
 | 
			
		||||
  pull_request:
 | 
			
		||||
    branches:
 | 
			
		||||
      - dev
 | 
			
		||||
      - prod
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
  # Any manual trigger on these branches.
 | 
			
		||||
  workflow_dispatch:
 | 
			
		||||
    branches:
 | 
			
		||||
      - dev
 | 
			
		||||
      - prod
 | 
			
		||||
 | 
			
		||||
# -------------------------------------------------------------------
 | 
			
		||||
# The rest of this workflow can operate without adjustments. Edit the
 | 
			
		||||
# below content at your own risk!
 | 
			
		||||
# -------------------------------------------------------------------
 | 
			
		||||
 | 
			
		||||
# Used to connect to AWS IAM
 | 
			
		||||
permissions:
 | 
			
		||||
  id-token: write
 | 
			
		||||
  contents: read
 | 
			
		||||
  pull-requests: write
 | 
			
		||||
 | 
			
		||||
# Only run one workflow at a time for each Terraform state. This prevents
 | 
			
		||||
# lockfile conflicts, especially during PR vs push.
 | 
			
		||||
concurrency: terraform-${{ github.base_ref || github.ref }}
 | 
			
		||||
 | 
			
		||||
jobs:
 | 
			
		||||
  terraform:
 | 
			
		||||
 | 
			
		||||
    name: 'Terraform'
 | 
			
		||||
 | 
			
		||||
    # Change this if you need to run your deployment on-prem.
 | 
			
		||||
    runs-on: ubuntu-latest
 | 
			
		||||
 | 
			
		||||
    steps:
 | 
			
		||||
 | 
			
		||||
      # Downloads the current repo code to the runner.
 | 
			
		||||
      - name: Checkout Repo Code
 | 
			
		||||
        uses: actions/checkout@v2
 | 
			
		||||
 | 
			
		||||
      # Install Nix
 | 
			
		||||
      - name: Install Nix
 | 
			
		||||
        uses: cachix/install-nix-action@v17
 | 
			
		||||
 | 
			
		||||
      # Build the image
 | 
			
		||||
      - name: Build Image
 | 
			
		||||
        run: nix build .#aws
 | 
			
		||||
 | 
			
		||||
      # Login to AWS
 | 
			
		||||
      - name: AWS Assume Role
 | 
			
		||||
        uses: aws-actions/configure-aws-credentials@v1.6.1
 | 
			
		||||
        with:
 | 
			
		||||
          role-to-assume: ${{ env.AWS_ROLE_ARN }}
 | 
			
		||||
          aws-region: ${{ env.AWS_REGION }}
 | 
			
		||||
 | 
			
		||||
      # Exports all GitHub Secrets as environment variables prefixed by
 | 
			
		||||
      # "TF_VAR_", which exposes them to Terraform. The name of each GitHub
 | 
			
		||||
      # Secret must match its Terraform variable name exactly.
 | 
			
		||||
      - name: Export Secrets to Terraform Variables
 | 
			
		||||
        env:
 | 
			
		||||
          ALL_SECRETS: ${{ toJson(secrets) }}
 | 
			
		||||
        run: |
 | 
			
		||||
          echo "$ALL_SECRETS" \
 | 
			
		||||
            | jq "to_entries | .[] | \"TF_VAR_\" + ( .key | ascii_downcase ) + \"=\" + .value" \
 | 
			
		||||
            | tr -d \" >> $GITHUB_ENV
 | 
			
		||||
 | 
			
		||||
      # Installs the Terraform binary and some other accessory functions.
 | 
			
		||||
      - name: Setup Terraform
 | 
			
		||||
        uses: hashicorp/setup-terraform@v2
 | 
			
		||||
        with:
 | 
			
		||||
          terraform_version: ${{ env.TERRAFORM_VERSION }}
 | 
			
		||||
 | 
			
		||||
      # Checks whether Terraform is formatted properly. If this fails, you
 | 
			
		||||
      # should install the pre-commit hook.
 | 
			
		||||
      - name: Check Formatting
 | 
			
		||||
        run: |
 | 
			
		||||
          terraform fmt -no-color -check -diff -recursive
 | 
			
		||||
 | 
			
		||||
      # Downloads a Terraform code lint test.
 | 
			
		||||
      - uses: terraform-linters/setup-tflint@v1
 | 
			
		||||
        name: Setup TFLint
 | 
			
		||||
        with:
 | 
			
		||||
          tflint_version: v${{ env.TFLINT_VERSION }}
 | 
			
		||||
 | 
			
		||||
      # Sets up linting with this codebase.
 | 
			
		||||
      - name: Init TFLint
 | 
			
		||||
        working-directory: ${{ env.TERRAFORM_DIRECTORY }}
 | 
			
		||||
        run: tflint --init
 | 
			
		||||
 | 
			
		||||
      # Lints the current code.
 | 
			
		||||
      - name: Run TFLint
 | 
			
		||||
        working-directory: ${{ env.TERRAFORM_DIRECTORY }}
 | 
			
		||||
        run: |
 | 
			
		||||
          tflint -f compact
 | 
			
		||||
          find ./modules/* -type d -maxdepth 0 | xargs -I __ tflint -f compact --disable-rule=terraform_required_providers --disable-rule=terraform_required_version __
 | 
			
		||||
 | 
			
		||||
      # Connects to remote state backend and download providers.
 | 
			
		||||
      - name: Terraform Init
 | 
			
		||||
        working-directory: ${{ env.TERRAFORM_DIRECTORY }}
 | 
			
		||||
        run: |
 | 
			
		||||
          terraform init \
 | 
			
		||||
            -backend-config="role_arn=${{ env.AWS_STATE_ROLE_ARN }}" \
 | 
			
		||||
            -backend-config="region=us-east-1" \
 | 
			
		||||
            -backend-config="workspace_key_prefix=accounts/${{ env.AWS_ACCOUNT_NUMBER }}/${{ github.repository }}" \
 | 
			
		||||
            -backend-config="key=state.tfstate" \
 | 
			
		||||
            -backend-config="dynamodb_table=global-tf-state-lock"
 | 
			
		||||
 | 
			
		||||
      # Set the Terraform Workspace to the current branch name.
 | 
			
		||||
      - name: Set Terraform Workspace
 | 
			
		||||
        working-directory: ${{ env.TERRAFORM_DIRECTORY }}
 | 
			
		||||
        shell: bash
 | 
			
		||||
        run: |
 | 
			
		||||
          export WORKSPACE=${{ github.base_ref || github.ref_name }}
 | 
			
		||||
          terraform workspace select ${WORKSPACE} || terraform workspace new $WORKSPACE
 | 
			
		||||
          echo "TF_WORKSPACE=$(echo ${WORKSPACE} | sed 's/\//_/g')" >> $GITHUB_ENV
 | 
			
		||||
 | 
			
		||||
      # Checks differences between current code and infrastructure state.
 | 
			
		||||
      - name: Terraform Plan
 | 
			
		||||
        id: plan
 | 
			
		||||
        working-directory: ${{ env.TERRAFORM_DIRECTORY }}
 | 
			
		||||
        run: |
 | 
			
		||||
          terraform plan \
 | 
			
		||||
            -input=false \
 | 
			
		||||
            -no-color \
 | 
			
		||||
            -out=tfplan \
 | 
			
		||||
            -parallelism=${TERRAFORM_PARALLELISM} \
 | 
			
		||||
            -var-file=variables-${TF_WORKSPACE}.tfvars
 | 
			
		||||
 | 
			
		||||
      # Gets the results of the plan for pull requests.
 | 
			
		||||
      - name: Terraform Show Plan
 | 
			
		||||
        id: show
 | 
			
		||||
        working-directory: ${{ env.TERRAFORM_DIRECTORY }}
 | 
			
		||||
        run: terraform show -no-color tfplan
 | 
			
		||||
 | 
			
		||||
      # Adds the results of the plan to the pull request.
 | 
			
		||||
      - name: Comment Plan
 | 
			
		||||
        uses: actions/github-script@v6
 | 
			
		||||
        if: github.event_name == 'pull_request'
 | 
			
		||||
        env:
 | 
			
		||||
          STDOUT: "```terraform\n${{ steps.show.outputs.stdout }}```"
 | 
			
		||||
        with:
 | 
			
		||||
          github-token: ${{ secrets.GITHUB_TOKEN }}
 | 
			
		||||
          script: |
 | 
			
		||||
            // 1. Retrieve existing bot comments for the PR
 | 
			
		||||
            const { data: comments } = await github.rest.issues.listComments({
 | 
			
		||||
              owner: context.repo.owner,
 | 
			
		||||
              repo: context.repo.repo,
 | 
			
		||||
              issue_number: context.issue.number,
 | 
			
		||||
            })
 | 
			
		||||
            const botComment = comments.find(comment => {
 | 
			
		||||
              return comment.user.type === 'Bot' && comment.body.includes('Terraform Format and Style')
 | 
			
		||||
            })
 | 
			
		||||
 | 
			
		||||
            // 2. Prepare format of the comment
 | 
			
		||||
            const output = `#### Terraform Format and Style 🖌\`${{ steps.fmt.outcome }}\`
 | 
			
		||||
            #### Terraform Initialization ⚙️\`${{ steps.init.outcome }}\`
 | 
			
		||||
            #### Terraform Validation 🤖\`${{ steps.validate.outcome }}\`
 | 
			
		||||
            <details><summary>Validation Output</summary>
 | 
			
		||||
 | 
			
		||||
            \`\`\`\n
 | 
			
		||||
            ${{ steps.validate.outputs.stdout }}
 | 
			
		||||
            \`\`\`
 | 
			
		||||
 | 
			
		||||
            </details>
 | 
			
		||||
 | 
			
		||||
            #### Terraform Plan 📖\`${{ steps.plan.outcome }}\`
 | 
			
		||||
 | 
			
		||||
            <details><summary>Show Plan</summary>
 | 
			
		||||
 | 
			
		||||
            \`\`\`\n
 | 
			
		||||
            ${process.env.PLAN}
 | 
			
		||||
            \`\`\`
 | 
			
		||||
 | 
			
		||||
            </details>
 | 
			
		||||
 | 
			
		||||
            *Pusher: @${{ github.actor }}, Action: \`${{ github.event_name }}\`, Working Directory: \`${{ env.tf_actions_working_dir }}\`, Workflow: \`${{ github.workflow }}\`*`;
 | 
			
		||||
 | 
			
		||||
            // 3. If we have a comment, update it, otherwise create a new one
 | 
			
		||||
            if (botComment) {
 | 
			
		||||
              github.rest.issues.updateComment({
 | 
			
		||||
                owner: context.repo.owner,
 | 
			
		||||
                repo: context.repo.repo,
 | 
			
		||||
                comment_id: botComment.id,
 | 
			
		||||
                body: output
 | 
			
		||||
              })
 | 
			
		||||
            } else {
 | 
			
		||||
              github.rest.issues.createComment({
 | 
			
		||||
                issue_number: context.issue.number,
 | 
			
		||||
                owner: context.repo.owner,
 | 
			
		||||
                repo: context.repo.repo,
 | 
			
		||||
                body: output
 | 
			
		||||
              })
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
      # Downloads Regula and checks whether the plan meets compliance requirements.
 | 
			
		||||
      - name: Regula Compliance Check
 | 
			
		||||
        shell: bash
 | 
			
		||||
        working-directory: ${{ env.TERRAFORM_DIRECTORY }}
 | 
			
		||||
        run: |
 | 
			
		||||
          REGULA_URL="https://github.com/fugue/regula/releases/download/v${REGULA_VERSION}/regula_${REGULA_VERSION}_Linux_x86_64.tar.gz"
 | 
			
		||||
          curl -sL "$REGULA_URL" -o regula.tar.gz
 | 
			
		||||
          tar xzf regula.tar.gz
 | 
			
		||||
          terraform show -json tfplan | ./regula run
 | 
			
		||||
 | 
			
		||||
      # Deploys infrastructure or changes to infrastructure.
 | 
			
		||||
      - name: Terraform Apply
 | 
			
		||||
        if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
 | 
			
		||||
        working-directory: ${{ env.TERRAFORM_DIRECTORY }}
 | 
			
		||||
        run: |
 | 
			
		||||
          terraform apply \
 | 
			
		||||
            -auto-approve \
 | 
			
		||||
            -input=false \
 | 
			
		||||
            -parallelism=${TERRAFORM_PARALLELISM} \
 | 
			
		||||
            tfplan
 | 
			
		||||
							
								
								
									
										47
									
								
								generators/staff/default.nix
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										47
									
								
								generators/staff/default.nix
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,47 @@
 | 
			
		||||
# The Staff
 | 
			
		||||
# ISO configuration for my USB drive
 | 
			
		||||
 | 
			
		||||
{ inputs, system, overlays, ... }:
 | 
			
		||||
 | 
			
		||||
with inputs;
 | 
			
		||||
 | 
			
		||||
nixos-generators.nixosGenerate {
 | 
			
		||||
  inherit system;
 | 
			
		||||
  format = "install-iso";
 | 
			
		||||
  modules = [{
 | 
			
		||||
    nixpkgs.overlays = overlays;
 | 
			
		||||
    networking.hostName = "staff";
 | 
			
		||||
    users.extraUsers.root.openssh.authorizedKeys.keys = [
 | 
			
		||||
      "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIB+AbmjGEwITk5CK9y7+Rg27Fokgj9QEjgc9wST6MA3s"
 | 
			
		||||
    ];
 | 
			
		||||
    services.openssh = {
 | 
			
		||||
      enable = true;
 | 
			
		||||
      ports = [ 22 ];
 | 
			
		||||
      allowSFTP = true;
 | 
			
		||||
      settings = {
 | 
			
		||||
        GatewayPorts = "no";
 | 
			
		||||
        X11Forwarding = false;
 | 
			
		||||
        PasswordAuthentication = false;
 | 
			
		||||
        PermitRootLogin = "yes";
 | 
			
		||||
      };
 | 
			
		||||
    };
 | 
			
		||||
    environment.systemPackages =
 | 
			
		||||
      let pkgs = import inputs.nixpkgs { inherit system overlays; };
 | 
			
		||||
      in with pkgs; [
 | 
			
		||||
        git
 | 
			
		||||
        vim
 | 
			
		||||
        wget
 | 
			
		||||
        curl
 | 
			
		||||
        (import ../../modules/common/neovim/package {
 | 
			
		||||
          inherit pkgs;
 | 
			
		||||
          # colors = import ../../colorscheme/gruvbox.dark.neovimConfig {
 | 
			
		||||
          #   inherit pkgs;
 | 
			
		||||
          # };
 | 
			
		||||
        })
 | 
			
		||||
      ];
 | 
			
		||||
    nix.extraOptions = ''
 | 
			
		||||
      experimental-features = nix-command flakes
 | 
			
		||||
      warn-dirty = false
 | 
			
		||||
    '';
 | 
			
		||||
  }];
 | 
			
		||||
}
 | 
			
		||||
@@ -1,26 +0,0 @@
 | 
			
		||||
# Hosts
 | 
			
		||||
 | 
			
		||||
These are the individual machines managed by this flake.
 | 
			
		||||
 | 
			
		||||
| Host                                       | Purpose             |
 | 
			
		||||
| ---                                        | ---                 |
 | 
			
		||||
| [aws](./aws/default.nix)                   | AWS AMI             |
 | 
			
		||||
| [staff](./staff/default.nix)               | Live USB stick      |
 | 
			
		||||
| [flame](./flame/default.nix)               | Oracle cloud server |
 | 
			
		||||
| [hydra](./hydra/default.nix)               | WSL config          |
 | 
			
		||||
| [lookingglass](./lookingglass/default.nix) | Work MacBook        |
 | 
			
		||||
| [swan](./swan/default.nix)                 | Home server         |
 | 
			
		||||
| [tempest](./tempest/default.nix)           | Linux desktop       |
 | 
			
		||||
 | 
			
		||||
## NixOS Workflow
 | 
			
		||||
 | 
			
		||||
Each hosts file is imported into [nixosConfigurations](../flake.nix) and passed
 | 
			
		||||
the arguments from the flake (inputs, globals, overlays). The `nixosSystem`
 | 
			
		||||
function in that hosts file will be called by the NixOS module system during a
 | 
			
		||||
nixos-rebuild.
 | 
			
		||||
 | 
			
		||||
Each module in the each host's `modules` list is either a function or an
 | 
			
		||||
attrset. The attrsets will simply apply values to options that have been
 | 
			
		||||
declared in the config by other modules. Meanwhile, the functions will be
 | 
			
		||||
passed various arguments, several of which you will see listed at the top of
 | 
			
		||||
each of their files.
 | 
			
		||||
@@ -1,98 +0,0 @@
 | 
			
		||||
resource "aws_instance" "instance" {
 | 
			
		||||
  ami                    = aws_ami.image.id
 | 
			
		||||
  iam_instance_profile   = aws_iam_instance_profile.instance.name
 | 
			
		||||
  instance_type          = var.ec2_size
 | 
			
		||||
  vpc_security_group_ids = [aws_security_group.instance.id]
 | 
			
		||||
 | 
			
		||||
  tags = {
 | 
			
		||||
    Name = "aws-nixos"
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  lifecycle {
 | 
			
		||||
    create_before_destroy = true
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
resource "aws_ec2_instance_state" "instance" {
 | 
			
		||||
  instance_id = aws_instance.instance.id
 | 
			
		||||
  state       = "running"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
data "aws_vpc" "vpc" {
 | 
			
		||||
  default = true
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
resource "aws_security_group" "instance" {
 | 
			
		||||
  name        = "aws-nixos"
 | 
			
		||||
  description = "Allow SSH and HTTPS"
 | 
			
		||||
  vpc_id      = data.aws_vpc.vpc.id
 | 
			
		||||
 | 
			
		||||
  ingress {
 | 
			
		||||
    description = "Ping"
 | 
			
		||||
    from_port   = -1
 | 
			
		||||
    to_port     = -1
 | 
			
		||||
    protocol    = "icmp"
 | 
			
		||||
    cidr_blocks = ["0.0.0.0/0"]
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  ingress {
 | 
			
		||||
    description = "SSH"
 | 
			
		||||
    from_port   = 22
 | 
			
		||||
    to_port     = 22
 | 
			
		||||
    protocol    = "tcp"
 | 
			
		||||
    cidr_blocks = ["0.0.0.0/0"]
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  ingress {
 | 
			
		||||
    description = "HTTPS"
 | 
			
		||||
    from_port   = 443
 | 
			
		||||
    to_port     = 443
 | 
			
		||||
    protocol    = "tcp"
 | 
			
		||||
    cidr_blocks = ["0.0.0.0/0"]
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  egress {
 | 
			
		||||
    from_port        = 0
 | 
			
		||||
    to_port          = 0
 | 
			
		||||
    protocol         = "-1"
 | 
			
		||||
    cidr_blocks      = ["0.0.0.0/0"]
 | 
			
		||||
    ipv6_cidr_blocks = ["::/0"]
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# Setup IAM for the instance to use SSM
 | 
			
		||||
data "aws_iam_policy_document" "ec2_assume_role" {
 | 
			
		||||
  statement {
 | 
			
		||||
    actions = ["sts:AssumeRole"]
 | 
			
		||||
    principals {
 | 
			
		||||
      type        = "Service"
 | 
			
		||||
      identifiers = ["ec2.amazonaws.com"]
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
data "aws_iam_policy_document" "instance_profile" {
 | 
			
		||||
  statement {
 | 
			
		||||
    actions = [
 | 
			
		||||
      "s3:ListAllMyBuckets",
 | 
			
		||||
    ]
 | 
			
		||||
    resources = ["*"]
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
resource "aws_iam_role" "instance_profile" {
 | 
			
		||||
  name               = "nixos"
 | 
			
		||||
  assume_role_policy = data.aws_iam_policy_document.ec2_assume_role.json
 | 
			
		||||
  inline_policy {
 | 
			
		||||
    name   = "instance-profile"
 | 
			
		||||
    policy = data.aws_iam_policy_document.instance_profile.json
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
resource "aws_iam_role_policy_attachment" "instance_ssm" {
 | 
			
		||||
  role       = aws_iam_role.instance_profile.name
 | 
			
		||||
  policy_arn = "arn:aws:iam::aws:policy/AmazonSSMManagedInstanceCore"
 | 
			
		||||
}
 | 
			
		||||
resource "aws_iam_instance_profile" "instance" {
 | 
			
		||||
  name = "nixos"
 | 
			
		||||
  role = aws_iam_role.instance_profile.name
 | 
			
		||||
}
 | 
			
		||||
@@ -1,13 +0,0 @@
 | 
			
		||||
terraform {
 | 
			
		||||
  backend "s3" {
 | 
			
		||||
    region         = "us-east-1"
 | 
			
		||||
    dynamodb_table = "terraform-state-lock"
 | 
			
		||||
  }
 | 
			
		||||
  required_version = ">= 1.0.0"
 | 
			
		||||
  required_providers {
 | 
			
		||||
    aws = {
 | 
			
		||||
      source  = "hashicorp/aws"
 | 
			
		||||
      version = "5.42.0"
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
@@ -1,3 +0,0 @@
 | 
			
		||||
output "host_ip" {
 | 
			
		||||
  value = aws_instance.instance.public_ip
 | 
			
		||||
}
 | 
			
		||||
@@ -1,10 +0,0 @@
 | 
			
		||||
variable "ec2_size" {
 | 
			
		||||
  type        = string
 | 
			
		||||
  description = "Size of instance to launch"
 | 
			
		||||
  default     = "t3a.small" # 2 GB RAM ($14/mo)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
variable "images_bucket" {
 | 
			
		||||
  description = "Name of the bucket in which to store the NixOS VM images."
 | 
			
		||||
  type        = string
 | 
			
		||||
}
 | 
			
		||||
@@ -1,41 +0,0 @@
 | 
			
		||||
# The Arrow
 | 
			
		||||
# System configuration for temporary VM
 | 
			
		||||
 | 
			
		||||
{
 | 
			
		||||
  inputs,
 | 
			
		||||
  globals,
 | 
			
		||||
  overlays,
 | 
			
		||||
  ...
 | 
			
		||||
}:
 | 
			
		||||
 | 
			
		||||
inputs.nixpkgs.lib.nixosSystem rec {
 | 
			
		||||
  system = "x86_64-linux";
 | 
			
		||||
  specialArgs = {
 | 
			
		||||
    pkgs-caddy = import inputs.nixpkgs-caddy { inherit system; };
 | 
			
		||||
  };
 | 
			
		||||
  modules = import ./modules.nix { inherit inputs globals overlays; } ++ [
 | 
			
		||||
    {
 | 
			
		||||
      # 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";
 | 
			
		||||
      };
 | 
			
		||||
 | 
			
		||||
      virtualisation.vmVariant = {
 | 
			
		||||
        virtualisation.forwardPorts = [
 | 
			
		||||
          {
 | 
			
		||||
            from = "host";
 | 
			
		||||
            host.port = 2222;
 | 
			
		||||
            guest.port = 22;
 | 
			
		||||
          }
 | 
			
		||||
        ];
 | 
			
		||||
      };
 | 
			
		||||
    }
 | 
			
		||||
  ];
 | 
			
		||||
}
 | 
			
		||||
@@ -1,32 +0,0 @@
 | 
			
		||||
{
 | 
			
		||||
  inputs,
 | 
			
		||||
  globals,
 | 
			
		||||
  overlays,
 | 
			
		||||
}:
 | 
			
		||||
 | 
			
		||||
[
 | 
			
		||||
  globals
 | 
			
		||||
  inputs.home-manager.nixosModules.home-manager
 | 
			
		||||
  {
 | 
			
		||||
    nixpkgs.overlays = overlays;
 | 
			
		||||
    networking.hostName = "arrow";
 | 
			
		||||
    physical = false;
 | 
			
		||||
    server = true;
 | 
			
		||||
    gui.enable = false;
 | 
			
		||||
    theme.colors = (import ../../colorscheme/gruvbox).dark;
 | 
			
		||||
    publicKeys = [
 | 
			
		||||
      "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIB+AbmjGEwITk5CK9y7+Rg27Fokgj9QEjgc9wST6MA3s personal"
 | 
			
		||||
      "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKpPU2G9rSF8Q6waH62IJexDCQ6lY+8ZyVufGE3xMDGw deploy"
 | 
			
		||||
    ];
 | 
			
		||||
    identityFile = "/home/${globals.user}/.ssh/id_ed25519";
 | 
			
		||||
    cloudflare.enable = true;
 | 
			
		||||
    services.openssh.enable = true;
 | 
			
		||||
    services.caddy.enable = true;
 | 
			
		||||
    services.n8n.enable = true;
 | 
			
		||||
 | 
			
		||||
    # nix-index seems to eat up too much memory for Vultr
 | 
			
		||||
    home-manager.users.${globals.user}.programs.nix-index.enable = inputs.nixpkgs.lib.mkForce false;
 | 
			
		||||
  }
 | 
			
		||||
  ../../modules/common
 | 
			
		||||
  ../../modules/nixos
 | 
			
		||||
]
 | 
			
		||||
@@ -1,78 +0,0 @@
 | 
			
		||||
terraform {
 | 
			
		||||
  backend "s3" {
 | 
			
		||||
    bucket                      = "noahmasur-terraform"
 | 
			
		||||
    key                         = "arrow.tfstate"
 | 
			
		||||
    region                      = "auto"
 | 
			
		||||
    skip_credentials_validation = true
 | 
			
		||||
    skip_metadata_api_check     = true
 | 
			
		||||
    skip_region_validation      = true
 | 
			
		||||
    skip_requesting_account_id  = true
 | 
			
		||||
    skip_s3_checksum            = true
 | 
			
		||||
    use_path_style              = true
 | 
			
		||||
    /*
 | 
			
		||||
      ENVIRONMENT VARIABLES
 | 
			
		||||
      ---------------------
 | 
			
		||||
      AWS_ACCESS_KEY_ID     - R2 token
 | 
			
		||||
      AWS_SECRET_ACCESS_KEY - R2 secret
 | 
			
		||||
      AWS_ENDPOINT_URL_S3   - R2 location: https://ACCOUNT_ID.r2.cloudflarestorage.com
 | 
			
		||||
    */
 | 
			
		||||
  }
 | 
			
		||||
  required_version = ">= 1.0.0"
 | 
			
		||||
  required_providers {
 | 
			
		||||
    aws = {
 | 
			
		||||
      source  = "hashicorp/aws"
 | 
			
		||||
      version = "5.42.0"
 | 
			
		||||
    }
 | 
			
		||||
    vultr = {
 | 
			
		||||
      source  = "vultr/vultr"
 | 
			
		||||
      version = "2.19.0"
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
variable "vultr_api_key" {
 | 
			
		||||
  type        = string
 | 
			
		||||
  description = "API key for Vultr management"
 | 
			
		||||
  sensitive   = true
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# https://api.vultr.com/v2/plans
 | 
			
		||||
variable "vultr_plan" {
 | 
			
		||||
  type        = string
 | 
			
		||||
  description = "Size of instance to launch"
 | 
			
		||||
  default     = "vc2-1c-2gb" # 55 GB SSD ($10/mo)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
provider "aws" {
 | 
			
		||||
  region                      = "auto"
 | 
			
		||||
  skip_credentials_validation = true
 | 
			
		||||
  skip_metadata_api_check     = true
 | 
			
		||||
  skip_region_validation      = true
 | 
			
		||||
  skip_requesting_account_id  = true
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
provider "vultr" {
 | 
			
		||||
  api_key = var.vultr_api_key
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
resource "vultr_iso_private" "image" {
 | 
			
		||||
  # url = "https://${var.cloudflare_account_id}.r2.cloudflarestorage.com/${data.aws_s3_bucket.images.id}/${aws_s3_object.image.key}"
 | 
			
		||||
  url = "https://arrow-images.masu.rs/arrow.iso"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
resource "vultr_instance" "arrow" {
 | 
			
		||||
  plan                = var.vultr_plan
 | 
			
		||||
  region              = "ewr"
 | 
			
		||||
  iso_id              = vultr_iso_private.image.id
 | 
			
		||||
  label               = "arrow"
 | 
			
		||||
  tags                = ["arrow"]
 | 
			
		||||
  enable_ipv6         = false
 | 
			
		||||
  disable_public_ipv4 = false
 | 
			
		||||
  backups             = "disabled"
 | 
			
		||||
  ddos_protection     = false
 | 
			
		||||
  activation_email    = false
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
output "host_ip" {
 | 
			
		||||
  value = vultr_instance.arrow.main_ip
 | 
			
		||||
}
 | 
			
		||||
@@ -1,93 +1,44 @@
 | 
			
		||||
# The Flame
 | 
			
		||||
# System configuration for an Oracle free server
 | 
			
		||||
 | 
			
		||||
# See [readme](../README.md) to explain how this file works.
 | 
			
		||||
 | 
			
		||||
# How to install:
 | 
			
		||||
# https://blog.korfuri.fr/posts/2022/08/nixos-on-an-oracle-free-tier-ampere-machine/
 | 
			
		||||
# These days, probably use nixos-anywhere instead.
 | 
			
		||||
 | 
			
		||||
{
 | 
			
		||||
  inputs,
 | 
			
		||||
  globals,
 | 
			
		||||
  overlays,
 | 
			
		||||
  ...
 | 
			
		||||
}:
 | 
			
		||||
{ inputs, globals, overlays, ... }:
 | 
			
		||||
 | 
			
		||||
inputs.nixpkgs.lib.nixosSystem rec {
 | 
			
		||||
with inputs;
 | 
			
		||||
 | 
			
		||||
nixpkgs.lib.nixosSystem {
 | 
			
		||||
  system = "aarch64-linux";
 | 
			
		||||
  specialArgs = {
 | 
			
		||||
    pkgs-caddy = import inputs.nixpkgs-caddy { inherit system; };
 | 
			
		||||
  };
 | 
			
		||||
  specialArgs = { };
 | 
			
		||||
  modules = [
 | 
			
		||||
    globals
 | 
			
		||||
    inputs.home-manager.nixosModules.home-manager
 | 
			
		||||
    ./hardware-configuration.nix
 | 
			
		||||
    ../../modules/common
 | 
			
		||||
    ../../modules/nixos
 | 
			
		||||
    (removeAttrs globals [ "mail.server" ])
 | 
			
		||||
    wsl.nixosModules.wsl
 | 
			
		||||
    home-manager.nixosModules.home-manager
 | 
			
		||||
    {
 | 
			
		||||
      nixpkgs.overlays = overlays;
 | 
			
		||||
 | 
			
		||||
      # Hardware
 | 
			
		||||
      server = true;
 | 
			
		||||
      networking.hostName = "flame";
 | 
			
		||||
 | 
			
		||||
      # Not sure what's necessary but too afraid to remove anything
 | 
			
		||||
      imports = [ (inputs.nixpkgs + "/nixos/modules/profiles/qemu-guest.nix") ];
 | 
			
		||||
      boot.initrd.availableKernelModules = [
 | 
			
		||||
        "xhci_pci"
 | 
			
		||||
        "virtio_pci"
 | 
			
		||||
        "usbhid"
 | 
			
		||||
      ];
 | 
			
		||||
 | 
			
		||||
      # File systems must be declared in order to boot
 | 
			
		||||
 | 
			
		||||
      # This is the root filesystem containing NixOS
 | 
			
		||||
      # I forgot to set a clean label for it
 | 
			
		||||
      fileSystems."/" = {
 | 
			
		||||
        device = "/dev/disk/by-uuid/e1b6bd50-306d-429a-9f45-78f57bc597c3";
 | 
			
		||||
        fsType = "ext4";
 | 
			
		||||
      };
 | 
			
		||||
 | 
			
		||||
      # This is the boot filesystem for systemd-boot
 | 
			
		||||
      fileSystems."/boot" = {
 | 
			
		||||
        device = "/dev/disk/by-uuid/D5CA-237A";
 | 
			
		||||
        fsType = "vfat";
 | 
			
		||||
      };
 | 
			
		||||
 | 
			
		||||
      # Theming
 | 
			
		||||
 | 
			
		||||
      # Server doesn't require GUI
 | 
			
		||||
      gui.enable = false;
 | 
			
		||||
      theme = { colors = (import ../../colorscheme/gruvbox).dark; };
 | 
			
		||||
      nixpkgs.overlays = overlays;
 | 
			
		||||
      wsl.enable = false;
 | 
			
		||||
      caddy.enable = true;
 | 
			
		||||
 | 
			
		||||
      # Still require colors for programs like Neovim, K9S
 | 
			
		||||
      theme = {
 | 
			
		||||
        colors = (import ../../colorscheme/gruvbox).dark;
 | 
			
		||||
      };
 | 
			
		||||
      # FQDNs for various services
 | 
			
		||||
      networking.hostName = "flame";
 | 
			
		||||
      bookServer = "books.masu.rs";
 | 
			
		||||
      # streamServer = "stream.masu.rs";
 | 
			
		||||
      nextcloudServer = "cloud.masu.rs";
 | 
			
		||||
      transmissionServer = "download.masu.rs";
 | 
			
		||||
      metricsServer = "metrics.masu.rs";
 | 
			
		||||
      vaultwardenServer = "vault.masu.rs";
 | 
			
		||||
      giteaServer = "git.masu.rs";
 | 
			
		||||
 | 
			
		||||
      # Programs and services
 | 
			
		||||
      atuin.enable = true;
 | 
			
		||||
      cloudflare.enable = true; # Proxy traffic with Cloudflare
 | 
			
		||||
      dotfiles.enable = true; # Clone dotfiles
 | 
			
		||||
      neovim.enable = true;
 | 
			
		||||
      giteaRunner.enable = true;
 | 
			
		||||
      services.caddy.enable = true;
 | 
			
		||||
      services.grafana.enable = true;
 | 
			
		||||
      services.thelounge.enable = true;
 | 
			
		||||
      services.openssh.enable = true;
 | 
			
		||||
      services.victoriametrics.enable = true;
 | 
			
		||||
      services.influxdb2.enable = true;
 | 
			
		||||
      services.gitea.enable = true;
 | 
			
		||||
      services.vaultwarden.enable = true;
 | 
			
		||||
      services.minecraft-server.enable = true; # Setup Minecraft server
 | 
			
		||||
      system.autoUpgrade.enable = true;
 | 
			
		||||
 | 
			
		||||
      # Allows private remote access over the internet
 | 
			
		||||
      cloudflareTunnel = {
 | 
			
		||||
        enable = true;
 | 
			
		||||
        id = "bd250ee1-ed2e-42d2-b627-039f1eb5a4d2";
 | 
			
		||||
        credentialsFile = ../../private/cloudflared-flame.age;
 | 
			
		||||
        ca = "ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBK/6oyVqjFGX3Uvrc3VS8J9sphxzAnRzKC85xgkHfYgR3TK6qBGXzHrknEj21xeZrr3G2y1UsGzphWJd9ZfIcdA= open-ssh-ca@cloudflareaccess.org";
 | 
			
		||||
      };
 | 
			
		||||
      # Disable passwords, only use SSH key
 | 
			
		||||
      publicKey =
 | 
			
		||||
        "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIB+AbmjGEwITk5CK9y7+Rg27Fokgj9QEjgc9wST6MA3s";
 | 
			
		||||
 | 
			
		||||
      # Nextcloud backup config
 | 
			
		||||
      backup.s3 = {
 | 
			
		||||
@@ -96,39 +47,52 @@ inputs.nixpkgs.lib.nixosSystem rec {
 | 
			
		||||
        accessKeyId = "0026b0e73b2e2c80000000005";
 | 
			
		||||
      };
 | 
			
		||||
 | 
			
		||||
      # Disable passwords, only use SSH key
 | 
			
		||||
      publicKeys = [
 | 
			
		||||
        "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIB+AbmjGEwITk5CK9y7+Rg27Fokgj9QEjgc9wST6MA3s personal"
 | 
			
		||||
      ];
 | 
			
		||||
      # Grant access to Jellyfin directories from Nextcloud
 | 
			
		||||
      users.users.nextcloud.extraGroups = [ "jellyfin" ];
 | 
			
		||||
 | 
			
		||||
      # # Wireguard config for Transmission
 | 
			
		||||
      # wireguard.enable = true;
 | 
			
		||||
      # networking.wireguard.interfaces.wg0 = {
 | 
			
		||||
      #
 | 
			
		||||
      #   # The local IPs for this machine within the Wireguard network
 | 
			
		||||
      #   # Any inbound traffic bound for these IPs should be kept on localhost
 | 
			
		||||
      #   ips = [ "10.66.13.200/32" "fc00:bbbb:bbbb:bb01::3:dc7/128" ];
 | 
			
		||||
      #
 | 
			
		||||
      #   peers = [{
 | 
			
		||||
      #
 | 
			
		||||
      #     # Identity of Wireguard target peer (VPN)
 | 
			
		||||
      #     publicKey = "bOOP5lIjqCdDx5t+mP/kEcSbHS4cZqE0rMlBI178lyY=";
 | 
			
		||||
      #
 | 
			
		||||
      #     # The public internet address of the target peer
 | 
			
		||||
      #     endpoint = "86.106.143.132:51820";
 | 
			
		||||
      #
 | 
			
		||||
      #     # Which outgoing IP ranges should be sent through Wireguard
 | 
			
		||||
      #     allowedIPs = [ "0.0.0.0/0" "::0/0" ];
 | 
			
		||||
      #
 | 
			
		||||
      #     # Send heartbeat signal within the network
 | 
			
		||||
      #     persistentKeepalive = 25;
 | 
			
		||||
      #
 | 
			
		||||
      #   }];
 | 
			
		||||
      #
 | 
			
		||||
      # };
 | 
			
		||||
      # Wireguard config for Transmission
 | 
			
		||||
      wireguard.enable = true;
 | 
			
		||||
      networking.wireguard.interfaces.wg0 = {
 | 
			
		||||
 | 
			
		||||
        # The local IPs for this machine within the Wireguard network
 | 
			
		||||
        # Any inbound traffic bound for these IPs should be kept on localhost
 | 
			
		||||
        ips = [ "10.66.13.200/32" "fc00:bbbb:bbbb:bb01::3:dc7/128" ];
 | 
			
		||||
 | 
			
		||||
        peers = [{
 | 
			
		||||
 | 
			
		||||
          # Identity of Wireguard target peer (VPN)
 | 
			
		||||
          publicKey = "bOOP5lIjqCdDx5t+mP/kEcSbHS4cZqE0rMlBI178lyY=";
 | 
			
		||||
 | 
			
		||||
          # The public internet address of the target peer
 | 
			
		||||
          endpoint = "86.106.143.132:51820";
 | 
			
		||||
 | 
			
		||||
          # Which outgoing IP ranges should be sent through Wireguard
 | 
			
		||||
          allowedIPs = [ "0.0.0.0/0" "::0/0" ];
 | 
			
		||||
 | 
			
		||||
          # Send heartbeat signal within the network
 | 
			
		||||
          persistentKeepalive = 25;
 | 
			
		||||
 | 
			
		||||
        }];
 | 
			
		||||
 | 
			
		||||
      };
 | 
			
		||||
 | 
			
		||||
      # VPN port forwarding
 | 
			
		||||
      services.transmission.settings.peer-port = 57599;
 | 
			
		||||
 | 
			
		||||
      # Grant access to Transmission directories from Jellyfin
 | 
			
		||||
      users.users.jellyfin.extraGroups = [ "transmission" ];
 | 
			
		||||
 | 
			
		||||
      # Proxy traffic with Cloudflare
 | 
			
		||||
      cloudflare.enable = true;
 | 
			
		||||
 | 
			
		||||
      # Setup Minecraft server
 | 
			
		||||
      gaming.minecraft-server.enable = true;
 | 
			
		||||
 | 
			
		||||
      # Clone dotfiles
 | 
			
		||||
      dotfiles.enable = true;
 | 
			
		||||
 | 
			
		||||
      neovim.enable = true;
 | 
			
		||||
 | 
			
		||||
      # # VPN port forwarding
 | 
			
		||||
      # services.transmission.settings.peer-port = 57599;
 | 
			
		||||
    }
 | 
			
		||||
  ];
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										34
									
								
								hosts/flame/hardware-configuration.nix
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										34
									
								
								hosts/flame/hardware-configuration.nix
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,34 @@
 | 
			
		||||
# Do not modify this file!  It was generated by ‘nixos-generate-config’
 | 
			
		||||
# and may be overwritten by future invocations.  Please make changes
 | 
			
		||||
# to /etc/nixos/configuration.nix instead.
 | 
			
		||||
{ lib, modulesPath, ... }:
 | 
			
		||||
 | 
			
		||||
{
 | 
			
		||||
  imports = [ (modulesPath + "/profiles/qemu-guest.nix") ];
 | 
			
		||||
 | 
			
		||||
  boot.initrd.availableKernelModules = [ "xhci_pci" "virtio_pci" "usbhid" ];
 | 
			
		||||
  boot.initrd.kernelModules = [ ];
 | 
			
		||||
  boot.kernelModules = [ ];
 | 
			
		||||
  boot.extraModulePackages = [ ];
 | 
			
		||||
 | 
			
		||||
  fileSystems."/" = {
 | 
			
		||||
    device = "/dev/disk/by-uuid/e1b6bd50-306d-429a-9f45-78f57bc597c3";
 | 
			
		||||
    fsType = "ext4";
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  fileSystems."/boot" = {
 | 
			
		||||
    device = "/dev/disk/by-uuid/D5CA-237A";
 | 
			
		||||
    fsType = "vfat";
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  swapDevices = [ ];
 | 
			
		||||
 | 
			
		||||
  # Enables DHCP on each ethernet and wireless interface. In case of scripted networking
 | 
			
		||||
  # (the default) this is the recommended approach. When using systemd-networkd it's
 | 
			
		||||
  # still possible to use this option, but it's recommended to use it in conjunction
 | 
			
		||||
  # with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
 | 
			
		||||
  networking.useDHCP = lib.mkDefault true;
 | 
			
		||||
  # networking.interfaces.eth0.useDHCP = lib.mkDefault true;
 | 
			
		||||
 | 
			
		||||
  nixpkgs.hostPlatform = lib.mkDefault "aarch64-linux";
 | 
			
		||||
}
 | 
			
		||||
@@ -1,35 +1,31 @@
 | 
			
		||||
# The Hydra
 | 
			
		||||
# System configuration for WSL
 | 
			
		||||
 | 
			
		||||
# See [readme](../README.md) to explain how this file works.
 | 
			
		||||
{ inputs, globals, overlays, ... }:
 | 
			
		||||
 | 
			
		||||
{
 | 
			
		||||
  inputs,
 | 
			
		||||
  globals,
 | 
			
		||||
  overlays,
 | 
			
		||||
  ...
 | 
			
		||||
}:
 | 
			
		||||
with inputs;
 | 
			
		||||
 | 
			
		||||
inputs.nixpkgs.lib.nixosSystem {
 | 
			
		||||
nixpkgs.lib.nixosSystem {
 | 
			
		||||
  system = "x86_64-linux";
 | 
			
		||||
  specialArgs = { };
 | 
			
		||||
  modules = [
 | 
			
		||||
    ../../modules/common
 | 
			
		||||
    ../../modules/nixos
 | 
			
		||||
    ../../modules/wsl
 | 
			
		||||
    globals
 | 
			
		||||
    inputs.wsl.nixosModules.wsl
 | 
			
		||||
    inputs.home-manager.nixosModules.home-manager
 | 
			
		||||
    wsl.nixosModules.wsl
 | 
			
		||||
    home-manager.nixosModules.home-manager
 | 
			
		||||
    {
 | 
			
		||||
      networking.hostName = "hydra";
 | 
			
		||||
      nixpkgs.overlays = overlays;
 | 
			
		||||
      # Set registry to flake packages, used for nix X commands
 | 
			
		||||
      nix.registry.nixpkgs.flake = nixpkgs;
 | 
			
		||||
      identityFile = "/home/${globals.user}/.ssh/id_ed25519";
 | 
			
		||||
      gui.enable = false;
 | 
			
		||||
      theme = {
 | 
			
		||||
        colors = (import ../../colorscheme/gruvbox).dark;
 | 
			
		||||
        dark = true;
 | 
			
		||||
      };
 | 
			
		||||
      passwordHash = inputs.nixpkgs.lib.fileContents ../../misc/password.sha512;
 | 
			
		||||
      passwordHash = nixpkgs.lib.fileContents ../../password.sha512;
 | 
			
		||||
      wsl = {
 | 
			
		||||
        enable = true;
 | 
			
		||||
        wslConf.automount.root = "/mnt";
 | 
			
		||||
@@ -37,7 +33,8 @@ inputs.nixpkgs.lib.nixosSystem {
 | 
			
		||||
        startMenuLaunchers = true;
 | 
			
		||||
        nativeSystemd = true;
 | 
			
		||||
        wslConf.network.generateResolvConf = true; # Turn off if it breaks VPN
 | 
			
		||||
        interop.includePath = false; # Including Windows PATH will slow down Neovim command mode
 | 
			
		||||
        interop.includePath =
 | 
			
		||||
          false; # Including Windows PATH will slow down Neovim command mode
 | 
			
		||||
      };
 | 
			
		||||
 | 
			
		||||
      neovim.enable = true;
 | 
			
		||||
@@ -45,6 +42,7 @@ inputs.nixpkgs.lib.nixosSystem {
 | 
			
		||||
      mail.aerc.enable = true;
 | 
			
		||||
      mail.himalaya.enable = true;
 | 
			
		||||
      dotfiles.enable = true;
 | 
			
		||||
      nixlang.enable = true;
 | 
			
		||||
      lua.enable = true;
 | 
			
		||||
    }
 | 
			
		||||
  ];
 | 
			
		||||
 
 | 
			
		||||
@@ -1,58 +1,50 @@
 | 
			
		||||
# The Looking Glass
 | 
			
		||||
# System configuration for my work Macbook
 | 
			
		||||
 | 
			
		||||
{
 | 
			
		||||
  inputs,
 | 
			
		||||
  globals,
 | 
			
		||||
  overlays,
 | 
			
		||||
  ...
 | 
			
		||||
}:
 | 
			
		||||
{ inputs, globals, overlays, ... }:
 | 
			
		||||
 | 
			
		||||
inputs.darwin.lib.darwinSystem {
 | 
			
		||||
  system = "aarch64-darwin";
 | 
			
		||||
with inputs;
 | 
			
		||||
 | 
			
		||||
darwin.lib.darwinSystem {
 | 
			
		||||
  system = "x86_64-darwin";
 | 
			
		||||
  specialArgs = { };
 | 
			
		||||
  modules = [
 | 
			
		||||
    ../../modules/common
 | 
			
		||||
    ../../modules/darwin
 | 
			
		||||
    (
 | 
			
		||||
      globals
 | 
			
		||||
      // rec {
 | 
			
		||||
    (globals // {
 | 
			
		||||
      user = "Noah.Masur";
 | 
			
		||||
      gitName = "Noah-Masur_1701";
 | 
			
		||||
        gitEmail = "${user}@take2games.com";
 | 
			
		||||
      }
 | 
			
		||||
    )
 | 
			
		||||
    inputs.home-manager.darwinModules.home-manager
 | 
			
		||||
    inputs.mac-app-util.darwinModules.default
 | 
			
		||||
      gitEmail = "Noah.Masur@take2games.com";
 | 
			
		||||
    })
 | 
			
		||||
    home-manager.darwinModules.home-manager
 | 
			
		||||
    {
 | 
			
		||||
      nixpkgs.overlays = [ inputs.firefox-darwin.overlay ] ++ overlays;
 | 
			
		||||
      networking.hostName = "lookingglass";
 | 
			
		||||
      networking.hostName = "noah-masur-mac";
 | 
			
		||||
      identityFile = "/Users/Noah.Masur/.ssh/id_ed25519";
 | 
			
		||||
      gui.enable = true;
 | 
			
		||||
      theme = {
 | 
			
		||||
        colors = (import ../../colorscheme/gruvbox-dark).dark;
 | 
			
		||||
        colors = (import ../../colorscheme/gruvbox).dark;
 | 
			
		||||
        dark = true;
 | 
			
		||||
      };
 | 
			
		||||
      mail.user = globals.user;
 | 
			
		||||
      atuin.enable = true;
 | 
			
		||||
      nixpkgs.overlays = [ firefox-darwin.overlay ] ++ overlays;
 | 
			
		||||
      # Set registry to flake packages, used for nix X commands
 | 
			
		||||
      nix.registry.nixpkgs.flake = nixpkgs;
 | 
			
		||||
      charm.enable = true;
 | 
			
		||||
      neovim.enable = true;
 | 
			
		||||
      mail.enable = true;
 | 
			
		||||
      mail.aerc.enable = true;
 | 
			
		||||
      mail.himalaya.enable = false;
 | 
			
		||||
      mail.himalaya.enable = true;
 | 
			
		||||
      kitty.enable = true;
 | 
			
		||||
      discord.enable = true;
 | 
			
		||||
      firefox.enable = true;
 | 
			
		||||
      dotfiles.enable = true;
 | 
			
		||||
      nixlang.enable = true;
 | 
			
		||||
      terraform.enable = true;
 | 
			
		||||
      python.enable = true;
 | 
			
		||||
      rust.enable = true;
 | 
			
		||||
      lua.enable = true;
 | 
			
		||||
      obsidian.enable = true;
 | 
			
		||||
      kubernetes.enable = true;
 | 
			
		||||
      _1password.enable = true;
 | 
			
		||||
      slack.enable = true;
 | 
			
		||||
      wezterm.enable = true;
 | 
			
		||||
    }
 | 
			
		||||
  ];
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,53 +0,0 @@
 | 
			
		||||
# The Staff
 | 
			
		||||
# ISO configuration for my USB drive
 | 
			
		||||
 | 
			
		||||
{
 | 
			
		||||
  inputs,
 | 
			
		||||
  system,
 | 
			
		||||
  overlays,
 | 
			
		||||
  ...
 | 
			
		||||
}:
 | 
			
		||||
 | 
			
		||||
inputs.nixos-generators.nixosGenerate {
 | 
			
		||||
  inherit system;
 | 
			
		||||
  format = "install-iso";
 | 
			
		||||
  modules = [
 | 
			
		||||
    {
 | 
			
		||||
      nixpkgs.overlays = overlays;
 | 
			
		||||
      networking.hostName = "staff";
 | 
			
		||||
      users.extraUsers.root.openssh.authorizedKeys.keys = [
 | 
			
		||||
        "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIB+AbmjGEwITk5CK9y7+Rg27Fokgj9QEjgc9wST6MA3s"
 | 
			
		||||
      ];
 | 
			
		||||
      services.openssh = {
 | 
			
		||||
        enable = true;
 | 
			
		||||
        ports = [ 22 ];
 | 
			
		||||
        allowSFTP = true;
 | 
			
		||||
        settings = {
 | 
			
		||||
          GatewayPorts = "no";
 | 
			
		||||
          X11Forwarding = false;
 | 
			
		||||
          PasswordAuthentication = false;
 | 
			
		||||
          PermitRootLogin = "yes";
 | 
			
		||||
        };
 | 
			
		||||
      };
 | 
			
		||||
      environment.systemPackages =
 | 
			
		||||
        let
 | 
			
		||||
          pkgs = import inputs.nixpkgs { inherit system overlays; };
 | 
			
		||||
        in
 | 
			
		||||
        with pkgs;
 | 
			
		||||
        [
 | 
			
		||||
          git
 | 
			
		||||
          vim
 | 
			
		||||
          wget
 | 
			
		||||
          curl
 | 
			
		||||
          (import ../../modules/common/neovim/package {
 | 
			
		||||
            inherit pkgs;
 | 
			
		||||
            colors = (import ../../colorscheme/gruvbox).dark;
 | 
			
		||||
          })
 | 
			
		||||
        ];
 | 
			
		||||
      nix.extraOptions = ''
 | 
			
		||||
        experimental-features = nix-command flakes
 | 
			
		||||
        warn-dirty = false
 | 
			
		||||
      '';
 | 
			
		||||
    }
 | 
			
		||||
  ];
 | 
			
		||||
}
 | 
			
		||||
@@ -1,123 +1,49 @@
 | 
			
		||||
# The Swan
 | 
			
		||||
# System configuration for my home NAS server
 | 
			
		||||
 | 
			
		||||
{
 | 
			
		||||
  inputs,
 | 
			
		||||
  globals,
 | 
			
		||||
  overlays,
 | 
			
		||||
  ...
 | 
			
		||||
}:
 | 
			
		||||
{ inputs, globals, overlays, ... }:
 | 
			
		||||
 | 
			
		||||
inputs.nixpkgs.lib.nixosSystem rec {
 | 
			
		||||
with inputs;
 | 
			
		||||
 | 
			
		||||
nixpkgs.lib.nixosSystem {
 | 
			
		||||
  system = "x86_64-linux";
 | 
			
		||||
  specialArgs = {
 | 
			
		||||
    pkgs-caddy = import inputs.nixpkgs-caddy { inherit system; };
 | 
			
		||||
  };
 | 
			
		||||
  specialArgs = { };
 | 
			
		||||
  modules = [
 | 
			
		||||
    globals
 | 
			
		||||
    inputs.home-manager.nixosModules.home-manager
 | 
			
		||||
    inputs.disko.nixosModules.disko
 | 
			
		||||
    ./hardware-configuration.nix
 | 
			
		||||
    ../../modules/common
 | 
			
		||||
    ../../modules/nixos
 | 
			
		||||
    (removeAttrs globals [ "mail.server" ])
 | 
			
		||||
    wsl.nixosModules.wsl
 | 
			
		||||
    home-manager.nixosModules.home-manager
 | 
			
		||||
    disko.nixosModules.disko
 | 
			
		||||
    {
 | 
			
		||||
      nixpkgs.overlays = overlays;
 | 
			
		||||
 | 
			
		||||
      # Hardware
 | 
			
		||||
      server = true;
 | 
			
		||||
      physical = true;
 | 
			
		||||
      networking.hostName = "swan";
 | 
			
		||||
 | 
			
		||||
      # Not sure what's necessary but too afraid to remove anything
 | 
			
		||||
      boot.initrd.availableKernelModules = [
 | 
			
		||||
        "xhci_pci"
 | 
			
		||||
        "ahci"
 | 
			
		||||
        "nvme"
 | 
			
		||||
        "usb_storage"
 | 
			
		||||
        "sd_mod"
 | 
			
		||||
      ];
 | 
			
		||||
 | 
			
		||||
      # Required for transcoding
 | 
			
		||||
      boot.initrd.kernelModules = [ "amdgpu" ];
 | 
			
		||||
      boot.kernelParams = [
 | 
			
		||||
        "radeon.si_support=0"
 | 
			
		||||
        "amdgpu.si_support=1"
 | 
			
		||||
        "radeon.cik_support=0"
 | 
			
		||||
        "amdgpu.cik_support=1"
 | 
			
		||||
        "amdgpu.dc=1"
 | 
			
		||||
      ];
 | 
			
		||||
 | 
			
		||||
      # Required binary blobs to boot on this machine
 | 
			
		||||
      hardware.enableRedistributableFirmware = true;
 | 
			
		||||
 | 
			
		||||
      # Prioritize efficiency over performance
 | 
			
		||||
      powerManagement.cpuFreqGovernor = "powersave";
 | 
			
		||||
 | 
			
		||||
      # Allow firmware updates
 | 
			
		||||
      hardware.cpu.intel.updateMicrocode = true;
 | 
			
		||||
 | 
			
		||||
      # ZFS
 | 
			
		||||
      zfs.enable = true;
 | 
			
		||||
      # Generated with: head -c 8 /etc/machine-id
 | 
			
		||||
      # head -c 8 /etc/machine-id
 | 
			
		||||
      networking.hostId = "600279f4"; # Random ID required for ZFS
 | 
			
		||||
 | 
			
		||||
      # Sets root ext4 filesystem instead of declaring it manually
 | 
			
		||||
      zfs.enable = true;
 | 
			
		||||
      disko = {
 | 
			
		||||
        enableConfig = true;
 | 
			
		||||
        devices = (import ../../disks/root.nix { disk = "/dev/nvme0n1"; });
 | 
			
		||||
        # // (import ../../disks/zfs.nix {
 | 
			
		||||
        #   pool = "tank";
 | 
			
		||||
        #   disks = [ "/dev/sda" "/dev/sdb" "/dev/sdc" ];
 | 
			
		||||
        # });
 | 
			
		||||
      };
 | 
			
		||||
      boot.zfs.extraPools = [ "tank" ];
 | 
			
		||||
 | 
			
		||||
      boot.zfs = {
 | 
			
		||||
        # Automatically load the ZFS pool on boot
 | 
			
		||||
        extraPools = [ "tank" ];
 | 
			
		||||
        # Only try to decrypt datasets with keyfiles
 | 
			
		||||
        requestEncryptionCredentials = [
 | 
			
		||||
          "tank/archive"
 | 
			
		||||
          "tank/generic"
 | 
			
		||||
          "tank/nextcloud"
 | 
			
		||||
          "tank/generic/git"
 | 
			
		||||
        ];
 | 
			
		||||
        # If password is requested and fails, continue to boot eventually
 | 
			
		||||
        passwordTimeout = 300;
 | 
			
		||||
      };
 | 
			
		||||
 | 
			
		||||
      # Theming
 | 
			
		||||
 | 
			
		||||
      # Server doesn't require GUI
 | 
			
		||||
      gui.enable = false;
 | 
			
		||||
 | 
			
		||||
      # Still require colors for programs like Neovim, K9S
 | 
			
		||||
      theme = {
 | 
			
		||||
        colors = (import ../../colorscheme/gruvbox-dark).dark;
 | 
			
		||||
      };
 | 
			
		||||
 | 
			
		||||
      # Programs and services
 | 
			
		||||
      atuin.enable = true;
 | 
			
		||||
      theme = { colors = (import ../../colorscheme/gruvbox).dark; };
 | 
			
		||||
      nixpkgs.overlays = overlays;
 | 
			
		||||
      neovim.enable = true;
 | 
			
		||||
      cloudflare.enable = true;
 | 
			
		||||
      dotfiles.enable = true;
 | 
			
		||||
      arrs.enable = true;
 | 
			
		||||
      services.bind.enable = true;
 | 
			
		||||
      services.caddy.enable = true;
 | 
			
		||||
      services.jellyfin.enable = true;
 | 
			
		||||
      services.nextcloud.enable = true;
 | 
			
		||||
      services.calibre-web.enable = true;
 | 
			
		||||
      services.openssh.enable = true;
 | 
			
		||||
      services.prometheus.enable = false;
 | 
			
		||||
      services.vmagent.enable = true;
 | 
			
		||||
      services.samba.enable = true;
 | 
			
		||||
      services.paperless.enable = true;
 | 
			
		||||
      services.postgresql.enable = true;
 | 
			
		||||
      system.autoUpgrade.enable = false;
 | 
			
		||||
      caddy.enable = true;
 | 
			
		||||
      streamServer = "stream.masu.rs";
 | 
			
		||||
      nextcloudServer = "cloud.masu.rs";
 | 
			
		||||
      bookServer = "books.masu.rs";
 | 
			
		||||
      samba.enable = true;
 | 
			
		||||
 | 
			
		||||
      # Allows private remote access over the internet
 | 
			
		||||
      cloudflareTunnel = {
 | 
			
		||||
        enable = true;
 | 
			
		||||
        id = "646754ac-2149-4a58-b51a-e1d0a1f3ade2";
 | 
			
		||||
        credentialsFile = ../../private/cloudflared-swan.age;
 | 
			
		||||
        ca = "ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBCHF/UMtJqPFrf6f6GRY0ZFnkCW7b6sYgUTjTtNfRj1RdmNic1NoJZql7y6BrqQinZvy7nsr1UFDNWoHn6ah3tg= open-ssh-ca@cloudflareaccess.org";
 | 
			
		||||
      };
 | 
			
		||||
 | 
			
		||||
      # Send regular backups and litestream for DBs to an S3-like bucket
 | 
			
		||||
      backup.s3 = {
 | 
			
		||||
        endpoint = "s3.us-west-002.backblazeb2.com";
 | 
			
		||||
        bucket = "noahmasur-backup";
 | 
			
		||||
@@ -125,9 +51,14 @@ inputs.nixpkgs.lib.nixosSystem rec {
 | 
			
		||||
      };
 | 
			
		||||
 | 
			
		||||
      # Disable passwords, only use SSH key
 | 
			
		||||
      publicKeys = [
 | 
			
		||||
        "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIB+AbmjGEwITk5CK9y7+Rg27Fokgj9QEjgc9wST6MA3s personal"
 | 
			
		||||
      ];
 | 
			
		||||
      publicKey =
 | 
			
		||||
        "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIB+AbmjGEwITk5CK9y7+Rg27Fokgj9QEjgc9wST6MA3s";
 | 
			
		||||
 | 
			
		||||
      # Clone dotfiles
 | 
			
		||||
      dotfiles.enable = true;
 | 
			
		||||
 | 
			
		||||
      # services.nfs.server.enable = true;
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
  ];
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										39
									
								
								hosts/swan/hardware-configuration.nix
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										39
									
								
								hosts/swan/hardware-configuration.nix
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,39 @@
 | 
			
		||||
# Do not modify this file!  It was generated by ‘nixos-generate-config’
 | 
			
		||||
# and may be overwritten by future invocations.  Please make changes
 | 
			
		||||
# to /etc/nixos/configuration.nix instead.
 | 
			
		||||
{ config, lib, pkgs, modulesPath, ... }:
 | 
			
		||||
 | 
			
		||||
{
 | 
			
		||||
  imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
 | 
			
		||||
 | 
			
		||||
  boot.initrd.availableKernelModules =
 | 
			
		||||
    [ "xhci_pci" "ahci" "nvme" "usb_storage" "sd_mod" ];
 | 
			
		||||
  boot.initrd.kernelModules = [ ];
 | 
			
		||||
  boot.kernelModules = [ "kvm-intel" ];
 | 
			
		||||
  boot.extraModulePackages = [ ];
 | 
			
		||||
 | 
			
		||||
  # fileSystems."/" = {
 | 
			
		||||
  #   device = "/dev/disk/by-label/nixos";
 | 
			
		||||
  #   fsType = "ext4";
 | 
			
		||||
  # };
 | 
			
		||||
  #
 | 
			
		||||
  # fileSystems."/boot" = {
 | 
			
		||||
  #   device = "/dev/disk/by-label/boot";
 | 
			
		||||
  #   fsType = "vfat";
 | 
			
		||||
  # };
 | 
			
		||||
 | 
			
		||||
  swapDevices = [ ];
 | 
			
		||||
 | 
			
		||||
  # Enables DHCP on each ethernet and wireless interface. In case of scripted networking
 | 
			
		||||
  # (the default) this is the recommended approach. When using systemd-networkd it's
 | 
			
		||||
  # still possible to use this option, but it's recommended to use it in conjunction
 | 
			
		||||
  # with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
 | 
			
		||||
  networking.useDHCP = lib.mkDefault true;
 | 
			
		||||
  # networking.interfaces.enp0s31f6.useDHCP = lib.mkDefault true;
 | 
			
		||||
  # networking.interfaces.wlp3s0.useDHCP = lib.mkDefault true;
 | 
			
		||||
 | 
			
		||||
  nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
 | 
			
		||||
  powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";
 | 
			
		||||
  hardware.cpu.intel.updateMicrocode =
 | 
			
		||||
    lib.mkDefault config.hardware.enableRedistributableFirmware;
 | 
			
		||||
}
 | 
			
		||||
@@ -1,104 +1,41 @@
 | 
			
		||||
# The Tempest
 | 
			
		||||
# System configuration for my desktop
 | 
			
		||||
 | 
			
		||||
{
 | 
			
		||||
  inputs,
 | 
			
		||||
  globals,
 | 
			
		||||
  overlays,
 | 
			
		||||
  ...
 | 
			
		||||
}:
 | 
			
		||||
{ inputs, globals, overlays, ... }:
 | 
			
		||||
 | 
			
		||||
inputs.nixpkgs.lib.nixosSystem {
 | 
			
		||||
with inputs;
 | 
			
		||||
 | 
			
		||||
nixpkgs.lib.nixosSystem {
 | 
			
		||||
  system = "x86_64-linux";
 | 
			
		||||
  specialArgs = { };
 | 
			
		||||
  modules = [
 | 
			
		||||
    globals
 | 
			
		||||
    inputs.home-manager.nixosModules.home-manager
 | 
			
		||||
    ./hardware-configuration.nix
 | 
			
		||||
    ../../modules/common
 | 
			
		||||
    ../../modules/nixos
 | 
			
		||||
    globals
 | 
			
		||||
    wsl.nixosModules.wsl
 | 
			
		||||
    home-manager.nixosModules.home-manager
 | 
			
		||||
    {
 | 
			
		||||
      nixpkgs.overlays = overlays;
 | 
			
		||||
 | 
			
		||||
      # Hardware
 | 
			
		||||
      physical = true;
 | 
			
		||||
      networking.hostName = "tempest";
 | 
			
		||||
 | 
			
		||||
      # Not sure what's necessary but too afraid to remove anything
 | 
			
		||||
      boot.initrd.availableKernelModules = [
 | 
			
		||||
        "nvme"
 | 
			
		||||
        "xhci_pci"
 | 
			
		||||
        "ahci"
 | 
			
		||||
        "usb_storage"
 | 
			
		||||
        "usbhid"
 | 
			
		||||
        "sd_mod"
 | 
			
		||||
      ];
 | 
			
		||||
 | 
			
		||||
      # Graphics and VMs
 | 
			
		||||
      boot.initrd.kernelModules = [ "amdgpu" ];
 | 
			
		||||
      boot.kernelModules = [ "kvm-amd" ];
 | 
			
		||||
      services.xserver.videoDrivers = [ "amdgpu" ];
 | 
			
		||||
 | 
			
		||||
      # Required binary blobs to boot on this machine
 | 
			
		||||
      hardware.enableRedistributableFirmware = true;
 | 
			
		||||
 | 
			
		||||
      # Prioritize performance over efficiency
 | 
			
		||||
      powerManagement.cpuFreqGovernor = "performance";
 | 
			
		||||
 | 
			
		||||
      # Allow firmware updates
 | 
			
		||||
      hardware.cpu.amd.updateMicrocode = true;
 | 
			
		||||
 | 
			
		||||
      # Helps reduce GPU fan noise under idle loads
 | 
			
		||||
      hardware.fancontrol.enable = true;
 | 
			
		||||
      hardware.fancontrol.config = ''
 | 
			
		||||
        # Configuration file generated by pwmconfig, changes will be lost
 | 
			
		||||
        INTERVAL=10
 | 
			
		||||
        DEVPATH=hwmon0=devices/pci0000:00/0000:00:03.1/0000:06:00.0/0000:07:00.0/0000:08:00.0
 | 
			
		||||
        DEVNAME=hwmon0=amdgpu
 | 
			
		||||
        FCTEMPS=hwmon0/pwm1=hwmon0/temp1_input
 | 
			
		||||
        FCFANS= hwmon0/pwm1=hwmon0/fan1_input
 | 
			
		||||
        MINTEMP=hwmon0/pwm1=50
 | 
			
		||||
        MAXTEMP=hwmon0/pwm1=70
 | 
			
		||||
        MINSTART=hwmon0/pwm1=100
 | 
			
		||||
        MINSTOP=hwmon0/pwm1=10
 | 
			
		||||
        MINPWM=hwmon0/pwm1=10
 | 
			
		||||
        MAXPWM=hwmon0/pwm1=240
 | 
			
		||||
      '';
 | 
			
		||||
 | 
			
		||||
      # File systems must be declared in order to boot
 | 
			
		||||
 | 
			
		||||
      # 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";
 | 
			
		||||
      };
 | 
			
		||||
 | 
			
		||||
      # Secrets must be prepared ahead before deploying
 | 
			
		||||
      passwordHash = inputs.nixpkgs.lib.fileContents ../../misc/password.sha512;
 | 
			
		||||
 | 
			
		||||
      # Theming
 | 
			
		||||
 | 
			
		||||
      # Turn on all features related to desktop and graphical applications
 | 
			
		||||
      nixpkgs.overlays = [ nur.overlay ] ++ overlays;
 | 
			
		||||
      # Set registry to flake packages, used for nix X commands
 | 
			
		||||
      nix.registry.nixpkgs.flake = nixpkgs;
 | 
			
		||||
      identityFile = "/home/${globals.user}/.ssh/id_ed25519";
 | 
			
		||||
      gui.enable = true;
 | 
			
		||||
 | 
			
		||||
      # Set the system-wide theme, also used for non-graphical programs
 | 
			
		||||
      theme = {
 | 
			
		||||
        colors = (import ../../colorscheme/gruvbox-dark).dark;
 | 
			
		||||
        colors = (import ../../colorscheme/gruvbox).dark;
 | 
			
		||||
        dark = true;
 | 
			
		||||
      };
 | 
			
		||||
      wallpaper = "${inputs.wallpapers}/gruvbox/road.jpg";
 | 
			
		||||
      gtk.theme.name = inputs.nixpkgs.lib.mkDefault "Adwaita-dark";
 | 
			
		||||
      wallpaper = "${wallpapers}/gruvbox/road.jpg";
 | 
			
		||||
      gtk.theme.name = nixpkgs.lib.mkDefault "Adwaita-dark";
 | 
			
		||||
      passwordHash = nixpkgs.lib.fileContents ../../password.sha512;
 | 
			
		||||
      wsl.enable = false;
 | 
			
		||||
      publicKey = null;
 | 
			
		||||
 | 
			
		||||
      # Programs and services
 | 
			
		||||
      atuin.enable = true;
 | 
			
		||||
      charm.enable = true;
 | 
			
		||||
      neovim.enable = true;
 | 
			
		||||
      media.enable = true;
 | 
			
		||||
      dotfiles.enable = true;
 | 
			
		||||
      firefox.enable = true;
 | 
			
		||||
      kitty.enable = true;
 | 
			
		||||
      _1password.enable = true;
 | 
			
		||||
@@ -109,34 +46,19 @@ inputs.nixpkgs.lib.nixosSystem {
 | 
			
		||||
      mail.aerc.enable = true;
 | 
			
		||||
      mail.himalaya.enable = true;
 | 
			
		||||
      keybase.enable = true;
 | 
			
		||||
      mullvad.enable = false;
 | 
			
		||||
      rust.enable = true;
 | 
			
		||||
      terraform.enable = true;
 | 
			
		||||
      wezterm.enable = true;
 | 
			
		||||
      # mullvad.enable = true;
 | 
			
		||||
      nixlang.enable = true;
 | 
			
		||||
      dotfiles.enable = true;
 | 
			
		||||
      yt-dlp.enable = true;
 | 
			
		||||
 | 
			
		||||
      gaming = {
 | 
			
		||||
        dwarf-fortress.enable = true;
 | 
			
		||||
        enable = true;
 | 
			
		||||
        steam.enable = true;
 | 
			
		||||
        legendary.enable = true;
 | 
			
		||||
        lutris.enable = true;
 | 
			
		||||
        ryujinx.enable = true;
 | 
			
		||||
      };
 | 
			
		||||
      services.vmagent.enable = true; # Enables Prometheus metrics
 | 
			
		||||
      services.openssh.enable = true; # Required for Cloudflare tunnel and identity file
 | 
			
		||||
 | 
			
		||||
      # Allows private remote access over the internet
 | 
			
		||||
      cloudflareTunnel = {
 | 
			
		||||
        enable = true;
 | 
			
		||||
        id = "ac133a82-31fb-480c-942a-cdbcd4c58173";
 | 
			
		||||
        credentialsFile = ../../private/cloudflared-tempest.age;
 | 
			
		||||
        ca = "ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBPY6C0HmdFCaxYtJxFr3qV4/1X4Q8KrYQ1hlme3u1hJXK+xW+lc9Y9glWHrhiTKilB7carYTB80US0O47gI5yU4= open-ssh-ca@cloudflareaccess.org";
 | 
			
		||||
        leagueoflegends.enable = true;
 | 
			
		||||
      };
 | 
			
		||||
 | 
			
		||||
      # Allows requests to force machine to wake up
 | 
			
		||||
      # This network interface might change, needs to be set specifically for each machine.
 | 
			
		||||
      # Or set usePredictableInterfaceNames = false
 | 
			
		||||
      networking.interfaces.enp5s0.wakeOnLan.enable = true;
 | 
			
		||||
    }
 | 
			
		||||
  ];
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										40
									
								
								hosts/tempest/hardware-configuration.nix
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										40
									
								
								hosts/tempest/hardware-configuration.nix
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,40 @@
 | 
			
		||||
# Do not modify this file!  It was generated by ‘nixos-generate-config’
 | 
			
		||||
# and may be overwritten by future invocations.  Please make changes
 | 
			
		||||
# to /etc/nixos/configuration.nix instead.
 | 
			
		||||
{ config, lib, modulesPath, ... }:
 | 
			
		||||
 | 
			
		||||
{
 | 
			
		||||
  imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
 | 
			
		||||
 | 
			
		||||
  boot.initrd.availableKernelModules =
 | 
			
		||||
    [ "nvme" "xhci_pci" "ahci" "usb_storage" "usbhid" "sd_mod" ];
 | 
			
		||||
  boot.initrd.kernelModules = [ "amdgpu" ];
 | 
			
		||||
  boot.kernelModules = [ "kvm-amd" ];
 | 
			
		||||
  boot.extraModulePackages = [ ];
 | 
			
		||||
 | 
			
		||||
  services.xserver.videoDrivers = [ "amdgpu" ];
 | 
			
		||||
 | 
			
		||||
  fileSystems."/" = {
 | 
			
		||||
    device = "/dev/disk/by-label/nixos";
 | 
			
		||||
    fsType = "ext4";
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  fileSystems."/boot" = {
 | 
			
		||||
    device = "/dev/disk/by-label/boot";
 | 
			
		||||
    fsType = "vfat";
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  swapDevices = [ ];
 | 
			
		||||
 | 
			
		||||
  # Enables DHCP on each ethernet and wireless interface. In case of scripted networking
 | 
			
		||||
  # (the default) this is the recommended approach. When using systemd-networkd it's
 | 
			
		||||
  # still possible to use this option, but it's recommended to use it in conjunction
 | 
			
		||||
  # with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
 | 
			
		||||
  networking.useDHCP = lib.mkDefault true;
 | 
			
		||||
  # networking.interfaces.enp5s0.useDHCP = lib.mkDefault true;
 | 
			
		||||
  # networking.interfaces.wlp4s0.useDHCP = lib.mkDefault true;
 | 
			
		||||
 | 
			
		||||
  powerManagement.cpuFreqGovernor = lib.mkDefault "performance";
 | 
			
		||||
  hardware.cpu.amd.updateMicrocode =
 | 
			
		||||
    lib.mkDefault config.hardware.enableRedistributableFirmware;
 | 
			
		||||
}
 | 
			
		||||
@@ -1,21 +0,0 @@
 | 
			
		||||
# Miscellaneous
 | 
			
		||||
 | 
			
		||||
These files contain important data sourced by the configuration, or simply
 | 
			
		||||
information to store for safekeeping later.
 | 
			
		||||
 | 
			
		||||
---
 | 
			
		||||
 | 
			
		||||
Creating hashed password for [password.sha512](./password.sha512):
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
mkpasswd -m sha-512
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
---
 | 
			
		||||
 | 
			
		||||
Getting key for [public-keys](./public-keys):
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
ssh-keyscan -t ed25519 <hostname>
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
@@ -1,23 +0,0 @@
 | 
			
		||||
Profile 1: (active)
 | 
			
		||||
Name: n/a
 | 
			
		||||
Report Rate: 1000Hz
 | 
			
		||||
Resolutions:
 | 
			
		||||
  0: 400dpi (active) (default)
 | 
			
		||||
  1: 800dpi
 | 
			
		||||
  2: 1600dpi
 | 
			
		||||
  3: 2400dpi
 | 
			
		||||
  4: 0dpi
 | 
			
		||||
Button: 0 is mapped to 'button 1'
 | 
			
		||||
Button: 1 is mapped to 'button 2'
 | 
			
		||||
Button: 2 is mapped to 'button 3'
 | 
			
		||||
Button: 3 is mapped to 'button 4'
 | 
			
		||||
Button: 4 is mapped to 'button 5'
 | 
			
		||||
Button: 5 is mapped to macro '↕F11'
 | 
			
		||||
Button: 6 is mapped to macro '↕VOLUMEDOWN'
 | 
			
		||||
Button: 7 is mapped to macro '↕VOLUMEUP'
 | 
			
		||||
Button: 8 is mapped to 'unknown'
 | 
			
		||||
Button: 9 is mapped to 'wheel-right'
 | 
			
		||||
Button: 10 is mapped to 'wheel-left'
 | 
			
		||||
LED: 0, depth: monochrome, mode: on, color: 000000
 | 
			
		||||
LED: 1, depth: monochrome, mode: on, color: 000000
 | 
			
		||||
LED: 2, depth: monochrome, mode: on, color: 000000
 | 
			
		||||
@@ -1,9 +0,0 @@
 | 
			
		||||
# Modules
 | 
			
		||||
 | 
			
		||||
| Module                         | Purpose                                     |
 | 
			
		||||
| ---                            | ---                                         |
 | 
			
		||||
| [common](./common/default.nix) | User programs and OS-agnostic configuration |
 | 
			
		||||
| [darwin](./darwin/default.nix) | macOS-specific configuration                |
 | 
			
		||||
| [nixos](./nixos/default.nix)   | NixOS-specific configuration                |
 | 
			
		||||
| [wsl](./wsl/default.nix)       | WSL-specific configuration                  |
 | 
			
		||||
 | 
			
		||||
@@ -1,9 +0,0 @@
 | 
			
		||||
{ ... }:
 | 
			
		||||
{
 | 
			
		||||
  # AWS settings require this
 | 
			
		||||
  permitRootLogin = "prohibit-password";
 | 
			
		||||
 | 
			
		||||
  # Make sure disk size is large enough
 | 
			
		||||
  # https://github.com/nix-community/nixos-generators/issues/150
 | 
			
		||||
  amazonImage.sizeMB = 16 * 1024;
 | 
			
		||||
}
 | 
			
		||||
@@ -1,10 +1,4 @@
 | 
			
		||||
{
 | 
			
		||||
  config,
 | 
			
		||||
  pkgs,
 | 
			
		||||
  lib,
 | 
			
		||||
  ...
 | 
			
		||||
}:
 | 
			
		||||
{
 | 
			
		||||
{ config, pkgs, lib, ... }: {
 | 
			
		||||
 | 
			
		||||
  options = {
 | 
			
		||||
    _1password = {
 | 
			
		||||
@@ -15,28 +9,12 @@
 | 
			
		||||
    };
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  config = lib.mkIf (config.gui.enable && config._1password.enable) {
 | 
			
		||||
    unfreePackages = [
 | 
			
		||||
      "1password"
 | 
			
		||||
      "_1password-gui"
 | 
			
		||||
      "1password-cli"
 | 
			
		||||
    ];
 | 
			
		||||
  config = lib.mkIf
 | 
			
		||||
    (config.gui.enable && config._1password.enable && pkgs.stdenv.isLinux) {
 | 
			
		||||
      unfreePackages = with pkgs; [ _1password _1password-gui ];
 | 
			
		||||
      home-manager.users.${config.user} = {
 | 
			
		||||
      home.packages = with pkgs; [
 | 
			
		||||
        _1password-gui
 | 
			
		||||
        _1password
 | 
			
		||||
      ];
 | 
			
		||||
        home.packages = with pkgs; [ _1password-gui ];
 | 
			
		||||
      };
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    # https://1password.community/discussion/135462/firefox-extension-does-not-connect-to-linux-app
 | 
			
		||||
    # On Mac, does not apply: https://1password.community/discussion/142794/app-and-browser-integration
 | 
			
		||||
    # However, the button doesn't work either:
 | 
			
		||||
    # https://1password.community/discussion/140735/extending-support-for-trusted-web-browsers
 | 
			
		||||
    environment.etc."1password/custom_allowed_browsers".text = ''
 | 
			
		||||
      ${
 | 
			
		||||
        config.home-manager.users.${config.user}.programs.firefox.package
 | 
			
		||||
      }/Applications/Firefox.app/Contents/MacOS/firefox
 | 
			
		||||
      firefox
 | 
			
		||||
    '';
 | 
			
		||||
  };
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,10 +1,4 @@
 | 
			
		||||
{
 | 
			
		||||
  config,
 | 
			
		||||
  pkgs,
 | 
			
		||||
  lib,
 | 
			
		||||
  ...
 | 
			
		||||
}:
 | 
			
		||||
{
 | 
			
		||||
{ config, pkgs, lib, ... }: {
 | 
			
		||||
 | 
			
		||||
  options = {
 | 
			
		||||
    alacritty = {
 | 
			
		||||
@@ -34,9 +28,7 @@
 | 
			
		||||
            opacity = 1.0;
 | 
			
		||||
          };
 | 
			
		||||
          scrolling.history = 10000;
 | 
			
		||||
          font = {
 | 
			
		||||
            size = 14.0;
 | 
			
		||||
          };
 | 
			
		||||
          font = { size = 14.0; };
 | 
			
		||||
          key_bindings = [
 | 
			
		||||
            # Used for word completion in fish_user_key_bindings
 | 
			
		||||
            {
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,4 @@
 | 
			
		||||
{ ... }:
 | 
			
		||||
{
 | 
			
		||||
{ ... }: {
 | 
			
		||||
 | 
			
		||||
  imports = [
 | 
			
		||||
    ./1password.nix
 | 
			
		||||
@@ -8,10 +7,11 @@
 | 
			
		||||
    ./firefox.nix
 | 
			
		||||
    ./kitty.nix
 | 
			
		||||
    ./media.nix
 | 
			
		||||
    ./nautilus.nix
 | 
			
		||||
    ./obsidian.nix
 | 
			
		||||
    ./qbittorrent.nix
 | 
			
		||||
    ./slack.nix
 | 
			
		||||
    ./wezterm.nix
 | 
			
		||||
    ./yt-dlp.nix
 | 
			
		||||
  ];
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,10 +1,4 @@
 | 
			
		||||
{
 | 
			
		||||
  config,
 | 
			
		||||
  pkgs,
 | 
			
		||||
  lib,
 | 
			
		||||
  ...
 | 
			
		||||
}:
 | 
			
		||||
{
 | 
			
		||||
{ config, pkgs, lib, ... }: {
 | 
			
		||||
 | 
			
		||||
  options = {
 | 
			
		||||
    discord = {
 | 
			
		||||
@@ -16,9 +10,9 @@
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  config = lib.mkIf (config.gui.enable && config.discord.enable) {
 | 
			
		||||
    unfreePackages = [ "discord" ];
 | 
			
		||||
    environment.systemPackages = [ pkgs.discord ];
 | 
			
		||||
    unfreePackages = [ pkgs.discord ];
 | 
			
		||||
    home-manager.users.${config.user} = {
 | 
			
		||||
      home.packages = with pkgs; [ discord ];
 | 
			
		||||
      xdg.configFile."discord/settings.json".text = ''
 | 
			
		||||
        {
 | 
			
		||||
          "BACKGROUND_COLOR": "#202225",
 | 
			
		||||
 
 | 
			
		||||
@@ -1,9 +1,4 @@
 | 
			
		||||
{
 | 
			
		||||
  config,
 | 
			
		||||
  pkgs,
 | 
			
		||||
  lib,
 | 
			
		||||
  ...
 | 
			
		||||
}:
 | 
			
		||||
{ config, pkgs, lib, ... }:
 | 
			
		||||
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
@@ -18,59 +13,64 @@
 | 
			
		||||
 | 
			
		||||
  config = lib.mkIf (config.gui.enable && config.firefox.enable) {
 | 
			
		||||
 | 
			
		||||
    unfreePackages = [
 | 
			
		||||
      (lib.mkIf config._1password.enable "onepassword-password-manager")
 | 
			
		||||
      "okta-browser-plugin"
 | 
			
		||||
    unfreePackages = with pkgs.nur.repos.rycee.firefox-addons; [
 | 
			
		||||
      (lib.mkIf config._1password.enable onepassword-password-manager)
 | 
			
		||||
      okta-browser-plugin
 | 
			
		||||
    ];
 | 
			
		||||
 | 
			
		||||
    home-manager.users.${config.user} = {
 | 
			
		||||
 | 
			
		||||
      programs.firefox = {
 | 
			
		||||
        enable = true;
 | 
			
		||||
        package = if pkgs.stdenv.isDarwin then pkgs.firefox-bin else pkgs.firefox;
 | 
			
		||||
        package =
 | 
			
		||||
          if pkgs.stdenv.isDarwin then pkgs.firefox-bin else pkgs.firefox;
 | 
			
		||||
        profiles.default = {
 | 
			
		||||
          id = 0;
 | 
			
		||||
          name = "default";
 | 
			
		||||
          isDefault = true;
 | 
			
		||||
          # https://nur.nix-community.org/repos/rycee/
 | 
			
		||||
          extensions = with pkgs.nur.repos.rycee.firefox-addons; [
 | 
			
		||||
            (lib.mkIf config._1password.enable onepassword-password-manager)
 | 
			
		||||
            darkreader
 | 
			
		||||
            don-t-fuck-with-paste
 | 
			
		||||
            facebook-container
 | 
			
		||||
            markdownload
 | 
			
		||||
            ublock-origin
 | 
			
		||||
            vimium
 | 
			
		||||
            multi-account-containers
 | 
			
		||||
            facebook-container
 | 
			
		||||
            temporary-containers
 | 
			
		||||
            (lib.mkIf config._1password.enable onepassword-password-manager)
 | 
			
		||||
            okta-browser-plugin
 | 
			
		||||
            sponsorblock
 | 
			
		||||
            reddit-enhancement-suite
 | 
			
		||||
            return-youtube-dislikes
 | 
			
		||||
            sponsorblock
 | 
			
		||||
            ublock-origin
 | 
			
		||||
            ublacklist
 | 
			
		||||
            vimium
 | 
			
		||||
            markdownload
 | 
			
		||||
            darkreader
 | 
			
		||||
            snowflake
 | 
			
		||||
            don-t-fuck-with-paste
 | 
			
		||||
            i-dont-care-about-cookies
 | 
			
		||||
            wappalyzer
 | 
			
		||||
          ];
 | 
			
		||||
          settings = {
 | 
			
		||||
            "app.update.auto" = false;
 | 
			
		||||
            "browser.aboutConfig.showWarning" = false;
 | 
			
		||||
            "browser.warnOnQuit" = false;
 | 
			
		||||
            "browser.quitShortcut.disabled" = if pkgs.stdenv.isLinux then true else false;
 | 
			
		||||
            "browser.quitShortcut.disabled" =
 | 
			
		||||
              if pkgs.stdenv.isLinux then true else false;
 | 
			
		||||
            "browser.theme.dark-private-windows" = true;
 | 
			
		||||
            "browser.toolbars.bookmarks.visibility" = false;
 | 
			
		||||
            "browser.startup.page" = 3; # Restore previous session
 | 
			
		||||
            "browser.newtabpage.enabled" = false; # Make new tabs blank
 | 
			
		||||
            "trailhead.firstrun.didSeeAboutWelcome" = true; # Disable welcome splash
 | 
			
		||||
            "trailhead.firstrun.didSeeAboutWelcome" =
 | 
			
		||||
              true; # Disable welcome splash
 | 
			
		||||
            "dom.forms.autocomplete.formautofill" = false; # Disable autofill
 | 
			
		||||
            "extensions.formautofill.creditCards.enabled" = false; # Disable credit cards
 | 
			
		||||
            "extensions.formautofill.creditCards.enabled" =
 | 
			
		||||
              false; # Disable credit cards
 | 
			
		||||
            "dom.payments.defaults.saveAddress" = false; # Disable address save
 | 
			
		||||
            "general.autoScroll" = true; # Drag middle-mouse to scroll
 | 
			
		||||
            "services.sync.prefs.sync.general.autoScroll" = false; # Prevent disabling autoscroll
 | 
			
		||||
            "services.sync.prefs.sync.general.autoScroll" =
 | 
			
		||||
              false; # Prevent disabling autoscroll
 | 
			
		||||
            "extensions.pocket.enabled" = false;
 | 
			
		||||
            "toolkit.legacyUserProfileCustomizations.stylesheets" = true; # Allow userChrome.css
 | 
			
		||||
            "toolkit.legacyUserProfileCustomizations.stylesheets" =
 | 
			
		||||
              true; # Allow userChrome.css
 | 
			
		||||
            "layout.css.color-mix.enabled" = true;
 | 
			
		||||
            "ui.systemUsesDarkTheme" = if config.theme.dark == true then 1 else 0;
 | 
			
		||||
            "media.ffmpeg.vaapi.enabled" = true; # Enable hardware video acceleration
 | 
			
		||||
            "cookiebanners.ui.desktop.enabled" = true; # Reject cookie popups
 | 
			
		||||
            "devtools.command-button-screenshot.enabled" = true; # Scrolling screenshot of entire page
 | 
			
		||||
            "svg.context-properties.content.enabled" = true; # Sidebery styling
 | 
			
		||||
            "ui.systemUsesDarkTheme" =
 | 
			
		||||
              if config.theme.dark == true then 1 else 0;
 | 
			
		||||
          };
 | 
			
		||||
          userChrome = ''
 | 
			
		||||
            :root {
 | 
			
		||||
@@ -111,7 +111,7 @@
 | 
			
		||||
              background-color: ${config.theme.colors.base00};
 | 
			
		||||
              color: ${config.theme.colors.base06} !important;
 | 
			
		||||
            }
 | 
			
		||||
            .tab-content[selected] {
 | 
			
		||||
            .tab-content[selected=true] {
 | 
			
		||||
              border-bottom: 2px solid color-mix(in srgb, var(--identity-tab-color) 25%, transparent);
 | 
			
		||||
              background-color: ${config.theme.colors.base01} !important;
 | 
			
		||||
              color: ${config.theme.colors.base07} !important;
 | 
			
		||||
@@ -155,38 +155,10 @@
 | 
			
		||||
 | 
			
		||||
          extraConfig = "";
 | 
			
		||||
        };
 | 
			
		||||
      };
 | 
			
		||||
 | 
			
		||||
      xdg.mimeApps = {
 | 
			
		||||
        associations.added = {
 | 
			
		||||
          "text/html" = [ "firefox.desktop" ];
 | 
			
		||||
      };
 | 
			
		||||
        defaultApplications = {
 | 
			
		||||
          "text/html" = [ "firefox.desktop" ];
 | 
			
		||||
        };
 | 
			
		||||
        associations.removed = {
 | 
			
		||||
          "text/html" = [ "wine-extension-htm.desktop" ];
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
      xsession.windowManager.i3.config.keybindings = lib.mkIf pkgs.stdenv.isLinux {
 | 
			
		||||
        "${
 | 
			
		||||
          config.home-manager.users.${config.user}.xsession.windowManager.i3.config.modifier
 | 
			
		||||
        }+Shift+b" = "exec ${
 | 
			
		||||
          # Don't name the script `firefox` or it will affect grep
 | 
			
		||||
          builtins.toString (
 | 
			
		||||
            pkgs.writeShellScript "focus-ff.sh" ''
 | 
			
		||||
              count=$(ps aux | grep -c firefox)
 | 
			
		||||
              if [ "$count" -eq 1 ]; then
 | 
			
		||||
                  i3-msg "exec --no-startup-id firefox"
 | 
			
		||||
                  sleep 0.5
 | 
			
		||||
              fi
 | 
			
		||||
              i3-msg "[class=firefox] focus"
 | 
			
		||||
            ''
 | 
			
		||||
          )
 | 
			
		||||
        }";
 | 
			
		||||
      };
 | 
			
		||||
    };
 | 
			
		||||
  };
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,10 +1,4 @@
 | 
			
		||||
{
 | 
			
		||||
  config,
 | 
			
		||||
  pkgs,
 | 
			
		||||
  lib,
 | 
			
		||||
  ...
 | 
			
		||||
}:
 | 
			
		||||
{
 | 
			
		||||
{ config, pkgs, lib, ... }: {
 | 
			
		||||
 | 
			
		||||
  options = {
 | 
			
		||||
    kitty = {
 | 
			
		||||
@@ -16,42 +10,16 @@
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  config = lib.mkIf (config.gui.enable && config.kitty.enable) {
 | 
			
		||||
 | 
			
		||||
    # Set the Rofi-Systemd terminal for viewing logs
 | 
			
		||||
    # Using optionalAttrs because only available in NixOS
 | 
			
		||||
    environment =
 | 
			
		||||
      { }
 | 
			
		||||
      // lib.attrsets.optionalAttrs (builtins.hasAttr "sessionVariables" config.environment) {
 | 
			
		||||
        sessionVariables.ROFI_SYSTEMD_TERM = lib.mkDefault "${pkgs.kitty}/bin/kitty";
 | 
			
		||||
      };
 | 
			
		||||
 | 
			
		||||
    home-manager.users.${config.user} = {
 | 
			
		||||
 | 
			
		||||
      # Set the i3 terminal
 | 
			
		||||
      xsession.windowManager.i3.config.terminal = lib.mkIf pkgs.stdenv.isLinux "kitty";
 | 
			
		||||
 | 
			
		||||
      # Set the Rofi terminal for running programs
 | 
			
		||||
      programs.rofi.terminal = lib.mkIf pkgs.stdenv.isLinux (lib.mkDefault "${pkgs.kitty}/bin/kitty");
 | 
			
		||||
 | 
			
		||||
      # Display images in the terminal
 | 
			
		||||
      programs.fish.interactiveShellInit = # fish
 | 
			
		||||
        ''
 | 
			
		||||
          if test "$TERM" = "xterm-kitty"
 | 
			
		||||
              alias icat="kitty +kitten icat"
 | 
			
		||||
              alias ssh="kitty +kitten ssh"
 | 
			
		||||
          end
 | 
			
		||||
        '';
 | 
			
		||||
 | 
			
		||||
      # xsession.windowManager.i3.config.terminal = "kitty";
 | 
			
		||||
      # programs.rofi.terminal = "${pkgs.kitty}/bin/kitty";
 | 
			
		||||
      programs.kitty = {
 | 
			
		||||
        enable = true;
 | 
			
		||||
        environment = { };
 | 
			
		||||
        extraConfig = "";
 | 
			
		||||
        font.size = 14;
 | 
			
		||||
        keybindings = {
 | 
			
		||||
          # Use shift+enter to complete text suggestions in fish
 | 
			
		||||
          "shift+enter" = "send_text all \\x1F";
 | 
			
		||||
 | 
			
		||||
          # Easy fullscreen toggle (for macOS)
 | 
			
		||||
          "super+f" = "toggle_fullscreen";
 | 
			
		||||
        };
 | 
			
		||||
        settings = {
 | 
			
		||||
@@ -100,8 +68,10 @@
 | 
			
		||||
          color21 = config.theme.colors.base06;
 | 
			
		||||
 | 
			
		||||
          # Scrollback
 | 
			
		||||
          scrollback_lines = 10000;
 | 
			
		||||
          scrollback_pager_history_size = 300; # MB
 | 
			
		||||
          scrolling_lines = 10000;
 | 
			
		||||
          scrollback_pager_history_size = 10; # MB
 | 
			
		||||
          scrollback_pager = ''
 | 
			
		||||
            ${pkgs.neovim}/bin/nvim -c 'setlocal nonumber nolist showtabline=0 foldcolumn=0|Man!' -c "autocmd VimEnter * normal G" -'';
 | 
			
		||||
 | 
			
		||||
          # Window
 | 
			
		||||
          window_padding_width = 6;
 | 
			
		||||
@@ -109,7 +79,7 @@
 | 
			
		||||
          tab_bar_edge = "top";
 | 
			
		||||
          tab_bar_style = "slant";
 | 
			
		||||
 | 
			
		||||
          # Disable audio
 | 
			
		||||
          # Audio
 | 
			
		||||
          enable_audio_bell = false;
 | 
			
		||||
        };
 | 
			
		||||
      };
 | 
			
		||||
 
 | 
			
		||||
@@ -1,10 +1,4 @@
 | 
			
		||||
{
 | 
			
		||||
  config,
 | 
			
		||||
  pkgs,
 | 
			
		||||
  lib,
 | 
			
		||||
  ...
 | 
			
		||||
}:
 | 
			
		||||
{
 | 
			
		||||
{ config, pkgs, lib, ... }: {
 | 
			
		||||
 | 
			
		||||
  options = {
 | 
			
		||||
    media = {
 | 
			
		||||
@@ -18,50 +12,27 @@
 | 
			
		||||
  config = lib.mkIf (config.gui.enable && config.media.enable) {
 | 
			
		||||
    home-manager.users.${config.user} = {
 | 
			
		||||
      home.packages = with pkgs; [
 | 
			
		||||
        nsxiv # Image viewer
 | 
			
		||||
        mpv # Video viewer
 | 
			
		||||
        sxiv # Image viewer
 | 
			
		||||
        mupdf # PDF viewer
 | 
			
		||||
        zathura # PDF viewer
 | 
			
		||||
      ];
 | 
			
		||||
 | 
			
		||||
      # Video player
 | 
			
		||||
      programs.mpv = {
 | 
			
		||||
        enable = true;
 | 
			
		||||
        bindings = { };
 | 
			
		||||
        config = {
 | 
			
		||||
          image-display-duration = 2; # For cycling through images
 | 
			
		||||
          hwdec = "auto-safe"; # Attempt to use GPU decoding for video
 | 
			
		||||
        };
 | 
			
		||||
        scripts = [
 | 
			
		||||
 | 
			
		||||
          # Automatically load playlist entries before and after current file
 | 
			
		||||
          pkgs.mpvScripts.autoload
 | 
			
		||||
 | 
			
		||||
          # Delete current file after quitting
 | 
			
		||||
          pkgs.mpvScripts.mpv-delete-file
 | 
			
		||||
        ];
 | 
			
		||||
      };
 | 
			
		||||
 | 
			
		||||
      # Set default programs for opening PDFs and other media
 | 
			
		||||
      # Set default for opening PDFs
 | 
			
		||||
      xdg.mimeApps = {
 | 
			
		||||
        associations.added = {
 | 
			
		||||
          "application/pdf" = [ "pwmt.zathura-cb.desktop" ];
 | 
			
		||||
          "image/jpeg" = [ "nsxiv.desktop" ];
 | 
			
		||||
          "image/png" = [ "nsxiv.desktop" ];
 | 
			
		||||
          "image/*" = [ "nsxiv.desktop" ];
 | 
			
		||||
        };
 | 
			
		||||
        associations.removed = {
 | 
			
		||||
          "application/pdf" = [
 | 
			
		||||
            "mupdf.desktop"
 | 
			
		||||
            "wine-extension-pdf.desktop"
 | 
			
		||||
          ];
 | 
			
		||||
          "image/*" = [ "sxiv.desktop" ];
 | 
			
		||||
        };
 | 
			
		||||
        associations.removed = { "application/pdf" = [ "mupdf.desktop" ]; };
 | 
			
		||||
        defaultApplications = {
 | 
			
		||||
          "application/pdf" = [ "pwmt.zathura-cb.desktop" ];
 | 
			
		||||
          "image/jpeg" = [ "nsxiv.desktop" ];
 | 
			
		||||
          "image/png" = [ "nsxiv.desktop" ];
 | 
			
		||||
          "image/*" = [ "nsxiv.desktop" ];
 | 
			
		||||
          "image/*" = [ "sxiv.desktop" ];
 | 
			
		||||
        };
 | 
			
		||||
      };
 | 
			
		||||
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										34
									
								
								modules/common/applications/nautilus.nix
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										34
									
								
								modules/common/applications/nautilus.nix
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,34 @@
 | 
			
		||||
{ config, pkgs, lib, ... }: {
 | 
			
		||||
 | 
			
		||||
  options = {
 | 
			
		||||
    nautilus = {
 | 
			
		||||
      enable = lib.mkEnableOption {
 | 
			
		||||
        description = "Enable Nautilus file manager.";
 | 
			
		||||
        default = false;
 | 
			
		||||
      };
 | 
			
		||||
    };
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  # Install Nautilus file manager
 | 
			
		||||
  config = lib.mkIf (config.gui.enable && config.nautilus.enable) {
 | 
			
		||||
    home-manager.users.${config.user} = {
 | 
			
		||||
      home.packages = with pkgs; [
 | 
			
		||||
        gnome.nautilus
 | 
			
		||||
        gnome.sushi # Quick preview with spacebar
 | 
			
		||||
      ];
 | 
			
		||||
 | 
			
		||||
      # Set default for opening directories
 | 
			
		||||
      xdg.mimeApps.defaultApplications."inode/directory" =
 | 
			
		||||
        [ "nautilus.desktop" ];
 | 
			
		||||
 | 
			
		||||
      programs.fish.functions = {
 | 
			
		||||
        qr = {
 | 
			
		||||
          body =
 | 
			
		||||
            "${pkgs.qrencode}/bin/qrencode $argv[1] -o /tmp/qr.png | ${pkgs.gnome.sushi}/bin/sushi /tmp/qr.png";
 | 
			
		||||
        };
 | 
			
		||||
      };
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -1,10 +1,4 @@
 | 
			
		||||
{
 | 
			
		||||
  config,
 | 
			
		||||
  pkgs,
 | 
			
		||||
  lib,
 | 
			
		||||
  ...
 | 
			
		||||
}:
 | 
			
		||||
{
 | 
			
		||||
{ config, pkgs, lib, ... }: {
 | 
			
		||||
 | 
			
		||||
  options = {
 | 
			
		||||
    obsidian = {
 | 
			
		||||
@@ -16,13 +10,10 @@
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  config = lib.mkIf (config.gui.enable && config.obsidian.enable) {
 | 
			
		||||
    unfreePackages = [ "obsidian" ];
 | 
			
		||||
    unfreePackages = [ pkgs.obsidian ];
 | 
			
		||||
    home-manager.users.${config.user} = {
 | 
			
		||||
      home.packages = with pkgs; [ obsidian ];
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    # Broken on 2023-12-11
 | 
			
		||||
    # https://forum.obsidian.md/t/electron-25-is-now-eol-please-upgrade-to-a-newer-version/72878/8
 | 
			
		||||
    nixpkgs.config.permittedInsecurePackages = [ "electron-25.9.0" ];
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,10 +1,4 @@
 | 
			
		||||
{
 | 
			
		||||
  config,
 | 
			
		||||
  pkgs,
 | 
			
		||||
  lib,
 | 
			
		||||
  ...
 | 
			
		||||
}:
 | 
			
		||||
{
 | 
			
		||||
{ config, pkgs, lib, ... }: {
 | 
			
		||||
 | 
			
		||||
  options = {
 | 
			
		||||
    qbittorrent = {
 | 
			
		||||
@@ -20,6 +14,8 @@
 | 
			
		||||
    home-manager.users.${config.user} = {
 | 
			
		||||
 | 
			
		||||
      home.packages = with pkgs; [ qbittorrent ];
 | 
			
		||||
 | 
			
		||||
    };
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,10 +1,4 @@
 | 
			
		||||
{
 | 
			
		||||
  config,
 | 
			
		||||
  pkgs,
 | 
			
		||||
  lib,
 | 
			
		||||
  ...
 | 
			
		||||
}:
 | 
			
		||||
{
 | 
			
		||||
{ config, pkgs, lib, ... }: {
 | 
			
		||||
 | 
			
		||||
  options = {
 | 
			
		||||
    slack = {
 | 
			
		||||
@@ -16,9 +10,10 @@
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  config = lib.mkIf (config.gui.enable && config.slack.enable) {
 | 
			
		||||
    unfreePackages = [ "slack" ];
 | 
			
		||||
    unfreePackages = [ pkgs.slack ];
 | 
			
		||||
    home-manager.users.${config.user} = {
 | 
			
		||||
      home.packages = with pkgs; [ slack ];
 | 
			
		||||
    };
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,235 +0,0 @@
 | 
			
		||||
{
 | 
			
		||||
  config,
 | 
			
		||||
  pkgs,
 | 
			
		||||
  lib,
 | 
			
		||||
  ...
 | 
			
		||||
}:
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
  options = {
 | 
			
		||||
    wezterm = {
 | 
			
		||||
      enable = lib.mkEnableOption {
 | 
			
		||||
        description = "Enable WezTerm terminal.";
 | 
			
		||||
        default = false;
 | 
			
		||||
      };
 | 
			
		||||
    };
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  config =
 | 
			
		||||
    let
 | 
			
		||||
      font = config.home-manager.users.${config.user}.programs.kitty.font.name;
 | 
			
		||||
    in
 | 
			
		||||
    lib.mkIf (config.gui.enable && config.wezterm.enable) {
 | 
			
		||||
 | 
			
		||||
      # Set the Rofi-Systemd terminal for viewing logs
 | 
			
		||||
      # Using optionalAttrs because only available in NixOS
 | 
			
		||||
      environment =
 | 
			
		||||
        { }
 | 
			
		||||
        // lib.attrsets.optionalAttrs (builtins.hasAttr "sessionVariables" config.environment) {
 | 
			
		||||
          sessionVariables.ROFI_SYSTEMD_TERM = "${pkgs.wezterm}/bin/wezterm";
 | 
			
		||||
        };
 | 
			
		||||
 | 
			
		||||
      home-manager.users.${config.user} = {
 | 
			
		||||
 | 
			
		||||
        # Set the i3 terminal
 | 
			
		||||
        xsession.windowManager.i3.config.terminal = lib.mkIf pkgs.stdenv.isLinux "wezterm";
 | 
			
		||||
 | 
			
		||||
        # Set the Rofi terminal for running programs
 | 
			
		||||
        programs.rofi.terminal = lib.mkIf pkgs.stdenv.isLinux "${pkgs.wezterm}/bin/wezterm";
 | 
			
		||||
 | 
			
		||||
        # Display images in the terminal
 | 
			
		||||
        programs.fish.shellAliases = {
 | 
			
		||||
          icat = lib.mkForce "wezterm imgcat";
 | 
			
		||||
        };
 | 
			
		||||
 | 
			
		||||
        programs.wezterm = {
 | 
			
		||||
          enable = true;
 | 
			
		||||
          colorSchemes = {
 | 
			
		||||
            myTheme = {
 | 
			
		||||
              background = config.theme.colors.base00;
 | 
			
		||||
              foreground = config.theme.colors.base05;
 | 
			
		||||
              cursor_bg = config.theme.colors.base05;
 | 
			
		||||
              cursor_fg = config.theme.colors.base00;
 | 
			
		||||
              cursor_border = config.theme.colors.base05;
 | 
			
		||||
              selection_bg = config.theme.colors.base05;
 | 
			
		||||
              selection_fg = config.theme.colors.base00;
 | 
			
		||||
              scrollbar_thumb = config.theme.colors.base03;
 | 
			
		||||
              ansi = [
 | 
			
		||||
                config.theme.colors.base01 # black
 | 
			
		||||
                config.theme.colors.base0F # maroon
 | 
			
		||||
                config.theme.colors.base0B # green
 | 
			
		||||
                config.theme.colors.base0A # olive
 | 
			
		||||
                config.theme.colors.base0D # navy
 | 
			
		||||
                config.theme.colors.base0E # purple
 | 
			
		||||
                config.theme.colors.base0C # teal
 | 
			
		||||
                config.theme.colors.base06 # silver
 | 
			
		||||
              ];
 | 
			
		||||
              brights = [
 | 
			
		||||
                config.theme.colors.base03 # grey
 | 
			
		||||
                config.theme.colors.base08 # red
 | 
			
		||||
                config.theme.colors.base0B # lime
 | 
			
		||||
                config.theme.colors.base0A # yellow
 | 
			
		||||
                config.theme.colors.base0D # blue
 | 
			
		||||
                config.theme.colors.base0E # fuchsia
 | 
			
		||||
                config.theme.colors.base0C # aqua
 | 
			
		||||
                config.theme.colors.base07 # white
 | 
			
		||||
              ];
 | 
			
		||||
              compose_cursor = config.theme.colors.base09; # orange
 | 
			
		||||
              copy_mode_active_highlight_bg = {
 | 
			
		||||
                Color = config.theme.colors.base03;
 | 
			
		||||
              };
 | 
			
		||||
              copy_mode_active_highlight_fg = {
 | 
			
		||||
                Color = config.theme.colors.base07;
 | 
			
		||||
              };
 | 
			
		||||
              copy_mode_inactive_highlight_bg = {
 | 
			
		||||
                Color = config.theme.colors.base02;
 | 
			
		||||
              };
 | 
			
		||||
              copy_mode_inactive_highlight_fg = {
 | 
			
		||||
                Color = config.theme.colors.base06;
 | 
			
		||||
              };
 | 
			
		||||
              quick_select_label_bg = {
 | 
			
		||||
                Color = config.theme.colors.base02;
 | 
			
		||||
              };
 | 
			
		||||
              quick_select_label_fg = {
 | 
			
		||||
                Color = config.theme.colors.base06;
 | 
			
		||||
              };
 | 
			
		||||
              quick_select_match_bg = {
 | 
			
		||||
                Color = config.theme.colors.base03;
 | 
			
		||||
              };
 | 
			
		||||
              quick_select_match_fg = {
 | 
			
		||||
                Color = config.theme.colors.base07;
 | 
			
		||||
              };
 | 
			
		||||
            };
 | 
			
		||||
          };
 | 
			
		||||
          extraConfig = ''
 | 
			
		||||
            return {
 | 
			
		||||
                color_scheme = "myTheme",
 | 
			
		||||
 | 
			
		||||
                -- Scrollback
 | 
			
		||||
                scrollback_lines = 10000,
 | 
			
		||||
 | 
			
		||||
                -- Window
 | 
			
		||||
                window_padding = {
 | 
			
		||||
                  left = 10,
 | 
			
		||||
                  right = 10,
 | 
			
		||||
                  top = 10,
 | 
			
		||||
                  bottom = 10,
 | 
			
		||||
                },
 | 
			
		||||
 | 
			
		||||
                font = wezterm.font('${font}', { weight = 'Bold'}),
 | 
			
		||||
                font_size = ${if pkgs.stdenv.isLinux then "14.0" else "18.0"},
 | 
			
		||||
 | 
			
		||||
                -- Tab Bar
 | 
			
		||||
                hide_tab_bar_if_only_one_tab = true,
 | 
			
		||||
                window_frame = {
 | 
			
		||||
                  font = wezterm.font('${font}', { weight = 'Bold'}),
 | 
			
		||||
                  font_size = ${if pkgs.stdenv.isLinux then "12.0" else "16.0"},
 | 
			
		||||
                },
 | 
			
		||||
 | 
			
		||||
                colors = {
 | 
			
		||||
                  tab_bar = {
 | 
			
		||||
                    active_tab = {
 | 
			
		||||
                      bg_color = '${config.theme.colors.base00}',
 | 
			
		||||
                      fg_color = '${config.theme.colors.base04}',
 | 
			
		||||
                    },
 | 
			
		||||
                  },
 | 
			
		||||
                },
 | 
			
		||||
 | 
			
		||||
                -- Disable audio
 | 
			
		||||
                audible_bell = "Disabled",
 | 
			
		||||
 | 
			
		||||
                initial_rows = 80,
 | 
			
		||||
                initial_cols = 200,
 | 
			
		||||
 | 
			
		||||
                keys = {
 | 
			
		||||
                  -- sends completion string for fish autosuggestions
 | 
			
		||||
                  {
 | 
			
		||||
                    key = 'Enter',
 | 
			
		||||
                    mods = 'SHIFT',
 | 
			
		||||
                    action = wezterm.action.SendString '\x1F'
 | 
			
		||||
                  },
 | 
			
		||||
                  -- ctrl-shift-h was "hide"
 | 
			
		||||
                  {
 | 
			
		||||
                    key = 'H',
 | 
			
		||||
                    mods = 'SHIFT|CTRL',
 | 
			
		||||
                    action = wezterm.action.DisableDefaultAssignment
 | 
			
		||||
                  },
 | 
			
		||||
                  -- alt-enter was "fullscreen"
 | 
			
		||||
                  {
 | 
			
		||||
                    key = 'Enter',
 | 
			
		||||
                    mods = 'ALT',
 | 
			
		||||
                    action = wezterm.action.DisableDefaultAssignment
 | 
			
		||||
                  },
 | 
			
		||||
                  -- make super-f "fullscreen"
 | 
			
		||||
                  {
 | 
			
		||||
                    key = 'f',
 | 
			
		||||
                    mods = 'SUPER',
 | 
			
		||||
                    action = wezterm.action.ToggleFullScreen
 | 
			
		||||
                  },
 | 
			
		||||
                  -- super-t open new tab in new dir
 | 
			
		||||
                  {
 | 
			
		||||
                    key = 't',
 | 
			
		||||
                    mods = 'SUPER',
 | 
			
		||||
                    action = wezterm.action.SpawnCommandInNewTab {
 | 
			
		||||
                      cwd = wezterm.home_dir,
 | 
			
		||||
                    },
 | 
			
		||||
                  },
 | 
			
		||||
                  -- shift-super-t open new tab in same dir
 | 
			
		||||
                  {
 | 
			
		||||
                    key = 't',
 | 
			
		||||
                    mods = 'SUPER|SHIFT',
 | 
			
		||||
                    action = wezterm.action.SpawnTab 'CurrentPaneDomain'
 | 
			
		||||
                  },
 | 
			
		||||
                  -- project switcher
 | 
			
		||||
                  {
 | 
			
		||||
                     key = 'P',
 | 
			
		||||
                     mods = 'SUPER',
 | 
			
		||||
                     action = wezterm.action_callback(function(window, pane)
 | 
			
		||||
                       local choices = {}
 | 
			
		||||
 | 
			
		||||
                       wezterm.log_info "working?"
 | 
			
		||||
 | 
			
		||||
                       function scandir(directory)
 | 
			
		||||
                           local i, t, popen = 0, {}, io.popen
 | 
			
		||||
                           local pfile = popen('${pkgs.fd}/bin/fd --search-path "'..directory..'" --type directory --exact-depth 2 | ${pkgs.proximity-sort}/bin/proximity-sort "'..os.getenv("HOME").."/dev/work"..'"')
 | 
			
		||||
                           for filename in pfile:lines() do
 | 
			
		||||
                               i = i + 1
 | 
			
		||||
                               t[i] = filename
 | 
			
		||||
                           end
 | 
			
		||||
                           pfile:close()
 | 
			
		||||
                           return t
 | 
			
		||||
                       end
 | 
			
		||||
 | 
			
		||||
                       for _, v in pairs(scandir(os.getenv("HOME").."/dev")) do
 | 
			
		||||
                         table.insert(choices, { label = v })
 | 
			
		||||
                       end
 | 
			
		||||
 | 
			
		||||
                       window:perform_action(
 | 
			
		||||
                         wezterm.action.InputSelector {
 | 
			
		||||
                           action = wezterm.action_callback(function(window, pane, id, label)
 | 
			
		||||
                             if not id and not label then
 | 
			
		||||
                               wezterm.log_info "cancelled"
 | 
			
		||||
                             else
 | 
			
		||||
                               window:perform_action(
 | 
			
		||||
                                 wezterm.action.SpawnCommandInNewTab {
 | 
			
		||||
                                   cwd = label,
 | 
			
		||||
                                 },
 | 
			
		||||
                                 pane
 | 
			
		||||
                               )
 | 
			
		||||
                             end
 | 
			
		||||
                           end),
 | 
			
		||||
                           fuzzy = true,
 | 
			
		||||
                           title = "Select Project",
 | 
			
		||||
                           choices = choices,
 | 
			
		||||
                         },
 | 
			
		||||
                         pane
 | 
			
		||||
                       )
 | 
			
		||||
                     end),
 | 
			
		||||
                  },
 | 
			
		||||
                },
 | 
			
		||||
            }
 | 
			
		||||
          '';
 | 
			
		||||
        };
 | 
			
		||||
      };
 | 
			
		||||
    };
 | 
			
		||||
}
 | 
			
		||||
@@ -1,10 +1,4 @@
 | 
			
		||||
{
 | 
			
		||||
  config,
 | 
			
		||||
  pkgs,
 | 
			
		||||
  lib,
 | 
			
		||||
  ...
 | 
			
		||||
}:
 | 
			
		||||
{
 | 
			
		||||
{ config, pkgs, lib, ... }: {
 | 
			
		||||
 | 
			
		||||
  options = {
 | 
			
		||||
    yt-dlp = {
 | 
			
		||||
@@ -33,6 +27,9 @@
 | 
			
		||||
      };
 | 
			
		||||
 | 
			
		||||
      programs.fish.shellAbbrs.yt = "yt-dlp";
 | 
			
		||||
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,19 +1,7 @@
 | 
			
		||||
{
 | 
			
		||||
  config,
 | 
			
		||||
  lib,
 | 
			
		||||
  pkgs,
 | 
			
		||||
  ...
 | 
			
		||||
}:
 | 
			
		||||
{
 | 
			
		||||
{ config, lib, pkgs, ... }: {
 | 
			
		||||
 | 
			
		||||
  imports = [
 | 
			
		||||
    ./applications
 | 
			
		||||
    ./mail
 | 
			
		||||
    ./neovim
 | 
			
		||||
    ./programming
 | 
			
		||||
    ./repositories
 | 
			
		||||
    ./shell
 | 
			
		||||
  ];
 | 
			
		||||
  imports =
 | 
			
		||||
    [ ./applications ./mail ./neovim ./programming ./repositories ./shell ];
 | 
			
		||||
 | 
			
		||||
  options = {
 | 
			
		||||
    user = lib.mkOption {
 | 
			
		||||
@@ -29,7 +17,8 @@
 | 
			
		||||
      download = lib.mkOption {
 | 
			
		||||
        type = lib.types.str;
 | 
			
		||||
        description = "XDG directory for downloads";
 | 
			
		||||
        default = if pkgs.stdenv.isDarwin then "$HOME/Downloads" else "$HOME/downloads";
 | 
			
		||||
        default =
 | 
			
		||||
          if pkgs.stdenv.isDarwin then "$HOME/Downloads" else "$HOME/downloads";
 | 
			
		||||
      };
 | 
			
		||||
    };
 | 
			
		||||
    identityFile = lib.mkOption {
 | 
			
		||||
@@ -55,13 +44,20 @@
 | 
			
		||||
        default = true;
 | 
			
		||||
      };
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    # colorscheme = lib.mkOption {
 | 
			
		||||
    #   type = types.attrs;
 | 
			
		||||
    #   description = "Base16 color scheme";
 | 
			
		||||
    # };
 | 
			
		||||
    homePath = lib.mkOption {
 | 
			
		||||
      type = lib.types.path;
 | 
			
		||||
      description = "Path of user's home directory.";
 | 
			
		||||
      default = builtins.toPath (
 | 
			
		||||
        if pkgs.stdenv.isDarwin then "/Users/${config.user}" else "/home/${config.user}"
 | 
			
		||||
      );
 | 
			
		||||
      default = builtins.toPath (if pkgs.stdenv.isDarwin then
 | 
			
		||||
        "/Users/${config.user}"
 | 
			
		||||
      else
 | 
			
		||||
        "/home/${config.user}");
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    dotfilesPath = lib.mkOption {
 | 
			
		||||
      type = lib.types.path;
 | 
			
		||||
      description = "Path of dotfiles repository.";
 | 
			
		||||
@@ -69,86 +65,44 @@
 | 
			
		||||
    };
 | 
			
		||||
    dotfilesRepo = lib.mkOption {
 | 
			
		||||
      type = lib.types.str;
 | 
			
		||||
      description = "Link to dotfiles repository HTTPS URL.";
 | 
			
		||||
      description = "Link to dotfiles repository.";
 | 
			
		||||
    };
 | 
			
		||||
    unfreePackages = lib.mkOption {
 | 
			
		||||
      type = lib.types.listOf lib.types.str;
 | 
			
		||||
      type = lib.types.listOf lib.types.package;
 | 
			
		||||
      description = "List of unfree packages to allow.";
 | 
			
		||||
      default = [ ];
 | 
			
		||||
    };
 | 
			
		||||
    hostnames = {
 | 
			
		||||
      git = lib.mkOption {
 | 
			
		||||
        type = lib.types.str;
 | 
			
		||||
        description = "Hostname for git server (Gitea).";
 | 
			
		||||
      };
 | 
			
		||||
      metrics = lib.mkOption {
 | 
			
		||||
        type = lib.types.str;
 | 
			
		||||
        description = "Hostname for metrics server.";
 | 
			
		||||
      };
 | 
			
		||||
      minecraft = lib.mkOption {
 | 
			
		||||
        type = lib.types.str;
 | 
			
		||||
        description = "Hostname for Minecraft server.";
 | 
			
		||||
      };
 | 
			
		||||
      paperless = lib.mkOption {
 | 
			
		||||
        type = lib.types.str;
 | 
			
		||||
        description = "Hostname for document server (paperless-ngx).";
 | 
			
		||||
      };
 | 
			
		||||
      prometheus = lib.mkOption {
 | 
			
		||||
        type = lib.types.str;
 | 
			
		||||
        description = "Hostname for Prometheus server.";
 | 
			
		||||
      };
 | 
			
		||||
      influxdb = lib.mkOption {
 | 
			
		||||
        type = lib.types.str;
 | 
			
		||||
        description = "Hostname for InfluxDB2 server.";
 | 
			
		||||
      };
 | 
			
		||||
      secrets = lib.mkOption {
 | 
			
		||||
        type = lib.types.str;
 | 
			
		||||
        description = "Hostname for passwords and secrets (Vaultwarden).";
 | 
			
		||||
      };
 | 
			
		||||
      stream = lib.mkOption {
 | 
			
		||||
        type = lib.types.str;
 | 
			
		||||
        description = "Hostname for video/media library (Jellyfin).";
 | 
			
		||||
      };
 | 
			
		||||
      content = lib.mkOption {
 | 
			
		||||
        type = lib.types.str;
 | 
			
		||||
        description = "Hostname for personal content system (Nextcloud).";
 | 
			
		||||
      };
 | 
			
		||||
      books = lib.mkOption {
 | 
			
		||||
        type = lib.types.str;
 | 
			
		||||
        description = "Hostname for books library (Calibre-Web).";
 | 
			
		||||
      };
 | 
			
		||||
      download = lib.mkOption {
 | 
			
		||||
        type = lib.types.str;
 | 
			
		||||
        description = "Hostname for download services.";
 | 
			
		||||
      };
 | 
			
		||||
      irc = lib.mkOption {
 | 
			
		||||
        type = lib.types.str;
 | 
			
		||||
        description = "Hostname for IRC services.";
 | 
			
		||||
      };
 | 
			
		||||
      n8n = lib.mkOption {
 | 
			
		||||
        type = lib.types.str;
 | 
			
		||||
        description = "Hostname for n8n automation.";
 | 
			
		||||
      };
 | 
			
		||||
      transmission = lib.mkOption {
 | 
			
		||||
        type = lib.types.str;
 | 
			
		||||
        description = "Hostname for peer2peer downloads (Transmission).";
 | 
			
		||||
      };
 | 
			
		||||
    };
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  config =
 | 
			
		||||
    let
 | 
			
		||||
      stateVersion = "23.05";
 | 
			
		||||
    in
 | 
			
		||||
    {
 | 
			
		||||
  config = let stateVersion = "23.05";
 | 
			
		||||
  in {
 | 
			
		||||
 | 
			
		||||
    nix = {
 | 
			
		||||
 | 
			
		||||
      # Enable features in Nix commands
 | 
			
		||||
      extraOptions = ''
 | 
			
		||||
        experimental-features = nix-command flakes
 | 
			
		||||
        warn-dirty = false
 | 
			
		||||
      '';
 | 
			
		||||
 | 
			
		||||
      settings = {
 | 
			
		||||
 | 
			
		||||
        # Add community Cachix to binary cache
 | 
			
		||||
        substituters = lib.mkIf (!pkgs.stdenv.isDarwin)
 | 
			
		||||
          [ "https://nix-community.cachix.org" ];
 | 
			
		||||
        trusted-public-keys = lib.mkIf (!pkgs.stdenv.isDarwin) [
 | 
			
		||||
          "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
 | 
			
		||||
        ];
 | 
			
		||||
 | 
			
		||||
        # Scans and hard links identical files in the store
 | 
			
		||||
        auto-optimise-store = true;
 | 
			
		||||
 | 
			
		||||
      };
 | 
			
		||||
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    # Basic common system packages for all devices
 | 
			
		||||
      environment.systemPackages = with pkgs; [
 | 
			
		||||
        git
 | 
			
		||||
        vim
 | 
			
		||||
        wget
 | 
			
		||||
        curl
 | 
			
		||||
      ];
 | 
			
		||||
    environment.systemPackages = with pkgs; [ git vim wget curl ];
 | 
			
		||||
 | 
			
		||||
    # Use the system-level nixpkgs instead of Home Manager's
 | 
			
		||||
    home-manager.useGlobalPkgs = true;
 | 
			
		||||
@@ -159,10 +113,15 @@
 | 
			
		||||
 | 
			
		||||
    # Allow specified unfree packages (identified elsewhere)
 | 
			
		||||
    # Retrieves package object based on string name
 | 
			
		||||
      nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) config.unfreePackages;
 | 
			
		||||
    # Idea: https://discourse.nixos.org/t/how-to-use-packages-directly-in-allowunfreepredicate/22455/6
 | 
			
		||||
    nixpkgs.config.allowUnfreePredicate = pkg:
 | 
			
		||||
      builtins.elem (pkg.name or (builtins.parseDrvName pkg.pname).name)
 | 
			
		||||
      (map lib.getName config.unfreePackages);
 | 
			
		||||
 | 
			
		||||
    # Pin a state version to prevent warnings
 | 
			
		||||
    home-manager.users.${config.user}.home.stateVersion = stateVersion;
 | 
			
		||||
    home-manager.users.root.home.stateVersion = stateVersion;
 | 
			
		||||
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,10 +1,4 @@
 | 
			
		||||
{
 | 
			
		||||
  config,
 | 
			
		||||
  pkgs,
 | 
			
		||||
  lib,
 | 
			
		||||
  ...
 | 
			
		||||
}:
 | 
			
		||||
{
 | 
			
		||||
{ config, pkgs, lib, ... }: {
 | 
			
		||||
 | 
			
		||||
  options.mail.aerc.enable = lib.mkEnableOption "Aerc email.";
 | 
			
		||||
 | 
			
		||||
@@ -74,16 +68,14 @@
 | 
			
		||||
            "!" = ":term<space>";
 | 
			
		||||
            "|" = ":pipe<space>";
 | 
			
		||||
 | 
			
		||||
            "/" = ":search<space>-a<space>";
 | 
			
		||||
            "/" = ":search<space>";
 | 
			
		||||
            "\\" = ":filter <space>";
 | 
			
		||||
            n = ":next-result<Enter>";
 | 
			
		||||
            N = ":prev-result<Enter>";
 | 
			
		||||
            "<Esc>" = ":clear<Enter>";
 | 
			
		||||
          };
 | 
			
		||||
 | 
			
		||||
          "messages:folder=Drafts" = {
 | 
			
		||||
            "<Enter>" = ":recall<Enter>";
 | 
			
		||||
          };
 | 
			
		||||
          "messages:folder=Drafts" = { "<Enter>" = ":recall<Enter>"; };
 | 
			
		||||
 | 
			
		||||
          view = {
 | 
			
		||||
            "/" = ":toggle-key-passthrough <Enter> /";
 | 
			
		||||
@@ -156,28 +148,28 @@
 | 
			
		||||
            "<C-p>" = ":prev-tab<Enter>";
 | 
			
		||||
            "<C-n>" = ":next-tab<Enter>";
 | 
			
		||||
          };
 | 
			
		||||
 | 
			
		||||
        };
 | 
			
		||||
        extraConfig = {
 | 
			
		||||
          general = {
 | 
			
		||||
            unsafe-accounts-conf = true;
 | 
			
		||||
            # log-file = "~/.cache/aerc.log";
 | 
			
		||||
            # log-level = "debug";
 | 
			
		||||
          };
 | 
			
		||||
          viewer = {
 | 
			
		||||
            pager = "${pkgs.less}/bin/less -R";
 | 
			
		||||
          };
 | 
			
		||||
          general.unsafe-accounts-conf = true;
 | 
			
		||||
          viewer = { pager = "${pkgs.less}/bin/less -R"; };
 | 
			
		||||
          filters = {
 | 
			
		||||
            "text/plain" = "${pkgs.aerc}/libexec/aerc/filters/colorize";
 | 
			
		||||
            "text/calendar" = "${pkgs.gawk}/bin/awk -f ${pkgs.aerc}/libexec/aerc/filters/calendar";
 | 
			
		||||
            "text/html" = "${pkgs.aerc}/libexec/aerc/filters/html | ${pkgs.aerc}/libexec/aerc/filters/colorize"; # Requires w3m, dante
 | 
			
		||||
            "text/plain" =
 | 
			
		||||
              "${pkgs.gawk}/bin/awk -f ${pkgs.aerc}/share/aerc/filters/colorize";
 | 
			
		||||
            "text/calendar" =
 | 
			
		||||
              "${pkgs.gawk}/bin/awk -f ${pkgs.aerc}/share/aerc/filters/calendar";
 | 
			
		||||
            "text/html" =
 | 
			
		||||
              "${pkgs.aerc}/share/aerc/filters/html"; # Requires w3m, dante
 | 
			
		||||
            # "text/html" =
 | 
			
		||||
            #   "${pkgs.aerc}/share/aerc/filters/html | ${pkgs.aerc}/share/aerc/filters/colorize";
 | 
			
		||||
            # "text/*" =
 | 
			
		||||
            #   ''${pkgs.bat}/bin/bat -fP --file-name="$AERC_FILENAME "'';
 | 
			
		||||
            "message/delivery-status" = "${pkgs.aerc}/libexec/aerc/filters/colorize";
 | 
			
		||||
            "message/rfc822" = "${pkgs.aerc}/libexec/aerc/filters/colorize";
 | 
			
		||||
            "message/delivery-status" =
 | 
			
		||||
              "${pkgs.gawk}/bin/awk -f ${pkgs.aerc}/share/aerc/filters/colorize";
 | 
			
		||||
            "message/rfc822" =
 | 
			
		||||
              "${pkgs.gawk}/bin/awk -f ${pkgs.aerc}/share/aerc/filters/colorize";
 | 
			
		||||
            "application/x-sh" = "${pkgs.bat}/bin/bat -fP -l sh";
 | 
			
		||||
            "application/pdf" = "${pkgs.zathura}/bin/zathura -";
 | 
			
		||||
            "audio/*" = "${pkgs.mpv}/bin/mpv -";
 | 
			
		||||
            "image/*" = "${pkgs.feh}/bin/feh -";
 | 
			
		||||
          };
 | 
			
		||||
        };
 | 
			
		||||
      };
 | 
			
		||||
@@ -186,35 +178,12 @@
 | 
			
		||||
        extraAccounts = {
 | 
			
		||||
          check-mail = "5m";
 | 
			
		||||
          check-mail-cmd = "${pkgs.isync}/bin/mbsync -a";
 | 
			
		||||
          check-mail-timeout = "15s";
 | 
			
		||||
        };
 | 
			
		||||
      };
 | 
			
		||||
 | 
			
		||||
      xdg.desktopEntries.aerc = lib.mkIf pkgs.stdenv.isLinux {
 | 
			
		||||
        name = "aerc";
 | 
			
		||||
        exec = "kitty aerc %u";
 | 
			
		||||
      };
 | 
			
		||||
      xsession.windowManager.i3.config.keybindings = lib.mkIf pkgs.stdenv.isLinux {
 | 
			
		||||
        "${
 | 
			
		||||
          config.home-manager.users.${config.user}.xsession.windowManager.i3.config.modifier
 | 
			
		||||
        }+Shift+e" = "exec ${
 | 
			
		||||
          # Don't name the script `aerc` or it will affect grep
 | 
			
		||||
          builtins.toString (
 | 
			
		||||
            pkgs.writeShellScript "focus-mail.sh" ''
 | 
			
		||||
              count=$(ps aux | grep -c aerc)
 | 
			
		||||
              if [ "$count" -eq 1 ]; then
 | 
			
		||||
                  i3-msg "exec --no-startup-id kitty --class aerc aerc"
 | 
			
		||||
                  sleep 0.25
 | 
			
		||||
              fi
 | 
			
		||||
              i3-msg "[class=aerc] focus"
 | 
			
		||||
            ''
 | 
			
		||||
          )
 | 
			
		||||
        }";
 | 
			
		||||
      programs.fish.shellAbbrs = { ae = "aerc"; };
 | 
			
		||||
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
      programs.fish.shellAbbrs = {
 | 
			
		||||
        ae = "aerc";
 | 
			
		||||
      };
 | 
			
		||||
    };
 | 
			
		||||
  };
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,16 +1,6 @@
 | 
			
		||||
{
 | 
			
		||||
  config,
 | 
			
		||||
  pkgs,
 | 
			
		||||
  lib,
 | 
			
		||||
  ...
 | 
			
		||||
}:
 | 
			
		||||
{
 | 
			
		||||
{ config, pkgs, lib, ... }: {
 | 
			
		||||
 | 
			
		||||
  imports = [
 | 
			
		||||
    ./himalaya.nix
 | 
			
		||||
    ./aerc.nix
 | 
			
		||||
    ./system.nix
 | 
			
		||||
  ];
 | 
			
		||||
  imports = [ ./himalaya.nix ./aerc.nix ];
 | 
			
		||||
 | 
			
		||||
  options = {
 | 
			
		||||
    mail.enable = lib.mkEnableOption "Mail service.";
 | 
			
		||||
@@ -20,60 +10,24 @@
 | 
			
		||||
      default = config.user;
 | 
			
		||||
    };
 | 
			
		||||
    mail.server = lib.mkOption {
 | 
			
		||||
      type = lib.types.nullOr lib.types.str;
 | 
			
		||||
      type = lib.types.str;
 | 
			
		||||
      description = "Server name for the email address.";
 | 
			
		||||
    };
 | 
			
		||||
    mail.imapHost = lib.mkOption {
 | 
			
		||||
      type = lib.types.nullOr lib.types.str;
 | 
			
		||||
      description = "Server host for IMAP (reading mail).";
 | 
			
		||||
    };
 | 
			
		||||
    mail.smtpHost = lib.mkOption {
 | 
			
		||||
      type = lib.types.nullOr lib.types.str;
 | 
			
		||||
      description = "Server host for SMTP (sending mail).";
 | 
			
		||||
    };
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  config = lib.mkIf config.mail.enable {
 | 
			
		||||
 | 
			
		||||
    home-manager.users.${config.user} = {
 | 
			
		||||
      programs.mbsync = {
 | 
			
		||||
        enable = true;
 | 
			
		||||
      };
 | 
			
		||||
 | 
			
		||||
      # Automatically check for mail and keep files synced locally
 | 
			
		||||
      programs.mbsync = { enable = true; };
 | 
			
		||||
      services.mbsync = lib.mkIf pkgs.stdenv.isLinux {
 | 
			
		||||
        enable = true;
 | 
			
		||||
        frequency = "*:0/5";
 | 
			
		||||
        postExec = "${pkgs.notmuch}/bin/notmuch new";
 | 
			
		||||
      };
 | 
			
		||||
 | 
			
		||||
      # Used to watch for new mail and trigger sync
 | 
			
		||||
      services.imapnotify.enable = pkgs.stdenv.isLinux;
 | 
			
		||||
 | 
			
		||||
      # Allows sending email from CLI/sendmail
 | 
			
		||||
      programs.msmtp.enable = true;
 | 
			
		||||
 | 
			
		||||
      # Better local mail search
 | 
			
		||||
      programs.notmuch = {
 | 
			
		||||
        enable = true;
 | 
			
		||||
        new.ignore = [
 | 
			
		||||
          ".mbsyncstate.lock"
 | 
			
		||||
          ".mbsyncstate.journal"
 | 
			
		||||
          ".mbsyncstate.new"
 | 
			
		||||
        ];
 | 
			
		||||
      };
 | 
			
		||||
 | 
			
		||||
      accounts.email = {
 | 
			
		||||
 | 
			
		||||
        # Where email files are stored
 | 
			
		||||
        maildirBasePath = "${config.homePath}/mail";
 | 
			
		||||
 | 
			
		||||
        accounts = {
 | 
			
		||||
          home =
 | 
			
		||||
            let
 | 
			
		||||
              address = "${config.mail.user}@${config.mail.server}";
 | 
			
		||||
            in
 | 
			
		||||
            {
 | 
			
		||||
          home = let address = "${config.mail.user}@${config.mail.server}";
 | 
			
		||||
          in {
 | 
			
		||||
            userName = address;
 | 
			
		||||
            realName = config.fullName;
 | 
			
		||||
            primary = true;
 | 
			
		||||
@@ -83,57 +37,48 @@
 | 
			
		||||
              "hey"
 | 
			
		||||
              "admin"
 | 
			
		||||
            ];
 | 
			
		||||
 | 
			
		||||
              # Options for contact completion
 | 
			
		||||
            alot = { };
 | 
			
		||||
 | 
			
		||||
            flavor = "plain";
 | 
			
		||||
            folders = { };
 | 
			
		||||
            getmail = { };
 | 
			
		||||
            imap = {
 | 
			
		||||
                host = config.mail.imapHost;
 | 
			
		||||
              host = "imap.purelymail.com";
 | 
			
		||||
              port = 993;
 | 
			
		||||
              tls.enable = true;
 | 
			
		||||
            };
 | 
			
		||||
 | 
			
		||||
              # Watch for mail and run notifications or sync
 | 
			
		||||
            imapnotify = {
 | 
			
		||||
                enable = true;
 | 
			
		||||
                boxes = [ "Inbox" ];
 | 
			
		||||
                onNotify = "${pkgs.isync}/bin/mbsync -a";
 | 
			
		||||
                onNotifyPost =
 | 
			
		||||
                  lib.mkIf config.home-manager.users.${config.user}.services.dunst.enable
 | 
			
		||||
                    "${pkgs.libnotify}/bin/notify-send 'New mail arrived'";
 | 
			
		||||
              enable = false;
 | 
			
		||||
              boxes = [ ];
 | 
			
		||||
              onNotify = "";
 | 
			
		||||
              onNotifyPost = "";
 | 
			
		||||
            };
 | 
			
		||||
 | 
			
		||||
              # Name of the directory in maildir for this account
 | 
			
		||||
              maildir = {
 | 
			
		||||
                path = "main";
 | 
			
		||||
              };
 | 
			
		||||
 | 
			
		||||
              # Bi-directional syncing options for local files
 | 
			
		||||
            maildir = { path = "main"; };
 | 
			
		||||
            mbsync = {
 | 
			
		||||
              enable = true;
 | 
			
		||||
                create = "both";
 | 
			
		||||
                expunge = "both";
 | 
			
		||||
                remove = "both";
 | 
			
		||||
              create = "maildir";
 | 
			
		||||
              expunge = "none";
 | 
			
		||||
              remove = "none";
 | 
			
		||||
              patterns = [ "*" ];
 | 
			
		||||
              extraConfig.channel = {
 | 
			
		||||
                CopyArrivalDate = "yes"; # Sync time of original message
 | 
			
		||||
              };
 | 
			
		||||
            };
 | 
			
		||||
 | 
			
		||||
              # Enable indexing
 | 
			
		||||
              notmuch.enable = true;
 | 
			
		||||
 | 
			
		||||
              # Used to login and send and receive emails
 | 
			
		||||
              passwordCommand = "${pkgs.age}/bin/age --decrypt --identity ~/.ssh/id_ed25519 ${pkgs.writeText "mailpass.age" (builtins.readFile ../../../private/mailpass.age)}";
 | 
			
		||||
 | 
			
		||||
            mu.enable = false;
 | 
			
		||||
            notmuch.enable = false;
 | 
			
		||||
            passwordCommand =
 | 
			
		||||
              "${pkgs.age}/bin/age --decrypt --identity ${config.identityFile} ${
 | 
			
		||||
                builtins.toString ../../../private/mailpass.age
 | 
			
		||||
              }";
 | 
			
		||||
            smtp = {
 | 
			
		||||
                host = config.mail.smtpHost;
 | 
			
		||||
              host = "smtp.purelymail.com";
 | 
			
		||||
              port = 465;
 | 
			
		||||
              tls.enable = true;
 | 
			
		||||
            };
 | 
			
		||||
          };
 | 
			
		||||
        };
 | 
			
		||||
      };
 | 
			
		||||
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
  };
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,4 @@
 | 
			
		||||
{ config, lib, ... }:
 | 
			
		||||
{
 | 
			
		||||
{ config, lib, ... }: {
 | 
			
		||||
 | 
			
		||||
  options.mail.himalaya.enable = lib.mkEnableOption "Himalaya email.";
 | 
			
		||||
 | 
			
		||||
@@ -7,20 +6,20 @@
 | 
			
		||||
 | 
			
		||||
    home-manager.users.${config.user} = {
 | 
			
		||||
 | 
			
		||||
      programs.himalaya = {
 | 
			
		||||
        enable = true;
 | 
			
		||||
      };
 | 
			
		||||
      programs.himalaya = { enable = true; };
 | 
			
		||||
      accounts.email.accounts.home.himalaya = {
 | 
			
		||||
        enable = true;
 | 
			
		||||
        backend = "imap";
 | 
			
		||||
        sender = "smtp";
 | 
			
		||||
        settings = {
 | 
			
		||||
          downloads-dir = config.userDirs.download;
 | 
			
		||||
          smtp-insecure = true;
 | 
			
		||||
        };
 | 
			
		||||
      };
 | 
			
		||||
 | 
			
		||||
      programs.fish.shellAbbrs = {
 | 
			
		||||
        hi = "himalaya";
 | 
			
		||||
      };
 | 
			
		||||
      programs.fish.shellAbbrs = { hi = "himalaya"; };
 | 
			
		||||
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
  };
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,35 +0,0 @@
 | 
			
		||||
{
 | 
			
		||||
  config,
 | 
			
		||||
  pkgs,
 | 
			
		||||
  lib,
 | 
			
		||||
  ...
 | 
			
		||||
}:
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
  config = lib.mkIf (config.mail.enable || config.server) {
 | 
			
		||||
 | 
			
		||||
    home-manager.users.${config.user} = {
 | 
			
		||||
 | 
			
		||||
      programs.msmtp.enable = true;
 | 
			
		||||
 | 
			
		||||
      # The system user for sending automatic notifications
 | 
			
		||||
      accounts.email.accounts.system =
 | 
			
		||||
        let
 | 
			
		||||
          address = "system@${config.mail.server}";
 | 
			
		||||
        in
 | 
			
		||||
        {
 | 
			
		||||
          userName = address;
 | 
			
		||||
          realName = "NixOS System";
 | 
			
		||||
          primary = !config.mail.enable; # Only primary if mail not enabled
 | 
			
		||||
          inherit address;
 | 
			
		||||
          passwordCommand = "${pkgs.age}/bin/age --decrypt --identity ${config.identityFile} ${pkgs.writeText "mailpass-system.age" (builtins.readFile ../../../private/mailpass-system.age)}";
 | 
			
		||||
          msmtp.enable = true;
 | 
			
		||||
          smtp = {
 | 
			
		||||
            host = config.mail.smtpHost;
 | 
			
		||||
            port = 465;
 | 
			
		||||
            tls.enable = true;
 | 
			
		||||
          };
 | 
			
		||||
        };
 | 
			
		||||
    };
 | 
			
		||||
  };
 | 
			
		||||
}
 | 
			
		||||
@@ -1,8 +1,4 @@
 | 
			
		||||
{ pkgs, ... }:
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
  # Plugin for aligning text programmatically
 | 
			
		||||
 | 
			
		||||
{ pkgs, ... }: {
 | 
			
		||||
  plugins = [ pkgs.vimPlugins.tabular ];
 | 
			
		||||
  lua = ''
 | 
			
		||||
    -- Align
 | 
			
		||||
 
 | 
			
		||||
@@ -1,8 +1,4 @@
 | 
			
		||||
{ pkgs, ... }:
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
  # Shows buffers in a VSCode-style tab layout
 | 
			
		||||
 | 
			
		||||
{ pkgs, ... }: {
 | 
			
		||||
  plugins = [
 | 
			
		||||
    pkgs.vimPlugins.bufferline-nvim
 | 
			
		||||
    pkgs.vimPlugins.vim-bbye # Better closing of buffers
 | 
			
		||||
@@ -12,7 +8,7 @@
 | 
			
		||||
      diagnostics = "nvim_lsp";
 | 
			
		||||
      always_show_bufferline = false;
 | 
			
		||||
      separator_style = "slant";
 | 
			
		||||
      offsets = [ { filetype = "NvimTree"; } ];
 | 
			
		||||
      offsets = [{ filetype = "NvimTree"; }];
 | 
			
		||||
    };
 | 
			
		||||
  };
 | 
			
		||||
  lua = ''
 | 
			
		||||
 
 | 
			
		||||
@@ -1,27 +0,0 @@
 | 
			
		||||
{
 | 
			
		||||
  pkgs,
 | 
			
		||||
  lib,
 | 
			
		||||
  config,
 | 
			
		||||
  ...
 | 
			
		||||
}:
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
  # Sets Neovim colors based on Nix colorscheme
 | 
			
		||||
 | 
			
		||||
  options.colors = lib.mkOption {
 | 
			
		||||
    type = lib.types.attrsOf lib.types.str;
 | 
			
		||||
    description = "Attrset of base16 colorscheme key value pairs.";
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  config = {
 | 
			
		||||
    plugins = [ pkgs.vimPlugins.base16-nvim ];
 | 
			
		||||
    setup.base16-colorscheme = config.colors;
 | 
			
		||||
 | 
			
		||||
    # Telescope isn't working, shut off for now
 | 
			
		||||
    lua = ''
 | 
			
		||||
      require('base16-colorscheme').with_config {
 | 
			
		||||
          telescope = false,
 | 
			
		||||
      }
 | 
			
		||||
    '';
 | 
			
		||||
  };
 | 
			
		||||
}
 | 
			
		||||
@@ -1,5 +1,4 @@
 | 
			
		||||
{ pkgs, dsl, ... }:
 | 
			
		||||
{
 | 
			
		||||
{ pkgs, dsl, ... }: {
 | 
			
		||||
 | 
			
		||||
  plugins = [
 | 
			
		||||
    pkgs.vimPlugins.cmp-nvim-lsp
 | 
			
		||||
@@ -10,6 +9,7 @@
 | 
			
		||||
    pkgs.vimPlugins.luasnip
 | 
			
		||||
    pkgs.vimPlugins.cmp_luasnip
 | 
			
		||||
    pkgs.vimPlugins.cmp-rg
 | 
			
		||||
    pkgs.vimPlugins.friendly-snippets
 | 
			
		||||
  ];
 | 
			
		||||
 | 
			
		||||
  use.cmp.setup = dsl.callWith {
 | 
			
		||||
@@ -24,17 +24,28 @@
 | 
			
		||||
      end
 | 
			
		||||
    '';
 | 
			
		||||
 | 
			
		||||
    # Basic completion keybinds
 | 
			
		||||
    snippet.expand = dsl.rawLua ''
 | 
			
		||||
      function(args)
 | 
			
		||||
          require("luasnip").lsp_expand(args.body)
 | 
			
		||||
      end
 | 
			
		||||
    '';
 | 
			
		||||
 | 
			
		||||
    mapping = {
 | 
			
		||||
      "['<C-n>']" = dsl.rawLua "require('cmp').mapping.select_next_item({ behavior = require('cmp').SelectBehavior.Insert }, { 'i', 'c' })";
 | 
			
		||||
      "['<C-p>']" = dsl.rawLua "require('cmp').mapping.select_prev_item({ behavior = require('cmp').SelectBehavior.Insert }, { 'i', 'c' })";
 | 
			
		||||
      "['<Down>']" = dsl.rawLua "require('cmp').mapping.select_next_item({ behavior = require('cmp').SelectBehavior.Select }, { 'i', 'c' })";
 | 
			
		||||
      "['<Up>']" = dsl.rawLua "require('cmp').mapping.select_prev_item({ behavior = require('cmp').SelectBehavior.Select }, { 'i', 'c' })";
 | 
			
		||||
      "['<C-n>']" = dsl.rawLua
 | 
			
		||||
        "require('cmp').mapping.select_next_item({ behavior = require('cmp').SelectBehavior.Insert })";
 | 
			
		||||
      "['<C-p>']" = dsl.rawLua
 | 
			
		||||
        "require('cmp').mapping.select_prev_item({ behavior = require('cmp').SelectBehavior.Insert })";
 | 
			
		||||
      "['<Down>']" = dsl.rawLua
 | 
			
		||||
        "require('cmp').mapping.select_next_item({ behavior = require('cmp').SelectBehavior.Select })";
 | 
			
		||||
      "['<Up>']" = dsl.rawLua
 | 
			
		||||
        "require('cmp').mapping.select_prev_item({ behavior = require('cmp').SelectBehavior.Select })";
 | 
			
		||||
      "['<C-d>']" = dsl.rawLua "require('cmp').mapping.scroll_docs(-4)";
 | 
			
		||||
      "['<C-f>']" = dsl.rawLua "require('cmp').mapping.scroll_docs(4)";
 | 
			
		||||
      "['<C-e>']" = dsl.rawLua "require('cmp').mapping.abort()";
 | 
			
		||||
      "['<C-y>']" = dsl.rawLua "require('cmp').mapping.confirm({ behavior = require('cmp').ConfirmBehavior.Insert, select = true, }, { 'i', 'c' })";
 | 
			
		||||
      "['<C-r>']" = dsl.rawLua "require('cmp').mapping.confirm({ behavior = require('cmp').ConfirmBehavior.Replace, select = true, }, { 'i', 'c' })";
 | 
			
		||||
      "['<CR>']" = dsl.rawLua
 | 
			
		||||
        "require('cmp').mapping.confirm({ behavior = require('cmp').ConfirmBehavior.Replace, select = true, })";
 | 
			
		||||
      "['<C-r>']" = dsl.rawLua
 | 
			
		||||
        "require('cmp').mapping.confirm({ behavior = require('cmp').ConfirmBehavior.Replace, select = true, })";
 | 
			
		||||
      "['<Esc>']" = dsl.rawLua ''
 | 
			
		||||
        function(_)
 | 
			
		||||
            cmp.mapping({
 | 
			
		||||
@@ -44,7 +55,7 @@
 | 
			
		||||
            vim.cmd("stopinsert") --- Abort and leave insert mode
 | 
			
		||||
        end
 | 
			
		||||
      '';
 | 
			
		||||
      "['<C-k>']" = dsl.rawLua ''
 | 
			
		||||
      "['<C-l>']" = dsl.rawLua ''
 | 
			
		||||
        cmp.mapping(function(_)
 | 
			
		||||
            if require("luasnip").expand_or_jumpable() then
 | 
			
		||||
                require("luasnip").expand_or_jump()
 | 
			
		||||
@@ -53,33 +64,26 @@
 | 
			
		||||
      '';
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    # These are where the completion engine gets its suggestions
 | 
			
		||||
    sources = [
 | 
			
		||||
      { name = "nvim_lua"; } # Fills in common Neovim lua functions
 | 
			
		||||
      { name = "nvim_lsp"; } # LSP results
 | 
			
		||||
      { name = "path"; } # Shell completion from current PATH
 | 
			
		||||
      { name = "nvim_lua"; }
 | 
			
		||||
      { name = "nvim_lsp"; }
 | 
			
		||||
      { name = "luasnip"; }
 | 
			
		||||
      { name = "path"; }
 | 
			
		||||
      {
 | 
			
		||||
        name = "buffer"; # Grep for text from the current text buffer
 | 
			
		||||
        name = "buffer";
 | 
			
		||||
        keyword_length = 3;
 | 
			
		||||
        max_item_count = 10;
 | 
			
		||||
      }
 | 
			
		||||
      {
 | 
			
		||||
        name = "rg"; # Grep for text from the current directory
 | 
			
		||||
        name = "rg";
 | 
			
		||||
        keyword_length = 6;
 | 
			
		||||
        max_item_count = 10;
 | 
			
		||||
        option = {
 | 
			
		||||
          additional_arguments = "--ignore-case";
 | 
			
		||||
        };
 | 
			
		||||
        option = { additional_arguments = "--ignore-case"; };
 | 
			
		||||
      }
 | 
			
		||||
    ];
 | 
			
		||||
 | 
			
		||||
    # Styling of the completion menu
 | 
			
		||||
    formatting = {
 | 
			
		||||
      fields = [
 | 
			
		||||
        "kind"
 | 
			
		||||
        "abbr"
 | 
			
		||||
        "menu"
 | 
			
		||||
      ];
 | 
			
		||||
      fields = [ "kind" "abbr" "menu" ];
 | 
			
		||||
      format = dsl.rawLua ''
 | 
			
		||||
        function(entry, vim_item)
 | 
			
		||||
            local kind_icons = {
 | 
			
		||||
@@ -111,6 +115,7 @@
 | 
			
		||||
            }
 | 
			
		||||
            vim_item.kind = string.format("%s", kind_icons[vim_item.kind])
 | 
			
		||||
            vim_item.menu = ({
 | 
			
		||||
                luasnip = "[Snippet]",
 | 
			
		||||
                buffer = "[Buffer]",
 | 
			
		||||
                path = "[Path]",
 | 
			
		||||
                rg = "[Grep]",
 | 
			
		||||
@@ -126,46 +131,19 @@
 | 
			
		||||
      native_menu = false; # Use cmp menu instead of Vim menu
 | 
			
		||||
      ghost_text = true; # Show preview auto-completion
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  lua = ''
 | 
			
		||||
    -- Use buffer source for `/`
 | 
			
		||||
    require('cmp').setup.cmdline("/", {
 | 
			
		||||
        mapping = {
 | 
			
		||||
            ['<C-n>'] = {
 | 
			
		||||
                c = require('cmp').mapping.select_next_item({ behavior = require('cmp').SelectBehavior.Insert }, { 'i', 'c' })
 | 
			
		||||
            },
 | 
			
		||||
            ['<C-p>'] = {
 | 
			
		||||
                c = require('cmp').mapping.select_prev_item({ behavior = require('cmp').SelectBehavior.Insert }, { 'i', 'c' })
 | 
			
		||||
            },
 | 
			
		||||
            ['<C-y>'] = {
 | 
			
		||||
                c = require('cmp').mapping.confirm({ behavior = require('cmp').ConfirmBehavior.Insert, select = true, }, { 'i', 'c' })
 | 
			
		||||
            },
 | 
			
		||||
            ['<C-r>'] = {
 | 
			
		||||
                c = require('cmp').mapping.confirm({ behavior = require('cmp').ConfirmBehavior.Replace, select = true, }, { 'i', 'c' })
 | 
			
		||||
            },
 | 
			
		||||
        },
 | 
			
		||||
        sources = require('cmp').config.sources({
 | 
			
		||||
        sources = {
 | 
			
		||||
            { name = "buffer", keyword_length = 5 },
 | 
			
		||||
        }),
 | 
			
		||||
        },
 | 
			
		||||
    })
 | 
			
		||||
 | 
			
		||||
    -- Use cmdline & path source for ':'
 | 
			
		||||
    require('cmp').setup.cmdline(":", {
 | 
			
		||||
        mapping = {
 | 
			
		||||
            ['<C-n>'] = {
 | 
			
		||||
                c = require('cmp').mapping.select_next_item({ behavior = require('cmp').SelectBehavior.Insert }, { 'i', 'c' })
 | 
			
		||||
            },
 | 
			
		||||
            ['<C-p>'] = {
 | 
			
		||||
                c = require('cmp').mapping.select_prev_item({ behavior = require('cmp').SelectBehavior.Insert }, { 'i', 'c' })
 | 
			
		||||
            },
 | 
			
		||||
            ['<C-y>'] = {
 | 
			
		||||
                c = require('cmp').mapping.confirm({ behavior = require('cmp').ConfirmBehavior.Insert, select = true, }, { 'i', 'c' })
 | 
			
		||||
            },
 | 
			
		||||
            ['<C-r>'] = {
 | 
			
		||||
                c = require('cmp').mapping.confirm({ behavior = require('cmp').ConfirmBehavior.Replace, select = true, }, { 'i', 'c' })
 | 
			
		||||
            },
 | 
			
		||||
        },
 | 
			
		||||
        sources = require('cmp').config.sources({
 | 
			
		||||
            { name = "path" },
 | 
			
		||||
        }, {
 | 
			
		||||
@@ -173,4 +151,5 @@
 | 
			
		||||
        }),
 | 
			
		||||
    })
 | 
			
		||||
  '';
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,17 +0,0 @@
 | 
			
		||||
-- Keymap to open file in GitHub web
 | 
			
		||||
vim.keymap.set("n", "<Leader>gr", ":!gh browse %<CR><CR>", { silent = true })
 | 
			
		||||
 | 
			
		||||
-- Pop a terminal to watch the current run
 | 
			
		||||
local gitwatch = require("toggleterm.terminal").Terminal:new({
 | 
			
		||||
    cmd = "fish --interactive --init-command 'gh run watch'",
 | 
			
		||||
    hidden = true,
 | 
			
		||||
    direction = "float",
 | 
			
		||||
})
 | 
			
		||||
 | 
			
		||||
-- Set a toggle for this terminal
 | 
			
		||||
function GITWATCH_TOGGLE()
 | 
			
		||||
    gitwatch:toggle()
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
-- Keymap to toggle the run
 | 
			
		||||
vim.keymap.set("n", "<Leader>W", GITWATCH_TOGGLE)
 | 
			
		||||
@@ -1,5 +1,4 @@
 | 
			
		||||
{ pkgs, ... }:
 | 
			
		||||
{
 | 
			
		||||
{ pkgs, ... }: {
 | 
			
		||||
  plugins = [ pkgs.vimPlugins.gitsigns-nvim ];
 | 
			
		||||
  setup.gitsigns = { };
 | 
			
		||||
  lua = builtins.readFile ./gitsigns.lua;
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +0,0 @@
 | 
			
		||||
local k9s = require("toggleterm.terminal").Terminal:new({ cmd = "k9s" })
 | 
			
		||||
function K9S_TOGGLE()
 | 
			
		||||
    k9s:toggle()
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
vim.keymap.set("n", "<Leader>9", K9S_TOGGLE)
 | 
			
		||||
@@ -1,138 +1,66 @@
 | 
			
		||||
{
 | 
			
		||||
  pkgs,
 | 
			
		||||
  lib,
 | 
			
		||||
  config,
 | 
			
		||||
  dsl,
 | 
			
		||||
  ...
 | 
			
		||||
}:
 | 
			
		||||
{
 | 
			
		||||
{ pkgs, dsl, ... }: {
 | 
			
		||||
 | 
			
		||||
  # Terraform optional because non-free
 | 
			
		||||
  options.terraform = lib.mkEnableOption "Whether to enable Terraform LSP";
 | 
			
		||||
  options.github = lib.mkEnableOption "Whether to enable GitHub features";
 | 
			
		||||
  options.kubernetes = lib.mkEnableOption "Whether to enable Kubernetes features";
 | 
			
		||||
 | 
			
		||||
  config = {
 | 
			
		||||
  plugins = [
 | 
			
		||||
    pkgs.vimPlugins.nvim-lspconfig
 | 
			
		||||
      pkgs.vimPlugins.conform-nvim
 | 
			
		||||
      pkgs.vimPlugins.fidget-nvim
 | 
			
		||||
      pkgs.vimPlugins.nvim-lint
 | 
			
		||||
      pkgs.vimPlugins.vim-table-mode
 | 
			
		||||
    pkgs.vimPlugins.lsp-colors-nvim
 | 
			
		||||
    pkgs.vimPlugins.null-ls-nvim
 | 
			
		||||
  ];
 | 
			
		||||
 | 
			
		||||
    setup.fidget = { };
 | 
			
		||||
 | 
			
		||||
  use.lspconfig.lua_ls.setup = dsl.callWith {
 | 
			
		||||
      settings = {
 | 
			
		||||
        Lua = {
 | 
			
		||||
          diagnostics = {
 | 
			
		||||
            globals = [
 | 
			
		||||
              "vim"
 | 
			
		||||
              "hs"
 | 
			
		||||
            ];
 | 
			
		||||
          };
 | 
			
		||||
        };
 | 
			
		||||
      };
 | 
			
		||||
    settings = { Lua = { diagnostics = { globals = [ "vim" "hs" ]; }; }; };
 | 
			
		||||
    capabilities = dsl.rawLua "require('cmp_nvim_lsp').default_capabilities()";
 | 
			
		||||
    cmd = [ "${pkgs.lua-language-server}/bin/lua-language-server" ];
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
    use.lspconfig.nixd.setup = dsl.callWith {
 | 
			
		||||
      cmd = [ "${pkgs.nixd}/bin/nixd" ];
 | 
			
		||||
  use.lspconfig.nil_ls.setup = dsl.callWith {
 | 
			
		||||
    cmd = [ "${pkgs.nil}/bin/nil" ];
 | 
			
		||||
    capabilities = dsl.rawLua "require('cmp_nvim_lsp').default_capabilities()";
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  use.lspconfig.pyright.setup = dsl.callWith {
 | 
			
		||||
      cmd = [
 | 
			
		||||
        "${pkgs.pyright}/bin/pyright-langserver"
 | 
			
		||||
        "--stdio"
 | 
			
		||||
      ];
 | 
			
		||||
    cmd = [ "${pkgs.pyright}/bin/pyright-langserver" "--stdio" ];
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
    use.lspconfig.terraformls.setup = dsl.callWith {
 | 
			
		||||
      cmd =
 | 
			
		||||
        if config.terraform then
 | 
			
		||||
          [
 | 
			
		||||
            "${pkgs.terraform-ls}/bin/terraform-ls"
 | 
			
		||||
            "serve"
 | 
			
		||||
          ]
 | 
			
		||||
        else
 | 
			
		||||
          [ "echo" ];
 | 
			
		||||
    };
 | 
			
		||||
  use.lspconfig.terraformls.setup =
 | 
			
		||||
    dsl.callWith { cmd = [ "${pkgs.terraform-ls}/bin/terraform-ls" "serve" ]; };
 | 
			
		||||
 | 
			
		||||
    use.lspconfig.rust_analyzer.setup = dsl.callWith {
 | 
			
		||||
      cmd = [ "${pkgs.rust-analyzer}/bin/rust-analyzer" ];
 | 
			
		||||
      settings = {
 | 
			
		||||
        "['rust-analyzer']" = {
 | 
			
		||||
          check = {
 | 
			
		||||
            command = "clippy";
 | 
			
		||||
          };
 | 
			
		||||
          files = {
 | 
			
		||||
            excludeDirs = [ ".direnv" ];
 | 
			
		||||
          };
 | 
			
		||||
        };
 | 
			
		||||
      };
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    setup.conform = {
 | 
			
		||||
      format_on_save = {
 | 
			
		||||
        # These options will be passed to conform.format()
 | 
			
		||||
        timeout_ms = 1500;
 | 
			
		||||
        lsp_fallback = true;
 | 
			
		||||
      };
 | 
			
		||||
      formatters_by_ft = {
 | 
			
		||||
        lua = [ "stylua" ];
 | 
			
		||||
        python = [ "black" ];
 | 
			
		||||
        fish = [ "fish_indent" ];
 | 
			
		||||
        nix = [ "nixfmt" ];
 | 
			
		||||
        rust = [ "rustfmt" ];
 | 
			
		||||
        sh = [ "shfmt" ];
 | 
			
		||||
        terraform = if config.terraform then [ "terraform_fmt" ] else [ ];
 | 
			
		||||
        hcl = [ "hcl" ];
 | 
			
		||||
      };
 | 
			
		||||
      formatters = {
 | 
			
		||||
        lua.command = "${pkgs.stylua}/bin/stylua";
 | 
			
		||||
        black.command = "${pkgs.black}/bin/black";
 | 
			
		||||
        fish_indent.command = "${pkgs.fish}/bin/fish_indent";
 | 
			
		||||
        nixfmt.command = "${pkgs.nixfmt-rfc-style}/bin/nixfmt";
 | 
			
		||||
        rustfmt.command = "${pkgs.rustfmt}/bin/rustfmt";
 | 
			
		||||
        shfmt = {
 | 
			
		||||
          command = "${pkgs.shfmt}/bin/shfmt";
 | 
			
		||||
          prepend_args = [
 | 
			
		||||
            "-i"
 | 
			
		||||
            "4"
 | 
			
		||||
            "-ci"
 | 
			
		||||
          ];
 | 
			
		||||
        };
 | 
			
		||||
        terraform_fmt.command = if config.terraform then "${pkgs.terraform}/bin/terraform" else "";
 | 
			
		||||
        hcl.command = "${pkgs.hclfmt}/bin/hclfmt";
 | 
			
		||||
      };
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    use.lint = {
 | 
			
		||||
      linters_by_ft = dsl.toTable {
 | 
			
		||||
        python = [ "ruff" ];
 | 
			
		||||
        sh = [ "shellcheck" ];
 | 
			
		||||
      };
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    vim.api.nvim_create_autocmd = dsl.callWith [
 | 
			
		||||
      (dsl.toTable [
 | 
			
		||||
        "BufEnter"
 | 
			
		||||
        "BufWritePost"
 | 
			
		||||
      ])
 | 
			
		||||
      (dsl.rawLua "{ callback = function() require('lint').try_lint() end }")
 | 
			
		||||
    ];
 | 
			
		||||
  vim.api.nvim_create_augroup = dsl.callWith [ "LspFormatting" { } ];
 | 
			
		||||
 | 
			
		||||
  lua = ''
 | 
			
		||||
    ${builtins.readFile ./lsp.lua}
 | 
			
		||||
 | 
			
		||||
      local ruff = require('lint').linters.ruff; ruff.cmd = "${pkgs.ruff}/bin/ruff"
 | 
			
		||||
      local shellcheck = require('lint').linters.shellcheck; shellcheck.cmd = "${pkgs.shellcheck}/bin/shellcheck"
 | 
			
		||||
    require("null-ls").setup({
 | 
			
		||||
        sources = {
 | 
			
		||||
            require("null-ls").builtins.formatting.stylua.with({ command = "${pkgs.stylua}/bin/stylua" }),
 | 
			
		||||
            require("null-ls").builtins.formatting.black.with({ command = "${pkgs.black}/bin/black" }),
 | 
			
		||||
            require("null-ls").builtins.diagnostics.flake8.with({ command = "${pkgs.python310Packages.flake8}/bin/flake8" }),
 | 
			
		||||
            require("null-ls").builtins.formatting.fish_indent.with({ command = "${pkgs.fish}/bin/fish_indent" }),
 | 
			
		||||
            require("null-ls").builtins.formatting.nixfmt.with({ command = "${pkgs.nixfmt}/bin/nixfmt" }),
 | 
			
		||||
            require("null-ls").builtins.formatting.rustfmt.with({ command = "${pkgs.rustfmt}/bin/rustfmt" }),
 | 
			
		||||
            require("null-ls").builtins.diagnostics.shellcheck.with({ command = "${pkgs.shellcheck}/bin/shellcheck" }),
 | 
			
		||||
            require("null-ls").builtins.formatting.shfmt.with({
 | 
			
		||||
                command = "${pkgs.shfmt}/bin/shfmt",
 | 
			
		||||
                extra_args = { "-i", "4", "-ci" },
 | 
			
		||||
            }),
 | 
			
		||||
            require("null-ls").builtins.formatting.terraform_fmt.with({
 | 
			
		||||
                command = "${pkgs.terraform}/bin/terraform",
 | 
			
		||||
                extra_filetypes = { "hcl" },
 | 
			
		||||
            }),
 | 
			
		||||
        },
 | 
			
		||||
 | 
			
		||||
      -- Prevent infinite log size (change this when debugging)
 | 
			
		||||
      vim.lsp.set_log_level("off")
 | 
			
		||||
        on_attach = function(client, bufnr)
 | 
			
		||||
            if client.supports_method("textDocument/formatting") then
 | 
			
		||||
                vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr })
 | 
			
		||||
                vim.api.nvim_create_autocmd("BufWritePre", {
 | 
			
		||||
                    group = augroup,
 | 
			
		||||
                    buffer = bufnr,
 | 
			
		||||
                    callback = function()
 | 
			
		||||
                        vim.lsp.buf.format({ bufnr = bufnr })
 | 
			
		||||
                    end,
 | 
			
		||||
                })
 | 
			
		||||
            end
 | 
			
		||||
        end,
 | 
			
		||||
    })
 | 
			
		||||
  '';
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,28 +1,17 @@
 | 
			
		||||
{
 | 
			
		||||
  pkgs,
 | 
			
		||||
  dsl,
 | 
			
		||||
  lib,
 | 
			
		||||
  ...
 | 
			
		||||
}:
 | 
			
		||||
{
 | 
			
		||||
{ pkgs, dsl, lib, ... }: {
 | 
			
		||||
  plugins = [
 | 
			
		||||
    pkgs.vimPlugins.vim-surround # Keybinds for surround characters
 | 
			
		||||
    pkgs.vimPlugins.vim-eunuch # File manipulation commands
 | 
			
		||||
    pkgs.vimPlugins.vim-fugitive # Git commands
 | 
			
		||||
    pkgs.vimPlugins.vim-repeat # Better repeat using .
 | 
			
		||||
    pkgs.vimPlugins.markview-nvim # Markdown preview
 | 
			
		||||
    pkgs.vimPlugins.comment-nvim # Smart comment commands
 | 
			
		||||
    pkgs.vimPlugins.impatient-nvim # Faster load times
 | 
			
		||||
    pkgs.vimPlugins.glow-nvim # Markdown preview popup
 | 
			
		||||
    pkgs.vimPlugins.nvim-colorizer-lua # Hex color previews
 | 
			
		||||
    pkgs.vimPlugins.which-key-nvim # Keybind helper
 | 
			
		||||
  ];
 | 
			
		||||
 | 
			
		||||
  # Initialize some plugins
 | 
			
		||||
  setup.colorizer = {
 | 
			
		||||
    user_default_options = {
 | 
			
		||||
      names = false;
 | 
			
		||||
    };
 | 
			
		||||
  };
 | 
			
		||||
  setup.markview = { };
 | 
			
		||||
  setup.which-key = { };
 | 
			
		||||
  setup.Comment = { };
 | 
			
		||||
  setup.colorizer = { };
 | 
			
		||||
 | 
			
		||||
  vim.o = {
 | 
			
		||||
    termguicolors = true; # Set to truecolor
 | 
			
		||||
@@ -40,6 +29,7 @@
 | 
			
		||||
    scrolloff = 3; # Margin of lines to see while scrolling
 | 
			
		||||
    splitright = true; # Vertical splits on the right side
 | 
			
		||||
    splitbelow = true; # Horizontal splits on the bottom side
 | 
			
		||||
    pastetoggle = "<F3>"; # Use F3 to enter raw paste mode
 | 
			
		||||
    clipboard = "unnamedplus"; # Uses system clipboard for yanking
 | 
			
		||||
    updatetime = 300; # Faster diagnostics
 | 
			
		||||
    mouse = "nv"; # Mouse interaction / scrolling
 | 
			
		||||
@@ -51,26 +41,17 @@
 | 
			
		||||
    relativenumber = true; # Relative numbers instead of absolute
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  # For which-key-nvim
 | 
			
		||||
  vim.o.timeout = true;
 | 
			
		||||
  vim.o.timeoutlen = 300;
 | 
			
		||||
 | 
			
		||||
  # Better backup, swap and undo storage
 | 
			
		||||
  vim.o.backup = true; # Easier to recover and more secure
 | 
			
		||||
  vim.opt.undofile = true; # Keeps undos after quit
 | 
			
		||||
  vim.opt.swapfile = false; # Instead of swaps, create backups
 | 
			
		||||
  vim.o.backupdir = dsl.rawLua ''vim.fn.expand("~/.local/state/nvim/backup//")'';
 | 
			
		||||
  vim.o.undodir = dsl.rawLua ''vim.fn.expand("~/.local/state/nvim/undo//")'';
 | 
			
		||||
  vim.bo.swapfile = false; # Instead of swaps, create backups
 | 
			
		||||
  vim.bo.undofile = true; # Keeps undos after quit
 | 
			
		||||
  vim.o.backupdir = dsl.rawLua ''vim.fn.stdpath("cache") .. "/backup"'';
 | 
			
		||||
 | 
			
		||||
  # Required for nvim-cmp completion
 | 
			
		||||
  vim.opt.completeopt = [
 | 
			
		||||
    "menu"
 | 
			
		||||
    "menuone"
 | 
			
		||||
    "noselect"
 | 
			
		||||
  ];
 | 
			
		||||
  vim.opt.completeopt = [ "menu" "menuone" "noselect" ];
 | 
			
		||||
 | 
			
		||||
  lua = lib.mkBefore ''
 | 
			
		||||
    vim.loader.enable()
 | 
			
		||||
    require("impatient")
 | 
			
		||||
    ${builtins.readFile ../lua/keybinds.lua};
 | 
			
		||||
    ${builtins.readFile ../lua/settings.lua};
 | 
			
		||||
  '';
 | 
			
		||||
@@ -79,6 +60,10 @@
 | 
			
		||||
    " Remember last position when reopening file
 | 
			
		||||
    au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") | exe "normal! g`\"" | endif
 | 
			
		||||
 | 
			
		||||
    " LaTeX options
 | 
			
		||||
    au FileType tex inoremap ;bf \textbf{}<Esc>i
 | 
			
		||||
    au BufWritePost *.tex silent! execute "!pdflatex -output-directory=%:p:h % >/dev/null 2>&1" | redraw!
 | 
			
		||||
 | 
			
		||||
    " Flash highlight when yanking
 | 
			
		||||
    au TextYankPost * silent! lua vim.highlight.on_yank { timeout = 250 }
 | 
			
		||||
  '';
 | 
			
		||||
 
 | 
			
		||||
@@ -1,9 +1,8 @@
 | 
			
		||||
{ pkgs, ... }:
 | 
			
		||||
{
 | 
			
		||||
{ pkgs, ... }: {
 | 
			
		||||
  plugins = [ pkgs.vimPlugins.lualine-nvim ];
 | 
			
		||||
  setup.lualine = {
 | 
			
		||||
    options = {
 | 
			
		||||
      theme = "base16";
 | 
			
		||||
      theme = "gruvbox";
 | 
			
		||||
      icons_enabled = true;
 | 
			
		||||
    };
 | 
			
		||||
  };
 | 
			
		||||
 
 | 
			
		||||
@@ -1,49 +1,26 @@
 | 
			
		||||
{ pkgs, lib, ... }:
 | 
			
		||||
{
 | 
			
		||||
{ pkgs, ... }: {
 | 
			
		||||
 | 
			
		||||
  plugins = [
 | 
			
		||||
    (pkgs.vimPlugins.nvim-treesitter.withPlugins (
 | 
			
		||||
      _plugins: with pkgs.tree-sitter-grammars; [
 | 
			
		||||
        tree-sitter-bash
 | 
			
		||||
        tree-sitter-c
 | 
			
		||||
        tree-sitter-fish
 | 
			
		||||
    (pkgs.vimPlugins.nvim-treesitter.withPlugins (_plugins:
 | 
			
		||||
      with pkgs.tree-sitter-grammars; [
 | 
			
		||||
        tree-sitter-hcl
 | 
			
		||||
        tree-sitter-ini
 | 
			
		||||
        tree-sitter-json
 | 
			
		||||
        tree-sitter-lua
 | 
			
		||||
        tree-sitter-markdown
 | 
			
		||||
        tree-sitter-markdown-inline
 | 
			
		||||
        tree-sitter-nix
 | 
			
		||||
        tree-sitter-puppet
 | 
			
		||||
        tree-sitter-python
 | 
			
		||||
        tree-sitter-rasi
 | 
			
		||||
        tree-sitter-lua
 | 
			
		||||
        tree-sitter-nix
 | 
			
		||||
        tree-sitter-fish
 | 
			
		||||
        tree-sitter-toml
 | 
			
		||||
        tree-sitter-vimdoc
 | 
			
		||||
        tree-sitter-yaml
 | 
			
		||||
      ]
 | 
			
		||||
    ))
 | 
			
		||||
        tree-sitter-json
 | 
			
		||||
      ]))
 | 
			
		||||
    pkgs.vimPlugins.vim-matchup # Better % jumping in languages
 | 
			
		||||
    pkgs.vimPlugins.playground # Tree-sitter experimenting
 | 
			
		||||
    pkgs.vimPlugins.nginx-vim
 | 
			
		||||
    pkgs.vimPlugins.vim-helm
 | 
			
		||||
    # pkgs.vimPlugins.hmts-nvim # Tree-sitter injections for home-manager
 | 
			
		||||
    (pkgs.vimUtils.buildVimPlugin {
 | 
			
		||||
      pname = "nmasur";
 | 
			
		||||
      version = "0.1";
 | 
			
		||||
      src = ../plugin;
 | 
			
		||||
    })
 | 
			
		||||
    pkgs.vimPlugins.vim-puppet
 | 
			
		||||
  ];
 | 
			
		||||
 | 
			
		||||
  setup."nvim-treesitter.configs" = {
 | 
			
		||||
    highlight = {
 | 
			
		||||
      enable = true;
 | 
			
		||||
    };
 | 
			
		||||
    indent = {
 | 
			
		||||
      enable = true;
 | 
			
		||||
    };
 | 
			
		||||
    matchup = {
 | 
			
		||||
      enable = true;
 | 
			
		||||
    }; # Uses vim-matchup
 | 
			
		||||
    highlight = { enable = true; };
 | 
			
		||||
    indent = { enable = true; };
 | 
			
		||||
 | 
			
		||||
    textobjects = {
 | 
			
		||||
      select = {
 | 
			
		||||
@@ -72,9 +49,4 @@
 | 
			
		||||
    };
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  # Use mkAfter to ensure tree-sitter is already loaded
 | 
			
		||||
  lua = lib.mkAfter ''
 | 
			
		||||
    -- Use HCL parser with .tf files
 | 
			
		||||
    vim.treesitter.language.register('hcl', 'terraform')
 | 
			
		||||
  '';
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -13,7 +13,6 @@ vim.keymap.set("n", "<Leader>gf", telescope.git_bcommits)
 | 
			
		||||
vim.keymap.set("n", "<Leader>gb", telescope.git_branches)
 | 
			
		||||
vim.keymap.set("n", "<Leader>gs", telescope.git_status)
 | 
			
		||||
vim.keymap.set("n", "<Leader>s", telescope.current_buffer_fuzzy_find)
 | 
			
		||||
vim.keymap.set("n", "<Leader>rr", telescope.resume)
 | 
			
		||||
 | 
			
		||||
vim.keymap.set("n", "<Leader>N", function()
 | 
			
		||||
    local opts = {
 | 
			
		||||
@@ -46,7 +45,7 @@ end)
 | 
			
		||||
vim.keymap.set("n", "<Leader>fz", require("telescope").extensions.zoxide.list)
 | 
			
		||||
 | 
			
		||||
-- Project
 | 
			
		||||
require("telescope").load_extension("projects")
 | 
			
		||||
require("telescope").load_extension("project")
 | 
			
		||||
vim.keymap.set("n", "<C-p>", function()
 | 
			
		||||
    local opts = require("telescope.themes").get_ivy({
 | 
			
		||||
        layout_config = {
 | 
			
		||||
@@ -55,7 +54,7 @@ vim.keymap.set("n", "<C-p>", function()
 | 
			
		||||
            },
 | 
			
		||||
        },
 | 
			
		||||
    })
 | 
			
		||||
    require("telescope").extensions.projects.projects(opts)
 | 
			
		||||
    require("telescope").extensions.project.project(opts)
 | 
			
		||||
end)
 | 
			
		||||
 | 
			
		||||
-- File browser
 | 
			
		||||
 
 | 
			
		||||
@@ -1,11 +1,8 @@
 | 
			
		||||
{ pkgs, dsl, ... }:
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
  # Telescope is a fuzzy finder that can work with different sub-plugins
 | 
			
		||||
{ pkgs, dsl, ... }: {
 | 
			
		||||
 | 
			
		||||
  plugins = [
 | 
			
		||||
    pkgs.vimPlugins.telescope-nvim
 | 
			
		||||
    pkgs.vimPlugins.project-nvim
 | 
			
		||||
    pkgs.vimPlugins.telescope-project-nvim
 | 
			
		||||
    pkgs.vimPlugins.telescope-fzy-native-nvim
 | 
			
		||||
    pkgs.vimPlugins.telescope-file-browser-nvim
 | 
			
		||||
    pkgs.vimPlugins.telescope-zoxide
 | 
			
		||||
@@ -21,23 +18,17 @@
 | 
			
		||||
      };
 | 
			
		||||
    };
 | 
			
		||||
    pickers = {
 | 
			
		||||
      find_files = {
 | 
			
		||||
        theme = "ivy";
 | 
			
		||||
      };
 | 
			
		||||
      oldfiles = {
 | 
			
		||||
        theme = "ivy";
 | 
			
		||||
      };
 | 
			
		||||
      buffers = {
 | 
			
		||||
        theme = "dropdown";
 | 
			
		||||
      };
 | 
			
		||||
      find_files = { theme = "ivy"; };
 | 
			
		||||
      oldfiles = { theme = "ivy"; };
 | 
			
		||||
      buffers = { theme = "dropdown"; };
 | 
			
		||||
    };
 | 
			
		||||
    extensions = {
 | 
			
		||||
      fzy_native = { };
 | 
			
		||||
      zoxide = { };
 | 
			
		||||
      project = { base_dirs = [ "~/dev" ]; };
 | 
			
		||||
    };
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  setup.project_nvim = { };
 | 
			
		||||
 | 
			
		||||
  lua = builtins.readFile ./telescope.lua;
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -12,8 +12,6 @@ vim.api.nvim_create_autocmd("TermOpen", {
 | 
			
		||||
    end,
 | 
			
		||||
})
 | 
			
		||||
 | 
			
		||||
-- These are all the different types of terminals we can trigger
 | 
			
		||||
 | 
			
		||||
local terminal = require("toggleterm.terminal").Terminal
 | 
			
		||||
 | 
			
		||||
local basicterminal = terminal:new()
 | 
			
		||||
@@ -26,5 +24,17 @@ function NIXPKGS_TOGGLE()
 | 
			
		||||
    nixpkgs:toggle()
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
local gitwatch = terminal:new({ cmd = "fish --interactive --init-command 'gh run watch'" })
 | 
			
		||||
function GITWATCH_TOGGLE()
 | 
			
		||||
    gitwatch:toggle()
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
local k9s = terminal:new({ cmd = "k9s" })
 | 
			
		||||
function K9S_TOGGLE()
 | 
			
		||||
    k9s:toggle()
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
vim.keymap.set("n", "<Leader>t", TERM_TOGGLE)
 | 
			
		||||
vim.keymap.set("n", "<Leader>P", NIXPKGS_TOGGLE)
 | 
			
		||||
vim.keymap.set("n", "<Leader>gw", GITWATCH_TOGGLE)
 | 
			
		||||
vim.keymap.set("n", "<Leader>9", K9S_TOGGLE)
 | 
			
		||||
 
 | 
			
		||||
@@ -1,12 +1,4 @@
 | 
			
		||||
{
 | 
			
		||||
  pkgs,
 | 
			
		||||
  dsl,
 | 
			
		||||
  config,
 | 
			
		||||
  ...
 | 
			
		||||
}:
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
  # Toggleterm provides a floating terminal inside the editor for quick access
 | 
			
		||||
{ pkgs, dsl, ... }: {
 | 
			
		||||
 | 
			
		||||
  plugins = [ pkgs.vimPlugins.toggleterm-nvim ];
 | 
			
		||||
 | 
			
		||||
@@ -16,9 +8,6 @@
 | 
			
		||||
    direction = "float";
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  lua = ''
 | 
			
		||||
    ${builtins.readFile ./toggleterm.lua}
 | 
			
		||||
    ${if config.github then (builtins.readFile ./github.lua) else ""}
 | 
			
		||||
    ${if config.kubernetes then (builtins.readFile ./kubernetes.lua) else ""}
 | 
			
		||||
  '';
 | 
			
		||||
  lua = builtins.readFile ./toggleterm.lua;
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,12 +1,6 @@
 | 
			
		||||
{ pkgs, dsl, ... }:
 | 
			
		||||
{
 | 
			
		||||
{ pkgs, dsl, ... }: {
 | 
			
		||||
 | 
			
		||||
  # This plugin creates a side drawer for navigating the current project
 | 
			
		||||
 | 
			
		||||
  plugins = [
 | 
			
		||||
    pkgs.vimPlugins.nvim-tree-lua
 | 
			
		||||
    pkgs.vimPlugins.nvim-web-devicons
 | 
			
		||||
  ];
 | 
			
		||||
  plugins = [ pkgs.vimPlugins.nvim-tree-lua pkgs.vimPlugins.nvim-web-devicons ];
 | 
			
		||||
 | 
			
		||||
  # Disable netrw eagerly
 | 
			
		||||
  # https://github.com/kyazdani42/nvim-tree.lua/commit/fb8735e96cecf004fbefb086ce85371d003c5129
 | 
			
		||||
@@ -16,18 +10,14 @@
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  setup.nvim-tree = {
 | 
			
		||||
    disable_netrw = true; # Disable the built-in file manager
 | 
			
		||||
    hijack_netrw = true; # Works as the file manager
 | 
			
		||||
    sync_root_with_cwd = true; # Change project whenever currend dir changes
 | 
			
		||||
    respect_buf_cwd = true; # Change to exact location of focused buffer
 | 
			
		||||
    disable_netrw = true;
 | 
			
		||||
    hijack_netrw = true;
 | 
			
		||||
    update_focused_file = {
 | 
			
		||||
      # Change project based on the focused buffer
 | 
			
		||||
      enable = true;
 | 
			
		||||
      update_root = true;
 | 
			
		||||
      update_cwd = true;
 | 
			
		||||
      ignore_list = { };
 | 
			
		||||
    };
 | 
			
		||||
    diagnostics = {
 | 
			
		||||
      # Enable LSP and linter integration
 | 
			
		||||
      enable = true;
 | 
			
		||||
      icons = {
 | 
			
		||||
        hint = "";
 | 
			
		||||
@@ -37,7 +27,6 @@
 | 
			
		||||
      };
 | 
			
		||||
    };
 | 
			
		||||
    renderer = {
 | 
			
		||||
      # Show files with changes vs. current commit
 | 
			
		||||
      icons = {
 | 
			
		||||
        glyphs = {
 | 
			
		||||
          git = {
 | 
			
		||||
@@ -52,33 +41,37 @@
 | 
			
		||||
        };
 | 
			
		||||
      };
 | 
			
		||||
    };
 | 
			
		||||
    # Set keybinds and initialize program
 | 
			
		||||
    on_attach = dsl.rawLua ''
 | 
			
		||||
      function (bufnr)
 | 
			
		||||
        local api = require('nvim-tree.api')
 | 
			
		||||
        local function opts(desc)
 | 
			
		||||
          return { desc = 'nvim-tree: ' .. desc, buffer = bufnr, noremap = true, silent = true, nowait = true }
 | 
			
		||||
        end
 | 
			
		||||
        api.config.mappings.default_on_attach(bufnr)
 | 
			
		||||
 | 
			
		||||
        vim.keymap.set('n', 'l', api.node.open.edit, opts('Open'))
 | 
			
		||||
        vim.keymap.set('n', '<CR>', api.node.open.edit, opts('Open'))
 | 
			
		||||
        vim.keymap.set('n', 'o', api.node.open.edit, opts('Open'))
 | 
			
		||||
        vim.keymap.set('n', 'h', api.node.navigate.parent_close, opts('Close Directory'))
 | 
			
		||||
        vim.keymap.set('n', 'v', api.node.open.vertical, opts('Open: Vertical Split'))
 | 
			
		||||
      end
 | 
			
		||||
    '';
 | 
			
		||||
    view = {
 | 
			
		||||
      # Set look and feel
 | 
			
		||||
      width = 30;
 | 
			
		||||
      hide_root_folder = false;
 | 
			
		||||
      side = "left";
 | 
			
		||||
      mappings = {
 | 
			
		||||
        custom_only = false;
 | 
			
		||||
        list = [
 | 
			
		||||
          {
 | 
			
		||||
            key = [ "l" "<CR>" "o" ];
 | 
			
		||||
            cb = dsl.rawLua
 | 
			
		||||
              "require('nvim-tree.config').nvim_tree_callback('edit')";
 | 
			
		||||
          }
 | 
			
		||||
          {
 | 
			
		||||
            key = "h";
 | 
			
		||||
            cb = dsl.rawLua
 | 
			
		||||
              "require('nvim-tree.config').nvim_tree_callback('close_node')";
 | 
			
		||||
          }
 | 
			
		||||
          {
 | 
			
		||||
            key = "v";
 | 
			
		||||
            cb = dsl.rawLua
 | 
			
		||||
              "require('nvim-tree.config').nvim_tree_callback('vsplit')";
 | 
			
		||||
          }
 | 
			
		||||
        ];
 | 
			
		||||
      };
 | 
			
		||||
      number = false;
 | 
			
		||||
      relativenumber = false;
 | 
			
		||||
    };
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  # Toggle the sidebar
 | 
			
		||||
  lua = ''
 | 
			
		||||
    vim.keymap.set("n", "<Leader>e", ":NvimTreeFindFileToggle<CR>", { silent = true })
 | 
			
		||||
  '';
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,21 +1,13 @@
 | 
			
		||||
{
 | 
			
		||||
  config,
 | 
			
		||||
  pkgs,
 | 
			
		||||
  lib,
 | 
			
		||||
  ...
 | 
			
		||||
}:
 | 
			
		||||
{ config, pkgs, lib, ... }:
 | 
			
		||||
 | 
			
		||||
let
 | 
			
		||||
 | 
			
		||||
  neovim = import ./package {
 | 
			
		||||
    inherit pkgs;
 | 
			
		||||
    colors = config.theme.colors;
 | 
			
		||||
    terraform = config.terraform.enable;
 | 
			
		||||
    github = true;
 | 
			
		||||
    kubernetes = config.kubernetes.enable;
 | 
			
		||||
    colors = import config.theme.colors.neovimConfig { inherit pkgs; };
 | 
			
		||||
  };
 | 
			
		||||
in
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
in {
 | 
			
		||||
 | 
			
		||||
  options.neovim.enable = lib.mkEnableOption "Neovim.";
 | 
			
		||||
 | 
			
		||||
@@ -26,42 +18,35 @@ in
 | 
			
		||||
 | 
			
		||||
        home.packages = [ neovim ];
 | 
			
		||||
 | 
			
		||||
        # Use Neovim as the editor for git commit messages
 | 
			
		||||
        programs.git.extraConfig.core.editor = "nvim";
 | 
			
		||||
        programs.jujutsu.settings.ui.editor = "nvim";
 | 
			
		||||
 | 
			
		||||
        # Set Neovim as the default app for text editing and manual pages
 | 
			
		||||
        home.sessionVariables = {
 | 
			
		||||
          EDITOR = "nvim";
 | 
			
		||||
          MANPAGER = "nvim +Man!";
 | 
			
		||||
        };
 | 
			
		||||
 | 
			
		||||
        # Create quick aliases for launching Neovim
 | 
			
		||||
        programs.fish = {
 | 
			
		||||
          shellAliases = {
 | 
			
		||||
            vim = "nvim";
 | 
			
		||||
          };
 | 
			
		||||
          shellAliases = { vim = "nvim"; };
 | 
			
		||||
          shellAbbrs = {
 | 
			
		||||
            v = lib.mkForce "nvim";
 | 
			
		||||
            vl = lib.mkForce "nvim -c 'normal! `0' -c 'bdelete 1'";
 | 
			
		||||
            vll = "nvim -c 'Telescope oldfiles'";
 | 
			
		||||
          };
 | 
			
		||||
        };
 | 
			
		||||
        programs.kitty.settings.scrollback_pager = lib.mkForce ''
 | 
			
		||||
          ${neovim}/bin/nvim -c 'setlocal nonumber nolist showtabline=0 foldcolumn=0|Man!' -c "autocmd VimEnter * normal G" -'';
 | 
			
		||||
 | 
			
		||||
        # Create a desktop option for launching Neovim from a file manager
 | 
			
		||||
        # (Requires launching the terminal and then executing Neovim)
 | 
			
		||||
        xdg.desktopEntries.nvim = lib.mkIf pkgs.stdenv.isLinux {
 | 
			
		||||
          name = "Neovim wrapper";
 | 
			
		||||
          exec = "kitty nvim %F";
 | 
			
		||||
          mimeType = [
 | 
			
		||||
            "text/plain"
 | 
			
		||||
            "text/markdown"
 | 
			
		||||
          ];
 | 
			
		||||
        };
 | 
			
		||||
        xdg.mimeApps.defaultApplications = lib.mkIf pkgs.stdenv.isLinux {
 | 
			
		||||
          "text/plain" = [ "nvim.desktop" ];
 | 
			
		||||
          "text/markdown" = [ "nvim.desktop" ];
 | 
			
		||||
        xdg.mimeApps = lib.mkIf pkgs.stdenv.isLinux {
 | 
			
		||||
          defaultApplications."text/markdown" = [ "nvim.desktop" ];
 | 
			
		||||
        };
 | 
			
		||||
 | 
			
		||||
      };
 | 
			
		||||
 | 
			
		||||
    # # Used for icons in Vim
 | 
			
		||||
    # fonts.fonts = with pkgs; [ nerdfonts ];
 | 
			
		||||
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										4
									
								
								modules/common/neovim/init.lua
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								modules/common/neovim/init.lua
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,4 @@
 | 
			
		||||
require("packer_init")
 | 
			
		||||
require("settings")
 | 
			
		||||
require("keybinds")
 | 
			
		||||
require("background")
 | 
			
		||||
@@ -39,6 +39,7 @@ key("n", "<Leader>fs", ":write<CR>")
 | 
			
		||||
key("n", "<Leader>fd", ":lcd %:p:h<CR>", { silent = true })
 | 
			
		||||
key("n", "<Leader>fu", ":lcd ..<CR>", { silent = true })
 | 
			
		||||
key("n", "<Leader><Tab>", ":b#<CR>", { silent = true })
 | 
			
		||||
key("n", "<Leader>gr", ":!gh repo view -w<CR><CR>", { silent = true })
 | 
			
		||||
key("n", "<Leader>tt", [[<Cmd>exe 'edit $NOTES_PATH/journal/'.strftime("%Y-%m-%d_%a").'.md'<CR>]])
 | 
			
		||||
key("n", "<Leader>jj", ":!journal<CR>:e<CR>")
 | 
			
		||||
 | 
			
		||||
@@ -47,6 +48,11 @@ key("n", "<Leader>wv", ":vsplit<CR>")
 | 
			
		||||
key("n", "<Leader>wh", ":split<CR>")
 | 
			
		||||
key("n", "<Leader>wm", ":only<CR>")
 | 
			
		||||
 | 
			
		||||
-- Vimrc editing
 | 
			
		||||
key("n", "<Leader>rr", ":luafile $HOME/.config/nvim/init.lua<CR>")
 | 
			
		||||
key("n", "<Leader>rp", ":luafile $HOME/.config/nvim/init.lua<CR>:PackerInstall<CR>:")
 | 
			
		||||
key("n", "<Leader>rc", ":luafile $HOME/.config/nvim/init.lua<CR>:PackerCompile<CR>")
 | 
			
		||||
 | 
			
		||||
-- Keep cursor in place
 | 
			
		||||
key("n", "n", "nzz")
 | 
			
		||||
key("n", "N", "Nzz")
 | 
			
		||||
@@ -64,12 +70,6 @@ key("n", "<C-Down>", ":resize -2<CR>", { silent = true })
 | 
			
		||||
key("n", "<C-Left>", ":vertical resize -2<CR>", { silent = true })
 | 
			
		||||
key("n", "<C-Right>", ":vertical resize +2<CR>", { silent = true })
 | 
			
		||||
 | 
			
		||||
-- Quickfix
 | 
			
		||||
key("n", "]q", ":cnext<CR>")
 | 
			
		||||
key("n", "[q", ":cprevious<CR>")
 | 
			
		||||
key("n", "co", ":copen<CR>")
 | 
			
		||||
key("n", "cq", ":cclose<CR>")
 | 
			
		||||
 | 
			
		||||
-- Other
 | 
			
		||||
key("n", "<A-CR>", ":noh<CR>", { silent = true }) --- Clear search in VimWiki
 | 
			
		||||
key("n", "Y", "y$") --- Copy to end of line
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										164
									
								
								modules/common/neovim/lua/packer/completion.lua
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										164
									
								
								modules/common/neovim/lua/packer/completion.lua
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,164 @@
 | 
			
		||||
-- =======================================================================
 | 
			
		||||
-- Completion System
 | 
			
		||||
-- =======================================================================
 | 
			
		||||
 | 
			
		||||
local M = {}
 | 
			
		||||
 | 
			
		||||
M.packer = function(use)
 | 
			
		||||
    -- Completion sources
 | 
			
		||||
    use("hrsh7th/cmp-nvim-lsp") --- Language server completion plugin
 | 
			
		||||
    use("hrsh7th/cmp-buffer") --- Generic text completion
 | 
			
		||||
    use("hrsh7th/cmp-path") --- Local file completion
 | 
			
		||||
    use("hrsh7th/cmp-cmdline") --- Command line completion
 | 
			
		||||
    use("hrsh7th/cmp-nvim-lua") --- Nvim lua api completion
 | 
			
		||||
    use("saadparwaiz1/cmp_luasnip") --- Luasnip completion
 | 
			
		||||
    use("lukas-reineke/cmp-rg") --- Ripgrep completion
 | 
			
		||||
    use("rafamadriz/friendly-snippets") -- Lots of pre-generated snippets
 | 
			
		||||
 | 
			
		||||
    -- Completion engine
 | 
			
		||||
    use({
 | 
			
		||||
        "hrsh7th/nvim-cmp",
 | 
			
		||||
        requires = { "L3MON4D3/LuaSnip" },
 | 
			
		||||
        config = function()
 | 
			
		||||
            local cmp = require("cmp")
 | 
			
		||||
 | 
			
		||||
            local kind_icons = {
 | 
			
		||||
                Text = "",
 | 
			
		||||
                Method = "m",
 | 
			
		||||
                Function = "",
 | 
			
		||||
                Constructor = "",
 | 
			
		||||
                Field = "",
 | 
			
		||||
                Variable = "",
 | 
			
		||||
                Class = "",
 | 
			
		||||
                Interface = "",
 | 
			
		||||
                Module = "",
 | 
			
		||||
                Property = "",
 | 
			
		||||
                Unit = "",
 | 
			
		||||
                Value = "",
 | 
			
		||||
                Enum = "",
 | 
			
		||||
                Keyword = "",
 | 
			
		||||
                Snippet = "",
 | 
			
		||||
                Color = "",
 | 
			
		||||
                File = "",
 | 
			
		||||
                Reference = "",
 | 
			
		||||
                Folder = "",
 | 
			
		||||
                EnumMember = "",
 | 
			
		||||
                Constant = "",
 | 
			
		||||
                Struct = "",
 | 
			
		||||
                Event = "",
 | 
			
		||||
                Operator = "",
 | 
			
		||||
                TypeParameter = "",
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            cmp.setup({
 | 
			
		||||
 | 
			
		||||
                -- Only enable on non-prompt buffers
 | 
			
		||||
                -- So don't use in telescope
 | 
			
		||||
                enabled = function()
 | 
			
		||||
                    if vim.bo.buftype == "prompt" then
 | 
			
		||||
                        return false
 | 
			
		||||
                    end
 | 
			
		||||
                    return true
 | 
			
		||||
                end,
 | 
			
		||||
 | 
			
		||||
                -- Setup snippet completion
 | 
			
		||||
                snippet = {
 | 
			
		||||
                    expand = function(args)
 | 
			
		||||
                        require("luasnip").lsp_expand(args.body)
 | 
			
		||||
                    end,
 | 
			
		||||
                },
 | 
			
		||||
 | 
			
		||||
                -- Setup completion keybinds
 | 
			
		||||
                mapping = {
 | 
			
		||||
                    ["<C-n>"] = cmp.mapping(cmp.mapping.select_next_item(), { "i", "c" }),
 | 
			
		||||
                    ["<C-p>"] = cmp.mapping(cmp.mapping.select_prev_item(), { "i", "c" }),
 | 
			
		||||
                    ["<C-d>"] = cmp.mapping(cmp.mapping.scroll_docs(-4), { "i", "c" }),
 | 
			
		||||
                    ["<C-f>"] = cmp.mapping(cmp.mapping.scroll_docs(4), { "i", "c" }),
 | 
			
		||||
                    ["<C-e>"] = cmp.mapping(cmp.mapping.abort(), { "i", "c" }),
 | 
			
		||||
                    ["<Esc>"] = function(_)
 | 
			
		||||
                        cmp.mapping({
 | 
			
		||||
                            i = cmp.mapping.abort(),
 | 
			
		||||
                            c = cmp.mapping.close(),
 | 
			
		||||
                        })
 | 
			
		||||
                        vim.cmd("stopinsert") --- Abort and leave insert mode
 | 
			
		||||
                    end,
 | 
			
		||||
                    ["<CR>"] = cmp.mapping.confirm({
 | 
			
		||||
                        behavior = cmp.ConfirmBehavior.Insert,
 | 
			
		||||
                        select = true,
 | 
			
		||||
                    }),
 | 
			
		||||
                    ["<C-r>"] = cmp.mapping.confirm({
 | 
			
		||||
                        behavior = cmp.ConfirmBehavior.Replace,
 | 
			
		||||
                        select = true,
 | 
			
		||||
                    }),
 | 
			
		||||
                    ["<C-l>"] = cmp.mapping(function(_)
 | 
			
		||||
                        if require("luasnip").expand_or_jumpable() then
 | 
			
		||||
                            require("luasnip").expand_or_jump()
 | 
			
		||||
                        end
 | 
			
		||||
                    end, { "i", "s" }),
 | 
			
		||||
                },
 | 
			
		||||
 | 
			
		||||
                -- Setup completion engines
 | 
			
		||||
                sources = {
 | 
			
		||||
                    { name = "nvim_lua" },
 | 
			
		||||
                    { name = "nvim_lsp" },
 | 
			
		||||
                    { name = "luasnip" },
 | 
			
		||||
                    { name = "path" },
 | 
			
		||||
                    { name = "buffer", keyword_length = 3, max_item_count = 10 },
 | 
			
		||||
                    {
 | 
			
		||||
                        name = "rg",
 | 
			
		||||
                        keyword_length = 6,
 | 
			
		||||
                        max_item_count = 10,
 | 
			
		||||
                        option = { additional_arguments = "--ignore-case" },
 | 
			
		||||
                    },
 | 
			
		||||
                },
 | 
			
		||||
 | 
			
		||||
                -- Visual presentation
 | 
			
		||||
                formatting = {
 | 
			
		||||
                    fields = { "kind", "abbr", "menu" },
 | 
			
		||||
                    format = function(entry, vim_item)
 | 
			
		||||
                        vim_item.kind = string.format("%s", kind_icons[vim_item.kind])
 | 
			
		||||
                        vim_item.menu = ({
 | 
			
		||||
                            luasnip = "[Snippet]",
 | 
			
		||||
                            buffer = "[Buffer]",
 | 
			
		||||
                            path = "[Path]",
 | 
			
		||||
                            rg = "[Grep]",
 | 
			
		||||
                            nvim_lsp = "[LSP]",
 | 
			
		||||
                            nvim_lua = "[Lua]",
 | 
			
		||||
                        })[entry.source.name]
 | 
			
		||||
                        return vim_item
 | 
			
		||||
                    end,
 | 
			
		||||
                },
 | 
			
		||||
 | 
			
		||||
                -- Docs
 | 
			
		||||
                -- window = {
 | 
			
		||||
                --     completion = cmp.config.window.bordered(),
 | 
			
		||||
                --     documentation = cmp.config.window.bordered(),
 | 
			
		||||
                -- },
 | 
			
		||||
 | 
			
		||||
                -- Extra features
 | 
			
		||||
                experimental = {
 | 
			
		||||
                    native_menu = false, --- Use cmp menu instead of Vim menu
 | 
			
		||||
                    ghost_text = true, --- Show preview auto-completion
 | 
			
		||||
                },
 | 
			
		||||
            })
 | 
			
		||||
 | 
			
		||||
            -- Use buffer source for `/`
 | 
			
		||||
            cmp.setup.cmdline("/", {
 | 
			
		||||
                sources = {
 | 
			
		||||
                    { name = "buffer", keyword_length = 5 },
 | 
			
		||||
                },
 | 
			
		||||
            })
 | 
			
		||||
 | 
			
		||||
            -- Use cmdline & path source for ':'
 | 
			
		||||
            cmp.setup.cmdline(":", {
 | 
			
		||||
                sources = cmp.config.sources({
 | 
			
		||||
                    { name = "path" },
 | 
			
		||||
                }, {
 | 
			
		||||
                    { name = "cmdline" },
 | 
			
		||||
                }),
 | 
			
		||||
            })
 | 
			
		||||
        end,
 | 
			
		||||
    })
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
return M
 | 
			
		||||
							
								
								
									
										153
									
								
								modules/common/neovim/lua/packer/lsp.lua
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										153
									
								
								modules/common/neovim/lua/packer/lsp.lua
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,153 @@
 | 
			
		||||
-- =======================================================================
 | 
			
		||||
-- Language Server
 | 
			
		||||
-- =======================================================================
 | 
			
		||||
 | 
			
		||||
local M = {}
 | 
			
		||||
 | 
			
		||||
M.packer = function(use)
 | 
			
		||||
    -- Language server engine
 | 
			
		||||
    use({
 | 
			
		||||
        "neovim/nvim-lspconfig",
 | 
			
		||||
        requires = { "hrsh7th/cmp-nvim-lsp" },
 | 
			
		||||
        config = function()
 | 
			
		||||
            local function on_path(program)
 | 
			
		||||
                return vim.fn.executable(program) == 1
 | 
			
		||||
            end
 | 
			
		||||
 | 
			
		||||
            local capabilities = require("cmp_nvim_lsp").default_capabilities()
 | 
			
		||||
            if on_path("lua-language-server") then
 | 
			
		||||
                require("lspconfig").sumneko_lua.setup({
 | 
			
		||||
                    capabilities = capabilities,
 | 
			
		||||
                    -- Turn off errors for vim global variable
 | 
			
		||||
                    settings = {
 | 
			
		||||
                        Lua = {
 | 
			
		||||
                            diagnostics = {
 | 
			
		||||
                                globals = { "vim", "hs" },
 | 
			
		||||
                            },
 | 
			
		||||
                        },
 | 
			
		||||
                    },
 | 
			
		||||
                })
 | 
			
		||||
            end
 | 
			
		||||
            if on_path("rust-analyzer") then
 | 
			
		||||
                require("lspconfig").rust_analyzer.setup({ capabilities = capabilities })
 | 
			
		||||
            end
 | 
			
		||||
            if on_path("tflint") then
 | 
			
		||||
                require("lspconfig").tflint.setup({ capabilities = capabilities })
 | 
			
		||||
            end
 | 
			
		||||
            if on_path("terraform-ls") then
 | 
			
		||||
                require("lspconfig").terraformls.setup({ capabilities = capabilities })
 | 
			
		||||
            end
 | 
			
		||||
            if on_path("pyright") then
 | 
			
		||||
                require("lspconfig").pyright.setup({
 | 
			
		||||
                    on_attach = function()
 | 
			
		||||
                        -- set keymaps (requires 0.7.0)
 | 
			
		||||
                        -- vim.keymap.set("n", "", "", {buffer=0})
 | 
			
		||||
                    end,
 | 
			
		||||
                    capabilities = capabilities,
 | 
			
		||||
                })
 | 
			
		||||
            end
 | 
			
		||||
            if on_path("nil") then
 | 
			
		||||
                require("lspconfig").nil_ls.setup({ capabilities = capabilities })
 | 
			
		||||
            end
 | 
			
		||||
 | 
			
		||||
            vim.keymap.set("n", "gd", vim.lsp.buf.definition)
 | 
			
		||||
            vim.keymap.set("n", "gT", vim.lsp.buf.type_definition)
 | 
			
		||||
            vim.keymap.set("n", "gi", vim.lsp.buf.implementation)
 | 
			
		||||
            vim.keymap.set("n", "gh", vim.lsp.buf.hover)
 | 
			
		||||
            -- vim.keymap.set("n", "gr", telescope.lsp_references)
 | 
			
		||||
            vim.keymap.set("n", "<Leader>R", vim.lsp.buf.rename)
 | 
			
		||||
            vim.keymap.set("n", "]e", vim.diagnostic.goto_next)
 | 
			
		||||
            vim.keymap.set("n", "[e", vim.diagnostic.goto_prev)
 | 
			
		||||
            vim.keymap.set("n", "<Leader>de", vim.diagnostic.open_float)
 | 
			
		||||
            vim.keymap.set("n", "<Leader>E", vim.lsp.buf.code_action)
 | 
			
		||||
        end,
 | 
			
		||||
    })
 | 
			
		||||
 | 
			
		||||
    -- Pretty highlights
 | 
			
		||||
    use("folke/lsp-colors.nvim")
 | 
			
		||||
 | 
			
		||||
    -- Linting
 | 
			
		||||
    use({
 | 
			
		||||
        "jose-elias-alvarez/null-ls.nvim",
 | 
			
		||||
        branch = "main",
 | 
			
		||||
        requires = {
 | 
			
		||||
            "nvim-lua/plenary.nvim",
 | 
			
		||||
            "neovim/nvim-lspconfig",
 | 
			
		||||
        },
 | 
			
		||||
        config = function()
 | 
			
		||||
            local function on_path(program)
 | 
			
		||||
                return vim.fn.executable(program) == 1
 | 
			
		||||
            end
 | 
			
		||||
 | 
			
		||||
            local augroup = vim.api.nvim_create_augroup("LspFormatting", {})
 | 
			
		||||
            require("null-ls").setup({
 | 
			
		||||
                sources = {
 | 
			
		||||
                    require("null-ls").builtins.formatting.stylua.with({
 | 
			
		||||
                        condition = function()
 | 
			
		||||
                            return on_path("stylua")
 | 
			
		||||
                        end,
 | 
			
		||||
                    }),
 | 
			
		||||
                    require("null-ls").builtins.formatting.black.with({
 | 
			
		||||
                        condition = function()
 | 
			
		||||
                            return on_path("black")
 | 
			
		||||
                        end,
 | 
			
		||||
                    }),
 | 
			
		||||
                    require("null-ls").builtins.diagnostics.flake8.with({
 | 
			
		||||
                        condition = function()
 | 
			
		||||
                            return on_path("flake8")
 | 
			
		||||
                        end,
 | 
			
		||||
                    }),
 | 
			
		||||
                    require("null-ls").builtins.formatting.fish_indent.with({
 | 
			
		||||
                        condition = function()
 | 
			
		||||
                            return on_path("fish_indent")
 | 
			
		||||
                        end,
 | 
			
		||||
                    }),
 | 
			
		||||
                    require("null-ls").builtins.formatting.nixfmt.with({
 | 
			
		||||
                        condition = function()
 | 
			
		||||
                            return on_path("nixfmt")
 | 
			
		||||
                        end,
 | 
			
		||||
                    }),
 | 
			
		||||
                    require("null-ls").builtins.formatting.rustfmt.with({
 | 
			
		||||
                        condition = function()
 | 
			
		||||
                            return on_path("rustfmt")
 | 
			
		||||
                        end,
 | 
			
		||||
                    }),
 | 
			
		||||
                    require("null-ls").builtins.diagnostics.shellcheck.with({
 | 
			
		||||
                        condition = function()
 | 
			
		||||
                            return on_path("shellcheck")
 | 
			
		||||
                        end,
 | 
			
		||||
                    }),
 | 
			
		||||
                    require("null-ls").builtins.formatting.shfmt.with({
 | 
			
		||||
                        extra_args = { "-i", "4", "-ci" },
 | 
			
		||||
                        condition = function()
 | 
			
		||||
                            return on_path("shfmt")
 | 
			
		||||
                        end,
 | 
			
		||||
                    }),
 | 
			
		||||
                    require("null-ls").builtins.formatting.terraform_fmt.with({
 | 
			
		||||
                        condition = function()
 | 
			
		||||
                            return on_path("terraform")
 | 
			
		||||
                        end,
 | 
			
		||||
                    }),
 | 
			
		||||
                    -- require("null-ls").builtins.diagnostics.luacheck,
 | 
			
		||||
                    -- require("null-ls").builtins.diagnostics.markdownlint,
 | 
			
		||||
                    -- require("null-ls").builtins.diagnostics.pylint,
 | 
			
		||||
                },
 | 
			
		||||
                -- Format on save
 | 
			
		||||
                on_attach = function(client, bufnr)
 | 
			
		||||
                    if client.supports_method("textDocument/formatting") then
 | 
			
		||||
                        vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr })
 | 
			
		||||
                        vim.api.nvim_create_autocmd("BufWritePre", {
 | 
			
		||||
                            group = augroup,
 | 
			
		||||
                            buffer = bufnr,
 | 
			
		||||
                            callback = function()
 | 
			
		||||
                                vim.lsp.buf.format({ bufnr = bufnr })
 | 
			
		||||
                            end,
 | 
			
		||||
                        })
 | 
			
		||||
                    end
 | 
			
		||||
                end,
 | 
			
		||||
            })
 | 
			
		||||
        end,
 | 
			
		||||
    })
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
return M
 | 
			
		||||
							
								
								
									
										67
									
								
								modules/common/neovim/lua/packer/misc.lua
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										67
									
								
								modules/common/neovim/lua/packer/misc.lua
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,67 @@
 | 
			
		||||
local M = {}
 | 
			
		||||
 | 
			
		||||
M.packer = function(use)
 | 
			
		||||
    -- Important tweaks
 | 
			
		||||
    use("tpope/vim-surround") --- Manipulate parentheses
 | 
			
		||||
 | 
			
		||||
    -- Convenience tweaks
 | 
			
		||||
    use("tpope/vim-eunuch") --- File manipulation in Vim
 | 
			
		||||
    use("tpope/vim-vinegar") --- Fixes netrw file explorer
 | 
			
		||||
    use("tpope/vim-fugitive") --- Git commands and syntax
 | 
			
		||||
    use("tpope/vim-repeat") --- Actually repeat using .
 | 
			
		||||
 | 
			
		||||
    -- Use gc or gcc to add comments
 | 
			
		||||
    use({
 | 
			
		||||
        "numToStr/Comment.nvim",
 | 
			
		||||
        config = function()
 | 
			
		||||
            require("Comment").setup()
 | 
			
		||||
        end,
 | 
			
		||||
    })
 | 
			
		||||
 | 
			
		||||
    -- Alignment tool
 | 
			
		||||
    use({
 | 
			
		||||
        "godlygeek/tabular",
 | 
			
		||||
        config = function()
 | 
			
		||||
            vim.keymap.set("", "<Leader>ta", ":Tabularize /")
 | 
			
		||||
            vim.keymap.set("", "<Leader>t#", ":Tabularize /#<CR>")
 | 
			
		||||
            vim.keymap.set("", "<Leader>tl", ":Tabularize /---<CR>")
 | 
			
		||||
        end,
 | 
			
		||||
    })
 | 
			
		||||
 | 
			
		||||
    -- Markdown renderer / wiki notes
 | 
			
		||||
    -- use("vimwiki/vimwiki")
 | 
			
		||||
    use({
 | 
			
		||||
        "jakewvincent/mkdnflow.nvim",
 | 
			
		||||
        config = function()
 | 
			
		||||
            require("mkdnflow").setup({
 | 
			
		||||
                modules = {
 | 
			
		||||
                    bib = false,
 | 
			
		||||
                    conceal = true,
 | 
			
		||||
                    folds = false,
 | 
			
		||||
                },
 | 
			
		||||
                perspective = {
 | 
			
		||||
                    priority = "current",
 | 
			
		||||
                    fallback = "first",
 | 
			
		||||
                    nvim_wd_heel = false, -- Don't change working dir
 | 
			
		||||
                },
 | 
			
		||||
                links = {
 | 
			
		||||
                    style = "markdown",
 | 
			
		||||
                    conceal = true,
 | 
			
		||||
                },
 | 
			
		||||
                wrap = true,
 | 
			
		||||
                to_do = {
 | 
			
		||||
                    symbols = { " ", "-", "x" },
 | 
			
		||||
                },
 | 
			
		||||
            })
 | 
			
		||||
            vim.api.nvim_create_autocmd("FileType", {
 | 
			
		||||
                pattern = "markdown",
 | 
			
		||||
                callback = function()
 | 
			
		||||
                    vim.o.autowriteall = true -- Save in new buffer
 | 
			
		||||
                    vim.o.wrapmargin = 79 -- Wrap text automatically
 | 
			
		||||
                end,
 | 
			
		||||
            })
 | 
			
		||||
        end,
 | 
			
		||||
    })
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
return M
 | 
			
		||||
Some files were not shown because too many files have changed in this diff Show More
		Reference in New Issue
	
	Block a user