mirror of
https://github.com/SebastianStork/nixos-config.git
synced 2026-03-22 23:29:08 +01:00
Compare commits
3 commits
d8ce0a52ed
...
6e8cea6a1f
| Author | SHA1 | Date | |
|---|---|---|---|
| 6e8cea6a1f | |||
| b36627095a | |||
| f8b30ac57b |
2 changed files with 56 additions and 3 deletions
53
flake-parts/nebula.nix
Normal file
53
flake-parts/nebula.nix
Normal file
|
|
@ -0,0 +1,53 @@
|
||||||
|
_: {
|
||||||
|
perSystem =
|
||||||
|
{ self', pkgs, ... }:
|
||||||
|
{
|
||||||
|
devShells.nebula = pkgs.mkShellNoCC {
|
||||||
|
packages = [
|
||||||
|
pkgs.nebula
|
||||||
|
pkgs.bitwarden-cli
|
||||||
|
self'.packages.nebula-regen-host-cert
|
||||||
|
];
|
||||||
|
|
||||||
|
shellHook = ''
|
||||||
|
if ! declare -px BW_SESSION >/dev/null 2>&1; then
|
||||||
|
BW_SESSION="$(bw unlock --raw || bw login --raw)"
|
||||||
|
export BW_SESSION
|
||||||
|
fi
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
packages.nebula-regen-host-cert = pkgs.writeShellApplication {
|
||||||
|
name = "nebula-regen-host-cert";
|
||||||
|
runtimeInputs = [
|
||||||
|
pkgs.nebula
|
||||||
|
pkgs.bitwarden-cli
|
||||||
|
];
|
||||||
|
text = ''
|
||||||
|
if [[ $# -ne 1 ]]; then
|
||||||
|
echo "Usage: $0 <host>"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
host="$1"
|
||||||
|
address="$(nix eval --raw ".#nixosConfigurations.$host.config.custom.networking.overlay.cidr")"
|
||||||
|
ca_cert='modules/system/services/nebula/ca.crt'
|
||||||
|
host_pub="$(nix eval --raw ".#nixosConfigurations.$host.config.custom.services.nebula.publicKeyPath")"
|
||||||
|
host_cert="$(nix eval --raw ".#nixosConfigurations.$host.config.custom.services.nebula.certificatePath")"
|
||||||
|
host_cert="''${host_cert#*-source/}"
|
||||||
|
|
||||||
|
if ! declare -px BW_SESSION >/dev/null 2>&1; then
|
||||||
|
BW_SESSION="$(bw unlock --raw || bw login --raw)"
|
||||||
|
fi
|
||||||
|
|
||||||
|
ca_key="$(mktemp)"
|
||||||
|
chmod 600 "$ca_key"
|
||||||
|
trap 'rm -f "$ca_key"' EXIT
|
||||||
|
bw get notes 'nebula ca-key' > "$ca_key"
|
||||||
|
|
||||||
|
rm -f "$host_cert"
|
||||||
|
nebula-cert sign -name "$host" -networks "$address" -ca-crt "$ca_cert" -ca-key "$ca_key" -in-pub "$host_pub" -out-crt "$host_cert"
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
@ -65,9 +65,9 @@
|
||||||
"nix.serverPath" = lib.getExe pkgs.nixd;
|
"nix.serverPath" = lib.getExe pkgs.nixd;
|
||||||
"nix.formatterPath" = lib.getExe pkgs.nixfmt-rfc-style;
|
"nix.formatterPath" = lib.getExe pkgs.nixfmt-rfc-style;
|
||||||
"nix.serverSettings.nixd.formatting.command" = [ (lib.getExe pkgs.nixfmt-rfc-style) ];
|
"nix.serverSettings.nixd.formatting.command" = [ (lib.getExe pkgs.nixfmt-rfc-style) ];
|
||||||
"github.copilot.enable" = {
|
"github.copilot.enable"."*" = false;
|
||||||
"*" = false;
|
"chat.fontSize" = 15;
|
||||||
};
|
"chat.editor.fontSize" = 15;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
in
|
in
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue