From d83955f001ecbeeb2dc30cd9fe8d4fe640740f67 Mon Sep 17 00:00:00 2001 From: Tim Schubert Date: Sun, 10 Aug 2025 21:39:42 +0200 Subject: [PATCH] fix: make flake work for aarch64 and darwin --- flake.lock | 8 ++++---- flake.nix | 43 ++++++++++++++++++++++++++++++++++++------- 2 files changed, 40 insertions(+), 11 deletions(-) diff --git a/flake.lock b/flake.lock index 6005341..43f5d18 100644 --- a/flake.lock +++ b/flake.lock @@ -2,16 +2,16 @@ "nodes": { "nixpkgs": { "locked": { - "lastModified": 1754498491, - "narHash": "sha256-erbiH2agUTD0Z30xcVSFcDHzkRvkRXOQ3lb887bcVrs=", + "lastModified": 1754800730, + "narHash": "sha256-HfVZCXic9XLBgybP0318ym3cDnGwBs/+H5MgxFVYF4I=", "owner": "nixos", "repo": "nixpkgs", - "rev": "c2ae88e026f9525daf89587f3cbee584b92b6134", + "rev": "641d909c4a7538f1539da9240dedb1755c907e40", "type": "github" }, "original": { "owner": "nixos", - "ref": "nixos-unstable", + "ref": "nixpkgs-unstable", "repo": "nixpkgs", "type": "github" } diff --git a/flake.nix b/flake.nix index 1a30095..63c90c1 100644 --- a/flake.nix +++ b/flake.nix @@ -1,13 +1,42 @@ { - description = "Repo RS"; + description = "repo-rs"; inputs = { - nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable"; + nixpkgs.url = "github:nixos/nixpkgs?ref=nixpkgs-unstable"; }; - outputs = { self, nixpkgs }: { - devShells.x86_64-linux.default = import ./shell.nix { pkgs = nixpkgs.legacyPackages.x86_64-linux; }; - packages.x86_64-linux.repo-rs = nixpkgs.legacyPackages.x86_64-linux.callPackage ./. { }; - packages.x86_64-linux.default = self.packages.x86_64-linux.repo-rs; - }; + outputs = + { self, nixpkgs }: + let + systems = [ + "aarch64-darwin" + "aarch64-linux" + "x86_64-darwin" + "x86_64-linux" + ]; + eachSystem = + f: + nixpkgs.lib.genAttrs systems ( + system: + f rec { + inherit system; + pkgs = nixpkgs.legacyPackages.${system}; + } + ); + in + { + devShells = eachSystem ( + { pkgs, ... }: + { + default = import ./shell.nix { inherit pkgs; }; + } + ); + packages = eachSystem ( + { pkgs, system, ... }: + { + repo-rs = pkgs.callPackage ./. { }; + default = self.packages.${system}.repo-rs; + } + ); + }; }