commit 1e56b9fbcb400aeebb49c289f700760a750ef1e7 Author: Artemis Tosini Date: Sat Dec 9 02:12:40 2023 +0000 First attempt at cross compiling sd image diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4425c7e --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +.direnv/ +target +result diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..621e14a --- /dev/null +++ b/flake.lock @@ -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 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..367dac2 --- /dev/null +++ b/flake.nix @@ -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" + ]; + }; + }; +}