First attempt at cross compiling sd image

This commit is contained in:
Artemis Tosini 2023-12-09 02:12:40 +00:00
commit 1e56b9fbcb
Signed by: artemist
GPG key ID: EE5227935FE3FF18
3 changed files with 102 additions and 0 deletions

3
.gitignore vendored Normal file
View file

@ -0,0 +1,3 @@
.direnv/
target
result

61
flake.lock Normal file
View file

@ -0,0 +1,61 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1701693815,
"narHash": "sha256-7BkrXykVWfkn6+c1EhFA3ko4MLi3gVG0p9G96PNnKTM=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "09ec6a0881e1a36c29d67497693a67a16f4da573",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs",
"utils": "utils"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1701680307,
"narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "4022d587cbbfd70fe950c1e2083a02621806a725",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

38
flake.nix Normal file
View file

@ -0,0 +1,38 @@
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, utils }:
let supportedSystems = [ "x86_64-linux" "aarch64-linux" ];
in (utils.lib.eachSystem supportedSystems (system:
let pkgs = import nixpkgs { inherit system; };
in {
formatter = pkgs.nixfmt;
packages.pi4-sdimage = (self.nixosConfigurations.pi4.extendModules {
modules = [{
config.nixpkgs = {
hostPlatform.system = "aarch64-linux";
buildPlatform.system = system;
};
}];
}).config.system.build.sdImage;
})) // {
nixosModules.minify = { ... }: {
disabledModules = [ "profiles/base.nix" ];
config = {
nix.enable = false;
programs.nano.enable = true;
};
};
nixosConfigurations.pi4 = nixpkgs.lib.nixosSystem {
system = "aarch64-linux";
modules = [
self.nixosModules.minify
"${nixpkgs}/nixos/modules/installer/sd-card/sd-image-aarch64.nix"
];
};
};
}