nix: Build on aarch64

This commit is contained in:
Geoffrey Frogeye 2023-11-22 00:52:31 +01:00
parent 471966197a
commit 5125e05266
Signed by: geoffrey
GPG key ID: C72403E7F82E6AD8
13 changed files with 62 additions and 33 deletions

6
config/nix/add_channels.sh Executable file
View file

@ -0,0 +1,6 @@
#!/usr/bin/env bash
# TODO Surely there's more elegant?
nix-channel --add https://nixos.org/channels/nixos-23.05 nixpkgs
nix-channel --add https://github.com/nix-community/home-manager/archive/release-23.05.tar.gz home-manager
nix-channel --add https://github.com/NixOS/nixos-hardware/archive/master.tar.gz nixos-hardware

View file

@ -1,3 +1,20 @@
#/usr/bin/env sh
# Build a disk image for testing on pindakaas via sd card
export NIXPKGS_ALLOW_UNFREE=1
nix-build '<nixpkgs/nixos>' -A config.system.build.sdImage -I nixos-config=./pindakaas.nix
extra=""
if [ "$(uname -m)" != "aarch64" ]
then
# If we have binfmt QEMU (https://nixos.wiki/wiki/NixOS_on_ARM#Compiling_through_binfmt_QEMU),
# we can pretend we're aarch64.
if [ -f /proc/sys/fs/binfmt_misc/qemu-aarch64 ]
then
extra="--argstr system aarch64-linux"
# Otherwise, use cross-compilation...
# theorically faster but doesn't use the cache and never got it to build a full customized image
else
extra="--argstr nixpkgs.crossSystem.system aarch64-linux"
fi
fi
nix-build '<nixpkgs/nixos>' -A config.system.build.sdImage -I nixos-config=./pindakaas.nix $extra --show-trace

18
config/nix/build-vm.sh Executable file
View file

@ -0,0 +1,18 @@
#/usr/bin/env sh
# Build a NixOS VM for testing
#
# For x86_64 hosts: use curacao config
# For aarch64 hosts: use pindakaas config
export NIXPKGS_ALLOW_UNFREE=1
if [ "$(uname -m)" == "x86_64" ]
then
config=./curacao.nix
elif [ "$(uname -m)" == "aarch64" ]
then
config=./pindakaas.nix
fi
nix-build '<nixpkgs/nixos>' -A vm \
-I nixpkgs=channel:nixos-23.05 \
-I nixos-config=${config}

View file

@ -1,5 +0,0 @@
#/usr/bin/env sh
export NIXPKGS_ALLOW_UNFREE=1
nix-build '<nixpkgs/nixos>' -A vm \
-I nixpkgs=channel:nixos-23.05 \
-I nixos-config=./testvm.nix

View file

@ -5,6 +5,6 @@
./os/loader.nix
];
networking.hostName = "curacao.geoffrey.frogeye.fr";
networking.hostName = "curacao";
frogeye.extra = true;
}

View file

@ -407,7 +407,8 @@ in
moreutils
man
visidata
nodePackages.insect
# nodePackages.insect # FIXME Don't install on aarch64
# TODO Use whatever replaces insect
translate-shell
unzip
unrar

View file

@ -269,12 +269,13 @@
"d" = "exec ${autorandrmenu {title="Default profile"; option="--default"; builtin = true;}}, mode default";
} // return_bindings;
"${mode_temp}" = {
"r" = "exec ${pkgs.sct}/bin/sct 1000";
"d" = "exec ${pkgs.sct}/bin/sct 2000";
"c" = "exec ${pkgs.sct}/bin/sct 4500";
"o" = "exec ${pkgs.sct}/bin/sct";
"a" = "exec ${pkgs.sct}/bin/sct 8000";
"b" = "exec ${pkgs.sct}/bin/sct 10000";
# "r" = "exec ${pkgs.sct}/bin/sct 1000";
# "d" = "exec ${pkgs.sct}/bin/sct 2000";
# "c" = "exec ${pkgs.sct}/bin/sct 4500";
# "o" = "exec ${pkgs.sct}/bin/sct";
# "a" = "exec ${pkgs.sct}/bin/sct 8000";
# "b" = "exec ${pkgs.sct}/bin/sct 10000";
# FIXME Not on aarch64
} // return_bindings;
};
window = {

View file

@ -1,5 +1,4 @@
{ pkgs, ... }:
{
{ pkgs, ... }: {
# TODO Separate in diffrent packages once the structure is finalized...
# or connvert into per-directory requirements
home.packages = with pkgs; [
@ -29,7 +28,7 @@
# FPGA
yosys
verilog
ghdl
# ghdl # TODO Not on aarch64
gtkwave # TODO Display server only
# Network

View file

@ -15,13 +15,13 @@ let
};
meta.homepage = "https://github.com/deris/vim-shot-f";
};
quick-scope = pkgs.vimUtils.buildVimPluginFrom2Nix {
quick-scope = pkgs.vimUtils.buildVimPluginFrom2Nix rec {
pname = "quick-scope";
version = "2.6.1";
src = pkgs.fetchFromGitHub {
owner = "deris";
owner = "unblevable";
repo = "quick-scope";
rev = "2.6.1";
rev = "v${version}";
sha256 = "iAPvIs/lhW+w5kFTZKaY97D/kfCGtqKrJVFvZ8cHu+c=";
};
meta.homepage = "https://github.com/unblevable/quick-scope";

View file

@ -1,5 +1,7 @@
{ pkgs, lib, ... }:
{
networking.domain = "geoffrey.frogeye.fr";
boot.loader.efi.canTouchEfiVariables = true;
time.timeZone = "Europe/Amsterdam";

View file

@ -4,7 +4,7 @@
# TODO This doesn't change anything, at least in the VM
networking.wireless = {
enable = true;
networks = builtins.fromJSON ./wireless/networks.json; # If this file doesn't exist, run ./wireless/import.py
networks = builtins.fromJSON (builtins.readFile ./wireless/networks.json); # If this file doesn't exist, run ./wireless/import.py
extraConfig = ''
country=NL
'';

View file

@ -3,8 +3,7 @@
imports = [
# <nixos-hardware/pine64/pinebook-pro>
<nixpkgs/nixos/modules/installer/sd-card/sd-image-aarch64.nix>
# ./os/loader.nix # Don't uncomment this before having put extra behind an option!
./os/loader.nix
];
nixpkgs.crossSystem.system = "aarch64-linux";
# networking.hostName = "pindakaas.geoffrey.frogeye.fr";
networking.hostName = "pindakaas";
}

View file

@ -1,9 +0,0 @@
{ ... }:
{
imports = [
./os/loader.nix
];
networking.hostName = "nixos";
frogeye.extra = true;
}