From 74112e27cea97a9ae35194d8c281955f203df5f0 Mon Sep 17 00:00:00 2001 From: Erin <79354991+oati@users.noreply.github.com> Date: Mon, 23 Jan 2023 00:13:39 -0600 Subject: [PATCH] simplify flake dependencies --- flake.lock | 87 +++++------------------------------------------------- flake.nix | 70 ++++++++++++++++++++++--------------------- 2 files changed, 45 insertions(+), 112 deletions(-) diff --git a/flake.lock b/flake.lock index e0d317ee..fded32fa 100644 --- a/flake.lock +++ b/flake.lock @@ -1,106 +1,35 @@ { "nodes": { - "flake-parts": { - "inputs": { - "nixpkgs-lib": "nixpkgs-lib" - }, - "locked": { - "lastModified": 1673362319, - "narHash": "sha256-Pjp45Vnj7S/b3BRpZEVfdu8sqqA6nvVjvYu59okhOyI=", - "owner": "hercules-ci", - "repo": "flake-parts", - "rev": "82c16f1682cf50c01cb0280b38a1eed202b3fe9f", - "type": "github" - }, - "original": { - "owner": "hercules-ci", - "repo": "flake-parts", - "type": "github" - } - }, - "flake-utils": { - "locked": { - "lastModified": 1659877975, - "narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, "nixpkgs": { "locked": { - "lastModified": 1673947312, - "narHash": "sha256-xx/2nRwRy3bXrtry6TtydKpJpqHahjuDB5sFkQ/XNDE=", + "lastModified": 1673796341, + "narHash": "sha256-1kZi9OkukpNmOaPY7S5/+SlCDOuYnP3HkXHvNDyLQcc=", "owner": "nixos", "repo": "nixpkgs", - "rev": "2d38b664b4400335086a713a0036aafaa002c003", + "rev": "6dccdc458512abce8d19f74195bb20fdb067df50", "type": "github" }, "original": { "owner": "nixos", - "ref": "nixpkgs-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs-lib": { - "locked": { - "dir": "lib", - "lastModified": 1672350804, - "narHash": "sha256-jo6zkiCabUBn3ObuKXHGqqORUMH27gYDIFFfLq5P4wg=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "677ed08a50931e38382dbef01cba08a8f7eac8f6", - "type": "github" - }, - "original": { - "dir": "lib", - "owner": "NixOS", - "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs_2": { - "locked": { - "lastModified": 1665296151, - "narHash": "sha256-uOB0oxqxN9K7XGF1hcnY+PQnlQJ+3bP2vCn/+Ru/bbc=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "14ccaaedd95a488dd7ae142757884d8e125b3363", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixpkgs-unstable", "repo": "nixpkgs", + "rev": "6dccdc458512abce8d19f74195bb20fdb067df50", "type": "github" } }, "root": { "inputs": { - "flake-parts": "flake-parts", "nixpkgs": "nixpkgs", "rust-overlay": "rust-overlay" } }, "rust-overlay": { - "inputs": { - "flake-utils": "flake-utils", - "nixpkgs": "nixpkgs_2" - }, + "flake": false, "locked": { - "lastModified": 1674095406, - "narHash": "sha256-RexH/1rZTiX4OhdYkuJP3MuANJ+JRgoLKL60iHm//T0=", + "lastModified": 1674440843, + "narHash": "sha256-kMCGL1wADpbcgGiMgj1pcOxbLy2zfmzsn46YCMWwtIE=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "5f7315b9800e2e500e6834767a57e39f7dbfd495", + "rev": "57b363f390f031b8b8d26235c2d21b0ad5a84640", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 45ee4975..509c31db 100644 --- a/flake.nix +++ b/flake.nix @@ -2,41 +2,47 @@ description = "Apple M1 support for NixOS"; inputs = { - nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; - rust-overlay.url = "github:oxalica/rust-overlay"; - flake-parts.url = "github:hercules-ci/flake-parts"; + nixpkgs = { + # https://hydra.nixos.org/jobset/mobile-nixos/unstable/evals + # these evals have a cross-compiled stdenv available + url = "github:nixos/nixpkgs/6dccdc458512abce8d19f74195bb20fdb067df50"; + }; + + rust-overlay = { + url = "github:oxalica/rust-overlay"; + flake = false; + }; }; - outputs = { self, flake-parts, ... }@inputs: - flake-parts.lib.mkFlake { inherit inputs; } ( - { withSystem, ... }: { - flake = { - overlays = rec { - asahi-overlay = import packages/overlay.nix; - default = asahi-overlay; - }; + outputs = { self, ... }@inputs: + let + # build platforms supported for uboot in nixpkgs + systems = [ "aarch64-linux" "x86_64-linux" ]; # "i686-linux" omitted - nixosModules = rec { - m1-support = ./nixos-module; - default = m1-support; - }; + forAllSystems = inputs.nixpkgs.lib.genAttrs systems; + in + { + overlays = rec { + asahi-overlay = import packages/overlay.nix; + default = asahi-overlay; }; - # build platforms supported for uboot in nixpkgs - systems = [ "aarch64-linux" "x86_64-linux" "i686-linux" ]; - - perSystem = { system, pkgs, ... }: { - # override the `pkgs` argument used by flake-parts modules - _module.args.pkgs = import inputs.nixpkgs { - crossSystem.system = "aarch64-linux"; - localSystem.system = system; - overlays = [ - inputs.rust-overlay.overlays.default - self.overlays.default - ]; - }; + nixosModules = rec { + m1-support = ./nixos-module; + default = m1-support; + }; - packages = { + packages = forAllSystems (system: + let + pkgs = import inputs.nixpkgs { + crossSystem.system = "aarch64-linux"; + localSystem.system = system; + overlays = [ + (import inputs.rust-overlay) + self.overlays.default + ]; + }; + in { inherit (pkgs) m1n1 uboot-asahi; installer-bootstrap = @@ -62,8 +68,6 @@ ]; }; in installer-system.config.system.build.isoImage; - }; - }; - } - ); + }); + }; }