Skip to content

Commit

Permalink
chore: format with nixfmt-rfc-style
Browse files Browse the repository at this point in the history
  • Loading branch information
tie committed Sep 9, 2024
1 parent 623f677 commit df9418b
Show file tree
Hide file tree
Showing 49 changed files with 2,377 additions and 714 deletions.
23 changes: 22 additions & 1 deletion flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 18 additions & 12 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
flake-parts.url = "flake-parts";
flake-parts.inputs.nixpkgs-lib.follows = "nixpkgs";

treefmt-nix.url = "github:numtide/treefmt-nix";
treefmt-nix.inputs.nixpkgs.follows = "nixpkgs";

sops-nix.url = "sops-nix";
sops-nix.inputs.nixpkgs.follows = "nixpkgs";
sops-nix.inputs.nixpkgs-stable.follows = "nixpkgs";
Expand All @@ -26,16 +29,19 @@
steam-games.inputs.flake-parts.follows = "flake-parts";
};

outputs = inputs: inputs.flake-parts.lib.mkFlake { inherit inputs; } {
systems = [
"aarch64-linux"
"x86_64-linux"
];

imports = [
inputs.minimal-shell.flakeModule
./nixpkgs.nix
./top-level.nix
];
};
outputs =
inputs:
inputs.flake-parts.lib.mkFlake { inherit inputs; } {
systems = [
"aarch64-linux"
"x86_64-linux"
];

imports = [
inputs.treefmt-nix.flakeModule
inputs.minimal-shell.flakeModule
./nixpkgs.nix
./top-level.nix
];
};
}
124 changes: 81 additions & 43 deletions hosts/akane/configuration.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
{ config, lib, pkgs, ... }: {
{
config,
lib,
pkgs,
...
}:
{
system.stateVersion = "23.11";

time.timeZone = "Europe/Moscow";
Expand Down Expand Up @@ -55,8 +61,7 @@

systemd.network =
let
interfaceRange = a: b:
map (i: "enp${toString i}s0") (lib.range a b);
interfaceRange = a: b: map (i: "enp${toString i}s0") (lib.range a b);

ispInterfaces = interfaceRange 2 2;
lanInterfaces = interfaceRange 3 9;
Expand Down Expand Up @@ -141,26 +146,34 @@
#};
addresses =
let
makeAddress = { cidr, tempAddr ? false, ... }: {
addressConfig = {
Address = cidr;
AddPrefixRoute = false;
} // lib.optionalAttrs tempAddr {
ManageTemporaryAddress = true;
makeAddress =
{
cidr,
tempAddr ? false,
...
}:
{
addressConfig = {
Address = cidr;
AddPrefixRoute = false;
} // lib.optionalAttrs tempAddr { ManageTemporaryAddress = true; };
};
};
in
map makeAddress lanConfiguration;
routes =
let
makeRoute = { network, address, ... }: {
routeConfig = {
Destination = network;
PreferredSource = address;
makeRoute =
{ network, address, ... }:
{
routeConfig = {
Destination = network;
PreferredSource = address;
};
};
};
routes = map makeRoute lanConfiguration;
withTable = routeTable: { routeConfig }:
withTable =
routeTable:
{ routeConfig }:
{
routeConfig = routeConfig // {
Table = routeTable;
Expand All @@ -170,23 +183,39 @@
routes ++ map (withTable "wireguard") routes;
ipv6Prefixes =
let
makeIPv6Prefix = { network, ... }: {
ipv6PrefixConfig = {
Prefix = network;
makeIPv6Prefix =
{ network, ... }:
{
ipv6PrefixConfig = {
Prefix = network;
};
};
};
radv = lib.filter ({ radv ? false, ... }: radv) lanConfiguration;
radv = lib.filter (
{
radv ? false,
...
}:
radv
) lanConfiguration;
in
map makeIPv6Prefix radv;
# NB seems to be working fine without IPv6RoutePrefix.
ipv6RoutePrefixes =
let
makeIPv6RoutePrefix = { network, ... }: {
ipv6RoutePrefixConfig = {
Route = network;
makeIPv6RoutePrefix =
{ network, ... }:
{
ipv6RoutePrefixConfig = {
Route = network;
};
};
};
radv = lib.filter ({ radv ? false, ... }: radv) lanConfiguration;
radv = lib.filter (
{
radv ? false,
...
}:
radv
) lanConfiguration;
in
map makeIPv6RoutePrefix radv;
linkConfig = {
Expand Down Expand Up @@ -220,33 +249,39 @@
};
addresses =
let
makeAddress = { cidr, ... }: {
addressConfig = {
Address = cidr;
AddPrefixRoute = false;
makeAddress =
{ cidr, ... }:
{
addressConfig = {
Address = cidr;
AddPrefixRoute = false;
};
};
};
in
map makeAddress wireguardConfiguration;
routes =
let
makeRoute = { network, address, ... }: {
routeConfig = {
Destination = network;
PreferredSource = address;
makeRoute =
{ network, address, ... }:
{
routeConfig = {
Destination = network;
PreferredSource = address;
};
};
};
in
map makeRoute wireguardConfiguration;
routingPolicyRules =
let
makeRoutingPolicyRule = { network, ... }: {
routingPolicyRuleConfig = {
From = network;
Table = "wireguard";
Priority = 1000;
makeRoutingPolicyRule =
{ network, ... }:
{
routingPolicyRuleConfig = {
From = network;
Table = "wireguard";
Priority = 1000;
};
};
};
in
map makeRoutingPolicyRule wireguardConfiguration;
linkConfig = {
Expand Down Expand Up @@ -276,7 +311,10 @@
wireguardPeers = [
{
wireguardPeerConfig = {
AllowedIPs = [ "::/0" "0.0.0.0/0" ];
AllowedIPs = [
"::/0"
"0.0.0.0/0"
];
RouteTable = "wireguard";
PublicKey = "8LgfPosHOG0SpUGqIlYesskq00Y6wihLtgZFUkutdE0=";
Endpoint = wireguardEndpoint;
Expand Down
3 changes: 2 additions & 1 deletion hosts/akane/default.nix
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{ nixosWithSystem, ... }: {
{ nixosWithSystem, ... }:
{
flake.nixosConfigurations.akane = nixosWithSystem "x86_64-linux" [ ./configuration.nix ];
}
7 changes: 3 additions & 4 deletions hosts/bootstrap/configuration.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{ lib, modulesPath, ... }: {
imports = [
(modulesPath + "/profiles/all-hardware.nix")
];
{ lib, modulesPath, ... }:
{
imports = [ (modulesPath + "/profiles/all-hardware.nix") ];

system.stateVersion = lib.trivial.release;

Expand Down
3 changes: 2 additions & 1 deletion hosts/bootstrap/default.nix
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{ nixosWithSystem, ... }: {
{ nixosWithSystem, ... }:
{
flake.nixosConfigurations.bootstrap-x86-64 = nixosWithSystem "x86_64-linux" [ ./configuration.nix ];
}
41 changes: 27 additions & 14 deletions hosts/brim/configuration.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{ lib, pkgs, config, ... }: {
{ pkgs, config, ... }:
{
system.stateVersion = "23.11";

time.timeZone = "Europe/Moscow";
Expand All @@ -11,7 +12,10 @@
configurationLimit = 10;
};

initrd.availableKernelModules = [ "mpt3sas" "i7core_edac" ];
initrd.availableKernelModules = [
"mpt3sas"
"i7core_edac"
];
};

environment.machineInfo = {
Expand All @@ -33,9 +37,15 @@
];
allowedTCPPortRanges = [
# Brim Minecraft
{ from = 25500; to = 25599; }
{
from = 25500;
to = 25599;
}
# Shared Minecraft (for Tie)
{ from = 22500; to = 22599; }
{
from = 22500;
to = 22599;
}
];
allowedUDPPorts = [
# Caddy HTTP/3
Expand Down Expand Up @@ -158,12 +168,16 @@
server_port = "25511";
activity_format = "BrimWorld: {online}/{max}";
players_format = "Игроков: {online}/{max}";
status_online = "Сервер в сети " +
# Honey Pot U+1F36F
builtins.fromJSON ''"\uD83C\uDF6F"'';
status_offline = "Сервер не в сети " +
# Broken Heart U+1F494
builtins.fromJSON ''"\uD83D\uDC94"'';
status_online =
"Сервер в сети "
+
# Honey Pot U+1F36F
builtins.fromJSON ''"\uD83C\uDF6F"'';
status_offline =
"Сервер не в сети "
+
# Broken Heart U+1F494
builtins.fromJSON ''"\uD83D\uDC94"'';
};
channels = {
enable_channels = true;
Expand Down Expand Up @@ -245,9 +259,8 @@
TLS_CERTIFICATE_PATH_FOR_BRIM_SU = ./certs/brim-su.pem;
TLS_CERTIFICATE_PATH_FOR_BRIMWORLD_ONLINE = ./certs/brimworld-online.pem;
};
serviceConfig.LoadCredential =
map
(name: name + ":" + config.sops.secrets."caddy/${name}".path)
config.passthru.caddySecrets;
serviceConfig.LoadCredential = map (
name: name + ":" + config.sops.secrets."caddy/${name}".path
) config.passthru.caddySecrets;
};
}
3 changes: 2 additions & 1 deletion hosts/brim/default.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{ nixosWithSystem, ... }: {
{ nixosWithSystem, ... }:
{
flake.nixosConfigurations.brim = nixosWithSystem "x86_64-linux" [
./configuration.nix
./sops.nix
Expand Down
Loading

0 comments on commit df9418b

Please sign in to comment.