diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml deleted file mode 100644 index 137d72d..0000000 --- a/.github/workflows/validate.yml +++ /dev/null @@ -1,27 +0,0 @@ -name: Validate - -on: - pull_request: - -jobs: - validate: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - uses: cachix/install-nix-action@v26 - with: - extra_nix_config: | - trusted-users = root @runner - - - name: Validate flake - run: nix flake show - - - name: Check formatting - run: nix fmt --check . - - - name: Run deadnix - run: deadnix ./modules ./lib - - - name: Run statix - run: statix check ./modules ./lib diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml deleted file mode 100644 index a6b8116..0000000 --- a/.pre-commit-config.yaml +++ /dev/null @@ -1,18 +0,0 @@ -repos: - - repo: local - hooks: - - id: nixfmt - name: nixfmt - entry: nixfmt - language: system - types: [nix] - pass_filenames: false - args: ["."] - - - id: deadnix - name: deadnix - entry: deadnix - language: system - types: [nix] - args: ["./modules", "./lib"] - diff --git a/.sops.yaml b/.sops.yaml index 09d78a0..bc2cfd3 100644 --- a/.sops.yaml +++ b/.sops.yaml @@ -60,8 +60,6 @@ creation_rules: key_groups: - age: - *system_rainbow_planet - - path_regex: ^\.pre-commit-config\.yaml$ - # Plain YAML file, not encrypted - path_regex: modules/shared/secrets.yaml$ key_groups: - age: diff --git a/examples/flake-structure.nix b/examples/flake-structure.nix index 5575f26..93b7608 100644 --- a/examples/flake-structure.nix +++ b/examples/flake-structure.nix @@ -6,41 +6,38 @@ nixos-hardware.url = "github:NixOS/nixos-hardware"; }; - outputs = - inputs@{ self, ... }: - let - # Import helper functions from lib/ - localLib = import ./lib { inherit inputs; }; - in - { - # Darwin (macOS) hosts - darwinConfigurations = { - mightymac = localLib.mkDarwinHost { - system = "aarch64-darwin"; - hostname = "mightymac"; - username = "gene.liverman"; - }; - }; - - # NixOS hosts - nixosConfigurations = { - rainbow-planet = localLib.mkNixosHost { - system = "x86_64-linux"; - hostname = "rainbow-planet"; - username = "gene"; - additionalModules = [ - inputs.nixos-hardware.nixosModules.dell-xps-13-9360 - ]; - }; - }; - - # Home Manager (only) users - homeConfigurations = { - gene = localLib.mkHomeConfig { - system = "x86_64-linux"; - homeDirectory = "/home/gene"; - username = "gene"; - }; + outputs = inputs@{ self, ... }: let + # Import helper functions from lib/ + localLib = import ./lib { inherit inputs; }; + in { + # Darwin (macOS) hosts + darwinConfigurations = { + mightymac = localLib.mkDarwinHost { + system = "aarch64-darwin"; + hostname = "mightymac"; + username = "gene.liverman"; }; }; + + # NixOS hosts + nixosConfigurations = { + rainbow-planet = localLib.mkNixosHost { + system = "x86_64-linux"; + hostname = "rainbow-planet"; + username = "gene"; + additionalModules = [ + inputs.nixos-hardware.nixosModules.dell-xps-13-9360 + ]; + }; + }; + + # Home Manager (only) users + homeConfigurations = { + gene = localLib.mkHomeConfig { + system = "x86_64-linux"; + homeDirectory = "/home/gene"; + username = "gene"; + }; + }; + }; } diff --git a/flake.lock b/flake.lock index 4513a73..b906cdf 100644 --- a/flake.lock +++ b/flake.lock @@ -69,25 +69,6 @@ "type": "github" } }, - "deadnix": { - "inputs": { - "nixpkgs": "nixpkgs", - "utils": "utils" - }, - "locked": { - "lastModified": 1764114543, - "narHash": "sha256-+C39E8qmGODT6eB0rhE/VX+DcekXW/Xww5IL/xlERNY=", - "owner": "astro", - "repo": "deadnix", - "rev": "d590041677add62267bef35ddec63cd9402d3505", - "type": "github" - }, - "original": { - "owner": "astro", - "repo": "deadnix", - "type": "github" - } - }, "disko": { "inputs": { "nixpkgs": [ @@ -130,28 +111,6 @@ "type": "github" } }, - "fenix_2": { - "inputs": { - "nixpkgs": [ - "statix", - "nixpkgs" - ], - "rust-analyzer-src": "rust-analyzer-src_2" - }, - "locked": { - "lastModified": 1645251813, - "narHash": "sha256-cQ66tGjnZclBCS3nD26mZ5fUH+3/HnysGffBiWXUSHk=", - "owner": "nix-community", - "repo": "fenix", - "rev": "9892337b588c38ec59466a1c89befce464aae7f8", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "fenix", - "type": "github" - } - }, "flake-compat": { "flake": false, "locked": { @@ -238,7 +197,7 @@ "crane": "crane", "fenix": "fenix", "nix-unit-src": "nix-unit-src", - "nixpkgs": "nixpkgs_2", + "nixpkgs": "nixpkgs", "pre-commit-hooks": "pre-commit-hooks" }, "locked": { @@ -349,11 +308,11 @@ ] }, "locked": { - "lastModified": 1773264488, - "narHash": "sha256-rK0507bDuWBrZo+0zts9bCs/+RRUEHuvFE5DHWPxX/Q=", + "lastModified": 1772985280, + "narHash": "sha256-FdrNykOoY9VStevU4zjSUdvsL9SzJTcXt4omdEDZDLk=", "owner": "nix-community", "repo": "home-manager", - "rev": "5c0f63f8d55040a7eed69df7e3fcdd15dfb5a04c", + "rev": "8f736f007139d7f70752657dff6a401a585d6cbc", "type": "github" }, "original": { @@ -372,11 +331,11 @@ "treefmt-nix": "treefmt-nix" }, "locked": { - "lastModified": 1773371628, - "narHash": "sha256-G9+d9C/7hz8qBFHOCzdH34Cj6MBNOlE9kCNfF+PKPZM=", + "lastModified": 1772680513, + "narHash": "sha256-zwVeM1TgfwMIq026uln9hqcCIINsLv6jEjztPqx0q+U=", "owner": "numtide", "repo": "nix-auth", - "rev": "09a9b568631cfbf4a70058bbff495b7e854aedc4", + "rev": "77c07e9a107972dd2170da6da9ed1e73e65c4a4a", "type": "github" }, "original": { @@ -521,16 +480,16 @@ }, "nixpkgs": { "locked": { - "lastModified": 1763934636, - "narHash": "sha256-9glbI7f1uU+yzQCq5LwLgdZqx6svOhZWkd4JRY265fc=", - "owner": "NixOS", + "lastModified": 1742889210, + "narHash": "sha256-hw63HnwnqU3ZQfsMclLhMvOezpM7RSB0dMAtD5/sOiw=", + "owner": "flox", "repo": "nixpkgs", - "rev": "ee09932cedcef15aaf476f9343d1dea2cb77e261", + "rev": "698214a32beb4f4c8e3942372c694f40848b360d", "type": "github" }, "original": { - "owner": "NixOS", - "ref": "nixpkgs-unstable", + "owner": "flox", + "ref": "stable", "repo": "nixpkgs", "type": "github" } @@ -552,11 +511,11 @@ }, "nixpkgs-unstable": { "locked": { - "lastModified": 1773231277, - "narHash": "sha256-Xy3WEpUAbpsz8ydgvVAQAGGB/WB+8cNA5cshiL0McTI=", + "lastModified": 1772956932, + "narHash": "sha256-M0yS4AafhKxPPmOHGqIV0iKxgNO8bHDWdl1kOwGBwRY=", "owner": "nixos", "repo": "nixpkgs", - "rev": "75690239f08f885ca9b0267580101f60d10fbe62", + "rev": "608d0cadfed240589a7eea422407a547ad626a14", "type": "github" }, "original": { @@ -567,22 +526,6 @@ } }, "nixpkgs_2": { - "locked": { - "lastModified": 1742889210, - "narHash": "sha256-hw63HnwnqU3ZQfsMclLhMvOezpM7RSB0dMAtD5/sOiw=", - "owner": "flox", - "repo": "nixpkgs", - "rev": "698214a32beb4f4c8e3942372c694f40848b360d", - "type": "github" - }, - "original": { - "owner": "flox", - "ref": "stable", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs_3": { "locked": { "lastModified": 1770107345, "narHash": "sha256-tbS0Ebx2PiA1FRW8mt8oejR0qMXmziJmPaU1d4kYY9g=", @@ -598,13 +541,13 @@ "type": "github" } }, - "nixpkgs_4": { + "nixpkgs_3": { "locked": { - "lastModified": 1773375660, - "narHash": "sha256-SEzUWw2Rf5Ki3bcM26nSKgbeoqi2uYy8IHVBqOKjX3w=", + "lastModified": 1773068389, + "narHash": "sha256-vMrm7Pk2hjBRPnCSjhq1pH0bg350Z+pXhqZ9ICiqqCs=", "owner": "nixos", "repo": "nixpkgs", - "rev": "3e20095fe3c6cbb1ddcef89b26969a69a1570776", + "rev": "44bae273f9f82d480273bab26f5c50de3724f52f", "type": "github" }, "original": { @@ -614,22 +557,6 @@ "type": "github" } }, - "nixpkgs_5": { - "locked": { - "lastModified": 1645013224, - "narHash": "sha256-b7OEC8vwzJv3rsz9pwnTX2LQDkeOWz2DbKypkVvNHXc=", - "owner": "nixos", - "repo": "nixpkgs", - "rev": "b66b39216b1fef2d8c33cc7a5c72d8da80b79970", - "type": "github" - }, - "original": { - "owner": "nixos", - "ref": "nixpkgs-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, "onchg": { "inputs": { "nix-pre-commit": "nix-pre-commit", @@ -704,7 +631,6 @@ "root": { "inputs": { "compose2nix": "compose2nix", - "deadnix": "deadnix", "disko": "disko", "flox": "flox", "genebean-omp-themes": "genebean-omp-themes", @@ -715,12 +641,11 @@ "nix-homebrew": "nix-homebrew", "nixos-cosmic": "nixos-cosmic", "nixos-hardware": "nixos-hardware", - "nixpkgs": "nixpkgs_4", + "nixpkgs": "nixpkgs_3", "nixpkgs-unstable": "nixpkgs-unstable", "private-flake": "private-flake", "simple-nixos-mailserver": "simple-nixos-mailserver", - "sops-nix": "sops-nix", - "statix": "statix" + "sops-nix": "sops-nix" } }, "rust-analyzer-src": { @@ -740,23 +665,6 @@ "type": "github" } }, - "rust-analyzer-src_2": { - "flake": false, - "locked": { - "lastModified": 1645205556, - "narHash": "sha256-e4lZW3qRyOEJ+vLKFQP7m2Dxh5P44NrnekZYLxlucww=", - "owner": "rust-analyzer", - "repo": "rust-analyzer", - "rev": "acf5874b39f3dc5262317a6074d9fc7285081161", - "type": "github" - }, - "original": { - "owner": "rust-analyzer", - "ref": "nightly", - "repo": "rust-analyzer", - "type": "github" - } - }, "rust-overlay": { "inputs": { "nixpkgs": [ @@ -788,11 +696,11 @@ ] }, "locked": { - "lastModified": 1773313890, - "narHash": "sha256-NXm/kOAk7HLziH1uWaUbNb9MhDS8yxFfQ8fMK5eN8/A=", + "lastModified": 1766537863, + "narHash": "sha256-HEt+wbazRgJYeY+lgj65bxhPyVc4x7NEB2bs5NU6DF8=", "owner": "simple-nixos-mailserver", "repo": "nixos-mailserver", - "rev": "9cdd6869e513df8153db4b920c8f15d394e150f7", + "rev": "23f0a53ca6e58e61e1ea2b86791c69b79c91656d", "type": "gitlab" }, "original": { @@ -822,50 +730,16 @@ "type": "github" } }, - "statix": { - "inputs": { - "fenix": "fenix_2", - "nixpkgs": "nixpkgs_5" - }, - "locked": { - "lastModified": 1676888642, - "narHash": "sha256-C73LOMVVCkeL0jA5xN7klLEDEB4NkuiATEJY4A/tIyM=", - "owner": "astro", - "repo": "statix", - "rev": "3c7136a23f444db252a556928c1489869ca3ab4e", - "type": "github" - }, - "original": { - "owner": "astro", - "repo": "statix", - "type": "github" - } - }, - "systems": { - "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": { "inputs": { - "nixpkgs": "nixpkgs_3" + "nixpkgs": "nixpkgs_2" }, "locked": { - "lastModified": 1773297127, - "narHash": "sha256-6E/yhXP7Oy/NbXtf1ktzmU8SdVqJQ09HC/48ebEGBpk=", + "lastModified": 1772660329, + "narHash": "sha256-IjU1FxYqm+VDe5qIOxoW+pISBlGvVApRjiw/Y/ttJzY=", "owner": "numtide", "repo": "treefmt-nix", - "rev": "71b125cd05fbfd78cab3e070b73544abe24c5016", + "rev": "3710e0e1218041bbad640352a0440114b1e10428", "type": "github" }, "original": { @@ -873,24 +747,6 @@ "repo": "treefmt-nix", "type": "github" } - }, - "utils": { - "inputs": { - "systems": "systems" - }, - "locked": { - "lastModified": 1731533236, - "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } } }, "root": "root", diff --git a/flake.nix b/flake.nix index f3b09bf..b5b03e1 100644 --- a/flake.nix +++ b/flake.nix @@ -8,7 +8,7 @@ compose2nix = { url = "github:aksiksi/compose2nix"; - inputs.nixpkgs.follows = "nixpkgs"; + inputs.nixpkgs.follows ="nixpkgs"; }; # Format disks with nix-config @@ -79,115 +79,100 @@ # Secrets managemnt sops-nix = { url = "github:mic92/sops-nix"; - inputs.nixpkgs.follows = "nixpkgs"; + inputs.nixpkgs.follows ="nixpkgs"; }; - # Linting and formatting - deadnix.url = "github:astro/deadnix"; - statix.url = "github:astro/statix"; - }; # end inputs - outputs = - inputs@{ self, nixpkgs, ... }: - let - # Functions that setup systems - localLib = import ./lib { inherit inputs; }; - forAllSystems = nixpkgs.lib.genAttrs [ - "x86_64-linux" - "aarch64-linux" - "x86_64-darwin" - "aarch64-darwin" - ]; - in - { - formatter = forAllSystems (system: nixpkgs.legacyPackages.${system}.nixfmt); + outputs = inputs@{ self, ... }: let + # Functions that setup systems + localLib = import ./lib { inherit inputs; }; - # Darwin (macOS) hosts - darwinConfigurations = { - AirPuppet = localLib.mkDarwinHost { - system = "x86_64-darwin"; - hostname = "AirPuppet"; - }; - Blue-Rock = localLib.mkDarwinHost { - system = "x86_64-darwin"; - hostname = "Blue-Rock"; - username = "gene.liverman"; - }; - mightymac = localLib.mkDarwinHost { - hostname = "mightymac"; - username = "gene.liverman"; - }; - }; # end darwinConfigurations + in { + # Darwin (macOS) hosts + darwinConfigurations = { + AirPuppet = localLib.mkDarwinHost { + system = "x86_64-darwin"; + hostname = "AirPuppet"; + }; + Blue-Rock = localLib.mkDarwinHost { + system = "x86_64-darwin"; + hostname = "Blue-Rock"; + username = "gene.liverman"; + }; + mightymac = localLib.mkDarwinHost { + hostname = "mightymac"; + username = "gene.liverman"; + }; + }; # end darwinConfigurations - # NixOS hosts - nixosConfigurations = { - bigboy = localLib.mkNixosHost { - hostname = "bigboy"; - additionalModules = [ - inputs.nixos-hardware.nixosModules.lenovo-thinkpad-p52 - ]; - }; - hetznix01 = localLib.mkNixosHost { - hostname = "hetznix01"; - additionalModules = [ - inputs.private-flake.nixosModules.private.hetznix01 - ]; - }; - hetznix02 = localLib.mkNixosHost { - system = "aarch64-linux"; - hostname = "hetznix02"; - additionalModules = [ - # inputs.simple-nixos-mailserver.nixosModule - ]; - }; - kiosk-entryway = localLib.mkNixosHost { - # Lenovo IdeaCentre Q190 - hostname = "kiosk-entryway"; - }; - kiosk-gene-desk = localLib.mkNixosHost { - system = "aarch64-linux"; - hostname = "kiosk-gene-desk"; - additionalModules = [ - inputs.nixos-hardware.nixosModules.raspberry-pi-4 - ]; - }; - nixnas1 = localLib.mkNixosHost { - hostname = "nixnas1"; - additionalModules = [ - inputs.simple-nixos-mailserver.nixosModule - ]; - }; - nixnuc = localLib.mkNixosHost { - hostname = "nixnuc"; - additionalModules = [ - inputs.simple-nixos-mailserver.nixosModule - ]; - }; - rainbow-planet = localLib.mkNixosHost { - hostname = "rainbow-planet"; - additionalModules = [ - inputs.nixos-cosmic.nixosModules.default - inputs.nixos-hardware.nixosModules.dell-xps-13-9360 - ]; - }; - }; # end nixosConfigurations + # NixOS hosts + nixosConfigurations = { + bigboy = localLib.mkNixosHost { + hostname = "bigboy"; + additionalModules = [ + inputs.nixos-hardware.nixosModules.lenovo-thinkpad-p52 + ]; + }; + hetznix01 = localLib.mkNixosHost { + hostname = "hetznix01"; + additionalModules = [ + inputs.private-flake.nixosModules.private.hetznix01 + ]; + }; + hetznix02 = localLib.mkNixosHost { + system = "aarch64-linux"; + hostname = "hetznix02"; + additionalModules = [ + # inputs.simple-nixos-mailserver.nixosModule + ]; + }; + kiosk-entryway = localLib.mkNixosHost { + # Lenovo IdeaCentre Q190 + hostname = "kiosk-entryway"; + }; + kiosk-gene-desk = localLib.mkNixosHost { + system = "aarch64-linux"; + hostname = "kiosk-gene-desk"; + additionalModules = [ + inputs.nixos-hardware.nixosModules.raspberry-pi-4 + ]; + }; + nixnas1 = localLib.mkNixosHost { + hostname = "nixnas1"; + additionalModules = [ + inputs.simple-nixos-mailserver.nixosModule + ]; + }; + nixnuc = localLib.mkNixosHost { + hostname = "nixnuc"; + additionalModules = [ + inputs.simple-nixos-mailserver.nixosModule + ]; + }; + rainbow-planet = localLib.mkNixosHost { + hostname = "rainbow-planet"; + additionalModules = [ + inputs.nixos-cosmic.nixosModules.default + inputs.nixos-hardware.nixosModules.dell-xps-13-9360 + ]; + }; + }; # end nixosConfigurations - # Home Manager (only) users - homeConfigurations = { - gene-x86_64-linux = localLib.mkHomeConfig { - homeDirectory = "/home/gene"; - username = "gene"; - system = "x86_64-linux"; - }; + # Home Manager (only) users + homeConfigurations = { + gene-x86_64-linux = localLib.mkHomeConfig { + homeDirectory = "/home/gene"; + username = "gene"; + system = "x86_64-linux"; + }; - gene-aarch64-linux = localLib.mkHomeConfig { - homeDirectory = "/home/gene"; - username = "gene"; - system = "aarch64-linux"; - }; - }; # end homeConfigurations + gene-aarch64-linux = localLib.mkHomeConfig { + homeDirectory = "/home/gene"; + username = "gene"; + system = "aarch64-linux"; + }; + }; # end homeConfigurations - packages.aarch64-linux.kiosk-gene-desk-sdImage = - self.nixosConfigurations.kiosk-gene-desk.config.system.build.sdImage; - }; + packages.aarch64-linux.kiosk-gene-desk-sdImage = self.nixosConfigurations.kiosk-gene-desk.config.system.build.sdImage; + }; } diff --git a/lib/default.nix b/lib/default.nix index 3d7d901..5d79385 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -1,10 +1,8 @@ -{ inputs, ... }: -let +{ inputs, ... }: let mkDarwinHost = import ./mkDarwinHost.nix { inherit inputs; }; mkHomeConfig = import ./mkHomeConfig.nix { inherit inputs; }; mkNixosHost = import ./mkNixosHost.nix { inherit inputs; }; -in -{ +in { inherit (mkDarwinHost) mkDarwinHost; inherit (mkHomeConfig) mkHomeConfig; inherit (mkNixosHost) mkNixosHost; diff --git a/lib/mkDarwinHost.nix b/lib/mkDarwinHost.nix index 02c0236..0d53859 100644 --- a/lib/mkDarwinHost.nix +++ b/lib/mkDarwinHost.nix @@ -1,50 +1,41 @@ -{ inputs, ... }: -{ - mkDarwinHost = - { - system ? "aarch64-darwin", - hostname, - username ? "gene", - additionalModules ? [ ], - additionalSpecialArgs ? { }, - }: - inputs.nix-darwin.lib.darwinSystem { - inherit system; - specialArgs = { - inherit inputs hostname username; +{ inputs, ... }: { + mkDarwinHost = { + system ? "aarch64-darwin", + hostname, + username ? "gene", + additionalModules ? [], + additionalSpecialArgs ? {} + }: inputs.nix-darwin.lib.darwinSystem { + inherit system; + specialArgs = { inherit inputs hostname username; } // additionalSpecialArgs; + modules = [ + ./nixpkgs-settings.nix + + inputs.nix-homebrew.darwinModules.nix-homebrew { + nix-homebrew = { + enable = true; # Install Homebrew under the default prefix + user = "${username}"; # User owning the Homebrew prefix + autoMigrate = true; # Automatically migrate existing Homebrew installations + }; } - // additionalSpecialArgs; - modules = [ - ./nixpkgs-settings.nix - inputs.nix-homebrew.darwinModules.nix-homebrew - { - nix-homebrew = { - enable = true; # Install Homebrew under the default prefix - user = "${username}"; # User owning the Homebrew prefix - autoMigrate = true; # Automatically migrate existing Homebrew installations - }; - } + inputs.home-manager.darwinModules.home-manager { + home-manager = { + extraSpecialArgs = { inherit inputs username; }; + useGlobalPkgs = true; + useUserPackages = true; + users.${username}.imports = [ + inputs.sops-nix.homeManagerModule # user-level secrets management + ../modules/shared/home/general + ../modules/shared/home/general/all-gui.nix + ../modules/hosts/darwin/home.nix + ../modules/hosts/darwin/${hostname}/home-${username}.nix + ]; + }; + } - inputs.home-manager.darwinModules.home-manager - { - home-manager = { - extraSpecialArgs = { inherit inputs username; }; - useGlobalPkgs = true; - useUserPackages = true; - users.${username}.imports = [ - inputs.sops-nix.homeManagerModule # user-level secrets management - ../modules/shared/home/general - ../modules/shared/home/general/all-gui.nix - ../modules/hosts/darwin/home.nix - ../modules/hosts/darwin/${hostname}/home-${username}.nix - ]; - }; - } - - ../modules/hosts/darwin # system-wide stuff - ../modules/hosts/darwin/${hostname} # host specific stuff - ] - ++ additionalModules; # end modules - }; # end darwinSystem + ../modules/hosts/darwin # system-wide stuff + ../modules/hosts/darwin/${hostname} # host specific stuff + ] ++ additionalModules; # end modules + }; # end darwinSystem } diff --git a/lib/mkHomeConfig.nix b/lib/mkHomeConfig.nix index 0e61a2d..d09cc99 100644 --- a/lib/mkHomeConfig.nix +++ b/lib/mkHomeConfig.nix @@ -1,39 +1,29 @@ -{ inputs, ... }: -{ - mkHomeConfig = - { - homeDirectory, - system, - username, - }: - inputs.home-manager.lib.homeManagerConfiguration { - extraSpecialArgs = { - inherit - inputs - homeDirectory - system - username - ; - }; +{ inputs, ... }: { + mkHomeConfig = { + homeDirectory, + system, + username, + }: inputs.home-manager.lib.homeManagerConfiguration { + extraSpecialArgs = { inherit inputs homeDirectory system username; }; - pkgs = inputs.nixpkgs.legacyPackages.${system}; + pkgs = inputs.nixpkgs.legacyPackages.${system}; - # Specify your home configuration modules here, for example, - # the path to your home.nix. - modules = [ - ./nixpkgs-settings.nix - ../modules/shared/home/general - ../modules/hosts/home-manager-only - ../modules/hosts/home-manager-only/home-${username}.nix + # Specify your home configuration modules here, for example, + # the path to your home.nix. + modules = [ + ./nixpkgs-settings.nix + ../modules/shared/home/general + ../modules/hosts/home-manager-only + ../modules/hosts/home-manager-only/home-${username}.nix - { - home = { - username = "${username}"; - homeDirectory = "${homeDirectory}"; - }; - } + { + home = { + username = "${username}"; + homeDirectory = "${homeDirectory}"; + }; + } - inputs.sops-nix.homeManagerModules.sops - ]; - }; -} + inputs.sops-nix.homeManagerModules.sops + ]; + }; +} \ No newline at end of file diff --git a/lib/mkNixosHost.nix b/lib/mkNixosHost.nix index 9d4a35b..b4023d2 100644 --- a/lib/mkNixosHost.nix +++ b/lib/mkNixosHost.nix @@ -1,44 +1,36 @@ -{ inputs, ... }: -{ - mkNixosHost = - { - system ? "x86_64-linux", - hostname, - username ? "gene", - additionalModules ? [ ], - additionalSpecialArgs ? { }, - }: - inputs.nixpkgs.lib.nixosSystem { - inherit system; - specialArgs = { - inherit inputs hostname username; +{ inputs, ... }: { + mkNixosHost = { + system ? "x86_64-linux", + hostname, + username ? "gene", + additionalModules ? [], + additionalSpecialArgs ? {} + }: inputs.nixpkgs.lib.nixosSystem { + inherit system; + specialArgs = { inherit inputs hostname username; } // additionalSpecialArgs; + modules = [ + ./nixpkgs-settings.nix + + inputs.disko.nixosModules.disko + + inputs.home-manager.nixosModules.home-manager { + home-manager = { + extraSpecialArgs = { inherit inputs hostname username; }; + useGlobalPkgs = true; + useUserPackages = true; + users.${username}.imports = [ + ../modules/shared/home/general + ../modules/shared/home/linux + ../modules/hosts/nixos/${hostname}/home-${username}.nix + ]; + }; } - // additionalSpecialArgs; - modules = [ - ./nixpkgs-settings.nix - inputs.disko.nixosModules.disko - - inputs.home-manager.nixosModules.home-manager - { - home-manager = { - extraSpecialArgs = { inherit inputs hostname username; }; - useGlobalPkgs = true; - useUserPackages = true; - users.${username}.imports = [ - ../modules/shared/home/general - ../modules/shared/home/linux - ../modules/hosts/nixos/${hostname}/home-${username}.nix - ]; - }; - } - - inputs.nix-flatpak.nixosModules.nix-flatpak - inputs.private-flake.nixosModules.private.ssh-keys - inputs.sops-nix.nixosModules.sops # system wide secrets management - ../modules/hosts/nixos # system-wide stuff - ../modules/hosts/nixos/${hostname} # host specific stuff - ] - ++ additionalModules; - }; + inputs.nix-flatpak.nixosModules.nix-flatpak + inputs.private-flake.nixosModules.private.ssh-keys + inputs.sops-nix.nixosModules.sops # system wide secrets management + ../modules/hosts/nixos # system-wide stuff + ../modules/hosts/nixos/${hostname} # host specific stuff + ] ++ additionalModules; + }; } diff --git a/lib/nixpkgs-settings.nix b/lib/nixpkgs-settings.nix index 2efc8c3..6255854 100644 --- a/lib/nixpkgs-settings.nix +++ b/lib/nixpkgs-settings.nix @@ -1,5 +1,4 @@ -{ inputs, ... }: -{ +{ inputs, ... }: { nixpkgs = { config = { allowUnfree = true; diff --git a/modules/hosts/darwin/AirPuppet/default.nix b/modules/hosts/darwin/AirPuppet/default.nix index 6375688..84afcb1 100644 --- a/modules/hosts/darwin/AirPuppet/default.nix +++ b/modules/hosts/darwin/AirPuppet/default.nix @@ -1,4 +1,4 @@ -_: { +{ ... }: { system.stateVersion = 4; homebrew = { diff --git a/modules/hosts/darwin/AirPuppet/home-gene.nix b/modules/hosts/darwin/AirPuppet/home-gene.nix index 2643ed1..644bc76 100644 --- a/modules/hosts/darwin/AirPuppet/home-gene.nix +++ b/modules/hosts/darwin/AirPuppet/home-gene.nix @@ -1,5 +1,4 @@ -{ username, ... }: -{ +{ username, ... }: { home.stateVersion = "23.11"; sops = { diff --git a/modules/hosts/darwin/Blue-Rock/default.nix b/modules/hosts/darwin/Blue-Rock/default.nix index a6efc0d..a2a98f4 100644 --- a/modules/hosts/darwin/Blue-Rock/default.nix +++ b/modules/hosts/darwin/Blue-Rock/default.nix @@ -1,5 +1,4 @@ -{ pkgs, ... }: -{ +{ pkgs, ... }: { system.stateVersion = 4; environment = { diff --git a/modules/hosts/darwin/Blue-Rock/home-gene.liverman.nix b/modules/hosts/darwin/Blue-Rock/home-gene.liverman.nix index 2ed7e0a..7f1fa1a 100644 --- a/modules/hosts/darwin/Blue-Rock/home-gene.liverman.nix +++ b/modules/hosts/darwin/Blue-Rock/home-gene.liverman.nix @@ -1,7 +1,6 @@ -{ username, ... }: -{ +{ username, ... }: { home.stateVersion = "23.11"; - + programs = { go = { enable = true; diff --git a/modules/hosts/darwin/default.nix b/modules/hosts/darwin/default.nix index 2db0fb8..7f3e7e5 100644 --- a/modules/hosts/darwin/default.nix +++ b/modules/hosts/darwin/default.nix @@ -1,17 +1,8 @@ -{ - pkgs, - hostname, - username, - ... -}: -{ +{ pkgs, hostname, username, ... }: { system.primaryUser = username; environment = { - shells = with pkgs; [ - bash - zsh - ]; + shells = with pkgs; [ bash zsh ]; pathsToLink = [ "/Applications" "/share/zsh" @@ -122,10 +113,7 @@ "flox-cache-public-1:7F4OyH7ZCnFhcze3fJdfyXYLQw/aV7GEed86nQ7IsOs=" "cache.thalheim.io-1:R7msbosLEZKrxk/lKxf9BTjOOH7Ax3H0Qj0/6wiHOgc=" ]; - trusted-users = [ - "@admin" - "${username}" - ]; + trusted-users = [ "@admin" "${username}" ]; }; extraOptions = '' # Generated by https://github.com/DeterminateSystems/nix-installer, version 0.11.0. diff --git a/modules/hosts/darwin/home.nix b/modules/hosts/darwin/home.nix index 7df380e..3767a24 100644 --- a/modules/hosts/darwin/home.nix +++ b/modules/hosts/darwin/home.nix @@ -1,5 +1,4 @@ -{ username, ... }: -{ +{ username, ... }: { # dawrwin-specific shell config programs = { zsh = { diff --git a/modules/hosts/darwin/mightymac/default.nix b/modules/hosts/darwin/mightymac/default.nix index 074ca67..49e1f76 100644 --- a/modules/hosts/darwin/mightymac/default.nix +++ b/modules/hosts/darwin/mightymac/default.nix @@ -1,5 +1,4 @@ -{ inputs, pkgs, ... }: -{ +{ inputs, pkgs, ... }: { system.stateVersion = 4; environment = { diff --git a/modules/hosts/darwin/mightymac/home-gene.liverman.nix b/modules/hosts/darwin/mightymac/home-gene.liverman.nix index 49aaea2..2d4fa73 100644 --- a/modules/hosts/darwin/mightymac/home-gene.liverman.nix +++ b/modules/hosts/darwin/mightymac/home-gene.liverman.nix @@ -1,5 +1,4 @@ -{ config, ... }: -{ +{ config, ... }: { home.stateVersion = "23.11"; programs = { diff --git a/modules/hosts/home-manager-only/default.nix b/modules/hosts/home-manager-only/default.nix index d4932be..3b00ffd 100644 --- a/modules/hosts/home-manager-only/default.nix +++ b/modules/hosts/home-manager-only/default.nix @@ -1,11 +1,4 @@ -{ - config, - pkgs, - system, - username, - ... -}: -{ +{ config, pkgs, system, username, ... }: { home.stateVersion = "25.05"; home.packages = with pkgs; [ age diff --git a/modules/hosts/home-manager-only/home-gene.liverman.nix b/modules/hosts/home-manager-only/home-gene.liverman.nix index 4d3a026..7095165 100644 --- a/modules/hosts/home-manager-only/home-gene.liverman.nix +++ b/modules/hosts/home-manager-only/home-gene.liverman.nix @@ -1,3 +1,3 @@ -_: { +{ ... }: { # Settings just for work machines go here -} +} \ No newline at end of file diff --git a/modules/hosts/home-manager-only/home-gene.nix b/modules/hosts/home-manager-only/home-gene.nix index 7c6b6bf..29c0c0f 100644 --- a/modules/hosts/home-manager-only/home-gene.nix +++ b/modules/hosts/home-manager-only/home-gene.nix @@ -1,5 +1,4 @@ -{ pkgs, ... }: -{ +{ pkgs, ... }: { # Settings just for personal machines go here home.packages = with pkgs; [ diff --git a/modules/hosts/nixos/bigboy/default.nix b/modules/hosts/nixos/bigboy/default.nix index 1c3c050..6a0025d 100644 --- a/modules/hosts/nixos/bigboy/default.nix +++ b/modules/hosts/nixos/bigboy/default.nix @@ -1,20 +1,14 @@ +{ config, pkgs, username, ... }: + let + libbluray = pkgs.libbluray.override { + withAACS = true; + withBDplus = true; + withJava = true; + }; + vlc-with-decoding = pkgs.vlc.override { inherit libbluray; }; + in { - config, - pkgs, - username, - ... -}: -let - libbluray = pkgs.libbluray.override { - withAACS = true; - withBDplus = true; - withJava = true; - }; - vlc-with-decoding = pkgs.vlc.override { inherit libbluray; }; -in -{ - imports = [ - # Include the results of the hardware scan. + imports = [ # Include the results of the hardware scan. ./hardware-configuration.nix ../../../shared/nixos/flatpaks.nix ../../../shared/nixos/ripping.nix @@ -49,6 +43,7 @@ in zoom-us ]; + networking.networkmanager.enable = true; programs = { @@ -123,15 +118,10 @@ in users.users.${username} = { isNormalUser = true; description = "Gene Liverman"; - extraGroups = [ - "networkmanager" - "wheel" - "dialout" - "input" - ]; + extraGroups = [ "networkmanager" "wheel" "dialout" "input" ]; packages = with pkgs; [ kdePackages.kate - # thunderbird + # thunderbird ]; }; } diff --git a/modules/hosts/nixos/bigboy/hardware-configuration.nix b/modules/hosts/nixos/bigboy/hardware-configuration.nix index 771dd7c..b124fad 100644 --- a/modules/hosts/nixos/bigboy/hardware-configuration.nix +++ b/modules/hosts/nixos/bigboy/hardware-configuration.nix @@ -1,50 +1,32 @@ # Do not modify this file! It was generated by ‘nixos-generate-config’ # and may be overwritten by future invocations. Please make changes # to /etc/nixos/configuration.nix instead. -{ - config, - lib, - pkgs, - modulesPath, - ... -}: +{ config, lib, pkgs, modulesPath, ... }: { - imports = [ - (modulesPath + "/installer/scan/not-detected.nix") - ]; + imports = + [ (modulesPath + "/installer/scan/not-detected.nix") + ]; - boot.initrd.availableKernelModules = [ - "xhci_pci" - "nvme" - "usb_storage" - "sd_mod" - "rtsx_pci_sdmmc" - ]; + boot.initrd.availableKernelModules = [ "xhci_pci" "nvme" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ]; boot.initrd.kernelModules = [ ]; - boot.kernelModules = [ - "kvm-intel" - "sg" - ]; + boot.kernelModules = [ "kvm-intel" "sg" ]; boot.extraModulePackages = [ ]; - fileSystems."/" = { - device = "/dev/disk/by-uuid/9c2d2979-dc8d-40e0-9ec2-c3cce33cd832"; - fsType = "ext4"; - }; + fileSystems."/" = + { device = "/dev/disk/by-uuid/9c2d2979-dc8d-40e0-9ec2-c3cce33cd832"; + fsType = "ext4"; + }; - fileSystems."/boot" = { - device = "/dev/disk/by-uuid/59CB-16DE"; - fsType = "vfat"; - options = [ - "fmask=0077" - "dmask=0077" + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/59CB-16DE"; + fsType = "vfat"; + options = [ "fmask=0077" "dmask=0077" ]; + }; + + swapDevices = + [ { device = "/dev/disk/by-uuid/878ff032-3de0-4efe-a12f-8eccd0ac3253"; } ]; - }; - - swapDevices = [ - { device = "/dev/disk/by-uuid/878ff032-3de0-4efe-a12f-8eccd0ac3253"; } - ]; # Enables DHCP on each ethernet and wireless interface. In case of scripted networking # (the default) this is the recommended approach. When using systemd-networkd it's diff --git a/modules/hosts/nixos/bigboy/home-gene.nix b/modules/hosts/nixos/bigboy/home-gene.nix index fa2f7e0..9042b47 100644 --- a/modules/hosts/nixos/bigboy/home-gene.nix +++ b/modules/hosts/nixos/bigboy/home-gene.nix @@ -1,5 +1,4 @@ -{ ... }: -{ +{ ... }: { home.stateVersion = "24.05"; imports = [ ../../../shared/home/general/all-gui.nix @@ -28,3 +27,4 @@ }; }; } + diff --git a/modules/hosts/nixos/default.nix b/modules/hosts/nixos/default.nix index 6e106a7..00b296a 100644 --- a/modules/hosts/nixos/default.nix +++ b/modules/hosts/nixos/default.nix @@ -1,19 +1,10 @@ -{ - hostname, - pkgs, - username, - ... -}: -{ +{ hostname, pkgs, username, ... }: { imports = [ - ../shared/nixos/internationalisation.nix + ../shared/nixos/internationalisation.nix ]; environment = { - shells = with pkgs; [ - bash - zsh - ]; + shells = with pkgs; [ bash zsh ]; systemPackages = with pkgs; [ age dconf2nix diff --git a/modules/hosts/nixos/hetznix01/default.nix b/modules/hosts/nixos/hetznix01/default.nix index af56260..63a5019 100644 --- a/modules/hosts/nixos/hetznix01/default.nix +++ b/modules/hosts/nixos/hetznix01/default.nix @@ -1,10 +1,4 @@ -{ - inputs, - pkgs, - username, - ... -}: -{ +{ inputs, pkgs, username, ... }: { imports = [ ../../../shared/nixos/nixroutes.nix ./disk-config.nix @@ -30,14 +24,14 @@ networking = { # Open ports in the firewall. firewall.allowedTCPPorts = [ - 22 # ssh - 25 # SMTP (unencrypted) - 80 # http to local Nginx - 143 # imap - 443 # https to local Nginx - 465 # SMTP with TLS - 587 # SMTP with STARTTLS - 993 # imaps + 22 # ssh + 25 # SMTP (unencrypted) + 80 # http to local Nginx + 143 # imap + 443 # https to local Nginx + 465 # SMTP with TLS + 587 # SMTP with STARTTLS + 993 # imaps 1883 # mqtt 8333 # Bitcoin Core 8448 # Matrix Synapse @@ -94,10 +88,7 @@ users.users.${username} = { isNormalUser = true; description = "Gene Liverman"; - extraGroups = [ - "networkmanager" - "wheel" - ]; + extraGroups = [ "networkmanager" "wheel" ]; linger = true; }; } diff --git a/modules/hosts/nixos/hetznix01/hardware-configuration.nix b/modules/hosts/nixos/hetznix01/hardware-configuration.nix index a8125f2..67a3557 100644 --- a/modules/hosts/nixos/hetznix01/hardware-configuration.nix +++ b/modules/hosts/nixos/hetznix01/hardware-configuration.nix @@ -4,18 +4,11 @@ { lib, modulesPath, ... }: { - imports = [ - (modulesPath + "/profiles/qemu-guest.nix") - ]; + imports = + [ (modulesPath + "/profiles/qemu-guest.nix") + ]; - boot.initrd.availableKernelModules = [ - "ahci" - "xhci_pci" - "virtio_pci" - "virtio_scsi" - "sd_mod" - "sr_mod" - ]; + boot.initrd.availableKernelModules = [ "ahci" "xhci_pci" "virtio_pci" "virtio_scsi" "sd_mod" "sr_mod" ]; boot.initrd.kernelModules = [ ]; boot.kernelModules = [ ]; boot.extraModulePackages = [ ]; @@ -32,3 +25,4 @@ nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; } + diff --git a/modules/hosts/nixos/hetznix01/home-gene.nix b/modules/hosts/nixos/hetznix01/home-gene.nix index 2f6f186..ec20c58 100644 --- a/modules/hosts/nixos/hetznix01/home-gene.nix +++ b/modules/hosts/nixos/hetznix01/home-gene.nix @@ -1,3 +1,3 @@ -_: { - home.stateVersion = "24.05"; +{ ... }: { + home.stateVersion = "24.05"; } diff --git a/modules/hosts/nixos/hetznix01/post-install/containers/emqx.nix b/modules/hosts/nixos/hetznix01/post-install/containers/emqx.nix index f350c4e..33188e9 100644 --- a/modules/hosts/nixos/hetznix01/post-install/containers/emqx.nix +++ b/modules/hosts/nixos/hetznix01/post-install/containers/emqx.nix @@ -1,8 +1,6 @@ -{ config, username, ... }: -let +{ config, username, ... }: let volume_base = "/var/lib/emqx"; -in -{ +in { # Based on docs at https://docs.emqx.com/en/emqx/latest/deploy/install-docker.html virtualisation.oci-containers.containers = { "emqx" = { diff --git a/modules/hosts/nixos/hetznix01/post-install/default.nix b/modules/hosts/nixos/hetznix01/post-install/default.nix index 3aaa909..8807f58 100644 --- a/modules/hosts/nixos/hetznix01/post-install/default.nix +++ b/modules/hosts/nixos/hetznix01/post-install/default.nix @@ -1,15 +1,7 @@ -{ - config, - lib, - pkgs, - username, - ... -}: -let +{ config, lib, pkgs, username, ... }: let domain = "technicalissues.us"; restic_backup_time = "01:00"; -in -{ +in { imports = [ ../../../../shared/nixos/lets-encrypt.nix ../../../../shared/nixos/restic.nix @@ -34,7 +26,7 @@ in # Listen on loopback interface only, and accept requests from ::1 net = { listen = "loopback"; - post_allow.host = [ "::1" ]; + post_allow.host = ["::1"]; }; # Restrict loading documents from WOPI Host nextcloud.example.com @@ -170,14 +162,14 @@ in }; matrix_secrets_yaml = { owner = config.users.users.matrix-synapse.name; - restartUnits = [ "matrix-synapse.service" ]; + restartUnits = ["matrix-synapse.service"]; }; matrix_homeserver_signing_key.owner = config.users.users.matrix-synapse.name; - mqtt_recorder_pass.restartUnits = [ "mosquitto.service" ]; + mqtt_recorder_pass.restartUnits = ["mosquitto.service"]; nextcloud_admin_pass.owner = config.users.users.nextcloud.name; owntracks_basic_auth = { owner = config.users.users.nginx.name; - restartUnits = [ "nginx.service" ]; + restartUnits = ["nginx.service"]; }; plausible_admin_pass.owner = config.users.users.nginx.name; plausible_secret_key_base.owner = config.users.users.nginx.name; @@ -188,36 +180,31 @@ in }; systemd.services = { - nextcloud-config-collabora = - let - inherit (config.services.nextcloud) occ; + nextcloud-config-collabora = let + inherit (config.services.nextcloud) occ; - wopi_url = "http://[::1]:${toString config.services.collabora-online.port}"; - public_wopi_url = "https://collabora.pack1828.org"; - wopi_allowlist = lib.concatStringsSep "," [ - "127.0.0.1" - "::1" - "5.161.244.95" - "2a01:4ff:f0:977c::1" - ]; - in - { - wantedBy = [ "multi-user.target" ]; - after = [ - "nextcloud-setup.service" - "coolwsd.service" - ]; - requires = [ "coolwsd.service" ]; - script = '' - ${occ}/bin/nextcloud-occ config:app:set richdocuments wopi_url --value ${lib.escapeShellArg wopi_url} - ${occ}/bin/nextcloud-occ config:app:set richdocuments public_wopi_url --value ${lib.escapeShellArg public_wopi_url} - ${occ}/bin/nextcloud-occ config:app:set richdocuments wopi_allowlist --value ${lib.escapeShellArg wopi_allowlist} - ${occ}/bin/nextcloud-occ richdocuments:setup - ''; - serviceConfig = { - Type = "oneshot"; - }; + wopi_url = "http://[::1]:${toString config.services.collabora-online.port}"; + public_wopi_url = "https://collabora.pack1828.org"; + wopi_allowlist = lib.concatStringsSep "," [ + "127.0.0.1" + "::1" + "5.161.244.95" + "2a01:4ff:f0:977c::1" + ]; + in { + wantedBy = ["multi-user.target"]; + after = ["nextcloud-setup.service" "coolwsd.service"]; + requires = ["coolwsd.service"]; + script = '' + ${occ}/bin/nextcloud-occ config:app:set richdocuments wopi_url --value ${lib.escapeShellArg wopi_url} + ${occ}/bin/nextcloud-occ config:app:set richdocuments public_wopi_url --value ${lib.escapeShellArg public_wopi_url} + ${occ}/bin/nextcloud-occ config:app:set richdocuments wopi_allowlist --value ${lib.escapeShellArg wopi_allowlist} + ${occ}/bin/nextcloud-occ richdocuments:setup + ''; + serviceConfig = { + Type = "oneshot"; }; + }; }; # Enable common container config files in /etc/containers diff --git a/modules/hosts/nixos/hetznix01/post-install/matrix-synapse.nix b/modules/hosts/nixos/hetznix01/post-install/matrix-synapse.nix index 0421a1d..7c83bc2 100644 --- a/modules/hosts/nixos/hetznix01/post-install/matrix-synapse.nix +++ b/modules/hosts/nixos/hetznix01/post-install/matrix-synapse.nix @@ -1,5 +1,4 @@ -{ config, ... }: -{ +{ config, ... }: { services.matrix-synapse = { enable = true; configureRedisLocally = true; @@ -34,7 +33,7 @@ ]; url_preview_enabled = true; enable_registration = false; - trusted_key_servers = [ { server_name = "matrix.org"; } ]; + trusted_key_servers = [{ server_name = "matrix.org"; }]; }; }; diff --git a/modules/hosts/nixos/hetznix01/post-install/monitoring.nix b/modules/hosts/nixos/hetznix01/post-install/monitoring.nix index 8f44f00..97d9c85 100644 --- a/modules/hosts/nixos/hetznix01/post-install/monitoring.nix +++ b/modules/hosts/nixos/hetznix01/post-install/monitoring.nix @@ -1,8 +1,6 @@ -{ config, pkgs, ... }: -let +{ config, pkgs, ... }: let metrics_server = "https://monitoring.home.technicalissues.us/remotewrite"; -in -{ +in { services = { vmagent = { enable = true; @@ -16,11 +14,11 @@ in { job_name = "node"; static_configs = [ - { targets = [ "127.0.0.1:9100" ]; } + { targets = ["127.0.0.1:9100"]; } ]; metric_relabel_configs = [ { - source_labels = [ "__name__" ]; + source_labels = ["__name__"]; regex = "go_.*"; action = "drop"; } @@ -37,11 +35,11 @@ in { job_name = "nginx"; static_configs = [ - { targets = [ "127.0.0.1:9113" ]; } + { targets = ["127.0.0.1:9113"]; } ]; metric_relabel_configs = [ { - source_labels = [ "__name__" ]; + source_labels = ["__name__"]; regex = "go_.*"; action = "drop"; } @@ -79,7 +77,7 @@ in # ---------------------------- # Exporters (using built-in NixOS modules) # ---------------------------- - + # Node exporter - using the built-in module prometheus.exporters.node = { enable = true; @@ -112,7 +110,7 @@ in group = "vmagent"; }; - users.groups.vmagent = { }; + users.groups.vmagent = {}; # ---------------------------- # SOPS secrets configuration @@ -121,9 +119,10 @@ in secrets = { vmagent_push_pw = { owner = "vmagent"; - restartUnits = [ "vmagent.service" ]; + restartUnits = ["vmagent.service"]; sopsFile = ../../../../shared/secrets.yaml; }; }; }; } + diff --git a/modules/hosts/nixos/hetznix01/post-install/mosquitto.nix b/modules/hosts/nixos/hetznix01/post-install/mosquitto.nix index 282557f..d3405e4 100644 --- a/modules/hosts/nixos/hetznix01/post-install/mosquitto.nix +++ b/modules/hosts/nixos/hetznix01/post-install/mosquitto.nix @@ -1,21 +1,16 @@ -{ config, ... }: -let +{ config, ... }: let mqtt_domain = "mqtt.technicalissues.us"; -in -{ - security.acme.certs.${mqtt_domain}.postRun = - "systemctl restart ${config.systemd.services.mosquitto.name}"; +in { + security.acme.certs.${mqtt_domain}.postRun = "systemctl restart ${config.systemd.services.mosquitto.name}"; services.mosquitto = { enable = true; bridges = { liamcottle = { - addresses = [ - { - address = "mqtt.meshtastic.liamcottle.net"; - port = 1883; - } - ]; + addresses = [{ + address = "mqtt.meshtastic.liamcottle.net"; + port = 1883; + }]; topics = [ "msh/# out 1 \"\"" ]; @@ -29,12 +24,10 @@ in }; }; meshtastic = { - addresses = [ - { - address = "mqtt.meshtastic.org"; - port = 1883; - } - ]; + addresses = [{ + address = "mqtt.meshtastic.org"; + port = 1883; + }]; topics = [ "msh/# out 1 \"\"" ]; @@ -49,12 +42,10 @@ in }; }; homeassistant = { - addresses = [ - { - address = "homeasistant-lc.atlas-snares.ts.net"; - port = 1883; - } - ]; + addresses = [{ + address = "homeasistant-lc.atlas-snares.ts.net"; + port = 1883; + }]; topics = [ "msh/US/2/e/LongFast/!a386c80 out 1 \"\"" "msh/US/2/e/LongFast/!b03bcb24 out 1 \"\"" @@ -71,59 +62,53 @@ in }; }; }; - listeners = - let - mqtt_users = { - genebean = { - acl = [ - "readwrite msh/#" - ]; - hashedPasswordFile = config.sops.secrets.mosquitto_genebean.path; - }; - mountain_mesh = { - acl = [ - "readwrite msh/#" - ]; - hashedPasswordFile = config.sops.secrets.mosquitto_mountain_mesh.path; - }; + listeners = let + mqtt_users = { + genebean = { + acl = [ + "readwrite msh/#" + ]; + hashedPasswordFile = config.sops.secrets.mosquitto_genebean.path; }; - in - [ - { - port = 1883; - users = mqtt_users; - settings.allow_anonymous = false; - } - { - port = 8883; - users = mqtt_users; - settings = - let - certDir = config.security.acme.certs."${mqtt_domain}".directory; - in - { - allow_anonymous = false; - keyfile = certDir + "/key.pem"; - certfile = certDir + "/cert.pem"; - cafile = certDir + "/chain.pem"; - }; - } - { - port = 9001; - users = mqtt_users; - settings = - let - certDir = config.security.acme.certs."${mqtt_domain}".directory; - in - { - allow_anonymous = false; - keyfile = certDir + "/key.pem"; - certfile = certDir + "/cert.pem"; - cafile = certDir + "/chain.pem"; - protocol = "websockets"; - }; - } - ]; + mountain_mesh = { + acl = [ + "readwrite msh/#" + ]; + hashedPasswordFile = config.sops.secrets.mosquitto_mountain_mesh.path; + }; + }; + in [ + { + port = 1883; + users = mqtt_users; + settings.allow_anonymous = false; + } + { + port = 8883; + users = mqtt_users; + settings = let + certDir = config.security.acme.certs."${mqtt_domain}".directory; + in { + allow_anonymous = false; + keyfile = certDir + "/key.pem"; + certfile = certDir + "/cert.pem"; + cafile = certDir + "/chain.pem"; + }; + } + { + port = 9001; + users = mqtt_users; + settings = let + certDir = config.security.acme.certs."${mqtt_domain}".directory; + in { + allow_anonymous = false; + keyfile = certDir + "/key.pem"; + certfile = certDir + "/cert.pem"; + cafile = certDir + "/chain.pem"; + protocol = "websockets"; + }; + } + ]; }; sops.secrets = { diff --git a/modules/hosts/nixos/hetznix01/post-install/nginx.nix b/modules/hosts/nixos/hetznix01/post-install/nginx.nix index fd39b68..c714b31 100644 --- a/modules/hosts/nixos/hetznix01/post-install/nginx.nix +++ b/modules/hosts/nixos/hetznix01/post-install/nginx.nix @@ -1,11 +1,9 @@ -{ config, ... }: -let +{ config, ... }: let domain = "technicalissues.us"; http_port = 80; https_port = 443; private_btc = "umbrel.atlas-snares.ts.net"; -in -{ +in { services.nginx = { enable = true; @@ -136,36 +134,14 @@ in }; "matrix.${domain}" = { listen = [ - { - port = http_port; - addr = "0.0.0.0"; - } - { - port = http_port; - addr = "[::]"; - } + { port = http_port; addr = "0.0.0.0"; } + { port = http_port; addr = "[::]"; } - { - port = https_port; - addr = "0.0.0.0"; - ssl = true; - } - { - port = https_port; - addr = "[::]"; - ssl = true; - } + { port = https_port; addr = "0.0.0.0"; ssl = true; } + { port = https_port; addr = "[::]"; ssl = true; } - { - port = 8448; - addr = "0.0.0.0"; - ssl = true; - } - { - port = 8448; - addr = "[::]"; - ssl = true; - } + { port = 8448; addr = "0.0.0.0"; ssl = true; } + { port = 8448; addr = "[::]"; ssl = true; } ]; enableACME = true; acmeRoot = null; @@ -219,8 +195,7 @@ in "/" = { proxyPass = "http://127.0.0.1:8083"; }; - "/pub" = { - # Client apps need to point to this path + "/pub" = { # Client apps need to point to this path extraConfig = "proxy_set_header X-Limit-U $remote_user;"; proxyPass = "http://127.0.0.1:8083/pub"; }; diff --git a/modules/hosts/nixos/hetznix02/default.nix b/modules/hosts/nixos/hetznix02/default.nix index 77b2cf8..d3f18a0 100644 --- a/modules/hosts/nixos/hetznix02/default.nix +++ b/modules/hosts/nixos/hetznix02/default.nix @@ -1,10 +1,4 @@ -{ - inputs, - pkgs, - username, - ... -}: -{ +{ inputs, pkgs, username, ... }: { imports = [ ../../../shared/nixos/nixroutes.nix ./disk-config.nix @@ -35,9 +29,9 @@ networking = { # Open ports in the firewall. firewall.allowedTCPPorts = [ - 22 # ssh - 80 # Nginx - 443 # Nginx + 22 # ssh + 80 # Nginx + 443 # Nginx ]; # firewall.allowedUDPPorts = [ ... ]; # Or disable the firewall altogether. @@ -62,10 +56,7 @@ users.users.${username} = { isNormalUser = true; description = "Gene Liverman"; - extraGroups = [ - "networkmanager" - "wheel" - ]; + extraGroups = [ "networkmanager" "wheel" ]; linger = true; }; diff --git a/modules/hosts/nixos/hetznix02/disk-config.nix b/modules/hosts/nixos/hetznix02/disk-config.nix index c1f51ca..bf22bdd 100644 --- a/modules/hosts/nixos/hetznix02/disk-config.nix +++ b/modules/hosts/nixos/hetznix02/disk-config.nix @@ -44,10 +44,10 @@ content = { type = "gpt"; partitions = { - nix = { - name = "nix"; - size = "100%"; - content = { + nix = { + name = "nix"; + size = "100%"; + content = { type = "filesystem"; format = "ext4"; mountpoint = "/nix"; diff --git a/modules/hosts/nixos/hetznix02/hardware-configuration.nix b/modules/hosts/nixos/hetznix02/hardware-configuration.nix index 5fb95a5..d13bb36 100644 --- a/modules/hosts/nixos/hetznix02/hardware-configuration.nix +++ b/modules/hosts/nixos/hetznix02/hardware-configuration.nix @@ -4,41 +4,34 @@ { lib, modulesPath, ... }: { - imports = [ - (modulesPath + "/profiles/qemu-guest.nix") - ]; + imports = + [ (modulesPath + "/profiles/qemu-guest.nix") + ]; boot = { initrd = { - availableKernelModules = [ - "xhci_pci" - "virtio_scsi" - "sr_mod" - ]; + availableKernelModules = [ "xhci_pci" "virtio_scsi" "sr_mod" ]; kernelModules = [ ]; }; kernelModules = [ ]; extraModulePackages = [ ]; }; - fileSystems."/" = { - device = "/dev/disk/by-partlabel/disk-primary-root"; - fsType = "ext4"; - }; + fileSystems."/" = + { device = "/dev/disk/by-partlabel/disk-primary-root"; + fsType = "ext4"; + }; - fileSystems."/boot" = { - device = "/dev/disk/by-partlabel/disk-primary-ESP"; - fsType = "vfat"; - options = [ - "fmask=0022" - "dmask=0022" - ]; - }; + fileSystems."/boot" = + { device = "/dev/disk/by-partlabel/disk-primary-ESP"; + fsType = "vfat"; + options = [ "fmask=0022" "dmask=0022" ]; + }; - fileSystems."/nix" = { - device = "/dev/disk/by-partlabel/disk-volume1-nix"; - fsType = "ext4"; - }; + fileSystems."/nix" = + { device = "/dev/disk/by-partlabel/disk-volume1-nix"; + fsType = "ext4"; + }; swapDevices = [ ]; diff --git a/modules/hosts/nixos/hetznix02/home-gene.nix b/modules/hosts/nixos/hetznix02/home-gene.nix index 2f6f186..945badd 100644 --- a/modules/hosts/nixos/hetznix02/home-gene.nix +++ b/modules/hosts/nixos/hetznix02/home-gene.nix @@ -1,3 +1,3 @@ -_: { +{ ... }: { home.stateVersion = "24.05"; } diff --git a/modules/hosts/nixos/hetznix02/post-install/default.nix b/modules/hosts/nixos/hetznix02/post-install/default.nix index 823dabb..9daed2b 100644 --- a/modules/hosts/nixos/hetznix02/post-install/default.nix +++ b/modules/hosts/nixos/hetznix02/post-install/default.nix @@ -1,5 +1,4 @@ -{ config, username, ... }: -{ +{ config, username, ... }: { imports = [ ../../../../shared/nixos/lets-encrypt.nix ./monitoring.nix @@ -24,3 +23,4 @@ }; }; } + diff --git a/modules/hosts/nixos/hetznix02/post-install/monitoring.nix b/modules/hosts/nixos/hetznix02/post-install/monitoring.nix index 8f44f00..97d9c85 100644 --- a/modules/hosts/nixos/hetznix02/post-install/monitoring.nix +++ b/modules/hosts/nixos/hetznix02/post-install/monitoring.nix @@ -1,8 +1,6 @@ -{ config, pkgs, ... }: -let +{ config, pkgs, ... }: let metrics_server = "https://monitoring.home.technicalissues.us/remotewrite"; -in -{ +in { services = { vmagent = { enable = true; @@ -16,11 +14,11 @@ in { job_name = "node"; static_configs = [ - { targets = [ "127.0.0.1:9100" ]; } + { targets = ["127.0.0.1:9100"]; } ]; metric_relabel_configs = [ { - source_labels = [ "__name__" ]; + source_labels = ["__name__"]; regex = "go_.*"; action = "drop"; } @@ -37,11 +35,11 @@ in { job_name = "nginx"; static_configs = [ - { targets = [ "127.0.0.1:9113" ]; } + { targets = ["127.0.0.1:9113"]; } ]; metric_relabel_configs = [ { - source_labels = [ "__name__" ]; + source_labels = ["__name__"]; regex = "go_.*"; action = "drop"; } @@ -79,7 +77,7 @@ in # ---------------------------- # Exporters (using built-in NixOS modules) # ---------------------------- - + # Node exporter - using the built-in module prometheus.exporters.node = { enable = true; @@ -112,7 +110,7 @@ in group = "vmagent"; }; - users.groups.vmagent = { }; + users.groups.vmagent = {}; # ---------------------------- # SOPS secrets configuration @@ -121,9 +119,10 @@ in secrets = { vmagent_push_pw = { owner = "vmagent"; - restartUnits = [ "vmagent.service" ]; + restartUnits = ["vmagent.service"]; sopsFile = ../../../../shared/secrets.yaml; }; }; }; } + diff --git a/modules/hosts/nixos/hetznix02/post-install/nginx.nix b/modules/hosts/nixos/hetznix02/post-install/nginx.nix index 880b521..bd91204 100644 --- a/modules/hosts/nixos/hetznix02/post-install/nginx.nix +++ b/modules/hosts/nixos/hetznix02/post-install/nginx.nix @@ -1,8 +1,7 @@ -{ pkgs, ... }: -let + +{ pkgs, ... }: let domain = "genebean.me"; -in -{ +in { environment.etc.nginx-littlelinks = { # Info generated via # nurl https://github.com/genebean/littlelink genebean-sometag diff --git a/modules/hosts/nixos/kiosk-entryway/default.nix b/modules/hosts/nixos/kiosk-entryway/default.nix index 8a7a8cb..15e13f7 100644 --- a/modules/hosts/nixos/kiosk-entryway/default.nix +++ b/modules/hosts/nixos/kiosk-entryway/default.nix @@ -1,11 +1,4 @@ -{ - config, - lib, - pkgs, - username, - ... -}: -{ +{ config, lib, pkgs, username, ... }: { imports = [ ./disk-config.nix ./hardware-configuration.nix @@ -49,7 +42,7 @@ # Home "Diagon Alley".pskRaw = "ext:psk_diagon_alley"; # Public networks - "Gallery Row-GuestWiFi" = { }; + "Gallery Row-GuestWiFi" = {}; "LocalTies Guest".pskRaw = "ext:psk_local_ties"; }; secretsFile = "${config.sops.secrets.wifi_creds.path}"; @@ -58,26 +51,25 @@ nixpkgs.overlays = [ (final: super: { - makeModulesClosure = x: super.makeModulesClosure (x // { allowMissing = true; }); + makeModulesClosure = x: + super.makeModulesClosure (x // { allowMissing = true; }); }) ]; services = { - cage = - let - kioskProgram = pkgs.writeShellScript "kiosk.sh" '' - WAYLAND_DISPLAY=wayland-0 wlr-randr --output HDMI-A-1 - /etc/profiles/per-user/gene/bin/chromium-browser - ''; - in - { - enable = true; - program = kioskProgram; - user = "gene"; - environment = { - WLR_LIBINPUT_NO_DEVICES = "1"; # boot up even if no mouse/keyboard connected - }; + cage = let + kioskProgram = pkgs.writeShellScript "kiosk.sh" '' + WAYLAND_DISPLAY=wayland-0 wlr-randr --output HDMI-A-1 + /etc/profiles/per-user/gene/bin/chromium-browser + ''; + in { + enable = true; + program = kioskProgram; + user = "gene"; + environment = { + WLR_LIBINPUT_NO_DEVICES = "1"; # boot up even if no mouse/keyboard connected }; + }; prometheus.exporters.node = { enable = true; enabledCollectors = [ @@ -123,10 +115,7 @@ users.users.${username} = { isNormalUser = true; description = "Gene Liverman"; - extraGroups = [ - "networkmanager" - "wheel" - ]; + extraGroups = [ "networkmanager" "wheel" ]; linger = true; }; @@ -136,3 +125,4 @@ memoryPercent = 90; }; } + diff --git a/modules/hosts/nixos/kiosk-entryway/hardware-configuration.nix b/modules/hosts/nixos/kiosk-entryway/hardware-configuration.nix index 9d6ff09..23c2071 100644 --- a/modules/hosts/nixos/kiosk-entryway/hardware-configuration.nix +++ b/modules/hosts/nixos/kiosk-entryway/hardware-configuration.nix @@ -1,27 +1,14 @@ # Do not modify this file! It was generated by ‘nixos-generate-config’ # and may be overwritten by future invocations. Please make changes # to /etc/nixos/configuration.nix instead. -{ - config, - lib, - pkgs, - modulesPath, - ... -}: +{ config, lib, pkgs, modulesPath, ... }: { - imports = [ - (modulesPath + "/installer/scan/not-detected.nix") - ]; + imports = + [ (modulesPath + "/installer/scan/not-detected.nix") + ]; - boot.initrd.availableKernelModules = [ - "xhci_pci" - "ehci_pci" - "ahci" - "usbhid" - "sd_mod" - "rtsx_pci_sdmmc" - ]; + boot.initrd.availableKernelModules = [ "xhci_pci" "ehci_pci" "ahci" "usbhid" "sd_mod" "rtsx_pci_sdmmc" ]; boot.initrd.kernelModules = [ ]; boot.kernelModules = [ "kvm-intel" ]; boot.extraModulePackages = [ ]; diff --git a/modules/hosts/nixos/kiosk-entryway/home-gene.nix b/modules/hosts/nixos/kiosk-entryway/home-gene.nix index 635af55..8e3e8b1 100644 --- a/modules/hosts/nixos/kiosk-entryway/home-gene.nix +++ b/modules/hosts/nixos/kiosk-entryway/home-gene.nix @@ -1,4 +1,4 @@ -_: { +{ ... }: { home.stateVersion = "24.11"; programs = { @@ -21,3 +21,4 @@ _: { }; } + diff --git a/modules/hosts/nixos/kiosk-entryway/monitoring.nix b/modules/hosts/nixos/kiosk-entryway/monitoring.nix index 8f44f00..97d9c85 100644 --- a/modules/hosts/nixos/kiosk-entryway/monitoring.nix +++ b/modules/hosts/nixos/kiosk-entryway/monitoring.nix @@ -1,8 +1,6 @@ -{ config, pkgs, ... }: -let +{ config, pkgs, ... }: let metrics_server = "https://monitoring.home.technicalissues.us/remotewrite"; -in -{ +in { services = { vmagent = { enable = true; @@ -16,11 +14,11 @@ in { job_name = "node"; static_configs = [ - { targets = [ "127.0.0.1:9100" ]; } + { targets = ["127.0.0.1:9100"]; } ]; metric_relabel_configs = [ { - source_labels = [ "__name__" ]; + source_labels = ["__name__"]; regex = "go_.*"; action = "drop"; } @@ -37,11 +35,11 @@ in { job_name = "nginx"; static_configs = [ - { targets = [ "127.0.0.1:9113" ]; } + { targets = ["127.0.0.1:9113"]; } ]; metric_relabel_configs = [ { - source_labels = [ "__name__" ]; + source_labels = ["__name__"]; regex = "go_.*"; action = "drop"; } @@ -79,7 +77,7 @@ in # ---------------------------- # Exporters (using built-in NixOS modules) # ---------------------------- - + # Node exporter - using the built-in module prometheus.exporters.node = { enable = true; @@ -112,7 +110,7 @@ in group = "vmagent"; }; - users.groups.vmagent = { }; + users.groups.vmagent = {}; # ---------------------------- # SOPS secrets configuration @@ -121,9 +119,10 @@ in secrets = { vmagent_push_pw = { owner = "vmagent"; - restartUnits = [ "vmagent.service" ]; + restartUnits = ["vmagent.service"]; sopsFile = ../../../../shared/secrets.yaml; }; }; }; } + diff --git a/modules/hosts/nixos/kiosk-gene-desk/default.nix b/modules/hosts/nixos/kiosk-gene-desk/default.nix index b550e87..24e208a 100644 --- a/modules/hosts/nixos/kiosk-gene-desk/default.nix +++ b/modules/hosts/nixos/kiosk-gene-desk/default.nix @@ -1,12 +1,4 @@ -{ - inputs, - config, - lib, - pkgs, - username, - ... -}: -{ +{ inputs, config, lib, pkgs, username, ... }: { imports = [ # SD card image "${inputs.nixpkgs}/nixos/modules/installer/sd-card/sd-image-aarch64.nix" @@ -42,7 +34,7 @@ # Home "Diagon Alley".pskRaw = "ext:psk_diagon_alley"; # Public networks - "Gallery Row-GuestWiFi" = { }; + "Gallery Row-GuestWiFi" = {}; "LocalTies Guest".pskRaw = "ext:psk_local_ties"; }; secretsFile = "${config.sops.secrets.wifi_creds.path}"; @@ -51,28 +43,27 @@ nixpkgs.overlays = [ (final: super: { - makeModulesClosure = x: super.makeModulesClosure (x // { allowMissing = true; }); + makeModulesClosure = x: + super.makeModulesClosure (x // { allowMissing = true; }); }) ]; sdImage.compressImage = true; services = { - cage = - let - kioskProgram = pkgs.writeShellScript "kiosk.sh" '' - WAYLAND_DISPLAY=wayland-0 wlr-randr --output HDMI-A-1 --transform 90 - /etc/profiles/per-user/gene/bin/chromium-browser - ''; - in - { - enable = true; - program = kioskProgram; - user = "gene"; - environment = { - WLR_LIBINPUT_NO_DEVICES = "1"; # boot up even if no mouse/keyboard connected - }; + cage = let + kioskProgram = pkgs.writeShellScript "kiosk.sh" '' + WAYLAND_DISPLAY=wayland-0 wlr-randr --output HDMI-A-1 --transform 90 + /etc/profiles/per-user/gene/bin/chromium-browser + ''; + in { + enable = true; + program = kioskProgram; + user = "gene"; + environment = { + WLR_LIBINPUT_NO_DEVICES = "1"; # boot up even if no mouse/keyboard connected }; + }; prometheus.exporters.node = { enable = true; enabledCollectors = [ @@ -117,10 +108,7 @@ users.users.${username} = { isNormalUser = true; description = "Gene Liverman"; - extraGroups = [ - "networkmanager" - "wheel" - ]; + extraGroups = [ "networkmanager" "wheel" ]; linger = true; }; @@ -130,3 +118,4 @@ memoryPercent = 90; }; } + diff --git a/modules/hosts/nixos/kiosk-gene-desk/home-gene.nix b/modules/hosts/nixos/kiosk-gene-desk/home-gene.nix index ea0f4db..b6f0a3c 100644 --- a/modules/hosts/nixos/kiosk-gene-desk/home-gene.nix +++ b/modules/hosts/nixos/kiosk-gene-desk/home-gene.nix @@ -1,4 +1,4 @@ -_: { +{ ... }: { home.stateVersion = "24.11"; programs = { @@ -20,3 +20,4 @@ _: { }; } + diff --git a/modules/hosts/nixos/nixnas1/default.nix b/modules/hosts/nixos/nixnas1/default.nix index 6ab4184..bf285a6 100644 --- a/modules/hosts/nixos/nixnas1/default.nix +++ b/modules/hosts/nixos/nixnas1/default.nix @@ -1,10 +1,4 @@ -{ - config, - pkgs, - username, - ... -}: -{ +{ config, pkgs, username, ... }: { imports = [ ./disk-config.nix ./hardware-configuration.nix @@ -23,16 +17,16 @@ device = "nodev"; mirroredBoots = [ { - devices = [ "/dev/disk/by-uuid/02A5-6FCC" ]; + devices = ["/dev/disk/by-uuid/02A5-6FCC"]; path = "/boot"; } { - devices = [ "/dev/disk/by-uuid/02F1-B12D" ]; + devices = ["/dev/disk/by-uuid/02F1-B12D"]; path = "/boot-fallback"; } ]; }; - supportedFilesystems = [ "zfs" ]; + supportedFilesystems = ["zfs"]; zfs = { extraPools = [ "storage" ]; forceImportRoot = false; diff --git a/modules/hosts/nixos/nixnas1/disk-config.nix b/modules/hosts/nixos/nixnas1/disk-config.nix index c521aa9..dcb9555 100644 --- a/modules/hosts/nixos/nixnas1/disk-config.nix +++ b/modules/hosts/nixos/nixnas1/disk-config.nix @@ -1,4 +1,5 @@ -_: { +{ ... }: +{ disko.devices = { disk = { sdc = { @@ -123,4 +124,4 @@ _: { }; # end zroot }; }; -} +} \ No newline at end of file diff --git a/modules/hosts/nixos/nixnas1/hardware-configuration.nix b/modules/hosts/nixos/nixnas1/hardware-configuration.nix index 7982749..8cce237 100644 --- a/modules/hosts/nixos/nixnas1/hardware-configuration.nix +++ b/modules/hosts/nixos/nixnas1/hardware-configuration.nix @@ -1,65 +1,45 @@ # Do not modify this file! It was generated by ‘nixos-generate-config’ # and may be overwritten by future invocations. Please make changes # to /etc/nixos/configuration.nix instead. -{ - config, - lib, - modulesPath, - ... -}: +{ config, lib, modulesPath, ... }: { - imports = [ - (modulesPath + "/installer/scan/not-detected.nix") - ]; + imports = + [ (modulesPath + "/installer/scan/not-detected.nix") + ]; - boot.initrd.availableKernelModules = [ - "ehci_pci" - "ahci" - "usbhid" - "usb_storage" - "sd_mod" - "sr_mod" - ]; + boot.initrd.availableKernelModules = [ "ehci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" "sr_mod" ]; boot.initrd.kernelModules = [ "nvme" ]; boot.kernelModules = [ "kvm-intel" ]; boot.extraModulePackages = [ ]; - fileSystems."/" = { - device = "zroot/root"; - fsType = "zfs"; - }; + fileSystems."/" = + { device = "zroot/root"; + fsType = "zfs"; + }; - fileSystems."/nix" = { - device = "zroot/root/nix"; - fsType = "zfs"; - }; + fileSystems."/nix" = + { device = "zroot/root/nix"; + fsType = "zfs"; + }; - fileSystems."/home" = { - device = "zroot/root/home"; - fsType = "zfs"; - }; + fileSystems."/home" = + { device = "zroot/root/home"; + fsType = "zfs"; + }; fileSystems."/boot" = # { device = "/dev/disk/by-uuid/02A5-6FCC"; - { - device = "/dev/disk/by-partlabel/disk-sdc-BOOT"; + { device = "/dev/disk/by-partlabel/disk-sdc-BOOT"; fsType = "vfat"; - options = [ - "fmask=0022" - "dmask=0022" - ]; + options = [ "fmask=0022" "dmask=0022" ]; }; fileSystems."/boot-fallback" = # { device = "/dev/disk/by-uuid/02F1-B12D"; - { - device = "/dev/disk/by-partlabel/disk-sdd-BOOT-FALLBACK"; + { device = "/dev/disk/by-partlabel/disk-sdd-BOOT-FALLBACK"; fsType = "vfat"; - options = [ - "fmask=0022" - "dmask=0022" - ]; + options = [ "fmask=0022" "dmask=0022" ]; }; swapDevices = [ ]; diff --git a/modules/hosts/nixos/nixnas1/home-gene.nix b/modules/hosts/nixos/nixnas1/home-gene.nix index 2f6f186..b6eed65 100644 --- a/modules/hosts/nixos/nixnas1/home-gene.nix +++ b/modules/hosts/nixos/nixnas1/home-gene.nix @@ -1,3 +1,3 @@ -_: { - home.stateVersion = "24.05"; +{ ... }: { + home.stateVersion = "24.05"; } diff --git a/modules/hosts/nixos/nixnuc/containers/audiobookshelf.nix b/modules/hosts/nixos/nixnuc/containers/audiobookshelf.nix index 4e8d2b0..2c8f134 100644 --- a/modules/hosts/nixos/nixnuc/containers/audiobookshelf.nix +++ b/modules/hosts/nixos/nixnuc/containers/audiobookshelf.nix @@ -1,9 +1,7 @@ -_: -let +{ ... }: let volume_base = "/var/lib/audiobookshelf"; http_port = "13378"; -in -{ +in { # Audiobookshelf virtualisation.oci-containers.containers = { diff --git a/modules/hosts/nixos/nixnuc/containers/mountain-mesh-bot-discord.nix b/modules/hosts/nixos/nixnuc/containers/mountain-mesh-bot-discord.nix index 331ddbe..670918b 100644 --- a/modules/hosts/nixos/nixnuc/containers/mountain-mesh-bot-discord.nix +++ b/modules/hosts/nixos/nixnuc/containers/mountain-mesh-bot-discord.nix @@ -1,8 +1,6 @@ -{ config, username, ... }: -let +{ config, username, ... }: let volume_base = "/orico/mountain-mesh-bot-discord"; -in -{ +in { # My mountain-mesh-bot-discord container virtualisation.oci-containers.containers = { @@ -19,8 +17,6 @@ in sops.secrets.mtnmesh_bot_dot_env = { path = "${volume_base}/.env"; - restartUnits = [ - "${config.virtualisation.oci-containers.containers.mtnmesh_bot_discord.serviceName}" - ]; + restartUnits = [ "${config.virtualisation.oci-containers.containers.mtnmesh_bot_discord.serviceName}" ]; }; } diff --git a/modules/hosts/nixos/nixnuc/containers/psitransfer.nix b/modules/hosts/nixos/nixnuc/containers/psitransfer.nix index f1e3558..b8f6e55 100644 --- a/modules/hosts/nixos/nixnuc/containers/psitransfer.nix +++ b/modules/hosts/nixos/nixnuc/containers/psitransfer.nix @@ -1,10 +1,8 @@ -{ config, ... }: -let +{ config, ... }: let volume_base = "/orico/psitransfer"; http_port = "3000"; psitransfer_dot_env = "${config.sops.secrets.psitransfer_dot_env.path}"; -in -{ +in { ############################################################################# # My intent as of now is to only make this available to the outside world # @@ -31,3 +29,4 @@ in }; }; } + diff --git a/modules/hosts/nixos/nixnuc/default.nix b/modules/hosts/nixos/nixnuc/default.nix index 6dc8806..1e3111c 100644 --- a/modules/hosts/nixos/nixnuc/default.nix +++ b/modules/hosts/nixos/nixnuc/default.nix @@ -1,18 +1,10 @@ -{ - inputs, - config, - pkgs, - username, - ... -}: -let +{ inputs, config, pkgs, username, ... }: let http_port = 80; https_port = 443; home_domain = "home.technicalissues.us"; backend_ip = "127.0.0.1"; restic_backup_time = "02:00"; -in -{ +in { imports = [ ./hardware-configuration.nix ./containers/audiobookshelf.nix @@ -39,9 +31,7 @@ in }; environment = { - sessionVariables = { - LIBVA_DRIVER_NAME = "iHD"; - }; + sessionVariables = { LIBVA_DRIVER_NAME = "iHD"; }; systemPackages = with pkgs; [ inputs.compose2nix.packages.${pkgs.stdenv.hostPlatform.system}.default docker-compose @@ -67,7 +57,7 @@ in intel-ocl # Generic OpenCL support ]; }; - + mailserver = { enable = true; enableImap = false; @@ -91,26 +81,26 @@ in # Open ports in the firewall. firewall = { allowedTCPPorts = [ - 22 # ssh - 80 # http to local Nginx - 443 # https to local Nginx - 3000 # PsiTransfer in oci-container - 3001 # immich-kiosk in compose - 3002 # grafana - 3005 # Firefly III - 3006 # Firefly III Data Importer - 3030 # Forgejo - 3087 # Youtarr in docker compose - 8001 # Tube Archivist - 8384 # Syncthing gui - 8888 # Atuin - 8090 # Wallabag in docker compose - 8945 # Pinchflat + 22 # ssh + 80 # http to local Nginx + 443 # https to local Nginx + 3000 # PsiTransfer in oci-container + 3001 # immich-kiosk in compose + 3002 # grafana + 3005 # Firefly III + 3006 # Firefly III Data Importer + 3030 # Forgejo + 3087 # Youtarr in docker compose + 8001 # Tube Archivist + 8384 # Syncthing gui + 8888 # Atuin + 8090 # Wallabag in docker compose + 8945 # Pinchflat 13378 # Audiobookshelf in oci-container ]; allowedUDPPorts = [ - 1900 # Jellyfin service auto-discovery - 7359 # Jellyfin auto-discovery + 1900 # Jellyfin service auto-discovery + 7359 # Jellyfin auto-discovery ]; }; # Or disable the firewall altogether. @@ -122,19 +112,11 @@ in networkmanager.enable = false; useNetworkd = true; vlans = { - vlan23 = { - id = 23; - interface = "eno1"; - }; + vlan23 = { id = 23; interface = "eno1"; }; }; interfaces = { eno1.useDHCP = true; - vlan23.ipv4.addresses = [ - { - address = "192.168.23.21"; - prefixLength = 24; - } - ]; + vlan23.ipv4.addresses = [{ address = "192.168.23.21"; prefixLength = 24; }]; }; }; @@ -329,11 +311,7 @@ in "nix-tester.${home_domain}" ]; listen = [ - { - port = https_port; - addr = "0.0.0.0"; - ssl = true; - } + { port = https_port; addr = "0.0.0.0"; ssl = true; } ]; enableACME = true; acmeRoot = null; @@ -353,13 +331,7 @@ in }; }; "ab.${home_domain}" = { - listen = [ - { - port = https_port; - addr = "0.0.0.0"; - ssl = true; - } - ]; + listen = [{ port = https_port; addr = "0.0.0.0"; ssl = true; }]; enableACME = true; acmeRoot = null; forceSSL = true; @@ -370,41 +342,17 @@ in ''; }; "atuin.${home_domain}" = { - listen = [ - { - port = https_port; - addr = "0.0.0.0"; - ssl = true; - } - ]; + listen = [{ port = https_port; addr = "0.0.0.0"; ssl = true; }]; enableACME = true; acmeRoot = null; forceSSL = true; locations."/".proxyPass = "http://${backend_ip}:8888"; }; # budget.${home_domain} - "${config.services.firefly-iii.virtualHost}".listen = [ - { - port = 3005; - addr = "0.0.0.0"; - ssl = false; - } - ]; - "${config.services.firefly-iii-data-importer.virtualHost}".listen = [ - { - port = 3006; - addr = "0.0.0.0"; - ssl = false; - } - ]; + "${config.services.firefly-iii.virtualHost}".listen = [{ port = 3005; addr = "0.0.0.0"; ssl = false; }]; + "${config.services.firefly-iii-data-importer.virtualHost}".listen = [{ port = 3006; addr = "0.0.0.0"; ssl = false; }]; "git.${home_domain}" = { - listen = [ - { - port = https_port; - addr = "0.0.0.0"; - ssl = true; - } - ]; + listen = [{ port = https_port; addr = "0.0.0.0"; ssl = true; }]; enableACME = true; acmeRoot = null; forceSSL = true; @@ -414,13 +362,7 @@ in ''; }; "id.${home_domain}" = { - listen = [ - { - port = https_port; - addr = "0.0.0.0"; - ssl = true; - } - ]; + listen = [{ port = https_port; addr = "0.0.0.0"; ssl = true; }]; enableACME = true; acmeRoot = null; forceSSL = true; @@ -432,13 +374,7 @@ in ''; }; "immich.${home_domain}" = { - listen = [ - { - port = https_port; - addr = "0.0.0.0"; - ssl = true; - } - ]; + listen = [{ port = https_port; addr = "0.0.0.0"; ssl = true; }]; enableACME = true; acmeRoot = null; forceSSL = true; @@ -452,13 +388,7 @@ in ''; }; "immich-kiosk.${home_domain}" = { - listen = [ - { - port = https_port; - addr = "0.0.0.0"; - ssl = true; - } - ]; + listen = [{ port = https_port; addr = "0.0.0.0"; ssl = true; }]; enableACME = true; acmeRoot = null; forceSSL = true; @@ -473,13 +403,7 @@ in ''; }; "jellyfin.${home_domain}" = { - listen = [ - { - port = https_port; - addr = "0.0.0.0"; - ssl = true; - } - ]; + listen = [{ port = https_port; addr = "0.0.0.0"; ssl = true; }]; enableACME = true; acmeRoot = null; forceSSL = true; @@ -504,13 +428,7 @@ in ''; }; "mealie.${home_domain}" = { - listen = [ - { - port = https_port; - addr = "0.0.0.0"; - ssl = true; - } - ]; + listen = [{ port = https_port; addr = "0.0.0.0"; ssl = true; }]; enableACME = true; acmeRoot = null; forceSSL = true; @@ -520,13 +438,7 @@ in ''; }; "monitoring.${home_domain}" = { - listen = [ - { - port = https_port; - addr = "0.0.0.0"; - ssl = true; - } - ]; + listen = [{ port = https_port; addr = "0.0.0.0"; ssl = true; }]; enableACME = true; acmeRoot = null; forceSSL = true; @@ -557,13 +469,7 @@ in ''; }; "readit.${home_domain}" = { - listen = [ - { - port = https_port; - addr = "0.0.0.0"; - ssl = true; - } - ]; + listen = [{ port = https_port; addr = "0.0.0.0"; ssl = true; }]; enableACME = true; acmeRoot = null; forceSSL = true; @@ -651,7 +557,7 @@ in secrets = { firefly_app_key = { owner = config.services.firefly-iii.user; - restartUnits = [ "nginx.service" ]; + restartUnits = ["nginx.service"]; }; firefly_pat_data_import = { owner = config.services.firefly-iii-data-importer.user; @@ -676,7 +582,7 @@ in }; immich_kiosk_basic_auth = { owner = config.users.users.nginx.name; - restartUnits = [ "nginx.service" ]; + restartUnits = ["nginx.service"]; }; local_git_config = { owner = "${username}"; @@ -688,12 +594,12 @@ in }; mealie = { mode = "0444"; - restartUnits = [ "mealie.service" ]; + restartUnits = ["mealie.service"]; }; nextcloud_admin_pass.owner = config.users.users.nextcloud.name; nginx_basic_auth = { owner = "nginx"; - restartUnits = [ "nginx.service" ]; + restartUnits = ["nginx.service"]; }; tailscale_key = { restartUnits = [ "tailscaled-autoconnect.service" ]; @@ -704,24 +610,19 @@ in systemd.services = { jellyfin.environment.LIBVA_DRIVER_NAME = "iHD"; "mealie" = { - requires = [ "postgresql.service" ]; - after = [ "postgresql.service" ]; + requires = ["postgresql.service"]; + after = ["postgresql.service"]; }; "nextcloud-setup" = { - requires = [ "postgresql.service" ]; - after = [ "postgresql.service" ]; + requires = ["postgresql.service"]; + after = ["postgresql.service"]; }; }; users.users.${username} = { isNormalUser = true; description = "Gene Liverman"; - extraGroups = [ - "docker" - "podman" - "networkmanager" - "wheel" - ]; + extraGroups = [ "docker" "podman" "networkmanager" "wheel" ]; linger = true; }; diff --git a/modules/hosts/nixos/nixnuc/hardware-configuration.nix b/modules/hosts/nixos/nixnuc/hardware-configuration.nix index c61cca9..c4d326f 100644 --- a/modules/hosts/nixos/nixnuc/hardware-configuration.nix +++ b/modules/hosts/nixos/nixnuc/hardware-configuration.nix @@ -1,54 +1,42 @@ # Do not modify this file! It was generated by ‘nixos-generate-config’ # and may be overwritten by future invocations. Please make changes # to /etc/nixos/configuration.nix instead. -{ - config, - lib, - modulesPath, - ... -}: +{ config, lib, modulesPath, ... }: { - imports = [ - (modulesPath + "/installer/scan/not-detected.nix") - ]; + imports = + [ (modulesPath + "/installer/scan/not-detected.nix") + ]; - boot.initrd.availableKernelModules = [ - "xhci_pci" - "ahci" - "usbhid" - "usb_storage" - "sd_mod" - "sdhci_pci" - ]; + boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" "sdhci_pci" ]; boot.initrd.kernelModules = [ ]; boot.kernelModules = [ "kvm-intel" ]; boot.extraModulePackages = [ ]; - fileSystems."/" = { - device = "/dev/disk/by-uuid/0ee15ee9-37ea-448d-aa3b-23eb25994df0"; - fsType = "ext4"; - }; + fileSystems."/" = + { device = "/dev/disk/by-uuid/0ee15ee9-37ea-448d-aa3b-23eb25994df0"; + fsType = "ext4"; + }; - fileSystems."/boot" = { - device = "/dev/disk/by-uuid/4814-3E47"; - fsType = "vfat"; - }; + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/4814-3E47"; + fsType = "vfat"; + }; - fileSystems."/var/lib/audiobookshelf" = { - device = "orico/audiobookshelf"; - fsType = "zfs"; - }; + fileSystems."/var/lib/audiobookshelf" = + { device = "orico/audiobookshelf"; + fsType = "zfs"; + }; - fileSystems."/var/lib/postgresql" = { - device = "orico/postgresql-data"; - fsType = "zfs"; - }; + fileSystems."/var/lib/postgresql" = + { device = "orico/postgresql-data"; + fsType = "zfs"; + }; - fileSystems."/var/lib/postgresql/16/pg_wal" = { - device = "orico/postgresql-wal-16"; - fsType = "zfs"; - }; + fileSystems."/var/lib/postgresql/16/pg_wal" = + { device = "orico/postgresql-wal-16"; + fsType = "zfs"; + }; # Second disk inside case #fileSystems."/var/lib/postgresql" = diff --git a/modules/hosts/nixos/nixnuc/home-gene.nix b/modules/hosts/nixos/nixnuc/home-gene.nix index d574493..21ec006 100644 --- a/modules/hosts/nixos/nixnuc/home-gene.nix +++ b/modules/hosts/nixos/nixnuc/home-gene.nix @@ -1,3 +1,3 @@ -_: { - home.stateVersion = "23.11"; +{ ... }: { + home.stateVersion = "23.11"; } diff --git a/modules/hosts/nixos/nixnuc/monitoring-stack.nix b/modules/hosts/nixos/nixnuc/monitoring-stack.nix index 3d489f8..89e7ae0 100644 --- a/modules/hosts/nixos/nixnuc/monitoring-stack.nix +++ b/modules/hosts/nixos/nixnuc/monitoring-stack.nix @@ -1,8 +1,6 @@ -{ config, pkgs, ... }: -let +{ config, pkgs, ... }: let home_domain = "home.technicalissues.us"; -in -{ +in { environment.systemPackages = with pkgs; [ # Keeping empty for manual testing if needed ]; @@ -27,7 +25,7 @@ in # ---------------------------- victoriametrics = { enable = true; - stateDir = "victoriametrics"; # Just the directory name, module adds /var/lib/ prefix + stateDir = "victoriametrics"; # Just the directory name, module adds /var/lib/ prefix package = pkgs.victoriametrics; }; @@ -49,24 +47,21 @@ in static_configs = [ { targets = [ - "127.0.0.1:9100" # nixnuc - "192.168.22.22:9100" # home assistant + "127.0.0.1:9100" # nixnuc + "192.168.22.22:9100" # home assistant "umbrel:9100" ]; } ]; metric_relabel_configs = [ { - source_labels = [ - "__name__" - "nodename" - ]; + source_labels = ["__name__" "nodename"]; regex = "node_uname_info;0d869efa-prometheus-node-exporter"; target_label = "nodename"; replacement = "homeassistant"; } { - source_labels = [ "__name__" ]; + source_labels = ["__name__"]; regex = "go_.*"; action = "drop"; } @@ -89,11 +84,11 @@ in { job_name = "cadvisor"; static_configs = [ - { targets = [ "127.0.0.1:8081" ]; } + { targets = ["127.0.0.1:8081"]; } ]; metric_relabel_configs = [ { - source_labels = [ "__name__" ]; + source_labels = ["__name__"]; regex = "go_.*"; action = "drop"; } @@ -110,11 +105,11 @@ in { job_name = "nginx"; static_configs = [ - { targets = [ "127.0.0.1:9113" ]; } + { targets = ["127.0.0.1:9113"]; } ]; metric_relabel_configs = [ { - source_labels = [ "__name__" ]; + source_labels = ["__name__"]; regex = "go_.*"; action = "drop"; } @@ -133,7 +128,7 @@ in scrape_interval = "30s"; metrics_path = "/api/prometheus"; static_configs = [ - { targets = [ "192.168.22.22:8123" ]; } + { targets = ["192.168.22.22:8123"]; } ]; bearer_token_file = config.sops.secrets.home_assistant_token.path; relabel_configs = [ @@ -150,7 +145,7 @@ in scheme = "https"; scrape_interval = "30s"; static_configs = [ - { targets = [ "utk.technicalissues.us" ]; } + { targets = ["utk.technicalissues.us"]; } ]; basic_auth = { password_file = config.sops.secrets.uptimekuma_grafana_api_key.path; @@ -158,19 +153,19 @@ in }; metric_relabel_configs = [ { - source_labels = [ "monitor_hostname" ]; + source_labels = ["monitor_hostname"]; regex = "^null$"; replacement = ""; target_label = "monitor_hostname"; } { - source_labels = [ "monitor_port" ]; + source_labels = ["monitor_port"]; regex = "^null$"; replacement = ""; target_label = "monitor_port"; } { - source_labels = [ "monitor_url" ]; + source_labels = ["monitor_url"]; regex = "https:\/\/"; replacement = ""; target_label = "monitor_url"; @@ -216,16 +211,17 @@ in datasources.settings.datasources = [ { - name = "VictoriaMetrics"; - type = "victoriametrics-metrics-datasource"; + name = "VictoriaMetrics"; + type = "victoriametrics-metrics-datasource"; access = "proxy"; - url = "http://127.0.0.1:8428"; + url = "http://127.0.0.1:8428"; isDefault = true; - uid = "VictoriaMetrics"; # Set explicit UID for use in alert rules + uid = "VictoriaMetrics"; # Set explicit UID for use in alert rules } ]; }; + settings = { auth = { # Set to true to disable (hide) the login form, useful if you use OAuth @@ -233,36 +229,36 @@ in }; "auth.generic_oauth" = { - name = "Pocket ID"; - enabled = true; + name = "Pocket ID"; + enabled = true; # Use Grafana's file reference syntax for secrets - client_id = "$__file{${config.sops.secrets.grafana_oauth_client_id.path}}"; - client_secret = "$__file{${config.sops.secrets.grafana_oauth_client_secret.path}}"; + client_id = "$__file{${config.sops.secrets.grafana_oauth_client_id.path}}"; + client_secret = "$__file{${config.sops.secrets.grafana_oauth_client_secret.path}}"; - auth_style = "AutoDetect"; - scopes = "openid email profile groups"; - auth_url = "${config.services.pocket-id.settings.APP_URL}/authorize"; - token_url = "${config.services.pocket-id.settings.APP_URL}/api/oidc/token"; - allow_sign_up = true; - auto_login = true; - name_attribute_path = "display_name"; - login_attribute_path = "preferred_username"; - email_attribute_name = "email:primary"; - email_attribute_path = "email"; - role_attribute_path = "contains(groups[*], 'grafana_super_admin') && 'GrafanaAdmin' || contains(groups[*], 'grafana_admin') && 'Admin' || contains(groups[*], 'grafana_editor') && 'Editor' || 'Viewer'"; - role_attribute_strict = false; + auth_style = "AutoDetect"; + scopes = "openid email profile groups"; + auth_url = "${config.services.pocket-id.settings.APP_URL}/authorize"; + token_url = "${config.services.pocket-id.settings.APP_URL}/api/oidc/token"; + allow_sign_up = true; + auto_login = true; + name_attribute_path = "display_name"; + login_attribute_path = "preferred_username"; + email_attribute_name = "email:primary"; + email_attribute_path = "email"; + role_attribute_path = "contains(groups[*], 'grafana_super_admin') && 'GrafanaAdmin' || contains(groups[*], 'grafana_admin') && 'Admin' || contains(groups[*], 'grafana_editor') && 'Editor' || 'Viewer'"; + role_attribute_strict = false; allow_assign_grafana_admin = true; - skip_org_role_sync = false; - use_pkce = true; - use_refresh_token = false; - tls_skip_verify_insecure = false; + skip_org_role_sync = false; + use_pkce = true; + use_refresh_token = false; + tls_skip_verify_insecure = false; }; # Database configuration - use PostgreSQL with peer authentication database = { type = "postgres"; - host = "/run/postgresql"; # Use Unix socket instead of TCP + host = "/run/postgresql"; # Use Unix socket instead of TCP name = "grafana"; user = "grafana"; # No password needed - using peer authentication via Unix socket @@ -270,10 +266,10 @@ in # Server configuration server = { - domain = "monitoring.${home_domain}"; - http_addr = "0.0.0.0"; - http_port = 3002; - root_url = "https://monitoring.${home_domain}/grafana/"; + domain = "monitoring.${home_domain}"; + http_addr = "0.0.0.0"; + http_port = 3002; + root_url = "https://monitoring.${home_domain}/grafana/"; serve_from_sub_path = true; }; @@ -290,7 +286,7 @@ in # ---------------------------- # Exporters (using built-in NixOS modules) # ---------------------------- - + # Node exporter - using the built-in module prometheus.exporters.node = { enable = true; @@ -336,7 +332,7 @@ in group = "vmagent"; }; - users.groups.vmagent = { }; + users.groups.vmagent = {}; # ---------------------------- # Systemd service dependencies @@ -354,19 +350,19 @@ in secrets = { grafana_oauth_client_id = { owner = "grafana"; - restartUnits = [ "grafana.service" ]; + restartUnits = ["grafana.service"]; }; grafana_oauth_client_secret = { owner = "grafana"; - restartUnits = [ "grafana.service" ]; + restartUnits = ["grafana.service"]; }; home_assistant_token = { owner = "vmagent"; - restartUnits = [ "vmagent.service" ]; + restartUnits = ["vmagent.service"]; }; uptimekuma_grafana_api_key = { owner = "vmagent"; - restartUnits = [ "vmagent.service" ]; + restartUnits = ["vmagent.service"]; sopsFile = ../../../shared/secrets.yaml; }; }; @@ -382,3 +378,4 @@ in ]; }; } + diff --git a/modules/hosts/nixos/rainbow-planet/default.nix b/modules/hosts/nixos/rainbow-planet/default.nix index bcb5155..d0c5439 100644 --- a/modules/hosts/nixos/rainbow-planet/default.nix +++ b/modules/hosts/nixos/rainbow-planet/default.nix @@ -1,11 +1,4 @@ -{ - inputs, - config, - pkgs, - username, - ... -}: -{ +{ inputs, config, pkgs, username, ... }: { imports = [ ./hardware-configuration.nix ../../../shared/nixos/flatpaks.nix @@ -21,7 +14,7 @@ }; loader = { efi.canTouchEfiVariables = true; - systemd-boot = { + systemd-boot= { enable = true; consoleMode = "1"; }; @@ -186,15 +179,7 @@ users.users.${username} = { isNormalUser = true; description = "Gene Liverman"; - extraGroups = [ - "adbusers" - "dialout" - "docker" - "input" - "networkmanager" - "podman" - "wheel" - ]; + extraGroups = [ "adbusers" "dialout" "docker" "input" "networkmanager" "podman" "wheel" ]; packages = with pkgs; [ tailscale-systray ]; diff --git a/modules/hosts/nixos/rainbow-planet/gnome.nix b/modules/hosts/nixos/rainbow-planet/gnome.nix index afe7c35..2aa57a5 100644 --- a/modules/hosts/nixos/rainbow-planet/gnome.nix +++ b/modules/hosts/nixos/rainbow-planet/gnome.nix @@ -1,5 +1,4 @@ -{ pkgs, ... }: -{ +{ pkgs, ... }: { environment.systemPackages = with pkgs; [ gnome.gnome-tweaks gnome.nautilus @@ -16,7 +15,7 @@ gnome.gnome-keyring.enable = true; # Provides secret storage gvfs.enable = true; # Used by Nautilus xserver = { - enable = true; # Enable the X11 windowing system. + enable = true; # Enable the X11 windowing system. # Configure keymap in X11 xkb = { @@ -34,3 +33,4 @@ }; }; } + diff --git a/modules/hosts/nixos/rainbow-planet/hardware-configuration.nix b/modules/hosts/nixos/rainbow-planet/hardware-configuration.nix index fe3b734..7a37e9f 100644 --- a/modules/hosts/nixos/rainbow-planet/hardware-configuration.nix +++ b/modules/hosts/nixos/rainbow-planet/hardware-configuration.nix @@ -1,51 +1,36 @@ # Do not modify this file! It was generated by ‘nixos-generate-config’ # and may be overwritten by future invocations. Please make changes # to /etc/nixos/configuration.nix instead. -{ - config, - lib, - modulesPath, - pkgs, - ... -}: +{ config, lib, modulesPath, pkgs, ... }: { - imports = [ - (modulesPath + "/installer/scan/not-detected.nix") - ]; + imports = + [ (modulesPath + "/installer/scan/not-detected.nix") + ]; - boot.initrd.availableKernelModules = [ - "xhci_pci" - "nvme" - "usb_storage" - "sd_mod" - "rtsx_pci_sdmmc" - ]; + boot.initrd.availableKernelModules = [ "xhci_pci" "nvme" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ]; # boot.kernelPackages = pkgs.linuxPackages_zen; boot.initrd.kernelModules = [ ]; - boot.kernelModules = [ - "kvm-intel" - "sg" - ]; + boot.kernelModules = [ "kvm-intel" "sg" ]; boot.kernelParams = [ "i915.enable_fbc=1" "i915.enable_psr=2" ]; boot.extraModulePackages = [ ]; - fileSystems."/" = { - device = "/dev/disk/by-uuid/eb9a2c7e-ae61-4d06-9464-49b98d576f7c"; - fsType = "ext4"; - }; + fileSystems."/" = + { device = "/dev/disk/by-uuid/eb9a2c7e-ae61-4d06-9464-49b98d576f7c"; + fsType = "ext4"; + }; - fileSystems."/boot" = { - device = "/dev/disk/by-uuid/924D-E7A4"; - fsType = "vfat"; - }; + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/924D-E7A4"; + fsType = "vfat"; + }; - swapDevices = [ - { device = "/dev/disk/by-uuid/166d24ca-401c-492e-845d-bb1d0d6d7d86"; } - ]; + swapDevices = + [ { device = "/dev/disk/by-uuid/166d24ca-401c-492e-845d-bb1d0d6d7d86"; } + ]; # Enables DHCP on each ethernet and wireless interface. In case of scripted networking # (the default) this is the recommended approach. When using systemd-networkd it's diff --git a/modules/hosts/nixos/rainbow-planet/home-gene.nix b/modules/hosts/nixos/rainbow-planet/home-gene.nix index db28e94..9abb351 100644 --- a/modules/hosts/nixos/rainbow-planet/home-gene.nix +++ b/modules/hosts/nixos/rainbow-planet/home-gene.nix @@ -1,5 +1,4 @@ -{ pkgs, ... }: -{ +{ pkgs, ... }: { home.stateVersion = "23.11"; imports = [ ../../../shared/home/general/all-gui.nix @@ -11,14 +10,12 @@ ]; home.file = { - ".config/hypr/frappe.conf".source = - pkgs.fetchFromGitHub { - owner = "catppuccin"; - repo = "hyprland"; - rev = "99a88fd21fac270bd999d4a26cf0f4a4222c58be"; - hash = "sha256-07B5QmQmsUKYf38oWU3+2C6KO4JvinuTwmW1Pfk8CT8="; - } - + "/themes/frappe.conf"; + ".config/hypr/frappe.conf".source = (pkgs.fetchFromGitHub { + owner = "catppuccin"; + repo = "hyprland"; + rev = "99a88fd21fac270bd999d4a26cf0f4a4222c58be"; + hash = "sha256-07B5QmQmsUKYf38oWU3+2C6KO4JvinuTwmW1Pfk8CT8="; + } + "/themes/frappe.conf"); }; programs = { @@ -35,7 +32,7 @@ settings = { global = { frame_color = "#8CAAEE"; - separator_color = "frame"; + separator_color= "frame"; }; urgency_low = { diff --git a/modules/shared/home/general/all-gui.nix b/modules/shared/home/general/all-gui.nix index fe6406c..0a5f3f1 100644 --- a/modules/shared/home/general/all-gui.nix +++ b/modules/shared/home/general/all-gui.nix @@ -1,5 +1,4 @@ -{ pkgs, ... }: -{ +{ pkgs, ... }: { home.packages = with pkgs; [ esptool ]; diff --git a/modules/shared/home/general/default.nix b/modules/shared/home/general/default.nix index dd045ca..a33fc2d 100644 --- a/modules/shared/home/general/default.nix +++ b/modules/shared/home/general/default.nix @@ -1,29 +1,17 @@ -{ - config, - inputs, - pkgs, - ... -}: -let - sqlite_lib = - if - builtins.elem pkgs.stdenv.hostPlatform.system [ - "aarch64-darwin" - "x86_64-darwin" - ] - then - "libsqlite3.dylib" - else - "libsqlite3.so"; -in -{ +{ config, inputs, pkgs, ... }: let + sqlite_lib = if builtins.elem pkgs.stdenv.hostPlatform.system [ + "aarch64-darwin" + "x86_64-darwin" + ] + then "libsqlite3.dylib" + else "libsqlite3.so"; +in { home.packages = with pkgs; [ btop bundix cargo cheat colordiff - deadnix dogdns dos2unix duf @@ -51,7 +39,6 @@ in nodejs nurl nvd - nixfmt onefetch powershell pre-commit @@ -59,7 +46,6 @@ in rename ruby subversion - statix tldr tree trippy @@ -125,7 +111,7 @@ in "*.swp" ".DS_Store" ]; - includes = [ { path = "~/.gitconfig-local"; } ]; + includes = [ { path = "~/.gitconfig-local"; }]; lfs.enable = true; package = pkgs.gitFull; settings = { @@ -173,7 +159,7 @@ in ''; extraPackages = with pkgs; [ - gcc # needed so treesitter can do compiling + gcc # needed so treesitter can do compiling sqlite # needed by sqlite.lua used by telescope-cheat ]; plugins = [ pkgs.vimPlugins.lazy-nvim ]; # let lazy.nvim manage every other plugin @@ -185,11 +171,7 @@ in oh-my-posh = { enable = true; enableZshIntegration = true; - settings = builtins.fromJSON ( - builtins.unsafeDiscardStringContext ( - builtins.readFile (inputs.genebean-omp-themes + "/beanbag.omp.json") - ) - ); + settings = builtins.fromJSON (builtins.unsafeDiscardStringContext (builtins.readFile (inputs.genebean-omp-themes + "/beanbag.omp.json"))); #useTheme = "amro"; #useTheme = "montys"; }; @@ -207,7 +189,7 @@ in set -g @dracula-show-battery false set -g @dracula-show-powerline true set -g @dracula-refresh-rate 10 - ''; + ''; } ]; extraConfig = '' @@ -378,9 +360,7 @@ in source = ../../files/nvim/lua/plugins; recursive = true; }; - ".config/powershell/Microsoft.PowerShell_profile.ps1".source = - ../../files/Microsoft.PowerShell_profile.ps1; - ".config/powershell/Microsoft.VSCode_profile.ps1".source = - ../../files/Microsoft.PowerShell_profile.ps1; + ".config/powershell/Microsoft.PowerShell_profile.ps1".source = ../../files/Microsoft.PowerShell_profile.ps1; + ".config/powershell/Microsoft.VSCode_profile.ps1".source = ../../files/Microsoft.PowerShell_profile.ps1; }; } diff --git a/modules/shared/home/linux/apps/hexchat.nix b/modules/shared/home/linux/apps/hexchat.nix index 11267f8..6addb18 100644 --- a/modules/shared/home/linux/apps/hexchat.nix +++ b/modules/shared/home/linux/apps/hexchat.nix @@ -1,3 +1,3 @@ -_: { +{ ... }: { programs.hexchat.enable = true; } diff --git a/modules/shared/home/linux/apps/pidgin.nix b/modules/shared/home/linux/apps/pidgin.nix index 5101306..e6d6840 100644 --- a/modules/shared/home/linux/apps/pidgin.nix +++ b/modules/shared/home/linux/apps/pidgin.nix @@ -1,3 +1,3 @@ -_: { +{ ... }: { programs.pidgin.enable = true; } diff --git a/modules/shared/home/linux/apps/tilix.nix b/modules/shared/home/linux/apps/tilix.nix index a70af5f..b8fa94a 100644 --- a/modules/shared/home/linux/apps/tilix.nix +++ b/modules/shared/home/linux/apps/tilix.nix @@ -1,6 +1,4 @@ -{ lib, pkgs, ... }: -with lib.hm.gvariant; -{ +{ lib, pkgs, ... }: with lib.hm.gvariant; { dconf.settings = { "com/gexperts/Tilix/profiles/2b7c4080-0ddd-46c5-8f23-563fd3ba789d" = { @@ -12,24 +10,7 @@ with lib.hm.gvariant; font = "Hack Nerd Font Mono 12"; foreground-color = "#F8F8F2"; highlight-colors-set = false; - palette = [ - "#272822" - "#F92672" - "#A6E22E" - "#F4BF75" - "#66D9EF" - "#AE81FF" - "#A1EFE4" - "#F8F8F2" - "#75715E" - "#F92672" - "#A6E22E" - "#F4BF75" - "#66D9EF" - "#AE81FF" - "#A1EFE4" - "#F9F8F5" - ]; + palette = [ "#272822" "#F92672" "#A6E22E" "#F4BF75" "#66D9EF" "#AE81FF" "#A1EFE4" "#F8F8F2" "#75715E" "#F92672" "#A6E22E" "#F4BF75" "#66D9EF" "#AE81FF" "#A1EFE4" "#F9F8F5" ]; use-system-font = false; use-theme-colors = false; visible-name = "Default"; @@ -39,13 +20,11 @@ with lib.hm.gvariant; home.file = { ".config/tilix/schemes/Beanbag-Mathias.json".source = ../../../files/tilix/Beanbag-Mathias.json; - ".config/tilix/schemes/Catppuccin-Frappe.json".source = - pkgs.fetchFromGitHub { - owner = "catppuccin"; - repo = "tilix"; - rev = "3fd05e03419321f2f2a6aad6da733b28be1765ef"; - hash = "sha256-SI7QxQ+WBHzeuXbTye+s8pi4tDVZOV4Aa33mRYO276k="; - } - + "/src/Catppuccin-Frappe.json"; + ".config/tilix/schemes/Catppuccin-Frappe.json".source = (pkgs.fetchFromGitHub { + owner = "catppuccin"; + repo = "tilix"; + rev = "3fd05e03419321f2f2a6aad6da733b28be1765ef"; + hash = "sha256-SI7QxQ+WBHzeuXbTye+s8pi4tDVZOV4Aa33mRYO276k="; + } + "/src/Catppuccin-Frappe.json"); }; -} +} \ No newline at end of file diff --git a/modules/shared/home/linux/apps/waybar.nix b/modules/shared/home/linux/apps/waybar.nix index 806ee21..b48c3be 100644 --- a/modules/shared/home/linux/apps/waybar.nix +++ b/modules/shared/home/linux/apps/waybar.nix @@ -1,20 +1,17 @@ -{ pkgs, ... }: -{ +{ pkgs, ... }: { home.file = { ".config/waybar/config".source = ../../../files/waybar/config; - ".config/waybar/frappe.css".source = - pkgs.fetchFromGitHub { - owner = "catppuccin"; - repo = "waybar"; - rev = "f74ab1eecf2dcaf22569b396eed53b2b2fbe8aff"; - hash = "sha256-WLJMA2X20E5PCPg0ZPtSop0bfmu+pLImP9t8A8V4QK8="; - } - + "/themes/frappe.css"; + ".config/waybar/frappe.css".source = (pkgs.fetchFromGitHub { + owner = "catppuccin"; + repo = "waybar"; + rev = "f74ab1eecf2dcaf22569b396eed53b2b2fbe8aff"; + hash = "sha256-WLJMA2X20E5PCPg0ZPtSop0bfmu+pLImP9t8A8V4QK8="; + } + "/themes/frappe.css"); ".config/waybar/style.css".source = ../../../files/waybar/style.css; }; - programs = { + programs = { # Using file in ../../files/waybar/ to configure waybar waybar.enable = true; }; -} +} \ No newline at end of file diff --git a/modules/shared/home/linux/apps/xfce4-terminal.nix b/modules/shared/home/linux/apps/xfce4-terminal.nix index 83857b1..d3e67fc 100644 --- a/modules/shared/home/linux/apps/xfce4-terminal.nix +++ b/modules/shared/home/linux/apps/xfce4-terminal.nix @@ -1,4 +1,4 @@ -_: { +{ ... }: { home.file = { ".config/xfce4/terminal/accels.scm".source = ../../../files/xfce4/terminal/accels.scm; }; @@ -11,8 +11,7 @@ _: { "color-background" = "#08052b"; "color-cursor" = "#ff7f7f"; "color-cursor-use-default" = false; - "color-palette" = - "#000000;#e52222;#a6e32d;#fc951e;#c48dff;#fa2573;#67d9f0;#f2f2f2;#555555;#ff5555;#55ff55;#ffff55;#5555ff;#ff55ff;#55ffff;#ffffff"; + "color-palette" = "#000000;#e52222;#a6e32d;#fc951e;#c48dff;#fa2573;#67d9f0;#f2f2f2;#555555;#ff5555;#55ff55;#ffff55;#5555ff;#ff55ff;#55ffff;#ffffff"; "font-name" = "Hack Nerd Font Mono 12"; "misc-always-show-tabs" = false; "misc-bell" = false; @@ -44,4 +43,4 @@ _: { "title-initial" = "xfce4-terminal"; }; }; -} +} \ No newline at end of file diff --git a/modules/shared/home/linux/default.nix b/modules/shared/home/linux/default.nix index 2cc695b..04428b9 100644 --- a/modules/shared/home/linux/default.nix +++ b/modules/shared/home/linux/default.nix @@ -1,5 +1,4 @@ -{ pkgs, ... }: -{ +{ pkgs, ... }: { home.packages = with pkgs; [ fastfetch ]; diff --git a/modules/shared/nixos/flatpaks.nix b/modules/shared/nixos/flatpaks.nix index acbfe9f..f29a1ff 100644 --- a/modules/shared/nixos/flatpaks.nix +++ b/modules/shared/nixos/flatpaks.nix @@ -1,4 +1,5 @@ -_: { + +{ ... }: { services = { flatpak = { enable = true; diff --git a/modules/shared/nixos/internationalisation.nix b/modules/shared/nixos/internationalisation.nix index 1d06191..5d71c99 100644 --- a/modules/shared/nixos/internationalisation.nix +++ b/modules/shared/nixos/internationalisation.nix @@ -1,4 +1,4 @@ -_: { +{ ... }: { # Select internationalisation properties. i18n = { defaultLocale = "en_US.UTF-8"; @@ -14,4 +14,4 @@ _: { LC_TIME = "en_US.UTF-8"; }; }; -} +} \ No newline at end of file diff --git a/modules/shared/nixos/lets-encrypt.nix b/modules/shared/nixos/lets-encrypt.nix index 6ab50df..e885306 100644 --- a/modules/shared/nixos/lets-encrypt.nix +++ b/modules/shared/nixos/lets-encrypt.nix @@ -1,5 +1,4 @@ -{ config, username, ... }: -{ +{ config, username, ... }: { ########################################################################## # # @@ -11,9 +10,7 @@ acceptTerms = true; defaults = { email = "lets-encrypt@technicalissues.us"; - credentialFiles = { - "GANDIV5_PERSONAL_ACCESS_TOKEN_FILE" = "${config.sops.secrets.gandi_dns_pat.path}"; - }; + credentialFiles = { "GANDIV5_PERSONAL_ACCESS_TOKEN_FILE" = "${config.sops.secrets.gandi_dns_pat.path}"; }; dnsProvider = "gandiv5"; dnsResolver = "ns1.gandi.net"; # uncomment below for testing diff --git a/modules/shared/nixos/nixroutes.nix b/modules/shared/nixos/nixroutes.nix index 43d0a42..0b50bdf 100644 --- a/modules/shared/nixos/nixroutes.nix +++ b/modules/shared/nixos/nixroutes.nix @@ -1,7 +1,7 @@ { config, lib, ... }: let - inherit (config.networking) hostName; -in -{ - programs.zsh.shellAliases.nixroutes = "cd ~/repos/dots && echo '=== Current Routes ===' && ip route show && ip -6 route show && echo '' && echo '=== New Build Routes ===' && nix eval --json '.#nixosConfigurations.${hostName}.config.systemd.network.networks.\"10-wan\".routes'"; + hostName = config.networking.hostName; +in { + programs.zsh.shellAliases.nixroutes = + "cd ~/repos/dots && echo '=== Current Routes ===' && ip route show && ip -6 route show && echo '' && echo '=== New Build Routes ===' && nix eval --json '.#nixosConfigurations.${hostName}.config.systemd.network.networks.\"10-wan\".routes'"; } diff --git a/modules/shared/nixos/restic.nix b/modules/shared/nixos/restic.nix index 4c0a04b..91cc256 100644 --- a/modules/shared/nixos/restic.nix +++ b/modules/shared/nixos/restic.nix @@ -1,5 +1,4 @@ -{ config, pkgs, ... }: -{ +{ config, pkgs, ... }: { environment.systemPackages = with pkgs; [ restic ]; @@ -30,3 +29,4 @@ }; }; } + diff --git a/modules/shared/nixos/ripping.nix b/modules/shared/nixos/ripping.nix index 9f6b33f..680db32 100644 --- a/modules/shared/nixos/ripping.nix +++ b/modules/shared/nixos/ripping.nix @@ -1,5 +1,4 @@ -{ pkgs, ... }: -{ +{ pkgs, ... }: { # Be sure this is added if on NixOS # boot.kernelModules = [ "sg" ]; @@ -21,3 +20,4 @@ mkvtoolnix-cli ]; } +