diff --git a/flake.nix b/flake.nix index 0a38d3a8..64e8e2c2 100644 --- a/flake.nix +++ b/flake.nix @@ -12,6 +12,11 @@ inputs.nixpkgs.follows = "nixpkgs"; }; + gitignore = { + url = "github:hercules-ci/gitignore.nix"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable-small"; pre-commit-hooks = { @@ -21,7 +26,7 @@ }; poetry2nix = { - url = "github:nix-community/poetry2nix"; + url = "github:cpcloud/poetry2nix/remove-bootstrap-poetry"; inputs.nixpkgs.follows = "nixpkgs"; inputs.flake-utils.follows = "flake-utils"; }; @@ -85,9 +90,9 @@ gitignore.overlay poetry2nix.overlay (pkgs: super: { - prettierTOML = pkgs.writeShellScriptBin "prettier" '' - ${pkgs.nodePackages.prettier}/bin/prettier \ - --plugin-search-dir "${pkgs.nodePackages.prettier-plugin-toml}/lib" \ + prettierTOML = pkgs.pkgsBuildBuild.writeShellScriptBin "prettier" '' + ${pkgs.pkgsBuildBuild.nodePackages.prettier}/bin/prettier \ + --plugin-search-dir "${pkgs.pkgsBuildBuild.nodePackages.prettier-plugin-toml}/lib" \ "$@" ''; protoletariatDevEnv = pkgs.protoletariatDevEnv310; @@ -154,12 +159,16 @@ [ "37" "38" "39" "310" ] ))) ]; - } // (flake-utils.lib.eachDefaultSystem (system: + } // (flake-utils.lib.eachDefaultSystem (localSystem: let - pkgs = import nixpkgs { - inherit system; + legacyPkgs = nixpkgs.legacyPackages.${localSystem}; + attrs = { + inherit localSystem; overlays = [ self.overlay ]; + } // legacyPkgs.lib.optionalAttrs (!legacyPkgs.stdenv.isDarwin) { + crossSystem = nixpkgs.lib.systems.examples.musl64 // { useLLVM = true; }; }; + pkgs = import nixpkgs attrs; inherit (pkgs) lib; in rec { @@ -177,7 +186,7 @@ }; defaultApp = apps.protoletariat; - packages.protoletariat-image = pkgs.dockerTools.buildLayeredImage { + packages.protoletariat-image = pkgs.pkgsBuildBuild.dockerTools.buildLayeredImage { name = "protoletariat"; config = { Entrypoint = [ defaultApp.program ]; @@ -186,22 +195,22 @@ }; checks = { - pre-commit-check = pre-commit-hooks.lib.${system}.run { + pre-commit-check = pre-commit-hooks.lib.${localSystem}.run { src = ./.; hooks = { nix-linter = { enable = true; - entry = lib.mkForce "${pkgs.nix-linter}/bin/nix-linter"; + entry = lib.mkForce "${pkgs.pkgsBuildBuild.nix-linter}/bin/nix-linter"; }; nixpkgs-fmt = { enable = true; - entry = lib.mkForce "${pkgs.nixpkgs-fmt}/bin/nixpkgs-fmt --check"; + entry = lib.mkForce "${pkgs.pkgsBuildBuild.nixpkgs-fmt}/bin/nixpkgs-fmt --check"; }; prettier = { enable = true; - entry = lib.mkForce "${pkgs.prettierTOML}/bin/prettier --check"; + entry = lib.mkForce "${pkgs.pkgsBuildBuild.prettierTOML}/bin/prettier --check"; types_or = [ "json" "markdown" "toml" "yaml" ]; }; @@ -238,10 +247,11 @@ }; }; - devShell = pkgs.mkShell { - nativeBuildInputs = with pkgs; [ + devShell = pkgs.pkgsBuildBuild.mkShell { + nativeBuildInputs = with pkgs.pkgsBuildBuild; [ buf commitizen + dive grpc poetry prettierTOML @@ -249,7 +259,7 @@ protoletariatDevEnv ]; - inherit (self.checks.${system}.pre-commit-check) shellHook; + inherit (self.checks.${localSystem}.pre-commit-check) shellHook; }; })); }