mirror of
https://github.com/JulienMalka/snowfield.git
synced 2025-03-25 21:30:52 +01:00
feat: better handling of nixos version depending on the machine
This commit is contained in:
parent
1117ecff61
commit
dce1df08e3
5 changed files with 172 additions and 8 deletions
17
flake.nix
17
flake.nix
|
@ -62,6 +62,13 @@
|
|||
|
||||
outputs = { self, nixpkgs, deploy-rs, ... }@inputs:
|
||||
let
|
||||
remotePatches = [
|
||||
{
|
||||
meta.description = "pkgs: fix buildbot";
|
||||
url = "https://github.com/NixOS/nixpkgs/pull/142273.diff";
|
||||
sha256 = "sha256-ZCDQ7SpGhH8JvAwWzdcyrc68RFEWHxxAj0M2+AvEzIg=";
|
||||
}
|
||||
];
|
||||
lib = nixpkgs.lib.extend (import ./lib inputs);
|
||||
machines_plats = lib.mapAttrsToList (name: value: value.arch) lib.luj.machines;
|
||||
|
||||
|
@ -80,7 +87,15 @@
|
|||
})
|
||||
(builtins.attrNames (builtins.readDir ./modules)));
|
||||
|
||||
nixosConfigurations = builtins.mapAttrs (name: value: (lib.mkMachine { host = name; host-config = value; modules = self.nixosModules; nixpkgs = inputs.nixos-apple-silicon.inputs.nixpkgs; system = lib.luj.machines.${name}.arch; })) (lib.importConfig ./machines);
|
||||
nixosConfigurations = builtins.mapAttrs
|
||||
(name: value: (lib.mkMachine {
|
||||
host = name;
|
||||
host-config = value;
|
||||
modules = self.nixosModules;
|
||||
nixpkgs = lib.luj.machines.${name}.nixpkgs_version;
|
||||
system = lib.luj.machines.${name}.arch;
|
||||
}))
|
||||
(lib.importConfig ./machines);
|
||||
|
||||
deploy.nodes.lambda = {
|
||||
hostname = "lambda.julienmalka.me";
|
||||
|
|
|
@ -90,7 +90,7 @@ in
|
|||
|
||||
|
||||
|
||||
luj = import ./luj.nix final;
|
||||
luj = import ./luj.nix inputs final;
|
||||
|
||||
}
|
||||
|
||||
|
|
12
lib/luj.nix
12
lib/luj.nix
|
@ -1,4 +1,4 @@
|
|||
lib: with lib; let
|
||||
inputs: lib: with lib; let
|
||||
modules = [
|
||||
{
|
||||
options.machines = mkOption {
|
||||
|
@ -26,23 +26,23 @@ lib: with lib; let
|
|||
machines = {
|
||||
lisa = {
|
||||
arch = "x86_64-linux";
|
||||
nixpkgs_version = "nixpkgs";
|
||||
nixpkgs_version = inputs.nixpkgs;
|
||||
};
|
||||
newton = {
|
||||
arch = "x86_64-linux";
|
||||
nixpkgs_version = "nixpkgs";
|
||||
nixpkgs_version = inputs.nixpkgs;
|
||||
};
|
||||
macintosh = {
|
||||
arch = "aarch64-linux";
|
||||
nixpkgs_version = "nixos-apple-silicon.inputs";
|
||||
nixpkgs_version = inputs.nixos-apple-silicon.inputs.nixpkgs;
|
||||
};
|
||||
lambda = {
|
||||
arch = "aarch64-linux";
|
||||
nixpkgs_version = "nixpkgs";
|
||||
nixpkgs_version = inputs.nixpkgs;
|
||||
};
|
||||
tower = {
|
||||
arch = "x86_64-linux";
|
||||
nixpkgs_version = "nixpkgs";
|
||||
nixpkgs_version = inputs.nixpkgs;
|
||||
};
|
||||
|
||||
};
|
||||
|
|
138
packages/buildbot/default.nix
Normal file
138
packages/buildbot/default.nix
Normal file
|
@ -0,0 +1,138 @@
|
|||
{ lib
|
||||
, stdenv
|
||||
, makeWrapper
|
||||
, python3
|
||||
, git
|
||||
, openssh
|
||||
, glibcLocales
|
||||
, nixosTests
|
||||
}:
|
||||
|
||||
let
|
||||
python = python3.override {
|
||||
packageOverrides = (self: super: {
|
||||
sqlalchemy = super.sqlalchemy.overridePythonAttrs (old: rec {
|
||||
version = "1.4.47";
|
||||
src = self.fetchPypi {
|
||||
pname = "SQLAlchemy";
|
||||
inherit version;
|
||||
hash = "sha256-lfwC9/wfMZmqpHqKdXQ3E0z2GOnZlMhO/9U/Uww4WG8=";
|
||||
};
|
||||
});
|
||||
});
|
||||
};
|
||||
withPlugins = plugins: python.pkgs.buildPythonPackage {
|
||||
pname = "${package.pname}-with-plugins";
|
||||
inherit (package) version;
|
||||
format = "other";
|
||||
|
||||
dontUnpack = true;
|
||||
dontBuild = true;
|
||||
doCheck = false;
|
||||
|
||||
nativeBuildInputs = [
|
||||
makeWrapper
|
||||
];
|
||||
|
||||
propagatedBuildInputs = plugins ++ package.propagatedBuildInputs;
|
||||
|
||||
installPhase = ''
|
||||
makeWrapper ${package}/bin/buildbot $out/bin/buildbot \
|
||||
--prefix PYTHONPATH : "${package}/${python.sitePackages}:$PYTHONPATH"
|
||||
ln -sfv ${package}/lib $out/lib
|
||||
'';
|
||||
|
||||
passthru = package.passthru // {
|
||||
withPlugins = morePlugins: withPlugins (morePlugins ++ plugins);
|
||||
};
|
||||
};
|
||||
|
||||
package = python.pkgs.buildPythonPackage rec {
|
||||
pname = "buildbot";
|
||||
version = "3.7.0";
|
||||
format = "setuptools";
|
||||
|
||||
|
||||
src = python.pkgs.fetchPypi {
|
||||
inherit pname version;
|
||||
hash = "sha256-YMLT1SP6NenJIUVTvr58GVrtNXHw+bhfgMpZu3revG4=";
|
||||
};
|
||||
|
||||
propagatedBuildInputs = with python.pkgs; [
|
||||
# core
|
||||
twisted
|
||||
jinja2
|
||||
msgpack
|
||||
zope_interface
|
||||
sqlalchemy
|
||||
alembic
|
||||
python-dateutil
|
||||
txaio
|
||||
autobahn
|
||||
pyjwt
|
||||
pyyaml
|
||||
]
|
||||
# tls
|
||||
++ twisted.optional-dependencies.tls;
|
||||
|
||||
nativeCheckInputs = with python.pkgs; [
|
||||
treq
|
||||
txrequests
|
||||
pypugjs
|
||||
boto3
|
||||
moto
|
||||
mock
|
||||
lz4
|
||||
setuptoolsTrial
|
||||
buildbot-worker
|
||||
buildbot-pkg
|
||||
buildbot-plugins.www
|
||||
parameterized
|
||||
git
|
||||
openssh
|
||||
glibcLocales
|
||||
];
|
||||
|
||||
patches = [
|
||||
# This patch disables the test that tries to read /etc/os-release which
|
||||
# is not accessible in sandboxed builds.
|
||||
./skip_test_linux_distro.patch
|
||||
];
|
||||
|
||||
postPatch = ''
|
||||
substituteInPlace buildbot/scripts/logwatcher.py --replace '/usr/bin/tail' "$(type -P tail)"
|
||||
'';
|
||||
|
||||
# Silence the depreciation warning from SqlAlchemy
|
||||
SQLALCHEMY_SILENCE_UBER_WARNING = 1;
|
||||
|
||||
# TimeoutErrors on slow machines -> aarch64
|
||||
doCheck = !stdenv.isAarch64;
|
||||
|
||||
preCheck = ''
|
||||
export LC_ALL="en_US.UTF-8"
|
||||
export PATH="$out/bin:$PATH"
|
||||
|
||||
# remove testfile which is missing configuration file from sdist
|
||||
rm buildbot/test/integration/test_graphql.py
|
||||
# tests in this file are flaky, see https://github.com/buildbot/buildbot/issues/6776
|
||||
rm buildbot/test/integration/test_try_client.py
|
||||
'';
|
||||
|
||||
passthru = {
|
||||
inherit withPlugins;
|
||||
tests.buildbot = nixosTests.buildbot;
|
||||
updateScript = ./update.sh;
|
||||
};
|
||||
|
||||
meta = with lib; {
|
||||
description = "An open-source continuous integration framework for automating software build, test, and release processes";
|
||||
homepage = "https://buildbot.net/";
|
||||
changelog = "https://github.com/buildbot/buildbot/releases/tag/v${version}";
|
||||
maintainers = with maintainers; [ ryansydnor lopsided98 ];
|
||||
license = licenses.gpl2Only;
|
||||
broken = stdenv.isDarwin;
|
||||
};
|
||||
};
|
||||
in
|
||||
package
|
11
packages/buildbot/skip_test_linux_distro.patch
Normal file
11
packages/buildbot/skip_test_linux_distro.patch
Normal file
|
@ -0,0 +1,11 @@
|
|||
diff -Nur buildbot-0.9.6/buildbot/test/unit/test_buildbot_net_usage_data.py buildbot-0.9.6.patched/buildbot/test/unit/test_buildbot_net_usage_data.py
|
||||
--- buildbot-0.9.6/buildbot/test/unit/test_buildbot_net_usage_data.py 2017-04-19 16:57:02.000000000 +0200
|
||||
+++ buildbot-0.9.6.patched/buildbot/test/unit/test_buildbot_net_usage_data.py 2017-05-04 12:22:54.575762551 +0200
|
||||
@@ -147,6 +147,7 @@
|
||||
_sendBuildbotNetUsageData({'foo': 'bar'})
|
||||
|
||||
def test_linux_distro(self):
|
||||
+ raise SkipTest("NixOS sandboxed builds hides /etc/os-release")
|
||||
system = platform.system()
|
||||
if system != "Linux":
|
||||
raise SkipTest("test is only for linux")
|
Loading…
Add table
Reference in a new issue