From 6fbe58a32730d852f222e13b74d3aa1349c99350 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Sun, 10 Sep 2023 09:16:51 +0000 Subject: [PATCH] make it eval --- examples/default.nix | 32 ++++++++++++++++++++++++++++++++ flake.nix | 14 ++++++++++++-- 2 files changed, 44 insertions(+), 2 deletions(-) create mode 100644 examples/default.nix diff --git a/examples/default.nix b/examples/default.nix new file mode 100644 index 0000000..c647c55 --- /dev/null +++ b/examples/default.nix @@ -0,0 +1,32 @@ +{ nixpkgs, system, buildbot-nix, ... }: +let + # some example configuration to make it eval + dummy = { config, ... }: { + networking.hostName = "example-common"; + system.stateVersion = config.system.nixos.version; + users.users.root.initialPassword = "fnord23"; + boot.loader.grub.devices = lib.mkForce [ "/dev/sda" ]; + fileSystems."/".device = lib.mkDefault "/dev/sda"; + }; + + inherit (nixpkgs) lib; + inherit (lib) nixosSystem; + +in +{ + # General + example-master = nixosSystem { + inherit system; + modules = [ + dummy + buildbot-nix.nixosModules.buildbot-master + ]; + }; + example-worker = nixosSystem { + inherit system; + modules = [ + dummy + buildbot-nix.nixosModules.buildbot-worker + ]; + }; +} diff --git a/flake.nix b/flake.nix index 229ba64..41cc14b 100644 --- a/flake.nix +++ b/flake.nix @@ -7,14 +7,24 @@ flake-parts.url = "github:hercules-ci/flake-parts"; }; - outputs = inputs@{ flake-parts, ... }: + outputs = inputs@{ self, flake-parts, ... }: flake-parts.lib.mkFlake { inherit inputs; } ({ lib, ... }: { systems = lib.systems.flakeExposed; flake = { nixosModules.buildbot-master = ./nix/master.nix; nixosModules.buildbot-worker = ./nix/worker.nix; + + nixosConfigurations = import ./examples { + inherit (inputs) nixpkgs; + buildbot-nix = self; + system = "x86_64-linux"; + }; + checks.x86_64-linux = { + nixos-master = self.nixosConfigurations.example-master.config.system.build.toplevel; + nixos-worker = self.nixosConfigurations.example-worker.config.system.build.toplevel; + }; }; - perSystem = { pkgs, ... }: { + perSystem = { pkgs, system, ... }: { packages.default = pkgs.mkShell { packages = [ pkgs.bashInteractive