From 8b41ded3a6ed741e8182c550a3b1accb6a49489f Mon Sep 17 00:00:00 2001 From: jopejoe1 Date: Thu, 11 Jul 2024 18:38:07 +0200 Subject: [PATCH] infra: format code --- flake.nix | 61 +++++++++++++++++++++++-------------------- nix/infra/backend.nix | 5 +++- nix/infra/nginx.nix | 12 ++++----- nix/web.nix | 2 +- 4 files changed, 43 insertions(+), 37 deletions(-) diff --git a/flake.nix b/flake.nix index 9ec3c73..5f42103 100644 --- a/flake.nix +++ b/flake.nix @@ -21,35 +21,38 @@ }; }; - outputs = inputs@{ self, nixpkgs, ... }: { - # System - nixosConfigurations = { - alisa = nixpkgs.lib.nixosSystem { - system = "aarch64-linux"; - specialArgs = inputs; - modules = [ - ./nix/infra - ]; + outputs = + inputs@{ self, nixpkgs, ... }: + { + # System + nixosConfigurations = { + alisa = nixpkgs.lib.nixosSystem { + system = "aarch64-linux"; + specialArgs = inputs; + modules = [ ./nix/infra ]; + }; }; + + # Formatter + formatter = nixpkgs.lib.attrsets.genAttrs nixpkgs.lib.systems.flakeExposed ( + system: nixpkgs.legacyPackages.${system}.nixfmt-rfc-style + ); + + # Packages + legacyPackages = nixpkgs.lib.attrsets.genAttrs nixpkgs.lib.systems.flakeExposed ( + system: + import ./nix { + inherit system inputs; + pkgs = nixpkgs.legacyPackages.${system}; + } + ); + + # Shell + devShells = nixpkgs.lib.attrsets.genAttrs nixpkgs.lib.systems.flakeExposed (system: { + default = import ./shell.nix { + inherit system inputs; + pkgs = nixpkgs.legacyPackages.${system}; + }; + }); }; - - # Formatter - formatter = nixpkgs.lib.attrsets.genAttrs nixpkgs.lib.systems.flakeExposed (system: - nixpkgs.legacyPackages.${system}.nixfmt-rfc-style - ); - - # Packages - legacyPackages = nixpkgs.lib.attrsets.genAttrs nixpkgs.lib.systems.flakeExposed (system: import ./nix { - inherit system inputs; - pkgs = nixpkgs.legacyPackages.${system}; - }); - - # Shell - devShells = nixpkgs.lib.attrsets.genAttrs nixpkgs.lib.systems.flakeExposed (system: { - default = import ./shell.nix { - inherit system inputs; - pkgs = nixpkgs.legacyPackages.${system}; - }; - }); - }; } diff --git a/nix/infra/backend.nix b/nix/infra/backend.nix index 6754837..81f8936 100644 --- a/nix/infra/backend.nix +++ b/nix/infra/backend.nix @@ -12,7 +12,10 @@ in { systemd.services.alisa-backend = { enable = true; - after = [ "network.target" "postgresql.service" ]; + after = [ + "network.target" + "postgresql.service" + ]; wantedBy = [ "multi-user.target" ]; description = "Alisa Backend API Server"; environment = { diff --git a/nix/infra/nginx.nix b/nix/infra/nginx.nix index 7dd0080..de1074e 100644 --- a/nix/infra/nginx.nix +++ b/nix/infra/nginx.nix @@ -1,8 +1,4 @@ - { - self, - config, - ... - }: +{ self, config, ... }: { services.nginx = { @@ -16,7 +12,11 @@ enableACME = true; forceSSL = true; locations = { - "/".root = "${self.legacyPackages.${config.nixpkgs.hostPlatform.system}.web.override { withBackendUrl = "https://clan-war.net/api/v1";}}/"; + "/".root = "${ + self.legacyPackages.${config.nixpkgs.hostPlatform.system}.web.override { + withBackendUrl = "https://clan-war.net/api/v1"; + } + }/"; "/api".proxyPass = "http://localhost:8080/api"; }; }; diff --git a/nix/web.nix b/nix/web.nix index bbc6530..df8f799 100644 --- a/nix/web.nix +++ b/nix/web.nix @@ -3,7 +3,7 @@ lib, pnpm, nodejs, - withBackendUrl ? "" + withBackendUrl ? "", }: stdenv.mkDerivation (finalAttrs: {