feat: support multiple system architectures

This commit is contained in:
Mohammad Rafiq 2025-06-28 14:39:16 +08:00
parent 3b14c37a52
commit 9e1adfa944
No known key found for this signature in database
2 changed files with 16 additions and 22 deletions

18
flake.lock generated
View file

@ -18,23 +18,7 @@
}, },
"root": { "root": {
"inputs": { "inputs": {
"nixpkgs": "nixpkgs", "nixpkgs": "nixpkgs"
"systems": "systems"
}
},
"systems": {
"locked": {
"lastModified": 1689347949,
"narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=",
"owner": "nix-systems",
"repo": "default-linux",
"rev": "31732fcf5e8fea42e59c2488ad31a0e651500f68",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default-linux",
"type": "github"
} }
} }
}, },

View file

@ -1,17 +1,27 @@
{ {
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
inputs.systems.url = "github:nix-systems/default-linux";
outputs = outputs =
inputs: inputs:
let let
inherit (inputs.nixpkgs) lib legacyPackages; systems = [
forEachSystem = lib.genAttrs (import inputs.systems); "x86_64-linux"
"aarch64-linux"
];
inherit (builtins) map listToAttrs;
forAllSystems =
f:
listToAttrs (
map (system: {
name = system;
value = f system;
}) systems
);
in in
{ {
packages = forEachSystem ( packages = forAllSystems (
system: system:
let let
pkgs = legacyPackages.${system}; pkgs = inputs.nixpkgs.legacyPackages.${system};
in in
{ {
default = pkgs.callPackage ./nix/package.nix { }; default = pkgs.callPackage ./nix/package.nix { };