diff --git a/build01/configuration.nix b/build01/configuration.nix index 04f64fe..aa74cbd 100644 --- a/build01/configuration.nix +++ b/build01/configuration.nix @@ -1,4 +1,4 @@ -{ inputs, ... }: +{ ... }: # Boot recovery: # Activate 64-bit Rescue system in https://robot.your-server.de/server # ssh root@build01.nix-community.org "mount /dev/md[0-9]* /mnt && /mnt/kexec_bundle" @@ -11,7 +11,6 @@ # nixos-enter { imports = [ - inputs.srvos.nixosModules.hardware-hetzner-online-amd ../roles/common.nix ../roles/raid.nix ../roles/zfs.nix diff --git a/build01/default.nix b/build01/default.nix deleted file mode 100644 index 9720188..0000000 --- a/build01/default.nix +++ /dev/null @@ -1,7 +0,0 @@ -{ self, ... }: -{ - flake.nixosConfigurations.build01 = self.lib.nixosSystem { - system = "x86_64-linux"; - modules = [ ./configuration.nix ]; - }; -} diff --git a/build02/configuration.nix b/build02/configuration.nix index a9a88c3..77bac47 100644 --- a/build02/configuration.nix +++ b/build02/configuration.nix @@ -1,9 +1,7 @@ -{ inputs, ... }: +{ ... }: { imports = [ - inputs.srvos.nixosModules.mixins-nginx - inputs.srvos.nixosModules.hardware-hetzner-online-amd ./nixpkgs-update.nix ./nixpkgs-update-backup.nix ../roles/common.nix diff --git a/build02/default.nix b/build02/default.nix deleted file mode 100644 index 075ec66..0000000 --- a/build02/default.nix +++ /dev/null @@ -1,8 +0,0 @@ -{ self, ... }: -{ - flake.nixosConfigurations.build02 = self.lib.nixosSystem { - system = "x86_64-linux"; - modules = [ ./configuration.nix ]; - }; -} - diff --git a/build03/configuration.nix b/build03/configuration.nix index f805418..5a3df75 100644 --- a/build03/configuration.nix +++ b/build03/configuration.nix @@ -1,4 +1,4 @@ -{ inputs, ... }: +{ ... }: { # Boot recovery: # Activate 64-bit Rescue system in https://robot.your-server.de/server @@ -10,8 +10,6 @@ # $ zpool import -f zroot && mount -t zfs zroot/root/nixos /mnt && mount -t zfs zroot/root/home /mnt/home && mount /dev/md[0-9]* /mnt/boot # $ nixos-enter imports = [ - inputs.srvos.nixosModules.mixins-nginx - inputs.srvos.nixosModules.hardware-hetzner-online-amd ../roles/common.nix ../roles/hercules-ci ../roles/watch-store.nix diff --git a/build03/default.nix b/build03/default.nix deleted file mode 100644 index 2e6047c..0000000 --- a/build03/default.nix +++ /dev/null @@ -1,7 +0,0 @@ -{ self, ... }: -{ - flake.nixosConfiguration.build03 = self.lib.nixosSystem { - system = "x86_64-linux"; - modules = [ ./configuration.nix ]; - }; -} diff --git a/build04/configuration.nix b/build04/configuration.nix index 35e6663..6c77710 100644 --- a/build04/configuration.nix +++ b/build04/configuration.nix @@ -1,7 +1,5 @@ -{ inputs, ... }: { imports = [ - inputs.disko.nixosModules.disko ./hardware-configuration.nix ../roles/common.nix ../roles/hercules-ci diff --git a/build04/default.nix b/build04/default.nix deleted file mode 100644 index 3b88fc5..0000000 --- a/build04/default.nix +++ /dev/null @@ -1,7 +0,0 @@ -{ self, ... }: -{ - flake.nixosConfigurations.build04 = self.lib.nixosSystem { - system = "aarch64-linux"; - modules = [ ./configuration.nix ]; - }; -} diff --git a/flake.nix b/flake.nix index 2993a57..fb325ed 100644 --- a/flake.nix +++ b/flake.nix @@ -42,64 +42,107 @@ }; outputs = inputs @ { flake-parts, self, ... }: - flake-parts.lib.mkFlake { inherit inputs; } { - systems = [ - "aarch64-darwin" - "aarch64-linux" - "x86_64-darwin" - "x86_64-linux" - ]; + flake-parts.lib.mkFlake + { inherit inputs; } + { + systems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ]; - herculesCI = { lib, ... }: { - ciSystems = [ "x86_64-linux" "aarch64-linux" ]; + herculesCI = { lib, ... }: { + ciSystems = [ "x86_64-linux" "aarch64-linux" ]; - onPush.default.outputs = { - checks = lib.mkForce self.outputs.checks.x86_64-linux; + onPush.default.outputs = { + checks = lib.mkForce self.outputs.checks.x86_64-linux; + }; }; - }; - hercules-ci.flake-update = { - enable = true; - createPullRequest = true; - autoMergeMethod = "rebase"; - when = { - hour = [ 2 ]; - dayOfWeek = [ "Mon" "Thu" ]; + hercules-ci.flake-update = { + enable = true; + createPullRequest = true; + autoMergeMethod = "rebase"; + when = { + hour = [ 2 ]; + dayOfWeek = [ "Mon" "Thu" ]; + }; }; - }; - hercules-ci.github-pages.branch = "master"; + imports = [ + inputs.hercules-ci-effects.flakeModule + inputs.treefmt-nix.flakeModule + ./effect.nix + ./shell.nix + ]; - imports = [ - inputs.hercules-ci-effects.flakeModule - inputs.treefmt-nix.flakeModule - ./effect.nix - ./shell.nix - ./build01 - ./build02 - ./build03 - ./build04 - ]; + hercules-ci.github-pages.branch = "master"; - perSystem = { config, pkgs, ... }: { - treefmt.imports = [ ./treefmt.nix ]; + perSystem = { config, pkgs, ... }: { + treefmt.imports = [ ./treefmt.nix ]; - packages.pages = pkgs.runCommand "pages" + packages.pages = pkgs.runCommand "pages" + { + buildInputs = [ pkgs.python3.pkgs.mkdocs-material ]; + } '' + cp -r ${pkgs.lib.cleanSource ./.}/* . + mkdocs build --strict --site-dir $out + ''; + + hercules-ci.github-pages.settings.contents = config.packages.pages; + }; + + flake.nixosConfigurations = + let + inherit (inputs.nixpkgs.lib) nixosSystem; + common = [ + { _module.args.inputs = inputs; } + { srvos.flake = inputs.self; } + inputs.sops-nix.nixosModules.sops + inputs.srvos.nixosModules.server + + inputs.srvos.nixosModules.mixins-telegraf + { networking.firewall.allowedTCPPorts = [ 9273 ]; } + ]; + in { - buildInputs = [ pkgs.python3.pkgs.mkdocs-material ]; - } '' - cp -r ${pkgs.lib.cleanSource ./.}/* . - mkdocs build --strict --site-dir $out - ''; + build01 = nixosSystem { + system = "x86_64-linux"; + modules = + common + ++ [ + ./build01/configuration.nix + inputs.srvos.nixosModules.hardware-hetzner-online-amd + ]; + }; - hercules-ci.github-pages.settings.contents = config.packages.pages; + build02 = nixosSystem { + system = "x86_64-linux"; + modules = + common + ++ [ + ./build02/configuration.nix + inputs.srvos.nixosModules.mixins-nginx + inputs.srvos.nixosModules.hardware-hetzner-online-amd + ]; + }; + + build03 = nixosSystem { + system = "x86_64-linux"; + modules = + common + ++ [ + ./build03/configuration.nix + inputs.srvos.nixosModules.mixins-nginx + inputs.srvos.nixosModules.hardware-hetzner-online-amd + ]; + }; + + build04 = nixosSystem { + system = "aarch64-linux"; + modules = + common + ++ [ + ./build04/configuration.nix + inputs.disko.nixosModules.disko + ]; + }; + }; }; - - flake.lib.nixosSystem = args: - inputs.nixpkgs.lib.nixosSystem ({ specialArgs = { inherit inputs; }; } // args); - - flake.nixosModules = { - common = ./roles/common.nix; - }; - }; } diff --git a/roles/common.nix b/roles/common.nix index 4816bb4..4ff6344 100644 --- a/roles/common.nix +++ b/roles/common.nix @@ -1,4 +1,4 @@ -{ inputs, pkgs, ... }: +{ pkgs, ... }: { imports = [ ./auto-upgrade.nix @@ -6,15 +6,8 @@ ./security.nix ./sops-nix.nix ./users.nix - inputs.sops-nix.nixosModules.sops - inputs.srvos.nixosModules.mixins-telegraf - inputs.srvos.nixosModules.server ]; - networking.firewall.allowedTCPPorts = [ 9273 ]; - - srvos.flake = inputs.self; - zramSwap.enable = true; # https://github.com/hercules-ci/hercules-ci-agent/issues/514