Trying to build new android host with CI

This commit is contained in:
Andrea Ciceri 2022-10-29 17:09:27 +02:00
parent e71fee8852
commit b3071a310f
No known key found for this signature in database
GPG key ID: A1FC89532D1C5654
4 changed files with 201 additions and 9 deletions

View file

@ -110,3 +110,30 @@ jobs:
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
- run: nix --print-build-logs --verbose build --allow-import-from-derivation --option system aarch64-linux --option sandbox false --extra-platforms aarch64-linux .#nixosConfigurations.pbp.config.system.build.toplevel - run: nix --print-build-logs --verbose build --allow-import-from-derivation --option system aarch64-linux --option sandbox false --extra-platforms aarch64-linux .#nixosConfigurations.pbp.config.system.build.toplevel
build-oneplus5t:
if: ${{ always() }}
needs: check
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- uses: cachix/install-nix-action@v17
with:
extra_nix_config: |
max-jobs = 10
- run: |
DEBIAN_FRONTEND=noninteractive
sudo apt-get update -q -y && sudo apt-get install -q -y qemu-system-aarch64 qemu-efi binfmt-support qemu-user-static
mkdir -p ~/.config/nix
sudo bash -c "echo system-features = aarch64-linux arm-linux >> /etc/nix/nix.conf"
- uses: cachix/cachix-action@v10
with:
name: aciceri-fleet
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
- run: nix --print-build-logs --verbose build --allow-import-from-derivation --option system aarch64-linux --option sandbox false --extra-platforms aarch64-linux .#oneplus5t
- run: readlink result

122
flake.lock generated
View file

