From eae2bf434ed59240916eb7c9faf549ca8ee2c60e Mon Sep 17 00:00:00 2001 From: RGBCube Date: Wed, 24 Apr 2024 11:46:26 +0300 Subject: [PATCH] Don't repeat the hostname --- hosts/cube/restic/default.nix | 2 +- hosts/cube/site.nix | 4 ++-- modules/git.nix | 12 +++++++----- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/hosts/cube/restic/default.nix b/hosts/cube/restic/default.nix index eaca715..247f849 100644 --- a/hosts/cube/restic/default.nix +++ b/hosts/cube/restic/default.nix @@ -7,7 +7,7 @@ systemConfiguration { passwordFile = config.secrets.resticPassword.path; initialize = true; - repository = "sftp:backup@${self.disk.networking.ipv4}:cube-varlib"; + repository = "sftp:backup@disk:${config.networking.hostName}-varlib"; paths = [ "/var/lib" ]; diff --git a/hosts/cube/site.nix b/hosts/cube/site.nix index c2b5b75..343110b 100644 --- a/hosts/cube/site.nix +++ b/hosts/cube/site.nix @@ -13,11 +13,11 @@ in systemConfiguration { services.nginx = enabled { appendHttpConfig = '' map $http_origin $allow_origin { - ~^https://.+\.rgbcu.be$ $http_origin; + ~^https://.+\.${domain}$ $http_origin; } map $http_origin $allow_methods { - ~^https://.+\.rgbcu.be$ "GET, HEAD, OPTIONS"; + ~^https://.+\.${domain}$ "GET, HEAD, OPTIONS"; } ''; diff --git a/modules/git.nix b/modules/git.nix index 9c31f66..ea51c7e 100644 --- a/modules/git.nix +++ b/modules/git.nix @@ -1,4 +1,4 @@ -{ lib, pkgs, ... }: with lib; merge +{ self, lib, pkgs, ... }: with lib; merge (systemConfiguration { environment.shellAliases = { @@ -64,7 +64,9 @@ }; }) -(homeConfiguration { +(let + gitHost = self.cube.networking.hostName; +in homeConfiguration { programs.nushell.configFile.text = mkAfter '' # Sets the remote origin to the specified user and repository on my git instance def gsr [user_and_repo: string] { @@ -74,7 +76,7 @@ "RGBCube/" + $user_and_repo } - git remote add origin ("https://git.rgbcu.be/" + $user_and_repo) + git remote add origin ("https://git.${gitHost}/" + $user_and_repo) } ''; @@ -82,7 +84,7 @@ package = pkgs.gitFull; userName = "RGBCube"; - userEmail = "git@rgbcu.be"; + userEmail = "git@${gitHost}"; lfs = enabled; @@ -123,7 +125,7 @@ core.sshCommand = "ssh -i ~/.ssh/id"; url."ssh://git@github.com/".insteadOf = "https://github.com/"; - url."ssh://forgejo@rgbcu.be:2222/".insteadOf = "https://git.rgbcu.be/"; + url."ssh://forgejo@${gitHost}:2222/".insteadOf = "https://git.${gitHost}/"; } (mkIf isDesktop { commit.gpgSign = true; tag.gpgSign = true;