From 8f96fbb0c5369f111ecce660e714ca8267062359 Mon Sep 17 00:00:00 2001 From: truxnell <19149206+truxnell@users.noreply.github.com> Date: Mon, 18 Mar 2024 20:02:10 +1100 Subject: [PATCH] feat: add direnv shell --- .envrc | 1 + .gitignore | 1 + .pre-commit-config.yaml | 5 ----- shell.nix | 32 ++++++++++++-------------------- 4 files changed, 14 insertions(+), 25 deletions(-) create mode 100644 .envrc diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..1d953f4 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use nix diff --git a/.gitignore b/.gitignore index 44cc532..e023299 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ .mozilla **/*.tmp.sops.yaml result +.direnv diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 204d9a9..6e5d382 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -2,11 +2,6 @@ fail_fast: false repos: - - repo: https://github.com/kamadorueda/alejandra - rev: 3.0.0 - hooks: - - id: alejandra-system - - repo: https://github.com/adrienverge/yamllint rev: v1.32.0 hooks: diff --git a/shell.nix b/shell.nix index 459fe9c..0677706 100644 --- a/shell.nix +++ b/shell.nix @@ -1,26 +1,18 @@ -# Shell for bootstrapping flake-enabled nix and other tooling -{ - pkgs ? - # If pkgs is not defined, instanciate nixpkgs from locked commit - let - lock = - (builtins.fromJSON (builtins.readFile ./flake.lock)).nodes.nixpkgs.locked; +# Shell for bootstrapping flake-enabled nix and home-manager +{ pkgs ? let + # If pkgs is not defined, instantiate nixpkgs from locked commit + lock = (builtins.fromJSON (builtins.readFile ./flake.lock)).nodes.nixpkgs.locked; nixpkgs = fetchTarball { url = "https://github.com/nixos/nixpkgs/archive/${lock.rev}.tar.gz"; sha256 = lock.narHash; }; + system = builtins.currentSystem; + overlays = [ ]; # Explicit blank overlay to avoid interference in - import nixpkgs {overlays = [];}, - ... -}: -pkgs.mkShell { - NIX_CONFIG = "extra-experimental-features = nix-command flakes repl-flake"; - nativeBuildInputs = with pkgs; [ - nixpkgs-fmt - nil - sops - pre-commit - go-task - alejandra - ]; + import nixpkgs { inherit system overlays; } +, ... +}: pkgs.mkShell { + # Enable experimental features without having to specify the argument + NIX_CONFIG = "experimental-features = nix-command flakes"; + nativeBuildInputs = with pkgs; [ nix home-manager git nil nixpkgs-fmt go-task sops ]; }