diff --git a/flake.lock b/flake.lock index 416c5c2..5a30943 100644 --- a/flake.lock +++ b/flake.lock @@ -1,12 +1,30 @@ { "nodes": { + "flake-parts": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib" + }, + "locked": { + "lastModified": 1736143030, + "narHash": "sha256-+hu54pAoLDEZT9pjHlqL9DNzWz0NbUn8NEAHP7PQPzU=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "b905f6fc23a9051a6e1b741e1438dbfc0634c6de", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, "nixpkgs": { "locked": { - "lastModified": 1737062831, - "narHash": "sha256-Tbk1MZbtV2s5aG+iM99U8FqwxU/YNArMcWAv6clcsBc=", + "lastModified": 1737885589, + "narHash": "sha256-Zf0hSrtzaM1DEz8//+Xs51k/wdSajticVrATqDrfQjg=", "owner": "nixos", "repo": "nixpkgs", - "rev": "5df43628fdf08d642be8ba5b3625a6c70731c19c", + "rev": "852ff1d9e153d8875a83602e03fdef8a63f0ecf8", "type": "github" }, "original": { @@ -16,8 +34,21 @@ "type": "github" } }, + "nixpkgs-lib": { + "locked": { + "lastModified": 1735774519, + "narHash": "sha256-CewEm1o2eVAnoqb6Ml+Qi9Gg/EfNAxbRx1lANGVyoLI=", + "type": "tarball", + "url": "https://github.com/NixOS/nixpkgs/archive/e9b51731911566bbf7e4895475a87fe06961de0b.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://github.com/NixOS/nixpkgs/archive/e9b51731911566bbf7e4895475a87fe06961de0b.tar.gz" + } + }, "root": { "inputs": { + "flake-parts": "flake-parts", "nixpkgs": "nixpkgs" } } diff --git a/flake.nix b/flake.nix index dca2497..4d20974 100644 --- a/flake.nix +++ b/flake.nix @@ -3,29 +3,36 @@ inputs = { nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable"; + flake-parts.url = "github:hercules-ci/flake-parts"; }; - outputs = { self, nixpkgs }: - let - pkgs = nixpkgs.legacyPackages.x86_64-linux; - pulumiBundle = pkgs.stdenv.mkDerivation { - name = "pulumi-bundle"; - phases = [ "installPhase" "fixupPhase" ]; - buildInputs = with pkgs; [ pulumi pulumiPackages.pulumi-language-go ]; - installPhase = '' - mkdir -p $out/bin - mkdir -p $out/share - cp ${pkgs.pulumi}/bin/* $out/bin/ - cp -r ${pkgs.pulumi}/share $out/share - cp ${pkgs.pulumiPackages.pulumi-language-go}/bin/* $out/bin/ - ''; - }; - in - { - formatter.x86_64-linux = pkgs.nixpkgs-fmt; - devShells.x86_64-linux.default = pkgs.mkShell { - # Note that Go is not provided, because it does not behave correctly inside a Nix shell. - packages = [ pulumiBundle ]; + outputs = inputs @ { self, nixpkgs, flake-parts }: + flake-parts.lib.mkFlake { inherit inputs; } + { + # systems that this flake can be used on + systems = [ "aarch64-darwin" "x86_64-linux" ]; + + perSystem = { config, pkgs, system, ... }: + let + pulumiBundle = pkgs.stdenv.mkDerivation { + name = "pulumi-bundle"; + phases = [ "installPhase" "fixupPhase" ]; + buildInputs = with pkgs; [ pulumi pulumiPackages.pulumi-language-go ]; + installPhase = '' + mkdir -p $out/bin + mkdir -p $out/share + cp ${pkgs.pulumi}/bin/* $out/bin/ + cp -r ${pkgs.pulumi}/share $out/share + cp ${pkgs.pulumiPackages.pulumi-language-go}/bin/* $out/bin/ + ''; + }; + in + { + formatter = pkgs.nixpkgs-fmt; + devShells.default = pkgs.mkShell { + # Note that Go is not provided, because it does not behave correctly inside a Nix shell. + packages = [ pulumiBundle ]; + }; + }; }; - }; }