-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Source build of lxd-agent. SecureBoot enabled.
- Loading branch information
1 parent
7a01dfe
commit b0c1746
Showing
5 changed files
with
49 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,34 @@ | ||
with import <nixpkgs> {}; | ||
|
||
stdenv.mkDerivation rec { | ||
stdenv.mkDerivation buildGoPackage rec { | ||
name = "lxd-agent"; | ||
version = "4.5"; # modify the version if using newer LXD | ||
|
||
goPackagePath = "github.com/lxc/lxd"; | ||
|
||
buildFlags = [ "-ldflags=-extldflags=-static" "-ldflags=-s" "-ldflags=-w" "-tags libsqlite3" ]; | ||
|
||
src = fetchurl { | ||
url = https://github.com/stevenewey/lxd-vms-on-nixos/raw/master/lxd-agent/lxd-agent; | ||
sha256 = "4c17cb711a95b7d2fd1ec90f02f94ec0b4bbd89e556e188576ece66f91666bb7"; | ||
url = "https://github.com/lxc/lxd/releases/download/lxd-${version}/lxd-${version}.tar.gz"; | ||
sha256 = "1nszzcyn8kvpnxppjbxky5x9a8n0jfmhy20j6nrwm3196gd6hirr"; # update this when changing LXD version | ||
}; | ||
buildCommand = '' | ||
mkdir -p $out/bin | ||
cp $src $out/bin/lxd-agent | ||
chmod +x $out/bin/lxd-agent | ||
|
||
subPackages = [ "lxd-agent" ]; | ||
|
||
preConfigure = '' | ||
export CGO_ENABLED=0 | ||
''; | ||
|
||
postPatch = '' | ||
substituteInPlace shared/usbid/load.go \ | ||
--replace "/usr/share/misc/usb.ids" "${hwdata}/share/hwdata/usb.ids" | ||
''; | ||
|
||
preBuild = '' | ||
# unpack vendor | ||
pushd go/src/github.com/lxc/lxd | ||
rm _dist/src/github.com/lxc/lxd | ||
cp -r _dist/src/* ../../.. | ||
popd | ||
''; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
with import <nixpkgs> {}; | ||
|
||
# with this configuration, LXD will only support secureboot, which is the default | ||
|
||
stdenv.mkDerivation rec { | ||
name = "ovmf-meta"; | ||
buildCommand = '' | ||
mkdir -p $out | ||
cp ${pkgs.OVMF-secureBoot.fd}/FV/OVMF.fd $out/ | ||
cp ${pkgs.OVMF-secureBoot.fd}/FV/OVMF_CODE.fd $out/ | ||
cp ${pkgs.OVMF-secureBoot.fd}/FV/OVMF_VARS.fd $out/OVMF_VARS.ms.fd | ||
''; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters