feat: nix package, overlay and devshell use the quickemu FlakeHub flake

This commit is contained in:
Martin Wimpress 2024-07-02 01:50:25 +01:00 committed by Martin Wimpress
parent a5a4c7cd11
commit 3f8be1bfc0
2 changed files with 69 additions and 25 deletions

View File

@ -14,24 +14,59 @@
"url": "https://flakehub.com/f/DeterminateSystems/flake-schemas/%2A.tar.gz" "url": "https://flakehub.com/f/DeterminateSystems/flake-schemas/%2A.tar.gz"
} }
}, },
"nixpkgs": { "flake-schemas_2": {
"locked": { "locked": {
"lastModified": 1719506693, "lastModified": 1697467827,
"narHash": "sha256-C8e9S7RzshSdHB7L+v9I51af1gDM5unhJ2xO1ywxNH8=", "narHash": "sha256-j8SR19V1SRysyJwpOBF4TLuAvAjF5t+gMiboN4gYQDU=",
"rev": "b2852eb9365c6de48ffb0dc2c9562591f652242a", "rev": "764932025c817d4e500a8d2a4d8c565563923d29",
"revCount": 644565, "revCount": 29,
"type": "tarball", "type": "tarball",
"url": "https://api.flakehub.com/f/pinned/NixOS/nixpkgs/0.1.644565%2Brev-b2852eb9365c6de48ffb0dc2c9562591f652242a/01906511-d0fc-7244-b596-2d790f5bfdb0/source.tar.gz" "url": "https://api.flakehub.com/f/pinned/DeterminateSystems/flake-schemas/0.1.2/018b3da8-4cc3-7fbb-8ff7-1588413c53e2/source.tar.gz"
}, },
"original": { "original": {
"type": "tarball", "type": "tarball",
"url": "https://flakehub.com/f/NixOS/nixpkgs/0.1.%2A.tar.gz" "url": "https://flakehub.com/f/DeterminateSystems/flake-schemas/%2A.tar.gz"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1717952948,
"narHash": "sha256-mJi4/gjiwQlSaxjA6AusXBN/6rQRaPCycR7bd8fydnQ=",
"rev": "2819fffa7fa42156680f0d282c60d81e8fb185b7",
"revCount": 631440,
"type": "tarball",
"url": "https://api.flakehub.com/f/pinned/NixOS/nixpkgs/0.2405.631440%2Brev-2819fffa7fa42156680f0d282c60d81e8fb185b7/0190034c-678d-7039-b45c-fa38168f2500/source.tar.gz"
},
"original": {
"type": "tarball",
"url": "https://flakehub.com/f/NixOS/nixpkgs/%2A.tar.gz"
}
},
"quickemu": {
"inputs": {
"flake-schemas": "flake-schemas_2",
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1719316513,
"narHash": "sha256-9EQMWByMD0K0mRFKO+CtTFRWREaePB6xU6jBmtVhF3U=",
"rev": "1c89f520f2c7d10cc9cc1d15b8cae32215359224",
"revCount": 1992,
"type": "tarball",
"url": "https://api.flakehub.com/f/pinned/quickemu-project/quickemu/4.9.5/01904f50-5263-7e22-b58e-a1dae34d5486/source.tar.gz"
},
"original": {
"type": "tarball",
"url": "https://flakehub.com/f/quickemu-project/quickemu/%2A.tar.gz"
} }
}, },
"root": { "root": {
"inputs": { "inputs": {
"flake-schemas": "flake-schemas", "flake-schemas": "flake-schemas",
"nixpkgs": "nixpkgs" "nixpkgs": "nixpkgs",
"quickemu": "quickemu"
} }
} }
}, },

View File

@ -2,37 +2,46 @@
description = "Quickgui flake"; description = "Quickgui flake";
inputs = { inputs = {
flake-schemas.url = "https://flakehub.com/f/DeterminateSystems/flake-schemas/*.tar.gz"; flake-schemas.url = "https://flakehub.com/f/DeterminateSystems/flake-schemas/*.tar.gz";
nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.1.*.tar.gz"; nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/*.tar.gz";
quickemu.url = "https://flakehub.com/f/quickemu-project/quickemu/*.tar.gz";
quickemu.inputs.nixpkgs.follows = "nixpkgs";
}; };
outputs = { outputs = {
self, self,
flake-schemas, flake-schemas,
nixpkgs, nixpkgs,
quickemu,
}: let }: let
forAllSystems = function: # Define supported systems and a helper function for generating system-specific outputs
nixpkgs.lib.genAttrs [ #TODO: Add the following as quickemu/quickgui/GitHub builders support them:
"x86_64-linux" # aarch64-darwin aarch64-linux x86_64-darwin
# TODO: Enable when upstream supports these platforms supportedSystems = [ "x86_64-linux" ];
#"aarch64-linux"
#"x86_64-darwin" forEachSupportedSystem = f: nixpkgs.lib.genAttrs supportedSystems (system: f {
#"aarch64-darwin" system = system;
] (system: function nixpkgs.legacyPackages.${system}); pkgs = import nixpkgs { inherit system; };
});
in { in {
# Schemas tell Nix about the structure of your flake's outputs # Define schemas for the flake's outputs
schemas = flake-schemas.schemas; schemas = flake-schemas.schemas;
overlays.default = final: prev: { # Define overlays for each supported system
quickgui = final.callPackage ./package.nix {}; overlays = forEachSupportedSystem ({pkgs, system, ...}: {
}; default = final: prev: {
quickgui = final.callPackage ./package.nix { quickemu = quickemu.packages.${system}.default; };
};
});
packages = forAllSystems (pkgs: rec { # Define packages for each supported system
quickgui = pkgs.callPackage ./package.nix {}; packages = forEachSupportedSystem ({pkgs, system, ...}: rec {
quickgui = pkgs.callPackage ./package.nix { quickemu = quickemu.packages.${system}.default; };
default = quickgui; default = quickgui;
}); });
devShells = forAllSystems (pkgs: { # Define devShells for each supported system
default = pkgs.callPackage ./devshell.nix {}; devShells = forEachSupportedSystem ({pkgs, system, ...}: {
default = pkgs.callPackage ./devshell.nix { quickemu = quickemu.packages.${system}.default; };
}); });
}; };
} }