From 03d9222a079b61aedbb9955e4a947b05a0943093 Mon Sep 17 00:00:00 2001 From: Sokhibjon Orzikulov Date: Mon, 26 Aug 2024 11:29:20 +0500 Subject: [PATCH] fmt + cryptoshop --- flake.nix | 243 +++++++++++----------- home/muzaffar.nix | 17 +- home/sakhib.nix | 17 +- home/shakhzod.nix | 17 +- modules/home/nixpkgs/default.nix | 2 +- modules/home/packages/default.nix | 15 +- modules/home/topgrade/default.nix | 6 +- modules/home/zsh/default.nix | 2 +- modules/home/zsh/starship.nix | 2 +- modules/home/zsh/zoxide.nix | 2 +- modules/nixos/boot.nix | 21 +- modules/nixos/data.nix | 11 +- modules/nixos/docker.nix | 11 +- modules/nixos/maid.nix | 11 +- modules/nixos/network.nix | 28 +-- modules/nixos/nixpkgs.nix | 15 +- modules/nixos/ssh.nix | 4 +- modules/nixos/users/muzaffar.nix | 19 +- modules/nixos/users/sakhib.nix | 19 +- modules/nixos/users/shakhzod.nix | 19 +- modules/nixos/zsh.nix | 11 +- modules/server/bind/default.nix | 41 ++-- modules/server/caddy/kolyma-1.nix | 13 +- modules/server/caddy/kolyma-2.nix | 13 +- modules/server/caddy/kolyma-3.nix | 49 +++-- modules/server/container/kolyma-1.nix | 13 +- modules/server/container/kolyma-2.nix | 17 +- modules/server/container/kolyma-3.nix | 17 +- nixos/kolyma-1/hardware-configuration.nix | 23 +- nixos/kolyma-1/services.nix | 13 +- nixos/kolyma-2/hardware-configuration.nix | 23 +- nixos/kolyma-2/services.nix | 13 +- nixos/kolyma-3/hardware-configuration.nix | 25 ++- nixos/kolyma-3/services.nix | 11 +- overlays/default.nix | 4 +- pkgs/default.nix | 4 +- pkgs/fp/default.nix | 12 +- shell.nix | 7 +- 38 files changed, 394 insertions(+), 396 deletions(-) diff --git a/flake.nix b/flake.nix index a044f82..79d770d 100644 --- a/flake.nix +++ b/flake.nix @@ -36,127 +36,130 @@ # In this context, outputs are mostly about getting home-manager what it # needs since it will be the one using the flake - outputs = { - self, - nixpkgs, - nixpkgs-unstable, - home-manager, - flake-utils, - ... - } @ inputs: let - inherit (self) outputs; - - # Legacy packages are needed for home-manager - lib = nixpkgs.lib // home-manager.lib; - - # Supported systems for your flake packages, shell, etc. - systems = [ - "aarch64-linux" - "x86_64-linux" - "aarch64-darwin" - "x86_64-darwin" - ]; - - # This is a function that generates an attribute by calling a function you - # pass to it, with each system as an argument - forAllSystems = nixpkgs.lib.genAttrs systems; - - # This is a function that generates an attribute by calling a function you - # pass to it, with each system as an argument - forEachSystem = f: lib.genAttrs systems (system: f pkgsFor.${system}); - - # This is a function that generates an attribute by calling a function you - # pass to it, with each system as an argument - pkgsFor = lib.genAttrs systems (system: - import nixpkgs { - inherit system; - config.allowUnfree = true; - }); - - # Define a development shell for each system - devShellFor = system: let - pkgs = import nixpkgs { - inherit system; - config.allowUnfree = true; - }; + outputs = + { self + , nixpkgs + , nixpkgs-unstable + , home-manager + , flake-utils + , ... + } @ inputs: + let + inherit (self) outputs; + + # Legacy packages are needed for home-manager + lib = nixpkgs.lib // home-manager.lib; + + # Supported systems for your flake packages, shell, etc. + systems = [ + "aarch64-linux" + "x86_64-linux" + "aarch64-darwin" + "x86_64-darwin" + ]; + + # This is a function that generates an attribute by calling a function you + # pass to it, with each system as an argument + forAllSystems = nixpkgs.lib.genAttrs systems; + + # This is a function that generates an attribute by calling a function you + # pass to it, with each system as an argument + forEachSystem = f: lib.genAttrs systems (system: f pkgsFor.${system}); + + # This is a function that generates an attribute by calling a function you + # pass to it, with each system as an argument + pkgsFor = lib.genAttrs systems (system: + import nixpkgs { + inherit system; + config.allowUnfree = true; + }); + + # Define a development shell for each system + devShellFor = system: + let + pkgs = import nixpkgs { + inherit system; + config.allowUnfree = true; + }; + in + pkgs.mkShell { + NIX_CONFIG = "extra-experimental-features = nix-command flakes repl-flake"; + buildInputs = with pkgs; [ + nix + nil + git + nixd + just + nixpkgs-fmt + nixpkgs-lint + ]; + + # Set environment variables, if needed + shellHook = '' + # export SOME_VAR=some_value + echo "Welcome to Kolyma's dotfiles!" + ''; + }; in - pkgs.mkShell { - NIX_CONFIG = "extra-experimental-features = nix-command flakes repl-flake"; - buildInputs = with pkgs; [ - nix - nil - git - nixd - just - nixpkgs-fmt - nixpkgs-lint - ]; - - # Set environment variables, if needed - shellHook = '' - # export SOME_VAR=some_value - echo "Welcome to Kolyma's dotfiles!" - ''; - }; - in { - inherit lib; - - # Your custom packages - # Acessible through 'nix build', 'nix shell', etc - packages = forEachSystem (pkgs: import ./pkgs {inherit pkgs;}); - - # Formatter for your nix files, available through 'nix fmt' - # Other options beside 'alejandra' include 'nixpkgs-fmt' - formatter = - forAllSystems (system: nixpkgs.legacyPackages.${system}.nixpkgs-fmt); - - # Your custom packages and modifications, exported as overlays - overlays = import ./overlays {inherit inputs;}; - - # Reusable nixos modules you might want to export - # These are usually stuff you would upstream into nixpkgs - nixosModules = import ./modules/nixos; - - # Reusable home-manager modules you might want to export - # These are usually stuff you would upstream into home-manager - homeManagerModules = import ./modules/home; - - # Reusable server modules you might want to export - # These are usually stuff you would upstream services to global - serverModules = import ./modules/server; - - # Reusable home-manager modules you might want to export - # These are usually stuff you would upstream into home-manager - # homeManagerModules = import ./modules/home; - - # NixOS configuration entrypoint - # Available through 'nixos-rebuild --flake .#your-hostname' - nixosConfigurations = { - "Kolyma-1" = nixpkgs.lib.nixosSystem { - specialArgs = {inherit inputs outputs;}; - modules = [ - # > Our main nixos configuration file < - ./nixos/kolyma-1/configuration.nix - ]; - }; - "Kolyma-2" = nixpkgs.lib.nixosSystem { - specialArgs = {inherit inputs outputs;}; - modules = [ - # > Our main nixos configuration file < - ./nixos/kolyma-2/configuration.nix - ]; - }; - "Kolyma-3" = nixpkgs.lib.nixosSystem { - specialArgs = {inherit inputs outputs;}; - modules = [ - # > Our main nixos configuration file < - ./nixos/kolyma-3/configuration.nix - ]; + { + inherit lib; + + # Your custom packages + # Acessible through 'nix build', 'nix shell', etc + packages = forEachSystem (pkgs: import ./pkgs { inherit pkgs; }); + + # Formatter for your nix files, available through 'nix fmt' + # Other options beside 'alejandra' include 'nixpkgs-fmt' + formatter = + forAllSystems (system: nixpkgs.legacyPackages.${system}.nixpkgs-fmt); + + # Your custom packages and modifications, exported as overlays + overlays = import ./overlays { inherit inputs; }; + + # Reusable nixos modules you might want to export + # These are usually stuff you would upstream into nixpkgs + nixosModules = import ./modules/nixos; + + # Reusable home-manager modules you might want to export + # These are usually stuff you would upstream into home-manager + homeManagerModules = import ./modules/home; + + # Reusable server modules you might want to export + # These are usually stuff you would upstream services to global + serverModules = import ./modules/server; + + # Reusable home-manager modules you might want to export + # These are usually stuff you would upstream into home-manager + # homeManagerModules = import ./modules/home; + + # NixOS configuration entrypoint + # Available through 'nixos-rebuild --flake .#your-hostname' + nixosConfigurations = { + "Kolyma-1" = nixpkgs.lib.nixosSystem { + specialArgs = { inherit inputs outputs; }; + modules = [ + # > Our main nixos configuration file < + ./nixos/kolyma-1/configuration.nix + ]; + }; + "Kolyma-2" = nixpkgs.lib.nixosSystem { + specialArgs = { inherit inputs outputs; }; + modules = [ + # > Our main nixos configuration file < + ./nixos/kolyma-2/configuration.nix + ]; + }; + "Kolyma-3" = nixpkgs.lib.nixosSystem { + specialArgs = { inherit inputs outputs; }; + modules = [ + # > Our main nixos configuration file < + ./nixos/kolyma-3/configuration.nix + ]; + }; }; - }; - # Development shells - devShell = lib.mapAttrs (system: _: devShellFor system) (lib.genAttrs systems {}); - # devShells = lib.mapAttrs (system: _: devShellFor system) (lib.genAttrs systems {}); - }; + # Development shells + devShell = lib.mapAttrs (system: _: devShellFor system) (lib.genAttrs systems { }); + # devShells = lib.mapAttrs (system: _: devShellFor system) (lib.genAttrs systems {}); + }; } diff --git a/home/muzaffar.nix b/home/muzaffar.nix index 59f509c..e0a9919 100644 --- a/home/muzaffar.nix +++ b/home/muzaffar.nix @@ -1,12 +1,11 @@ -{ - inputs, - lib, - pkgs, - config, - outputs, - packages, - self, - ... +{ inputs +, lib +, pkgs +, config +, outputs +, packages +, self +, ... }: { imports = [ outputs.homeManagerModules.zsh diff --git a/home/sakhib.nix b/home/sakhib.nix index 46c6fba..1cad58e 100644 --- a/home/sakhib.nix +++ b/home/sakhib.nix @@ -1,12 +1,11 @@ -{ - inputs, - lib, - pkgs, - config, - outputs, - packages, - self, - ... +{ inputs +, lib +, pkgs +, config +, outputs +, packages +, self +, ... }: { imports = [ outputs.homeManagerModules.zsh diff --git a/home/shakhzod.nix b/home/shakhzod.nix index 96b5f5f..d4c52b8 100644 --- a/home/shakhzod.nix +++ b/home/shakhzod.nix @@ -1,12 +1,11 @@ -{ - inputs, - lib, - pkgs, - config, - outputs, - packages, - self, - ... +{ inputs +, lib +, pkgs +, config +, outputs +, packages +, self +, ... }: { imports = [ outputs.homeManagerModules.zsh diff --git a/modules/home/nixpkgs/default.nix b/modules/home/nixpkgs/default.nix index b9bc5cd..d5ec21a 100644 --- a/modules/home/nixpkgs/default.nix +++ b/modules/home/nixpkgs/default.nix @@ -1,4 +1,4 @@ -{outputs, ...}: { +{ outputs, ... }: { config = { nixpkgs = { # You can add overlays here diff --git a/modules/home/packages/default.nix b/modules/home/packages/default.nix index 4f8c62d..1b4e214 100644 --- a/modules/home/packages/default.nix +++ b/modules/home/packages/default.nix @@ -1,9 +1,9 @@ -{ - config, - pkgs, - lib, - ... -}: let +{ config +, pkgs +, lib +, ... +}: +let linux = with pkgs; [ # Add new packages here docker-compose @@ -59,7 +59,8 @@ # Selfmade programs fp ]; -in { +in +{ config = { # Packages to be installed on my machine home.packages = globals ++ linux; diff --git a/modules/home/topgrade/default.nix b/modules/home/topgrade/default.nix index d9c01b1..9957d4b 100644 --- a/modules/home/topgrade/default.nix +++ b/modules/home/topgrade/default.nix @@ -1,4 +1,4 @@ -{pkgs, ...}: { +{ pkgs, ... }: { config = { programs.topgrade = { enable = true; @@ -17,10 +17,10 @@ assume_yes = true; no_self_update = true; }; - commands = {}; + commands = { }; linux = { nix_arguments = "--flake github:kolyma-labs/instances"; - home_manager_arguments = ["--flake" "github:kolyma-labs/instances"]; + home_manager_arguments = [ "--flake" "github:kolyma-labs/instances" ]; }; }; }; diff --git a/modules/home/zsh/default.nix b/modules/home/zsh/default.nix index ac6a71b..3c95c17 100644 --- a/modules/home/zsh/default.nix +++ b/modules/home/zsh/default.nix @@ -1,4 +1,4 @@ -{pkgs, ...}: { +{ pkgs, ... }: { imports = [ ./zoxide.nix ./starship.nix diff --git a/modules/home/zsh/starship.nix b/modules/home/zsh/starship.nix index a025c62..57acce2 100644 --- a/modules/home/zsh/starship.nix +++ b/modules/home/zsh/starship.nix @@ -1,4 +1,4 @@ -{pkgs, ...}: { +{ pkgs, ... }: { # Prettier terminal prompt programs.starship = { enable = true; diff --git a/modules/home/zsh/zoxide.nix b/modules/home/zsh/zoxide.nix index 7191075..8c46a75 100644 --- a/modules/home/zsh/zoxide.nix +++ b/modules/home/zsh/zoxide.nix @@ -1,4 +1,4 @@ -{pkgs, ...}: { +{ pkgs, ... }: { # Zpxide path integration programs.zoxide = { enable = true; diff --git a/modules/nixos/boot.nix b/modules/nixos/boot.nix index 4d91e25..7fafe58 100644 --- a/modules/nixos/boot.nix +++ b/modules/nixos/boot.nix @@ -1,9 +1,9 @@ -{ - pkgs, - lib, - config, - ... -}: let +{ pkgs +, lib +, config +, ... +}: +let raid = lib.mkIf config.boot.bios.raided { boot.swraid = { enable = true; @@ -20,7 +20,7 @@ }; }; - mirrors = lib.mkIf (config.boot.bios.mirrors != []) { + mirrors = lib.mkIf (config.boot.bios.mirrors != [ ]) { boot.loader.grub.mirroredBoots = [ { devices = config.boot.bios.mirrors; @@ -32,7 +32,8 @@ cfg = lib.mkIf config.boot.bios.enable { boot.loader.grub.enable = true; }; -in { +in +{ options = { boot.bios = { enable = lib.mkOption { @@ -49,7 +50,7 @@ in { mirrors = lib.mkOption { type = lib.types.listOf lib.types.str; - default = []; + default = [ ]; description = "List of devices to mirror the boot partition to."; }; @@ -61,5 +62,5 @@ in { }; }; - config = lib.mkMerge [raid mirrors uefi cfg]; + config = lib.mkMerge [ raid mirrors uefi cfg ]; } diff --git a/modules/nixos/data.nix b/modules/nixos/data.nix index 09d58b9..ca3ae56 100644 --- a/modules/nixos/data.nix +++ b/modules/nixos/data.nix @@ -1,8 +1,7 @@ -{ - config, - lib, - pkgs, - ... +{ config +, lib +, pkgs +, ... }: { config = { users.groups.admins = { @@ -19,7 +18,7 @@ systemd.services.chownSrv = { description = "Change ownership of /srv"; - wantedBy = ["multi-user.target"]; + wantedBy = [ "multi-user.target" ]; serviceConfig = { Type = "oneshot"; ExecStart = "${pkgs.bash}/bin/bash -c ${config.system.activationScripts.chownSrv.text}"; diff --git a/modules/nixos/docker.nix b/modules/nixos/docker.nix index 5015cde..1c19765 100644 --- a/modules/nixos/docker.nix +++ b/modules/nixos/docker.nix @@ -1,9 +1,8 @@ -{ - config, - lib, - pkgs, - inputs, - ... +{ config +, lib +, pkgs +, inputs +, ... }: { config = { virtualisation = { diff --git a/modules/nixos/maid.nix b/modules/nixos/maid.nix index b8ecbca..9ec528e 100644 --- a/modules/nixos/maid.nix +++ b/modules/nixos/maid.nix @@ -1,9 +1,8 @@ -{ - config, - lib, - pkgs, - inputs, - ... +{ config +, lib +, pkgs +, inputs +, ... }: { config = { nix.gc = { diff --git a/modules/nixos/network.nix b/modules/nixos/network.nix index ab522b9..437c2f7 100644 --- a/modules/nixos/network.nix +++ b/modules/nixos/network.nix @@ -1,13 +1,14 @@ -{ - pkgs, - lib, - config, - ... -}: let - gateway = ip: let - parts = lib.splitString "." ip; - in - lib.concatStringsSep "." (lib.take 3 parts ++ ["1"]); +{ pkgs +, lib +, config +, ... +}: +let + gateway = ip: + let + parts = lib.splitString "." ip; + in + lib.concatStringsSep "." (lib.take 3 parts ++ [ "1" ]); ipv4 = lib.mkIf config.network.ipv4.enable { networking = { @@ -73,7 +74,8 @@ nameservers = config.network.nameserver; }; }; -in { +in +{ options = { network = { enable = lib.mkOption { @@ -114,7 +116,7 @@ in { nameserver = lib.mkOption { type = lib.types.listOf lib.types.str; - default = ["8.8.8.8" "8.8.4.4"]; + default = [ "8.8.8.8" "8.8.4.4" ]; description = "DNS nameserver."; }; }; @@ -124,5 +126,5 @@ in { # (the default) this is the recommended approach. When using systemd-networkd it's # still possible to use this option, but it's recommended to use it in conjunction # with explicit per-interface declarations with `networking.interfaces..useDHCP`. - config = lib.mkMerge [ipv4 ipv6 cfg]; + config = lib.mkMerge [ ipv4 ipv6 cfg ]; } diff --git a/modules/nixos/nixpkgs.nix b/modules/nixos/nixpkgs.nix index d1df8ea..cc23ae4 100644 --- a/modules/nixos/nixpkgs.nix +++ b/modules/nixos/nixpkgs.nix @@ -1,10 +1,9 @@ -{ - pkgs, - outputs, - lib, - config, - inputs, - ... +{ pkgs +, outputs +, lib +, config +, inputs +, ... }: { config = { nixpkgs = { @@ -36,7 +35,7 @@ nix = { # This will add each flake input as a registry # To make nix3 commands consistent with your flake - registry = lib.mapAttrs (_: value: {flake = value;}) inputs; + registry = lib.mapAttrs (_: value: { flake = value; }) inputs; # This will additionally add your inputs to the system's legacy channels # Making legacy nix commands consistent as well, awesome! diff --git a/modules/nixos/ssh.nix b/modules/nixos/ssh.nix index bb802b8..cd9218c 100644 --- a/modules/nixos/ssh.nix +++ b/modules/nixos/ssh.nix @@ -1,4 +1,4 @@ -{...}: { +{ ... }: { config = { # This setups a SSH server. Very important if you're setting up a headless system. # Feel free to remove if you don't need it. @@ -10,7 +10,7 @@ # Use keys only. Remove if you want to SSH using password (not recommended) PasswordAuthentication = false; }; - ports = [2222]; + ports = [ 2222 ]; }; }; } diff --git a/modules/nixos/users/muzaffar.nix b/modules/nixos/users/muzaffar.nix index e0d7e64..1e2d580 100644 --- a/modules/nixos/users/muzaffar.nix +++ b/modules/nixos/users/muzaffar.nix @@ -1,11 +1,10 @@ -{ - pkgs, - inputs, - outputs, - lib, - config, - packages, - ... +{ pkgs +, inputs +, outputs +, lib +, config +, packages +, ... }: { config = { users.users = { @@ -16,12 +15,12 @@ openssh.authorizedKeys.keys = [ "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJHDSH+E/7791S2x2QF3WsQU1nnr7WNLyK1BubDmOeib muzaffar.gaming7@gmail.com" ]; - extraGroups = ["networkmanager" "wheel" "docker" "admins"]; + extraGroups = [ "networkmanager" "wheel" "docker" "admins" ]; }; }; home-manager = { - extraSpecialArgs = {inherit inputs outputs;}; + extraSpecialArgs = { inherit inputs outputs; }; users = { # Import your home-manager configuration muzaffar = import ../../../home/muzaffar.nix; diff --git a/modules/nixos/users/sakhib.nix b/modules/nixos/users/sakhib.nix index 75610cf..3a10686 100644 --- a/modules/nixos/users/sakhib.nix +++ b/modules/nixos/users/sakhib.nix @@ -1,11 +1,10 @@ -{ - pkgs, - inputs, - outputs, - lib, - config, - packages, - ... +{ pkgs +, inputs +, outputs +, lib +, config +, packages +, ... }: { config = { users.users = { @@ -16,12 +15,12 @@ openssh.authorizedKeys.keys = [ "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDAGqU+JleLM0T44P2quirtLPrhFExOi6EOe0GYXkTFcTSjhw9LqiuX1/FbqNdKTaP9k6CdV3xc/8Z5wxbNOhpcPi9XLoupv9oNyIew7QYl+ZoAck6/qPsM7uptGYCwo0/ErzPNLd3ERD3KT1axCqrI6rWJ+JFOMAPtGeAZZxIedksViZ5SuNhpzXCIzS2PACqDTxFj7JwXK/pQ200h9ZS0MSh7iLKggXQfRVDndJxRnVY69NmbRa4MqkjgyxqWSDbqrDAXuTHpqKJ5kpXJ6p2a82EIHcCwXXpEmLwKxatxWJWJb9nurm3aS74BYmT3pRVVSPC6n5a2LWN9GxzvVh3AXXZtWGvjXSqBxHdSyUoDPuZnDneycdRC5vs6I1jSGTyDFdc4Etq1M5uUYb6SqCjJIBvTNqVnOf8nzFwl/ENvc8sbIVtILgAbBdwDiiQSu8xppqWMZfkQJy+uI5Ok7TZ8o5rGIblzfKyTiljCQb7RO7Klg3TwysetREn8ZEykBx0= This world soon will cherish into my darkness of my madness" ]; - extraGroups = ["networkmanager" "wheel" "docker" "admins"]; + extraGroups = [ "networkmanager" "wheel" "docker" "admins" ]; }; }; home-manager = { - extraSpecialArgs = {inherit inputs outputs;}; + extraSpecialArgs = { inherit inputs outputs; }; users = { # Import your home-manager configuration sakhib = import ../../../home/sakhib.nix; diff --git a/modules/nixos/users/shakhzod.nix b/modules/nixos/users/shakhzod.nix index 1df0a77..7be7bd3 100644 --- a/modules/nixos/users/shakhzod.nix +++ b/modules/nixos/users/shakhzod.nix @@ -1,11 +1,10 @@ -{ - pkgs, - inputs, - outputs, - lib, - config, - packages, - ... +{ pkgs +, inputs +, outputs +, lib +, config +, packages +, ... }: { config = { users.users = { @@ -16,12 +15,12 @@ openssh.authorizedKeys.keys = [ "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDGU7pRKuTWfzRy8+Hb6vKz4+FNKfDzKA0HCLw+cxDCVXqsCBJPZXTfUZV1fxfBhfgn2IBOw99DbnmRaYeSm48ZB7V0xwqgM8Ucy2m4MJytvPbyjoEcfV434J3Xm+1R5P4tn5BvFPPseBBFrahsKXvakT07hiEJe6S28KuC3zvMN/cORfGuViGuZRslRuT3ozd8pJtDcWSod5f3ek59qwYrC8KS8ljR7kBJWgdJvAOyifuDd9POh4TcbXOykcDqYKlZlWLnFoZcCE3QUcOAELyBffEtMFRd/4N+Mgwdf6Y4YjspHNDfnSKRgNQVH/zYBnIV9jt/umdAyN9Kby0v/EGv9HI0Kb5t2/eCLPCDSyb4AQChb25xMTkGXcXcqIrLCWl6oR1/QfqUfuC8KJRp5Nj9saoi9pxtzAqU4/EXXL1EwYHaICK4LOYW+2la05Pv8wzX4ne9Xpoo0jJNCHioYacvJC1noWrDSmRU6oEhQqHKGBQU0drC/pYLmZhjAhi0JQE= shakhzod@shakhzod-workpc" ]; - extraGroups = ["networkmanager" "wheel" "docker" "admins"]; + extraGroups = [ "networkmanager" "wheel" "docker" "admins" ]; }; }; home-manager = { - extraSpecialArgs = {inherit inputs outputs;}; + extraSpecialArgs = { inherit inputs outputs; }; users = { # Import your home-manager configuration shakhzod = import ../../../home/shakhzod.nix; diff --git a/modules/nixos/zsh.nix b/modules/nixos/zsh.nix index 9d41f98..0f59a76 100644 --- a/modules/nixos/zsh.nix +++ b/modules/nixos/zsh.nix @@ -1,7 +1,6 @@ -{ - pkgs, - inputs, - ... +{ pkgs +, inputs +, ... }: { config = { # Installing zsh for system @@ -12,8 +11,8 @@ # System configurations environment = { - shells = with pkgs; [zsh]; - pathsToLink = ["/share/zsh"]; + shells = with pkgs; [ zsh ]; + pathsToLink = [ "/share/zsh" ]; systemPackages = with pkgs; [ inputs.home-manager.packages.${pkgs.system}.default ]; diff --git a/modules/server/bind/default.nix b/modules/server/bind/default.nix index e43f67d..58290f2 100644 --- a/modules/server/bind/default.nix +++ b/modules/server/bind/default.nix @@ -1,16 +1,17 @@ -{ - config, - pkgs, - lib, - ... -}: let +{ config +, pkgs +, lib +, ... +}: +let # Statically defined list of zones - zones = ["kolyma.uz"]; + zones = [ "kolyma.uz" ]; - generateZone = zone: type: let - master = type == "master"; - file = "/var/dns/${zone}.zone"; - in + generateZone = zone: type: + let + master = type == "master"; + file = "/var/dns/${zone}.zone"; + in if master then { inherit master file; @@ -23,7 +24,8 @@ # Map through given array of zones and generate zone object list zonesMap = zones: type: - lib.listToAttrs (map (zone: { + lib.listToAttrs (map + (zone: { name = zone; value = generateZone zone type; }) @@ -38,7 +40,7 @@ cp -f "$zoneFile" /var/dns/ done ''; - deps = []; + deps = [ ]; }; }; @@ -50,10 +52,11 @@ }; # DNS standard port for connections + that require more than 512 bytes - networking.firewall.allowedUDPPorts = [53]; - networking.firewall.allowedTCPPorts = [53]; + networking.firewall.allowedUDPPorts = [ 53 ]; + networking.firewall.allowedTCPPorts = [ 53 ]; }; -in { +in +{ options = { services.nameserver = { enable = lib.mkOption { @@ -63,20 +66,20 @@ in { }; type = lib.mkOption { - type = lib.types.enum ["master" "slave"]; + type = lib.types.enum [ "master" "slave" ]; default = "master"; description = "The type of the bind zone, either 'master' or 'slave'."; }; masters = lib.mkOption { type = lib.types.listOf lib.types.str; - default = ["5.9.66.12"]; + default = [ "5.9.66.12" ]; description = "IP address of the master server."; }; slaves = lib.mkOption { type = lib.types.listOf lib.types.str; - default = ["65.109.61.35"]; + default = [ "65.109.61.35" ]; description = "List of slave servers."; }; diff --git a/modules/server/caddy/kolyma-1.nix b/modules/server/caddy/kolyma-1.nix index 5a19b1a..03864bb 100644 --- a/modules/server/caddy/kolyma-1.nix +++ b/modules/server/caddy/kolyma-1.nix @@ -1,8 +1,7 @@ -{ - config, - lib, - pkgs, - ... +{ config +, lib +, pkgs +, ... }: { config = { # Configure Caddy @@ -34,7 +33,7 @@ }; # Ensure the firewall allows HTTP and HTTPS traffic - networking.firewall.allowedTCPPorts = [80 443]; - networking.firewall.allowedUDPPorts = [80 443]; + networking.firewall.allowedTCPPorts = [ 80 443 ]; + networking.firewall.allowedUDPPorts = [ 80 443 ]; }; } diff --git a/modules/server/caddy/kolyma-2.nix b/modules/server/caddy/kolyma-2.nix index 3a325e6..04b1630 100644 --- a/modules/server/caddy/kolyma-2.nix +++ b/modules/server/caddy/kolyma-2.nix @@ -1,8 +1,7 @@ -{ - config, - lib, - pkgs, - ... +{ config +, lib +, pkgs +, ... }: { config = { # Configure Caddy @@ -39,7 +38,7 @@ }; # Ensure the firewall allows HTTP and HTTPS traffic - networking.firewall.allowedTCPPorts = [80 443]; - networking.firewall.allowedUDPPorts = [80 443]; + networking.firewall.allowedTCPPorts = [ 80 443 ]; + networking.firewall.allowedUDPPorts = [ 80 443 ]; }; } diff --git a/modules/server/caddy/kolyma-3.nix b/modules/server/caddy/kolyma-3.nix index 6839b4e..6fb5fde 100644 --- a/modules/server/caddy/kolyma-3.nix +++ b/modules/server/caddy/kolyma-3.nix @@ -1,8 +1,7 @@ -{ - config, - lib, - pkgs, - ... +{ config +, lib +, pkgs +, ... }: { config = { # Configure Caddy @@ -38,12 +37,12 @@ "www.cxsmxs.space" ]; extraConfig = '' - reverse_proxy 127.0.0.1:8100 { - header_up Host {host} - header_up X-Real-IP {remote} - header_up Upgrade {http_upgrade} - header_up Connection {>Connection} - } + reverse_proxy 127.0.0.1:8100 { + header_up Host {host} + header_up X-Real-IP {remote} + header_up Upgrade {http_upgrade} + header_up Connection {>Connection} + } ''; }; @@ -53,12 +52,12 @@ "chat.haskell.uz" ]; extraConfig = '' - reverse_proxy 127.0.0.1:8450 { - header_up Host {host} - header_up X-Real-IP {remote} - header_up Upgrade {http_upgrade} - header_up Connection {>Connection} - } + reverse_proxy 127.0.0.1:8450 { + header_up Host {host} + header_up X-Real-IP {remote} + header_up Upgrade {http_upgrade} + header_up Connection {>Connection} + } ''; }; @@ -67,11 +66,23 @@ reverse_proxy 127.0.0.1:8445 ''; }; + + "cryptoshop.uz" = { + extraConfig = '' + reverse_proxy 127.0.0.1:8461 + ''; + }; + + "api.cryptoshop.uz" = { + extraConfig = '' + reverse_proxy 127.0.0.1:8460 + ''; + }; }; }; # Ensure the firewall allows HTTP and HTTPS traffic - networking.firewall.allowedTCPPorts = [80 443]; - networking.firewall.allowedUDPPorts = [80 443]; + networking.firewall.allowedTCPPorts = [ 80 443 ]; + networking.firewall.allowedUDPPorts = [ 80 443 ]; }; } diff --git a/modules/server/container/kolyma-1.nix b/modules/server/container/kolyma-1.nix index 701fe5e..202ca56 100644 --- a/modules/server/container/kolyma-1.nix +++ b/modules/server/container/kolyma-1.nix @@ -1,9 +1,8 @@ -{ - config, - lib, - pkgs, - outputs, - ... +{ config +, lib +, pkgs +, outputs +, ... }: { imports = [ outputs.nixosModules.docker @@ -17,7 +16,7 @@ # |__/|__/\___/_.___/____/_/\__/\___/ website = { image = "ghcr.io/kolyma-labs/gate:master"; - ports = ["8440:80"]; + ports = [ "8440:80" ]; }; # _______ __ ____ diff --git a/modules/server/container/kolyma-2.nix b/modules/server/container/kolyma-2.nix index 7d11e07..fdfa273 100644 --- a/modules/server/container/kolyma-2.nix +++ b/modules/server/container/kolyma-2.nix @@ -1,9 +1,8 @@ -{ - config, - lib, - pkgs, - outputs, - ... +{ config +, lib +, pkgs +, outputs +, ... }: { imports = [ outputs.nixosModules.docker @@ -17,7 +16,7 @@ # |__/|__/\___/_.___/____/_/\__/\___/ website = { image = "ghcr.io/kolyma-labs/gate:master"; - ports = ["8440:80"]; + ports = [ "8440:80" ]; }; # _______ __ __ __ @@ -52,7 +51,7 @@ volumes = [ "/srv/remote:/root" ]; - cmd = ["hbbr"]; + cmd = [ "hbbr" ]; extraOptions = [ "--network=host" ]; @@ -63,7 +62,7 @@ volumes = [ "/srv/remote:/root" ]; - cmd = ["hbbs"]; + cmd = [ "hbbs" ]; dependsOn = [ "remote-hbbr" ]; diff --git a/modules/server/container/kolyma-3.nix b/modules/server/container/kolyma-3.nix index e113b08..9730935 100644 --- a/modules/server/container/kolyma-3.nix +++ b/modules/server/container/kolyma-3.nix @@ -1,9 +1,8 @@ -{ - config, - lib, - pkgs, - outputs, - ... +{ config +, lib +, pkgs +, outputs +, ... }: { imports = [ outputs.nixosModules.docker @@ -17,17 +16,17 @@ # |__/|__/\___/_.___/____/_/\__/\___/ website = { image = "ghcr.io/kolyma-labs/gate@sha256:2a1cfdfe8e78aa4173c260f5f1a40640785e182ca4aebfe09dc7b0544c4c24fd"; - ports = ["8440:80"]; + ports = [ "8440:80" ]; }; khakimovs = { image = "ghcr.io/khakimovs/website@sha256:87827e103623f301dff0b55dfea34ee9a841c5a5718a065b777a1e2d730db494"; - ports = ["8441:3000"]; + ports = [ "8441:3000" ]; }; bot-xinuxmgr = { image = "ghcr.io/xinux-org/xinuxmgr@sha256:0b43cfd6f01f9cc03fcdc817975a42a8e2670c844758d50d1674de3ea10b8ae0"; - ports = ["8445:8445"]; + ports = [ "8445:8445" ]; environmentFiles = [ /srv/bots/xinuxmgr.env ]; diff --git a/nixos/kolyma-1/hardware-configuration.nix b/nixos/kolyma-1/hardware-configuration.nix index 6bd4139..2c27e92 100644 --- a/nixos/kolyma-1/hardware-configuration.nix +++ b/nixos/kolyma-1/hardware-configuration.nix @@ -1,23 +1,22 @@ -{ - config, - lib, - pkgs, - modulesPath, - ... +{ config +, lib +, pkgs +, modulesPath +, ... }: { imports = [ (modulesPath + "/installer/scan/not-detected.nix") ]; - boot.initrd.availableKernelModules = ["xhci_pci" "ahci" "nvme" "usbhid"]; - boot.initrd.kernelModules = ["nvme"]; - boot.kernelModules = ["kvm-amd"]; - boot.extraModulePackages = []; + boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usbhid" ]; + boot.initrd.kernelModules = [ "nvme" ]; + boot.kernelModules = [ "kvm-amd" ]; + boot.extraModulePackages = [ ]; boot.bios = { enable = true; raided = true; - mirrors = ["/dev/nvme0n1" "/dev/nvme1n1"]; + mirrors = [ "/dev/nvme0n1" "/dev/nvme1n1" ]; }; fileSystems."/" = { @@ -31,7 +30,7 @@ }; swapDevices = [ - {device = "/dev/disk/by-uuid/e41e140f-53f3-4663-b6e4-db64dc02c2f2";} + { device = "/dev/disk/by-uuid/e41e140f-53f3-4663-b6e4-db64dc02c2f2"; } ]; network = { diff --git a/nixos/kolyma-1/services.nix b/nixos/kolyma-1/services.nix index 6124f36..42583d9 100644 --- a/nixos/kolyma-1/services.nix +++ b/nixos/kolyma-1/services.nix @@ -1,9 +1,8 @@ -{ - config, - lib, - pkgs, - outputs, - ... +{ config +, lib +, pkgs +, outputs +, ... }: { # Deployed Services imports = [ @@ -34,6 +33,6 @@ "xinux.uz" "haskell.uz" ]; - slaves = ["65.109.61.35"]; + slaves = [ "65.109.61.35" ]; }; } diff --git a/nixos/kolyma-2/hardware-configuration.nix b/nixos/kolyma-2/hardware-configuration.nix index 5887b41..24d745d 100644 --- a/nixos/kolyma-2/hardware-configuration.nix +++ b/nixos/kolyma-2/hardware-configuration.nix @@ -1,23 +1,22 @@ -{ - config, - lib, - pkgs, - modulesPath, - ... +{ config +, lib +, pkgs +, modulesPath +, ... }: { imports = [ (modulesPath + "/installer/scan/not-detected.nix") ]; - boot.initrd.availableKernelModules = ["xhci_pci" "ahci" "nvme" "usbhid"]; - boot.initrd.kernelModules = ["nvme"]; - boot.kernelModules = ["kvm-amd"]; - boot.extraModulePackages = []; + boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usbhid" ]; + boot.initrd.kernelModules = [ "nvme" ]; + boot.kernelModules = [ "kvm-amd" ]; + boot.extraModulePackages = [ ]; boot.bios = { enable = true; raided = true; - mirrors = ["/dev/nvme0n1"]; + mirrors = [ "/dev/nvme0n1" ]; }; fileSystems."/" = { @@ -31,7 +30,7 @@ }; swapDevices = [ - {device = "/dev/disk/by-uuid/3ad38ead-cb6a-4e4c-9b5d-acb1fc67e444";} + { device = "/dev/disk/by-uuid/3ad38ead-cb6a-4e4c-9b5d-acb1fc67e444"; } ]; network = { diff --git a/nixos/kolyma-2/services.nix b/nixos/kolyma-2/services.nix index dc46322..0763396 100644 --- a/nixos/kolyma-2/services.nix +++ b/nixos/kolyma-2/services.nix @@ -1,9 +1,8 @@ -{ - config, - lib, - pkgs, - outputs, - ... +{ config +, lib +, pkgs +, outputs +, ... }: { # Deployed Services imports = [ @@ -34,6 +33,6 @@ "xinux.uz" "haskell.uz" ]; - masters = ["5.9.66.12"]; + masters = [ "5.9.66.12" ]; }; } diff --git a/nixos/kolyma-3/hardware-configuration.nix b/nixos/kolyma-3/hardware-configuration.nix index bfb83e8..895b9c5 100644 --- a/nixos/kolyma-3/hardware-configuration.nix +++ b/nixos/kolyma-3/hardware-configuration.nix @@ -1,24 +1,23 @@ -{ - config, - lib, - pkgs, - modulesPath, - ... +{ config +, lib +, pkgs +, modulesPath +, ... }: { imports = [ (modulesPath + "/installer/scan/not-detected.nix") ]; - boot.initrd.availableKernelModules = ["xhci_pci" "ahci" "nvme" "usbhid"]; - boot.initrd.kernelModules = ["nvme"]; - boot.kernelModules = ["kvm-amd"]; - boot.extraModulePackages = []; + boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usbhid" ]; + boot.initrd.kernelModules = [ "nvme" ]; + boot.kernelModules = [ "kvm-amd" ]; + boot.extraModulePackages = [ ]; boot.bios = { enable = true; uefi = true; raided = true; - mirrors = ["/dev/nvme0n1" "/dev/nvme1n1"]; + mirrors = [ "/dev/nvme0n1" "/dev/nvme1n1" ]; }; fileSystems."/" = { @@ -29,11 +28,11 @@ fileSystems."/boot" = { device = "/dev/disk/by-uuid/1B12-CEDF"; fsType = "vfat"; - options = ["fmask=0022" "dmask=0022"]; + options = [ "fmask=0022" "dmask=0022" ]; }; swapDevices = [ - {device = "/dev/disk/by-uuid/1e7187bf-7374-41d6-bf0d-4c38a51e02bd";} + { device = "/dev/disk/by-uuid/1e7187bf-7374-41d6-bf0d-4c38a51e02bd"; } ]; network = { diff --git a/nixos/kolyma-3/services.nix b/nixos/kolyma-3/services.nix index 07f0bae..9a95c03 100644 --- a/nixos/kolyma-3/services.nix +++ b/nixos/kolyma-3/services.nix @@ -1,9 +1,8 @@ -{ - config, - lib, - pkgs, - outputs, - ... +{ config +, lib +, pkgs +, outputs +, ... }: { # Deployed Services imports = [ diff --git a/overlays/default.nix b/overlays/default.nix index a13ea3c..2c21f95 100644 --- a/overlays/default.nix +++ b/overlays/default.nix @@ -1,7 +1,7 @@ # This file defines overlays -{inputs, ...}: { +{ inputs, ... }: { # This one brings our custom packages from the 'pkgs' directory - additions = final: _prev: import ../pkgs {pkgs = final;}; + additions = final: _prev: import ../pkgs { pkgs = final; }; # This one contains whatever you want to overlay # You can change versions, add patches, set compilation flags, anything really. diff --git a/pkgs/default.nix b/pkgs/default.nix index 6fb48bc..21c694b 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -1,6 +1,6 @@ # Custom packages, that can be defined similarly to ones from nixpkgs # You can build them using 'nix build .#example' -{pkgs ? import {}}: rec { +{ pkgs ? import { } }: rec { # Personal scripts - fp = pkgs.callPackage ./fp {}; + fp = pkgs.callPackage ./fp { }; } diff --git a/pkgs/fp/default.nix b/pkgs/fp/default.nix index 3dde5df..e9b40e0 100644 --- a/pkgs/fp/default.nix +++ b/pkgs/fp/default.nix @@ -1,16 +1,16 @@ # Cleans up dev space # devcc -{ - lib, - writeShellApplication, - git, +{ lib +, writeShellApplication +, git +, }: (writeShellApplication { name = "fp"; - runtimeInputs = [git]; + runtimeInputs = [ git ]; text = builtins.readFile ./fp.sh; }) -// { + // { meta = with lib; { licenses = licenses.mit; platforms = platforms.all; diff --git a/shell.nix b/shell.nix index f4f644b..8b6042f 100644 --- a/shell.nix +++ b/shell.nix @@ -1,13 +1,12 @@ -{ - pkgs ? let +{ pkgs ? let lock = (builtins.fromJSON (builtins.readFile ./flake.lock)).nodes.nixpkgs.locked; nixpkgs = fetchTarball { url = "https://github.com/nixos/nixpkgs/archive/${lock.rev}.tar.gz"; sha256 = lock.narHash; }; in - import nixpkgs {overlays = [];}, - ... + import nixpkgs { overlays = [ ]; } +, ... }: { default = pkgs.mkShell { NIX_CONFIG = "extra-experimental-features = nix-command flakes repl-flake";