Set up formatting

This commit is contained in:
Natsu Kagami 2022-05-31 12:45:33 -04:00 committed by Natsu Kagami
parent 2f78eed4cc
commit 69ce8f32ef
12 changed files with 132 additions and 107 deletions

View file

@ -58,6 +58,21 @@
} }
}, },
"flake-utils": { "flake-utils": {
"locked": {
"lastModified": 1653893745,
"narHash": "sha256-0jntwV3Z8//YwuOjzhV2sgJJPt+HY6KhU7VZUL0fKZQ=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "1ed9fb1935d260de5fe1c2f7ee0ebaae17ed2fa1",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils_2": {
"locked": { "locked": {
"lastModified": 1648297722, "lastModified": 1648297722,
"narHash": "sha256-W+qlPsiZd8F3XkzXOzAoR+mpFqzm3ekQkJNa+PIh1BQ=", "narHash": "sha256-W+qlPsiZd8F3XkzXOzAoR+mpFqzm3ekQkJNa+PIh1BQ=",
@ -307,6 +322,7 @@
"inputs": { "inputs": {
"darwin": "darwin", "darwin": "darwin",
"deploy-rs": "deploy-rs", "deploy-rs": "deploy-rs",
"flake-utils": "flake-utils",
"home-manager": "home-manager", "home-manager": "home-manager",
"nix-gaming": "nix-gaming", "nix-gaming": "nix-gaming",
"nixpkgs": "nixpkgs_2", "nixpkgs": "nixpkgs_2",
@ -385,7 +401,7 @@
}, },
"youmubot": { "youmubot": {
"inputs": { "inputs": {
"flake-utils": "flake-utils", "flake-utils": "flake-utils_2",
"naersk": "naersk_2", "naersk": "naersk_2",
"nixpkgs": [ "nixpkgs": [
"nixpkgs" "nixpkgs"

View file

@ -12,6 +12,8 @@
deploy-rs.url = "github:Serokell/deploy-rs"; deploy-rs.url = "github:Serokell/deploy-rs";
nur.url = "github:nix-community/NUR"; nur.url = "github:nix-community/NUR";
flake-utils.url = github:numtide/flake-utils;
# --- # ---
# Imported apps # Imported apps
rnix-lsp.url = "github:nix-community/rnix-lsp"; rnix-lsp.url = "github:nix-community/rnix-lsp";
@ -146,5 +148,7 @@
# This is highly advised, and will prevent many possible mistakes # This is highly advised, and will prevent many possible mistakes
checks = builtins.mapAttrs (system: deployLib: deployLib.deployChecks self.deploy) deploy-rs.lib; checks = builtins.mapAttrs (system: deployLib: deployLib.deployChecks self.deploy) deploy-rs.lib;
}; } // (inputs.flake-utils.lib.eachDefaultSystem (system: {
formatter = nixpkgs.legacyPackages.${system}.nixpkgs-fmt;
}));
} }

View file

@ -17,8 +17,7 @@
]; ];
# Additional settings for programs # Additional settings for programs
programs.fish.shellAliases = { programs.fish.shellAliases = { };
};
# This value determines the Home Manager release that your # This value determines the Home Manager release that your
# configuration is compatible with. This helps avoid breakage # configuration is compatible with. This helps avoid breakage

View file

@ -5,7 +5,8 @@ let
# Copied from traefik.nix # Copied from traefik.nix
jsonValue = with types; jsonValue = with types;
let let
valueType = nullOr (oneOf [ valueType = nullOr
(oneOf [
bool bool
int int
float float
@ -16,7 +17,8 @@ let
description = "JSON value"; description = "JSON value";
emptyValue.value = { }; emptyValue.value = { };
}; };
in valueType; in
valueType;
cfg = config.cloud.traefik; cfg = config.cloud.traefik;
in in

View file

@ -38,7 +38,8 @@ in
config = mkIf cfg.enable (builtins.seq config = mkIf cfg.enable (builtins.seq
(mkIf (isNull cfg.rsaPrivateKey && isNull cfg.ed25519PrivateKey) (builtins.abort "one of the keys must be defined")) (mkIf (isNull cfg.rsaPrivateKey && isNull cfg.ed25519PrivateKey) (builtins.abort "one of the keys must be defined"))
(let (
let
networkName = "my-tinc"; networkName = "my-tinc";
myHost = builtins.getAttr cfg.hostName hosts; myHost = builtins.getAttr cfg.hostName hosts;
@ -93,6 +94,7 @@ in
ed25519PrivateKeyFile = cfg.ed25519PrivateKey; ed25519PrivateKeyFile = cfg.ed25519PrivateKey;
rsaPrivateKeyFile = cfg.rsaPrivateKey; rsaPrivateKeyFile = cfg.rsaPrivateKey;
}; };
}) }
)
); );
} }

View file

@ -13,11 +13,13 @@ in
{ {
config = mkIf cfg.enable { config = mkIf cfg.enable {
# All hosts we know of # All hosts we know of
services.tinc.networks.my-tinc.hostSettings = mapAttrs (name: host: { services.tinc.networks.my-tinc.hostSettings = mapAttrs
(name: host: {
addresses = if (host ? address) then [{ address = host.address; }] else [ ]; addresses = if (host ? address) then [{ address = host.address; }] else [ ];
subnets = [{ address = host.subnetAddr; }]; subnets = [{ address = host.subnetAddr; }];
rsaPublicKey = mkIf (host ? "rsaPublicKey") host.rsaPublicKey; rsaPublicKey = mkIf (host ? "rsaPublicKey") host.rsaPublicKey;
settings.Ed25519PublicKey = mkIf (host ? "ed25519PublicKey") host.ed25519PublicKey; settings.Ed25519PublicKey = mkIf (host ? "ed25519PublicKey") host.ed25519PublicKey;
}) hosts; })
hosts;
}; };
} }