make flake generic over platform

This commit is contained in:
778a69cd 2023-11-06 17:56:12 +01:00
parent 4fb5be561f
commit a0b001576b

View file

@ -8,13 +8,22 @@
outputs = { self, nixpkgs, nix-filter }: outputs = { self, nixpkgs, nix-filter }:
let let
system = "x86_64-linux"; forAllSystems = f: nixpkgs.lib.genAttrs
pkgs = import nixpkgs { inherit system; }; [ "x86_64-linux" "aarch64-linux" ]
(system: f system);
nixpkgsFor = forAllSystems (
system:
import nixpkgs { inherit system; }
);
filter = nix-filter.lib; filter = nix-filter.lib;
in in
{ {
packages.x86_64-linux = { packages = forAllSystems (system:
let
pkgs = nixpkgsFor.${system};
in
{
mobilizon = pkgs.callPackage ./. { mobilizon = pkgs.callPackage ./. {
src = filter { src = filter {
root = ./.; root = ./.;
@ -38,9 +47,12 @@
${pkgs.mix2nix}/bin/mix2nix ./mix.lock > mix.nix ${pkgs.mix2nix}/bin/mix2nix ./mix.lock > mix.nix
''; '';
}; });
devShells.x86_64-linux.default = devShells = forAllSystems (system:
let pkgs = nixpkgsFor.${system};
in {
default =
pkgs.mkShell { pkgs.mkShell {
buildInputs = with pkgs; [ buildInputs = with pkgs; [
elixir elixir
@ -54,10 +66,11 @@
nodejs-18_x nodejs-18_x
]; ];
}; };
});
checks.x86_64-linux = { checks = forAllSystems (system: {
inherit (self.packages.x86_64-linux) mobilizon update; inherit (self.packages.${system}) mobilizon update;
}; });
lib = { lib = {
# Patch the logos in the source tree of a mobilizon-frontend package before building. # Patch the logos in the source tree of a mobilizon-frontend package before building.
@ -67,7 +80,6 @@
inherit (icons) logo favicon; inherit (icons) logo favicon;
in in
old: { old: {
nativeBuildInputs = (old.nativeBuildInputs or [ ]) ++ [ pkgs.imagemagick ];
postPatch = '' postPatch = ''
cp '${logo}' src/assets/logo.svg cp '${logo}' src/assets/logo.svg