Skip to content

Commit

Permalink
mkosi: dev-debian: Initial image
Browse files Browse the repository at this point in the history
Signed-off-by: Nathan Chancellor <[email protected]>
  • Loading branch information
nathanchance committed Jan 8, 2025
1 parent bb8d795 commit 43cb62c
Show file tree
Hide file tree
Showing 11 changed files with 192 additions and 4 deletions.
4 changes: 2 additions & 2 deletions fish/functions/mkosi_bld.fish
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ function mkosi_bld -d "Build a distribution using mkosi"
switch (basename $directory)
case dev-arch
set cache_dir pacman
case dev-debian pgo-llvm-builder
set cache_dir apt
case dev-fedora
set cache_dir dnf
case pgo-llvm-builder
set cache_dir apt
end

sudo (command -v mkosi) \
Expand Down
117 changes: 117 additions & 0 deletions mkosi/dev-debian/mkosi.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
[Build]
WithNetwork=true

[Content]
Bootable=false
# base
Packages=apt
bash
dbus-broker
iproute2
gnupg
libnss-myhostname
libnss-systemd
login
openssh-client
polkitd
sudo
systemd
systemd-sysv
tzdata
udev
# b4
Packages=python3-dkim
python3-requests
# boot-qemu.py
Packages=lsof
qemu-system-arm
qemu-system-mips
qemu-system-misc
qemu-system-ppc
qemu-system-x86
# build-binutils.py
Packages=file
texinfo
# cvise
Packages=cvise
# compression / decompression / extraction
Packages=bzip2
gzip
lzop
lz4
pbzip2
pigz
tar
unzip
xz-utils
zip
zstd
# development
Packages=build-essential
ccache
hyperfine
# downloading
Packages=curl
wget
# env
Packages=ca-certificates
fastfetch
fzf
jq
locales
moreutils
openssh-client
stow
tmux
vim
zoxide
# git
Packages=git
git-delta
git-email
libauthen-sasl-perl
libio-socket-ssl-perl
# kernel / tuxmake
Packages=bison
cpio
flex
kmod
libc-dev
libdw-dev
libelf-dev
libncurses5-dev
libssl-dev
openssl
pahole
rsync
socat
sparse
u-boot-tools
# LLVM
Packages=binutils-dev
cmake
ninja-build
zlib1g-dev
# llvm.sh
Packages=lsb-release
software-properties-common
# nicer GNU utilities
Packages=bat
eza
fd-find
ripgrep
# package building
Packages=dpkg
rpm
# spdxcheck.py
Packages=python3-git
python3-ply

[Distribution]
Distribution=debian
Release=unstable

[Output]
Format=directory
ImageId=dev-debian
OutputDirectory=/var/lib/machines
18 changes: 18 additions & 0 deletions mkosi/dev-debian/mkosi.conf.d/00-cross-compilers.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[Content]
Packages=binutils-aarch64-linux-gnu
binutils-arm-linux-gnueabi
binutils-arm-linux-gnueabihf
binutils-mips-linux-gnu
binutils-mipsel-linux-gnu
binutils-riscv64-linux-gnu
binutils-s390x-linux-gnu
gcc-aarch64-linux-gnu
gcc-mips-linux-gnu
gcc-mipsel-linux-gnu
gcc-riscv64-linux-gnu
gcc-s390x-linux-gnu
gcc-arm-linux-gnueabi
gcc-arm-linux-gnueabihf
[Match]
Architecture=|arm64
Architecture=|x86-64
1 change: 1 addition & 0 deletions mkosi/dev-debian/mkosi.postinst.d/00-modern-fish.sh.chroot
10 changes: 10 additions & 0 deletions mkosi/dev-debian/mkosi.postinst.d/01-etc-use-cbl.fish.chroot
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env fish

# This image is the default development image on arm systems but it is not on
# other systems so avoid using the toolchains by default there. They can still
# be accessed via absolute paths if necessary.
if test $ARCHITECTURE = arm
echo 1 >/etc/use-cbl
else
echo 0 >/etc/use-cbl
end
22 changes: 22 additions & 0 deletions mkosi/dev-debian/mkosi.postinst.d/01-install-packages.fish.chroot
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env fish

# Setup gh repo
set gh_gpg_key /etc/apt/trusted.gpg.d/githubcli-archive-keyring.gpg
and curl -fLSs https://cli.github.com/packages/(basename $gh_gpg_key) | dd of=$gh_gpg_key
and echo "deb [arch=$DISTRIBUTION_ARCHITECTURE signed-by=$gh_gpg_key] https://cli.github.com/packages stable main" | tee /etc/apt/sources.list.d/github-cli.list

# Setup LLVM repo
and set llvm_main_version (curl -fLSs https://raw.githubusercontent.com/llvm/llvm-project/main/cmake/Modules/LLVMVersion.cmake | string match -gr 'set\(LLVM_VERSION_MAJOR (\d+)\)'; or echo 20)
and set llvm_stable_version (math $llvm_main_version - 1)
and switch $ARCHITECTURE
case arm64 x86-64
curl -fLSs https://apt.llvm.org/llvm-snapshot.gpg.key | gpg --dearmor | dd of=/etc/apt/trusted.gpg.d/apt_llvm_org.gpg
and echo "deb https://apt.llvm.org/$RELEASE/ llvm-toolchain main" >/etc/apt/sources.list.d/llvm-main.list
and echo "deb https://apt.llvm.org/$RELEASE/ llvm-toolchain-$llvm_stable_version main" >/etc/apt/sources.list.d/llvm-stable.list
end

# Download packages from repos
and apt update
and apt install -y \
{clang,lld,llvm}-$llvm_stable_version \
gh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env fish

echo 'nathan ALL=(ALL) NOPASSWD: ALL' >/etc/sudoers.d/00_nathan
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env fish

echo "locales locales/default_environment_locale select en_US.UTF-8" | debconf-set-selections
echo "locales locales/locales_to_be_generated multiselect en_US.UTF-8 UTF-8" | debconf-set-selections

rm -f /etc/locale.gen

dpkg-reconfigure --frontend noninteractive locales
3 changes: 3 additions & 0 deletions mkosi/dev-debian/mkosi.postinst.d/01-symlink-fd.fish.chroot
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env fish

ln -fsv /usr/bin/fdfind /usr/local/bin/fd
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,13 @@

set -eux

echo 'deb http://download.opensuse.org/repositories/shells:/fish/Debian_10/ /' >/etc/apt/sources.list.d/shells:fish.list
wget -O - -q https://download.opensuse.org/repositories/shells:fish/Debian_10/Release.key | gpg --dearmor >/etc/apt/trusted.gpg.d/shells_fish.gpg
case "$RELEASE" in
"buster") ver=10 ;;
"unstable") ver=12 ;;
*) echo "$RELEASE" is not supported 2>&1; false ;;
esac
echo "deb http://download.opensuse.org/repositories/shells:/fish/Debian_$ver/ /" >/etc/apt/sources.list.d/shells:fish.list
wget -O - -q https://download.opensuse.org/repositories/shells:fish/Debian_"$ver"/Release.key | gpg --dearmor >/etc/apt/trusted.gpg.d/shells_fish.gpg

apt update -y
apt install -y fish

0 comments on commit 43cb62c

Please sign in to comment.