6 Commits

Author SHA1 Message Date
cb15963270 clean up i3 sxhkd 2023-08-09 22:03:47 -04:00
5efa1eb269 restored working i3 with sxhkd 2023-08-09 21:32:38 -04:00
6ea3da93db partial success of i3 and sxhkd 2023-08-09 08:36:07 -04:00
97c94e6b6a move keybinds between i3 and keybinds file 2023-08-08 22:13:38 -04:00
f16ef49792 move keybinds to sxhkd 2023-08-08 22:13:38 -04:00
cc0325b431 start to add sway config 2023-08-08 22:13:38 -04:00
239 changed files with 6040 additions and 8446 deletions

View File

@ -1,159 +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
# 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@v17
# Build the image
- name: Build Image
if: inputs.rebuild && inputs.action != 'destroy'
run: nix build .#arrow-aws
# # Copy the image to S3
# - name: Upload Image to Cache
# env:
# NIX_CACHE_PRIVATE_KEY: ${{ secrets.NIX_CACHE_PRIVATE_KEY }}
# run: |
# echo "$NIX_CACHE_PRIVATE_KEY" > cache.key
# nix store sign --key-file cache.key $(readlink result)
# nix copy --to s3://t2-aws-nixos-test $(readlink result)
# rm cache.key
# 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 }}
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 == "transmission.${{ 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 }}"

View File

@ -1,164 +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 }}"
# # Copy the image to S3
# - name: Upload Image to Cache
# env:
# NIX_CACHE_PRIVATE_KEY: ${{ secrets.NIX_CACHE_PRIVATE_KEY }}
# run: |
# echo "$NIX_CACHE_PRIVATE_KEY" > cache.key
# nix store sign --key-file cache.key $(readlink result)
# nix copy --to s3://t2-aws-nixos-test $(readlink result)
# rm cache.key
# 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 == "transmission.${{ 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 }}"

View File

@ -8,7 +8,6 @@ on:
permissions: permissions:
contents: write contents: write
pull-requests: write pull-requests: write
checks: write
jobs: jobs:
lockfile: lockfile:
@ -31,39 +30,9 @@ jobs:
pr-labels: | # Labels to be set on the PR pr-labels: | # Labels to be set on the PR
dependencies dependencies
automated 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 - name: Check the Flake
id: check
run: nix flake 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 - name: Enable Pull Request Automerge
if: success() run: gh pr merge --rebase --auto ${{ steps.update.outputs.pull-request-number }}
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: env:
GH_TOKEN: ${{ github.token }} GH_TOKEN: ${{ github.token }}

1
.gitignore vendored
View File

