init temp while waiting for public ip address

This commit is contained in:
Anish Lakhwara
2025-10-16 02:37:11 -07:00
commit 680c000c36
10 changed files with 902 additions and 0 deletions
+75
View File
@@ -0,0 +1,75 @@
{ config, ... }:
{
age.secrets.pds-env = {
file = ../../secrets/pds-env.age;
mode = "0400";
owner = "pds";
};
services.pds = {
enable = true;
environmentFiles = [ config.age.secrets.pds-env.path ];
settings = {
PDS_PORT = 5556;
PDS_HOSTNAME = "pds.commonscomputer.com";
# We can set a bunch of other things too
# PDS_BSKY_APP_VIEW_URL
# PDS_CRAWLERS
# PDS_BLOB_UPLOAD_LIMIT
# Full list available here: https://github.com/bluesky-social/atproto/blob/main/packages/pds/src/config/env.ts
};
};
services.tangled-spindle = {
enable = true;
server = {
hostname = "spindle.commonscomputer.com";
owner = "did:plc:dy6ekftqerqu5bcz76kgy6ux";
};
};
# stolen from https://tangled.org/@isuggest.selfce.st/tangled-knot-nix/blob/main/knot.nix
services.tangled-knot = {
enable = true;
server = {
hostname = "knot.commonscomputer.com"; # put in the hostname where your knot can be accessed at. e.g. knot.a.tgirl.gay
owner = "did:plc:dy6ekftqerqu5bcz76kgy6ux"; # your did, must be did:plc:<whatever> or did:web:<whatever>.
};
# optional configuration options. the current value is the default provided to the knot server.
# appviewEndpoint = "https://tangled.sh"; # appview endpoint.
# gitUser = "git"; # user that hosts git repos and performs git operations.
# openFirewall = true; # open port 22 in the firewall for ssh.
# stateDir = "/home/${cfg.gitUser}"; # tangled knot data directory.
# repo = {
# scanPath = cfg.stateDir; # path where repositories are scanned from;
# mainBranch = "main"; # default branch name for repositories;
# };
# motd = ""; # message of the day. the contents are shown as-is; eg. you will want to add a newline if setting a non-empty message since the knot won't do this for you.
# motdFile = null; # "file containing message of the day. the contents are shown as-is; eg. you will want to add a newline if setting a non-empty message since the knot won't do this for you."
# server = {
# listenAddr = "0.0.0.0:5555"; # address to listen on.
# internalListenAddr = "127.0.0.1:5444"; # internal address for inter-service communication.
# dbPath = "${cfg.stateDir}/knotserver.db"; # path to the database file.
# dev = false; # enable development mode (disables signature verification)
# };
};
services.caddy = {
enable = true;
virtualHosts = {
"knot.commonscomputer.org".extraConfig = ''
reverse_proxy http://localhost:5555
'';
"pds.commonscomputer.org".extraConfig = ''
reverse_proxy http://localhost:5556
'';
"spindle.commonscomputer.com".extraConfig = ''
reverse_proxy http://localhost:6555
'';
};
};
networking.firewall.allowedTCPPorts = [
80
443
];
}
+60
View File
@@ -0,0 +1,60 @@
{ config, pkgs, ... }:
{
systemd.services.auto-update = {
description = "Auto-update NixOS configuration";
path = with pkgs; [ git nix openssh ];
serviceConfig = {
Type = "oneshot";
User = "root";
WorkingDirectory = "/etc/nixos";
};
script = ''
set -e
echo "Pulling latest changes..."
git pull
echo "Updating flake inputs..."
nix flake update
# Check if there are changes to commit
if ! git diff --quiet flake.lock; then
echo "Committing flake.lock updates..."
git add flake.lock
git commit -m "auto-update: flake inputs $(date -Iseconds)"
echo "Pushing changes..."
git push
else
echo "No flake.lock changes to commit"
fi
echo "Rebuilding system..."
if ! nixos-rebuild switch --flake .#asusmini; then
echo "Build/switch failed, staying on current generation"
exit 1
fi
echo "Auto-update completed successfully"
'';
};
systemd.timers.auto-update = {
description = "Auto-update timer";
wantedBy = [ "timers.target" ];
timerConfig = {
OnCalendar = "weekly"; # Run weekly, adjust as needed
Persistent = true; # Run on boot if missed
RandomizedDelaySec = "1h"; # Add some randomness
};
};
# TODO: Set up SSH key for git push access
# Options:
# 1. Deploy key with write access to the repo
# 2. Generate SSH key on server and add to GitHub
# Command to generate: ssh-keygen -t ed25519 -f /root/.ssh/commons-nix-deploy -N ""
}
+123
View File
@@ -0,0 +1,123 @@
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running nixos-help).
{ config, pkgs }:
{
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
# ./atproto.nix
./auto-update.nix
];
# Bootloader.
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
networking.hostName = "asusmininix"; # Define your hostname.
# Static IP configuration
# TODO(anish): Replace with actual static IP once VLAN is configured
# networking.interfaces.eth0 = {
# useDHCP = false;
# ipv4.addresses = [{
# address = ""; # something like "192.168.1.100"
# prefixLength = 24; # e.g., 24 for /24 subnet
# }];
# };
# networking.defaultGateway = ""; # e.g., "192.168.1.1"
# networking.nameservers = [ "" "" ]; # e.g., "1.1.1.1" "8.8.8.8"
# Disable NetworkManager when using static IP
# networking.networkmanager.enable = true;
# Tailscale
services.tailscale.enable = true;
services.tailscale.useRoutingFeatures = "both";
# flake config
nix.settings.experimental-features = [
"nix-command"
"flakes"
];
# Set your time zone.
time.timeZone = "America/Vancouver";
# Select internationalisation properties.
i18n.defaultLocale = "en_CA.UTF-8";
# Configure keymap in X11
services.xserver.xkb = {
layout = "us";
variant = "";
};
# Define a user account. Don't forget to set a password with passwd.
users.users.bmann = {
isNormalUser = true;
description = "Boris Mann";
extraGroups = [ "networkmanager" "wheel" ];
packages = with pkgs; [];
};
users.users.anish = {
isNormalUser = true;
description = "som";
extraGroups = [ "networkmanager" "wheel" ];
openssh.authorizedKeys.keys = [
# Curve
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDM0Zvei46x/yZl/IeBCq6+IYQQ0avulzVyBysF9cPigZMCybWRV7IEU+E3k9t6JrbdbdGfJkcZIWmsWDdKS8W8mBnZpVoT0ffLynu8JQ/TKdGm4Qv6bgUeKNrGsNv0ZPs2CDaGSLj0oJfRF7Ko10tcLP0vW+yujrh+y6TH/vVzJioaV4TGvtCUpn+wEQah9ROwPQLUUofsSWdnRsDJ/gp37zXWs4l5wyjSKtP3O9RZUP7kBekbSqEgSXiTk0oUQSVqIWl9NDiP6onk/gSOjXsR/JPqsSN/XI/c/yj6gyY0f51Ru2D7iBxuMJIJcWV+rU6coIj+ULcQWLzt/7TI8jq5AOOzI/ll4zbL24Eo84Rz+TP9tvMMhDZ0VaMN22AJ8qQEjc5P09tWKsX7Jg39XelyV1jHXncE4yvIE9F4RSCHzWCeKeXakizQNuzSaxTxIExRFYHjNW5bR6+3MTGwVrEIXU+qML+0yFTR86MT+tdY5AreAJQLwbog79O1NupeXJE= anish@curve"
# Box
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDKN8/SH55DBiwVoSnTU8k2Pen+wmovL9QaMyehxGEsJJv/8fzwsswGalD4C/4O51LOvdu4UKkZW5hG02uVSK+58p3UV3pOPyoqsu/aDeIsWsqmTeTzUrBIWOlNzcDKnohLz2oGC5YO+wyTJ9Iteq6aGJDjErsW7sG3h5lXCs551EmJNNGhtBQaaoytMNnWqSdlVjDNCijurH7WUpp40U/RjEp532l4rX6eIIj3jBKEFbhZkFSSjqbj4xM4SyFt+Jmigb1RMjsQjmpfY1vDtM84RcYfpTUte/T5w2dkD5H6kccmWnwKSJpm9wXfx4E7lR9APdUGnau2U1+XxiD3ytGl anish@box"
# Nix-on-droid line
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJOiXBPVvZAp1fY0a0Tupxj0Ml6MoA51lvqt/jAQq249 nix-on-droid@localhost"
# Work
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC/vvh0i6+uAN0GWlK6ZfyTlc/AW54xe2CroUDsDSoGnFKeIUiSsWexobODlVakNhqwCKfsvUh6g+RdA8ZVcamATcYqxysP4X5fRksmAzRm5281O7ZBDHMB2BdcfHSTgiz7JvMRIQYWDlU8Ck6IL4wlN0b2GMUj9t/GeG37us8280rxpRNoIY7M27AJEZ7XNQhctBIVujxctVBgIMYmZiTwziU7ywJv4rNT5OAWvjRXSo1rkxdvx3VESv4y/mp8m7dEupZpIjIFsLs52+UG5LtadulUqtTWg05sCw8LEcmRhflgZSAvjw60RrKFCuWxc8+/Pmaw+zExeBMenqi0NzuTc3S3k2wCKVIZDh/0tlXzIwZ6WRqxDevUtEKfvbEFMXd8akhTfYs0dyszcFRevBxOBPbcKku+FK/HkdPLmEANvxYty3cv+Eipkz3c8JPJPvXNTXrjepXMm0LUKodO3c15hGogCOxUO38kykkyYnn+MxxHparoMfEr2+oHNpQoS5wA1G43ppqjVoRDgnhleu6ixwRkLZzphY3cnOd5jL9Ie5xIGbFWH1qSlQRdHBkHjuf85z7+QK8nFYAhmG1K3Vt3GNtF8LN1tYQkfwBJ/vsroMNzGPoq4PjVbqb80Eq+96cP89XKfU2/xw1g+p2lJDm/zC1WCjXVzf8NRwC7gqPavQ== anishlakhwara@anishs-mbp.lan"
];
};
# Allow unfree packages
nixpkgs.config.allowUnfree = true;
# List packages installed in system profile. To search, run:
# $ nix search wget
environment.systemPackages = with pkgs; [
vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default.
wget
];
# Some programs need SUID wrappers, can be configured further or are
# started in user sessions.
# programs.mtr.enable = true;
# programs.gnupg.agent = {
# enable = true;
# enableSSHSupport = true;
# };
# List services that you want to enable:
# Enable the OpenSSH daemon.
services.openssh = {
enable = true;
settings = {
PermitRootLogin = "yes";
};
};
# Open ports in the firewall.
networking.firewall.allowedTCPPorts = [ 22 80 443 ];
# networking.firewall.allowedUDPPorts = [ ... ];
# Or disable the firewall altogether.
# networking.firewall.enable = false;
# This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions
# on your system were taken. Its perfectly fine and recommended to leave
# this value at the release version of the first install of this system.
# Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "25.05"; # Did you read the comment?
}
+41
View File
@@ -0,0 +1,41 @@
# Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:
{
imports =
[ (modulesPath + "/installer/scan/not-detected.nix")
];
boot.initrd.availableKernelModules = [ "xhci_pci" "thunderbolt" "ahci" "nvme" "usb_storage" "usbhid" "sd_mod" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/677df32e-477e-4abe-bf2e-f487a9cea7ef";
fsType = "ext4";
};
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/9BE2-2FFF";
fsType = "vfat";
options = [ "fmask=0077" "dmask=0077" ];
};
swapDevices =
[ { device = "/dev/disk/by-uuid/4ca37db4-1819-40fc-a744-58b959da7fa0"; }
];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's
# still possible to use this option, but it's recommended to use it in conjunction
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
networking.useDHCP = lib.mkDefault true;
# networking.interfaces.enp89s0.useDHCP = lib.mkDefault true;
# networking.interfaces.wlo1.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}