diff --git a/flake.lock b/flake.lock index 4f4c7c6..5c7c366 100644 --- a/flake.lock +++ b/flake.lock @@ -5,11 +5,11 @@ "systems": "systems" }, "locked": { - "lastModified": 1701680307, - "narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=", + "lastModified": 1709126324, + "narHash": "sha256-q6EQdSeUZOG26WelxqkmR7kArjgWCdw5sfJVHPH/7j8=", "owner": "numtide", "repo": "flake-utils", - "rev": "4022d587cbbfd70fe950c1e2083a02621806a725", + "rev": "d465f4819400de7c8d874d50b982301f28a84605", "type": "github" }, "original": { @@ -20,16 +20,16 @@ }, "nixpkgs": { "locked": { - "lastModified": 1703438236, - "narHash": "sha256-aqVBq1u09yFhL7bj1/xyUeJjzr92fXVvQSSEx6AdB1M=", + "lastModified": 1709780214, + "narHash": "sha256-p4iDKdveHMhfGAlpxmkCtfQO3WRzmlD11aIcThwPqhk=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "5f64a12a728902226210bf01d25ec6cbb9d9265b", + "rev": "f945939fd679284d736112d3d5410eb867f3b31c", "type": "github" }, "original": { "owner": "NixOS", - "ref": "nixos-unstable", + "ref": "nixpkgs-unstable", "repo": "nixpkgs", "type": "github" } @@ -63,11 +63,11 @@ ] }, "locked": { - "lastModified": 1702979157, - "narHash": "sha256-RnFBbLbpqtn4AoJGXKevQMCGhra4h6G2MPcuTSZZQ+g=", + "lastModified": 1709546977, + "narHash": "sha256-R0bi8zAWt1s1q7lSvwiFI8+kEL29rm4WtYTqPgjlEBs=", "owner": "numtide", "repo": "treefmt-nix", - "rev": "2961375283668d867e64129c22af532de8e77734", + "rev": "e7a277c5d12bf570efa2427d9cfdb760b9a0512f", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 7744945..f714820 100644 --- a/flake.nix +++ b/flake.nix @@ -8,7 +8,7 @@ description = "folliehiyuki's infrastructure configuration"; inputs = { - nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; flake-utils.url = "github:numtide/flake-utils"; treefmt-nix = { @@ -20,75 +20,29 @@ outputs = { self, nixpkgs, flake-utils, treefmt-nix, ... }: flake-utils.lib.eachDefaultSystem (system: let - inherit (nixpkgs) lib; - inherit (flake-utils.lib) mkApp; pkgs = nixpkgs.legacyPackages."${system}"; treefmtEval = treefmt-nix.lib.evalModule pkgs ./treefmt.nix; shellHook = '' export NIX_CONFIG="experimental-features = nix-command flakes" - export GOTOOLCHAIN=local export PULUMI_SKIP_UPDATE_CHECK=true export PULUMI_AUTOMATION_API_SKIP_VERSION_CHECK=true ''; pulumiInputs = with pkgs; [ - go + nodejs-slim + nodePackages.pnpm pulumi pulumiPackages.pulumi-language-nodejs ]; - - # `pulumi up` -> nix run .#up: - # `pulumi preview` -> nix run .#plan: - targets.pulumi = - let - pulumiStacks = builtins.attrNames (lib.filterAttrs - (key: value: value == "directory") - (builtins.readDir ./stacks)); - - pulumiCommands = { - plan = "pulumi preview --diff"; - up = "pulumi up --show-replacement-steps"; - }; - in - lib.concatMapAttrs - (name: value: lib.mapAttrs' - (key: val: - lib.nameValuePair (name + ":" + key) val) - value) - (lib.mapAttrs - (key: command: lib.genAttrs - pulumiStacks - (stack: mkApp { - drv = pkgs.writeShellApplication { - name = key + "-" + stack; - runtimeInputs = pulumiInputs; - text = '' - ${shellHook} - cd ./stacks/${stack} - pulumi login file:///home/follie/.local/share/pulumi - pulumi stack select ${stack} - ${command} - ''; - }; - }) - ) - pulumiCommands); in { - apps = lib.foldr (a: b: a // b) { } (lib.attrValues targets); - checks = with pkgs; { treefmt = treefmtEval.config.build.check self; ansible-lint = writeShellScriptBin "ansible-lint" '' ${ansible-lint}/bin/ansible-lint ./playbooks/ ''; - golangci-lint = writeShellApplication { - name = "golangci-lint"; - runtimeInputs = [ go ]; - text = "${golangci-lint}/bin/golangci-lint run"; - }; license = writeShellScriptBin "reuse-lint" '' ${reuse}/bin/reuse lint ''; diff --git a/nx.json b/nx.json index 609c911..5613a74 100644 --- a/nx.json +++ b/nx.json @@ -1,20 +1,14 @@ { "$schema": "./node_modules/nx/schemas/nx-schema.json", - "plugins": [ - "@nx-extend/pulumi" - ], + "plugins": ["@nx-extend/pulumi"], "targetDefaults": { "preview": { "executor": "@nx-extend/pulumi:preview", - "dependsOn": [ - "res:build" - ] + "dependsOn": ["res:build"] }, "up": { "executor": "@nx-extend/pulumi:up", - "dependsOn": [ - "res:build" - ] + "dependsOn": ["res:build"] }, "refresh": { "executor": "@nx-extend/pulumi:refresh", @@ -25,18 +19,12 @@ "res:build": { "cache": true, "executor": "nx:run-commands", - "dependsOn": [ - "^res:build" - ], + "dependsOn": ["^res:build"], "options": { - "commands": [ - "rescript build" - ], + "commands": ["rescript build"], "cwd": "{projectRoot}" }, - "inputs": [ - "{projectRoot}/src/**/*.res" - ], + "inputs": ["{projectRoot}/src/**/*.res"], "outputs": [ "{projectRoot}/src/**/*.res.js", "{projectRoot}/src/**/*.gen.tsx" @@ -45,18 +33,14 @@ "res:clean": { "executor": "nx:run-commands", "options": { - "commands": [ - "rescript clean" - ], + "commands": ["rescript clean"], "cwd": "{projectRoot}" } }, "res:dev": { "executor": "nx:run-commands", "options": { - "commands": [ - "rescript -w" - ], + "commands": ["rescript -w"], "cwd": "{projectRoot}" } } diff --git a/package.json b/package.json index 9b100ef..189ded8 100644 --- a/package.json +++ b/package.json @@ -1,11 +1,11 @@ { - "name": "infra", - "private": true, - "devDependencies": { - "@nx-extend/pulumi": "^5.0.4", - "@nx/js": "^18.0.7", - "@nx/workspace": "^18.0.7", - "nx": "^18.0.7" - } + "name": "infra", + "private": true, + "devDependencies": { + "@nx-extend/pulumi": "^5.0.4", + "@nx/js": "^18.0.7", + "@nx/workspace": "^18.0.7", + "nx": "^18.0.7" + } } diff --git a/stacks/cloudflare/package.json b/stacks/cloudflare/package.json index 98df56c..2d4aa06 100644 --- a/stacks/cloudflare/package.json +++ b/stacks/cloudflare/package.json @@ -8,9 +8,7 @@ "rescript": "^11.0.1" }, "nx": { - "implicitDependencies": [ - "shared" - ], + "implicitDependencies": ["shared"], "targets": { "preview": { "options": {