Skip to content

Commit

Permalink
Convert dev shell to flake
Browse files Browse the repository at this point in the history
  • Loading branch information
zombiezen committed Mar 6, 2023
1 parent 45fd8ca commit 683387f
Show file tree
Hide file tree
Showing 4 changed files with 95 additions and 7 deletions.
2 changes: 2 additions & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#shellcheck shell=bash
use flake
57 changes: 57 additions & 0 deletions flake.lock

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

27 changes: 27 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
description = "GitHub Action that configures the Nix package manager to read from (and optionally write to) a remote cache.";

inputs = {
nixpkgs.url = "nixpkgs";
flake-utils.url = "flake-utils";
flake-compat = {
url = "github:edolstra/flake-compat";
flake = false;
};
};

outputs = { self, nixpkgs, flake-utils, ... }@inputs:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; };
in {
packages.nodejs = pkgs.nodejs-16_x;

devShells.default = pkgs.mkShell {
packages = [
self.packages.${system}.nodejs
];
};
}
);
}
16 changes: 9 additions & 7 deletions shell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@
#
# SPDX-License-Identifier: Apache-2.0

{ pkgs ? import (fetchTarball "https://github.com/NixOS/nixpkgs/archive/0c408a087b4751c887e463e3848512c12017be25.tar.gz") {}
}:

with pkgs;
mkShell {
packages = [ pkgs.nodejs-16_x ];
}
let
lock = builtins.fromJSON (builtins.readFile ./flake.lock);
flakeCompatSource = fetchTarball {
url = "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz";
sha256 = lock.nodes.flake-compat.locked.narHash;
};
flakeCompat = import flakeCompatSource { src = ./.; };
in
flakeCompat.shellNix

0 comments on commit 683387f

Please sign in to comment.