summaryrefslogtreecommitdiff
path: root/flake.nix
diff options
context:
space:
mode:
authorseth <[email protected]>2024-10-12 14:28:54 -0400
committerseth <[email protected]>2024-10-12 14:59:04 -0400
commit6a2d9e752fab27b59da4f194b0ef6daf7e8b6d81 (patch)
treeed8f9f07861a0a4463dcd910baa349b6cc6656aa /flake.nix
parent08912b439bd61088dd849b9342a81341fa9e4a23 (diff)
port to deno
Diffstat (limited to 'flake.nix')
-rw-r--r--flake.nix113
1 files changed, 44 insertions, 69 deletions
diff --git a/flake.nix b/flake.nix
index 94b8099..3040e52 100644
--- a/flake.nix
+++ b/flake.nix
@@ -1,11 +1,6 @@
{
inputs = {
- nixpkgs.url = "nixpkgs/nixpkgs-unstable";
-
- parts = {
- url = "github:hercules-ci/flake-parts";
- inputs.nixpkgs-lib.follows = "nixpkgs";
- };
+ nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
treefmt-nix = {
url = "github:numtide/treefmt-nix";
@@ -14,72 +9,52 @@
};
outputs =
- { parts, treefmt-nix, ... }@inputs:
- parts.lib.mkFlake { inherit inputs; } {
- systems = [
- "x86_64-linux"
- "aarch64-linux"
- "x86_64-darwin"
- "aarch64-darwin"
- ];
-
- imports = [ treefmt-nix.flakeModule ];
-
- perSystem =
- { self', pkgs, ... }:
+ {
+ self,
+ nixpkgs,
+ treefmt-nix,
+ }:
+
+ let
+ inherit (nixpkgs) lib;
+ systems = lib.systems.flakeExposed;
+
+ forAllSystems = lib.genAttrs systems;
+ nixpkgsFor = forAllSystems (system: nixpkgs.legacyPackages.${system});
+ treefmtFor = forAllSystems (system: treefmt-nix.lib.evalModule nixpkgsFor.${system} ./treefmt.nix);
+ in
+ {
+ checks = forAllSystems (system: {
+ treefmt = treefmtFor.${system}.config.build.check self;
+ });
+
+ devShells = forAllSystems (
+ system:
+ let
+ pkgs = nixpkgsFor.${system};
+
+ basePackages = [
+ pkgs.deno
+ ];
+ in
{
- devShells = {
- default = pkgs.mkShellNoCC {
- packages = with pkgs; [
- # node
- nodejs_20
- corepack_20
- wrangler
- nrr
- typescript-language-server
- vscode-langservers-extracted # for eslint server
-
- # github actions
- actionlint
-
- # nix
- self'.formatter
- nil
- statix
- ];
-
- env = {
- # https://github.com/NixOS/nixpkgs/pull/330808
- SSL_CERT_FILE = "${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt";
- };
- };
-
- ci = pkgs.mkShellNoCC {
- shellHook = ''
- corepack install
- '';
-
- packages = with pkgs; [
- nodejs_20
- corepack_20
- nrr
-
- self'.formatter
- ];
- };
+ default = pkgs.mkShellNoCC {
+ packages = basePackages ++ [
+ # CI Tools
+ pkgs.actionlint
+
+ # Nix Tools
+ self.formatter.${system}
+ pkgs.deadnix
+ pkgs.nil
+ pkgs.statix
+ ];
};
- treefmt = {
- projectRootFile = ".git/config";
+ ci = pkgs.mkShellNoCC { packages = basePackages; };
+ }
+ );
- programs = {
- actionlint.enable = true;
- deadnix.enable = true;
- nixfmt.enable = true;
- prettier.enable = true;
- statix.enable = true;
- };
- };
- };
+ formatter = forAllSystems (system: treefmtFor.${system}.config.build.wrapper);
};
}