Skip to content

Commit

Permalink
feat(flake): use flake-parts
Browse files Browse the repository at this point in the history
  • Loading branch information
ryand56 committed Aug 25, 2024
1 parent 2e3e155 commit 2f73783
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 31 deletions.
21 changes: 21 additions & 0 deletions flake.lock

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

64 changes: 33 additions & 31 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -1,38 +1,40 @@
{
description = "Wrangler, the CLI for Cloudflare Workers, packaged as a nix flake";
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";

inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
flake-parts = {
url = "github:hercules-ci/flake-parts";
inputs.nixpkgs-lib.follows = "nixpkgs";
};
};

outputs =
{ self, nixpkgs }:
let
supportedSystems = [ "x86_64-linux" ];
forEachSupportedSystem =
f: nixpkgs.lib.genAttrs supportedSystems (system: f { pkgs = import nixpkgs { inherit system; }; });
in
{
packages = forEachSupportedSystem (
{ pkgs }:
let
wrangler = pkgs.callPackage ./pkgs/wrangler/package.nix { };
in
{
inherit wrangler;
default = wrangler;
}
);
inputs@{ self, flake-parts, ... }:
flake-parts.lib.mkFlake { inherit inputs; } (
{ lib, ... }:
{
systems = [ "x86_64-linux" ];

devShells = forEachSupportedSystem (
{ pkgs }:
{
default = pkgs.mkShell { packages = with pkgs; [ nixfmt-rfc-style ]; };
}
);
perSystem =
{
self',
pkgs,
system,
...
}:
rec {
packages = rec {
wrangler = pkgs.callPackage ./pkgs/wrangler/package.nix { };
default = wrangler;
};

checks =
let
packages = self.packages;
devShells = self.devShells;
in
packages // devShells;
};
devShells = {
default = pkgs.mkShell { packages = [ pkgs.nixfmt-rfc-style ]; };
};

checks = packages // devShells;
};
}
);
}

0 comments on commit 2f73783

Please sign in to comment.