mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-01-10 15:04:44 +00:00
multipass: 1.14.0 -> 1.15.0 (#363626)
This commit is contained in:
commit
e659d918cd
79
pkgs/by-name/mu/multipass/gui.nix
Normal file
79
pkgs/by-name/mu/multipass/gui.nix
Normal file
@ -0,0 +1,79 @@
|
||||
{
|
||||
commonMeta,
|
||||
multipass_src,
|
||||
multipassd,
|
||||
version,
|
||||
|
||||
autoPatchelfHook,
|
||||
flutter327,
|
||||
gtkmm3,
|
||||
keybinder3,
|
||||
lib,
|
||||
libayatana-appindicator,
|
||||
libnotify,
|
||||
protobuf,
|
||||
protoc-gen-dart,
|
||||
qt6,
|
||||
}:
|
||||
flutter327.buildFlutterApplication {
|
||||
inherit version;
|
||||
pname = "multipass-gui";
|
||||
src = multipass_src;
|
||||
|
||||
sourceRoot = "${multipass_src.name}/src/client/gui";
|
||||
|
||||
pubspecLock = lib.importJSON ./pubspec.lock.json;
|
||||
|
||||
gitHashes = {
|
||||
dartssh2 = "sha256-2pypKwurziwGLZYuGaxlS2lzN3UvJp3bRTvvYYxEqRI=";
|
||||
hotkey_manager_linux = "sha256-aO0h94YZvgV/ggVupNw8GjyZsnXrq3qTHRDtuhNv3oI=";
|
||||
system_info2 = "sha256-fly7E2vG+bQ/+QGzXk+DYba73RZccltdW2LpZGDKX60=";
|
||||
tray_menu = "sha256-riiAiBEms+9ARog8i+MR1fto1Yqx+gwbBWyNbNq6VTM=";
|
||||
window_size = "sha256-71PqQzf+qY23hTJvcm0Oye8tng3Asr42E2vfF1nBmVA=";
|
||||
xterm = "sha256-h8vIonTPUVnNqZPk/A4ZV7EYCMyM0rrErL9ZOMe4ZBE=";
|
||||
};
|
||||
|
||||
buildInputs = [
|
||||
gtkmm3
|
||||
keybinder3
|
||||
libayatana-appindicator
|
||||
libnotify
|
||||
qt6.qtbase
|
||||
qt6.qtwayland
|
||||
];
|
||||
|
||||
nativeBuildInputs = [
|
||||
autoPatchelfHook
|
||||
protobuf
|
||||
protoc-gen-dart
|
||||
qt6.wrapQtAppsHook
|
||||
];
|
||||
|
||||
preBuild = ''
|
||||
mkdir -p lib/generated
|
||||
|
||||
# Generate the Dart gRPC code for the Multipass GUI.
|
||||
protoc \
|
||||
--plugin=protoc-gen-dart=${lib.getExe protoc-gen-dart} \
|
||||
--dart_out=grpc:lib/generated \
|
||||
-I ../../rpc \
|
||||
../../rpc/multipass.proto \
|
||||
google/protobuf/timestamp.proto
|
||||
'';
|
||||
|
||||
runtimeDependencies = [ multipassd ];
|
||||
|
||||
postFixup = ''
|
||||
mv $out/bin/multipass_gui $out/bin/multipass.gui
|
||||
|
||||
install -Dm444 $out/app/multipass-gui/data/flutter_assets/assets/icon.png \
|
||||
$out/share/icons/hicolor/256x256/apps/multipass.gui.png
|
||||
|
||||
cp $out/share/applications/multipass.gui.autostart.desktop \
|
||||
$out/share/applications/multipass.gui.desktop
|
||||
'';
|
||||
|
||||
meta = commonMeta // {
|
||||
description = "Flutter frontend application for managing Ubuntu VMs";
|
||||
};
|
||||
}
|
@ -1,4 +1,8 @@
|
||||
{
|
||||
commonMeta,
|
||||
multipass_src,
|
||||
version,
|
||||
|
||||
cmake,
|
||||
dnsmasq,
|
||||
fetchFromGitHub,
|
||||
@ -10,53 +14,35 @@
|
||||
libapparmor,
|
||||
libvirt,
|
||||
libxml2,
|
||||
nixosTests,
|
||||
openssl,
|
||||
OVMF,
|
||||
pkg-config,
|
||||
qemu,
|
||||
poco,
|
||||
protobuf,
|
||||
qemu-utils,
|
||||
qtbase,
|
||||
qtwayland,
|
||||
wrapQtAppsHook,
|
||||
qemu,
|
||||
qt6,
|
||||
slang,
|
||||
stdenv,
|
||||
xterm,
|
||||
}:
|
||||
|
||||
let
|
||||
pname = "multipass";
|
||||
version = "1.14.1";
|
||||
|
||||
# This is done here because a CMakeLists.txt from one of it's submodules tries
|
||||
# to modify a file, so we grab the source for the submodule here, copy it into
|
||||
# the source of the Multipass project which allows the modification to happen.
|
||||
grpc_src = fetchFromGitHub {
|
||||
owner = "CanonicalLtd";
|
||||
owner = "canonical";
|
||||
repo = "grpc";
|
||||
rev = "e3acf245";
|
||||
hash = "sha256-tDc2iGxIV68Yi4RL8ES4yglJNlu8yH6FlpVvZoWjoXk=";
|
||||
rev = "ba8e7f72a57b9e0b25783a4d3cea58c79379f194";
|
||||
hash = "sha256-DS1UNLCUdbipn5w4p2aVa8LgHHhdJiAfzfEdIXNO69o=";
|
||||
fetchSubmodules = true;
|
||||
};
|
||||
in
|
||||
stdenv.mkDerivation {
|
||||
inherit pname version;
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "canonical";
|
||||
repo = "multipass";
|
||||
rev = "refs/tags/v${version}";
|
||||
hash = "sha256-i6SKiV4jwiBURx85m3u7km1dhi+fRdVpMBanlZo0VK4=";
|
||||
fetchSubmodules = true;
|
||||
leaveDotGit = true;
|
||||
postFetch = ''
|
||||
# Workaround for https://github.com/NixOS/nixpkgs/issues/8567
|
||||
cd $out
|
||||
rm -rf .git
|
||||
'';
|
||||
};
|
||||
inherit version;
|
||||
pname = "multipassd";
|
||||
src = multipass_src;
|
||||
|
||||
patches = [
|
||||
# Multipass is usually only delivered as a snap package on Linux, and it expects that
|
||||
@ -86,6 +72,9 @@ stdenv.mkDerivation {
|
||||
--replace-fail "determine_version(MULTIPASS_VERSION)" "" \
|
||||
--replace-fail 'set(MULTIPASS_VERSION ''${MULTIPASS_VERSION})' 'set(MULTIPASS_VERSION "v${version}")'
|
||||
|
||||
# Don't build the GUI .desktop file, do that in the gui derivation instead
|
||||
substituteInPlace ./CMakeLists.txt --replace-fail "add_subdirectory(data)" ""
|
||||
|
||||
# Don't build/use vcpkg
|
||||
rm -rf 3rd-party/vcpkg
|
||||
|
||||
@ -118,7 +107,7 @@ stdenv.mkDerivation {
|
||||
EOF
|
||||
'';
|
||||
|
||||
# We'll build the flutter application seperately using buildFlutterApplication
|
||||
# We'll build the flutter application separately using buildFlutterApplication
|
||||
cmakeFlags = [ "-DMULTIPASS_ENABLE_FLUTTER_GUI=false" ];
|
||||
|
||||
buildInputs = [
|
||||
@ -127,18 +116,18 @@ stdenv.mkDerivation {
|
||||
libvirt
|
||||
libxml2
|
||||
openssl
|
||||
qtbase
|
||||
qtwayland
|
||||
poco.dev
|
||||
protobuf
|
||||
qt6.qtbase
|
||||
qt6.qtwayland
|
||||
];
|
||||
|
||||
nativeBuildInputs = [
|
||||
cmake
|
||||
git
|
||||
pkg-config
|
||||
qt6.wrapQtAppsHook
|
||||
slang
|
||||
wrapQtAppsHook
|
||||
];
|
||||
|
||||
nativeCheckInputs = [ gtest ];
|
||||
@ -157,15 +146,7 @@ stdenv.mkDerivation {
|
||||
}
|
||||
'';
|
||||
|
||||
passthru.tests = {
|
||||
multipass = nixosTests.multipass;
|
||||
};
|
||||
|
||||
meta = with lib; {
|
||||
description = "Ubuntu VMs on demand for any workstation";
|
||||
homepage = "https://multipass.run";
|
||||
license = licenses.gpl3Plus;
|
||||
maintainers = with maintainers; [ jnsgruk ];
|
||||
platforms = [ "x86_64-linux" ];
|
||||
meta = commonMeta // {
|
||||
description = "Backend server & client for managing on-demand Ubuntu VMs";
|
||||
};
|
||||
}
|
61
pkgs/by-name/mu/multipass/package.nix
Normal file
61
pkgs/by-name/mu/multipass/package.nix
Normal file
@ -0,0 +1,61 @@
|
||||
{
|
||||
callPackage,
|
||||
fetchFromGitHub,
|
||||
lib,
|
||||
nixosTests,
|
||||
stdenv,
|
||||
symlinkJoin,
|
||||
}:
|
||||
|
||||
let
|
||||
name = "multipass";
|
||||
version = "1.15.0";
|
||||
|
||||
multipass_src = fetchFromGitHub {
|
||||
owner = "canonical";
|
||||
repo = "multipass";
|
||||
rev = "refs/tags/v${version}";
|
||||
hash = "sha256-RoOCh1winDs7BZwyduZziHj6EMe3sGMYonkA757UrIU=";
|
||||
fetchSubmodules = true;
|
||||
};
|
||||
|
||||
commonMeta = {
|
||||
homepage = "https://multipass.run";
|
||||
license = lib.licenses.gpl3Plus;
|
||||
maintainers = with lib.maintainers; [ jnsgruk ];
|
||||
platforms = [ "x86_64-linux" ];
|
||||
};
|
||||
|
||||
multipassd = callPackage ./multipassd.nix {
|
||||
inherit commonMeta multipass_src version;
|
||||
};
|
||||
|
||||
multipass-gui = callPackage ./gui.nix {
|
||||
inherit
|
||||
commonMeta
|
||||
multipass_src
|
||||
multipassd
|
||||
version
|
||||
;
|
||||
};
|
||||
in
|
||||
symlinkJoin {
|
||||
inherit version;
|
||||
pname = name;
|
||||
|
||||
paths = [
|
||||
multipassd
|
||||
multipass-gui
|
||||
];
|
||||
|
||||
passthru = {
|
||||
tests = lib.optionalAttrs stdenv.hostPlatform.isLinux {
|
||||
inherit (nixosTests) multipass;
|
||||
};
|
||||
updateScript = ./update.sh;
|
||||
};
|
||||
|
||||
meta = commonMeta // {
|
||||
description = "Ubuntu VMs on demand for any workstation";
|
||||
};
|
||||
}
|
1
pkgs/by-name/mu/multipass/pubspec.lock.json
Normal file
1
pkgs/by-name/mu/multipass/pubspec.lock.json
Normal file
File diff suppressed because one or more lines are too long
78
pkgs/by-name/mu/multipass/update.sh
Executable file
78
pkgs/by-name/mu/multipass/update.sh
Executable file
@ -0,0 +1,78 @@
|
||||
#!/usr/bin/env nix-shell
|
||||
#!nix-shell -I nixpkgs=./. -i bash -p curl jq nix-prefetch-github yj git
|
||||
# shellcheck shell=bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
cd $(readlink -e $(dirname "${BASH_SOURCE[0]}"))
|
||||
|
||||
# Download the latest pubspec.lock (which is a YAML file), convert it to JSON and write it to
|
||||
# the package directory as pubspec.lock.json
|
||||
update_pubspec_json() {
|
||||
local version; version="$1"
|
||||
echo "Updating pubspec.lock.json"
|
||||
|
||||
curl -s \
|
||||
"https://raw.githubusercontent.com/canonical/multipass/refs/tags/v${version}/src/client/gui/pubspec.lock" \
|
||||
| yj > pubspec.lock.json
|
||||
}
|
||||
|
||||
# Update the SRI hash of a particular overridden Dart package in the Nix expression
|
||||
update_dart_pkg_hash() {
|
||||
local pkg_name; pkg_name="$1"
|
||||
local owner; owner="$2";
|
||||
local repo; repo="$3";
|
||||
echo "Updating dart package hash: $pkg_name"
|
||||
|
||||
resolved_ref="$(jq -r --arg PKG "$pkg_name" '.packages[$PKG].description."resolved-ref"' pubspec.lock.json)"
|
||||
hash="$(nix-prefetch-github --rev "$resolved_ref" "$owner" "$repo" | jq '.hash')"
|
||||
sed -i "s|${pkg_name} = \".*\";|${pkg_name} = $hash;|" gui.nix
|
||||
}
|
||||
|
||||
# Update the hash of the multipass source code in the Nix expression.
|
||||
update_multipass_source() {
|
||||
local version; version="$1"
|
||||
echo "Updating multipass source"
|
||||
|
||||
sri_hash="$(nix-prefetch-github canonical multipass --rev "refs/tags/v${version}" --fetch-submodules | jq -r '.hash')"
|
||||
|
||||
sed -i "s|version = \".*$|version = \"$version\";|" package.nix
|
||||
sed -i "s|hash = \".*$|hash = \"${sri_hash}\";|" package.nix
|
||||
}
|
||||
|
||||
# Update the version/hash of the grpc source code in the Nix expression.
|
||||
update_grpc_source() {
|
||||
local version; version="$1"
|
||||
echo "Updating grpc source"
|
||||
|
||||
submodule_info="https://raw.githubusercontent.com/canonical/multipass/refs/tags/v${version}/3rd-party/submodule_info.md"
|
||||
commit_short="$(curl -s "${submodule_info}" | grep -Po "CanonicalLtd/grpc/compare/v[0-9]+\.[0-9]+\.[0-9]+\.\.\K[0-9a-f]+")"
|
||||
commit_hash="$(curl -s "https://github.com/canonical/grpc/commits/${commit_short}" | grep -Po "${commit_short}[0-9a-f]+" | head -n1)"
|
||||
sri_hash="$(nix-prefetch-github canonical grpc --rev "${commit_hash}" --fetch-submodules | jq -r '.hash')"
|
||||
|
||||
sed -i "s|rev = \".*$|rev = \"${commit_hash}\";|" multipassd.nix
|
||||
sed -i "s|hash = \".*$|hash = \"${sri_hash}\";|" multipassd.nix
|
||||
}
|
||||
|
||||
|
||||
LATEST_TAG="$(curl -s ${GITHUB_TOKEN:+-u ":$GITHUB_TOKEN"} https://api.github.com/repos/canonical/multipass/releases/latest | jq -r '.tag_name')"
|
||||
LATEST_VERSION="$(expr "$LATEST_TAG" : 'v\(.*\)')"
|
||||
CURRENT_VERSION="$(grep -Po "version = \"\K[^\"]+" package.nix)"
|
||||
|
||||
if [[ "$CURRENT_VERSION" == "$LATEST_VERSION" ]]; then
|
||||
echo "multipass is up to date: ${CURRENT_VERSION}"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
update_pubspec_json "$LATEST_VERSION"
|
||||
|
||||
update_dart_pkg_hash dartssh2 andrei-toterman dartssh2
|
||||
update_dart_pkg_hash hotkey_manager_linux andrei-toterman hotkey_manager
|
||||
update_dart_pkg_hash system_info2 andrei-toterman system_info
|
||||
update_dart_pkg_hash tray_menu andrei-toterman tray_menu
|
||||
update_dart_pkg_hash window_size google flutter-desktop-embedding
|
||||
update_dart_pkg_hash xterm levkropp xterm.dart
|
||||
|
||||
update_multipass_source "$LATEST_VERSION"
|
||||
|
||||
update_grpc_source "$LATEST_VERSION"
|
@ -4417,8 +4417,6 @@ with pkgs;
|
||||
|
||||
mtr-gui = callPackage ../tools/networking/mtr { withGtk = true; };
|
||||
|
||||
multipass = qt6Packages.callPackage ../tools/virtualization/multipass { };
|
||||
|
||||
multitran = recurseIntoAttrs (let callPackage = newScope pkgs.multitran; in {
|
||||
multitrandata = callPackage ../tools/text/multitran/data { };
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user