@ -1,7 +1,6 @@
.DS_Store .DS_Store
*.bak *.bak
*.db *.db
*.qcow2
**/.direnv/** **/.direnv/**
result result
private/** private/**

View File

@ -25,7 +25,7 @@ configuration may be difficult to translate to a non-Nix system.
| Dotfiles | [Home-Manager](https://github.com/nix-community/home-manager) | [Link](./modules/common) | | 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) | | Terminal | [Kitty](https://sw.kovidgoyal.net/kitty/) | [Link](./modules/common/applications/kitty.nix) |
| Shell | [Fish](https://fishshell.com/) | [Link](./modules/common/shell/fish) | | Shell | [Fish](https://fishshell.com/) | [Link](./modules/common/shell/fish) |
| Shell Prompt | [Starship](https://starship.rs/) | [Link](./modules/common/shell/starship.nix) | | Shell Prompt | [Starship](https://starship.rs/) | [Link](./modules/common/shell/starhip.nix) |
| Colorscheme | [Gruvbox](https://github.com/morhetz/gruvbox) | [Link](./colorscheme/gruvbox/default.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) | | 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) | | Text Editor | [Neovim](https://neovim.io/) | [Link](./modules/common/neovim/config) |
@ -41,26 +41,6 @@ configuration may be difficult to translate to a non-Nix system.
| --- | --- | --- | | --- | --- | --- |
| Keybinds | [Hammerspoon](https://www.hammerspoon.org/) | [Link](./modules/darwin/hammerspoon) | | Keybinds | [Hammerspoon](https://www.hammerspoon.org/) | [Link](./modules/darwin/hammerspoon) |
# Diagram
![Diagram](https://github.com/nmasur/dotfiles/assets/7386960/4cc22285-cea1-4831-b387-a82241184381)
---
# 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 # Installation

View File

@ -1,5 +1,4 @@
{ pkgs, ... }: { pkgs, ... }: rec {
rec {
# Show quick helper # Show quick helper
default = import ./help.nix { inherit pkgs; }; default = import ./help.nix { inherit pkgs; };
@ -31,4 +30,5 @@ rec {
# Run neovim as an app # Run neovim as an app
neovim = import ./neovim.nix { inherit pkgs; }; neovim = import ./neovim.nix { inherit pkgs; };
nvim = neovim; nvim = neovim;
} }

View File

@ -1,19 +1,19 @@
{ pkgs, ... }: { pkgs, ... }: {
{
# nix run github:nmasur/dotfiles#encrypt-secret > private/mysecret.age # nix run github:nmasur/dotfiles#encrypt-secret > private/mysecret.age
type = "app"; type = "app";
program = builtins.toString ( program = builtins.toString (pkgs.writeShellScript "encrypt-secret" ''
pkgs.writeShellScript "encrypt-secret" '' printf "\nEnter the secret data to encrypt for all hosts...\n\n" 1>&2
printf "\nEnter the secret data to encrypt for all hosts...\n\n" 1>&2 read -p "Secret: " secret
read -p "Secret: " secret printf "\nEncrypting...\n\n" 1>&2
printf "\nEncrypting...\n\n" 1>&2 tmpfile=$(mktemp)
tmpfile=$(mktemp) echo "''${secret}" > ''${tmpfile}
echo "''${secret}" > ''${tmpfile} ${pkgs.age}/bin/age --encrypt --armor --recipients-file ${
${pkgs.age}/bin/age --encrypt --armor --recipients-file ${builtins.toString ../misc/public-keys} $tmpfile builtins.toString ../misc/public-keys
rm $tmpfile } $tmpfile
'' rm $tmpfile
); '');
} }

View File

@ -1,41 +1,39 @@
{ pkgs, ... }: { pkgs, ... }: {
{
# This script will partition and format drives; use at your own risk! # This script will partition and format drives; use at your own risk!
type = "app"; type = "app";
program = builtins.toString ( program = builtins.toString (pkgs.writeShellScript "format-root" ''
pkgs.writeShellScript "format-root" '' set -e
set -e
DISK=$1 DISK=$1
if [ -z "''${DISK}" ]; then if [ -z "''${DISK}" ]; then
${pkgs.gum}/bin/gum style --width 50 --margin "1 2" --padding "2 4" \ ${pkgs.gum}/bin/gum style --width 50 --margin "1 2" --padding "2 4" \
--foreground "#fb4934" \ --foreground "#fb4934" \
"Missing required parameter." \ "Missing required parameter." \
"Usage: format-root -- <disk>" \ "Usage: format-root -- <disk>" \
"Flake example: nix run github:nmasur/dotfiles#format-root -- nvme0n1" "Flake example: nix run github:nmasur/dotfiles#format-root -- nvme0n1"
echo "(exiting)" echo "(exiting)"
exit 1 exit 1
fi fi
${pkgs.disko-packaged}/bin/disko \ ${pkgs.disko-packaged}/bin/disko \
--mode create \ --mode create \
--dry-run \ --dry-run \
--flake "path:$(pwd)#root" \ --flake "path:$(pwd)#root" \
--arg disk \""/dev/''${DISK}"\" --arg disk \""/dev/''${DISK}"\"
${pkgs.gum}/bin/gum confirm \ ${pkgs.gum}/bin/gum confirm \
"This will ERASE ALL DATA on the disk /dev/''${DISK}. Are you sure you want to continue?" \ "This will ERASE ALL DATA on the disk /dev/''${DISK}. Are you sure you want to continue?" \
--default=false --default=false
${pkgs.disko-packaged}/bin/disko \ ${pkgs.disko-packaged}/bin/disko \
--mode create \ --mode create \
--flake "path:$(pwd)#root" \ --flake "path:$(pwd)#root" \
--arg disk "/dev/''${DISK}" --arg disk "/dev/''${DISK}"
'');
''
);
} }

View File

@ -1,25 +1,23 @@
{ pkgs, ... }: { pkgs, ... }: {
{
type = "app"; type = "app";
program = builtins.toString ( program = builtins.toString (pkgs.writeShellScript "default" ''
pkgs.writeShellScript "default" '' ${pkgs.gum}/bin/gum style --margin "1 2" --padding "0 2" --foreground "15" --background "55" "Options"
${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" " " }}.'
${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 ""
echo "" echo ""
echo "" ${pkgs.gum}/bin/gum format --type=template -- \
${pkgs.gum}/bin/gum format --type=template -- \ ' {{ Color "15" "57" " readme " }} {{ Italic "Documentation for this repository." }}' \
' {{ Color "15" "57" " readme " }} {{ Italic "Documentation for this repository." }}' \ ' {{ Color "15" "57" " rebuild " }} {{ Italic "Switch to this configuration." }}' \
' {{ Color "15" "57" " rebuild " }} {{ Italic "Switch to this configuration." }}' \ ' {{ Color "15" "57" " installer " }} {{ Italic "Format and install from nothing." }}' \
' {{ Color "15" "57" " installer " }} {{ Italic "Format and install from nothing." }}' \ ' {{ Color "15" "57" " neovim " }} {{ Italic "Test out the Neovim package." }}' \
' {{ Color "15" "57" " neovim " }} {{ Italic "Test out the Neovim package." }}' \ ' {{ Color "15" "57" " loadkey " }} {{ Italic "Load an ssh key for this machine using melt." }}' \
' {{ Color "15" "57" " loadkey " }} {{ Italic "Load an ssh key for this machine using melt." }}' \ ' {{ Color "15" "57" " encrypt-secret " }} {{ Italic "Encrypt a secret for all machines." }}' \
' {{ Color "15" "57" " encrypt-secret " }} {{ Italic "Encrypt a secret for all machines." }}' \ ' {{ Color "15" "57" " reencrypt-secrets " }} {{ Italic "Reencrypt all secrets when new machine is added." }}' \
' {{ Color "15" "57" " reencrypt-secrets " }} {{ Italic "Reencrypt all secrets when new machine is added." }}' \ ' {{ Color "15" "57" " netdata " }} {{ Italic "Connect a machine to Netdata cloud." }}'
' {{ Color "15" "57" " netdata " }} {{ Italic "Connect a machine to Netdata cloud." }}' echo ""
echo "" echo ""
echo "" '');
''
);
} }

View File

@ -1,50 +1,48 @@
{ pkgs, ... }: { pkgs, ... }: {
{
# Inspired by https://github.com/cleverca22/nix-tests/blob/master/kexec/justdoit.nix # 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! # This script will partition and format drives; use at your own risk!
type = "app"; type = "app";
program = builtins.toString ( program = builtins.toString (pkgs.writeShellScript "installer" ''
pkgs.writeShellScript "installer" '' set -e
set -e
DISK=$1 DISK=$1
FLAKE=$2 FLAKE=$2
PARTITION_PREFIX="" PARTITION_PREFIX=""
if [ -z "$DISK" ] || [ -z "$FLAKE" ]; then if [ -z "$DISK" ] || [ -z "$FLAKE" ]; then
${pkgs.gum}/bin/gum style --width 50 --margin "1 2" --padding "2 4" \ ${pkgs.gum}/bin/gum style --width 50 --margin "1 2" --padding "2 4" \
--foreground "#fb4934" \ --foreground "#fb4934" \
"Missing required parameter." \ "Missing required parameter." \
"Usage: installer -- <disk> <host>" \ "Usage: installer -- <disk> <host>" \
"Example: installer -- nvme0n1 tempest" \ "Example: installer -- nvme0n1 tempest" \
"Flake example: nix run github:nmasur/dotfiles#installer -- nvme0n1 tempest" "Flake example: nix run github:nmasur/dotfiles#installer -- nvme0n1 tempest"
echo "(exiting)" echo "(exiting)"
exit 1 exit 1
fi fi
case "$DISK" in nvme*) case "$DISK" in nvme*)
PARTITION_PREFIX="p" PARTITION_PREFIX="p"
esac esac
${pkgs.gum}/bin/gum confirm \ ${pkgs.gum}/bin/gum confirm \
"This will ERASE ALL DATA on the disk /dev/''${DISK}. Are you sure you want to continue?" \ "This will ERASE ALL DATA on the disk /dev/''${DISK}. Are you sure you want to continue?" \
--default=false --default=false
${pkgs.parted}/bin/parted /dev/''${DISK} -- mklabel gpt ${pkgs.parted}/bin/parted /dev/''${DISK} -- mklabel gpt
${pkgs.parted}/bin/parted /dev/''${DISK} -- mkpart primary 512MiB 100% ${pkgs.parted}/bin/parted /dev/''${DISK} -- mkpart primary 512MiB 100%
${pkgs.parted}/bin/parted /dev/''${DISK} -- mkpart ESP fat32 1MiB 512MiB ${pkgs.parted}/bin/parted /dev/''${DISK} -- mkpart ESP fat32 1MiB 512MiB
${pkgs.parted}/bin/parted /dev/''${DISK} -- set 3 esp on ${pkgs.parted}/bin/parted /dev/''${DISK} -- set 3 esp on
mkfs.ext4 -L nixos /dev/''${DISK}''${PARTITION_PREFIX}1 mkfs.ext4 -L nixos /dev/''${DISK}''${PARTITION_PREFIX}1
mkfs.fat -F 32 -n boot /dev/''${DISK}''${PARTITION_PREFIX}2 mkfs.fat -F 32 -n boot /dev/''${DISK}''${PARTITION_PREFIX}2
mount /dev/disk/by-label/nixos /mnt mount /dev/disk/by-label/nixos /mnt
mkdir --parents /mnt/boot mkdir --parents /mnt/boot
mount /dev/disk/by-label/boot /mnt/boot mount /dev/disk/by-label/boot /mnt/boot
${pkgs.nixos-install-tools}/bin/nixos-install --flake github:nmasur/dotfiles#''${FLAKE}
'');
${pkgs.nixos-install-tools}/bin/nixos-install --flake github:nmasur/dotfiles#''${FLAKE}
''
);
} }

View File

@ -1,15 +1,12 @@
{ pkgs, ... }: { pkgs, ... }: {
{
type = "app"; type = "app";
program = builtins.toString ( program = builtins.toString (pkgs.writeShellScript "loadkey" ''
pkgs.writeShellScript "loadkey" '' printf "\nEnter the seed phrase for your SSH key...\n"
printf "\nEnter the seed phrase for your SSH key...\n" printf "\nThen press ^D when complete.\n\n"
printf "\nThen press ^D when complete.\n\n" ${pkgs.melt}/bin/melt restore ~/.ssh/id_ed25519
mkdir -p ~/.ssh/ printf "\n\nContinuing activation.\n\n"
${pkgs.melt}/bin/melt restore ~/.ssh/id_ed25519 '');
printf "\n\nContinuing activation.\n\n"
''
);
} }

View File

@ -1,12 +1,12 @@
{ pkgs, ... }: { pkgs, ... }: {
{
type = "app"; type = "app";
program = "${ program = "${
(import ../modules/common/neovim/package { (import ../modules/common/neovim/package {
inherit pkgs; inherit pkgs;
colors = (import ../colorscheme/nord).dark; colors = (import ../colorscheme/nord).dark;
}) })
}/bin/nvim"; }/bin/nvim";
} }

View File

@ -1,21 +1,19 @@
{ pkgs, ... }: { pkgs, ... }: {
{
type = "app"; type = "app";
program = builtins.toString ( program = builtins.toString (pkgs.writeShellScript "netdata-cloud" ''
pkgs.writeShellScript "netdata-cloud" '' if [ "$EUID" -ne 0 ]; then
if [ "$EUID" -ne 0 ]; then echo "Please run as root"
echo "Please run as root" exit 1
exit 1 fi
fi mkdir --parents --mode 0750 /var/lib/netdata/cloud.d
mkdir --parents --mode 0750 /var/lib/netdata/cloud.d printf "\nEnter the claim token for netdata cloud...\n\n"
printf "\nEnter the claim token for netdata cloud...\n\n" read -p "Token: " token
read -p "Token: " token echo "''${token}" > /var/lib/netdata/cloud.d/token
echo "''${token}" > /var/lib/netdata/cloud.d/token chown -R netdata:netdata /var/lib/netdata
chown -R netdata:netdata /var/lib/netdata ${pkgs.netdata}/bin/netdata-claim.sh -id=$(uuidgen)
${pkgs.netdata}/bin/netdata-claim.sh -id=$(uuidgen) printf "\n\nNow restart netdata service.\n\n"
printf "\n\nNow restart netdata service.\n\n" '');
''
);
} }

View File

@ -1,11 +1,9 @@
{ pkgs, ... }: { pkgs, ... }: {
{
type = "app"; type = "app";
program = builtins.toString ( program = builtins.toString (pkgs.writeShellScript "readme" ''
pkgs.writeShellScript "readme" '' ${pkgs.glow}/bin/glow --pager ${builtins.toString ../README.md}
${pkgs.glow}/bin/glow --pager ${builtins.toString ../README.md} '');
''
);
} }

View File

@ -1,17 +1,15 @@
{ pkgs, ... }: { pkgs, ... }: {
{
type = "app"; type = "app";
program = builtins.toString ( program = builtins.toString (pkgs.writeShellScript "rebuild" ''
pkgs.writeShellScript "rebuild" '' echo ${pkgs.system}
echo ${pkgs.system} SYSTEM=${if pkgs.stdenv.isDarwin then "darwin" else "linux"}
SYSTEM=${if pkgs.stdenv.isDarwin then "darwin" else "linux"} if [ "$SYSTEM" == "darwin" ]; then
if [ "$SYSTEM" == "darwin" ]; then sudo darwin-rebuild switch --flake ${builtins.toString ../.}
sudo darwin-rebuild switch --flake ${builtins.toString ../.} else
else doas nixos-rebuild switch --flake ${builtins.toString ../.}
doas nixos-rebuild switch --flake ${builtins.toString ../.} fi
fi '');
''
);
} }

View File

@ -1,27 +1,27 @@
{ pkgs, ... }: { pkgs, ... }: {
{
# nix run github:nmasur/dotfiles#reencrypt-secrets ./private # nix run github:nmasur/dotfiles#reencrypt-secrets ./private
type = "app"; type = "app";
program = builtins.toString ( program = builtins.toString (pkgs.writeShellScript "reencrypt-secrets" ''
pkgs.writeShellScript "reencrypt-secrets" '' if [ $# -eq 0 ]; then
if [ $# -eq 0 ]; then echo "Must provide directory to reencrypt."
echo "Must provide directory to reencrypt." exit 1
exit 1 fi
fi encrypted=$1
encrypted=$1 for encryptedfile in ''${1}/*; do
for encryptedfile in ''${1}/*; do tmpfile=$(mktemp)
tmpfile=$(mktemp) echo "Decrypting ''${encryptedfile}..."
echo "Decrypting ''${encryptedfile}..." ${pkgs.age}/bin/age --decrypt \
${pkgs.age}/bin/age --decrypt \ --identity ~/.ssh/id_ed25519 $encryptedfile > $tmpfile
--identity ~/.ssh/id_ed25519 $encryptedfile > $tmpfile echo "Encrypting ''${encryptedfile}..."
echo "Encrypting ''${encryptedfile}..." ${pkgs.age}/bin/age --encrypt --armor --recipients-file ${
${pkgs.age}/bin/age --encrypt --armor --recipients-file ${builtins.toString ../misc/public-keys} $tmpfile > $encryptedfile builtins.toString ../misc/public-keys
rm $tmpfile } $tmpfile > $encryptedfile
done rm $tmpfile
echo "Finished." done
'' echo "Finished."
); '');
} }

View File

@ -16,7 +16,9 @@
base0B = "#dbbc7f"; # Strings, Inherited Class, Markup Code, Diff Inserted base0B = "#dbbc7f"; # Strings, Inherited Class, Markup Code, Diff Inserted
base0C = "#e69875"; # Support, Regular Expressions, Escape Characters, ... base0C = "#e69875"; # Support, Regular Expressions, Escape Characters, ...
base0D = "#a7c080"; # Functions, Methods, Attribute IDs, Headings base0D = "#a7c080"; # Functions, Methods, Attribute IDs, Headings
base0E = "#e67e80"; # Keywords, Storage, Selector, Markup Italic, Diff Changed base0E =
base0F = "#d699b6"; # Deprecated, Opening/Closing Embedded Language Tags, ... "#e67e80"; # Keywords, Storage, Selector, Markup Italic, Diff Changed
base0F =
"#d699b6"; # Deprecated, Opening/Closing Embedded Language Tags, ...
}; };
} }

View File

@ -2,7 +2,8 @@
{ {
name = "gruvbox-dark"; # Dark, Medium name = "gruvbox-dark"; # Dark, Medium
author = "Dawid Kurek (dawikur@gmail.com), morhetz (https://github.com/morhetz/gruvbox), ElRastaOk (https://www.reddit.com/user/ElRastaOk)"; author =
"Dawid Kurek (dawikur@gmail.com), morhetz (https://github.com/morhetz/gruvbox), ElRastaOk (https://www.reddit.com/user/ElRastaOk)";
dark = { dark = {
base00 = "#1D2122"; # ---- This is the change from normal gruvbox base00 = "#1D2122"; # ---- This is the change from normal gruvbox
base01 = "#3c3836"; # --- base01 = "#3c3836"; # ---

View File

@ -1,6 +1,7 @@
{ {
name = "gruvbox"; # Dark, Medium 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 = { dark = {
base00 = "#282828"; # ---- base00 = "#282828"; # ----
base01 = "#3c3836"; # --- base01 = "#3c3836"; # ---

View File

@ -1,38 +1,41 @@
{ disk, ... }: { disk, ... }: {
{
disk = { disk = {
boot = { boot = {
type = "disk"; type = "disk";
device = disk; device = disk;
content = { content = {
type = "gpt"; type = "table";
partitions = { format = "gpt";
partitions = [
# Boot partition # Boot partition
ESP = rec { {
size = "512MiB"; name = "ESP";
type = "EF00"; start = "0";
label = "boot"; end = "512MiB";
device = "/dev/disk/by-label/${label}"; fs-type = "fat32";
bootable = true;
content = { content = {
type = "filesystem"; type = "filesystem";
format = "vfat"; format = "vfat";
mountpoint = "/boot"; mountpoint = "/boot";
extraArgs = [ "-n ${label}" ]; extraArgs = [ "-n boot" ];
}; };
}; }
# Root partition ext4 # Root partition ext4
root = rec { {
size = "100%"; name = "root";
label = "nixos"; start = "512MiB";
device = "/dev/disk/by-label/${label}"; end = "100%";
part-type = "primary";
bootable = true;
content = { content = {
type = "filesystem"; type = "filesystem";
format = "ext4"; format = "ext4";
mountpoint = "/"; mountpoint = "/";
extraArgs = [ "-L ${label}" ]; extraArgs = [ "-L nixos" ];
}; };
}; }
}; ];
}; };
}; };
}; };

View File

@ -1,5 +1,4 @@
{ pool, disks, ... }: { pool, disks, ... }: {
{
disk = lib.genAttrs disks (disk: { disk = lib.genAttrs disks (disk: {
"${disk}" = { "${disk}" = {
type = "disk"; type = "disk";
@ -7,18 +6,16 @@
content = { content = {
type = "table"; type = "table";
format = "gpt"; format = "gpt";
partitions = [ partitions = [{
{ type = "partition";
type = "partition"; name = "zfs";
name = "zfs"; start = "128MiB";
start = "128MiB"; end = "100%";
end = "100%"; content = {
content = { type = "zfs";
type = "zfs"; pool = pool;
pool = pool; };
}; }];
}
];
}; };
}; };
}); });

View File

@ -49,25 +49,19 @@ move the `windows/alacritty.yml` file to
To get started on a bare macOS installation, first install Nix: To get started on a bare macOS installation, first install Nix:
```bash ```bash
curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install sh -c "$(curl -L https://nixos.org/nix/install)"
``` ```
Launch a new shell. Then use Nix to switch to the macOS configuration: Then use Nix to build nix-darwin:
```bash ```bash
sudo rm /etc/bashrc nix-build https://github.com/LnL7/nix-darwin/archive/master.tar.gz -A installer
sudo rm /etc/nix/nix.conf ./result/bin/darwin-installer
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: Then switch to the macOS configuration:
```bash ```bash
darwin-rebuild switch --flake ~/dev/personal/dotfiles darwin-rebuild switch --flake github:nmasur/dotfiles#lookingglass
``` ```

View File

@ -63,20 +63,3 @@ Use this mysqldump command:
sudo -u nextcloud mysqldump -S /run/mysqld/mysqld.sock --default-character-set=utf8mb4 nextcloud > backup.sql 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
```

557
flake.lock generated
View File

@ -1,83 +1,6 @@
{ {
"nodes": { "nodes": {
"baleia-nvim-src": { "Comment-nvim-src": {
"flake": false,
"locked": {
"lastModified": 1704551058,
"narHash": "sha256-0NmiGzMFvL1awYOVtiaSd+O4sAR524x68xwWLgArlqs=",
"owner": "m00qek",
"repo": "baleia.nvim",
"rev": "6d9cbdaca3a428bc7296f838fdfce3ad01ee7495",
"type": "github"
},
"original": {
"owner": "m00qek",
"repo": "baleia.nvim",
"type": "github"
}
},
"base16-nvim-src": {
"flake": false,
"locked": {
"lastModified": 1713467988,
"narHash": "sha256-p3HWYasmi0gVUM5l9jLWL4Iy37Uxnvbj3SO/cMCpDBg=",
"owner": "RRethy",
"repo": "base16-nvim",
"rev": "eec6882101dd189117f79c5d18d389d20cfc0415",
"type": "github"
},
"original": {
"owner": "RRethy",
"repo": "base16-nvim",
"type": "github"
}
},
"bufferline-nvim-src": {
"flake": false,
"locked": {
"lastModified": 1706180994,
"narHash": "sha256-/iGzUDJaodkUyWpwim8UtwaRuarfu/Nk6wxVApk+QxY=",
"owner": "akinsho",
"repo": "bufferline.nvim",
"rev": "d6cb9b7cac52887bcac65f8698e67479553c0748",
"type": "github"
},
"original": {
"owner": "akinsho",
"ref": "v4.5.0",
"repo": "bufferline.nvim",
"type": "github"
}
},
"bypass-paywalls-clean": {
"flake": false,
"locked": {
"narHash": "sha256-VZey1VgabUpsiN+mdSNzoMfxICSNKtZIuvISFcMUDw4=",
"type": "file",
"url": "https://github.com/bpc-clone/bpc_updates/releases/download/latest/bypass_paywalls_clean-3.6.6.0.xpi"
},
"original": {
"type": "file",
"url": "https://github.com/bpc-clone/bpc_updates/releases/download/latest/bypass_paywalls_clean-3.6.6.0.xpi"
}
},
"cmp-nvim-lsp-src": {
"flake": false,
"locked": {
"lastModified": 1702205473,
"narHash": "sha256-/0sh9vJBD9pUuD7q3tNSQ1YLvxFMNykdg5eG+LjZAA8=",
"owner": "hrsh7th",
"repo": "cmp-nvim-lsp",
"rev": "5af77f54de1b16c34b23cba810150689a3a90312",
"type": "github"
},
"original": {
"owner": "hrsh7th",
"repo": "cmp-nvim-lsp",
"type": "github"
}
},
"comment-nvim-src": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1681214440, "lastModified": 1681214440,
@ -94,6 +17,55 @@
"type": "github" "type": "github"
} }
}, },
"baleia-nvim-src": {
"flake": false,
"locked": {
"lastModified": 1681806450,
"narHash": "sha256-jxRlIzWbnSj89032msc5w+2TVt7zVyzlxdXxiH1dQqY=",
"owner": "m00qek",
"repo": "baleia.nvim",
"rev": "00bb4af31c8c3865b735d40ebefa6c3f07b2dd16",
"type": "github"
},
"original": {
"owner": "m00qek",
"repo": "baleia.nvim",
"type": "github"
}
},
"bufferline-nvim-src": {
"flake": false,
"locked": {
"lastModified": 1687763763,
"narHash": "sha256-wbOeylzjjScQXkrDbBU2HtrOZrp2YUK+wQ2aOkgxmRQ=",
"owner": "akinsho",
"repo": "bufferline.nvim",
"rev": "bf2f6b7edd0abf6b0732f5e5c0a8f30e51611c75",
"type": "github"
},
"original": {
"owner": "akinsho",
"ref": "v4.2.0",
"repo": "bufferline.nvim",
"type": "github"
}
},
"cmp-nvim-lsp-src": {
"flake": false,
"locked": {
"lastModified": 1687494203,
"narHash": "sha256-mU0soCz79erJXMMqD/FyrJZ0mu2n6fE0deymPzQlxts=",
"owner": "hrsh7th",
"repo": "cmp-nvim-lsp",
"rev": "44b16d11215dce86f253ce0c30949813c0a90765",
"type": "github"
},
"original": {
"owner": "hrsh7th",
"repo": "cmp-nvim-lsp",
"type": "github"
}
},
"darwin": { "darwin": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [
@ -101,11 +73,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1713946171, "lastModified": 1691275315,
"narHash": "sha256-lc75rgRQLdp4Dzogv5cfqOg6qYc5Rp83oedF2t0kDp8=", "narHash": "sha256-9WN0IA0vNZSNxKHpy/bYvPnCw4VH/nr5iBv7c+7KUts=",
"owner": "lnl7", "owner": "lnl7",
"repo": "nix-darwin", "repo": "nix-darwin",
"rev": "230a197063de9287128e2c68a7a4b0cd7d0b50a7", "rev": "829041cf10c4f6751a53c0a11ca2fd22ff0918d6",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -122,11 +94,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1714612856, "lastModified": 1690739034,
"narHash": "sha256-W7+rtMzRmdovzndN2NYUv5xzkbMudtQ3jbyFuGk0O1E=", "narHash": "sha256-roW02IaiQ3gnEEDMCDWL5YyN+C4nBf/te6vfL7rG0jk=",
"owner": "nix-community", "owner": "nix-community",
"repo": "disko", "repo": "disko",
"rev": "d57058eb09dd5ec00c746df34fe0a603ea744370", "rev": "4015740375676402a2ee6adebc3c30ea625b9a94",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -135,23 +107,6 @@
"type": "github" "type": "github"
} }
}, },
"fidget-nvim-src": {
"flake": false,
"locked": {
"lastModified": 1704696337,
"narHash": "sha256-uAX/RGfOmsUIUaDepNwUpK8MBaTMBJ4rLZ69y0MwpNE=",
"owner": "j-hui",
"repo": "fidget.nvim",
"rev": "3a93300c076109d86c7ce35ec67a8034ae6ba9db",
"type": "github"
},
"original": {
"owner": "j-hui",
"ref": "v1.2.0",
"repo": "fidget.nvim",
"type": "github"
}
},
"firefox-darwin": { "firefox-darwin": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [
@ -159,11 +114,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1714869979, "lastModified": 1691196340,
"narHash": "sha256-kTAMHZ1DDGauq3f5IzPw+EtVOgWdctLPUMJiqciqOx0=", "narHash": "sha256-b1haFWCbFJkiUkeTQCkNjr8hFq/8JlMPaQwNpGlcvxI=",
"owner": "bandithedoge", "owner": "bandithedoge",
"repo": "nixpkgs-firefox-darwin", "repo": "nixpkgs-firefox-darwin",
"rev": "7e9014891eebabffa68351e3360da3fbc59b8066", "rev": "6081c33185dba05da784d9f2a392861af025bf1a",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -175,11 +130,11 @@
"flake-compat": { "flake-compat": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1696426674, "lastModified": 1673956053,
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=",
"owner": "edolstra", "owner": "edolstra",
"repo": "flake-compat", "repo": "flake-compat",
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -189,15 +144,12 @@
} }
}, },
"flake-utils": { "flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": { "locked": {
"lastModified": 1705309234, "lastModified": 1678901627,
"narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=", "narHash": "sha256-U02riOqrKKzwjsxc/400XnElV+UtPUQWpANPlyazjH0=",
"owner": "numtide", "owner": "numtide",
"repo": "flake-utils", "repo": "flake-utils",
"rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26", "rev": "93a2b84fc4b70d9e089d029deacc3583435c2ed6",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -207,15 +159,33 @@
} }
}, },
"flake-utils_2": { "flake-utils_2": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1685518550,
"narHash": "sha256-o2d0KcvaXzTrPRIo0kOLV0/QXHhDQ5DTi+OxcjO8xqY=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "a1720a10a6cfe8234c0e93907ffe81be440f4cef",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils_3": {
"inputs": { "inputs": {
"systems": "systems_2" "systems": "systems_2"
}, },
"locked": { "locked": {
"lastModified": 1710146030, "lastModified": 1689068808,
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", "narHash": "sha256-6ixXo3wt24N/melDWjq70UuHQLxGV8jZvooRanIHXw0=",
"owner": "numtide", "owner": "numtide",
"repo": "flake-utils", "repo": "flake-utils",
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", "rev": "919d646de7be200f3bf08cb76ae1f09402b6f9b4",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -227,11 +197,11 @@
"hmts-nvim-src": { "hmts-nvim-src": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1710430870, "lastModified": 1691223193,
"narHash": "sha256-bsOQX56ciQ8ni7Zh4ZNtTvptvy/YaDPG318AsEaZRpE=", "narHash": "sha256-Zsl4s3e4upWiU2mXKqiQcUGxslPzzebKKXfzaHiNq48=",
"owner": "calops", "owner": "calops",
"repo": "hmts.nvim", "repo": "hmts.nvim",
"rev": "473d74cf54da8f51aaa9993ec3e6bfae278eb47b", "rev": "1d40963804925754672940d07ddb250d19efec2e",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -247,11 +217,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1714865296, "lastModified": 1691225770,
"narHash": "sha256-02r2Qzh4fGYBPB/3Lj8vwPMtE6H/UchZnN7A/dQMHIA=", "narHash": "sha256-O5slH8nW8msTAqVAS5rkvdHSkjmrO+JauuSDzZCmv2M=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "e0825ea2112d09d9f0680833cd716f6aee3b973f", "rev": "0a014a729cdd54d9919ff36b714d047909d7a4c8",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -261,87 +231,78 @@
"type": "github" "type": "github"
} }
}, },
"kitty-scrollback-nvim-src": {
"flake": false,
"locked": {
"lastModified": 1714049193,
"narHash": "sha256-LICARktpc04vaHpFuAFDrZsYKy2HJme6LMtoXMi7jJ8=",
"owner": "mikesmithgh",
"repo": "kitty-scrollback.nvim",
"rev": "22f524f1fa9c7660804a1800ed0fe981c5d392c8",
"type": "github"
},
"original": {
"owner": "mikesmithgh",
"repo": "kitty-scrollback.nvim",
"type": "github"
}
},
"nextcloud-cookbook": { "nextcloud-cookbook": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1702545935, "narHash": "sha256-XgBwUr26qW6wvqhrnhhhhcN4wkI+eXDHnNSm1HDbP6M=",
"narHash": "sha256-19LN1nYJJ0RMWj6DrYPvHzocTyhMfYdpdhBFch3fpHE=",
"type": "tarball", "type": "tarball",
"url": "https://github.com/christianlupus-nextcloud/cookbook-releases/releases/download/v0.11.0/cookbook-0.11.0.tar.gz" "url": "https://github.com/nextcloud/cookbook/releases/download/v0.10.2/Cookbook-0.10.2.tar.gz"
}, },
"original": { "original": {
"type": "tarball", "type": "tarball",
"url": "https://github.com/christianlupus-nextcloud/cookbook-releases/releases/download/v0.11.0/cookbook-0.11.0.tar.gz" "url": "https://github.com/nextcloud/cookbook/releases/download/v0.10.2/Cookbook-0.10.2.tar.gz"
} }
}, },
"nextcloud-external": { "nextcloud-external": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1699624348, "narHash": "sha256-gY1nxqK/pHfoxW/9mE7DFtNawgdEV7a4OXpscWY14yk=",
"narHash": "sha256-RCL2RP5twRDLxI/KfAX6QLYQOzqZmSWsfrC5ZQIwTD4=",
"type": "tarball", "type": "tarball",
"url": "https://github.com/nextcloud-releases/external/releases/download/v5.3.1/external-v5.3.1.tar.gz" "url": "https://github.com/nextcloud-releases/external/releases/download/v5.2.0/external-v5.2.0.tar.gz"
}, },
"original": { "original": {
"type": "tarball", "type": "tarball",
"url": "https://github.com/nextcloud-releases/external/releases/download/v5.3.1/external-v5.3.1.tar.gz" "url": "https://github.com/nextcloud-releases/external/releases/download/v5.2.0/external-v5.2.0.tar.gz"
} }
}, },
"nextcloud-news": { "nextcloud-news": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1703426420, "narHash": "sha256-hhXPEITSbCiFs0o+TOsQnSasXBpjU9mA/OFsbzuaCPw=",
"narHash": "sha256-AENBJH/bEob5JQvw4WEi864mdLYJ5Mqe78HJH6ceCpI=",
"type": "tarball", "type": "tarball",
"url": "https://github.com/nextcloud/news/releases/download/25.0.0-alpha3/news.tar.gz" "url": "https://github.com/nextcloud/news/releases/download/22.0.0/news.tar.gz"
}, },
"original": { "original": {
"type": "tarball", "type": "tarball",
"url": "https://github.com/nextcloud/news/releases/download/25.0.0-alpha3/news.tar.gz" "url": "https://github.com/nextcloud/news/releases/download/22.0.0/news.tar.gz"
} }
}, },
"nextcloud-snappymail": { "nil": {
"flake": false, "inputs": {
"flake-utils": "flake-utils",
"nixpkgs": [
"nixpkgs"
],
"rust-overlay": "rust-overlay"
},
"locked": { "locked": {
"lastModified": 1714909152, "lastModified": 1680544266,
"narHash": "sha256-CsAUnbA/9XiVuk96pOK+E++lp8BlJITtfExWcb9rqPk=", "narHash": "sha256-d/TusDXmIo8IT5DNRA21lN+nOVSER8atIx9TJteR6LQ=",
"type": "tarball", "owner": "oxalica",
"url": "https://github.com/nmasur/snappymail-nextcloud/releases/download/v2.36.1/snappymail-2.36.1-nextcloud.tar.gz" "repo": "nil",
"rev": "56a1fa87b98a9508920f4b0ab8fe36d5b54b2362",
"type": "github"
}, },
"original": { "original": {
"type": "tarball", "owner": "oxalica",
"url": "https://github.com/nmasur/snappymail-nextcloud/releases/download/v2.36.1/snappymail-2.36.1-nextcloud.tar.gz" "ref": "2023-04-03",
"repo": "nil",
"type": "github"
} }
}, },
"nix2vim": { "nix2vim": {
"inputs": { "inputs": {
"flake-utils": "flake-utils", "flake-utils": "flake-utils_2",
"nixpkgs": [ "nixpkgs": [
"nixpkgs" "nixpkgs"
] ]
}, },
"locked": { "locked": {
"lastModified": 1707832982, "lastModified": 1685980282,
"narHash": "sha256-Jsrj8HJyo+PmjrHIDhq4gjZCE0eYCVmmTrx24cG8eOQ=", "narHash": "sha256-uQyVaoqkiocA8bXKMfrgizuKmz0hUzHye5owFoUd2AQ=",
"owner": "gytis-ivaskevicius", "owner": "gytis-ivaskevicius",
"repo": "nix2vim", "repo": "nix2vim",
"rev": "2fb1328cf058fc967b02f9a5330a99253b4c247e", "rev": "3836a348503ae27340c7f83f0bc7bcb907f3781d",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -352,11 +313,11 @@
}, },
"nixlib": { "nixlib": {
"locked": { "locked": {
"lastModified": 1712450863, "lastModified": 1689469483,
"narHash": "sha256-K6IkdtMtq9xktmYPj0uaYc8NsIqHuaAoRBaMgu9Fvrw=", "narHash": "sha256-2SBhY7rZQ/iNCxe04Eqxlz9YK9KgbaTMBssq3/BgdWY=",
"owner": "nix-community", "owner": "nix-community",
"repo": "nixpkgs.lib", "repo": "nixpkgs.lib",
"rev": "3c62b6a12571c9a7f65ab037173ee153d539905f", "rev": "02fea408f27186f139153e1ae88f8ab2abd9c22c",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -373,11 +334,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1713783234, "lastModified": 1690133435,
"narHash": "sha256-3yh0nqI1avYUmmtqqTW3EVfwaLE+9ytRWxsA5aWtmyI=", "narHash": "sha256-YNZiefETggroaTLsLJG2M+wpF0pJPwiauKG4q48ddNU=",
"owner": "nix-community", "owner": "nix-community",
"repo": "nixos-generators", "repo": "nixos-generators",
"rev": "722b512eb7e6915882f39fff0e4c9dd44f42b77e", "rev": "b1171de4d362c022130c92d7c8adc4bf2b83d586",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -388,11 +349,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1714635257, "lastModified": 1691186842,
"narHash": "sha256-4cPymbty65RvF1DWQfc+Bc8B233A1BWxJnNULJKQ1EY=", "narHash": "sha256-wxBVCvZUwq+XS4N4t9NqsHV4E64cPVqQ2fdDISpjcw0=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "63c3a29ca82437c87573e4c6919b09a24ea61b0f", "rev": "18036c0be90f4e308ae3ebcab0e14aae0336fe42",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -402,29 +363,45 @@
"type": "github" "type": "github"
} }
}, },
"nixpkgs-caddy": { "nixpkgs_2": {
"locked": { "locked": {
"lastModified": 1699107987, "lastModified": 1690470004,
"narHash": "sha256-nWXETr4Oqy/vOfzgWyMY04qzEN2iREFJc5ycQ3XNu0A=", "narHash": "sha256-l57RmPhPz9r1LGDg/0v8bYgJO8R+GGTQZtkIxE7negU=",
"owner": "jpds", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "a33b02fa9d664f31dadc8a874eb1a5dbaa9f4ecf", "rev": "9462344318b376e157c94fa60c20a25b913b2381",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "jpds", "owner": "NixOS",
"ref": "caddy-external-plugins", "ref": "nixos-23.05",
"repo": "nixpkgs", "repo": "nixpkgs",
"type": "github" "type": "github"
} }
}, },
"null-ls-nvim-src": {
"flake": false,
"locked": {
"lastModified": 1688652536,
"narHash": "sha256-6KJtj9pbvBm6fOVpnyzO2fEVC+cVrw2XtZHOgq9ieIw=",
"owner": "jose-elias-alvarez",
"repo": "null-ls.nvim",
"rev": "db09b6c691def0038c456551e4e2772186449f35",
"type": "github"
},
"original": {
"owner": "jose-elias-alvarez",
"repo": "null-ls.nvim",
"type": "github"
}
},
"nur": { "nur": {
"locked": { "locked": {
"lastModified": 1714880338, "lastModified": 1691289987,
"narHash": "sha256-G/dc755qMdAMvXuZsi1OFCzD49OWszdMSnp12+1eFcM=", "narHash": "sha256-sbbDlVzxlP+bBTdhyyzJ6C0APUNU/sChuLmNU9ehkmg=",
"owner": "nix-community", "owner": "nix-community",
"repo": "nur", "repo": "nur",
"rev": "49f72c695fb2f46c8aeb1549704246b9558b2011", "rev": "cf2f5d8ad452795e5aca290c95eedc829d3da7ec",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -433,35 +410,19 @@
"type": "github" "type": "github"
} }
}, },
"nvim-lint-src": {
"flake": false,
"locked": {
"lastModified": 1714489830,
"narHash": "sha256-aM4oWSZrZb660wEpLQnFyoBkH+MSi0WgfBIztk98Qtk=",
"owner": "mfussenegger",
"repo": "nvim-lint",
"rev": "861a04313501563bb1b11f125ae9b7237a517b9b",
"type": "github"
},
"original": {
"owner": "mfussenegger",
"repo": "nvim-lint",
"type": "github"
}
},
"nvim-lspconfig-src": { "nvim-lspconfig-src": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1701687137, "lastModified": 1675639052,
"narHash": "sha256-qFjFofA2LoD4yRfx4KGfSCpR3mDkpFaagcm+TVNPqco=", "narHash": "sha256-B8IgpypxzCACZ5VcqM6KiWyClaN+KrmemtkwMznmj5Y=",
"owner": "neovim", "owner": "neovim",
"repo": "nvim-lspconfig", "repo": "nvim-lspconfig",
"rev": "cf3dd4a290084a868fac0e2e876039321d57111c", "rev": "255e07ce2a05627d482d2de77308bba51b90470c",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "neovim", "owner": "neovim",
"ref": "v0.1.7", "ref": "v0.1.6",
"repo": "nvim-lspconfig", "repo": "nvim-lspconfig",
"type": "github" "type": "github"
} }
@ -469,11 +430,11 @@
"nvim-tree-lua-src": { "nvim-tree-lua-src": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1714794673, "lastModified": 1691292370,
"narHash": "sha256-rY4FbuqBM4zOUkaA3QBc+UrpfTha8uGtp+lIzrYK+cg=", "narHash": "sha256-YQRirmp8QerxwF9qdrSrUKJZiVrBb6ZWpUTfM8H7fl4=",
"owner": "kyazdani42", "owner": "kyazdani42",
"repo": "nvim-tree.lua", "repo": "nvim-tree.lua",
"rev": "64f61e4c913047a045ff90bd188dd3b54ee443cf", "rev": "904f95cd9db31d1800998fa428e78e418a50181d",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -485,97 +446,82 @@
"nvim-treesitter-src": { "nvim-treesitter-src": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1714811590, "lastModified": 1681121236,
"narHash": "sha256-3Ae3ieCqckVAElTufJxgBRNXdWg81++oI0qesKevcb4=", "narHash": "sha256-iPsPDLhVKJ14iP1/2cCgcY9SCKK/DQz9Y0mQB1DqNiM=",
"owner": "nvim-treesitter", "owner": "nvim-treesitter",
"repo": "nvim-treesitter", "repo": "nvim-treesitter",
"rev": "4e21361e15b1d4147830c5fe571556eb1b14e6f9", "rev": "cc360a9beb1b30d172438f640e2c3450358c4086",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "nvim-treesitter", "owner": "nvim-treesitter",
"ref": "master", "ref": "v0.9.0",
"repo": "nvim-treesitter", "repo": "nvim-treesitter",
"type": "github" "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": { "root": {
"inputs": { "inputs": {
"Comment-nvim-src": "Comment-nvim-src",
"baleia-nvim-src": "baleia-nvim-src", "baleia-nvim-src": "baleia-nvim-src",
"base16-nvim-src": "base16-nvim-src",
"bufferline-nvim-src": "bufferline-nvim-src", "bufferline-nvim-src": "bufferline-nvim-src",
"bypass-paywalls-clean": "bypass-paywalls-clean",
"cmp-nvim-lsp-src": "cmp-nvim-lsp-src", "cmp-nvim-lsp-src": "cmp-nvim-lsp-src",
"comment-nvim-src": "comment-nvim-src",
"darwin": "darwin", "darwin": "darwin",
"disko": "disko", "disko": "disko",
"fidget-nvim-src": "fidget-nvim-src",
"firefox-darwin": "firefox-darwin", "firefox-darwin": "firefox-darwin",
"hmts-nvim-src": "hmts-nvim-src", "hmts-nvim-src": "hmts-nvim-src",
"home-manager": "home-manager", "home-manager": "home-manager",
"kitty-scrollback-nvim-src": "kitty-scrollback-nvim-src",
"nextcloud-cookbook": "nextcloud-cookbook", "nextcloud-cookbook": "nextcloud-cookbook",
"nextcloud-external": "nextcloud-external", "nextcloud-external": "nextcloud-external",
"nextcloud-news": "nextcloud-news", "nextcloud-news": "nextcloud-news",
"nextcloud-snappymail": "nextcloud-snappymail", "nil": "nil",
"nix2vim": "nix2vim", "nix2vim": "nix2vim",
"nixos-generators": "nixos-generators", "nixos-generators": "nixos-generators",
"nixpkgs": "nixpkgs", "nixpkgs": "nixpkgs",
"nixpkgs-caddy": "nixpkgs-caddy", "null-ls-nvim-src": "null-ls-nvim-src",
"nur": "nur", "nur": "nur",
"nvim-lint-src": "nvim-lint-src",
"nvim-lspconfig-src": "nvim-lspconfig-src", "nvim-lspconfig-src": "nvim-lspconfig-src",
"nvim-tree-lua-src": "nvim-tree-lua-src", "nvim-tree-lua-src": "nvim-tree-lua-src",
"nvim-treesitter-src": "nvim-treesitter-src", "nvim-treesitter-src": "nvim-treesitter-src",
"ren": "ren",
"rep": "rep",
"telescope-nvim-src": "telescope-nvim-src", "telescope-nvim-src": "telescope-nvim-src",
"telescope-project-nvim-src": "telescope-project-nvim-src", "telescope-project-nvim-src": "telescope-project-nvim-src",
"toggleterm-nvim-src": "toggleterm-nvim-src", "toggleterm-nvim-src": "toggleterm-nvim-src",
"tree-sitter-bash": "tree-sitter-bash", "tree-sitter-bash": "tree-sitter-bash",
"tree-sitter-ini": "tree-sitter-ini", "tree-sitter-ini": "tree-sitter-ini",
"tree-sitter-lua": "tree-sitter-lua",
"tree-sitter-puppet": "tree-sitter-puppet", "tree-sitter-puppet": "tree-sitter-puppet",
"tree-sitter-python": "tree-sitter-python", "tree-sitter-python": "tree-sitter-python",
"tree-sitter-rasi": "tree-sitter-rasi", "tree-sitter-rasi": "tree-sitter-rasi",
"tree-sitter-vimdoc": "tree-sitter-vimdoc", "vscode-terraform-snippets": "vscode-terraform-snippets",
"wallpapers": "wallpapers", "wallpapers": "wallpapers",
"wsl": "wsl", "wsl": "wsl",
"zenyd-mpv-scripts": "zenyd-mpv-scripts" "zenyd-mpv-scripts": "zenyd-mpv-scripts"
} }
}, },
"rust-overlay": {
"inputs": {
"flake-utils": [
"nil",
"flake-utils"
],
"nixpkgs": [
"nil",
"nixpkgs"
]
},
"locked": {
"lastModified": 1680488274,
"narHash": "sha256-0vYMrZDdokVmPQQXtFpnqA2wEgCCUXf5a3dDuDVshn0=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "7ec2ff598a172c6e8584457167575b3a1a5d80d8",
"type": "github"
},
"original": {
"owner": "oxalica",
"repo": "rust-overlay",
"type": "github"
}
},
"systems": { "systems": {
"locked": { "locked": {
"lastModified": 1681028828, "lastModified": 1681028828,
@ -609,16 +555,16 @@
"telescope-nvim-src": { "telescope-nvim-src": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1701167040, "lastModified": 1686302912,
"narHash": "sha256-H5RpyWMluE+Yxg7xFX43AZTVW+Yg70DF3FmEGXBUSNg=", "narHash": "sha256-fV3LLRwAPykVGc4ImOnUSP+WTrPp9Ad9OTfBJ6wqTMk=",
"owner": "nvim-telescope", "owner": "nvim-telescope",
"repo": "telescope.nvim", "repo": "telescope.nvim",
"rev": "d90956833d7c27e73c621a61f20b29fdb7122709", "rev": "776b509f80dd49d8205b9b0d94485568236d1192",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "nvim-telescope", "owner": "nvim-telescope",
"ref": "0.1.5", "ref": "0.1.2",
"repo": "telescope.nvim", "repo": "telescope.nvim",
"type": "github" "type": "github"
} }
@ -626,11 +572,11 @@
"telescope-project-nvim-src": { "telescope-project-nvim-src": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1701464478, "lastModified": 1682606566,
"narHash": "sha256-touMCltcnqkrQYV1NtNeWLQeFVGt+WM3aIWIdKilA7w=", "narHash": "sha256-H6lrPjpOUVleKHB0ziI+6dthg9ymitHhEWtcgYJTrKo=",
"owner": "nvim-telescope", "owner": "nvim-telescope",
"repo": "telescope-project.nvim", "repo": "telescope-project.nvim",
"rev": "1aaf16580a614601a7f7077d9639aeb457dc5559", "rev": "7c64b181dd4e72deddcf6f319e3bf1e95b2a2f30",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -642,16 +588,16 @@
"toggleterm-nvim-src": { "toggleterm-nvim-src": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1701858874, "lastModified": 1685434104,
"narHash": "sha256-vJApw7XY2wOX9InfWcah+hkNxBfS1+kQUWr4ITxRmgA=", "narHash": "sha256-oiCnBrvft6XxiQtQH8E4F842xhh348SaTpHzaeb+iDY=",
"owner": "akinsho", "owner": "akinsho",
"repo": "toggleterm.nvim", "repo": "toggleterm.nvim",
"rev": "cbd041d91b90cd3c02df03fe6133208888f8e008", "rev": "95204ece0f2a54c89c4395295432f9aeedca7b5f",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "akinsho", "owner": "akinsho",
"ref": "v2.9.0", "ref": "v2.7.0",
"repo": "toggleterm.nvim", "repo": "toggleterm.nvim",
"type": "github" "type": "github"
} }
@ -659,28 +605,28 @@
"tree-sitter-bash": { "tree-sitter-bash": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1712878661, "lastModified": 1688032601,
"narHash": "sha256-sj1qYb42k0hXXcNCKg1hINYD11wDcVpnoPhZNtlYT6k=", "narHash": "sha256-gl5F3IeZa2VqyH/qFj8ey2pRbGq4X8DL5wiyvRrH56U=",
"owner": "tree-sitter", "owner": "tree-sitter",
"repo": "tree-sitter-bash", "repo": "tree-sitter-bash",
"rev": "f8fb3274f72a30896075585b32b0c54cad65c086", "rev": "493646764e7ad61ce63ce3b8c59ebeb37f71b841",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "tree-sitter", "owner": "tree-sitter",
"ref": "master",
"repo": "tree-sitter-bash", "repo": "tree-sitter-bash",
"rev": "493646764e7ad61ce63ce3b8c59ebeb37f71b841",
"type": "github" "type": "github"
} }
}, },
"tree-sitter-ini": { "tree-sitter-ini": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1699877527, "lastModified": 1690815608,
"narHash": "sha256-dYPeVTNWO4apY5dsjsKViavU7YtLeGTp6BzEemXhsEU=", "narHash": "sha256-IIpKzpA4q1jpYVZ75VZaxWHaqNt8TA427eMOui2s71M=",
"owner": "justinmk", "owner": "justinmk",
"repo": "tree-sitter-ini", "repo": "tree-sitter-ini",
"rev": "bcb84a2d4bcd6f55b911c42deade75c8f90cb0c5", "rev": "7f11a02fb8891482068e0fe419965d7bade81a68",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -689,31 +635,14 @@
"type": "github" "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": { "tree-sitter-puppet": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1713617121, "lastModified": 1690231696,
"narHash": "sha256-+zMgzyuGerJ8l+i5ZtWnmGr3i4fFiSLD5FssyKESsmI=", "narHash": "sha256-YEjjy9WLwITERYqoeSVrRYnwVBIAwdc4o0lvAK9wizw=",
"owner": "amaanq", "owner": "amaanq",
"repo": "tree-sitter-puppet", "repo": "tree-sitter-puppet",
"rev": "584522f32495d648b18a53ccb52d988e60de127d", "rev": "9ce9a5f7d64528572aaa8d59459ba869e634086b",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -725,28 +654,28 @@
"tree-sitter-python": { "tree-sitter-python": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1714528221, "lastModified": 1690493803,
"narHash": "sha256-hHQ5gK4dTRSdp0fLKarytU9vFhsBeQp7Ka61vFoIr7Y=", "narHash": "sha256-2btd/NRE6NuGNlx4cq535OrwtWXihiP3VMCJjPCiDOk=",
"owner": "tree-sitter", "owner": "tree-sitter",
"repo": "tree-sitter-python", "repo": "tree-sitter-python",
"rev": "71778c2a472ed00a64abf4219544edbf8e4b86d7", "rev": "5af00f64af6bbf822f208243cce5cf75396fb6f5",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "tree-sitter", "owner": "tree-sitter",
"ref": "master",
"repo": "tree-sitter-python", "repo": "tree-sitter-python",
"rev": "5af00f64af6bbf822f208243cce5cf75396fb6f5",
"type": "github" "type": "github"
} }
}, },
"tree-sitter-rasi": { "tree-sitter-rasi": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1707776004, "lastModified": 1678701563,
"narHash": "sha256-7zhQ5wGm0FFyuTiBVN2KgvUTw8G6fwUGR8HKJ69kR+c=", "narHash": "sha256-2nYZoLcrxxxiOJEySwHUm93lzMg8mU+V7LIP63ntFdA=",
"owner": "Fymyte", "owner": "Fymyte",
"repo": "tree-sitter-rasi", "repo": "tree-sitter-rasi",
"rev": "43196d934a9a6ab3c7093a8683efd0111bb03db1", "rev": "371dac6bcce0df5566c1cfebde69d90ecbeefd2d",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -755,19 +684,19 @@
"type": "github" "type": "github"
} }
}, },
"tree-sitter-vimdoc": { "vscode-terraform-snippets": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1713806200, "lastModified": 1614849738,
"narHash": "sha256-+QbLL5EC3oNiwd7h7MW/mutHhGPUHhbYTQcu6x6atcI=", "narHash": "sha256-v392tyzXV+zyBNt5OCB2NBCK7JcByrTa5Ne/nFtSCJI=",
"owner": "neovim", "owner": "run-at-scale",
"repo": "tree-sitter-vimdoc", "repo": "vscode-terraform-doc-snippets",
"rev": "b711df784dd43d0a8ed8ddbfca0ddcc3239d94b4", "rev": "6ab3e44b566e660f38922cf908e6e547eaa5d4b4",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "neovim", "owner": "run-at-scale",
"repo": "tree-sitter-vimdoc", "repo": "vscode-terraform-doc-snippets",
"type": "github" "type": "github"
} }
}, },
@ -790,17 +719,15 @@
"wsl": { "wsl": {
"inputs": { "inputs": {
"flake-compat": "flake-compat", "flake-compat": "flake-compat",
"flake-utils": "flake-utils_2", "flake-utils": "flake-utils_3",
"nixpkgs": [ "nixpkgs": "nixpkgs_2"
"nixpkgs"
]
}, },
"locked": { "locked": {
"lastModified": 1714355896, "lastModified": 1690553050,
"narHash": "sha256-rtv+nJJ12V7w68j8vIcGacfS1yuK1/dBgglSKWzYMTM=", "narHash": "sha256-pK3kF30OykL3v6P8UP6ipihlS34KoGq9SryCj3tHrFw=",
"owner": "nix-community", "owner": "nix-community",
"repo": "NixOS-WSL", "repo": "NixOS-WSL",
"rev": "acb893461a4bee4e77b1a27b1410d4995b52174c", "rev": "f7a95a37306c46b42e9ce751977c44c752fd5eca",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -812,11 +739,11 @@
"zenyd-mpv-scripts": { "zenyd-mpv-scripts": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1707704915, "lastModified": 1650625438,
"narHash": "sha256-9P/8q/OZXfaJMS08acQP4h3/zUA5mKRQee0JmkXcz1w=", "narHash": "sha256-OBCuzCtgfSwj0i/rBNranuu4LRc47jObwQIJgQQoerg=",
"owner": "zenyd", "owner": "zenyd",
"repo": "mpv-scripts", "repo": "mpv-scripts",
"rev": "9bdce0050144cb24f92475f7bdd77180e0e4c26b", "rev": "19ea069abcb794d1bf8fac2f59b50d71ab992130",
"type": "github" "type": "github"
}, },
"original": { "original": {

355
flake.nix
View File

@ -7,25 +7,20 @@
# Used for system packages # Used for system packages
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; 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 # Used for MacOS system config
darwin = { darwin = {
url = "github:lnl7/nix-darwin/master"; url = "github:/lnl7/nix-darwin/master";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
# Used for Windows Subsystem for Linux compatibility # Used for Windows Subsystem for Linux compatibility
wsl = { wsl.url = "github:nix-community/NixOS-WSL";
url = "github:nix-community/NixOS-WSL";
inputs.nixpkgs.follows = "nixpkgs";
};
# Used for user packages and dotfiles # Used for user packages and dotfiles
home-manager = { home-manager = {
url = "github:nix-community/home-manager/master"; 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 for their inputs
}; };
# Community packages; used for Firefox extensions # Community packages; used for Firefox extensions
@ -61,38 +56,39 @@
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
# Neovim plugins # Nix language server
base16-nvim-src = { nil = {
url = "github:RRethy/base16-nvim"; url = "github:oxalica/nil/2023-04-03";
flake = false; inputs.nixpkgs.follows = "nixpkgs";
}; };
# Neovim plugins
nvim-lspconfig-src = { nvim-lspconfig-src = {
# https://github.com/neovim/nvim-lspconfig/tags url = "github:neovim/nvim-lspconfig/v0.1.6";
url = "github:neovim/nvim-lspconfig/v0.1.7";
flake = false; flake = false;
}; };
cmp-nvim-lsp-src = { cmp-nvim-lsp-src = {
url = "github:hrsh7th/cmp-nvim-lsp"; url = "github:hrsh7th/cmp-nvim-lsp";
flake = false; flake = false;
}; };
null-ls-nvim-src = {
url = "github:jose-elias-alvarez/null-ls.nvim";
flake = false;
};
baleia-nvim-src = { baleia-nvim-src = {
# https://github.com/m00qek/baleia.nvim/tags
url = "github:m00qek/baleia.nvim"; url = "github:m00qek/baleia.nvim";
flake = false; flake = false;
}; };
comment-nvim-src = { Comment-nvim-src = {
# https://github.com/numToStr/Comment.nvim/releases
url = "github:numToStr/Comment.nvim/v0.8.0"; url = "github:numToStr/Comment.nvim/v0.8.0";
flake = false; flake = false;
}; };
nvim-treesitter-src = { nvim-treesitter-src = {
# https://github.com/nvim-treesitter/nvim-treesitter/tags url = "github:nvim-treesitter/nvim-treesitter/v0.9.0";
url = "github:nvim-treesitter/nvim-treesitter/master";
flake = false; flake = false;
}; };
telescope-nvim-src = { telescope-nvim-src = {
# https://github.com/nvim-telescope/telescope.nvim/releases url = "github:nvim-telescope/telescope.nvim/0.1.2";
url = "github:nvim-telescope/telescope.nvim/0.1.5";
flake = false; flake = false;
}; };
telescope-project-nvim-src = { telescope-project-nvim-src = {
@ -100,48 +96,39 @@
flake = false; flake = false;
}; };
toggleterm-nvim-src = { toggleterm-nvim-src = {
# https://github.com/akinsho/toggleterm.nvim/tags url = "github:akinsho/toggleterm.nvim/v2.7.0";
url = "github:akinsho/toggleterm.nvim/v2.9.0";
flake = false; flake = false;
}; };
bufferline-nvim-src = { bufferline-nvim-src = {
# https://github.com/akinsho/bufferline.nvim/releases url = "github:akinsho/bufferline.nvim/v4.2.0";
url = "github:akinsho/bufferline.nvim/v4.5.0";
flake = false; flake = false;
}; };
nvim-tree-lua-src = { nvim-tree-lua-src = {
url = "github:kyazdani42/nvim-tree.lua"; url = "github:kyazdani42/nvim-tree.lua";
flake = false; flake = false;
}; };
vscode-terraform-snippets = {
url = "github:run-at-scale/vscode-terraform-doc-snippets";
flake = false;
};
hmts-nvim-src = { hmts-nvim-src = {
url = "github:calops/hmts.nvim"; url = "github:calops/hmts.nvim";
flake = false; flake = false;
}; };
fidget-nvim-src = {
# https://github.com/j-hui/fidget.nvim/tags
url = "github:j-hui/fidget.nvim/v1.2.0";
flake = false;
};
kitty-scrollback-nvim-src = {
url = "github:mikesmithgh/kitty-scrollback.nvim";
flake = false;
};
nvim-lint-src = {
url = "github:mfussenegger/nvim-lint";
flake = false;
};
# Tree-Sitter Grammars # Tree-Sitter Grammars
tree-sitter-bash = { tree-sitter-bash = {
url = "github:tree-sitter/tree-sitter-bash/master"; # Fix: bash highlighting doesn't work as of this commit:
# https://github.com/NixOS/nixpkgs/commit/49cce41b7c5f6b88570a482355d9655ca19c1029
url =
"github:tree-sitter/tree-sitter-bash/493646764e7ad61ce63ce3b8c59ebeb37f71b841";
flake = false; flake = false;
}; };
tree-sitter-python = { tree-sitter-python = {
url = "github:tree-sitter/tree-sitter-python/master"; # Fix: invalid node in position. Broken as of this commit (replaced with newer):
flake = false; # https://github.com/NixOS/nixpkgs/commit/8ec3627796ecc899e6f47f5bf3c3220856ead9c5
}; url =
tree-sitter-lua = { "github:tree-sitter/tree-sitter-python/5af00f64af6bbf822f208243cce5cf75396fb6f5";
url = "github:MunifTanjim/tree-sitter-lua/main";
flake = false; flake = false;
}; };
tree-sitter-ini = { tree-sitter-ini = {
@ -156,10 +143,6 @@
url = "github:Fymyte/tree-sitter-rasi"; url = "github:Fymyte/tree-sitter-rasi";
flake = false; flake = false;
}; };
tree-sitter-vimdoc = {
url = "github:neovim/tree-sitter-vimdoc";
flake = false;
};
# MPV Scripts # MPV Scripts
zenyd-mpv-scripts = { zenyd-mpv-scripts = {
@ -167,82 +150,51 @@
flake = false; 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;
};
# Firefox addon from outside the extension store
bypass-paywalls-clean = {
# https://gitlab.com/magnolia1234/bpc-uploads/-/commits/master/?ref_type=HEADS
url = "https://github.com/bpc-clone/bpc_updates/releases/download/latest/bypass_paywalls_clean-3.6.6.0.xpi";
flake = false;
};
# Nextcloud Apps # Nextcloud Apps
nextcloud-news = { nextcloud-news = {
# https://github.com/nextcloud/news/releases url =
url = "https://github.com/nextcloud/news/releases/download/25.0.0-alpha3/news.tar.gz"; "https://github.com/nextcloud/news/releases/download/22.0.0/news.tar.gz";
flake = false; flake = false;
}; };
nextcloud-external = { nextcloud-external = {
# https://github.com/nextcloud-releases/external/releases url =
url = "https://github.com/nextcloud-releases/external/releases/download/v5.3.1/external-v5.3.1.tar.gz"; "https://github.com/nextcloud-releases/external/releases/download/v5.2.0/external-v5.2.0.tar.gz";
flake = false; flake = false;
}; };
nextcloud-cookbook = { nextcloud-cookbook = {
# https://github.com/christianlupus-nextcloud/cookbook-releases/releases/ url =
url = "https://github.com/christianlupus-nextcloud/cookbook-releases/releases/download/v0.11.0/cookbook-0.11.0.tar.gz"; "https://github.com/nextcloud/cookbook/releases/download/v0.10.2/Cookbook-0.10.2.tar.gz";
flake = false;
};
nextcloud-snappymail = {
# https://github.com/the-djmaze/snappymail/releases
# https://snappymail.eu/repository/nextcloud
url = "https://github.com/nmasur/snappymail-nextcloud/releases/download/v2.36.1/snappymail-2.36.1-nextcloud.tar.gz";
flake = false; flake = false;
}; };
}; };
outputs = outputs = { nixpkgs, ... }@inputs:
{ nixpkgs, ... }@inputs:
let let
# Global configuration for my systems # Global configuration for my systems
globals = globals = let baseName = "masu.rs";
let in rec {
baseName = "masu.rs"; user = "noah";
in fullName = "Noah Masur";
rec { gitName = fullName;
user = "noah"; gitEmail = "7386960+nmasur@users.noreply.github.com";
fullName = "Noah Masur"; mail.server = "noahmasur.com";
gitName = fullName; mail.imapHost = "imap.purelymail.com";
gitEmail = "7386960+nmasur@users.noreply.github.com"; mail.smtpHost = "smtp.purelymail.com";
mail.server = "noahmasur.com"; dotfilesRepo = "https://github.com/nmasur/dotfiles";
mail.imapHost = "imap.purelymail.com"; hostnames = {
mail.smtpHost = "smtp.purelymail.com"; git = "git.${baseName}";
dotfilesRepo = "https://github.com/nmasur/dotfiles"; metrics = "metrics.${baseName}";
hostnames = { prometheus = "prom.${baseName}";
git = "git.${baseName}"; secrets = "vault.${baseName}";
influxdb = "influxdb.${baseName}"; stream = "stream.${baseName}";
irc = "irc.${baseName}"; content = "cloud.${baseName}";
metrics = "metrics.${baseName}"; books = "books.${baseName}";
minecraft = "minecraft.${baseName}"; download = "download.${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}";
};
}; };
};
# Common overlays to always use # Common overlays to always use
overlays = [ overlays = [
@ -252,31 +204,24 @@
(import ./overlays/calibre-web.nix) (import ./overlays/calibre-web.nix)
(import ./overlays/disko.nix inputs) (import ./overlays/disko.nix inputs)
(import ./overlays/tree-sitter.nix inputs) (import ./overlays/tree-sitter.nix inputs)
(import ./overlays/caddy.nix inputs)
(import ./overlays/mpv-scripts.nix inputs) (import ./overlays/mpv-scripts.nix inputs)
(import ./overlays/nextcloud-apps.nix inputs) (import ./overlays/nextcloud-apps.nix inputs)
(import ./overlays/betterlockscreen.nix) (import ./overlays/betterlockscreen.nix)
(import ./overlays/gh-collaborators.nix)
(import ./overlays/bypass-paywalls-clean.nix inputs)
(import ./overlays/ren-rep.nix inputs)
]; ];
# System types to support. # System types to support.
supportedSystems = [ supportedSystems =
"x86_64-linux" [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ];
"x86_64-darwin"
"aarch64-linux"
"aarch64-darwin"
];
# Helper function to generate an attrset '{ x86_64-linux = f "x86_64-linux"; ... }'. # Helper function to generate an attrset '{ x86_64-linux = f "x86_64-linux"; ... }'.
forAllSystems = nixpkgs.lib.genAttrs supportedSystems; forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
in
rec { in rec {
# Contains my full system builds, including home-manager # Contains my full system builds, including home-manager
# nixos-rebuild switch --flake .#tempest # nixos-rebuild switch --flake .#tempest
nixosConfigurations = { nixosConfigurations = {
arrow = import ./hosts/arrow { inherit inputs globals overlays; };
tempest = import ./hosts/tempest { inherit inputs globals overlays; }; tempest = import ./hosts/tempest { inherit inputs globals overlays; };
hydra = import ./hosts/hydra { inherit inputs globals overlays; }; hydra = import ./hosts/hydra { inherit inputs globals overlays; };
flame = import ./hosts/flame { inherit inputs globals overlays; }; flame = import ./hosts/flame { inherit inputs globals overlays; };
@ -286,139 +231,78 @@
# Contains my full Mac system builds, including home-manager # Contains my full Mac system builds, including home-manager
# darwin-rebuild switch --flake .#lookingglass # darwin-rebuild switch --flake .#lookingglass
darwinConfigurations = { 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 home-manager settings with:
# home-manager switch --flake .#tempest # home-manager switch --flake .#tempest
homeConfigurations = { homeConfigurations = {
tempest = nixosConfigurations.tempest.config.home-manager.users.${globals.user}.home; tempest =
lookingglass = darwinConfigurations.lookingglass.config.home-manager.users."Noah.Masur".home; nixosConfigurations.tempest.config.home-manager.users.${globals.user}.home;
lookingglass =
darwinConfigurations.lookingglass.config.home-manager.users."Noah.Masur".home;
}; };
# Disk formatting, only used once # Disk formatting, only used once
diskoConfigurations = { diskoConfigurations = { root = import ./disks/root.nix; };
root = import ./disks/root.nix;
packages = let
aws = system:
import ./hosts/aws { inherit inputs globals overlays system; };
staff = system:
import ./hosts/staff { inherit inputs globals overlays system; };
neovim = system:
let pkgs = import nixpkgs { inherit system overlays; };
in import ./modules/common/neovim/package {
inherit pkgs;
colors = (import ./colorscheme/gruvbox-dark).dark;
};
in {
x86_64-linux.aws = aws "x86_64-linux";
x86_64-linux.staff = staff "x86_64-linux";
# 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";
}; };
packages =
let
staff =
system:
import ./hosts/staff {
inherit
inputs
globals
overlays
system
;
};
neovim =
system:
let
pkgs = import nixpkgs { inherit system overlays; };
in
import ./modules/common/neovim/package {
inherit pkgs;
colors = (import ./colorscheme/gruvbox-dark).dark;
};
in
{
x86_64-linux.staff = staff "x86_64-linux";
x86_64-linux.arrow = inputs.nixos-generators.nixosGenerate {
system = "x86_64-linux";
format = "iso";
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; } ++ [
# import
# ./modules/aws
# { inherit inputs; }
(
{ ... }:
{
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;
}
)
];
};
# 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 # Programs that can be run by calling this flake
apps = forAllSystems ( apps = forAllSystems (system:
system: let pkgs = import nixpkgs { inherit system overlays; };
let in import ./apps { inherit pkgs; });
pkgs = import nixpkgs { inherit system overlays; };
in
import ./apps { inherit pkgs; }
);
# Development environments # Development environments
devShells = forAllSystems ( devShells = forAllSystems (system:
system: let pkgs = import nixpkgs { inherit system overlays; };
let in {
pkgs = import nixpkgs { inherit system overlays; };
in
{
# Used to run commands and edit files in this repo # Used to run commands and edit files in this repo
default = pkgs.mkShell { default = pkgs.mkShell {
buildInputs = with pkgs; [ buildInputs = with pkgs; [ git stylua nixfmt shfmt shellcheck ];
git
stylua
nixfmt-rfc-style
shfmt
shellcheck
];
}; };
}
);
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 checks = forAllSystems (system:
if $(grep "ERROR" $out/health.log); then let pkgs = import nixpkgs { inherit system overlays; };
cat $out/health.log in {
exit 1 neovim = pkgs.runCommand "neovim-check-health" {
fi buildInputs = [ inputs.self.packages.${system}.neovim ];
''; } ''
} mkdir -p $out
); export HOME=$TMPDIR
nvim -c "checkhealth" -c "write $out/health.log" -c "quitall"
formatter = forAllSystems ( # Check for errors inside the health log
system: if $(grep "ERROR" $out/health.log); then
let cat $out/health.log
pkgs = import nixpkgs { inherit system overlays; }; exit 1
in fi
pkgs.nixfmt-rfc-style '';
); });
# Templates for starting other projects quickly # Templates for starting other projects quickly
templates = rec { templates = rec {
@ -439,10 +323,7 @@
path = ./templates/haskell; path = ./templates/haskell;
description = "Haskell template"; description = "Haskell template";
}; };
rust = {
path = ./templates/rust;
description = "Rust template";
};
}; };
}; };
} }

View File

@ -12,15 +12,3 @@ These are the individual machines managed by this flake.
| [swan](./swan/default.nix) | Home server | | [swan](./swan/default.nix) | Home server |
| [tempest](./tempest/default.nix) | Linux desktop | | [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.

View File

@ -1,47 +0,0 @@
resource "aws_instance" "instance" {
ami = aws_ami.image.id
instance_type = var.ec2_size
vpc_security_group_ids = [aws_security_group.instance.id]
tags = merge(local.default_tags, {
Name = "aws-nixos"
})
lifecycle {
create_before_destroy = true
}
}
data "aws_vpc" "vpc" {
default = true
}
resource "aws_security_group" "instance" {
name = "t2-aws-nixos-test"
description = "Allow SSH and HTTPS"
vpc_id = data.aws_vpc.vpc.id
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"]
}
}

View File

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

View File

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

View File

@ -1,31 +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";
};
}
];
}

View File

@ -1,41 +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;
# 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;
virtualisation.vmVariant = {
virtualisation.forwardPorts = [
{
from = "host";
host.port = 2222;
guest.port = 22;
}
];
};
}
../../modules/common
../../modules/nixos
]

View File

@ -1,99 +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"
}
}
}
# locals {
# image_file = one(fileset(path.root, "result/iso/nixos.iso"))
# }
# variable "cloudflare_r2_endpoint" {
# type = string
# description = "Domain for the Cloudflare R2 endpoint"
# }
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
}
# data "aws_s3_bucket" "images" {
# bucket = "noahmasur-arrow-images"
# }
#
# resource "aws_s3_object" "image" {
# bucket = data.aws_s3_bucket.images.id
# key = "arrow.iso"
# source = local.image_file
# etag = filemd5(local.image_file)
# acl = "public-read"
# }
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
}

27
hosts/aws/default.nix Normal file
View File

@ -0,0 +1,27 @@
{ inputs, system, globals, overlays, ... }:
inputs.nixos-generators.nixosGenerate {
inherit system;
format = "amazon";
modules = [
globals
inputs.home-manager.nixosModules.home-manager
{
nixpkgs.overlays = overlays;
networking.hostName = "sheep";
gui.enable = false;
theme.colors = (import ../../colorscheme/gruvbox).dark;
passwordHash = null;
publicKey =
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIB+AbmjGEwITk5CK9y7+Rg27Fokgj9QEjgc9wST6MA3s";
# AWS settings require this
permitRootLogin = "prohibit-password";
}
../../modules/common
../../modules/nixos
../../modules/nixos/services/sshd.nix
] ++ [
# Required to fix diskSize errors during build
({ ... }: { amazonImage.sizeMB = 16 * 1024; })
];
}

View File

@ -2,9 +2,9 @@ locals {
image_file = one(fileset(path.root, "result/nixos-amazon-image-*.vhd")) image_file = one(fileset(path.root, "result/nixos-amazon-image-*.vhd"))
} }
# Upload image to S3 # Upload to S3
resource "aws_s3_object" "image" { resource "aws_s3_object" "image" {
bucket = var.images_bucket bucket = "your_bucket_name"
key = basename(local.image_file) key = basename(local.image_file)
source = local.image_file source = local.image_file
etag = filemd5(local.image_file) etag = filemd5(local.image_file)

280
hosts/aws/workflow.yml Normal file
View File

@ -0,0 +1,280 @@
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@v3
# Enable access to KVM, required to build an image
- name: Enable KVM group perms
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@v1.6.1
with:
role-to-assume: ${{ env.AWS_ROLE_ARN }}
aws-region: ${{ env.AWS_REGION }}
# Install Nix
- name: Install Nix
uses: cachix/install-nix-action@v17
with:
extra_nix_config: |
substituters = s3://insert-cache-bucket https://cache.nixos.org/
trusted-public-keys = insert-cache-bucket:M6PsZjHXcLvbQyPUBLICKEYGVoNwI84g1FBQzouRU= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=
# Build the image
- name: Build Image
run: nix build .#aws
# Copy the image to S3
- name: Upload Image to Cache
env:
NIX_CACHE_PRIVATE_KEY: ${{ secrets.NIX_CACHE_PRIVATE_KEY }}
run: |
echo "$NIX_CACHE_PRIVATE_KEY" > cache.key
nix store sign --key-file cache.key $(readlink result)
nix copy --to s3://t2-aws-nixos-test $(readlink result)
rm cache.key
# 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

View File

@ -1,18 +1,11 @@
# The Flame # The Flame
# System configuration for an Oracle free server # System configuration for an Oracle free server
# See [readme](../README.md) to explain how this file works.
# How to install: # How to install:
# https://blog.korfuri.fr/posts/2022/08/nixos-on-an-oracle-free-tier-ampere-machine/ # https://blog.korfuri.fr/posts/2022/08/nixos-on-an-oracle-free-tier-ampere-machine/
# These days, probably use nixos-anywhere instead. # These days, probably use nixos-anywhere instead.
{ { inputs, globals, overlays, ... }:
inputs,
globals,
overlays,
...
}:
inputs.nixpkgs.lib.nixosSystem { inputs.nixpkgs.lib.nixosSystem {
system = "aarch64-linux"; system = "aarch64-linux";
@ -31,11 +24,7 @@ inputs.nixpkgs.lib.nixosSystem {
# Not sure what's necessary but too afraid to remove anything # Not sure what's necessary but too afraid to remove anything
imports = [ (inputs.nixpkgs + "/nixos/modules/profiles/qemu-guest.nix") ]; imports = [ (inputs.nixpkgs + "/nixos/modules/profiles/qemu-guest.nix") ];
boot.initrd.availableKernelModules = [ boot.initrd.availableKernelModules = [ "xhci_pci" "virtio_pci" "usbhid" ];
"xhci_pci"
"virtio_pci"
"usbhid"
];
# File systems must be declared in order to boot # File systems must be declared in order to boot
@ -58,22 +47,17 @@ inputs.nixpkgs.lib.nixosSystem {
gui.enable = false; gui.enable = false;
# Still require colors for programs like Neovim, K9S # Still require colors for programs like Neovim, K9S
theme = { theme = { colors = (import ../../colorscheme/gruvbox).dark; };
colors = (import ../../colorscheme/gruvbox).dark;
};
# Programs and services # Programs and services
atuin.enable = true;
cloudflare.enable = true; # Proxy traffic with Cloudflare cloudflare.enable = true; # Proxy traffic with Cloudflare
dotfiles.enable = true; # Clone dotfiles dotfiles.enable = true; # Clone dotfiles
neovim.enable = true; neovim.enable = true;
giteaRunner.enable = true; giteaRunner.enable = true;
services.caddy.enable = true; services.caddy.enable = true;
services.grafana.enable = true; services.grafana.enable = true;
services.thelounge.enable = true;
services.openssh.enable = true; services.openssh.enable = true;
services.victoriametrics.enable = true; services.victoriametrics.enable = true;
services.influxdb2.enable = true;
services.gitea.enable = true; services.gitea.enable = true;
services.vaultwarden.enable = true; services.vaultwarden.enable = true;
services.minecraft-server.enable = true; # Setup Minecraft server services.minecraft-server.enable = true; # Setup Minecraft server
@ -83,7 +67,8 @@ inputs.nixpkgs.lib.nixosSystem {
enable = true; enable = true;
id = "bd250ee1-ed2e-42d2-b627-039f1eb5a4d2"; id = "bd250ee1-ed2e-42d2-b627-039f1eb5a4d2";
credentialsFile = ../../private/cloudflared-flame.age; credentialsFile = ../../private/cloudflared-flame.age;
ca = "ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBK/6oyVqjFGX3Uvrc3VS8J9sphxzAnRzKC85xgkHfYgR3TK6qBGXzHrknEj21xeZrr3G2y1UsGzphWJd9ZfIcdA= open-ssh-ca@cloudflareaccess.org"; ca =
"ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBK/6oyVqjFGX3Uvrc3VS8J9sphxzAnRzKC85xgkHfYgR3TK6qBGXzHrknEj21xeZrr3G2y1UsGzphWJd9ZfIcdA= open-ssh-ca@cloudflareaccess.org";
}; };
# Nextcloud backup config # Nextcloud backup config
@ -94,9 +79,8 @@ inputs.nixpkgs.lib.nixosSystem {
}; };
# Disable passwords, only use SSH key # Disable passwords, only use SSH key
publicKeys = [ publicKey =
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIB+AbmjGEwITk5CK9y7+Rg27Fokgj9QEjgc9wST6MA3s personal" "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIB+AbmjGEwITk5CK9y7+Rg27Fokgj9QEjgc9wST6MA3s";
];
# # Wireguard config for Transmission # # Wireguard config for Transmission
# wireguard.enable = true; # wireguard.enable = true;
@ -126,6 +110,7 @@ inputs.nixpkgs.lib.nixosSystem {
# # VPN port forwarding # # VPN port forwarding
# services.transmission.settings.peer-port = 57599; # services.transmission.settings.peer-port = 57599;
} }
]; ];
} }

View File

@ -1,14 +1,7 @@
# The Hydra # The Hydra
# System configuration for WSL # System configuration for WSL
# See [readme](../README.md) to explain how this file works. { inputs, globals, overlays, ... }:
{
inputs,
globals,
overlays,
...
}:
inputs.nixpkgs.lib.nixosSystem { inputs.nixpkgs.lib.nixosSystem {
system = "x86_64-linux"; system = "x86_64-linux";
@ -37,7 +30,8 @@ inputs.nixpkgs.lib.nixosSystem {
startMenuLaunchers = true; startMenuLaunchers = true;
nativeSystemd = true; nativeSystemd = true;
wslConf.network.generateResolvConf = true; # Turn off if it breaks VPN 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; neovim.enable = true;
@ -45,6 +39,7 @@ inputs.nixpkgs.lib.nixosSystem {
mail.aerc.enable = true; mail.aerc.enable = true;
mail.himalaya.enable = true; mail.himalaya.enable = true;
dotfiles.enable = true; dotfiles.enable = true;
nixlang.enable = true;
lua.enable = true; lua.enable = true;
} }
]; ];

View File

@ -1,27 +1,19 @@
# The Looking Glass # The Looking Glass
# System configuration for my work Macbook # System configuration for my work Macbook
{ { inputs, globals, overlays, ... }:
inputs,
globals,
overlays,
...
}:
inputs.darwin.lib.darwinSystem { inputs.darwin.lib.darwinSystem {
system = "aarch64-darwin"; system = "x86_64-darwin";
specialArgs = { }; specialArgs = { };
modules = [ modules = [
../../modules/common ../../modules/common
../../modules/darwin ../../modules/darwin
( (globals // rec {
globals user = "Noah.Masur";
// rec { gitName = "Noah-Masur_1701";
user = "Noah.Masur"; gitEmail = "${user}@take2games.com";
gitName = "Noah-Masur_1701"; })
gitEmail = "${user}@take2games.com";
}
)
inputs.home-manager.darwinModules.home-manager inputs.home-manager.darwinModules.home-manager
{ {
nixpkgs.overlays = [ inputs.firefox-darwin.overlay ] ++ overlays; nixpkgs.overlays = [ inputs.firefox-darwin.overlay ] ++ overlays;
@ -33,7 +25,6 @@ inputs.darwin.lib.darwinSystem {
dark = true; dark = true;
}; };
mail.user = globals.user; mail.user = globals.user;
atuin.enable = true;
charm.enable = true; charm.enable = true;
neovim.enable = true; neovim.enable = true;
mail.enable = true; mail.enable = true;
@ -43,11 +34,10 @@ inputs.darwin.lib.darwinSystem {
discord.enable = true; discord.enable = true;
firefox.enable = true; firefox.enable = true;
dotfiles.enable = true; dotfiles.enable = true;
nixlang.enable = true;
terraform.enable = true; terraform.enable = true;
python.enable = true; python.enable = true;
rust.enable = true;
lua.enable = true; lua.enable = true;
obsidian.enable = true;
kubernetes.enable = true; kubernetes.enable = true;
_1password.enable = true; _1password.enable = true;
slack.enable = true; slack.enable = true;

View File

@ -1,53 +1,43 @@
# The Staff # The Staff
# ISO configuration for my USB drive # ISO configuration for my USB drive
{ { inputs, system, overlays, ... }:
inputs,
system,
overlays,
...
}:
inputs.nixos-generators.nixosGenerate { inputs.nixos-generators.nixosGenerate {
inherit system; inherit system;
format = "install-iso"; format = "install-iso";
modules = [ modules = [{
{ nixpkgs.overlays = overlays;
nixpkgs.overlays = overlays; networking.hostName = "staff";
networking.hostName = "staff"; users.extraUsers.root.openssh.authorizedKeys.keys = [
users.extraUsers.root.openssh.authorizedKeys.keys = [ "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIB+AbmjGEwITk5CK9y7+Rg27Fokgj9QEjgc9wST6MA3s"
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIB+AbmjGEwITk5CK9y7+Rg27Fokgj9QEjgc9wST6MA3s" ];
]; services.openssh = {
services.openssh = { enable = true;
enable = true; ports = [ 22 ];
ports = [ 22 ]; allowSFTP = true;
allowSFTP = true; settings = {
settings = { GatewayPorts = "no";
GatewayPorts = "no"; X11Forwarding = false;
X11Forwarding = false; PasswordAuthentication = false;
PasswordAuthentication = false; PermitRootLogin = "yes";
PermitRootLogin = "yes";
};
}; };
environment.systemPackages = };
let environment.systemPackages =
pkgs = import inputs.nixpkgs { inherit system overlays; }; let pkgs = import inputs.nixpkgs { inherit system overlays; };
in in with pkgs; [
with pkgs; git
[ vim
git wget
vim curl
wget (import ../../modules/common/neovim/package {
curl inherit pkgs;
(import ../../modules/common/neovim/package { colors = (import ../../colorscheme/gruvbox).dark;
inherit pkgs; })
colors = (import ../../colorscheme/gruvbox).dark; ];
}) nix.extraOptions = ''
]; experimental-features = nix-command flakes
nix.extraOptions = '' warn-dirty = false
experimental-features = nix-command flakes '';
warn-dirty = false }];
'';
}
];
} }

View File

@ -1,12 +1,7 @@
# The Swan # The Swan
# System configuration for my home NAS server # System configuration for my home NAS server
{ { inputs, globals, overlays, ... }:
inputs,
globals,
overlays,
...
}:
inputs.nixpkgs.lib.nixosSystem { inputs.nixpkgs.lib.nixosSystem {
system = "x86_64-linux"; system = "x86_64-linux";
@ -26,13 +21,8 @@ inputs.nixpkgs.lib.nixosSystem {
networking.hostName = "swan"; networking.hostName = "swan";
# Not sure what's necessary but too afraid to remove anything # Not sure what's necessary but too afraid to remove anything
boot.initrd.availableKernelModules = [ boot.initrd.availableKernelModules =
"xhci_pci" [ "xhci_pci" "ahci" "nvme" "usb_storage" "sd_mod" ];
"ahci"
"nvme"
"usb_storage"
"sd_mod"
];
# Required for transcoding # Required for transcoding
boot.initrd.kernelModules = [ "amdgpu" ]; boot.initrd.kernelModules = [ "amdgpu" ];
@ -64,19 +54,8 @@ inputs.nixpkgs.lib.nixosSystem {
devices = (import ../../disks/root.nix { disk = "/dev/nvme0n1"; }); devices = (import ../../disks/root.nix { disk = "/dev/nvme0n1"; });
}; };
boot.zfs = { # Automatically load the ZFS pool on boot
# Automatically load the ZFS pool on boot boot.zfs.extraPools = [ "tank" ];
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 # Theming
@ -84,12 +63,9 @@ inputs.nixpkgs.lib.nixosSystem {
gui.enable = false; gui.enable = false;
# Still require colors for programs like Neovim, K9S # Still require colors for programs like Neovim, K9S
theme = { theme = { colors = (import ../../colorscheme/gruvbox).dark; };
colors = (import ../../colorscheme/gruvbox-dark).dark;
};
# Programs and services # Programs and services
atuin.enable = true;
neovim.enable = true; neovim.enable = true;
cloudflare.enable = true; cloudflare.enable = true;
dotfiles.enable = true; dotfiles.enable = true;
@ -103,15 +79,14 @@ inputs.nixpkgs.lib.nixosSystem {
services.prometheus.enable = false; services.prometheus.enable = false;
services.vmagent.enable = true; services.vmagent.enable = true;
services.samba.enable = true; services.samba.enable = true;
services.paperless.enable = true;
services.postgresql.enable = true;
# Allows private remote access over the internet # Allows private remote access over the internet
cloudflareTunnel = { cloudflareTunnel = {
enable = true; enable = true;
id = "646754ac-2149-4a58-b51a-e1d0a1f3ade2"; id = "646754ac-2149-4a58-b51a-e1d0a1f3ade2";
credentialsFile = ../../private/cloudflared-swan.age; credentialsFile = ../../private/cloudflared-swan.age;
ca = "ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBCHF/UMtJqPFrf6f6GRY0ZFnkCW7b6sYgUTjTtNfRj1RdmNic1NoJZql7y6BrqQinZvy7nsr1UFDNWoHn6ah3tg= open-ssh-ca@cloudflareaccess.org"; ca =
"ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBCHF/UMtJqPFrf6f6GRY0ZFnkCW7b6sYgUTjTtNfRj1RdmNic1NoJZql7y6BrqQinZvy7nsr1UFDNWoHn6ah3tg= open-ssh-ca@cloudflareaccess.org";
}; };
# Send regular backups and litestream for DBs to an S3-like bucket # Send regular backups and litestream for DBs to an S3-like bucket
@ -122,9 +97,8 @@ inputs.nixpkgs.lib.nixosSystem {
}; };
# Disable passwords, only use SSH key # Disable passwords, only use SSH key
publicKeys = [ publicKey =
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIB+AbmjGEwITk5CK9y7+Rg27Fokgj9QEjgc9wST6MA3s personal" "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIB+AbmjGEwITk5CK9y7+Rg27Fokgj9QEjgc9wST6MA3s";
];
} }
]; ];
} }

View File

@ -1,12 +1,7 @@
# The Tempest # The Tempest
# System configuration for my desktop # System configuration for my desktop
{ { inputs, globals, overlays, ... }:
inputs,
globals,
overlays,
...
}:
inputs.nixpkgs.lib.nixosSystem { inputs.nixpkgs.lib.nixosSystem {
system = "x86_64-linux"; system = "x86_64-linux";
@ -23,14 +18,8 @@ inputs.nixpkgs.lib.nixosSystem {
networking.hostName = "tempest"; networking.hostName = "tempest";
# Not sure what's necessary but too afraid to remove anything # Not sure what's necessary but too afraid to remove anything
boot.initrd.availableKernelModules = [ boot.initrd.availableKernelModules =
"nvme" [ "nvme" "xhci_pci" "ahci" "usb_storage" "usbhid" "sd_mod" ];
"xhci_pci"
"ahci"
"usb_storage"
"usbhid"
"sd_mod"
];
# Graphics and VMs # Graphics and VMs
boot.initrd.kernelModules = [ "amdgpu" ]; boot.initrd.kernelModules = [ "amdgpu" ];
@ -94,7 +83,6 @@ inputs.nixpkgs.lib.nixosSystem {
gtk.theme.name = inputs.nixpkgs.lib.mkDefault "Adwaita-dark"; gtk.theme.name = inputs.nixpkgs.lib.mkDefault "Adwaita-dark";
# Programs and services # Programs and services
atuin.enable = true;
charm.enable = true; charm.enable = true;
neovim.enable = true; neovim.enable = true;
media.enable = true; media.enable = true;
@ -110,8 +98,7 @@ inputs.nixpkgs.lib.nixosSystem {
mail.himalaya.enable = true; mail.himalaya.enable = true;
keybase.enable = true; keybase.enable = true;
mullvad.enable = false; mullvad.enable = false;
rust.enable = true; nixlang.enable = true;
terraform.enable = true;
yt-dlp.enable = true; yt-dlp.enable = true;
gaming = { gaming = {
dwarf-fortress.enable = true; dwarf-fortress.enable = true;
@ -119,23 +106,27 @@ inputs.nixpkgs.lib.nixosSystem {
steam.enable = true; steam.enable = true;
legendary.enable = true; legendary.enable = true;
lutris.enable = true; lutris.enable = true;
leagueoflegends.enable = true;
ryujinx.enable = true; ryujinx.enable = true;
}; };
services.vmagent.enable = true; # Enables Prometheus metrics services.vmagent.enable = true; # Enables Prometheus metrics
services.openssh.enable = true; # Required for Cloudflare tunnel and identity file services.openssh.enable =
true; # Required for Cloudflare tunnel and identity file
# Allows private remote access over the internet # Allows private remote access over the internet
cloudflareTunnel = { cloudflareTunnel = {
enable = true; enable = true;
id = "ac133a82-31fb-480c-942a-cdbcd4c58173"; id = "ac133a82-31fb-480c-942a-cdbcd4c58173";
credentialsFile = ../../private/cloudflared-tempest.age; credentialsFile = ../../private/cloudflared-tempest.age;
ca = "ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBPY6C0HmdFCaxYtJxFr3qV4/1X4Q8KrYQ1hlme3u1hJXK+xW+lc9Y9glWHrhiTKilB7carYTB80US0O47gI5yU4= open-ssh-ca@cloudflareaccess.org"; ca =
"ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBPY6C0HmdFCaxYtJxFr3qV4/1X4Q8KrYQ1hlme3u1hJXK+xW+lc9Y9glWHrhiTKilB7carYTB80US0O47gI5yU4= open-ssh-ca@cloudflareaccess.org";
}; };
# Allows requests to force machine to wake up # Allows requests to force machine to wake up
# This network interface might change, needs to be set specifically for each machine. # This network interface might change, needs to be set specifically for each machine.
# Or set usePredictableInterfaceNames = false # Or set usePredictableInterfaceNames = false
networking.interfaces.enp5s0.wakeOnLan.enable = true; networking.interfaces.enp5s0.wakeOnLan.enable = true;
} }
]; ];
} }

View File

@ -4,4 +4,3 @@ ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIB+AbmjGEwITk5CK9y7+Rg27Fokgj9QEjgc9wST6MA3s
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHVknmPi7sG6ES0G0jcsvebzKGWWaMfJTYgvOue6EULI flame ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHVknmPi7sG6ES0G0jcsvebzKGWWaMfJTYgvOue6EULI flame
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJ9mwXlZnIALt9SnH3FOZvdgHLM5ZqwYUERXBbM7Rwh6 swan ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJ9mwXlZnIALt9SnH3FOZvdgHLM5ZqwYUERXBbM7Rwh6 swan
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIC3yHivgEXr2ecwe58h9bkhwTYivf3GwL8xenQKMeiUb tempest ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIC3yHivgEXr2ecwe58h9bkhwTYivf3GwL8xenQKMeiUb tempest
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICmGHIWBZzRx35/yFgnPJSHN2+35WJ30G9c5tDhPsCrl arrow

View File

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

View File

@ -1,10 +1,4 @@
{ { config, pkgs, lib, ... }: {
config,
pkgs,
lib,
...
}:
{
options = { options = {
_1password = { _1password = {
@ -15,28 +9,12 @@
}; };
}; };
config = lib.mkIf (config.gui.enable && config._1password.enable) { config = lib.mkIf
unfreePackages = [ (config.gui.enable && config._1password.enable && pkgs.stdenv.isLinux) {
"1password" unfreePackages = [ "1password" "_1password-gui" ];
"_1password-gui" home-manager.users.${config.user} = {
"1password-cli" home.packages = with pkgs; [ _1password-gui ];
]; };
home-manager.users.${config.user} = {
home.packages = with pkgs; [
_1password-gui
_1password
];
}; };
# 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
'';
};
} }

View File

@ -1,10 +1,4 @@
{ { config, pkgs, lib, ... }: {
config,
pkgs,
lib,
...
}:
{
options = { options = {
alacritty = { alacritty = {
@ -34,9 +28,7 @@
opacity = 1.0; opacity = 1.0;
}; };
scrolling.history = 10000; scrolling.history = 10000;
font = { font = { size = 14.0; };
size = 14.0;
};
key_bindings = [ key_bindings = [
# Used for word completion in fish_user_key_bindings # Used for word completion in fish_user_key_bindings
{ {

View File

@ -1,5 +1,4 @@
{ ... }: { ... }: {
{
imports = [ imports = [
./1password.nix ./1password.nix
@ -13,4 +12,5 @@
./slack.nix ./slack.nix
./yt-dlp.nix ./yt-dlp.nix
]; ];
} }

View File

@ -1,10 +1,4 @@
{ { config, pkgs, lib, ... }: {
config,
pkgs,
lib,
...
}:
{
options = { options = {
discord = { discord = {
@ -17,8 +11,8 @@
config = lib.mkIf (config.gui.enable && config.discord.enable) { config = lib.mkIf (config.gui.enable && config.discord.enable) {
unfreePackages = [ "discord" ]; unfreePackages = [ "discord" ];
environment.systemPackages = [ pkgs.discord ];
home-manager.users.${config.user} = { home-manager.users.${config.user} = {
home.packages = with pkgs; [ discord ];
xdg.configFile."discord/settings.json".text = '' xdg.configFile."discord/settings.json".text = ''
{ {
"BACKGROUND_COLOR": "#202225", "BACKGROUND_COLOR": "#202225",

View File

@ -1,9 +1,4 @@
{ { config, pkgs, lib, ... }:
config,
pkgs,
lib,
...
}:
{ {
@ -27,50 +22,57 @@
programs.firefox = { programs.firefox = {
enable = true; 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 = { profiles.default = {
id = 0; id = 0;
name = "default"; name = "default";
isDefault = true; isDefault = true;
# https://nur.nix-community.org/repos/rycee/
extensions = with pkgs.nur.repos.rycee.firefox-addons; [ extensions = with pkgs.nur.repos.rycee.firefox-addons; [
(lib.mkIf config._1password.enable onepassword-password-manager) ublock-origin
pkgs.bypass-paywalls-clean vimium
darkreader
don-t-fuck-with-paste
facebook-container
markdownload
multi-account-containers multi-account-containers
facebook-container
(lib.mkIf config._1password.enable onepassword-password-manager)
okta-browser-plugin okta-browser-plugin
sponsorblock
reddit-enhancement-suite reddit-enhancement-suite
return-youtube-dislikes return-youtube-dislikes
sponsorblock markdownload
ublock-origin darkreader
ublacklist snowflake
vimium don-t-fuck-with-paste
i-dont-care-about-cookies
wappalyzer
]; ];
settings = { settings = {
"app.update.auto" = false; "app.update.auto" = false;
"browser.aboutConfig.showWarning" = false; "browser.aboutConfig.showWarning" = false;
"browser.warnOnQuit" = 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.theme.dark-private-windows" = true;
"browser.toolbars.bookmarks.visibility" = false; "browser.toolbars.bookmarks.visibility" = false;
"browser.startup.page" = 3; # Restore previous session "browser.startup.page" = 3; # Restore previous session
"browser.newtabpage.enabled" = false; # Make new tabs blank "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 "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 "dom.payments.defaults.saveAddress" = false; # Disable address save
"general.autoScroll" = true; # Drag middle-mouse to scroll "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; "extensions.pocket.enabled" = false;
"toolkit.legacyUserProfileCustomizations.stylesheets" = true; # Allow userChrome.css "toolkit.legacyUserProfileCustomizations.stylesheets" =
true; # Allow userChrome.css
"layout.css.color-mix.enabled" = true; "layout.css.color-mix.enabled" = true;
"ui.systemUsesDarkTheme" = if config.theme.dark == true then 1 else 0; "ui.systemUsesDarkTheme" =
"media.ffmpeg.vaapi.enabled" = true; # Enable hardware video acceleration 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 "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 "svg.context-properties.content.enabled" = true; # Sidebery styling
}; };
userChrome = '' userChrome = ''
@ -112,7 +114,7 @@
background-color: ${config.theme.colors.base00}; background-color: ${config.theme.colors.base00};
color: ${config.theme.colors.base06} !important; 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); border-bottom: 2px solid color-mix(in srgb, var(--identity-tab-color) 25%, transparent);
background-color: ${config.theme.colors.base01} !important; background-color: ${config.theme.colors.base01} !important;
color: ${config.theme.colors.base07} !important; color: ${config.theme.colors.base07} !important;
@ -156,34 +158,28 @@
extraConfig = ""; extraConfig = "";
}; };
}; };
xdg.mimeApps = { xsession.windowManager.i3.config.keybindings =
associations.added = { lib.mkIf pkgs.stdenv.isLinux {
"text.html" = [ "firefox.desktop" ]; "${
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"
'')
}";
}; };
defaultApplications = {
"text.html" = [ "firefox.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"
''
)
}";
};
}; };
}; };
} }

View File

@ -1,10 +1,4 @@
{ { config, pkgs, lib, ... }: {
config,
pkgs,
lib,
...
}:
{
options = { options = {
kitty = { kitty = {
@ -17,22 +11,10 @@
config = lib.mkIf (config.gui.enable && config.kitty.enable) { config = lib.mkIf (config.gui.enable && config.kitty.enable) {
# Set the Rofi-Systemd terminal for viewing logs terminal = "${pkgs.kitty}/bin/kitty";
# Using optionalAttrs because only available in NixOS
environment =
{ }
// lib.attrsets.optionalAttrs (builtins.hasAttr "sessionVariables" config.environment) {
sessionVariables.ROFI_SYSTEMD_TERM = "${pkgs.kitty}/bin/kitty";
};
home-manager.users.${config.user} = { 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 "${pkgs.kitty}/bin/kitty";
# Display images in the terminal # Display images in the terminal
programs.fish.shellAliases = { programs.fish.shellAliases = {
icat = "kitty +kitten icat"; icat = "kitty +kitten icat";
@ -50,18 +32,9 @@
# Easy fullscreen toggle (for macOS) # Easy fullscreen toggle (for macOS)
"super+f" = "toggle_fullscreen"; "super+f" = "toggle_fullscreen";
# Kitty scrollback nvim
"kitty_mod+h" = "kitty_scrollback_nvim";
"kitty_mod+g" = "kitty_scrollback_nvim --config ksb_builtin_last_cmd_output";
}; };
settings = { settings = {
# Required for kitty-scrollback.nvim
allow_remote_control = "socket-only";
listen_on = "unix:/tmp/kitty";
action_alias = "kitty_scrollback_nvim kitten ${pkgs.vimPlugins.kitty-scrollback-nvim}/python/kitty_scrollback_nvim.py";
# Colors (adapted from: https://github.com/kdrag0n/base16-kitty/blob/master/templates/default-256.mustache) # Colors (adapted from: https://github.com/kdrag0n/base16-kitty/blob/master/templates/default-256.mustache)
background = config.theme.colors.base00; background = config.theme.colors.base00;
foreground = config.theme.colors.base05; foreground = config.theme.colors.base05;
@ -106,8 +79,8 @@
color21 = config.theme.colors.base06; color21 = config.theme.colors.base06;
# Scrollback # Scrollback
scrollback_lines = 10000; scrolling_lines = 10000;
scrollback_pager_history_size = 300; # MB scrollback_pager_history_size = 10; # MB
# Window # Window
window_padding_width = 6; window_padding_width = 6;

View File

@ -1,10 +1,4 @@
{ { config, pkgs, lib, ... }: {
config,
pkgs,
lib,
...
}:
{
options = { options = {
media = { media = {
@ -46,22 +40,20 @@
associations.added = { associations.added = {
"application/pdf" = [ "pwmt.zathura-cb.desktop" ]; "application/pdf" = [ "pwmt.zathura-cb.desktop" ];
"image/jpeg" = [ "nsxiv.desktop" ]; "image/jpeg" = [ "nsxiv.desktop" ];
"image/png" = [ "nsxiv.desktop" ];
"image/*" = [ "nsxiv.desktop" ]; "image/*" = [ "nsxiv.desktop" ];
}; };
associations.removed = { associations.removed = {
"application/pdf" = [ "application/pdf" = [ "mupdf.desktop" "wine-extension-pdf.desktop" ];
"mupdf.desktop"
"wine-extension-pdf.desktop"
];
}; };
defaultApplications = { defaultApplications = {
"application/pdf" = [ "pwmt.zathura-cb.desktop" ]; "application/pdf" = [ "pwmt.zathura-cb.desktop" ];
"image/jpeg" = [ "nsxiv.desktop" ]; "image/jpeg" = [ "nsxiv.desktop" ];
"image/png" = [ "nsxiv.desktop" ];
"image/*" = [ "nsxiv.desktop" ]; "image/*" = [ "nsxiv.desktop" ];
}; };
}; };
}; };
}; };
} }

View File

@ -1,10 +1,4 @@
{ { config, pkgs, lib, ... }: {
config,
pkgs,
lib,
...
}:
{
options = { options = {
obsidian = { obsidian = {
@ -21,8 +15,9 @@
home.packages = with pkgs; [ obsidian ]; home.packages = with pkgs; [ obsidian ];
}; };
# Broken on 2023-12-11 # Broken on 2023-04-16
# https://forum.obsidian.md/t/electron-25-is-now-eol-please-upgrade-to-a-newer-version/72878/8 nixpkgs.config.permittedInsecurePackages = [ "electron-21.4.0" ];
nixpkgs.config.permittedInsecurePackages = [ "electron-25.9.0" ];
}; };
} }

View File

@ -1,10 +1,4 @@
{ { config, pkgs, lib, ... }: {
config,
pkgs,
lib,
...
}:
{
options = { options = {
qbittorrent = { qbittorrent = {
@ -20,6 +14,8 @@
home-manager.users.${config.user} = { home-manager.users.${config.user} = {
home.packages = with pkgs; [ qbittorrent ]; home.packages = with pkgs; [ qbittorrent ];
}; };
}; };
} }

View File

@ -1,10 +1,4 @@
{ { config, pkgs, lib, ... }: {
config,
pkgs,
lib,
...
}:
{
options = { options = {
slack = { slack = {
@ -21,4 +15,5 @@
home.packages = with pkgs; [ slack ]; home.packages = with pkgs; [ slack ];
}; };
}; };
} }

View File

@ -1,10 +1,4 @@
{ { config, pkgs, lib, ... }: {
config,
pkgs,
lib,
...
}:
{
options = { options = {
yt-dlp = { yt-dlp = {
@ -33,6 +27,9 @@
}; };
programs.fish.shellAbbrs.yt = "yt-dlp"; programs.fish.shellAbbrs.yt = "yt-dlp";
}; };
}; };
} }

View File

@ -1,19 +1,7 @@
{ { config, lib, pkgs, ... }: {
config,
lib,
pkgs,
...
}:
{
imports = [ imports =
./applications [ ./applications ./mail ./neovim ./programming ./repositories ./shell ];
./mail
./neovim
./programming
./repositories
./shell
];
options = { options = {
user = lib.mkOption { user = lib.mkOption {
@ -29,7 +17,8 @@
download = lib.mkOption { download = lib.mkOption {
type = lib.types.str; type = lib.types.str;
description = "XDG directory for downloads"; 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 { identityFile = lib.mkOption {
@ -58,9 +47,10 @@
homePath = lib.mkOption { homePath = lib.mkOption {
type = lib.types.path; type = lib.types.path;
description = "Path of user's home directory."; description = "Path of user's home directory.";
default = builtins.toPath ( default = builtins.toPath (if pkgs.stdenv.isDarwin then
if pkgs.stdenv.isDarwin then "/Users/${config.user}" else "/home/${config.user}" "/Users/${config.user}"
); else
"/home/${config.user}");
}; };
dotfilesPath = lib.mkOption { dotfilesPath = lib.mkOption {
type = lib.types.path; type = lib.types.path;
@ -85,22 +75,10 @@
type = lib.types.str; type = lib.types.str;
description = "Hostname for metrics server."; 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 { prometheus = lib.mkOption {
type = lib.types.str; type = lib.types.str;
description = "Hostname for Prometheus server."; description = "Hostname for Prometheus server.";
}; };
influxdb = lib.mkOption {
type = lib.types.str;
description = "Hostname for InfluxDB2 server.";
};
secrets = lib.mkOption { secrets = lib.mkOption {
type = lib.types.str; type = lib.types.str;
description = "Hostname for passwords and secrets (Vaultwarden)."; description = "Hostname for passwords and secrets (Vaultwarden).";
@ -121,44 +99,63 @@
type = lib.types.str; type = lib.types.str;
description = "Hostname for download services."; description = "Hostname for download services.";
}; };
irc = lib.mkOption {
type = lib.types.str;
description = "Hostname for IRC services.";
};
transmission = lib.mkOption {
type = lib.types.str;
description = "Hostname for peer2peer downloads (Transmission).";
};
}; };
}; };
config = config = let stateVersion = "23.05";
let in {
stateVersion = "23.05";
in
{
# Basic common system packages for all devices nix = {
environment.systemPackages = with pkgs; [
git
vim
wget
curl
];
# Use the system-level nixpkgs instead of Home Manager's # Enable features in Nix commands
home-manager.useGlobalPkgs = true; extraOptions = ''
experimental-features = nix-command flakes
warn-dirty = false
'';
# Install packages to /etc/profiles instead of ~/.nix-profile, useful when gc = {
# using multiple profiles for one user automatic = true;
home-manager.useUserPackages = true; options = "--delete-older-than 7d";
};
# Allow specified unfree packages (identified elsewhere) settings = {
# Retrieves package object based on string name
nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) config.unfreePackages; # Add community Cachix to binary cache
# Don't use with macOS because blocked by corporate firewall
builders-use-substitutes = true;
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
# Not working with macOS: https://github.com/NixOS/nix/issues/7273
auto-optimise-store = lib.mkIf (!pkgs.stdenv.isDarwin) true;
};
# Pin a state version to prevent warnings
home-manager.users.${config.user}.home.stateVersion = stateVersion;
home-manager.users.root.home.stateVersion = stateVersion;
}; };
# Basic common system packages for all devices
environment.systemPackages = with pkgs; [ git vim wget curl ];
# Use the system-level nixpkgs instead of Home Manager's
home-manager.useGlobalPkgs = true;
# Install packages to /etc/profiles instead of ~/.nix-profile, useful when
# using multiple profiles for one user
home-manager.useUserPackages = true;
# Allow specified unfree packages (identified elsewhere)
# Retrieves package object based on string name
nixpkgs.config.allowUnfreePredicate = pkg:
builtins.elem (lib.getName pkg) config.unfreePackages;
# Pin a state version to prevent warnings
home-manager.users.${config.user}.home.stateVersion = stateVersion;
home-manager.users.root.home.stateVersion = stateVersion;
};
} }

View File

@ -1,10 +1,4 @@
{ { config, pkgs, lib, ... }: {
config,
pkgs,
lib,
...
}:
{
options.mail.aerc.enable = lib.mkEnableOption "Aerc email."; options.mail.aerc.enable = lib.mkEnableOption "Aerc email.";
@ -74,16 +68,14 @@
"!" = ":term<space>"; "!" = ":term<space>";
"|" = ":pipe<space>"; "|" = ":pipe<space>";
"/" = ":search<space>-a<space>"; "/" = ":search<space>";
"\\" = ":filter <space>"; "\\" = ":filter <space>";
n = ":next-result<Enter>"; n = ":next-result<Enter>";
N = ":prev-result<Enter>"; N = ":prev-result<Enter>";
"<Esc>" = ":clear<Enter>"; "<Esc>" = ":clear<Enter>";
}; };
"messages:folder=Drafts" = { "messages:folder=Drafts" = { "<Enter>" = ":recall<Enter>"; };
"<Enter>" = ":recall<Enter>";
};
view = { view = {
"/" = ":toggle-key-passthrough <Enter> /"; "/" = ":toggle-key-passthrough <Enter> /";
@ -156,19 +148,21 @@
"<C-p>" = ":prev-tab<Enter>"; "<C-p>" = ":prev-tab<Enter>";
"<C-n>" = ":next-tab<Enter>"; "<C-n>" = ":next-tab<Enter>";
}; };
}; };
extraConfig = { extraConfig = {
general.unsafe-accounts-conf = true; general.unsafe-accounts-conf = true;
viewer = { viewer = { pager = "${pkgs.less}/bin/less -R"; };
pager = "${pkgs.less}/bin/less -R";
};
filters = { filters = {
"text/plain" = "${pkgs.aerc}/libexec/aerc/filters/colorize"; "text/plain" = "${pkgs.aerc}/libexec/aerc/filters/colorize";
"text/calendar" = "${pkgs.gawk}/bin/awk -f ${pkgs.aerc}/libexec/aerc/filters/calendar"; "text/calendar" =
"text/html" = "${pkgs.aerc}/libexec/aerc/filters/html | ${pkgs.aerc}/libexec/aerc/filters/colorize"; # Requires w3m, dante "${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/*" = # "text/*" =
# ''${pkgs.bat}/bin/bat -fP --file-name="$AERC_FILENAME "''; # ''${pkgs.bat}/bin/bat -fP --file-name="$AERC_FILENAME "'';
"message/delivery-status" = "${pkgs.aerc}/libexec/aerc/filters/colorize"; "message/delivery-status" =
"${pkgs.aerc}/libexec/aerc/filters/colorize";
"message/rfc822" = "${pkgs.aerc}/libexec/aerc/filters/colorize"; "message/rfc822" = "${pkgs.aerc}/libexec/aerc/filters/colorize";
"application/x-sh" = "${pkgs.bat}/bin/bat -fP -l sh"; "application/x-sh" = "${pkgs.bat}/bin/bat -fP -l sh";
"application/pdf" = "${pkgs.zathura}/bin/zathura -"; "application/pdf" = "${pkgs.zathura}/bin/zathura -";
@ -182,7 +176,6 @@
extraAccounts = { extraAccounts = {
check-mail = "5m"; check-mail = "5m";
check-mail-cmd = "${pkgs.isync}/bin/mbsync -a"; check-mail-cmd = "${pkgs.isync}/bin/mbsync -a";
check-mail-timeout = "15s";
}; };
}; };
@ -190,27 +183,26 @@
name = "aerc"; name = "aerc";
exec = "kitty aerc %u"; exec = "kitty aerc %u";
}; };
xsession.windowManager.i3.config.keybindings = lib.mkIf pkgs.stdenv.isLinux { xsession.windowManager.i3.config.keybindings =
"${ lib.mkIf pkgs.stdenv.isLinux {
config.home-manager.users.${config.user}.xsession.windowManager.i3.config.modifier "${
}+Shift+e" = "exec ${ config.home-manager.users.${config.user}.xsession.windowManager.i3.config.modifier
# Don't name the script `aerc` or it will affect grep }+Shift+e" = "exec ${
builtins.toString ( # Don't name the script `aerc` or it will affect grep
pkgs.writeShellScript "focus-mail.sh" '' builtins.toString (pkgs.writeShellScript "focus-mail.sh" ''
count=$(ps aux | grep -c aerc) count=$(ps aux | grep -c aerc)
if [ "$count" -eq 1 ]; then if [ "$count" -eq 1 ]; then
i3-msg "exec --no-startup-id kitty --class aerc aerc" i3-msg "exec --no-startup-id kitty --class aerc aerc"
sleep 0.25 sleep 0.25
fi fi
i3-msg "[class=aerc] focus" i3-msg "[class=aerc] focus"
'' '')
) }";
}"; };
};
programs.fish.shellAbbrs = { ae = "aerc"; };
programs.fish.shellAbbrs = {
ae = "aerc";
};
}; };
}; };
} }

View File

@ -1,16 +1,6 @@
{ { config, pkgs, lib, ... }: {
config,
pkgs,
lib,
...
}:
{
imports = [ imports = [ ./himalaya.nix ./aerc.nix ./system.nix ];
./himalaya.nix
./aerc.nix
./system.nix
];
options = { options = {
mail.enable = lib.mkEnableOption "Mail service."; mail.enable = lib.mkEnableOption "Mail service.";
@ -36,9 +26,7 @@
config = lib.mkIf config.mail.enable { config = lib.mkIf config.mail.enable {
home-manager.users.${config.user} = { home-manager.users.${config.user} = {
programs.mbsync = { programs.mbsync = { enable = true; };
enable = true;
};
# Automatically check for mail and keep files synced locally # Automatically check for mail and keep files synced locally
services.mbsync = lib.mkIf pkgs.stdenv.isLinux { services.mbsync = lib.mkIf pkgs.stdenv.isLinux {
@ -56,11 +44,8 @@
# Better local mail search # Better local mail search
programs.notmuch = { programs.notmuch = {
enable = true; enable = true;
new.ignore = [ new.ignore =
".mbsyncstate.lock" [ ".mbsyncstate.lock" ".mbsyncstate.journal" ".mbsyncstate.new" ];
".mbsyncstate.journal"
".mbsyncstate.new"
];
}; };
accounts.email = { accounts.email = {
@ -69,71 +54,72 @@
maildirBasePath = "${config.homePath}/mail"; maildirBasePath = "${config.homePath}/mail";
accounts = { accounts = {
home = home = let address = "${config.mail.user}@${config.mail.server}";
let in {
address = "${config.mail.user}@${config.mail.server}"; userName = address;
in realName = config.fullName;
{ primary = true;
userName = address; inherit address;
realName = config.fullName; aliases = map (user: "${user}@${config.mail.server}") [
primary = true; "me"
inherit address; "hey"
aliases = map (user: "${user}@${config.mail.server}") [ "admin"
"me" ];
"hey"
"admin"
];
# Options for contact completion # Options for contact completion
alot = { }; alot = { };
imap = { imap = {
host = config.mail.imapHost; host = config.mail.imapHost;
port = 993; port = 993;
tls.enable = true; tls.enable = true;
}; };
# Watch for mail and run notifications or sync # Watch for mail and run notifications or sync
imapnotify = { imapnotify = {
enable = true; enable = true;
boxes = [ "Inbox" ]; boxes = [ "Inbox" ];
onNotify = "${pkgs.isync}/bin/mbsync -a"; onNotify = "${pkgs.isync}/bin/mbsync -a";
onNotifyPost = onNotifyPost = lib.mkIf
lib.mkIf config.home-manager.users.${config.user}.services.dunst.enable config.home-manager.users.${config.user}.services.dunst.enable
"${pkgs.libnotify}/bin/notify-send 'New mail arrived'"; "${pkgs.libnotify}/bin/notify-send 'New mail arrived'";
}; };
# Name of the directory in maildir for this account # Name of the directory in maildir for this account
maildir = { maildir = { path = "main"; };
path = "main";
};
# Bi-directional syncing options for local files # Bi-directional syncing options for local files
mbsync = { mbsync = {
enable = true; enable = true;
create = "both"; create = "both";
expunge = "both"; expunge = "both";
remove = "both"; remove = "both";
patterns = [ "*" ]; patterns = [ "*" ];
extraConfig.channel = { extraConfig.channel = {
CopyArrivalDate = "yes"; # Sync time of original message 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)}";
smtp = {
host = config.mail.smtpHost;
port = 465;
tls.enable = true;
}; };
}; };
# 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)
}";
smtp = {
host = config.mail.smtpHost;
port = 465;
tls.enable = true;
};
};
}; };
}; };
}; };
}; };
} }

View File

@ -1,5 +1,4 @@
{ config, lib, ... }: { config, lib, ... }: {
{
options.mail.himalaya.enable = lib.mkEnableOption "Himalaya email."; options.mail.himalaya.enable = lib.mkEnableOption "Himalaya email.";
@ -7,20 +6,20 @@
home-manager.users.${config.user} = { home-manager.users.${config.user} = {
programs.himalaya = { programs.himalaya = { enable = true; };
enable = true;
};
accounts.email.accounts.home.himalaya = { accounts.email.accounts.home.himalaya = {
enable = true; enable = true;
backend = "imap";
sender = "smtp";
settings = { settings = {
downloads-dir = config.userDirs.download; downloads-dir = config.userDirs.download;
smtp-insecure = true; smtp-insecure = true;
}; };
}; };
programs.fish.shellAbbrs = { programs.fish.shellAbbrs = { hi = "himalaya"; };
hi = "himalaya";
};
}; };
}; };
} }

View File

@ -1,10 +1,4 @@
{ { config, pkgs, lib, ... }: {
config,
pkgs,
lib,
...
}:
{
config = lib.mkIf (config.mail.enable || config.server) { config = lib.mkIf (config.mail.enable || config.server) {
@ -14,15 +8,17 @@
# The system user for sending automatic notifications # The system user for sending automatic notifications
accounts.email.accounts.system = accounts.email.accounts.system =
let let address = "system@${config.mail.server}";
address = "system@${config.mail.server}"; in {
in
{
userName = address; userName = address;
realName = "NixOS System"; realName = "NixOS System";
primary = !config.mail.enable; # Only primary if mail not enabled primary = !config.mail.enable; # Only primary if mail not enabled
inherit address; inherit address;
passwordCommand = "${pkgs.age}/bin/age --decrypt --identity ${config.identityFile} ${pkgs.writeText "mailpass-system.age" (builtins.readFile ../../../private/mailpass-system.age)}"; passwordCommand =
"${pkgs.age}/bin/age --decrypt --identity ${config.identityFile} ${
pkgs.writeText "mailpass-system.age"
(builtins.readFile ../../../private/mailpass-system.age)
}";
msmtp.enable = true; msmtp.enable = true;
smtp = { smtp = {
host = config.mail.smtpHost; host = config.mail.smtpHost;
@ -30,6 +26,9 @@
tls.enable = true; tls.enable = true;
}; };
}; };
}; };
}; };
} }

View File

@ -1,5 +1,4 @@
{ pkgs, ... }: { pkgs, ... }: {
{
# Plugin for aligning text programmatically # Plugin for aligning text programmatically

View File

@ -1,5 +1,4 @@
{ pkgs, ... }: { pkgs, ... }: {
{
# Shows buffers in a VSCode-style tab layout # Shows buffers in a VSCode-style tab layout
@ -12,7 +11,7 @@
diagnostics = "nvim_lsp"; diagnostics = "nvim_lsp";
always_show_bufferline = false; always_show_bufferline = false;
separator_style = "slant"; separator_style = "slant";
offsets = [ { filetype = "NvimTree"; } ]; offsets = [{ filetype = "NvimTree"; }];
}; };
}; };
lua = '' lua = ''

View File

@ -1,10 +1,4 @@
{ { pkgs, lib, config, ... }: {
pkgs,
lib,
config,
...
}:
{
# Sets Neovim colors based on Nix colorscheme # Sets Neovim colors based on Nix colorscheme
@ -14,7 +8,7 @@
}; };
config = { config = {
plugins = [ pkgs.vimPlugins.base16-nvim ]; plugins = [ pkgs.vimPlugins.nvim-base16 ];
setup.base16-colorscheme = config.colors; setup.base16-colorscheme = config.colors;
# Telescope isn't working, shut off for now # Telescope isn't working, shut off for now
@ -24,4 +18,5 @@
} }
''; '';
}; };
} }

View File

@ -1,5 +1,4 @@
{ pkgs, dsl, ... }: { pkgs, dsl, ... }: {
{
plugins = [ plugins = [
pkgs.vimPlugins.cmp-nvim-lsp pkgs.vimPlugins.cmp-nvim-lsp
@ -10,6 +9,7 @@
pkgs.vimPlugins.luasnip pkgs.vimPlugins.luasnip
pkgs.vimPlugins.cmp_luasnip pkgs.vimPlugins.cmp_luasnip
pkgs.vimPlugins.cmp-rg pkgs.vimPlugins.cmp-rg
pkgs.vimPlugins.friendly-snippets
]; ];
use.cmp.setup = dsl.callWith { use.cmp.setup = dsl.callWith {
@ -24,17 +24,30 @@
end end
''; '';
# Enable Luasnip snippet completion
snippet.expand = dsl.rawLua ''
function(args)
require("luasnip").lsp_expand(args.body)
end
'';
# Basic completion keybinds # Basic completion keybinds
mapping = { mapping = {
"['<C-n>']" = dsl.rawLua "require('cmp').mapping.select_next_item({ behavior = require('cmp').SelectBehavior.Insert })"; "['<C-n>']" = dsl.rawLua
"['<C-p>']" = dsl.rawLua "require('cmp').mapping.select_prev_item({ behavior = require('cmp').SelectBehavior.Insert })"; "require('cmp').mapping.select_next_item({ behavior = require('cmp').SelectBehavior.Insert })";
"['<Down>']" = dsl.rawLua "require('cmp').mapping.select_next_item({ behavior = require('cmp').SelectBehavior.Select })"; "['<C-p>']" = dsl.rawLua
"['<Up>']" = dsl.rawLua "require('cmp').mapping.select_prev_item({ behavior = require('cmp').SelectBehavior.Select })"; "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-d>']" = dsl.rawLua "require('cmp').mapping.scroll_docs(-4)";
"['<C-f>']" = 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-e>']" = dsl.rawLua "require('cmp').mapping.abort()";
"['<CR>']" = dsl.rawLua "require('cmp').mapping.confirm({ behavior = require('cmp').ConfirmBehavior.Replace, select = true, })"; "['<CR>']" = dsl.rawLua
"['<C-r>']" = dsl.rawLua "require('cmp').mapping.confirm({ behavior = require('cmp').ConfirmBehavior.Replace, select = true, })"; "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 '' "['<Esc>']" = dsl.rawLua ''
function(_) function(_)
cmp.mapping({ cmp.mapping({
@ -57,6 +70,7 @@
sources = [ sources = [
{ name = "nvim_lua"; } # Fills in common Neovim lua functions { name = "nvim_lua"; } # Fills in common Neovim lua functions
{ name = "nvim_lsp"; } # LSP results { name = "nvim_lsp"; } # LSP results
{ name = "luasnip"; } # Snippets
{ name = "path"; } # Shell completion from current PATH { name = "path"; } # Shell completion from current PATH
{ {
name = "buffer"; # Grep for text from the current text buffer name = "buffer"; # Grep for text from the current text buffer
@ -67,19 +81,13 @@
name = "rg"; # Grep for text from the current directory name = "rg"; # Grep for text from the current directory
keyword_length = 6; keyword_length = 6;
max_item_count = 10; max_item_count = 10;
option = { option = { additional_arguments = "--ignore-case"; };
additional_arguments = "--ignore-case";
};
} }
]; ];
# Styling of the completion menu # Styling of the completion menu
formatting = { formatting = {
fields = [ fields = [ "kind" "abbr" "menu" ];
"kind"
"abbr"
"menu"
];
format = dsl.rawLua '' format = dsl.rawLua ''
function(entry, vim_item) function(entry, vim_item)
local kind_icons = { local kind_icons = {
@ -111,6 +119,7 @@
} }
vim_item.kind = string.format("%s", kind_icons[vim_item.kind]) vim_item.kind = string.format("%s", kind_icons[vim_item.kind])
vim_item.menu = ({ vim_item.menu = ({
luasnip = "[Snippet]",
buffer = "[Buffer]", buffer = "[Buffer]",
path = "[Path]", path = "[Path]",
rg = "[Grep]", rg = "[Grep]",
@ -126,9 +135,17 @@
native_menu = false; # Use cmp menu instead of Vim menu native_menu = false; # Use cmp menu instead of Vim menu
ghost_text = true; # Show preview auto-completion ghost_text = true; # Show preview auto-completion
}; };
}; };
lua = '' lua = ''
-- Load snippets
-- Check status: :lua require("luasnip").log.open()
require("luasnip.loaders.from_vscode").lazy_load()
require("luasnip.loaders.from_vscode").lazy_load({ paths = { "${
builtins.toString pkgs.vscode-terraform-snippets
}" } })
-- Use buffer source for `/` -- Use buffer source for `/`
require('cmp').setup.cmdline("/", { require('cmp').setup.cmdline("/", {
sources = { sources = {
@ -145,4 +162,5 @@
}), }),
}) })
''; '';
} }

View File

@ -1,14 +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'" })
-- Set a toggle for this terminal
function GITWATCH_TOGGLE()
gitwatch:toggle()
end
-- Keymap to toggle the run
vim.keymap.set("n", "<Leader>gw", GITWATCH_TOGGLE)

View File

@ -1,5 +1,4 @@
{ pkgs, ... }: { pkgs, ... }: {
{
plugins = [ pkgs.vimPlugins.gitsigns-nvim ]; plugins = [ pkgs.vimPlugins.gitsigns-nvim ];
setup.gitsigns = { }; setup.gitsigns = { };
lua = builtins.readFile ./gitsigns.lua; lua = builtins.readFile ./gitsigns.lua;

View File

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

View File

@ -1,136 +1,76 @@
{ { pkgs, dsl, ... }: {
pkgs,
lib,
config,
dsl,
...
}:
{
# Terraform optional because non-free plugins = [
options.terraform = lib.mkEnableOption "Whether to enable Terraform LSP"; pkgs.vimPlugins.nvim-lspconfig
options.github = lib.mkEnableOption "Whether to enable GitHub features"; pkgs.vimPlugins.lsp-colors-nvim
options.kubernetes = lib.mkEnableOption "Whether to enable Kubernetes features"; pkgs.vimPlugins.null-ls-nvim
];
config = { use.lspconfig.lua_ls.setup = dsl.callWith {
plugins = [ settings = { Lua = { diagnostics = { globals = [ "vim" "hs" ]; }; }; };
pkgs.vimPlugins.nvim-lspconfig capabilities = dsl.rawLua "require('cmp_nvim_lsp').default_capabilities()";
pkgs.vimPlugins.conform-nvim cmd = [ "${pkgs.lua-language-server}/bin/lua-language-server" ];
pkgs.vimPlugins.fidget-nvim
pkgs.vimPlugins.nvim-lint
];
setup.fidget = { };
use.lspconfig.lua_ls.setup = dsl.callWith {
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" ];
capabilities = dsl.rawLua "require('cmp_nvim_lsp').default_capabilities()";
};
use.lspconfig.pyright.setup = dsl.callWith {
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.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 = if config.terraform then [ "terraform_fmt" ] else [ ];
};
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 "";
};
};
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 }")
];
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"
-- Prevent infinite log size (change this when debugging)
vim.lsp.set_log_level("off")
'';
}; };
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" ];
};
use.lspconfig.terraformls.setup =
dsl.callWith { cmd = [ "${pkgs.terraform-ls}/bin/terraform-ls" "serve" ]; };
vim.api.nvim_create_augroup = dsl.callWith [ "LspFormatting" { } ];
lua = ''
${builtins.readFile ./lsp.lua}
-- Prevent infinite log size (change this when debugging)
vim.lsp.set_log_level("off")
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.ruff.with({ command = "${pkgs.ruff}/bin/ruff" }),
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" },
}),
},
on_attach = function(client, bufnr)
if client.supports_method("textDocument/formatting") then
-- Auto-format on save
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,
})
-- Use internal formatting for bindings like gq.
vim.api.nvim_create_autocmd("LspAttach", {
callback = function(args)
vim.bo[args.buf].formatexpr = nil
end,
})
end
end,
})
'';
} }

View File

@ -1,10 +1,4 @@
{ { pkgs, dsl, lib, ... }: {
pkgs,
dsl,
lib,
...
}:
{
plugins = [ plugins = [
pkgs.vimPlugins.vim-surround # Keybinds for surround characters pkgs.vimPlugins.vim-surround # Keybinds for surround characters
pkgs.vimPlugins.vim-eunuch # File manipulation commands pkgs.vimPlugins.vim-eunuch # File manipulation commands
@ -14,19 +8,13 @@
pkgs.vimPlugins.glow-nvim # Markdown preview popup pkgs.vimPlugins.glow-nvim # Markdown preview popup
pkgs.vimPlugins.nvim-colorizer-lua # Hex color previews pkgs.vimPlugins.nvim-colorizer-lua # Hex color previews
pkgs.vimPlugins.which-key-nvim # Keybind helper pkgs.vimPlugins.which-key-nvim # Keybind helper
pkgs.vimPlugins.kitty-scrollback-nvim # Scrollback pager for kitty
]; ];
# Initialize some plugins # Initialize some plugins
setup.Comment = { }; setup.Comment = { };
setup.colorizer = { setup.colorizer = { };
user_default_options = {
names = false;
};
};
setup.glow = { }; setup.glow = { };
setup.which-key = { }; setup.which-key = { };
setup.kitty-scrollback = { };
vim.o = { vim.o = {
termguicolors = true; # Set to truecolor termguicolors = true; # Set to truecolor
@ -64,15 +52,12 @@
vim.o.backup = true; # Easier to recover and more secure vim.o.backup = true; # Easier to recover and more secure
vim.bo.swapfile = false; # Instead of swaps, create backups vim.bo.swapfile = false; # Instead of swaps, create backups
vim.bo.undofile = true; # Keeps undos after quit vim.bo.undofile = true; # Keeps undos after quit
vim.o.backupdir = dsl.rawLua ''vim.fn.expand("~/.local/state/nvim/backup//")''; 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.o.undodir = dsl.rawLua ''vim.fn.expand("~/.local/state/nvim/undo//")'';
# Required for nvim-cmp completion # Required for nvim-cmp completion
vim.opt.completeopt = [ vim.opt.completeopt = [ "menu" "menuone" "noselect" ];
"menu"
"menuone"
"noselect"
];
lua = lib.mkBefore '' lua = lib.mkBefore ''
vim.loader.enable() vim.loader.enable()
@ -84,6 +69,10 @@
" Remember last position when reopening file " Remember last position when reopening file
au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") | exe "normal! g`\"" | endif 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 " Flash highlight when yanking
au TextYankPost * silent! lua vim.highlight.on_yank { timeout = 250 } au TextYankPost * silent! lua vim.highlight.on_yank { timeout = 250 }
''; '';

View File

@ -1,5 +1,4 @@
{ pkgs, ... }: { pkgs, ... }: {
{
plugins = [ pkgs.vimPlugins.lualine-nvim ]; plugins = [ pkgs.vimPlugins.lualine-nvim ];
setup.lualine = { setup.lualine = {
options = { options = {

View File

@ -1,11 +1,9 @@
{ pkgs, lib, ... }: { pkgs, lib, ... }: {
{
plugins = [ plugins = [
(pkgs.vimPlugins.nvim-treesitter.withPlugins ( (pkgs.vimPlugins.nvim-treesitter.withPlugins (_plugins:
_plugins: with pkgs.tree-sitter-grammars; [ with pkgs.tree-sitter-grammars; [
tree-sitter-bash tree-sitter-bash
tree-sitter-c
tree-sitter-fish tree-sitter-fish
tree-sitter-hcl tree-sitter-hcl
tree-sitter-ini tree-sitter-ini
@ -18,17 +16,15 @@
tree-sitter-python tree-sitter-python
tree-sitter-rasi tree-sitter-rasi
tree-sitter-toml tree-sitter-toml
tree-sitter-vimdoc
tree-sitter-yaml tree-sitter-yaml
] ]))
))
pkgs.vimPlugins.vim-matchup # Better % jumping in languages pkgs.vimPlugins.vim-matchup # Better % jumping in languages
pkgs.vimPlugins.playground # Tree-sitter experimenting pkgs.vimPlugins.playground # Tree-sitter experimenting
pkgs.vimPlugins.nginx-vim pkgs.vimPlugins.nginx-vim
pkgs.vimPlugins.vim-helm pkgs.vimPlugins.vim-helm
pkgs.vimPlugins.baleia-nvim # Clean ANSI from kitty scrollback pkgs.baleia-nvim # Clean ANSI from kitty scrollback
# pkgs.vimPlugins.hmts-nvim # Tree-sitter injections for home-manager # pkgs.hmts-nvim # Tree-sitter injections for home-manager
(pkgs.vimUtils.buildVimPlugin { (pkgs.vimUtils.buildVimPluginFrom2Nix {
pname = "nmasur"; pname = "nmasur";
version = "0.1"; version = "0.1";
src = ../plugin; src = ../plugin;
@ -36,15 +32,9 @@
]; ];
setup."nvim-treesitter.configs" = { setup."nvim-treesitter.configs" = {
highlight = { highlight = { enable = true; };
enable = true; indent = { enable = true; };
}; matchup = { enable = true; }; # Uses vim-matchup
indent = {
enable = true;
};
matchup = {
enable = true;
}; # Uses vim-matchup
textobjects = { textobjects = {
select = { select = {
@ -78,4 +68,5 @@
-- Use HCL parser with .tf files -- Use HCL parser with .tf files
vim.treesitter.language.register('hcl', 'terraform') vim.treesitter.language.register('hcl', 'terraform')
''; '';
} }

View File

@ -1,5 +1,4 @@
{ pkgs, dsl, ... }: { pkgs, dsl, ... }: {
{
# Telescope is a fuzzy finder that can work with different sub-plugins # Telescope is a fuzzy finder that can work with different sub-plugins
@ -21,15 +20,9 @@
}; };
}; };
pickers = { pickers = {
find_files = { find_files = { theme = "ivy"; };
theme = "ivy"; oldfiles = { theme = "ivy"; };
}; buffers = { theme = "dropdown"; };
oldfiles = {
theme = "ivy";
};
buffers = {
theme = "dropdown";
};
}; };
extensions = { extensions = {
fzy_native = { }; fzy_native = { };
@ -40,4 +33,5 @@
setup.project_nvim = { }; setup.project_nvim = { };
lua = builtins.readFile ./telescope.lua; lua = builtins.readFile ./telescope.lua;
} }

View File

@ -26,5 +26,17 @@ function NIXPKGS_TOGGLE()
nixpkgs:toggle() nixpkgs:toggle()
end 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>t", TERM_TOGGLE)
vim.keymap.set("n", "<Leader>P", NIXPKGS_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)

View File

@ -1,10 +1,4 @@
{ { pkgs, dsl, ... }: {
pkgs,
dsl,
config,
...
}:
{
# Toggleterm provides a floating terminal inside the editor for quick access # Toggleterm provides a floating terminal inside the editor for quick access
@ -16,9 +10,6 @@
direction = "float"; direction = "float";
}; };
lua = '' lua = builtins.readFile ./toggleterm.lua;
${builtins.readFile ./toggleterm.lua}
${if config.github then (builtins.readFile ./github.lua) else ""}
${if config.kubernetes then (builtins.readFile ./kubernetes.lua) else ""}
'';
} }

View File

@ -1,12 +1,8 @@
{ pkgs, dsl, ... }: { pkgs, dsl, ... }: {
{
# This plugin creates a side drawer for navigating the current project # This plugin creates a side drawer for navigating the current project
plugins = [ plugins = [ pkgs.vimPlugins.nvim-tree-lua pkgs.vimPlugins.nvim-web-devicons ];
pkgs.vimPlugins.nvim-tree-lua
pkgs.vimPlugins.nvim-web-devicons
];
# Disable netrw eagerly # Disable netrw eagerly
# https://github.com/kyazdani42/nvim-tree.lua/commit/fb8735e96cecf004fbefb086ce85371d003c5129 # https://github.com/kyazdani42/nvim-tree.lua/commit/fb8735e96cecf004fbefb086ce85371d003c5129
@ -20,14 +16,12 @@
hijack_netrw = true; # Works as the file manager hijack_netrw = true; # Works as the file manager
sync_root_with_cwd = true; # Change project whenever currend dir changes sync_root_with_cwd = true; # Change project whenever currend dir changes
respect_buf_cwd = true; # Change to exact location of focused buffer respect_buf_cwd = true; # Change to exact location of focused buffer
update_focused_file = { update_focused_file = { # Change project based on the focused buffer
# Change project based on the focused buffer
enable = true; enable = true;
update_root = true; update_root = true;
ignore_list = { }; ignore_list = { };
}; };
diagnostics = { diagnostics = { # Enable LSP and linter integration
# Enable LSP and linter integration
enable = true; enable = true;
icons = { icons = {
hint = ""; hint = "";
@ -36,8 +30,7 @@
error = ""; error = "";
}; };
}; };
renderer = { renderer = { # Show files with changes vs. current commit
# Show files with changes vs. current commit
icons = { icons = {
glyphs = { glyphs = {
git = { git = {
@ -68,9 +61,9 @@
vim.keymap.set('n', 'v', api.node.open.vertical, opts('Open: Vertical Split')) vim.keymap.set('n', 'v', api.node.open.vertical, opts('Open: Vertical Split'))
end end
''; '';
view = { view = { # Set look and feel
# Set look and feel
width = 30; width = 30;
hide_root_folder = false;
side = "left"; side = "left";
number = false; number = false;
relativenumber = false; relativenumber = false;
@ -81,4 +74,5 @@
lua = '' lua = ''
vim.keymap.set("n", "<Leader>e", ":NvimTreeFindFileToggle<CR>", { silent = true }) vim.keymap.set("n", "<Leader>e", ":NvimTreeFindFileToggle<CR>", { silent = true })
''; '';
} }

View File

@ -1,21 +1,13 @@
{ { config, pkgs, lib, ... }:
config,
pkgs,
lib,
...
}:
let let
neovim = import ./package { neovim = import ./package {
inherit pkgs; inherit pkgs;
colors = config.theme.colors; colors = config.theme.colors;
terraform = config.terraform.enable;
github = true;
kubernetes = config.kubernetes.enable;
}; };
in
{ in {
options.neovim.enable = lib.mkEnableOption "Neovim."; options.neovim.enable = lib.mkEnableOption "Neovim.";
@ -38,9 +30,7 @@ in
# Create quick aliases for launching Neovim # Create quick aliases for launching Neovim
programs.fish = { programs.fish = {
shellAliases = { shellAliases = { vim = "nvim"; };
vim = "nvim";
};
shellAbbrs = { shellAbbrs = {
v = lib.mkForce "nvim"; v = lib.mkForce "nvim";
vl = lib.mkForce "nvim -c 'normal! `0' -c 'bdelete 1'"; vl = lib.mkForce "nvim -c 'normal! `0' -c 'bdelete 1'";
@ -52,22 +42,23 @@ in
# Requires removing some of the ANSI escape codes that are sent to the # Requires removing some of the ANSI escape codes that are sent to the
# scrollback using sed and baleia, as well as removing several # scrollback using sed and baleia, as well as removing several
# unnecessary features. # unnecessary features.
programs.kitty.settings.scrollback_pager = "${neovim}/bin/nvim --headless +'KittyScrollbackGenerateKittens' +'set nonumber' +'set norelativenumber' +'%print' +'quit!' 2>&1"; programs.kitty.settings.scrollback_pager = ''
$SHELL -c 'sed -r "s/[[:cntrl:]]\]133;[AC]..//g" | ${neovim}/bin/nvim -c "setlocal nonumber norelativenumber nolist laststatus=0" -c "lua baleia = require(\"baleia\").setup({}); baleia.once(0)" -c "map <silent> q :qa!<CR>" -c "autocmd VimEnter * normal G"' '';
# Create a desktop option for launching Neovim from a file manager # Create a desktop option for launching Neovim from a file manager
# (Requires launching the terminal and then executing Neovim) # (Requires launching the terminal and then executing Neovim)
xdg.desktopEntries.nvim = lib.mkIf pkgs.stdenv.isLinux { xdg.desktopEntries.nvim = lib.mkIf pkgs.stdenv.isLinux {
name = "Neovim wrapper"; name = "Neovim wrapper";
exec = "kitty nvim %F"; exec = "kitty nvim %F";
mimeType = [ mimeType = [ "text/plain" "text/markdown" ];
"text/plain"
"text/markdown"
];
}; };
xdg.mimeApps.defaultApplications = lib.mkIf pkgs.stdenv.isLinux { xdg.mimeApps.defaultApplications = lib.mkIf pkgs.stdenv.isLinux {
"text/plain" = [ "nvim.desktop" ]; "text/plain" = [ "nvim.desktop" ];
"text/markdown" = [ "nvim.desktop" ]; "text/markdown" = [ "nvim.desktop" ];
}; };
}; };
}; };
} }

View File

@ -39,6 +39,7 @@ key("n", "<Leader>fs", ":write<CR>")
key("n", "<Leader>fd", ":lcd %:p:h<CR>", { silent = true }) key("n", "<Leader>fd", ":lcd %:p:h<CR>", { silent = true })
key("n", "<Leader>fu", ":lcd ..<CR>", { silent = true }) key("n", "<Leader>fu", ":lcd ..<CR>", { silent = true })
key("n", "<Leader><Tab>", ":b#<CR>", { silent = true }) key("n", "<Leader><Tab>", ":b#<CR>", { silent = true })
key("n", "<Leader>gr", ":!gh browse %<CR><CR>", { silent = true })
key("n", "<Leader>tt", [[<Cmd>exe 'edit $NOTES_PATH/journal/'.strftime("%Y-%m-%d_%a").'.md'<CR>]]) 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>") key("n", "<Leader>jj", ":!journal<CR>:e<CR>")
@ -64,12 +65,6 @@ key("n", "<C-Down>", ":resize -2<CR>", { silent = true })
key("n", "<C-Left>", ":vertical 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 }) 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 -- Other
key("n", "<A-CR>", ":noh<CR>", { silent = true }) --- Clear search in VimWiki key("n", "<A-CR>", ":noh<CR>", { silent = true }) --- Clear search in VimWiki
key("n", "Y", "y$") --- Copy to end of line key("n", "Y", "y$") --- Copy to end of line

View File

@ -26,25 +26,13 @@
# ] ++ extraConfig; # ] ++ extraConfig;
# } # }
{ { pkgs, colors, ... }:
pkgs,
colors,
terraform ? false,
github ? false,
kubernetes ? false,
...
}:
# Comes from nix2vim overlay: # Comes from nix2vim overlay:
# https://github.com/gytis-ivaskevicius/nix2vim/blob/master/lib/neovim-builder.nix # https://github.com/gytis-ivaskevicius/nix2vim/blob/master/lib/neovim-builder.nix
pkgs.neovimBuilder { pkgs.neovimBuilder {
package = pkgs.neovim-unwrapped; package = pkgs.neovim-unwrapped;
inherit inherit colors;
colors
terraform
github
kubernetes
;
imports = [ imports = [
../config/align.nix ../config/align.nix
../config/bufferline.nix ../config/bufferline.nix

View File

@ -1,12 +1,12 @@
{ ... }: { ... }: {
{
imports = [ imports = [
./haskell.nix ./haskell.nix
./kubernetes.nix ./kubernetes.nix
./lua.nix ./lua.nix
./nix.nix
./python.nix ./python.nix
./rust.nix
./terraform.nix ./terraform.nix
]; ];
} }

View File

@ -1,12 +1,14 @@
{ config, lib, ... }: { config, lib, ... }: {
{
options.haskell.enable = lib.mkEnableOption "Haskell programming language."; options.haskell.enable = lib.mkEnableOption "Haskell programming language.";
config = lib.mkIf config.haskell.enable { config = lib.mkIf config.haskell.enable {
# Binary Cache for Haskell.nix # Binary Cache for Haskell.nix
nix.settings.trusted-public-keys = [ "hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ=" ]; nix.settings.trusted-public-keys =
[ "hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ=" ];
nix.settings.substituters = [ "https://cache.iog.io" ]; nix.settings.substituters = [ "https://cache.iog.io" ];
}; };
} }

View File

@ -1,10 +1,4 @@
{ { config, pkgs, lib, ... }: {
config,
pkgs,
lib,
...
}:
{
options.kubernetes.enable = lib.mkEnableOption "Kubernetes tools."; options.kubernetes.enable = lib.mkEnableOption "Kubernetes tools.";
@ -30,135 +24,122 @@
# Terminal Kubernetes UI # Terminal Kubernetes UI
programs.k9s = { programs.k9s = {
enable = true; enable = true;
settings = { # settings = { k9s = { headless = true; }; };
skin = {
k9s = { k9s = {
ui = { body = {
enableMouse = true; fgColor = config.theme.colors.base06;
headless = true; bgColor = config.theme.colors.base00;
logoless = true; logoColor = config.theme.colors.base02; # *blue ?
crumbsless = false;
skin = "main";
}; };
}; # Search bar
}; prompt = {
skins = { fgColor = config.theme.colors.base06;
main = { bgColor = config.theme.colors.base00;
k9s = { suggestColor = config.theme.colors.base03;
body = { };
# Header left side
info = {
fgColor = config.theme.colors.base04;
sectionColor = config.theme.colors.base05;
};
dialog = {
fgColor = config.theme.colors.base06;
bgColor = config.theme.colors.base00;
buttonFgColor = config.theme.colors.base06;
buttonBgColor = config.theme.colors.base0E;
buttonFocusFgColor = config.theme.colors.base07;
buttonFocusBgColor = config.theme.colors.base02; # *cyan
labelFgColor = config.theme.colors.base09;
fieldFgColor = config.theme.colors.base06;
};
frame = {
border = {
fgColor = config.theme.colors.base01;
focusColor = config.theme.colors.base06;
};
menu = {
fgColor = config.theme.colors.base06; fgColor = config.theme.colors.base06;
bgColor = "default"; keyColor = config.theme.colors.base0E; # *magenta
logoColor = config.theme.colors.base02; # *blue ? numKeyColor = config.theme.colors.base0E; # *magenta
}; };
# Search bar crumbs = {
prompt = {
fgColor = config.theme.colors.base06; fgColor = config.theme.colors.base06;
bgColor = "default"; bgColor = config.theme.colors.base01;
suggestColor = config.theme.colors.base03; activeColor = config.theme.colors.base03;
}; };
# Header left side status = {
info = { newColor = config.theme.colors.base04; # *cyan
fgColor = config.theme.colors.base04; modifyColor = config.theme.colors.base0D; # *blue
sectionColor = config.theme.colors.base05; addColor = config.theme.colors.base0B; # *green
errorColor = config.theme.colors.base08; # *red
highlightColor = config.theme.colors.base09; # *orange
killColor = config.theme.colors.base03; # *comment
completedColor = config.theme.colors.base03; # *comment
}; };
dialog = { title = {
fgColor = config.theme.colors.base06; fgColor = config.theme.colors.base06;
bgColor = "default"; bgColor = config.theme.colors.base00;
buttonFgColor = config.theme.colors.base06; highlightColor = config.theme.colors.base09; # *orange
buttonBgColor = config.theme.colors.base0E; counterColor = config.theme.colors.base0D; # *blue
buttonFocusFgColor = config.theme.colors.base07; filterColor = config.theme.colors.base0E; # *magenta
buttonFocusBgColor = config.theme.colors.base02; # *cyan
labelFgColor = config.theme.colors.base09;
fieldFgColor = config.theme.colors.base06;
}; };
frame = { };
border = { views = {
fgColor = config.theme.colors.base01; charts = {
focusColor = config.theme.colors.base06; bgColor = config.theme.colors.base00;
}; defaultDialColors =
menu = { [ config.theme.colors.base0D config.theme.colors.base08 ];
fgColor = config.theme.colors.base06; # - *blue
keyColor = config.theme.colors.base0E; # *magenta # - *red
numKeyColor = config.theme.colors.base0E; # *magenta defaultChartColors =
}; [ config.theme.colors.base0D config.theme.colors.base08 ];
crumbs = { # - *blue
fgColor = config.theme.colors.base06; # - *red
bgColor = config.theme.colors.base01;
activeColor = config.theme.colors.base03;
};
status = {
newColor = config.theme.colors.base04; # *cyan
modifyColor = config.theme.colors.base0D; # *blue
addColor = config.theme.colors.base0B; # *green
errorColor = config.theme.colors.base08; # *red
highlightColor = config.theme.colors.base09; # *orange
killColor = config.theme.colors.base03; # *comment
completedColor = config.theme.colors.base03; # *comment
};
title = {
fgColor = config.theme.colors.base06;
bgColor = "default";
highlightColor = config.theme.colors.base09; # *orange
counterColor = config.theme.colors.base0D; # *blue
filterColor = config.theme.colors.base0E; # *magenta
};
}; };
views = { table = {
charts = { # List of resources
bgColor = "default"; fgColor = config.theme.colors.base06;
defaultDialColors = [ bgColor = config.theme.colors.base00;
config.theme.colors.base0D
config.theme.colors.base08
];
# - *blue
# - *red
defaultChartColors = [
config.theme.colors.base0D
config.theme.colors.base08
];
# - *blue
# - *red
};
table = {
# List of resources
fgColor = config.theme.colors.base06;
bgColor = "default";
# Row selection # Row selection
cursorFgColor = config.theme.colors.base07; cursorFgColor = config.theme.colors.base07;
cursorBgColor = config.theme.colors.base01; cursorBgColor = config.theme.colors.base01;
# Header row # Header row
header = { header = {
fgColor = config.theme.colors.base0D; fgColor = config.theme.colors.base0D;
bgColor = "default"; bgColor = config.theme.colors.base00;
sorterColor = config.theme.colors.base0A; # *selection sorterColor = config.theme.colors.base0A; # *selection
};
}; };
xray = { };
xray = {
fgColor = config.theme.colors.base06;
bgColor = config.theme.colors.base00;
cursorColor = config.theme.colors.base06;
graphicColor = config.theme.colors.base0D;
showIcons = false;
};
yaml = {
keyColor = config.theme.colors.base0D;
colonColor = config.theme.colors.base04;
fgColor = config.theme.colors.base03;
};
logs = {
fgColor = config.theme.colors.base06;
bgColor = config.theme.colors.base00;
indicator = {
fgColor = config.theme.colors.base06; fgColor = config.theme.colors.base06;
bgColor = "default"; bgColor = config.theme.colors.base00;
cursorColor = config.theme.colors.base06;
graphicColor = config.theme.colors.base0D;
showIcons = false;
};
yaml = {
keyColor = config.theme.colors.base0D;
colonColor = config.theme.colors.base04;
fgColor = config.theme.colors.base03;
};
logs = {
fgColor = config.theme.colors.base06;
bgColor = "default";
indicator = {
fgColor = config.theme.colors.base06;
bgColor = "default";
};
}; };
}; };
}; };
}; };
}; };
}; };
}; };
}; };
} }

View File

@ -1,10 +1,4 @@
{ { config, pkgs, lib, ... }: {
config,
pkgs,
lib,
...
}:
{
options.lua.enable = lib.mkEnableOption "Lua programming language."; options.lua.enable = lib.mkEnableOption "Lua programming language.";
@ -14,4 +8,5 @@
sumneko-lua-language-server # Lua LSP sumneko-lua-language-server # Lua LSP
]; ];
}; };
} }

View File

@ -0,0 +1,18 @@
{ config, pkgs, lib, ... }: {
options.nixlang.enable = lib.mkEnableOption "Nix programming language.";
config = lib.mkIf config.nixlang.enable {
home-manager.users.${config.user} = {
home.packages = with pkgs; [
nixfmt # Nix file formatter
nil # Nix language server
];
};
};
}

View File

@ -1,10 +1,4 @@
{ { config, pkgs, lib, ... }: {
config,
pkgs,
lib,
...
}:
{
options.python.enable = lib.mkEnableOption "Python programming language."; options.python.enable = lib.mkEnableOption "Python programming language.";
@ -19,9 +13,10 @@
python310Packages.flake8 # Python linter python310Packages.flake8 # Python linter
]; ];
programs.fish.shellAbbrs = { programs.fish.shellAbbrs = { py = "python3"; };
py = "python3";
};
}; };
}; };
} }

View File

@ -1,27 +0,0 @@
{
config,
pkgs,
lib,
...
}:
{
options.rust.enable = lib.mkEnableOption "Rust programming language.";
config = lib.mkIf config.rust.enable {
home-manager.users.${config.user} = {
programs.fish.shellAbbrs = {
ca = "cargo";
};
home.packages = with pkgs; [
cargo
rustc
clippy
gcc
];
};
};
}

View File

@ -1,15 +1,8 @@
{ { config, pkgs, lib, ... }: {
config,
pkgs,
lib,
...
}:
{
options.terraform.enable = lib.mkEnableOption "Terraform tools."; options.terraform.enable = lib.mkEnableOption "Terraform tools.";
config = lib.mkIf config.terraform.enable { config = lib.mkIf config.terraform.enable {
unfreePackages = [ "terraform" ];
home-manager.users.${config.user} = { home-manager.users.${config.user} = {
programs.fish.shellAbbrs = { programs.fish.shellAbbrs = {
@ -21,6 +14,9 @@
terraform-ls # Language server terraform-ls # Language server
tflint # Linter tflint # Linter
]; ];
}; };
}; };
} }

View File

@ -1,8 +1,5 @@
{ ... }: { ... }: {
{
imports = [ ./dotfiles.nix ./notes.nix ];
imports = [
./dotfiles.nix
./notes.nix
];
} }

View File

@ -1,10 +1,4 @@
{ { config, pkgs, lib, ... }: {
config,
pkgs,
lib,
...
}:
{
# Allows me to make sure I can work on my dotfiles locally # Allows me to make sure I can work on my dotfiles locally
@ -17,17 +11,23 @@
home.activation = { home.activation = {
# Always clone dotfiles repository if it doesn't exist # Always clone dotfiles repository if it doesn't exist
cloneDotfiles = config.home-manager.users.${config.user}.lib.dag.entryAfter [ "writeBoundary" ] '' cloneDotfiles =
if [ ! -d "${config.dotfilesPath}" ]; then config.home-manager.users.${config.user}.lib.dag.entryAfter
$DRY_RUN_CMD mkdir --parents $VERBOSE_ARG $(dirname "${config.dotfilesPath}") [ "writeBoundary" ] ''
$DRY_RUN_CMD ${pkgs.git}/bin/git \ if [ ! -d "${config.dotfilesPath}" ]; then
clone ${config.dotfilesRepo} "${config.dotfilesPath}" $DRY_RUN_CMD mkdir --parents $VERBOSE_ARG $(dirname "${config.dotfilesPath}")
fi $DRY_RUN_CMD ${pkgs.git}/bin/git \
''; clone ${config.dotfilesRepo} "${config.dotfilesPath}"
fi
'';
}; };
# Set a variable for dotfiles repo, not necessary but convenient # Set a variable for dotfiles repo, not necessary but convenient
home.sessionVariables.DOTS = config.dotfilesPath; home.sessionVariables.DOTS = config.dotfilesPath;
}; };
}; };
} }

View File

@ -1,10 +1,4 @@
{ { config, ... }: {
config,
pkgs,
lib,
...
}:
{
# This is just a placeholder as I expect to interact with my notes in a # This is just a placeholder as I expect to interact with my notes in a
# certain location # certain location
@ -15,22 +9,6 @@
NOTES_PATH = "${config.homePath}/dev/personal/notes/content"; NOTES_PATH = "${config.homePath}/dev/personal/notes/content";
}; };
# Sync notes for Nextcloud automatically
systemd.user.timers.refresh-notes = lib.mkIf config.services.nextcloud.enable {
Timer = {
OnCalendar = "*-*-* *:0/10:50"; # Every 10 minutes
Unit = "refresh-notes.service";
};
};
systemd.user.services.refresh-notes = {
Unit.Description = "Get latest notes.";
Service = {
Type = "oneshot";
ExecStartPre = "${pkgs.git}/bin/git -C /data/git/notes reset --hard master";
ExecStart = "${pkgs.git}/bin/git -C /data/git/notes pull";
WorkingDirectory = config.homePath;
Environment = "PATH=${pkgs.openssh}/bin";
};
};
}; };
} }

View File

@ -1,39 +0,0 @@
{ config, lib, ... }:
{
# Shell history sync
options.atuin.enable = lib.mkEnableOption "Atuin";
config = {
home-manager.users.${config.user} = lib.mkIf config.atuin.enable {
programs.atuin = {
enable = true;
flags = [
"--disable-up-arrow"
"--disable-ctrl-r"
];
settings = {
auto_sync = true;
update_check = false;
sync_address = "https://api.atuin.sh";
search_mode = "fuzzy";
filter_mode = "host"; # global, host, session, directory
search_mode_shell_up_key_binding = "fuzzy";
filter_mode_shell_up_key_binding = "session";
style = "compact"; # or auto,full
show_help = true;
history_filter = [ ];
secrets_filter = true;
enter_accept = false;
keymap_mode = "vim-normal";
};
};
};
# Give root user the same setup
home-manager.users.root.programs.atuin = config.home-manager.users.${config.user}.programs.atuin;
};
}

View File

@ -1,17 +1,12 @@
{ { config, pkgs, lib, ... }: {
config,
pkgs,
lib,
...
}:
{
config = { config = {
home-manager.users.${config.user} = { home-manager.users.${config.user} = {
programs.bash = { programs.bash = {
enable = true; enable = true;
shellAliases = config.home-manager.users.${config.user}.programs.fish.shellAliases; shellAliases =
config.home-manager.users.${config.user}.programs.fish.shellAliases;
initExtra = ""; initExtra = "";
profileExtra = ""; profileExtra = "";
}; };
@ -19,6 +14,7 @@
programs.starship.enableBashIntegration = false; programs.starship.enableBashIntegration = false;
programs.zoxide.enableBashIntegration = true; programs.zoxide.enableBashIntegration = true;
programs.fzf.enableBashIntegration = true; programs.fzf.enableBashIntegration = true;
}; };
}; };
} }

View File

@ -31,10 +31,6 @@ STATUS=$?
# because tesseract adds .txt to the given file path anyways. So if we were to # because tesseract adds .txt to the given file path anyways. So if we were to
# specify /tmp/ocr.txt as the file path, tesseract would out the text to # specify /tmp/ocr.txt as the file path, tesseract would out the text to
# /tmp/ocr.txt.txt # /tmp/ocr.txt.txt
cd /tmp || {
echo "Failed to jump to directory."
exit 1
}
tesseract "$IMAGE_FILE" "${TEXT_FILE//\.txt/}" tesseract "$IMAGE_FILE" "${TEXT_FILE//\.txt/}"
# Check if the text was detected by checking number # Check if the text was detected by checking number

View File

@ -1,10 +1,4 @@
{ { config, pkgs, lib, ... }: {
config,
pkgs,
lib,
...
}:
{
# Convenience utilities from charm.sh # Convenience utilities from charm.sh
@ -16,7 +10,8 @@
glow # Markdown previews glow # Markdown previews
skate # Key-value store skate # Key-value store
charm # Manage account and filesystem charm # Manage account and filesystem
pop # Send emails from a TUI
]; ];
}; };
} }

View File

@ -1,7 +1,5 @@
{ ... }: { ... }: {
{
imports = [ imports = [
./atuin.nix
./bash ./bash
./charm.nix ./charm.nix
./direnv.nix ./direnv.nix
@ -13,6 +11,5 @@
./nixpkgs.nix ./nixpkgs.nix
./starship.nix ./starship.nix
./utilities.nix ./utilities.nix
./work.nix
]; ];
} }

View File

@ -1,36 +1,16 @@
{ config, ... }: { config, ... }: {
{
# Enables quickly entering Nix shells when changing directories # Enables quickly entering Nix shells when changing directories
home-manager.users.${config.user}.programs.direnv = { home-manager.users.${config.user}.programs.direnv = {
enable = true; enable = true;
nix-direnv.enable = true; nix-direnv.enable = true;
config = { config = { whitelist = { prefix = [ config.dotfilesPath ]; }; };
whitelist = {
prefix = [ config.dotfilesPath ];
};
};
}; };
# programs.direnv.direnvrcExtra = ''
# layout_postgres() {
# export PGDATA="$(direnv_layout_dir)/postgres"
# export PGHOST="$PGDATA"
#
# if [[ ! -d "PGDATA" ]]; then
# initdb
# cat >> "$PGDATA/postgres.conf" <<- EOF
# listen_addresses = '''
# unix_socket_directories = '$PGHOST'
# EOF
# echo "CREATE DATABASE $USER;" | postgres --single -E postgres
# fi
# }
# '';
# Prevent garbage collection # Prevent garbage collection
nix.extraOptions = '' nix.extraOptions = ''
keep-outputs = true keep-outputs = true
keep-derivations = true keep-derivations = true
''; '';
} }

View File

@ -1,10 +1,4 @@
{ { config, pkgs, lib, ... }: {
config,
pkgs,
lib,
...
}:
{
users.users.${config.user}.shell = pkgs.fish; users.users.${config.user}.shell = pkgs.fish;
programs.fish.enable = true; # Needed for LightDM to remember username programs.fish.enable = true; # Needed for LightDM to remember username
@ -12,7 +6,7 @@
home-manager.users.${config.user} = { home-manager.users.${config.user} = {
# Packages used in abbreviations and aliases # Packages used in abbreviations and aliases
home.packages = with pkgs; [ curl ]; home.packages = with pkgs; [ curl exa ];
programs.fish = { programs.fish = {
enable = true; enable = true;
@ -21,8 +15,8 @@
# Version of bash which works much better on the terminal # Version of bash which works much better on the terminal
bash = "${pkgs.bashInteractive}/bin/bash"; bash = "${pkgs.bashInteractive}/bin/bash";
# Use eza (exa) instead of ls for fancier output # Use exa instead of ls for fancier output
ls = "${pkgs.eza}/bin/eza --group"; ls = "exa --group";
# Move files to XDG trash on the commandline # Move files to XDG trash on the commandline
trash = lib.mkIf pkgs.stdenv.isLinux "${pkgs.trash-cli}/bin/trash-put"; trash = lib.mkIf pkgs.stdenv.isLinux "${pkgs.trash-cli}/bin/trash-put";
@ -52,9 +46,7 @@
fish_user_key_bindings = { fish_user_key_bindings = {
body = builtins.readFile ./functions/fish_user_key_bindings.fish; body = builtins.readFile ./functions/fish_user_key_bindings.fish;
}; };
ip = { ip = { body = builtins.readFile ./functions/ip.fish; };
body = builtins.readFile ./functions/ip.fish;
};
json = { json = {
description = "Tidy up JSON using jq"; description = "Tidy up JSON using jq";
body = "pbpaste | jq '.' | pbcopy"; # Need to fix for non-macOS body = "pbpaste | jq '.' | pbcopy"; # Need to fix for non-macOS
@ -120,7 +112,8 @@
moon = "curl wttr.in/Moon"; moon = "curl wttr.in/Moon";
# Cheat Sheets # Cheat Sheets
ssl = "openssl req -new -newkey rsa:2048 -nodes -keyout server.key -out server.csr"; ssl =
"openssl req -new -newkey rsa:2048 -nodes -keyout server.key -out server.csr";
fingerprint = "ssh-keyscan myhost.com | ssh-keygen -lf -"; fingerprint = "ssh-keyscan myhost.com | ssh-keygen -lf -";
publickey = "ssh-keygen -y -f ~/.ssh/id_rsa > ~/.ssh/id_rsa.pub"; publickey = "ssh-keygen -y -f ~/.ssh/id_rsa > ~/.ssh/id_rsa.pub";
forloop = "for i in (seq 1 100)"; forloop = "for i in (seq 1 100)";
@ -129,6 +122,10 @@
dc = "$DOTS/bin/docker_cleanup"; dc = "$DOTS/bin/docker_cleanup";
dr = "docker run --rm -it"; dr = "docker run --rm -it";
db = "docker build . -t"; db = "docker build . -t";
# Rust
ca = "cargo";
}; };
shellInit = ""; shellInit = "";
}; };
@ -138,5 +135,6 @@
programs.starship.enableFishIntegration = true; programs.starship.enableFishIntegration = true;
programs.zoxide.enableFishIntegration = true; programs.zoxide.enableFishIntegration = true;
programs.fzf.enableFishIntegration = true; programs.fzf.enableFishIntegration = true;
}; };
} }

View File

@ -18,5 +18,3 @@ bind -M insert \cn 'commandline -r "nix shell nixpkgs#"'
bind -M default \cn 'commandline -r "nix shell nixpkgs#"' bind -M default \cn 'commandline -r "nix shell nixpkgs#"'
bind -M insert \x11F nix-fzf bind -M insert \x11F nix-fzf
bind -M default \x11F nix-fzf bind -M default \x11F nix-fzf
bind -M insert \ch '_atuin_search --filter-mode global'
bind -M default \ch '_atuin_search --filter-mode global'

View File

@ -1,5 +1,4 @@
{ config, pkgs, ... }: { config, ... }: {
{
# FZF is a fuzzy-finder for the terminal # FZF is a fuzzy-finder for the terminal
@ -17,29 +16,27 @@
--search-path $HOME/dev \ --search-path $HOME/dev \
--type directory \ --type directory \
--exact-depth 2 \ --exact-depth 2 \
| ${pkgs.proximity-sort}/bin/proximity-sort $PWD \
| sed 's/\\/$//' \ | sed 's/\\/$//' \
| fzf --tiebreak=index \ | fzf \
--delimiter '/' \
--with-nth 6.. \
) )
and cd $projdir and cd $projdir
and commandline -f execute and commandline -f execute
''; '';
}; };
}; };
shellAbbrs = { shellAbbrs = { lsf = "ls -lh | fzf"; };
lsf = "ls -lh | fzf";
};
}; };
# Global fzf configuration # Global fzf configuration
home.sessionVariables = home.sessionVariables = let fzfCommand = "fd --type file";
let in {
fzfCommand = "fd --type file"; FZF_DEFAULT_COMMAND = fzfCommand;
in FZF_CTRL_T_COMMAND = fzfCommand;
{ FZF_DEFAULT_OPTS = "-m --height 50% --border";
FZF_DEFAULT_COMMAND = fzfCommand; };
FZF_CTRL_T_COMMAND = fzfCommand;
FZF_DEFAULT_OPTS = "-m --height 50% --border";
};
}; };
} }

View File

@ -1,14 +1,8 @@
{ { config, pkgs, lib, ... }:
config,
pkgs,
lib,
...
}:
let let home-packages = config.home-manager.users.${config.user}.home.packages;
home-packages = config.home-manager.users.${config.user}.home.packages;
in in {
{
options = { options = {
gitName = lib.mkOption { gitName = lib.mkOption {
@ -34,62 +28,15 @@ in
userName = config.gitName; userName = config.gitName;
userEmail = config.gitEmail; userEmail = config.gitEmail;
extraConfig = { extraConfig = {
core.pager = "${pkgs.git}/share/git/contrib/diff-highlight/diff-highlight | less -F"; pager = { branch = "false"; };
interactive.difffilter = "${pkgs.git}/share/git/contrib/diff-highlight/diff-highlight"; safe = { directory = config.dotfilesPath; };
pager = { pull = { ff = "only"; };
branch = "false"; push = { autoSetupRemote = "true"; };
}; init = { defaultBranch = "master"; };
safe = {
directory = config.dotfilesPath;
};
pull = {
ff = "only";
};
push = {
autoSetupRemote = "true";
};
init = {
defaultBranch = "master";
};
rebase = {
autosquash = "true";
};
gpg = {
format = "ssh";
ssh.allowedSignersFile = "~/.config/git/allowed-signers";
};
# commit.gpgsign = true;
# tag.gpgsign = true;
}; };
ignores = [ ignores = [ ".direnv/**" "result" ];
".direnv/**"
"result"
];
includes = [
{
path = "~/.config/git/personal";
condition = "gitdir:~/dev/personal/";
}
];
}; };
# Personal git config
# TODO: fix with variables
xdg.configFile."git/personal".text = ''
[user]
name = "${config.fullName}"
email = "7386960+nmasur@users.noreply.github.com"
signingkey = ~/.ssh/id_ed25519
[commit]
gpgsign = true
[tag]
gpgsign = true
'';
xdg.configFile."git/allowed-signers".text = ''
7386960+nmasur@users.noreply.github.com ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIB+AbmjGEwITk5CK9y7+Rg27Fokgj9QEjgc9wST6MA3s
'';
programs.fish.shellAbbrs = { programs.fish.shellAbbrs = {
g = "git"; g = "git";
gs = "git status"; gs = "git status";
@ -107,10 +54,10 @@ in
gl = "git log --graph --decorate --oneline -20"; gl = "git log --graph --decorate --oneline -20";
gll = "git log --graph --decorate --oneline"; gll = "git log --graph --decorate --oneline";
gco = "git checkout"; gco = "git checkout";
gcom = ''git switch (git symbolic-ref refs/remotes/origin/HEAD | cut -d"/" -f4)''; gcom = ''
git switch (git symbolic-ref refs/remotes/origin/HEAD | cut -d"/" -f4)'';
gcob = "git switch -c"; gcob = "git switch -c";
gb = "git branch"; gb = "git branch";
gpd = "git push origin -d";
gbd = "git branch -d"; gbd = "git branch -d";
gbD = "git branch -D"; gbD = "git branch -D";
gr = "git reset"; gr = "git reset";
@ -121,63 +68,58 @@ in
}; };
# Required for fish commands # Required for fish commands
home.packages = with pkgs; [ home.packages = with pkgs; [ fish fzf bat ];
fish
fzf
bat
];
programs.fish.functions = programs.fish.functions = lib.mkIf (builtins.elem pkgs.fzf home-packages
lib.mkIf (builtins.elem pkgs.fzf home-packages && builtins.elem pkgs.bat home-packages) && builtins.elem pkgs.bat home-packages) {
{ git = { body = builtins.readFile ./fish/functions/git.fish; };
git = { git-add-fuzzy = {
body = builtins.readFile ./fish/functions/git.fish; body = builtins.readFile ./fish/functions/git-add-fuzzy.fish;
};
git-add-fuzzy = {
body = builtins.readFile ./fish/functions/git-add-fuzzy.fish;
};
git-fuzzy-branch = {
argumentNames = "header";
body = builtins.readFile ./fish/functions/git-fuzzy-branch.fish;
};
git-checkout-fuzzy = {
body = ''
set branch (git-fuzzy-branch "checkout branch...")
and git checkout $branch
'';
};
git-delete-fuzzy = {
body = ''
set branch (git-fuzzy-branch "delete branch...")
and git branch -d $branch
'';
};
git-force-delete-fuzzy = {
body = ''
set branch (git-fuzzy-branch "force delete branch...")
and git branch -D $branch
'';
};
git-merge-fuzzy = {
body = ''
set branch (git-fuzzy-branch "merge from...")
and git merge $branch
'';
};
git-show-fuzzy = {
body = builtins.readFile ./fish/functions/git-show-fuzzy.fish;
};
git-commits = {
body = builtins.readFile ./fish/functions/git-commits.fish;
};
git-history = {
body = builtins.readFile ./fish/functions/git-history.fish;
};
uncommitted = {
description = "Find uncommitted git repos";
body = builtins.readFile ./fish/functions/uncommitted.fish;
};
}; };
git-fuzzy-branch = {
argumentNames = "header";
body = builtins.readFile ./fish/functions/git-fuzzy-branch.fish;
};
git-checkout-fuzzy = {
body = ''
set branch (git-fuzzy-branch "checkout branch...")
and git checkout $branch
'';
};
git-delete-fuzzy = {
body = ''
set branch (git-fuzzy-branch "delete branch...")
and git branch -d $branch
'';
};
git-force-delete-fuzzy = {
body = ''
set branch (git-fuzzy-branch "force delete branch...")
and git branch -D $branch
'';
};
git-merge-fuzzy = {
body = ''
set branch (git-fuzzy-branch "merge from...")
and git merge $branch
'';
};
git-show-fuzzy = {
body = builtins.readFile ./fish/functions/git-show-fuzzy.fish;
};
git-commits = {
body = builtins.readFile ./fish/functions/git-commits.fish;
};
git-history = {
body = builtins.readFile ./fish/functions/git-history.fish;
};
uncommitted = {
description = "Find uncommitted git repos";
body = builtins.readFile ./fish/functions/uncommitted.fish;
};
};
}; };
}; };
} }

View File

@ -1,43 +1,39 @@
{ { config, pkgs, lib, ... }: {
config,
pkgs,
lib,
...
}:
{
home-manager.users.${config.user} = { home-manager.users.${config.user} = {
programs.gh = lib.mkIf config.home-manager.users.${config.user}.programs.git.enable { programs.gh =
enable = true; lib.mkIf config.home-manager.users.${config.user}.programs.git.enable {
gitCredentialHelper.enable = true; enable = true;
settings.git_protocol = "https"; gitCredentialHelper.enable = true;
extensions = [ pkgs.gh-collaborators ]; settings.git_protocol = "https";
};
programs.fish = lib.mkIf config.home-manager.users.${config.user}.programs.gh.enable {
shellAbbrs = {
ghr = "gh repo view -w";
gha = "gh run list | head -1 | awk '{ print \\$\\(NF-2\\) }' | xargs gh run view";
grw = "gh run watch";
grf = "gh run view --log-failed";
grl = "gh run view --log";
ghpr = "gh pr create && sleep 3 && gh run watch";
# https://github.com/cli/cli/discussions/4067
prs = "gh search prs --state=open --review-requested=@me";
}; };
functions = {
repos = { programs.fish =
description = "Clone GitHub repositories"; lib.mkIf config.home-manager.users.${config.user}.programs.gh.enable {
argumentNames = "organization"; shellAbbrs = {
body = '' ghr = "gh repo view -w";
set directory (gh-repos $organization) gha =
and cd $directory "gh run list | head -1 | awk '{ print $(NF-2) }' | xargs gh run view";
''; grw = "gh run watch";
grf = "gh run view --log-failed";
grl = "gh run view --log";
ghpr = "gh pr create && sleep 3 && gh run watch";
# https://github.com/cli/cli/discussions/4067
prs = "gh search prs --state=open --review-requested=@me";
};
functions = {
repos = {
description = "Clone GitHub repositories";
argumentNames = "organization";
body = ''
set directory (gh-repos $organization)
and cd $directory
'';
};
}; };
}; };
};
home.packages = [ home.packages = [
(pkgs.writeShellScriptBin "gh-repos" '' (pkgs.writeShellScriptBin "gh-repos" ''
@ -51,7 +47,7 @@
esac esac
selected=$(gh repo list "$organization" \ selected=$(gh repo list "$organization" \
--limit 100 \ --limit 50 \
--no-archived \ --no-archived \
--json=name,description,isPrivate,updatedAt,primaryLanguage \ --json=name,description,isPrivate,updatedAt,primaryLanguage \
| jq -r '.[] | .name + "," + if .description == "" then "-" else .description |= gsub(","; " ") | .description end + "," + .updatedAt + "," + .primaryLanguage.name' \ | jq -r '.[] | .name + "," + if .description == "" then "-" else .description |= gsub(","; " ") | .description end + "," + .updatedAt + "," + .primaryLanguage.name' \
@ -60,7 +56,6 @@
| fzf \ | fzf \
--header-lines=1 \ --header-lines=1 \
--layout=reverse \ --layout=reverse \
--height=100% \
--bind "ctrl-o:execute:gh repo view -w ''${organization}/{1}" \ --bind "ctrl-o:execute:gh repo view -w ''${organization}/{1}" \
--bind "shift-up:preview-half-page-up" \ --bind "shift-up:preview-half-page-up" \
--bind "shift-down:preview-half-page-down" \ --bind "shift-down:preview-half-page-down" \
@ -79,5 +74,7 @@
} }
'') '')
]; ];
}; };
} }

View File

@ -1,18 +1,21 @@
{ config, ... }: { config, ... }: {
{
config = { config = {
home-manager.users.${config.user}.programs.jujutsu = { home-manager.users.${config.user}.programs.jujutsu = {
enable = true; enable = true;
enableFishIntegration = true;
# https://github.com/martinvonz/jj/blob/main/docs/config.md # https://github.com/martinvonz/jj/blob/main/docs/config.md
settings = { settings = {
user = { user = {
name = config.home-manager.users.${config.user}.programs.git.userName; name = config.home-manager.users.${config.user}.programs.git.userName;
email = config.home-manager.users.${config.user}.programs.git.userEmail; email =
config.home-manager.users.${config.user}.programs.git.userEmail;
}; };
}; };
}; };
}; };
} }

Some files were not shown because too many files have changed in this diff Show More