summaryrefslogtreecommitdiff
path: root/flake.nix
diff options
context:
space:
mode:
authorseth <[email protected]>2024-10-15 19:28:16 -0400
committerGitHub <[email protected]>2024-10-15 23:28:16 +0000
commit8b48cbd5010e3ce8c41406aafcd10b920a927102 (patch)
tree2402707e82a7afb4af39f37222afd0940f1422ff /flake.nix
parent08912b439bd61088dd849b9342a81341fa9e4a23 (diff)
tidy up (#328)
* nix: tidy up flake * ci: tidy up workflows * cleanup bindings
Diffstat (limited to 'flake.nix')
-rw-r--r--flake.nix101
1 files changed, 43 insertions, 58 deletions
diff --git a/flake.nix b/flake.nix
index 94b8099..26d6bfd 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,8 +9,13 @@
};
outputs =
- { parts, treefmt-nix, ... }@inputs:
- parts.lib.mkFlake { inherit inputs; } {
+ {
+ self,
+ nixpkgs,
+ treefmt-nix,
+ }:
+ let
+ inherit (nixpkgs) lib;
systems = [
"x86_64-linux"
"aarch64-linux"
@@ -23,63 +23,48 @@
"aarch64-darwin"
];
- imports = [ treefmt-nix.flakeModule ];
-
- perSystem =
- { self', pkgs, ... }:
- {
- devShells = {
- default = pkgs.mkShellNoCC {
- packages = with pkgs; [
- # node
- nodejs_20
- corepack_20
- wrangler
- nrr
- typescript-language-server
- vscode-langservers-extracted # for eslint server
+ 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;
+ });
- # github actions
- actionlint
+ devShells = forAllSystems (
+ system:
+ let
+ pkgs = nixpkgsFor.${system};
- # nix
- self'.formatter
- nil
- statix
- ];
+ basePackages = [
+ pkgs.nodejs
+ pkgs.corepack
- 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
- '';
+ pkgs.nrr
+ pkgs.wrangler
+ ];
+ in
+ {
+ default = pkgs.mkShellNoCC {
+ packages = basePackages ++ [
+ pkgs.typescript-language-server
+ pkgs.vscode-langservers-extracted # for eslint server
- packages = with pkgs; [
- nodejs_20
- corepack_20
- nrr
+ # github actions
+ pkgs.actionlint
- self'.formatter
- ];
- };
+ # nix
+ self.formatter.${system}
+ 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);
};
}