From d3d2f6bf5ecc8e4b4e1ab5f332393e550aed5b66 Mon Sep 17 00:00:00 2001 From: clerie Date: Sun, 25 Aug 2024 14:37:20 +0200 Subject: [PATCH] Build for aarch64-linux --- flake.nix | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/flake.nix b/flake.nix index 56ed915..e48fd0d 100644 --- a/flake.nix +++ b/flake.nix @@ -2,12 +2,12 @@ inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; }; - outputs = { self, nixpkgs, ... }: { - packages.x86_64-linux = let - pkgs = import nixpkgs { - system = "x86_64-linux"; - }; - in { + outputs = { self, nixpkgs, ... }: let + forAllSystems = f: (nixpkgs.lib.genAttrs [ "x86_64-linux" "aarch64-linux" ] (system: let + pkgs = import nixpkgs { inherit system; }; + in f { inherit pkgs system; } )); + in { + packages = forAllSystems ({ pkgs, system, ... }: { nixos-exporter = pkgs.rustPlatform.buildRustPackage rec { pname = "nixos-exporter"; version = "0.6.0"; @@ -25,20 +25,20 @@ cargoLock.lockFile = ./Cargo.lock; }; - default = self.packages.x86_64-linux.nixos-exporter; - }; + default = self.packages."${system}".nixos-exporter; + }); - apps.x86_64-linux = { + apps = forAllSystems ({ pkgs, system, ... }: { nixos-exporter = { type = "app"; - program = self.packages.x86_64-linux.nixos-exporter + "/bin/nixos-exporter"; + program = self.packages."${system}".nixos-exporter + "/bin/nixos-exporter"; }; nixos-validator = { type = "app"; - program = self.packages.x86_64-linux.nixos-exporter + "/bin/nixos-validator"; + program = self.packages."${system}".nixos-exporter + "/bin/nixos-validator"; }; - default = self.apps.x86_64-linux.nixos-exporter; - }; + default = self.apps."${system}".nixos-exporter; + }); nixosModules = { @@ -166,7 +166,8 @@ }; hydraJobs = { - packages.x86_64-linux.nixos-exporter = self.packages.x86_64-linux.nixos-exporter; + inherit (self) + packages; }; }; }