Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

declarative projects: support fully static, declarative configuration #804

Merged
merged 1 commit into from Sep 2, 2020

Conversation

grahamc
Copy link
Member

@grahamc grahamc commented Sep 2, 2020

Skip the dependency on nixpkgs and a whole build when you just want to statically define some jobsets with JSON.

@edolstra edolstra merged commit e707990 into NixOS:master Sep 2, 2020
@grahamc grahamc deleted the fully-static-jobsets branch September 2, 2020 20:37
@ajs124
Copy link
Member

ajs124 commented Sep 3, 2020

Because of this to this PR #717, which has been open for 6 months without so much as a comment, now has a merge conflict.

@dasJ
Copy link
Member

dasJ commented Sep 3, 2020

Also, why would there be a dependency on nixpkgs just from using Nix? We're running our Hydra with declarative Jobsets for months (years?) now and we never had a nixpkgs depdency in our .jobsets.
Instead, using nix makes everything a lot easier because we can generate similar jobsets from the same data (like you could for nixpkgs/nixos releases).

@dasJ
Copy link
Member

dasJ commented Sep 3, 2020

Untested:

{ ... }: let
  defaultJobset = {
    enabled = 1;
    hidden = false;
    nixexprinput = "nixpkgs";
    nixexprpath = "nixos/release-combined.nix";
    checkinterval = 43200;
    schedulingshares = 1500000;
    enableemail = false;
    emailoverride = "";
    keepnr = 1;
  };

  mkNixpkgs = release: {
    description = "NixOS ${release} release branch";
    inputs = {
      nixpkgs = {
        type = "git";
        value = "https://github.com/NixOS/nixpkgs.git release-${release}";
        emailresponsible = false;
      };
      stableBranch = {
        type = "boolean";
        value = 1;
        emailresponsible = false;
      };
      supportedSystems = {
        type = "nix";
        value = "[ \"x86_64-linux\" ]";
        emailresponsible = false;
      };
    };
  };

  jobsets = {
    "release-19.03" = mkNixpkgs "19.03";
    "release-19.09" = mkNixpkgs "19.09";
    "release-20.03" = mkNixpkgs "20.03";
  };

in {
  jobsets = derivation {
    name = "spec.json";
    system = builtins.currentSystem;

    builder = "/bin/sh";
    args = [ (builtins.toFile "spec-builder.sh" ''
      echo '
      ${builtins.toJSON (builtins.mapAttrs (k: v: defaultJobset // v) jobsets)}
      ' > $out
    '') ];
  };
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants