diff --git a/flake.nix b/flake.nix index f953aa7..5a8bc7e 100644 --- a/flake.nix +++ b/flake.nix @@ -1,32 +1,43 @@ { description = "swatch beat internet time"; + inputs.nixpkgs.url = github:Nixos/nixpkgs/nixos-20.03; + outputs = { self, nixpkgs }: { - overlay = final: prev: { - swatch = with final; self.defaultPackage.x86_64-linux; - }; - defaultPackage.x86_64-linux = - with import nixpkgs { system = "x86_64-linux"; }; - stdenv.mkDerivation rec { - name = "swatch-${version}"; - version = "1.0.0"; - meta = { - description = "Display the current swatch beats"; - longDescription = '' - Prints the current Swatch Internet Time. - Optional short form. + let + supportedSystems = [ "x86_64-linux" "i686-linux" "aarch64-linux" ]; + forAllSystems = + f: nixpkgs.lib.genAttrs supportedSystems (system: f system); + version = "1.0.0"; + in { + + overlay = final: prev: { + swatch = with final; let nix = final.nix; in stdenv.mkDerivation { + name = "swatch-${version}"; + buildInputs = [ gawk utillinux ]; + src = self; + installPhase = '' + mkdir -p $out/bin + cp ./swatch.sh $out/bin/swatch + chmod +x $out/bin/swatch ''; - homepage = https://github.com/techieAgnostic/swatch; - maintainers = [ "Shaun Kerr - s@p7.co.nz" ]; - platforms = stdenv.lib.platforms.all; + meta = { + description = "Display the current swatch beats"; + longDescription = '' + Prints the current Swatch Internet Time. + Optional short form. + ''; + homepage = https://github.com/techieAgnostic/swatch; + maintainers = [ "Shaun Kerr - s@p7.co.nz" ]; + platforms = stdenv.lib.platforms.all; + }; }; - src = self; - buildInputs = [ - gawk - utillinux - ]; - buildPhase = "cp ./swatch.sh ./swatch"; - installPhase = "mkdir -p $out/bin; install -t $out/bin swatch"; }; + + defaultPackage = + forAllSystems (system: (import nixpkgs { + inherit system; + overlays = [ self.overlay nix.overlay ]; + }).swatch); }; }