Skip to content

Commit

Permalink
chore: Add Nix support on macos
Browse files Browse the repository at this point in the history
  • Loading branch information
ThetaSinner committed Jan 29, 2025
1 parent 6942eb0 commit 33931f5
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 25 deletions.
37 changes: 34 additions & 3 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

51 changes: 29 additions & 22 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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 ];
};
};
};
};
}

0 comments on commit 33931f5

Please sign in to comment.