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

158
flake.lock generated
View File

@ -1,5 +1,27 @@
{ {
"nodes": { "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": { "attic": {
"inputs": { "inputs": {
"crane": "crane", "crane": "crane",
@ -130,6 +152,24 @@
} }
}, },
"flake-utils": { "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": { "inputs": {
"systems": [ "systems": [
"systems" "systems"
@ -149,9 +189,9 @@
"type": "github" "type": "github"
} }
}, },
"flake-utils_2": { "flake-utils_3": {
"inputs": { "inputs": {
"systems": "systems" "systems": "systems_3"
}, },
"locked": { "locked": {
"lastModified": 1710146030, "lastModified": 1710146030,
@ -277,6 +317,28 @@
} }
}, },
"nix-github-actions": { "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": { "inputs": {
"nixpkgs": [ "nixpkgs": [
"server_tools", "server_tools",
@ -456,17 +518,45 @@
"poetry2nix": { "poetry2nix": {
"inputs": { "inputs": {
"flake-utils": [ "flake-utils": [
"server_tools", "arch_mirror",
"flake-utils" "flake-utils"
], ],
"nix-github-actions": "nix-github-actions", "nix-github-actions": "nix-github-actions",
"nixpkgs": [ "nixpkgs": [
"server_tools", "arch_mirror",
"nixpkgs" "nixpkgs"
], ],
"systems": "systems_2", "systems": "systems_2",
"treefmt-nix": "treefmt-nix" "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": { "locked": {
"lastModified": 1721039874, "lastModified": 1721039874,
"narHash": "sha256-XANsG9GYHip8pxZpbqKf/YGv8tIa0xTh289Y+WNBNfw=", "narHash": "sha256-XANsG9GYHip8pxZpbqKf/YGv8tIa0xTh289Y+WNBNfw=",
@ -510,12 +600,13 @@
}, },
"root": { "root": {
"inputs": { "inputs": {
"arch_mirror": "arch_mirror",
"attic": "attic", "attic": "attic",
"fenix": "fenix", "fenix": "fenix",
"firefox-addons": "firefox-addons", "firefox-addons": "firefox-addons",
"flake-compat": "flake-compat", "flake-compat": "flake-compat",
"flake-parts": "flake-parts", "flake-parts": "flake-parts",
"flake-utils": "flake-utils", "flake-utils": "flake-utils_2",
"home-manager": "home-manager", "home-manager": "home-manager",
"hyprland-contrib": "hyprland-contrib", "hyprland-contrib": "hyprland-contrib",
"nix": "nix", "nix": "nix",
@ -529,7 +620,7 @@
"rust-overlay": "rust-overlay", "rust-overlay": "rust-overlay",
"server_tools": "server_tools", "server_tools": "server_tools",
"sops-nix": "sops-nix", "sops-nix": "sops-nix",
"systems": "systems_3", "systems": "systems_5",
"wired-notify": "wired-notify" "wired-notify": "wired-notify"
} }
}, },
@ -597,11 +688,11 @@
}, },
"server_tools": { "server_tools": {
"inputs": { "inputs": {
"flake-utils": "flake-utils_2", "flake-utils": "flake-utils_3",
"nixpkgs": [ "nixpkgs": [
"nixpkgs" "nixpkgs"
], ],
"poetry2nix": "poetry2nix" "poetry2nix": "poetry2nix_2"
}, },
"locked": { "locked": {
"lastModified": 1722039234, "lastModified": 1722039234,
@ -684,7 +775,58 @@
"type": "github" "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": { "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": { "inputs": {
"nixpkgs": [ "nixpkgs": [
"server_tools", "server_tools",

View File

@ -29,6 +29,11 @@
nixpkgs-stable.url = "github:nixos/nixpkgs/nixos-24.05"; nixpkgs-stable.url = "github:nixos/nixpkgs/nixos-24.05";
systems.url = "github:nix-systems/default"; systems.url = "github:nix-systems/default";
arch_mirror = {
url = "github:RichieCahill/arch_mirror";
inputs.nixpkgs.follows = "nixpkgs";
};
attic = { attic = {
url = "github:zhaofengli/attic"; url = "github:zhaofengli/attic";
inputs = { 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 = [ imports = [
../../users/richie/global/ssh.nix ../../users/richie/global/ssh.nix
../../users/richie/global/zerotier.nix ../../users/richie/global/zerotier.nix
./arch_mirror.nix
./docker ./docker
./services.nix ./services.nix
]; ];

View File

@ -1,19 +1,6 @@
{ config, ... }: { config, ... }:
let
vars = import ../vars.nix;
in
{ {
virtualisation.oci-containers.containers = { 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 = { haproxy = {
image = "haproxy:latest"; image = "haproxy:latest";
user = "600:600"; 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/ssh.nix
../../users/richie/global/syncthing_base.nix ../../users/richie/global/syncthing_base.nix
../../users/richie/global/zerotier.nix ../../users/richie/global/zerotier.nix
./arch_mirror.nix
./docker ./docker
./programs.nix ./programs.nix
./services.nix ./services.nix

View File

@ -20,16 +20,6 @@ in
extraOptions = [ "--network=web" ]; extraOptions = [ "--network=web" ];
autoStart = true; 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 = { haproxy = {
image = "haproxy:latest"; image = "haproxy:latest";
user = "600:600"; user = "600:600";

View File

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