I’m tired of mvn2nix
I figured out how to get things working, but it requires non-trivial modifications to it, and I am not in a mmod to make them. Especially given that building OH from source doesn’t actually make much sense – mvn will “just” download the “built” dependencies anyhow…
This commit is contained in:
42
flake.lock
generated
Normal file
42
flake.lock
generated
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
{
|
||||||
|
"nodes": {
|
||||||
|
"flake-utils": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1676283394,
|
||||||
|
"narHash": "sha256-XX2f9c3iySLCw54rJ/CZs+ZK6IQy7GXNY4nSOyu2QG4=",
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"rev": "3db36a8b464d0c4532ba1c7dda728f4576d6d073",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixpkgs": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1677022426,
|
||||||
|
"narHash": "sha256-dCFSTknONT7Rz5AYHEXrh4kpgSZjqjuu/lXJhJTiS78=",
|
||||||
|
"owner": "NixOS",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "8260d35eb9212c4803a3c612a9f7e29c3434fde2",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "NixOS",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": {
|
||||||
|
"inputs": {
|
||||||
|
"flake-utils": "flake-utils",
|
||||||
|
"nixpkgs": "nixpkgs"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": "root",
|
||||||
|
"version": 7
|
||||||
|
}
|
||||||
15
flake.nix
15
flake.nix
@@ -2,24 +2,15 @@
|
|||||||
inputs = {
|
inputs = {
|
||||||
nixpkgs.url = "github:NixOS/nixpkgs";
|
nixpkgs.url = "github:NixOS/nixpkgs";
|
||||||
flake-utils.url = "github:numtide/flake-utils";
|
flake-utils.url = "github:numtide/flake-utils";
|
||||||
openhab-distro = {
|
|
||||||
url = "github:openhab/openhab-distro/3.4.2"; # OH-DISTRO-URL
|
|
||||||
flake = false;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = { flake-utils, nixpkgs, openhab-distro, ... }: flake-utils.lib.eachDefaultSystem (system: {
|
outputs = { flake-utils, nixpkgs, ... }: flake-utils.lib.eachDefaultSystem (system: {
|
||||||
packages = rec {
|
packages = rec {
|
||||||
jdk-openhab = nixpkgs.legacyPackages.${system}.jdk11;
|
jdk-openhab = nixpkgs.legacyPackages.${system}.jdk11;
|
||||||
maven-openhab = nixpkgs.legacyPackages.${system}.maven.override { jdk = jdk-openhab; };
|
|
||||||
openhab-repository = nixpkgs.legacyPackages.${system}.callPackage ./openhab-repository.nix {
|
|
||||||
inherit openhab-distro;
|
|
||||||
maven = maven-openhab;
|
|
||||||
};
|
|
||||||
openhab = nixpkgs.legacyPackages.${system}.callPackage ./openhab.nix {
|
openhab = nixpkgs.legacyPackages.${system}.callPackage ./openhab.nix {
|
||||||
inherit openhab-distro openhab-repository jdk-openhab;
|
inherit jdk-openhab;
|
||||||
maven = maven-openhab;
|
|
||||||
};
|
};
|
||||||
|
openhab-addons = nixpkgs.legacyPackages.${system}.callPackage ./openhab-addons.nix {};
|
||||||
default = openhab;
|
default = openhab;
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|||||||
17594
mvn2nix-lock.json
17594
mvn2nix-lock.json
File diff suppressed because it is too large
Load Diff
@@ -1,16 +0,0 @@
|
|||||||
# Downloads various dependencies for the openhab build.
|
|
||||||
{ lib, stdenv, maven, openhab-distro, fetchurl, linkFarm }:
|
|
||||||
|
|
||||||
let
|
|
||||||
dependencies = (builtins.fromJSON (builtins.readFile ./mvn2nix-lock.json )).dependencies;
|
|
||||||
dependenciesAsDrv = (lib.forEach (lib.attrValues dependencies) (dependency: {
|
|
||||||
drv = fetchurl {
|
|
||||||
url = dependency.url;
|
|
||||||
sha256 = dependency.sha256;
|
|
||||||
};
|
|
||||||
layout = dependency.layout;
|
|
||||||
}));
|
|
||||||
in linkFarm "openhab-repository" (lib.forEach dependenciesAsDrv (dependency: {
|
|
||||||
name = dependency.layout;
|
|
||||||
path = dependency.drv;
|
|
||||||
}))
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
sha256-po8EjHV8lPUOxkuOnZ5mQOODg+LAhgazfx7wW6Modqc=
|
|
||||||
39
openhab.nix
39
openhab.nix
@@ -1,23 +1,24 @@
|
|||||||
{
|
{
|
||||||
gawk,
|
|
||||||
bash,
|
bash,
|
||||||
coreutils,
|
coreutils,
|
||||||
|
fetchurl,
|
||||||
|
gawk,
|
||||||
jdk-openhab,
|
jdk-openhab,
|
||||||
makeWrapper,
|
|
||||||
lib,
|
lib,
|
||||||
maven,
|
makeWrapper,
|
||||||
openhab-distro,
|
|
||||||
openhab-repository,
|
|
||||||
stdenv,
|
stdenv,
|
||||||
}:
|
}:
|
||||||
|
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
pname = "openhab";
|
pname = "openhab";
|
||||||
version = openhab-distro.shortRev;
|
version = builtins.readFile ./version;
|
||||||
src = openhab-distro;
|
src = fetchurl {
|
||||||
nativeBuildInputs = [ makeWrapper maven ];
|
url = "https://github.com/openhab/openhab-distro/releases/download/${version}/openhab-${version}.tar.gz";
|
||||||
|
sha256 = builtins.readFile ./sha256;
|
||||||
|
};
|
||||||
|
nativeBuildInputs = [ makeWrapper ];
|
||||||
buildInputs = [ bash ];
|
buildInputs = [ bash ];
|
||||||
outputs = [ "out" "demo" ];
|
outputs = [ "out" ];
|
||||||
extraPath = lib.makeBinPath [ jdk-openhab gawk coreutils ];
|
extraPath = lib.makeBinPath [ jdk-openhab gawk coreutils ];
|
||||||
wrappedExecutables = [
|
wrappedExecutables = [
|
||||||
"start.sh"
|
"start.sh"
|
||||||
@@ -35,25 +36,15 @@ stdenv.mkDerivation rec {
|
|||||||
"runtime/bin/update"
|
"runtime/bin/update"
|
||||||
];
|
];
|
||||||
|
|
||||||
buildPhase = ''
|
unpackPhase = ''
|
||||||
runHook preBuild
|
runHook preUnpack
|
||||||
|
mkdir -p $out
|
||||||
echo "Using repository ${openhab-repository}"
|
tar -C $out -xf $src
|
||||||
cp -r ${openhab-repository} ./repository
|
runHook postUnpack
|
||||||
chmod -R +rw ./repository
|
|
||||||
mvn --offline -B -T $NIX_BUILD_CORES -Drelease -Dmaven.repo.local=./repository package
|
|
||||||
|
|
||||||
runHook postBuild
|
|
||||||
'';
|
'';
|
||||||
|
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
runHook preInstall
|
runHook preInstall
|
||||||
mkdir $out
|
|
||||||
tar -C $out -xf distributions/openhab/target/openhab-3.4.2.tar.gz
|
|
||||||
mv distributions/openhab-addons/target/openhab-addons-3.4.2.kar $out/addons/
|
|
||||||
mkdir $demo
|
|
||||||
tar -C $demo -xf distributions/openhab-demo/target/openhab-demo-3.4.2.tar.gz
|
|
||||||
|
|
||||||
rm -rfv \
|
rm -rfv \
|
||||||
"$out/"*.bat \
|
"$out/"*.bat \
|
||||||
"$out/runtime/bin/"*.bat \
|
"$out/runtime/bin/"*.bat \
|
||||||
|
|||||||
Reference in New Issue
Block a user