63 Commits

Author SHA1 Message Date
dbfe474299 Use fish 2025-05-26 16:38:15 -07:00
455a36f0d1 Use apache and mod_php in www services 2025-05-26 15:23:29 -07:00
f21f543976 Configure www services 2025-05-25 21:52:10 -07:00
fc28b23995 Add electron tools 2025-05-25 21:11:31 -07:00
d9b0d8d4cb Make htop a globally common package 2025-04-22 15:34:08 -07:00
e40f929abe Add cachix substituter and disable shelvacu's 2025-04-22 14:21:01 -07:00
493d9962ef Setup php7.2 dev tools 2025-04-19 01:18:00 -07:00
3ee2d1dd84 Use cachix 2025-04-19 01:17:15 -07:00
1ac3895177 Install Arduino IDE on Marauder 2025-04-05 20:57:20 -07:00
3bc1357bb1 Uninstall orca-slicer from Marauder 2025-02-26 18:03:37 -08:00
46fbfbf8ca Install Signal desktop on Marauder 2025-02-26 17:59:38 -08:00
ebc1fce8f4 Update restic backup paths on marauder 2024-12-27 00:55:25 -08:00
a6acaf9b17 Setup vaultwarden on monolith 2024-12-27 00:55:25 -08:00
42a9998b54 Add Orca Slicer to marauder 2024-12-27 00:55:25 -08:00
36f3d3b66b Update hardware settings on marauder 2024-12-27 00:55:25 -08:00
fda44a9cc8 Add mp3val to monolith 2024-12-23 12:27:55 -08:00
8cdb64ed65 Add htop to monolith 2024-12-23 12:12:45 -08:00
5fd8e803b1 Update flake to NixOS 24.11 2024-12-18 22:15:49 -08:00
ac916d8305 Add reboot service to monolith 2024-12-18 22:04:49 -08:00
0de7e50ffa Add mullvad and qbittorrent to Marauder 2024-12-11 20:12:32 -08:00
227bf853ab Add extra SSH configurations to Marauder 2024-12-10 17:17:11 -08:00
e7100daf2f Install blender on marauder 2024-12-08 09:33:40 -08:00
04069f02ec Roughly setup todo-app web server 2024-12-06 17:02:11 -08:00
4210857297 Add ffcheck util to monolith 2024-11-30 13:39:34 -08:00
3136ec6762 Add screen util to monolith 2024-11-30 13:37:43 -08:00
fc2a78b0db Fix DNS updater 2024-11-30 13:37:00 -08:00
bb77fc54d4 Add media services 2024-11-30 10:56:41 -08:00
91f4fe8b13 Add intiface and minecraft 2024-11-13 16:41:53 -08:00
8be0deed4b Enable nix-ld 2024-10-10 15:08:09 -07:00
9ed9e10931 Disable firewall 2024-10-10 15:06:29 -07:00
75c76ef032 Fix restic daily backups 2024-10-06 18:35:00 -07:00
0ebe8d1121 Serve Synapse Admin from quasar 2024-09-27 21:01:31 -07:00
d80ae92464 Add system-control-printer to marauder 2024-09-27 21:01:31 -07:00
883204e90e Set synapse secrets 2024-09-27 21:01:31 -07:00
0172e6af2b Configure synapse on quasar 2024-09-26 00:40:56 -07:00
66786c2455 Move zerotier out of the common module 2024-09-25 21:05:05 -07:00
e30a5830ef Add quasar host 2024-09-25 19:44:47 -07:00
572cca2dd9 Configure printing on marauder 2024-09-25 16:20:21 -07:00
09a1cc5a26 Move ffcheck into a separate package 2024-09-23 16:46:50 -07:00
8ef9e1b0be Use Shelvacu's cache 2024-09-23 16:29:02 -07:00
2e956f2ddd Move lightweight editor config to common module 2024-09-23 16:20:51 -07:00
d3f46bf7c5 Move Marauder dev configs into a separate module 2024-09-23 16:15:42 -07:00
e22915119e Set default editors 2024-09-23 15:57:54 -07:00
e79ec922d1 Only backup critical Marauder directories 2024-09-23 15:55:37 -07:00
4eff26d69d Update flake 2024-09-20 21:46:18 -07:00
b714df956c Add Super Mario 64 Co-op Deluxe 2024-09-15 15:49:06 -07:00
4e905ba555 Set Marauder time zone to Pacific 2024-09-05 20:01:17 -07:00
19089fd683 Add art software 2024-09-02 17:10:31 -06:00
ee94662fd1 Add mullvad 2024-08-11 21:32:33 -06:00
0992eba4dc Format nix files 2024-08-06 14:58:30 -06:00
57049fe511 Add nixpkgs-fmt 2024-08-06 14:54:48 -06:00
b5e8cd89dd Add nixd 2024-08-04 23:40:42 -06:00
f9e8704fce Add nix-direnv 2024-08-04 23:26:33 -06:00
1b62fee835 Add pyenv 2024-08-04 23:18:01 -06:00
821b3a00ed Add slack 2024-08-01 15:31:08 -06:00
050f2ded35 Add GCC 2024-07-31 10:41:59 -06:00
7deda2a385 Add rustup 2024-07-31 10:24:49 -06:00
066d21cf66 Add kotlin 2024-07-29 12:15:10 -06:00
2e90f3455a Set Marauder time zone to Denver 2024-07-29 10:16:27 -06:00
1ccbd013f8 Add ffmpeg and ffcheck helper script 2024-07-28 17:13:05 -07:00
705a9f840b Add filezilla 2024-07-28 17:00:53 -07:00
81651492ca Set prompt emoji for Monolith 2024-07-23 20:57:43 -07:00
eade86cef6 Create prompt module 2024-07-23 20:53:57 -07:00
16 changed files with 2312 additions and 98 deletions

