Kieran's opinionated (and probably slightly dumb) nix config

Compare changes

Choose any two refs to compare.

Changed files
+609 -201
.github
workflows
machines
modules
packages
+8
.github/workflows/deploy.yaml
···
- name: Install Nix
uses: DeterminateSystems/determinate-nix-action@main
+
with:
+
extra-conf: |
+
extra-platforms = aarch64-linux
+
+
- name: Set up QEMU
+
uses: docker/setup-qemu-action@v3
+
with:
+
platforms: arm64
- name: Setup Tailscale
uses: tailscale/github-action@v3
-1
README.md
···
โ”œโ”€โ”€ machines
โ”‚ โ”œโ”€โ”€ atalanta # my macOS M4 machine
โ”‚ โ”œโ”€โ”€ ember # my dell r210 server (in my basement)
-
โ”‚ โ”œโ”€โ”€ john # shared server for cedarville
โ”‚ โ”œโ”€โ”€ moonlark # my framework 13 <dead>
โ”‚ โ”œโ”€โ”€ nest # shared tilde server through hc
โ”‚ โ”œโ”€โ”€ prattle # oracle cloud x86_64 server
+112 -26
flake.lock
···
]
},
"locked": {
-
"lastModified": 1764627417,
-
"narHash": "sha256-D6xc3Rl8Ab6wucJWdvjNsGYGSxNjQHzRc2EZ6eeQ6l4=",
+
"lastModified": 1765326679,
+
"narHash": "sha256-fTLX9kDwLr9Y0rH/nG+h1XG5UU+jBcy0PFYn5eneRX8=",
"owner": "nix-community",
"repo": "disko",
-
"rev": "5a88a6eceb8fd732b983e72b732f6f4b8269bef3",
+
"rev": "d64e5cdca35b5fad7c504f615357a7afe6d9c49e",
"type": "github"
},
"original": {
···
"type": "github"
}
},
+
"flake-utils_7": {
+
"inputs": {
+
"systems": "systems_10"
+
},
+
"locked": {
+
"lastModified": 1731533236,
+
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
+
"owner": "numtide",
+
"repo": "flake-utils",
+
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
+
"type": "github"
+
},
+
"original": {
+
"owner": "numtide",
+
"repo": "flake-utils",
+
"type": "github"
+
}
+
},
"flare": {
"inputs": {
"flake-utils": "flake-utils_3",
···
]
},
"locked": {
-
"lastModified": 1765170903,
-
"narHash": "sha256-O8VTGey1xxiRW+Fpb+Ps9zU7ShmxUA1a7cMTcENCVNg=",
+
"lastModified": 1765384171,
+
"narHash": "sha256-FuFtkJrW1Z7u+3lhzPRau69E0CNjADku1mLQQflUORo=",
"owner": "nix-community",
"repo": "home-manager",
-
"rev": "20561be440a11ec57a89715480717baf19fe6343",
+
"rev": "44777152652bc9eacf8876976fa72cc77ca8b9d8",
"type": "github"
},
"original": {
···
"nixpkgs": "nixpkgs_3"
},
"locked": {
-
"lastModified": 1765159287,
-
"narHash": "sha256-C+dVEekU31QPaPShMaUbs3LqOVVqzq0b4gKC1jX8Mlk=",
+
"lastModified": 1765418662,
+
"narHash": "sha256-8SSYagIUn+m9CKUYddq3DN1xkh04KCO0itB/LMgEgpc=",
"owner": "nix-community",
"repo": "nix-vscode-extensions",
-
"rev": "dccd0cc3693bff67e4856b5a22445223aabc4d4b",
+
"rev": "0f6679daa3f5bc2b09827b67f49caf0ac8e3a4c8",
"type": "github"
},
"original": {
···
},
"nixos-facter-modules": {
"locked": {
-
"lastModified": 1764252389,
-
"narHash": "sha256-3bbuneTKZBkYXlm0bE36kUjiDsasoIC1GWBw/UEJ9T4=",
+
"lastModified": 1765442039,
+
"narHash": "sha256-k3lYQ+A1F7aTz8HnlU++bd9t/x/NP2A4v9+x6opcVg0=",
"owner": "numtide",
"repo": "nixos-facter-modules",
-
"rev": "5ea68886d95218646d11d3551a476d458df00778",
+
"rev": "9dd775ee92de63f14edd021d59416e18ac2c00f1",
"type": "github"
},
"original": {
···
},
"nixpkgs-unstable": {
"locked": {
-
"lastModified": 1764950072,
-
"narHash": "sha256-BmPWzogsG2GsXZtlT+MTcAWeDK5hkbGRZTeZNW42fwA=",
+
"lastModified": 1765186076,
+
"narHash": "sha256-hM20uyap1a0M9d344I692r+ik4gTMyj60cQWO+hAYP8=",
"owner": "nixos",
"repo": "nixpkgs",
-
"rev": "f61125a668a320878494449750330ca58b78c557",
+
"rev": "addf7cf5f383a3101ecfba091b98d0a1263dc9b8",
"type": "github"
},
"original": {
···
},
"nixpkgs_4": {
"locked": {
-
"lastModified": 1764983851,
-
"narHash": "sha256-y7RPKl/jJ/KAP/VKLMghMgXTlvNIJMHKskl8/Uuar7o=",
+
"lastModified": 1765311797,
+
"narHash": "sha256-mSD5Ob7a+T2RNjvPvOA1dkJHGVrNVl8ZOrAwBjKBDQo=",
"owner": "nixos",
"repo": "nixpkgs",
-
"rev": "d9bc5c7dceb30d8d6fafa10aeb6aa8a48c218454",
+
"rev": "09eb77e94fa25202af8f3e81ddc7353d9970ac1b",
"type": "github"
},
"original": {
···
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
+
"repo": "nixpkgs",
+
"type": "github"
+
}
+
},
+
"nixpkgs_8": {
+
"locked": {
+
"lastModified": 1764635402,
+
"narHash": "sha256-6rYcajRLe2C5ZYnV1HYskJl+QAkhvseWTzbdQiTN9OI=",
+
"owner": "nixos",
+
"repo": "nixpkgs",
+
"rev": "5f53b0d46d320352684242d000b36dcfbbf7b0bc",
+
"type": "github"
+
},
+
"original": {
+
"owner": "nixos",
"repo": "nixpkgs",
"type": "github"
}
···
},
"locked": {
-
"lastModified": 1765213466,
-
"narHash": "sha256-JdQa7m3a/oWun8TGJ+jamAdxn820RFjqDLNnl4d8a+0=",
+
"lastModified": 1765470296,
+
"narHash": "sha256-bURojPUn8jloR046JNZf6qrYNmEPfFEoDaLTKoP9pg4=",
"owner": "nix-community",
"repo": "NUR",
-
"rev": "0c5cabc4f46e5ce7e45827c22b21173a887acff2",
+
"rev": "441a70568483c0c48b338cca2030e3d9c7aef3ba",
"type": "github"
},
"original": {
···
"spicetify-nix": "spicetify-nix",
"tangled": "tangled",
"terminal-wakatime": "terminal-wakatime",
-
"wakatime-ls": "wakatime-ls"
+
"wakatime-ls": "wakatime-ls",
+
"zmx": "zmx"
},
"rust-overlay": {
···
"type": "github"
},
+
"systems_10": {
+
"locked": {
+
"lastModified": 1681028828,
+
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
+
"owner": "nix-systems",
+
"repo": "default",
+
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
+
"type": "github"
+
},
+
"original": {
+
"owner": "nix-systems",
+
"repo": "default",
+
"type": "github"
+
}
+
},
"systems_2": {
"locked": {
"lastModified": 1681028828,
···
"sqlite-lib-src": "sqlite-lib-src"
},
"locked": {
-
"lastModified": 1765171220,
-
"narHash": "sha256-K+Cs6k0nQYRwW+RwlKCZabLBOVel84C2wPEZjYOH6JA=",
+
"lastModified": 1765368304,
+
"narHash": "sha256-Q3JC5+FYtsKJU70WIhGhsAYWzu0CvUmmbdYhcFe46Pg=",
"ref": "refs/heads/master",
-
"rev": "ca8217e99806280fa77316b46b0b243647ed491c",
-
"revCount": 1722,
+
"rev": "a53d124ea4746109c1933f7adc72f0bde1309890",
+
"revCount": 1731,
"type": "git",
"url": "https://tangled.org/tangled.org/core"
},
···
"original": {
"owner": "mrnossiom",
"repo": "wakatime-ls",
+
"type": "github"
+
}
+
},
+
"zig2nix": {
+
"inputs": {
+
"flake-utils": "flake-utils_7",
+
"nixpkgs": "nixpkgs_8"
+
},
+
"locked": {
+
"lastModified": 1764678235,
+
"narHash": "sha256-NNQWR3DAufaH7fs6ZplfAv1xPHEc0Ne3Z0v4MNHCqSw=",
+
"owner": "Cloudef",
+
"repo": "zig2nix",
+
"rev": "8b6ec85bccdf6b91ded19e9ef671205937e271e6",
+
"type": "github"
+
},
+
"original": {
+
"owner": "Cloudef",
+
"repo": "zig2nix",
+
"type": "github"
+
}
+
},
+
"zmx": {
+
"inputs": {
+
"zig2nix": "zig2nix"
+
},
+
"locked": {
+
"lastModified": 1765397837,
+
"narHash": "sha256-nMlS9SA8MLJHJ0X/zEg3eG18mLw5vvZpZBbTbVcGFTI=",
+
"owner": "neurosnap",
+
"repo": "zmx",
+
"rev": "a22dba538a31480ed450b389f397e15880a1c53a",
+
"type": "github"
+
},
+
"original": {
+
"owner": "neurosnap",
+
"repo": "zmx",
"type": "github"
+7
flake.nix
···
url = "github:taciturnaxolotl/battleship-arena";
inputs.nixpkgs.follows = "nixpkgs";
};
+
+
zmx = {
+
url = "github:neurosnap/zmx";
+
};
};
outputs =
···
hash = "sha256-7mkrPl2CQSfc1lRjl1ilwxdYcK5iRU//QGKmdCicK30=";
};
});
+
+
zmx-binary = prev.callPackage ./packages/zmx.nix { };
})
];
};
···
home-manager.darwinModules.home-manager
agenix.darwinModules.default
unstable-overlays
+
nur.modules.darwin.default
./machines/atalanta
];
};
+68 -2
machines/atalanta/home/default.nix
···
(inputs.import-tree ../../../modules/home)
];
-
nixpkgs.enable = true;
-
home = {
username = "kierank";
homeDirectory = "/Users/kierank";
···
bore = {
enable = true;
authTokenFile = osConfig.age.secrets.frp-auth-token.path;
+
};
+
ssh = {
+
enable = true;
+
+
zmx = {
+
enable = true;
+
hosts = [ "t.*" "p.*" "e.*" "j.*" ];
+
};
+
+
hosts = {
+
# Dynamic zmx sessions per server
+
"t.*" = {
+
hostname = "150.136.15.177"; # terebithia
+
};
+
+
"p.*" = {
+
hostname = "150.136.63.103"; # prattle
+
};
+
+
"e.*" = {
+
hostname = "192.168.0.94"; # ember
+
};
+
+
"j.*" = {
+
hostname = "john.cedarville.edu";
+
user = "klukas";
+
};
+
+
# Regular hosts
+
john = {
+
hostname = "john.cedarville.edu";
+
user = "klukas";
+
zmx = true;
+
};
+
+
bandit = {
+
hostname = "bandit.labs.overthewire.org";
+
port = 2220;
+
};
+
+
kali = {
+
user = "kali";
+
};
+
+
terebithia = {
+
hostname = "150.136.15.177";
+
zmx = true;
+
};
+
+
prattle = {
+
hostname = "150.136.63.103";
+
zmx = true;
+
};
+
+
ember = {
+
hostname = "192.168.0.94";
+
zmx = true;
+
};
+
+
remarkable = {
+
hostname = "10.11.99.01";
+
user = "root";
+
};
+
};
+
+
extraConfig = ''
+
IdentityFile ~/.ssh/id_rsa
+
'';
};
};
+1
machines/atalanta/home-manager.nix
···
];
home-manager = {
+
useGlobalPkgs = true;
extraSpecialArgs = {
inherit inputs outputs;
};
+5
machines/ember/default.nix
···
{
imports = [
(inputs.import-tree ../../modules/home)
+
../../modules/home/system/nixpkgs.nix.disabled
];
nixpkgs.enable = true;
···
shell.enable = true;
apps = {
helix.enable = true;
+
};
+
ssh = {
+
enable = true;
+
zmx.enable = true;
};
};
-35
machines/john/default.nix
···
-
{
-
inputs,
-
pkgs,
-
...
-
}:
-
{
-
imports = [
-
(inputs.import-tree ../../modules/home)
-
];
-
-
nixpkgs.enable = true;
-
-
home = {
-
username = "klukas";
-
homeDirectory = "/home/students/2029/klukas";
-
-
packages = with pkgs; [ ];
-
};
-
-
atelier = {
-
shell.enable = true;
-
};
-
-
# Enable home-manager
-
programs.home-manager.enable = true;
-
-
# keep hm in .local/state since we are using nix-portable
-
xdg.enable = true;
-
-
# Nicely reload system units when changing configs
-
systemd.user.startServices = "sd-switch";
-
-
# https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion
-
home.stateVersion = "23.05";
-
}
-2
machines/moonlark/home/default.nix
···
(inputs.import-tree ../../../modules/home)
];
-
nixpkgs.enable = true;
-
home = {
username = "kierank";
homeDirectory = "/home/kierank";
+1
machines/moonlark/home-manager.nix
···
];
home-manager = {
+
useGlobalPkgs = true;
extraSpecialArgs = {
inherit inputs outputs;
};
+5
machines/nest/default.nix
···
{
imports = [
(inputs.import-tree ../../modules/home)
+
../../modules/home/system/nixpkgs.nix.disabled
];
nixpkgs.enable = true;
···
shell.enable = true;
apps = {
helix.enable = true;
+
};
+
ssh = {
+
enable = true;
+
zmx.enable = true;
};
};
+7 -2
machines/prattle/home/default.nix
···
(inputs.import-tree ../../../modules/home)
];
-
nixpkgs.enable = true;
-
home = {
username = "kierank";
homeDirectory = "/home/kierank";
+
};
+
+
atelier = {
+
ssh = {
+
enable = true;
+
zmx.enable = true;
+
};
};
programs.home-manager.enable = true;
+1
machines/prattle/home-manager.nix
···
];
home-manager = {
+
useGlobalPkgs = true;
extraSpecialArgs = {
inherit inputs outputs;
};
+1
machines/tacyon/default.nix
···
{
imports = [
(inputs.import-tree ../../modules/home)
+
../../modules/home/system/nixpkgs.nix.disabled
];
nixpkgs.enable = true;
+4 -2
machines/terebithia/home/default.nix
···
(inputs.import-tree ../../../modules/home)
];
-
nixpkgs.enable = true;
-
home = {
username = "kierank";
homeDirectory = "/home/kierank";
···
apps = {
helix.enable = true;
irssi.enable = true;
+
};
+
ssh = {
+
enable = true;
+
zmx.enable = true;
};
};
+1
machines/terebithia/home-manager.nix
···
];
home-manager = {
+
useGlobalPkgs = true;
extraSpecialArgs = {
inherit inputs outputs;
};
+23 -1
modules/home/apps/bore/default.nix
···
;;
esac
done
+
+
# Prompt for label if not provided via flag and not loaded from saved config
+
if [ -z "$label" ]; then
+
echo
+
# Allow multiple labels selection
+
labels=$(${pkgs.gum}/bin/gum choose --no-limit --header "Labels (select multiple):" "dev" "prod" "custom")
+
+
if [ -n "$labels" ]; then
+
# Check if custom was selected
+
if echo "$labels" | ${pkgs.gnugrep}/bin/grep -q "custom"; then
+
custom_label=$(${pkgs.gum}/bin/gum input --placeholder "my-label" --prompt "Custom label: ")
+
if [ -z "$custom_label" ]; then
+
${pkgs.gum}/bin/gum style --foreground 196 "No custom label provided"
+
exit 1
+
fi
+
# Replace 'custom' with the actual custom label
+
labels=$(echo "$labels" | ${pkgs.gnused}/bin/sed "s/custom/$custom_label/")
+
fi
+
# Join labels with comma
+
label=$(echo "$labels" | ${pkgs.coreutils}/bin/tr '\n' ',' | ${pkgs.gnused}/bin/sed 's/,$//')
+
fi
+
fi
fi
# Check if local port is accessible
···
config_file=$(${pkgs.coreutils}/bin/mktemp)
trap "${pkgs.coreutils}/bin/rm -f $config_file" EXIT
-
# Encode label into proxy name if provided (format: subdomain[label])
+
# Encode label into proxy name if provided (format: subdomain[label1,label2])
proxy_name="$subdomain"
if [ -n "$label" ]; then
proxy_name="''${subdomain}[''${label}]"
+183
modules/home/apps/ssh.nix
···
+
{
+
config,
+
lib,
+
pkgs,
+
inputs,
+
...
+
}:
+
with lib;
+
let
+
cfg = config.atelier.ssh;
+
in
+
{
+
options.atelier.ssh = {
+
enable = mkEnableOption "SSH configuration";
+
+
zmx = {
+
enable = mkEnableOption "zmx integration for persistent sessions";
+
hosts = mkOption {
+
type = types.listOf types.str;
+
default = [ ];
+
description = "List of host patterns to enable zmx auto-attach (e.g., 'd.*')";
+
};
+
};
+
+
extraConfig = mkOption {
+
type = types.lines;
+
default = "";
+
description = "Extra SSH configuration";
+
};
+
+
hosts = mkOption {
+
type = types.attrsOf (
+
types.submodule {
+
options = {
+
hostname = mkOption {
+
type = types.nullOr types.str;
+
default = null;
+
description = "Hostname or IP address";
+
};
+
+
port = mkOption {
+
type = types.nullOr types.int;
+
default = null;
+
description = "SSH port";
+
};
+
+
user = mkOption {
+
type = types.nullOr types.str;
+
default = null;
+
description = "Username for SSH connection";
+
};
+
+
identityFile = mkOption {
+
type = types.nullOr types.str;
+
default = null;
+
description = "Path to SSH identity file";
+
};
+
+
forwardAgent = mkOption {
+
type = types.nullOr types.bool;
+
default = null;
+
description = "Enable SSH agent forwarding";
+
};
+
+
extraOptions = mkOption {
+
type = types.attrsOf types.str;
+
default = { };
+
description = "Additional SSH options for this host";
+
};
+
+
zmx = mkOption {
+
type = types.bool;
+
default = false;
+
description = "Enable zmx persistent sessions for this host";
+
};
+
};
+
}
+
);
+
default = { };
+
description = "SSH host configurations";
+
};
+
};
+
+
config = mkIf cfg.enable {
+
# zmx provides pre-built binaries that we download instead of building from source
+
# This avoids the zig2nix dependency which causes issues in CI
+
home.packages =
+
(optionals cfg.zmx.enable [
+
pkgs.zmx-binary
+
pkgs.autossh
+
]);
+
+
programs.ssh = {
+
enable = true;
+
enableDefaultConfig = false;
+
+
matchBlocks =
+
let
+
# Convert atelier.ssh.hosts to SSH matchBlocks
+
hostConfigs = mapAttrs (
+
name: hostCfg:
+
{
+
hostname = mkIf (hostCfg.hostname != null) hostCfg.hostname;
+
port = mkIf (hostCfg.port != null) hostCfg.port;
+
user = mkIf (hostCfg.user != null) hostCfg.user;
+
identityFile = mkIf (hostCfg.identityFile != null) hostCfg.identityFile;
+
forwardAgent = mkIf (hostCfg.forwardAgent != null) hostCfg.forwardAgent;
+
extraOptions = hostCfg.extraOptions // (
+
if hostCfg.zmx then
+
{
+
RemoteCommand = "export PATH=$HOME/.nix-profile/bin:$PATH; zmx attach %n";
+
RequestTTY = "yes";
+
ControlPath = "~/.ssh/cm-%r@%h:%p";
+
ControlMaster = "auto";
+
ControlPersist = "10m";
+
}
+
else
+
{ }
+
);
+
}
+
) cfg.hosts;
+
+
# Create zmx pattern hosts if enabled
+
zmxPatternHosts = if cfg.zmx.enable then
+
listToAttrs (
+
map (pattern:
+
let
+
patternHost = cfg.hosts.${pattern} or {};
+
in {
+
name = pattern;
+
value = {
+
hostname = mkIf (patternHost.hostname or null != null) patternHost.hostname;
+
port = mkIf (patternHost.port or null != null) patternHost.port;
+
user = mkIf (patternHost.user or null != null) patternHost.user;
+
extraOptions = {
+
RemoteCommand = "export PATH=$HOME/.nix-profile/bin:$PATH; zmx attach %k";
+
RequestTTY = "yes";
+
ControlPath = "~/.ssh/cm-%r@%h:%p";
+
ControlMaster = "auto";
+
ControlPersist = "10m";
+
};
+
};
+
}) cfg.zmx.hosts
+
)
+
else
+
{ };
+
+
# Default match block for extraConfig
+
defaultBlock = if cfg.extraConfig != "" then
+
{
+
"*" = { };
+
}
+
else
+
{ };
+
in
+
defaultBlock // hostConfigs // zmxPatternHosts;
+
+
extraConfig = cfg.extraConfig;
+
};
+
+
# Add shell aliases for easier zmx usage
+
programs.zsh.shellAliases = mkIf cfg.zmx.enable {
+
zmls = "zmx list";
+
zmk = "zmx kill";
+
zma = "zmx attach";
+
ash = "autossh -M 0 -q";
+
};
+
+
programs.bash.shellAliases = mkIf cfg.zmx.enable {
+
zmls = "zmx list";
+
zmk = "zmx kill";
+
zma = "zmx attach";
+
ash = "autossh -M 0 -q";
+
};
+
+
programs.fish.shellAliases = mkIf cfg.zmx.enable {
+
zmls = "zmx list";
+
zmk = "zmx kill";
+
zma = "zmx attach";
+
ash = "autossh -M 0 -q";
+
};
+
};
+
}
-85
modules/home/apps/vscode.nix
···
-
{
-
lib,
-
pkgs,
-
config,
-
inputs,
-
...
-
}:
-
{
-
options.atelier.apps.vscode.enable = lib.mkEnableOption "Enable VSCode config";
-
config = lib.mkIf config.atelier.apps.vscode.enable {
-
nixpkgs.overlays = [
-
inputs.nix-vscode-extensions.overlays.default
-
inputs.catppuccin-vsc.overlays.default
-
];
-
programs.vscode = {
-
enable = true;
-
package = pkgs.unstable.vscode;
-
profiles.default = {
-
extensions = with pkgs.vscode-marketplace; [
-
ms-vscode.live-server
-
formulahendry.auto-rename-tag
-
edwinkofler.vscode-assorted-languages
-
golang.go
-
eamodio.gitlens
-
yzhang.markdown-all-in-one
-
github.vscode-github-actions
-
yoavbls.pretty-ts-errors
-
esbenp.prettier-vscode
-
ms-vscode.vscode-serial-monitor
-
prisma.prisma
-
ms-azuretools.vscode-docker
-
astro-build.astro-vscode
-
github.copilot
-
github.copilot-chat
-
dotjoshjohnson.xml
-
mikestead.dotenv
-
bradlc.vscode-tailwindcss
-
mechatroner.rainbow-csv
-
wakatime.vscode-wakatime
-
paulober.pico-w-go
-
ms-python.python
-
karunamurti.tera
-
biomejs.biome
-
bschulte.love
-
yinfei.luahelper
-
tamasfe.even-better-toml
-
fill-labs.dependi
-
rust-lang.rust-analyzer
-
dustypomerleau.rust-syntax
-
catppuccin.catppuccin-vsc
-
inputs.frc-nix.packages.${pkgs.stdenv.hostPlatform.system}.vscode-wpilib
-
];
-
userSettings = {
-
"editor.semanticHighlighting.enabled" = true;
-
"terminal.integrated.minimumContrastRatio" = 1;
-
"window.titleBarStyle" = "custom";
-
"gopls" = {
-
"ui.semanticTokens" = true;
-
};
-
"workbench.colorTheme" = "Catppuccin Macchiato";
-
"workbench.iconTheme" = "catppuccin-macchiato";
-
"catppuccin.accentColor" = lib.mkForce "blue";
-
"editor.fontFamily" = "'FiraCode Nerd Font', 'monospace', monospace";
-
"git.autofetch" = true;
-
"git.confirmSync" = false;
-
"github.copilot.editor.enableAutoCompletions" = false;
-
"editor.formatOnSave" = true;
-
"editor.defaultFormatter" = "biomejs.biome";
-
"[go]" = {
-
"editor.defaultFormatter" = "golang.go";
-
};
-
"[yaml]" = {
-
"editor.defaultFormatter" = "esbenp.prettier-vscode";
-
};
-
"[lua]" = {
-
"editor.defaultFormatter" = "yinfei.luahelper";
-
};
-
"[html]" = {
-
"editor.defaultFormatter" = "esbenp.prettier-vscode";
-
};
-
};
-
};
-
};
-
};
-
}
-26
modules/home/system/nixpkgs.nix
···
-
{
-
lib,
-
pkgs,
-
config,
-
inputs,
-
...
-
}:
-
{
-
options.nixpkgs.enable = lib.mkEnableOption "Enable custom nixpkgs overlays/config";
-
config = lib.mkIf config.nixpkgs.enable {
-
nixpkgs = {
-
overlays = [
-
(final: prev: {
-
unstable = import inputs.nixpkgs-unstable {
-
inherit (pkgs.stdenv.hostPlatform) system;
-
config.allowUnfree = true;
-
};
-
})
-
];
-
config = {
-
allowUnfree = true;
-
allowUnfreePredicate = _: true;
-
};
-
};
-
};
-
}
+26
modules/home/system/nixpkgs.nix.disabled
···
+
{
+
lib,
+
pkgs,
+
config,
+
inputs,
+
...
+
}:
+
{
+
options.nixpkgs.enable = lib.mkEnableOption "Enable custom nixpkgs overlays/config";
+
config = lib.mkIf config.nixpkgs.enable {
+
nixpkgs = {
+
overlays = [
+
(final: prev: {
+
unstable = import inputs.nixpkgs-unstable {
+
inherit (pkgs.stdenv.hostPlatform) system;
+
config.allowUnfree = true;
+
};
+
})
+
];
+
config = {
+
allowUnfree = true;
+
allowUnfreePredicate = _: true;
+
};
+
};
+
};
+
}
+9 -2
modules/home/system/shell.nix
···
template = "{{ if .SSHSession }}{{.HostName}} {{ end }}";
}
{
+
type = "text";
+
style = "plain";
+
background = "transparent";
+
foreground = "green";
+
template = "{{ if .Env.ZMX_SESSION }}[{{ .Env.ZMX_SESSION }}] {{ end }}";
+
}
+
{
type = "path";
style = "plain";
background = "transparent";
···
style = "plain";
foreground_templates = [
"{{if gt .Code 0}}red{{end}}"
-
"{{if eq .Code 0}}magenta{{end}}"
+
"{{if eq .Code 0}}{{if .Env.SSH_CONNECTION}}cyan{{else}}magenta{{end}}{{end}}"
];
background = "transparent";
template = "โฏ";
···
transient_prompt = {
foreground_templates = [
"{{if gt .Code 0}}red{{end}}"
-
"{{if eq .Code 0}}magenta{{end}}"
+
"{{if eq .Code 0}}{{if .Env.SSH_CONNECTION}}cyan{{else}}magenta{{end}}{{end}}"
];
background = "transparent";
template = "โฏ ";
+32
modules/nixos/services/bore/README.md
···
+
# Bore
+
+
![screenshot](https://hc-cdn.hel1.your-objectstorage.com/s/v3/7652f29dacb8f76d_screenshot_2025-12-09_at_16.57.47.png)
+
+
Bore is a lightweight wrapper around `frp` which provides a dashboard and a nice `gum` based cli. If you would like to run this in your own nix flake then simplify vendor this folder and `./modules/home/bore` and import the folders into the appropriate home manager and nixos configurations.
+
+
```nix
+
atelier = {
+
bore = {
+
enable = true;
+
authTokenFile = osConfig.age.secrets.bore.path
+
};
+
}
+
```
+
+
and be sure to have a definition for your agenix secret in the osConfig as well:
+
+
```nix
+
age = {
+
identityPaths = [
+
"path/to/ssh/key"
+
];
+
secrets = {
+
bore = {
+
file = ./path/to/bore.age;
+
owner = "username";
+
};
+
};
+
}
+
```
+
+
The secret file is just a oneline file with the key in it. If you do end up deploying this feel free to email me and let me know! I would love to hear about your setup!
-5
modules/nixos/services/bore/bore.nix
···
Strict-Transport-Security "max-age=31536000; includeSubDomains; preload"
}
-
# Proxy /metrics to frps dashboard
-
handle /metrics {
-
reverse_proxy localhost:7400
-
}
-
# Proxy /api/* to frps dashboard
handle /api/* {
reverse_proxy localhost:7400
+67 -12
modules/nixos/services/bore/dashboard.html
···
.tunnel-label {
display: inline-block;
padding: 0.125rem 0.5rem;
-
background: rgba(251, 146, 60, 0.2);
-
color: #fb923c;
-
border: 1px solid #fb923c;
font-size: 0.7rem;
font-weight: 500;
border-radius: 0;
+
margin-left: 0.25rem;
+
border: 1px solid;
}
.tunnel-url {
···
const MAX_FAIL_COUNT = 3;
let lastProxiesState = null;
+
// Predefined color palette for labels
+
const labelColors = [
+
{ color: '#a78bfa', bg: 'rgba(167, 139, 250, 0.2)' }, // purple
+
{ color: '#f472b6', bg: 'rgba(244, 114, 182, 0.2)' }, // pink
+
{ color: '#facc15', bg: 'rgba(250, 204, 21, 0.2)' }, // yellow
+
{ color: '#60a5fa', bg: 'rgba(96, 165, 250, 0.2)' }, // blue
+
{ color: '#f87171', bg: 'rgba(248, 113, 113, 0.2)' }, // red
+
{ color: '#38bdf8', bg: 'rgba(56, 189, 248, 0.2)' }, // sky
+
{ color: '#c084fc', bg: 'rgba(192, 132, 252, 0.2)' }, // violet
+
{ color: '#fb7185', bg: 'rgba(251, 113, 133, 0.2)' }, // rose
+
];
+
+
// Hash string to index
+
function stringToColorIndex(str) {
+
let hash = 0;
+
for (let i = 0; i < str.length; i++) {
+
hash = str.charCodeAt(i) + ((hash << 5) - hash);
+
}
+
return Math.abs(hash) % labelColors.length;
+
}
+
+
// Get label color and styles
+
function getLabelStyle(label) {
+
const trimmedLabel = label.trim();
+
if (trimmedLabel === 'prod') {
+
return {
+
color: '#22c55e',
+
bgColor: 'rgba(34, 197, 94, 0.2)',
+
borderColor: '#22c55e'
+
};
+
}
+
+
if (trimmedLabel === 'dev') {
+
return {
+
color: '#fb923c',
+
bgColor: 'rgba(251, 146, 60, 0.2)',
+
borderColor: '#fb923c'
+
};
+
}
+
+
const colorIndex = stringToColorIndex(trimmedLabel);
+
const colorScheme = labelColors[colorIndex];
+
return {
+
color: colorScheme.color,
+
bgColor: colorScheme.bg,
+
borderColor: colorScheme.color
+
};
+
}
+
async function fetchStats() {
try {
// Fetch server info
···
const subdomain = proxy.conf?.subdomain || 'unknown';
const url = `https://${subdomain}.bore.dunkirk.sh`;
-
// Parse label from proxy name (format: subdomain[label])
+
// Parse labels from proxy name (format: subdomain[label1,label2])
const labelMatch = proxy.name.match(/\[([^\]]+)\]$/);
-
const label = labelMatch ? labelMatch[1] : null;
-
const displayName = label ? proxy.name.replace(/\[[^\]]+\]$/, '') : proxy.name;
+
const labels = labelMatch ? labelMatch[1].split(',') : [];
+
const displayName = labels.length > 0 ? proxy.name.replace(/\[[^\]]+\]$/, '') : proxy.name;
+
+
const labelHtml = labels.map(label => {
+
const trimmedLabel = label.trim();
+
const style = getLabelStyle(trimmedLabel);
+
return `<span class="tunnel-label" style="color: ${style.color}; background: ${style.bgColor}; border-color: ${style.borderColor};">${trimmedLabel}</span>`;
+
}).join('');
return `
<div class="tunnel" data-tunnel="${proxy.name}">
<div class="tunnel-info">
<div class="tunnel-name">
${displayName || 'unnamed'}
-
${label ? `<span class="tunnel-label">${label}</span>` : ''}
+
${labelHtml}
</div>
<div class="tunnel-url">
<a href="${url}" target="_blank">${url}</a>
···
html += '<div class="offline-tunnels">';
html += '<div style="color: #8b949e; font-size: 0.85rem; margin-bottom: 0.75rem;">recently disconnected</div>';
html += offlineTunnels.map(proxy => {
-
// Parse label from proxy name (format: subdomain[label])
+
// Parse labels from proxy name (format: subdomain[label1,label2])
const labelMatch = proxy.name.match(/\[([^\]]+)\]$/);
-
const label = labelMatch ? labelMatch[1] : null;
-
const displayName = label ? proxy.name.replace(/\[[^\]]+\]$/, '') : proxy.name;
+
const labels = labelMatch ? labelMatch[1].split(',').map(l => l.trim()) : [];
+
const displayName = labels.length > 0 ? proxy.name.replace(/\[[^\]]+\]$/, '') : proxy.name;
+
const labelStr = labels.length > 0 ? ` [${labels.join(', ')}]` : '';
if (!proxy.conf) {
return `
<div class="offline-tunnel" data-tunnel="${proxy.name}">
-
<span class="offline-tunnel-name">${displayName || 'unnamed'}${label ? ` [${label}]` : ''}</span>
+
<span class="offline-tunnel-name">${displayName || 'unnamed'}${labelStr}</span>
<span class="offline-tunnel-stats">in: <span data-traffic-in="${proxy.name}">0 B</span> โ€ข out: <span data-traffic-out="${proxy.name}">0 B</span></span>
</div>
`;
···
const url = `https://${subdomain}.bore.dunkirk.sh`;
return `
<div class="offline-tunnel" data-tunnel="${proxy.name}">
-
<span class="offline-tunnel-name">${displayName || 'unnamed'}${label ? ` [${label}]` : ''} โ†’ ${url}</span>
+
<span class="offline-tunnel-name">${displayName || 'unnamed'}${labelStr} โ†’ ${url}</span>
<span class="offline-tunnel-stats">in: <span data-traffic-in="${proxy.name}">0 B</span> โ€ข out: <span data-traffic-out="${proxy.name}">0 B</span></span>
</div>
`;
+48
packages/zmx.nix
···
+
{ pkgs, lib, stdenv, fetchurl, autoPatchelfHook }:
+
+
stdenv.mkDerivation rec {
+
pname = "zmx";
+
version = "0.1.0";
+
+
src = fetchurl {
+
url = if stdenv.isLinux then
+
(if stdenv.isAarch64 then
+
"https://zmx.sh/a/zmx-${version}-linux-aarch64.tar.gz"
+
else
+
"https://zmx.sh/a/zmx-${version}-linux-x86_64.tar.gz")
+
else if stdenv.isDarwin then
+
(if stdenv.isAarch64 then
+
"https://zmx.sh/a/zmx-${version}-macos-aarch64.tar.gz"
+
else
+
"https://zmx.sh/a/zmx-${version}-macos-x86_64.tar.gz")
+
else throw "Unsupported platform";
+
+
hash = if stdenv.isLinux && stdenv.isAarch64 then
+
"sha256-sv83lR4DLJE+gsMtqCk6VCFdo5n4lhI0P1loxAf0iOg="
+
else if stdenv.isLinux then
+
"sha256-c+wCUcm7DEO55wXuHq0aP0Kn908jj1FM5Z+JQJnKE0M="
+
else if stdenv.isDarwin && stdenv.isAarch64 then
+
"sha256-dM6MFikdbpN+n8BK6fLbzyJfi88xetCWL9H5VfGB07o="
+
else
+
"sha256-B52NC8NEjVPDNSG11qPb0uRNExB66bllnK7ivXMJbHk=";
+
};
+
+
nativeBuildInputs = lib.optionals stdenv.isLinux [ autoPatchelfHook ];
+
+
sourceRoot = ".";
+
+
installPhase = ''
+
runHook preInstall
+
mkdir -p $out/bin
+
cp zmx $out/bin/
+
chmod +x $out/bin/zmx
+
runHook postInstall
+
'';
+
+
meta = with lib; {
+
description = "Session persistence for terminal processes";
+
homepage = "https://zmx.sh";
+
license = licenses.mit;
+
platforms = platforms.unix;
+
};
+
}