fixes and docs
This commit is contained in:
82
packages/cockpit-machines/default.nix
Normal file
82
packages/cockpit-machines/default.nix
Normal file
@@ -0,0 +1,82 @@
|
||||
{
|
||||
lib,
|
||||
namespace,
|
||||
nodejs,
|
||||
stdenv,
|
||||
}:
|
||||
let
|
||||
inherit (lib.trivial) importJSON;
|
||||
inherit (lib.${namespace}) mkAllSources selectVariant;
|
||||
|
||||
versionSpec = importJSON ./version.json;
|
||||
selected = selectVariant versionSpec null null;
|
||||
sources = mkAllSources selected;
|
||||
inherit (selected.variables) version;
|
||||
in
|
||||
stdenv.mkDerivation {
|
||||
pname = "cockpit-machines";
|
||||
inherit version;
|
||||
|
||||
src = sources.src;
|
||||
|
||||
# Pre-vendored node_modules from cockpit-project/node-cache, pinned via the
|
||||
# node_modules submodule reference in the source tree.
|
||||
inherit (sources) nodeModules;
|
||||
|
||||
# pkg/lib checked out from the main cockpit repo at the commit pinned in
|
||||
# the Makefile (COCKPIT_REPO_COMMIT).
|
||||
inherit (sources) cockpitLib;
|
||||
|
||||
nativeBuildInputs = [ nodejs ];
|
||||
|
||||
# passthru.cockpitPath is used by the NixOS cockpit module to add runtime
|
||||
# dependencies to the cockpit service's PATH.
|
||||
passthru.cockpitPath = [ ];
|
||||
|
||||
configurePhase = ''
|
||||
runHook preConfigure
|
||||
|
||||
# Replace the empty git submodule placeholder with the real vendored modules.
|
||||
# Use dotglob so hidden entries (.bin, .package-lock.json, etc.) are included.
|
||||
rm -rf node_modules
|
||||
mkdir node_modules
|
||||
(shopt -s dotglob; cp -r $nodeModules/* node_modules/)
|
||||
chmod -R u+w node_modules
|
||||
|
||||
# Node needs package-lock.json at the project root to resolve modules.
|
||||
cp node_modules/.package-lock.json package-lock.json
|
||||
|
||||
# Wire up pkg/lib from the pinned cockpit repo.
|
||||
mkdir -p pkg
|
||||
cp -r $cockpitLib/pkg/lib pkg/lib
|
||||
chmod -R u+w pkg
|
||||
|
||||
runHook postConfigure
|
||||
'';
|
||||
|
||||
buildPhase = ''
|
||||
runHook preBuild
|
||||
|
||||
NODE_ENV=production node build.js
|
||||
|
||||
runHook postBuild
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
mkdir -p $out/share/cockpit/machines
|
||||
cp -r dist/* $out/share/cockpit/machines/
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
meta = {
|
||||
description = "Cockpit UI for virtual machines (libvirt/KVM)";
|
||||
homepage = "https://github.com/cockpit-project/cockpit-machines";
|
||||
changelog = "https://github.com/cockpit-project/cockpit-machines/releases/tag/${version}";
|
||||
license = lib.licenses.lgpl21Plus;
|
||||
platforms = lib.platforms.linux;
|
||||
maintainers = [ ];
|
||||
};
|
||||
}
|
||||
31
packages/cockpit-machines/version.json
Normal file
31
packages/cockpit-machines/version.json
Normal file
@@ -0,0 +1,31 @@
|
||||
{
|
||||
"schemaVersion": 1,
|
||||
"variables": {
|
||||
"version": "350",
|
||||
"cockpitRepoCommit": "5fb84eaefbc5ff4433a21bc452270af8d09e1ab7",
|
||||
"nodeCacheRev": "d1c928e67c7891bb05238dde9caa6486bba15625"
|
||||
},
|
||||
"sources": {
|
||||
"src": {
|
||||
"fetcher": "github",
|
||||
"owner": "cockpit-project",
|
||||
"repo": "cockpit-machines",
|
||||
"tag": "${version}",
|
||||
"hash": "sha256-jP/ffo0kwju0xxKMHhDwOsNKO7HjOaJZ/uXYijsElNg="
|
||||
},
|
||||
"nodeModules": {
|
||||
"fetcher": "github",
|
||||
"owner": "cockpit-project",
|
||||
"repo": "node-cache",
|
||||
"rev": "${nodeCacheRev}",
|
||||
"hash": "sha256-yonEQ7hRskbFDnW/Pc3aOeV7bgu1LCYpi1Ok5/aHeC8="
|
||||
},
|
||||
"cockpitLib": {
|
||||
"fetcher": "github",
|
||||
"owner": "cockpit-project",
|
||||
"repo": "cockpit",
|
||||
"rev": "${cockpitRepoCommit}",
|
||||
"hash": "sha256-H9eeTprI0rBKv//1TvGWTtgb5N09/8Audtu5dE1y86o="
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user