1944
flake.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -2,16 +2,21 @@
description = "Nettika's NixOS Configurations";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.05";
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.11";
shelvacu.url = "git+https://git.uninsane.org/shelvacu/nix-stuff";
phps.url = "github:fossar/nix-phps";
};
outputs = { self, nixpkgs, ... }@inputs:
let
secrets = builtins.fromJSON (builtins.readFile ./secrets.json);
in {
in
{
nixosModules = {
common = import ./modules/common.nix;
prompt = import ./modules/prompt.nix;
server = import ./modules/server.nix;
zerotier = import ./modules/zerotier.nix;
};
nixosConfigurations = {
@@ -25,6 +30,11 @@
modules = [ ./hosts/monolith ];
specialArgs = { inherit self inputs secrets; };
};
quasar = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [ ./hosts/quasar ];
specialArgs = { inherit self inputs secrets; };
};
};
};
}

View File

@@ -1,11 +1,5 @@
{ pkgs, config, secrets, ... }:
{
environment.systemPackages = with pkgs; [
restic
libnotify
backblaze-b2
];
systemd.services = {
notify-backup-b2-failed = {
description = "Notify on failed backup to B2";
@@ -20,14 +14,14 @@
script = "notify-send -u critical \"Backup to B2 failed\" \"$(journalctl -u restic-backups-b2 -n 5 -o cat)\"";
};
restic-backups-b2 = {
onFailure = ["notify-backup-b2-failed.service"];
onFailure = [ "notify-backup-b2-failed.service" ];
};
};
environment.etc = {
"restic-env".text = ''
export B2_ACCOUNT_ID="${secrets.b2.accountId}"
export B2_ACCOUNT_KEY="${secrets.b2.accountKey}"
B2_ACCOUNT_ID="${secrets.b2.accountId}"
B2_ACCOUNT_KEY="${secrets.b2.accountKey}"
'';
"restic-password".text = secrets.restic.password;
};
@@ -39,13 +33,11 @@
repository = "b2:marauder-backup";
passwordFile = "/etc/restic-password";
paths = [
"${config.users.users.nettika.home}/Desktop"
"${config.users.users.nettika.home}/Artwork"
"${config.users.users.nettika.home}/Documents"
"${config.users.users.nettika.home}/Music"
"${config.users.users.nettika.home}/Pictures"
"${config.users.users.nettika.home}/Projects"
"${config.users.users.nettika.home}/Public"
"${config.users.users.nettika.home}/Templates"
"${config.users.users.nettika.home}/Videos"
];
pruneOpts = [

View File

@@ -1,11 +1,19 @@
{ self, pkgs, inputs, secrets, ... }:
{ self, pkgs, inputs, ... }:
{
imports = [
self.nixosModules.common
self.nixosModules.prompt
self.nixosModules.zerotier
./backup.nix
./dev.nix
./www.nix
./printing.nix
];
networking.hostName = "marauder";
networking = {
hostName = "marauder";
firewall.enable = false;
};
fileSystems = {
"/" = {
@@ -34,19 +42,21 @@
"sd_mod"
];
};
kernelModules = ["kvm-amd"];
kernelModules = [ "kvm-amd" ];
kernelParams = [ "amd_pstate=active" ];
};
hardware = {
enableRedistributableFirmware = true;
cpu.amd.updateMicrocode = true;
opengl = {
graphics = {
enable = true;
driSupport32Bit = true;
extraPackages = [pkgs.vaapiVdpau];
enable32Bit = true;
extraPackages = [ pkgs.vaapiVdpau ];
};
nvidia.prime = {
nvidia = {
open = true;
prime = {
offload = {
enable = true;
enableOffloadCmd = true;
@@ -55,42 +65,43 @@
nvidiaBusId = "PCI:01:00:0";
};
};
};
environment.systemPackages = with pkgs; [
environment = {
systemPackages = [
inputs.shelvacu.packages.x86_64-linux.sm64coopdx
] ++ (with pkgs; [
# Chat clients
discord
slack
element-desktop
telegram-desktop
signal-desktop
# Browsers
firefox
filezilla
# Coding
vscode
# Art and 3D
# Creative
inkscape
gimp
krita
openscad-unstable
bambu-studio
# Multimedia
vlc
ffmpeg
(callPackage ./ffcheck.nix { })
# Productivity
# Misc
obsidian
];
programs.bash = {
promptInit = ''
PS1="\[\e]0;\u@\h: \w\a\]" # window title
PS1+="\n"
PS1+="\$(printf \"%*s\" \$((\$COLUMNS + 9)) \"\[\e[1;33m\]\$(git branch --show-current 2>/dev/null)\")" # git branch
PS1+="\[\e[1G\]" # move cursor to beginning of line
PS1+="💜" # prompt symbol
PS1+="\[\033[1;$((UID ? 32 : 31))m\]" # prompt color
PS1+="[\u@\h:\w]\\$"
PS1+="\[\033[0m\] " # reset color
'';
intiface-central
prismlauncher
blender
mullvad-vpn
qbittorrent
]);
};
programs.steam = {
@@ -99,9 +110,26 @@
dedicatedServer.openFirewall = true;
};
programs.ssh.extraConfig = ''
Host quasar
HostName consortium.chat
IdentityFile ~/.ssh/LightsailDefaultKey-us-west-2.pem
Host monolith
HostName 10.243.210.154
Host fennbox
HostName 10.243.109.199
User fenn
'';
programs.nix-ld = {
enable = true;
};
services.xserver = {
enable = true;
videoDrivers = ["nvidia"];
videoDrivers = [ "nvidia" ];
desktopManager = {
cinnamon.enable = true;
xterm.enable = false;
@@ -120,8 +148,14 @@
enable = true;
};
services.mullvad-vpn = {
enable = true;
package = pkgs.mullvad-vpn; # Include GUI
};
promptEmoji = "💜";
time.timeZone = "America/Los_Angeles";
system.stateVersion = "24.05";
}

34
hosts/marauder/dev.nix Executable file
View File

@@ -0,0 +1,34 @@
{ pkgs, ... }:
{
environment.variables = {
VISUAL = "code --wait";
};
environment.systemPackages = with pkgs; [
# Code Editors
vscode
arduino-ide
# Dev Tools
nixd
nixpkgs-fmt
pyenv
rustup
electron-fiddle
electron
# Languages
gcc
kotlin
nodejs
php
];
programs.direnv = {
enable = true;
};
nixpkgs.config.permittedInsecurePackages = [
"electron-24.8.6"
];
}

3
hosts/marauder/ffcheck.nix Executable file
View File

@@ -0,0 +1,3 @@
{ writeShellScriptBin, ffmpeg }: writeShellScriptBin "ffcheck" ''
${ffmpeg}/bin/ffmpeg -v error -stats -hide_banner -i "$1" -c copy -f null -
''

View File

@@ -0,0 +1,16 @@
{ pkgs, ... }:
{
environment.systemPackages = with pkgs; [
system-config-printer
];
services.printing = {
enable = true;
};
services.avahi = {
enable = true;
nssmdns4 = true;
openFirewall = true;
};
}

26
hosts/marauder/www.nix Executable file
View File

@@ -0,0 +1,26 @@
{ pkgs, inputs, ... }:
let
fortune = pkgs.writeShellScript "cgi" ''
echo "Content-type: text/html"
echo ""
${pkgs.fortune}/bin/fortune
'';
in {
services.mysql = {
enable = true;
package = pkgs.mariadb;
};
services.httpd = {
enable = true;
enablePHP = true;
# phpPackage = inputs.phps.packages.x86_64-linux.php74;
extraConfig = ''
ScriptAlias /fortune ${fortune}/bin/fortune
'';
virtualHosts."localhost" = {
documentRoot = "/var/www";
locations."/".index = "index.html index.php";
};
};
}

View File

@@ -1,14 +1,18 @@
{ self, pkgs, secrets, ... }:
{ self, pkgs, ... }:
{
imports = [
self.nixosModules.common
self.nixosModules.prompt
self.nixosModules.server
self.nixosModules.zerotier
./dns.nix
./vault.nix
];
networking = {
hostName = "monolith";
hostId = "44551c32";
firewall.allowedTCPPorts = [ 8000 ];
};
fileSystems = {
@@ -37,6 +41,53 @@
supportedFilesystems = [ "zfs" ];
};
environment.systemPackages = with pkgs; [
rclone
beets
flac
screen
rustup
gcc
(callPackage ../marauder/ffcheck.nix { })
mp3val
];
services.jellyfin = {
enable = true;
openFirewall = true;
};
services.navidrome = {
enable = true;
openFirewall = true;
settings = {
Address = "0.0.0.0";
MusicFolder = "/library/music";
Scanner.GroupAlbumReleases = "true";
ScanSchedule = "0";
};
};
systemd = {
services.reboot = {
description = "Reboot the system";
serviceConfig = {
Type = "oneshot";
ExecStart = "${pkgs.systemd}/bin/systemctl reboot";
};
};
timers.reboot = {
description = "Reboot the system every two hours";
wantedBy = [ "timers.target" ];
timerConfig = {
OnBootSec = "6h";
Persistent = true;
};
};
};
promptEmoji = "🏰";
time.timeZone = "America/Los_Angeles";
system.stateVersion = "24.05";

View File

@@ -3,22 +3,16 @@
systemd.services.update-dns = {
serviceConfig.Type = "oneshot";
description = "Update the leaf.ninja DNS records";
path = with pkgs; [ curl jq ];
path = with pkgs; [ curl ];
script = ''
public_ip=$(curl -s https://ifconfig.me/ip)
endpoint="https://api.gandi.net/v5/livedns/domains/leaf.ninja/records"
curl -s \
curl \
-X PUT \
-H "Authorization: Bearer ${secrets.gandi.token}" \
-H "Content-Type: application/json" \
-d "{\"rrset_values\":[\"$public_ip\"]}" \
"$ENDPOINT/%2A/A" | jq
curl -s \
-X PUT \
-H "Authorization: Bearer ${secrets.gandi.token}" \
-H "Content-Type: application/json" \
-d "{\"rrset_values\":[\"$public_ip\"]}" \
"$ENDPOINT/%40/A" | jq
$endpoint/ostiary/A
'';
};

20
hosts/monolith/vault.nix Normal file
View File

@@ -0,0 +1,20 @@
{ secrets, ... }:
{
services.vaultwarden = {
enable = true;
config = {
domain = "https://vault.leaf.ninja";
signupsAllowed = false;
rocketAddress = "0.0.0.0";
rocketPort = 8222;
smtpHost = "smtp.migadu.com";
smtpFrom = "vaultwarden@leaf.ninja";
smtpPort = 587;
smtpSecurity = "starttls";
smtpUsername = "vaultwarden@leaf.ninja";
smtpPassword = secrets.vaultwarden.smtpPassword;
};
};
networking.firewall.allowedTCPPorts = [ 8222 ];
}

54
hosts/quasar/default.nix Normal file
View File

@@ -0,0 +1,54 @@
{ self, modulesPath, pkgs, config, secrets, ... }:
{
imports = [
"${modulesPath}/virtualisation/amazon-image.nix"
self.nixosModules.common
self.nixosModules.prompt
self.nixosModules.server
];
networking = {
hostName = "quasar";
domain = "consortium.chat";
firewall.allowedTCPPorts = [ 80 443 ];
};
services.postgresql = {
enable = true;
};
services.caddy = {
enable = true;
virtualHosts = {
"${config.networking.domain}".extraConfig = ''
reverse_proxy localhost:8008
header Strict-Transport-Security "max-age=63072000; includeSubDomains;"
'';
"matrix.${config.networking.domain}".extraConfig = ''
reverse_proxy /_matrix/* localhost:8008
reverse_proxy /_synapse/client/* localhost:8008
'';
"admin.${config.networking.domain}".extraConfig = ''
root * ${pkgs.synapse-admin}
file_server
'';
};
};
services.matrix-synapse = {
enable = true;
settings = {
server_name = config.networking.domain;
serve_server_wellknown = true;
registration_shared_secret = secrets.synapse."consortium.chat".registration-shared-secret;
macaroon_secret_key = secrets.synapse."consortium.chat".macaroon-secret-key;
form_secret = secrets.synapse."consortium.chat".form-secret;
};
};
promptEmoji = "🌟";
time.timeZone = "America/Los_Angeles";
system.stateVersion = "24.05";
}

View File

@@ -1,19 +1,32 @@
{ pkgs, secrets, ... }:
{ pkgs, ... }:
{
nixpkgs.config.allowUnfree = true;
nix.settings = {
experimental-features = [ "nix-command" "flakes" ];
substituters = [
"https://fossar.cachix.org"
# "https://nixcache.shelvacu.com"
];
trusted-public-keys = [
"fossar.cachix.org-1:Zv6FuqIboeHPWQS7ysLCJ7UT7xExb4OE8c4LyGb5AsE="
"nixcache.shelvacu.com:73u5ZGBpPRoVZfgNJQKYYBt9K9Io/jPwgUfuOLsJbsM="
];
trusted-users = [ "@wheel" ];
};
users.users.nettika = {
isNormalUser = true;
extraGroups = [ "wheel" "networkmanager" ];
shell = pkgs.fish;
};
security.sudo.wheelNeedsPassword = false;
environment.variables = {
EDITOR = "nano";
};
programs.git = {
enable = true;
lfs.enable = true;
@@ -35,13 +48,13 @@
'';
};
services.zerotierone = {
programs.fish = {
enable = true;
joinNetworks = secrets.zerotier.networks;
};
environment.systemPackages = with pkgs; [
git-crypt
htop
jq
];
}

30
modules/prompt.nix Normal file
View File

@@ -0,0 +1,30 @@
{ lib, config, ... }:
{
options.promptEmoji = lib.mkOption {
type = lib.types.str;
};
config.programs.bash.promptInit = ''
PS1="\[\e]0;\u@\h: \w\a\]\n${config.promptEmoji} \[\033[1;$((UID ? 32 : 31))m\]\w \\$\[\033[0m\] "
'';
config.programs.fish = {
promptInit = ''
function fish_prompt
echo -n '${config.promptEmoji} '
set_color brgreen
echo -n (prompt_pwd)
set_color normal
echo -n ' > '
end
function fish_right_prompt
set_color bryellow
echo -n (git branch --show-current 2>/dev/null)
end
'';
shellInit = ''
set -g fish_greeting
set -g fish_prompt_pwd_full_dirs 999
'';
};
}

7
modules/zerotier.nix Normal file
View File

@@ -0,0 +1,7 @@
{ secrets, ... }:
{
services.zerotierone = {
enable = true;
joinNetworks = secrets.zerotier.networks;
};
}

Binary file not shown.