Drop support for dir-locals.nix, <nixpkgs>, etc.

In the spirit of Marie Kondo, I'm tidying up!

TL;DR:
- Prefer .envrc `use_nix` and delete all dir-locals.nix files
- Remove ~all references to <nixpkgs>, <unstable>, <depot> and prefer
  referencing each with briefcase.third_party.{pkgs,unstable,depot}
- Delete nixBufferFromShell function since I was only using that in
  dir-locals.nix files
This commit is contained in:
William Carroll 2020-08-18 12:00:17 +01:00
parent 51ec9e0d88
commit 0c71fc9d1d
55 changed files with 102 additions and 118 deletions

12
.envrc
View file

@ -1,10 +1,8 @@
export BRIEFCASE="$(realpath ~/briefcase)"
export DEPOT="$(realpath ~/depot)"
export NIXPKGS="$(realpath ~/nixpkgs)"
# I'm ensuring that $NIX_PATH is unset to avoid the anti-pattern of depending on
# <nixpkgs>, <briefcase>, <depot>, <unstable>.
# For more information about setting this to "", see:
export BRIEFCASE="$(realpath .)"
# I'm ensuring that $NIX_PATH is mostly empty, so that I only depend on
# <briefcase> for now.
# For more information on the NIX_PATH anti-pattern, see here:
# https://nix.dev/tutorials/towards-reproducibility-pinning-nixpkgs.html#pinning-nixpkgs
export NIX_PATH="";
export NIX_PATH="briefcase=$BRIEFCASE";
export DESKTOP="zeno.lon.corp.google.com";
export LAPTOP="seneca";

View file

@ -1 +1,2 @@
source_up
use_nix

View file

@ -0,0 +1,2 @@
source_up
use_nix

View file

@ -1,3 +0,0 @@
let
briefcase = import <briefcase> {};
in briefcase.utils.nixBufferFromShell ./shell.nix

View file

