From b4197e9b95ce718b12c5deb85e89cd4afe266979 Mon Sep 17 00:00:00 2001 From: Skyler Grey Date: Sun, 22 May 2022 21:00:40 +0100 Subject: [PATCH] Let flake run under all systems --- flake.nix | 42 +++++++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/flake.nix b/flake.nix index 0553d47..fc480e8 100644 --- a/flake.nix +++ b/flake.nix @@ -4,26 +4,30 @@ outputs = { self, nixpkgs }: let system = "x86_64-linux"; - pkgs = import nixpkgs { - inherit system; - }; + forAllSystems = f: nixpkgs.lib.genAttrs nixpkgs.lib.systems.supported.hydra (system: f system); in rec { - packages."${system}".pridefetch = pkgs.stdenv.mkDerivation { - name = "pridefetch"; - buildInputs = [ - (pkgs.python39.withPackages (pythonPackages: with pythonPackages; [ - distro - ])) - ]; - unpackPhase = "true"; - installPhase = '' - mkdir -p $out/bin - cp ${./pridefetch} $out/bin/pridefetch - cp ${./packages.py} $out/bin/packages.py - chmod +x $out/bin/pridefetch - ''; - }; + packages = forAllSystems (system: let + pkgs = import nixpkgs { + inherit system; + }; + in { + pridefetch = pkgs.stdenv.mkDerivation { + name = "pridefetch"; + buildInputs = [ + (pkgs.python39.withPackages (pythonPackages: with pythonPackages; [ + distro + ])) + ]; + unpackPhase = "true"; + installPhase = '' + mkdir -p $out/bin + cp ${./pridefetch} $out/bin/pridefetch + cp ${./packages.py} $out/bin/packages.py + chmod +x $out/bin/pridefetch + ''; + }; + }); - defaultPackage."${system}" = packages."${system}".pridefetch; + defaultPackage = forAllSystems (system: self.packages.${system}.pridefetch); }; }