create arch_mirror.nix

This commit is contained in:
Richie Cahill 2024-08-03 13:26:50 -04:00
parent 7f73454f75
commit d12ca3fb0e
10 changed files with 227 additions and 31 deletions

11
.vscode/settings.json vendored
View File

@ -12,6 +12,7 @@
"alsa",
"amdgpu",
"amdvlk",
"archlinux",
"artemision",
"asrouter",
"auditd",
@ -48,6 +49,7 @@
"datareporting",
"davidanson",
"dbus",
"deadnix",
"dearrow",
"debugpy",
"devicemap",
@ -114,10 +116,15 @@
"KRNL",
"kuma",
"libexec",
"libglvnd",
"libmysqlclient",
"libsodium",
"libssh",
"libvirtd",
"localtime",
"LOGG",
"louislam",
"lsdir",
"lsnew",
"luks",
"lynis",
@ -153,9 +160,11 @@
"oderwat",
"oneshot",
"openpgp",
"opensearch",
"optimumwifi",
"optoutstudies",
"overscroll",
"oxalica",
"pavucontrol",
"pbmode",
"pciutils",
@ -214,6 +223,7 @@
"spotifyd",
"sqltools",
"sshconfig",
"stdenv",
"subresource",
"substituters",
"supermaven",
@ -262,6 +272,7 @@
"zerotierone",
"zhaofengli",
"zoxide",
"zstd",
"ztkubnet"
]
}

158
flake.lock generated
View File