@ -1,5 +1,6 @@
let
pkgs = import <nixpkgs> {};
briefcase = import <briefcase> {};
pkgs = briefcase.third_party.pkgs;
in pkgs.mkShell {
buildInputs = with pkgs; [
leiningen

2
boilerplate/elm/.envrc Normal file
View file

@ -0,0 +1,2 @@
source_up
use_nix

View file

@ -1,3 +0,0 @@
let
briefcase = import <briefcase> {};
in briefcase.utils.nixBufferFromShell ./shell.nix

View file

@ -1,9 +1,10 @@
let
pkgs = import <nixpkgs> {};
briefcase = import <briefcase> {};
pkgs = briefcase.third_party.pkgs;
in pkgs.mkShell {
buildInputs = with pkgs; [
elmPackages.elm
elmPackages.elm-format
elmPackages.elm-live
buildInputs = with pkgs.elmPackages; [
elm
elm-format
elm-live
];
}

View file

@ -0,0 +1,2 @@
source_up
use_nix

View file

@ -1,3 +0,0 @@
let
briefcase = import <briefcase> {};
in briefcase.utils.nixBufferFromShell ./shell.nix

View file

@ -1,5 +1,6 @@
let
pkgs = import <nixpkgs> {};
briefcase = import <briefcase> {};
pkgs = briefcase.third_party.pkgs;
in pkgs.mkShell {
buildInputs = with pkgs; [
nodejs

View file

@ -2,9 +2,10 @@
# name: shell.nix boilerplate
# key: import
# --
with import <nixpkgs> {};
stdenv.mkDerivation {
let
briefcase = with import <briefcase> {};
pkgs = briefcase.third_party.pkgs;
in stdenv.mkDerivation {
name = "$1";
buildInputs = [
$2

View file

@ -59,7 +59,7 @@ This function was taken from @tazjin's depot and adapted for my monorepo.
(interactive "sAttribute: ")
(lexical-let* ((outbuf (get-buffer-create (format "*briefcase-out/%s*" attribute)))
(errbuf (get-buffer-create (format "*briefcase-errors/%s*" attribute)))
(expression (format "let depot = import <depot> {}; briefcase = import <briefcase> {}; in depot.nix.buildLisp.sbclWith [ briefcase.%s ]" attribute))
(expression (format "let briefcase = import <briefcase> {}; in briefcase.third_party.depot.nix.buildLisp.sbclWith [ briefcase.%s ]" attribute))
(command (list "nix-build" "-E" expression)))
(message "Acquiring Lisp for <briefcase>.%s" attribute)
(make-process :name (format "nix-build/%s" attribute)

View file

@ -1 +1,2 @@
source_up
use_nix

View file

@ -1,3 +0,0 @@
let
briefcase = import <briefcase> {};
in briefcase.utils.nixBufferFromShell ./shell.nix

View file

@ -1,9 +1,10 @@
let
pkgs = import <nixpkgs> {};
briefcase = import <briefcase> {};
pkgs = briefcase.third_party.pkgs;
in pkgs.mkShell {
buildInputs = [
pkgs.go
pkgs.goimports
pkgs.godef
buildInputs = with pkgs; [
go
goimports
godef
];
}

2
haskell-file/.envrc Normal file
View file

@ -0,0 +1,2 @@
source_up
use_nix

View file

@ -1,9 +1,5 @@
with import <nixpkgs> {};
stdenv.mkDerivation {
name = "f-hs";
buildInputs = [
(pkgs.haskellPackages.ghcWithPackages (pkgs: [
]))
];
let
briefcase = import <briefcase> {};
in briefcase.buildHaskell.shell {
deps = hpkgs: [];
}

View file

@ -1,8 +1,4 @@
{
pkgs ? import <nixpkgs> {},
depot ? import <depot> {},
...
}:
{ pkgs, depot, ... }:
pkgs.dockerTools.buildLayeredImage {
name = "gemma";

View file

@ -1 +1,2 @@
source_up
use_nix

View file

@ -1,3 +0,0 @@
let
briefcase = import <briefcase> {};
in briefcase.utils.nixBufferFromShell ./shell.nix

View file

@ -1,5 +1,6 @@
let
pkgs = import <nixpkgs> {};
briefcase = import <briefcase> {};
pkgs = briefcase.third_party.pkgs;
in pkgs.mkShell {
buildInputs = with pkgs; [
nodejs

2
scratch/groceries/.envrc Normal file
View file

@ -0,0 +1,2 @@
source_up
use_nix

View file

@ -1,8 +1,5 @@
let
pkgs = import <unstable> {};
in pkgs.mkShell {
buildInputs = with pkgs; [
(haskellPackages.ghcWithPackages (hpkgs: with hpkgs; [
]))
];
briefcase = import <briefcase> {};
in briefcase.buildHaskell.shell {
deps = hpkgs: [];
}

View file

@ -0,0 +1,2 @@
source_up
use_nix

View file

@ -1,10 +1,8 @@
let
pkgs = import <unstable> {};
in pkgs.mkShell {
buildInputs = with pkgs; [
(haskellPackages.ghcWithPackages (hpkgs: with hpkgs; [
hpkgs.quickcheck-simple
hpkgs.checkers
]))
briefcase = import <briefcase> {};
in briefcase.buildHaskell.shell {
deps = hpkgs: with hpkgs; [
quickcheck-simple
checkers
];
}

View file

@ -1,4 +1,5 @@
source_up
use_nix
export monzo_client_id="$(pass show finance/monzo/client-id)"
export monzo_client_secret="$(pass show finance/monzo/client-secret)"
export ynab_personal_access_token="$(pass show finance/youneedabudget.com/personal-access-token)"

View file

@ -1,3 +0,0 @@
let
briefcase = import <briefcase> {};
in briefcase.utils.nixBufferFromShell ./shell.nix

View file

@ -1,5 +1,6 @@
let
pkgs = import <nixpkgs> {};
briefcase = import <briefcase> {};
pkgs = briefcase.third_party.pkgs;
in pkgs.mkShell {
buildInputs = [
pkgs.go

View file

@ -1 +1,2 @@
source_up
use_nix

View file

@ -1,3 +0,0 @@
let
briefcase = import <briefcase> {};
in briefcase.utils.nixBufferFromShell ./shell.nix

View file

@ -1,5 +1,6 @@
let
pkgs = import <nixpkgs> {};
briefcase = import <briefcase> {};
pkgs = briefcase.third_party.pkgs;
in pkgs.mkShell {
buildInputs = with pkgs; [
go

View file

@ -1 +1,2 @@
source_up
use_nix

View file

@ -1,8 +1,6 @@
{ ... }:
{ pkgs, ... }:
let
pkgs = import <unstable> {};
ghc = pkgs.haskellPackages.ghcWithPackages (hpkgs: [
hpkgs.time
hpkgs.aeson

View file

@ -1,12 +1,10 @@
let
pkgs = import <unstable> {};
in pkgs.mkShell {
buildInputs = with pkgs; [
(haskellPackages.ghcWithPackages (hpkgs: with hpkgs; [
time
aeson
either
hspec
]))
briefcase = import <briefcase> {};
in briefcase.buildHaskell.shell {
deps = hpkgs: with hpkgs; [
time
aeson
either
hspec
];
}

View file

@ -11,10 +11,4 @@
wrapNonNixProgram = { path, as }: pkgs.writeShellScriptBin as ''
exec ${path} "$@"
'';
# Expose the buildInputs from a Nix shell to an Emacs buffer. Intended to be
# called from dir-locals.nix files.
nixBufferFromShell = path: let
shell = import path;
in pkgs.nixBufferBuilders.withPackages shell.buildInputs;
}

View file

@ -1 +1,2 @@
source_up
use_nix

View file

@ -1,7 +1,7 @@
let
pkgs = import <nixpkgs> {};
in
pkgs.mkShell {
briefcase = import <briefcase> {};
pkgs = briefcase.third_party.pkgs;
in pkgs.mkShell {
buildInputs = with pkgs; [
hugo
];

View file

@ -0,0 +1,2 @@
source_up
use_nix

View file

@ -1,3 +0,0 @@
let
briefcase = import <briefcase> {};
in briefcase.utils.nixBufferFromShell ./shell.nix

View file

@ -1,5 +1,6 @@
let
pkgs = import <nixpkgs> {};
briefcase = import <briefcase> {};
pkgs = briefcase.third_party.pkgs;
in pkgs.mkShell {
buildInputs = with pkgs; [
nodejs

2
website/goals/.envrc Normal file
View file

@ -0,0 +1,2 @@
source_up
use_nix

View file

@ -1,3 +0,0 @@
let
briefcase = import <briefcase> {};
in briefcase.utils.nixBufferFromShell ./shell.nix

View file

@ -1,5 +1,6 @@
let
pkgs = import <nixpkgs> {};
briefcase = import <briefcase> {};
pkgs = briefcase.third_party.pkgs;
in pkgs.mkShell {
buildInputs = with pkgs; [
nodejs

View file

@ -0,0 +1,2 @@
source_up
use_nix

View file

@ -1,3 +0,0 @@
let
briefcase = import <briefcase> {};
in briefcase.utils.nixBufferFromShell ./shell.nix

View file

@ -1,5 +1,6 @@
let
pkgs = import <nixpkgs> {};
briefcase = import <briefcase> {};
pkgs = briefcase.third_party.pkgs;
in pkgs.mkShell {
buildInputs = with pkgs; [
nodejs

View file

@ -1,3 +1,4 @@
source_up
use_nix
export CONTENTFUL_SPACE_ID="$(pass show programming/contentful/space-id)"
export CONTENTFUL_ACCESS_TOKEN="$(pass show programming/contentful/access-token)"

View file

@ -1,6 +1,6 @@
let
pkgs = import <nixpkgs> {};
in pkgs.stdenv.mkDerivation {
{ pkgs, ... }:
pkgs.stdenv.mkDerivation {
name = "ideal-website";
src = builtins.path { path = ./.; name = "contentful"; };
buildInputs = with pkgs; [

View file

@ -1,5 +1,6 @@
let
pkgs = import <nixpkgs> {};
briefcase = import <briefcase> {};
pkgs = briefcase.third_party.pkgs;
in pkgs.mkShell {
buildInputs = with pkgs; [
nodejs

View file

@ -1,5 +1,6 @@
let
pkgs = import <nixpkgs> {};
briefcase = import <briefcase> {};
pkgs = briefcase.third_party.pkgs;
in pkgs.mkShell {
buildInputs = with pkgs; [
yarn

View file

@ -0,0 +1,2 @@
source_up
use_nix

View file

@ -1,3 +0,0 @@
let
briefcase = import <briefcase> {};
in briefcase.utils.nixBufferFromShell ./shell.nix

View file

@ -2,9 +2,9 @@ let
briefcase = import <briefcase> {};
pkgs = briefcase.third_party.pkgs;
in pkgs.mkShell {
buildInputs = with pkgs; [
elmPackages.elm
elmPackages.elm-format
elmPackages.elm-live
buildInputs = with pkgs.elmPackages; [
elm
elm-format
elm-live
];
}

View file

@ -1 +1,2 @@
source_up
use_nix