summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSeth Flynn <[email protected]>2025-03-12 01:18:35 -0400
committerSeth Flynn <[email protected]>2025-03-12 20:26:38 -0400
commit6cf2d778397d8e21d9100589f35fb402fa9beb56 (patch)
treeb3287c2e5418446b22488041af44dc9ddc81c519
parentfa4eb3a1ab14173cf27be23c0fde71a4c73f974c (diff)
nix: flake.nix -> shell.nix
-rw-r--r--.github/workflows/eslint.yaml13
-rw-r--r--.github/workflows/update-flake.yaml49
-rw-r--r--ci-shell.nix18
-rw-r--r--flake.lock27
-rw-r--r--flake.nix57
-rw-r--r--shell.nix33
6 files changed, 59 insertions, 138 deletions
diff --git a/.github/workflows/eslint.yaml b/.github/workflows/eslint.yaml
index aee65e8..3dc7d56 100644
--- a/.github/workflows/eslint.yaml
+++ b/.github/workflows/eslint.yaml
@@ -47,18 +47,21 @@ jobs:
uses: actions/checkout@v4
- name: Install Nix
- uses: DeterminateSystems/nix-installer-action@v14
+ uses: cachix/install-nix-action@v31
+ with:
+ nix_path: nixpkgs=channel:nixos-unstable
- name: Install Dependencies
- run: nix develop .#ci --command pnpm install --frozen-lockfile
+ run: |
+ nix-shell ci-shell.nix --command 'pnpm install --frozen-lockfile'
- name: Run ESLint
continue-on-error: true
run: |
- nix develop .#ci --command \
- nrr lint \
+ nix-shell ci-shell.nix --command \
+ 'nrr lint \
--format @microsoft/eslint-formatter-sarif \
- --output-file /tmp/results.sarif
+ --output-file /tmp/results.sarif'
- name: Upload Results
uses: github/codeql-action/upload-sarif@v3
diff --git a/.github/workflows/update-flake.yaml b/.github/workflows/update-flake.yaml
deleted file mode 100644
index 4473811..0000000
--- a/.github/workflows/update-flake.yaml
+++ /dev/null
@@ -1,49 +0,0 @@
-name: Update flake.lock
-
-on:
- schedule:
- # run every saturday
- - cron: "0 0 * * 6"
- workflow_dispatch:
-
-jobs:
- update:
- name: Run update & create PR
-
- runs-on: ubuntu-latest
-
- steps:
- - name: Generate GitHub App token
- uses: actions/create-github-app-token@v1
- id: app-token
- with:
- app-id: ${{ vars.APP_ID }}
- private-key: ${{ secrets.PRIVATE_KEY }}
-
- - name: Checkout repository
- uses: actions/checkout@v4
- with:
- token: ${{ steps.app-token.outputs.token }}
-
- - name: Install Nix
- uses: DeterminateSystems/nix-installer-action@v14
-
- - name: Run update
- run: nix flake update
-
- - name: Create pull request
- id: pull-request
- uses: peter-evans/create-pull-request@v7
- with:
- branch: update-flake-lock
- commit-message: "nix: update flake.lock"
- title: "nix: update flake.lock"
- token: ${{ steps.app-token.outputs.token }}
- sign-commits: true
-
- - name: Enable auto-merge
- if: ${{ env.PR_ID != '' }}
- run: gh pr merge --auto --squash "$PR_ID"
- env:
- PR_ID: ${{ steps.pull-request.outputs.pull-request-number }}
- GH_TOKEN: ${{ steps.app-token.outputs.token }}
diff --git a/ci-shell.nix b/ci-shell.nix
new file mode 100644
index 0000000..0b18d3e
--- /dev/null
+++ b/ci-shell.nix
@@ -0,0 +1,18 @@
+{
+ pkgs ? import <nixpkgs> {
+ inherit system;
+ config = { };
+ overlays = [ ];
+ },
+ system ? builtins.currentSystem,
+}:
+
+let
+ inherit (pkgs) lib;
+in
+
+pkgs.mkShellNoCC {
+ packages = lib.attrValues {
+ inherit (pkgs) corepack nodejs nrr;
+ };
+}
diff --git a/flake.lock b/flake.lock
deleted file mode 100644
index 9e20410..0000000
--- a/flake.lock
+++ /dev/null
@@ -1,27 +0,0 @@
-{
- "nodes": {
- "nixpkgs": {
- "locked": {
- "lastModified": 1741310760,
- "narHash": "sha256-aizILFrPgq/W53Jw8i0a1h1GZAAKtlYOrG/A5r46gVM=",
- "owner": "NixOS",
- "repo": "nixpkgs",
- "rev": "de0fe301211c267807afd11b12613f5511ff7433",
- "type": "github"
- },
- "original": {
- "owner": "NixOS",
- "ref": "nixpkgs-unstable",
- "repo": "nixpkgs",
- "type": "github"
- }
- },
- "root": {
- "inputs": {
- "nixpkgs": "nixpkgs"
- }
- }
- },
- "root": "root",
- "version": 7
-}
diff --git a/flake.nix b/flake.nix
deleted file mode 100644
index 91983dc..0000000
--- a/flake.nix
+++ /dev/null
@@ -1,57 +0,0 @@
-{
- description = "Getchoo's website";
-
- inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
-
- outputs =
- {
- self,
- nixpkgs,
- }:
- let
- inherit (nixpkgs) lib;
- systems = lib.systems.flakeExposed;
-
- forAllSystems = lib.genAttrs systems;
- nixpkgsFor = forAllSystems (system: nixpkgs.legacyPackages.${system});
- in
- {
- devShells = forAllSystems (
- system:
- let
- pkgs = nixpkgsFor.${system};
-
- baseNodeTools = [
- pkgs.corepack
- pkgs.nodejs
- pkgs.nrr
- ];
- in
- {
- default = pkgs.mkShellNoCC {
- packages = baseNodeTools ++ [
- # Language servers
- pkgs.astro-language-server
- pkgs.typescript-language-server
- pkgs.vscode-langservers-extracted
-
- # For CI
- pkgs.actionlint
-
- # Nix tools
- pkgs.deadnix
- pkgs.nil
- pkgs.statix
- self.formatter.${system}
- ];
- };
-
- ci = pkgs.mkShellNoCC {
- packages = baseNodeTools;
- };
- }
- );
-
- formatter = forAllSystems (system: nixpkgsFor.${system}.nixfmt-rfc-style);
- };
-}
diff --git a/shell.nix b/shell.nix
new file mode 100644
index 0000000..735fe6a
--- /dev/null
+++ b/shell.nix
@@ -0,0 +1,33 @@
+{
+ pkgs ? import <nixpkgs> {
+ inherit system;
+ config = { };
+ overlays = [ ];
+ },
+ system ? builtins.currentSystem,
+}:
+
+let
+ inherit (pkgs) lib;
+ ci-shell = import ./ci-shell.nix { inherit pkgs; };
+in
+
+pkgs.mkShellNoCC {
+ packages =
+ lib.attrValues {
+ inherit (pkgs)
+ # Language servers
+ astro-language-server
+ typescript-language-server
+ vscode-langservers-extracted
+
+ # For CI
+ actionlint
+
+ # Nix tools
+ deadnix
+ statix
+ ;
+ }
+ ++ ci-shell.nativeBuildInputs;
+}