@ -18,6 +18,27 @@
"type": "github" "type": "github"
} }
}, },
"androidPkgs": {
"inputs": {
"devshell": "devshell",
"flake-utils": "flake-utils_3",
"nixpkgs": "nixpkgs_5"
},
"locked": {
"lastModified": 1638562808,
"narHash": "sha256-nnGyBugMQo9WweTgpfPbJu0fHnRtxvsPQ9el2D3wPrY=",
"owner": "tadfisher",
"repo": "android-nixpkgs",
"rev": "a191ab6adb019b09d3bb919bb98dca31d83519d5",
"type": "github"
},
"original": {
"owner": "tadfisher",
"ref": "stable",
"repo": "android-nixpkgs",
"type": "github"
}
},
"comma": { "comma": {
"inputs": { "inputs": {
"flake-compat": "flake-compat", "flake-compat": "flake-compat",
@ -39,6 +60,21 @@
"type": "github" "type": "github"
} }
}, },
"devshell": {
"locked": {
"lastModified": 1637575296,
"narHash": "sha256-ZY8YR5u8aglZPe27+AJMnPTG6645WuavB+w0xmhTarw=",
"owner": "numtide",
"repo": "devshell",
"rev": "0e56ef21ba1a717169953122c7415fa6a8cd2618",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "devshell",
"type": "github"
}
},
"doom-emacs": { "doom-emacs": {
"flake": false, "flake": false,
"locked": { "locked": {
@ -306,6 +342,21 @@
"type": "github" "type": "github"
} }
}, },
"flake-utils_3": {
"locked": {
"lastModified": 1638122382,
"narHash": "sha256-sQzZzAbvKEqN9s0bzWuYmRaA03v40gaJ4+iL1LXjaeI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "74f7e4319258e287b0f9cb95426c9853b282730b",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"format-all": { "format-all": {
"flake": false, "flake": false,
"locked": { "locked": {
@ -445,6 +496,22 @@
"type": "github" "type": "github"
} }
}, },
"nixpkgsUnstable_2": {
"locked": {
"lastModified": 1638376152,
"narHash": "sha256-ucgLpVqhFnClH7YRUHBHnmiOd82RZdFR3XJt36ks5fE=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "6daa4a5c045d40e6eae60a3b6e427e8700f1c07f",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_2": { "nixpkgs_2": {
"locked": { "locked": {
"lastModified": 1663235518, "lastModified": 1663235518,
@ -490,6 +557,38 @@
"type": "indirect" "type": "indirect"
} }
}, },
"nixpkgs_5": {
"locked": {
"lastModified": 1637841632,
"narHash": "sha256-QYqiKHdda0EOnLGQCHE+GluD/Lq2EJj4hVTooPM55Ic=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "73369f8d0864854d1acfa7f1e6217f7d6b6e3fa1",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_6": {
"locked": {
"lastModified": 1638371214,
"narHash": "sha256-0kE6KhgH7n0vyuX4aUoGsGIQOqjIx2fJavpCWtn73rc=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "a640d8394f34714578f3e6335fc767d0755d78f9",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-21.11",
"repo": "nixpkgs",
"type": "github"
}
},
"nose": { "nose": {
"flake": false, "flake": false,
"locked": { "locked": {
@ -621,6 +720,26 @@
"type": "github" "type": "github"
} }
}, },
"robotnix": {
"inputs": {
"androidPkgs": "androidPkgs",
"nixpkgs": "nixpkgs_6",
"nixpkgsUnstable": "nixpkgsUnstable_2"
},
"locked": {
"lastModified": 1665032132,
"narHash": "sha256-3TtIR7JXGewZmvN4TknmVPzZkPptxJUxDvlfxks46tA=",
"owner": "danielfullmer",
"repo": "robotnix",
"rev": "2bcd6a106fd73e5f6454a4e3afc2d29cb78a2793",
"type": "github"
},
"original": {
"owner": "danielfullmer",
"repo": "robotnix",
"type": "github"
}
},
"root": { "root": {
"inputs": { "inputs": {
"agenix": "agenix", "agenix": "agenix",
@ -630,7 +749,8 @@
"nixosHardware": "nixosHardware", "nixosHardware": "nixosHardware",
"nixpkgsStable": "nixpkgsStable", "nixpkgsStable": "nixpkgsStable",
"nixpkgsUnstable": "nixpkgsUnstable", "nixpkgsUnstable": "nixpkgsUnstable",
"preCommitHooks": "preCommitHooks" "preCommitHooks": "preCommitHooks",
"robotnix": "robotnix"
} }
}, },
"rotate-text": { "rotate-text": {

View file

@ -13,13 +13,26 @@
agenix.url = github:ryantm/agenix; agenix.url = github:ryantm/agenix;
doomEmacs.url = github:nix-community/nix-doom-emacs; doomEmacs.url = github:nix-community/nix-doom-emacs;
comma.url = github:nix-community/comma; comma.url = github:nix-community/comma;
robotnix.url = github:danielfullmer/robotnix;
}; };
outputs = {self, ...} @ inputs: let outputs = {self, ...} @ inputs: let
utils = (import ./utils) inputs; utils = import ./utils inputs;
inherit (utils) lib mkConfigurations mkVmApps checkFormatting formatter formatApp mkDevShell; inherit
(utils)
androidImages
checkFormatting
formatApp
formatter
lib
mkDevShell
mkVmApps
nixosConfigurations
;
in { in {
nixosConfigurations = mkConfigurations; inherit nixosConfigurations;
packages = androidImages;
apps = lib.recursiveUpdate (mkVmApps self.nixosConfigurations) formatApp; apps = lib.recursiveUpdate (mkVmApps self.nixosConfigurations) formatApp;

View file

@ -6,6 +6,7 @@
doomEmacs, doomEmacs,
agenix, agenix,
comma, comma,
robotnix,
... ...
}: let }: let
supportedSystems = { supportedSystems = {
@ -15,9 +16,11 @@
pkgsFor = lib.genAttrs (lib.attrValues supportedSystems) (system: nixpkgsUnstable.legacyPackages.${system}); pkgsFor = lib.genAttrs (lib.attrValues supportedSystems) (system: nixpkgsUnstable.legacyPackages.${system});
lib = nixpkgsUnstable.lib.extend (self: super: { lib = nixpkgsUnstable.lib.extend (self: super:
{
perSystem = super.genAttrs (super.attrValues supportedSystems); perSystem = super.genAttrs (super.attrValues supportedSystems);
}); }
// robotnix.lib);
mkConfiguration = { mkConfiguration = {
name, name,
@ -49,7 +52,7 @@
}; };
}; };
mkConfigurations = { nixosConfigurations = {
thinkpad = mkConfiguration { thinkpad = mkConfiguration {
name = "thinkpad"; name = "thinkpad";
system = supportedSystems.x86_64-linux; system = supportedSystems.x86_64-linux;
@ -70,6 +73,25 @@
}; };
}; };
mkAndroidConfiguration = {
name,
device,
flavor,
}:
lib.robotnixSystem {
inherit device flavor;
};
androidConfigurations = {
oneplus5t = mkAndroidConfiguration {
name = "oneplus5t";
device = "dumpling";
flavor = "lineageos";
};
};
androidImages = lib.perSystem (system: builtins.mapAttrs (name: conf: conf.img) androidConfigurations);
mkVmApp = system: configuration: let mkVmApp = system: configuration: let
shellScript = pkgsFor.${system}.writeShellScript "run-vm" '' shellScript = pkgsFor.${system}.writeShellScript "run-vm" ''
${configuration.config.system.build.vm}/bin/run-${configuration.config.networking.hostName}-vm ${configuration.config.system.build.vm}/bin/run-${configuration.config.networking.hostName}-vm
@ -131,5 +153,15 @@
}; };
}); });
in { in {
inherit lib mkConfigurations mkVmApps supportedSystems formatApp formatter mkDevShell checkFormatting; inherit
androidImages
checkFormatting
formatApp
formatter
lib
mkDevShell
mkVmApps
nixosConfigurations
supportedSystems
;
} }