使用nix打包quardstar-qemu

quardstar-tuorial

quardstar-tutal 是一个从0开始构建嵌入式linux操作系统的教程, 他基于一个定制的qemu模拟器

之前没尝试过用nix打包程序,就借着这个机会试一试

结果

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
{ pkgs, stdenv, lib, ... }:

stdenv.mkDerivation rec {
pname = "quard-star-qemu";
version = "8.0.0-custom";

src = ./qemu-8.0.0/.;

nativeBuildInputs = with pkgs; [
makeWrapper
removeReferencesTo
pkg-config
flex
bison
meson
ninja
perl

# Don't change this to python3 and python3.pkgs.*, breaks cross-compilation
python3Packages.python

wrapGAppsHook3
glib

];

buildInputs = with pkgs; [
glib
zlib
libcap_ng
gtk3
gettext
vte
];
configureFlags = [
"--target-list=riscv64-softmmu"
"--enable-gtk"
"--enable-virtfs"
"--disable-gio"
];


configurePhase = ''
./configure --prefix=$out $configureFlags
'';

buildPhase = ''
make -j
'';

installPhase = ''
make install
'';

meta = with lib; {
description = "qemu with quard_star board";
homepage = "https://github.com/QQxiaoming/quard_star_tutorial";
license = licenses.bsd3;
platforms = platforms.linux;
};
}

可以使用nix-build -E 'with import <nixpkgs> {}; callPackage ./custom-qemu.nix {}'

参考

https://lantian.pub/article/modify-computer/nixos-packaging.lantian/
https://quard-star-tutorial.readthedocs.io/zh-cn/latest/ch1.html


使用nix打包quardstar-qemu
https://20040702.xyz/2025/01/19/nix-package-quardstar/
作者
Seeker
发布于
2025年1月19日
许可协议