rewrite to hostname

This commit is contained in:
Andreas Zweili 2022-09-06 23:03:29 +02:00
parent 8c68bd9e88
commit a0bd746957
15 changed files with 41 additions and 46 deletions

View File

@ -4,7 +4,10 @@
modules = (
[
# System configuration for this host
"${inputs.self}/systems/${hostname}"
(import "${inputs.self}/systems/${hostname}" {
lib = pkgs.lib;
inherit custom inputs hostname pkgs;
})
# Common configuration
"${inputs.self}/modules/common-x86"

View File

@ -1,4 +1,4 @@
{ config, inputs, custom, pkgs, time, ... }:
{ hostname, inputs, custom, pkgs, time, ... }:
{
imports = [
"${inputs.self}/modules/telegram-notifications"
@ -34,7 +34,7 @@
${pkgs.restic}/bin/restic forget \
--tag home-dir \
--host ${config.networking.hostName} \
--host ${hostname} \
--keep-daily 7 \
--keep-weekly 5 \
--keep-monthly 12 \
@ -42,7 +42,7 @@
${pkgs.restic}/bin/restic forget \
--tag mariadb \
--host ${config.networking.hostName} \
--host ${hostname} \
--keep-daily 7 \
--keep-weekly 5 \
--keep-monthly 12 \

View File

@ -1,4 +1,4 @@
{ config, inputs, custom, pkgs, ... }:
{ hostname, inputs, custom, pkgs, ... }:
let
password_file = "/home/${custom.username}/.nixos/secrets/passwords/restic.key";
repository = "rest:http://10.7.89.30:8000";
@ -8,7 +8,7 @@ let
${pkgs.restic}/bin/restic \
--repo ${repository} \
--password-file ${password_file} \
--host ${config.networking.hostName} \
--host ${hostname} \
mount /tmp/restic'';
restic-mount-all = pkgs.writeShellScriptBin "restic-mount-all" ''
@ -75,7 +75,7 @@ in
${pkgs.restic}/bin/restic \
forget \
--host ${config.networking.hostName} \
--host ${hostname} \
--tag home-dir \
--keep-hourly 25 \
--keep-daily 7 \
@ -90,7 +90,7 @@ in
${pkgs.restic}/bin/restic \
--repo ${repository} \
--password-file ${password_file} \
snapshots --host ${config.networking.hostName}'';
snapshots --host ${hostname}'';
restic-unlock = ''
${pkgs.restic}/bin/restic \
--repo ${repository} \

View File

@ -1,4 +1,4 @@
{ inputs, ... }:
{ hostname, inputs, ... }:
{
imports = [
"${inputs.self}/modules/desktop"
@ -28,7 +28,7 @@
};
networking = {
hostName = "nixos-vm";
hostName = hostname;
interfaces.enp0s3.useDHCP = true;
};

View File

@ -1,13 +1,12 @@
{ config, custom, inputs, pkgs, ... }:
{ custom, hostname, inputs, pkgs, ... }:
{
imports = [
(import "${inputs.self}/systems/proxmox-vm" {
hostname = "git";
ip = "10.7.89.109";
inherit inputs;
inherit hostname inputs;
})
(import "${inputs.self}/modules/restic-server-mysql-client" {
time = "03:00"; inherit config custom inputs pkgs;
time = "03:00"; inherit custom hostname inputs pkgs;
})
(import "${inputs.self}/modules/nginx-acme" {
domain = "git.2li.ch"; inherit inputs;

View File

@ -1,4 +1,4 @@
{ inputs, lib, ... }:
{ custom, hostname, inputs, lib, pkgs, ... }:
{
imports = [
inputs.nixos-hardware.nixosModules.dell-precision-5530
@ -16,10 +16,10 @@
"${inputs.self}/modules/lockscreen"
"${inputs.self}/modules/logs-share"
"${inputs.self}/modules/nix-direnv"
"${inputs.self}/modules/restic"
"${inputs.self}/modules/scripts"
"${inputs.self}/modules/tlp"
"${inputs.self}/modules/tmux"
(import "${inputs.self}/modules/restic" { inherit custom hostname inputs pkgs; })
];
boot.initrd.availableKernelModules = [
"aesni_intel"
@ -52,7 +52,7 @@
fsType = "vfat";
};
networking.hostName = "gwyn"; # Define your hostname.
networking.hostName = hostname;
swapDevices = [
{ device = "/dev/disk/by-label/swap"; }

View File

@ -1,13 +1,12 @@
{ config, custom, inputs, pkgs, ... }:
{ custom, hostname, inputs, pkgs, ... }:
{
imports = [
(import "${inputs.self}/systems/proxmox-vm" {
hostname = "mail";
ip = "10.7.89.123";
inherit inputs;
inherit hostname inputs;
})
(import "${inputs.self}/modules/restic-server-client" {
time = "04:30"; inherit config custom inputs pkgs;
time = "04:30"; inherit custom hostname inputs pkgs;
})
(import "${inputs.self}/modules/nginx-acme" {
domain = "mail.zweili.org"; inherit inputs;

View File

@ -1,13 +1,12 @@
{ config, custom, inputs, pkgs, ... }:
{ custom, hostname, inputs, pkgs, ... }:
{
imports = [
(import "${inputs.self}/systems/proxmox-vm" {
hostname = "nextcloud";
ip = "10.7.89.103";
inherit inputs;
inherit hostname inputs;
})
(import "${inputs.self}/modules/restic-server-mysql-client" {
time = "04:00"; inherit config custom inputs pkgs;
time = "04:00"; inherit custom hostname inputs pkgs;
})
"${inputs.self}/modules/docker"
"${inputs.self}/modules/mariadb"

View File

@ -1,13 +1,12 @@
{ config, custom, inputs, pkgs, ... }:
{ custom, hostname, inputs, pkgs, ... }:
{
imports = [
(import "${inputs.self}/systems/proxmox-vm" {
hostname = "pihole";
ip = "10.7.89.2";
inherit inputs;
inherit hostname inputs;
})
(import "${inputs.self}/modules/restic-server-client" {
time = "05:00"; inherit config custom inputs pkgs;
time = "05:00"; inherit custom hostname inputs pkgs;
})
"${inputs.self}/modules/docker"
"${inputs.self}/modules/pihole"

View File

@ -1,13 +1,12 @@
{ config, custom, inputs, pkgs, ... }:
{ custom, hostname, inputs, pkgs, ... }:
{
imports = [
(import "${inputs.self}/systems/proxmox-vm" {
hostname = "plex";
ip = "10.7.89.112";
inherit inputs;
inherit hostname inputs;
})
(import "${inputs.self}/modules/restic-server-client" {
time = "03:30"; inherit config custom inputs pkgs;
time = "03:30"; inherit custom hostname inputs pkgs;
})
"${inputs.self}/modules/docker"
"${inputs.self}/modules/plex"

View File

@ -1,4 +1,4 @@
{ config, pkgs, lib, ... }:
{ pkgs, lib, ... }:
{
imports = [ "${fetchTarball "https://github.com/NixOS/nixos-hardware/archive/32f61571b486efc987baca553fb35df22532ba63.tar.gz" }/raspberry-pi/4" ];

View File

@ -1,10 +1,9 @@
{ config, custom, inputs, pkgs, ... }:
{ custom, hostname, inputs, pkgs, ... }:
{
imports = [
(import "${inputs.self}/systems/proxmox-vm" {
hostname = "restic-server";
ip = "10.7.89.30";
inherit inputs;
inherit hostname inputs;
})
"${inputs.self}/modules/restic-server"
];

View File

@ -1,4 +1,4 @@
{ inputs, ... }:
{ hostname, inputs, ... }:
{
imports = [
inputs.nixos-hardware.nixosModules.common-gpu-intel
@ -39,7 +39,7 @@
fsType = "vfat";
};
networking.hostName = "staubfinger";
networking.hostName = hostname;
swapDevices = [
{ device = "/dev/disk/by-label/swap"; }

View File

@ -1,10 +1,9 @@
{ config, custom, inputs, pkgs, ... }:
{ custom, hostname, inputs, pkgs, ... }:
{
imports = [
(import "${inputs.self}/systems/proxmox-vm" {
hostname = "test-server";
ip = "10.7.89.142";
inherit inputs;
inherit hostname inputs;
})
(import "${inputs.self}/modules/nginx-acme" {
domain = "test.2li.ch";

View File

@ -1,16 +1,15 @@
{ config, custom, inputs, pkgs, ... }:
{ custom, hostname, inputs, pkgs, ... }:
{
imports = [
(import "${inputs.self}/systems/proxmox-vm" {
hostname = "ttrss";
ip = "10.7.89.115";
inherit inputs;
inherit hostname inputs;
})
(import "${inputs.self}/modules/nginx-acme" {
domain = "ttrss.2li.ch"; inherit inputs;
})
(import "${inputs.self}/modules/restic-server-mysql-client" {
time = "23:00"; inherit config custom inputs pkgs;
time = "23:00"; inherit custom hostname inputs pkgs;
})
"${inputs.self}/modules/docker"
"${inputs.self}/modules/mariadb"