@ -1,5 +1,27 @@
{
"nodes": {
"arch_mirror": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": [
"nixpkgs"
],
"poetry2nix": "poetry2nix"
},
"locked": {
"lastModified": 1722704786,
"narHash": "sha256-M9ejTqXVtcXJt4oM6wa+NMSjBJX8KYrqjr0XxFWqV0o=",
"owner": "RichieCahill",
"repo": "arch_mirror",
"rev": "fcef4d3b95267e67cfaf1733a062d5cc7a82362c",
"type": "github"
},
"original": {
"owner": "RichieCahill",
"repo": "arch_mirror",
"type": "github"
}
},
"attic": {
"inputs": {
"crane": "crane",
@ -130,6 +152,24 @@
}
},
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1710146030,
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils_2": {
"inputs": {
"systems": [
"systems"
@ -149,9 +189,9 @@
"type": "github"
}
},
"flake-utils_2": {
"flake-utils_3": {
"inputs": {
"systems": "systems"
"systems": "systems_3"
},
"locked": {
"lastModified": 1710146030,
@ -277,6 +317,28 @@
}
},
"nix-github-actions": {
"inputs": {
"nixpkgs": [
"arch_mirror",
"poetry2nix",
"nixpkgs"
]
},
"locked": {
"lastModified": 1703863825,
"narHash": "sha256-rXwqjtwiGKJheXB43ybM8NwWB8rO2dSRrEqes0S7F5Y=",
"owner": "nix-community",
"repo": "nix-github-actions",
"rev": "5163432afc817cf8bd1f031418d1869e4c9d5547",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "nix-github-actions",
"type": "github"
}
},
"nix-github-actions_2": {
"inputs": {
"nixpkgs": [
"server_tools",
@ -456,17 +518,45 @@
"poetry2nix": {
"inputs": {
"flake-utils": [
"server_tools",
"arch_mirror",
"flake-utils"
],
"nix-github-actions": "nix-github-actions",
"nixpkgs": [
"server_tools",
"arch_mirror",
"nixpkgs"
],
"systems": "systems_2",
"treefmt-nix": "treefmt-nix"
},
"locked": {
"lastModified": 1722515463,
"narHash": "sha256-6FVPz1WzHak65xJQg8tRjVyFEWMesGxfskKaCxDUnRk=",
"owner": "nix-community",
"repo": "poetry2nix",
"rev": "8c25e871bba3f472e1569bbf6c0f52dcc34bf2a4",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "poetry2nix",
"type": "github"
}
},
"poetry2nix_2": {
"inputs": {
"flake-utils": [
"server_tools",
"flake-utils"
],
"nix-github-actions": "nix-github-actions_2",
"nixpkgs": [
"server_tools",
"nixpkgs"
],
"systems": "systems_4",
"treefmt-nix": "treefmt-nix_2"
},
"locked": {
"lastModified": 1721039874,
"narHash": "sha256-XANsG9GYHip8pxZpbqKf/YGv8tIa0xTh289Y+WNBNfw=",
@ -510,12 +600,13 @@
},
"root": {
"inputs": {
"arch_mirror": "arch_mirror",
"attic": "attic",
"fenix": "fenix",
"firefox-addons": "firefox-addons",
"flake-compat": "flake-compat",
"flake-parts": "flake-parts",
"flake-utils": "flake-utils",
"flake-utils": "flake-utils_2",
"home-manager": "home-manager",
"hyprland-contrib": "hyprland-contrib",
"nix": "nix",
@ -529,7 +620,7 @@
"rust-overlay": "rust-overlay",
"server_tools": "server_tools",
"sops-nix": "sops-nix",
"systems": "systems_3",
"systems": "systems_5",
"wired-notify": "wired-notify"
}
},
@ -597,11 +688,11 @@
},
"server_tools": {
"inputs": {
"flake-utils": "flake-utils_2",
"flake-utils": "flake-utils_3",
"nixpkgs": [
"nixpkgs"
],
"poetry2nix": "poetry2nix"
"poetry2nix": "poetry2nix_2"
},
"locked": {
"lastModified": 1722039234,
@ -684,7 +775,58 @@
"type": "github"
}
},
"systems_4": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"id": "systems",
"type": "indirect"
}
},
"systems_5": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"treefmt-nix": {
"inputs": {
"nixpkgs": [
"arch_mirror",
"poetry2nix",
"nixpkgs"
]
},
"locked": {
"lastModified": 1719749022,
"narHash": "sha256-ddPKHcqaKCIFSFc/cvxS14goUhCOAwsM1PbMr0ZtHMg=",
"owner": "numtide",
"repo": "treefmt-nix",
"rev": "8df5ff62195d4e67e2264df0b7f5e8c9995fd0bd",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "treefmt-nix",
"type": "github"
}
},
"treefmt-nix_2": {
"inputs": {
"nixpkgs": [
"server_tools",

View File

@ -29,6 +29,11 @@
nixpkgs-stable.url = "github:nixos/nixpkgs/nixos-24.05";
systems.url = "github:nix-systems/default";
arch_mirror = {
url = "github:RichieCahill/arch_mirror";
inputs.nixpkgs.follows = "nixpkgs";
};
attic = {
url = "github:zhaofengli/attic";
inputs = {

View File

@ -0,0 +1,29 @@
{ inputs, pkgs, ... }:
let
vars = import ./vars.nix;
in
{
virtualisation.oci-containers.containers.arch_mirror = {
image = "ubuntu/apache2:latest";
volumes = [
"${../../users/richie/global/docker_templates}/file_server/sites/:/etc/apache2/sites-enabled/"
"${vars.main_mirror}:/data"
];
ports = [ "800:80" ];
extraOptions = [ "--network=web" ];
autoStart = true;
};
systemd.services.sync_mirror = {
requires = [ "network-online.target" ];
after = [ "network-online.target" ];
wantedBy = [ "multi-user.target" ];
description = "validates startup";
path = [ pkgs.rsync ];
serviceConfig = {
Environment = "MIRROR_DIR=${vars.main_mirror}/archlinux/";
Type = "simple";
ExecStart = "${inputs.arch_mirror.packages.x86_64-linux.default}/bin/sync_mirror";
};
};
}

View File

@ -3,6 +3,7 @@
imports = [
../../users/richie/global/ssh.nix
../../users/richie/global/zerotier.nix
./arch_mirror.nix
./docker
./services.nix
];

View File

@ -1,19 +1,6 @@
{ config, ... }:
let
vars = import ../vars.nix;
in
{
virtualisation.oci-containers.containers = {
arch_mirror = {
image = "ubuntu/apache2:latest";
volumes = [
"${../../../users/richie/global/docker_templates}/file_server/sites/:/etc/apache2/sites-enabled/"
"${vars.main_mirror}:/data"
];
ports = [ "800:80" ];
extraOptions = [ "--network=web" ];
autoStart = true;
};
haproxy = {
image = "haproxy:latest";
user = "600:600";

View File

@ -0,0 +1,29 @@
{ inputs, pkgs, ... }:
let
vars = import ./vars.nix;
in
{
virtualisation.oci-containers.containers.arch_mirror = {
image = "ubuntu/apache2:latest";
volumes = [
"${../../users/richie/global/docker_templates}/file_server/sites/:/etc/apache2/sites-enabled/"
"${vars.media_mirror}:/data"
];
ports = [ "800:80" ];
extraOptions = [ "--network=web" ];
autoStart = true;
};
systemd.services.sync_mirror = {
requires = [ "network-online.target" ];
after = [ "network-online.target" ];
wantedBy = [ "multi-user.target" ];
description = "validates startup";
path = [ pkgs.rsync ];
serviceConfig = {
Environment = "MIRROR_DIR=${vars.media_mirror}/archlinux/";
Type = "simple";
ExecStart = "${inputs.arch_mirror.packages.x86_64-linux.default}/bin/sync_mirror";
};
};
}

View File

@ -7,6 +7,7 @@ in
../../users/richie/global/ssh.nix
../../users/richie/global/syncthing_base.nix
../../users/richie/global/zerotier.nix
./arch_mirror.nix
./docker
./programs.nix
./services.nix

View File

@ -20,16 +20,6 @@ in
extraOptions = [ "--network=web" ];
autoStart = true;
};
arch_mirror = {
image = "ubuntu/apache2:latest";
volumes = [
"${../../../users/richie/global/docker_templates}/file_server/sites/:/etc/apache2/sites-enabled/"
"${vars.media_mirror}:/data"
];
ports = [ "800:80" ];
extraOptions = [ "--network=web" ];
autoStart = true;
};
haproxy = {
image = "haproxy:latest";
user = "600:600";

View File

@ -44,5 +44,6 @@
nix-tree
nixpkgs-fmt
inputs.server_tools.packages.x86_64-linux.default
inputs.arch_mirror.packages.x86_64-linux.default
];
}