diff options
55 files changed, 102 insertions, 118 deletions
diff --git a/.envrc b/.envrc index db68a946a14f..23adf2d29d3f 100644 --- a/.envrc +++ b/.envrc @@ -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"; diff --git a/assessments/dotted-squares/.envrc b/assessments/dotted-squares/.envrc index 4a4726a5c73f..a4a62da526d3 100644 --- a/assessments/dotted-squares/.envrc +++ b/assessments/dotted-squares/.envrc @@ -1 +1,2 @@ +source_up use_nix diff --git a/boilerplate/clojure/.envrc b/boilerplate/clojure/.envrc new file mode 100644 index 000000000000..a4a62da526d3 --- /dev/null +++ b/boilerplate/clojure/.envrc @@ -0,0 +1,2 @@ +source_up +use_nix diff --git a/boilerplate/clojure/dir-locals.nix b/boilerplate/clojure/dir-locals.nix deleted file mode 100644 index 498f4b5055f8..000000000000 --- a/boilerplate/clojure/dir-locals.nix +++ /dev/null @@ -1,3 +0,0 @@ -let - briefcase = import <briefcase> {}; -in briefcase.utils.nixBufferFromShell ./shell.nix diff --git a/boilerplate/clojure/shell.nix b/boilerplate/clojure/shell.nix index 0ea68aba4608..efa854422eae 100644 --- a/boilerplate/clojure/shell.nix +++ b/boilerplate/clojure/shell.nix @@ -1,5 +1,6 @@ let - pkgs = import <nixpkgs> {}; + briefcase = import <briefcase> {}; + pkgs = briefcase.third_party.pkgs; in pkgs.mkShell { buildInputs = with pkgs; [ leiningen diff --git a/boilerplate/elm/.envrc b/boilerplate/elm/.envrc new file mode 100644 index 000000000000..a4a62da526d3 --- /dev/null +++ b/boilerplate/elm/.envrc @@ -0,0 +1,2 @@ +source_up +use_nix diff --git a/boilerplate/elm/dir-locals.nix b/boilerplate/elm/dir-locals.nix deleted file mode 100644 index 498f4b5055f8..000000000000 --- a/boilerplate/elm/dir-locals.nix +++ /dev/null @@ -1,3 +0,0 @@ -let - briefcase = import <briefcase> {}; -in briefcase.utils.nixBufferFromShell ./shell.nix diff --git a/boilerplate/elm/shell.nix b/boilerplate/elm/shell.nix index 6f1c8ee23b30..00bb4b0b3edc 100644 --- a/boilerplate/elm/shell.nix +++ b/boilerplate/elm/shell.nix @@ -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 ]; } diff --git a/boilerplate/typescript/.envrc b/boilerplate/typescript/.envrc new file mode 100644 index 000000000000..a4a62da526d3 --- /dev/null +++ b/boilerplate/typescript/.envrc @@ -0,0 +1,2 @@ +source_up +use_nix diff --git a/boilerplate/typescript/dir-locals.nix b/boilerplate/typescript/dir-locals.nix deleted file mode 100644 index 498f4b5055f8..000000000000 --- a/boilerplate/typescript/dir-locals.nix +++ /dev/null @@ -1,3 +0,0 @@ -let - briefcase = import <briefcase> {}; -in briefcase.utils.nixBufferFromShell ./shell.nix diff --git a/boilerplate/typescript/shell.nix b/boilerplate/typescript/shell.nix index ec2a1ce833fa..083254beefd0 100644 --- a/boilerplate/typescript/shell.nix +++ b/boilerplate/typescript/shell.nix @@ -1,5 +1,6 @@ let - pkgs = import <nixpkgs> {}; + briefcase = import <briefcase> {}; + pkgs = briefcase.third_party.pkgs; in pkgs.mkShell { buildInputs = with pkgs; [ nodejs diff --git a/emacs/.emacs.d/snippets/nix-mode/shell-nix b/emacs/.emacs.d/snippets/nix-mode/shell-nix index 4c308bb51b3a..45cb24e2b9e3 100644 --- a/emacs/.emacs.d/snippets/nix-mode/shell-nix +++ b/emacs/.emacs.d/snippets/nix-mode/shell-nix @@ -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 diff --git a/emacs/.emacs.d/wpc/wpc-nix.el b/emacs/.emacs.d/wpc/wpc-nix.el index b67a0f80f95d..501531f23789 100644 --- a/emacs/.emacs.d/wpc/wpc-nix.el +++ b/emacs/.emacs.d/wpc/wpc-nix.el @@ -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) diff --git a/go/.envrc b/go/.envrc index 1abb058f60d5..a4a62da526d3 100644 --- a/go/.envrc +++ b/go/.envrc @@ -1 +1,2 @@ source_up +use_nix diff --git a/go/dir-locals.nix b/go/dir-locals.nix deleted file mode 100644 index 498f4b5055f8..000000000000 --- a/go/dir-locals.nix +++ /dev/null @@ -1,3 +0,0 @@ -let - briefcase = import <briefcase> {}; -in briefcase.utils.nixBufferFromShell ./shell.nix diff --git a/go/shell.nix b/go/shell.nix index aab4123bff9a..e14bffae487c 100644 --- a/go/shell.nix +++ b/go/shell.nix @@ -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 ]; } diff --git a/haskell-file/.envrc b/haskell-file/.envrc new file mode 100644 index 000000000000..a4a62da526d3 --- /dev/null +++ b/haskell-file/.envrc @@ -0,0 +1,2 @@ +source_up +use_nix diff --git a/haskell-file/shell.nix b/haskell-file/shell.nix index f2621d6eac5a..4d5b412a0884 100644 --- a/haskell-file/shell.nix +++ b/haskell-file/shell.nix @@ -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: []; } diff --git a/playbooks/nix_gcr/cloud_run.nix b/playbooks/nix_gcr/cloud_run.nix index 70be4040c36b..3d981611817b 100644 --- a/playbooks/nix_gcr/cloud_run.nix +++ b/playbooks/nix_gcr/cloud_run.nix @@ -1,8 +1,4 @@ -{ - pkgs ? import <nixpkgs> {}, - depot ? import <depot> {}, - ... -}: +{ pkgs, depot, ... }: pkgs.dockerTools.buildLayeredImage { name = "gemma"; diff --git a/scratch/deepmind/part_two/.envrc b/scratch/deepmind/part_two/.envrc index 1abb058f60d5..a4a62da526d3 100644 --- a/scratch/deepmind/part_two/.envrc +++ b/scratch/deepmind/part_two/.envrc @@ -1 +1,2 @@ source_up +use_nix diff --git a/scratch/deepmind/part_two/dir-locals.nix b/scratch/deepmind/part_two/dir-locals.nix deleted file mode 100644 index 498f4b5055f8..000000000000 --- a/scratch/deepmind/part_two/dir-locals.nix +++ /dev/null @@ -1,3 +0,0 @@ -let - briefcase = import <briefcase> {}; -in briefcase.utils.nixBufferFromShell ./shell.nix diff --git a/scratch/deepmind/part_two/shell.nix b/scratch/deepmind/part_two/shell.nix index 65de884696d0..6080171bb835 100644 --- a/scratch/deepmind/part_two/shell.nix +++ b/scratch/deepmind/part_two/shell.nix @@ -1,5 +1,6 @@ let - pkgs = import <nixpkgs> {}; + briefcase = import <briefcase> {}; + pkgs = briefcase.third_party.pkgs; in pkgs.mkShell { buildInputs = with pkgs; [ nodejs diff --git a/scratch/groceries/.envrc b/scratch/groceries/.envrc new file mode 100644 index 000000000000..a4a62da526d3 --- /dev/null +++ b/scratch/groceries/.envrc @@ -0,0 +1,2 @@ +source_up +use_nix diff --git a/scratch/groceries/shell.nix b/scratch/groceries/shell.nix index c62b86e12832..4d5b412a0884 100644 --- a/scratch/groceries/shell.nix +++ b/scratch/groceries/shell.nix @@ -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: []; } diff --git a/scratch/haskell-programming-from-first-principles/.envrc b/scratch/haskell-programming-from-first-principles/.envrc new file mode 100644 index 000000000000..a4a62da526d3 --- /dev/null +++ b/scratch/haskell-programming-from-first-principles/.envrc @@ -0,0 +1,2 @@ +source_up +use_nix diff --git a/scratch/haskell-programming-from-first-principles/shell.nix b/scratch/haskell-programming-from-first-principles/shell.nix index 3190e6e75e72..b594a4207e48 100644 --- a/scratch/haskell-programming-from-first-principles/shell.nix +++ b/scratch/haskell-programming-from-first-principles/shell.nix @@ -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 ]; } diff --git a/tools/monzo_ynab/.envrc b/tools/monzo_ynab/.envrc index 14829cb12390..9b234477352d 100644 --- a/tools/monzo_ynab/.envrc +++ b/tools/monzo_ynab/.envrc @@ -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)" diff --git a/tools/monzo_ynab/dir-locals.nix b/tools/monzo_ynab/dir-locals.nix deleted file mode 100644 index 498f4b5055f8..000000000000 --- a/tools/monzo_ynab/dir-locals.nix +++ /dev/null @@ -1,3 +0,0 @@ -let - briefcase = import <briefcase> {}; -in briefcase.utils.nixBufferFromShell ./shell.nix diff --git a/tools/monzo_ynab/shell.nix b/tools/monzo_ynab/shell.nix index aab4123bff9a..910d7c1829e2 100644 --- a/tools/monzo_ynab/shell.nix +++ b/tools/monzo_ynab/shell.nix @@ -1,5 +1,6 @@ let - pkgs = import <nixpkgs> {}; + briefcase = import <briefcase> {}; + pkgs = briefcase.third_party.pkgs; in pkgs.mkShell { buildInputs = [ pkgs.go diff --git a/tools/run/.envrc b/tools/run/.envrc index 1abb058f60d5..a4a62da526d3 100644 --- a/tools/run/.envrc +++ b/tools/run/.envrc @@ -1 +1,2 @@ source_up +use_nix diff --git a/tools/run/dir-locals.nix b/tools/run/dir-locals.nix deleted file mode 100644 index 498f4b5055f8..000000000000 --- a/tools/run/dir-locals.nix +++ /dev/null @@ -1,3 +0,0 @@ -let - briefcase = import <briefcase> {}; -in briefcase.utils.nixBufferFromShell ./shell.nix diff --git a/tools/run/shell.nix b/tools/run/shell.nix index 97d8ed61ec59..e14bffae487c 100644 --- a/tools/run/shell.nix +++ b/tools/run/shell.nix @@ -1,5 +1,6 @@ let - pkgs = import <nixpkgs> {}; + briefcase = import <briefcase> {}; + pkgs = briefcase.third_party.pkgs; in pkgs.mkShell { buildInputs = with pkgs; [ go diff --git a/tools/url-blocker/.envrc b/tools/url-blocker/.envrc index 1abb058f60d5..a4a62da526d3 100644 --- a/tools/url-blocker/.envrc +++ b/tools/url-blocker/.envrc @@ -1 +1,2 @@ source_up +use_nix diff --git a/tools/url-blocker/default.nix b/tools/url-blocker/default.nix index 5d1b8cd1666a..943644e5f542 100644 --- a/tools/url-blocker/default.nix +++ b/tools/url-blocker/default.nix @@ -1,8 +1,6 @@ -{ ... }: +{ pkgs, ... }: let - pkgs = import <unstable> {}; - ghc = pkgs.haskellPackages.ghcWithPackages (hpkgs: [ hpkgs.time hpkgs.aeson diff --git a/tools/url-blocker/shell.nix b/tools/url-blocker/shell.nix index 40f217e3f9a7..1adc566c0121 100644 --- a/tools/url-blocker/shell.nix +++ b/tools/url-blocker/shell.nix @@ -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 ]; } diff --git a/utils/default.nix b/utils/default.nix index d5130c10ccff..df9673daec70 100644 --- a/utils/default.nix +++ b/utils/default.nix @@ -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; } diff --git a/website/blog/.envrc b/website/blog/.envrc index 1abb058f60d5..a4a62da526d3 100644 --- a/website/blog/.envrc +++ b/website/blog/.envrc @@ -1 +1,2 @@ source_up +use_nix diff --git a/website/blog/shell.nix b/website/blog/shell.nix index d1b4f49942bc..7ca3a9713ebf 100644 --- a/website/blog/shell.nix +++ b/website/blog/shell.nix @@ -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 ]; diff --git a/website/days-of-week-habits/.envrc b/website/days-of-week-habits/.envrc new file mode 100644 index 000000000000..a4a62da526d3 --- /dev/null +++ b/website/days-of-week-habits/.envrc @@ -0,0 +1,2 @@ +source_up +use_nix diff --git a/website/days-of-week-habits/dir-locals.nix b/website/days-of-week-habits/dir-locals.nix deleted file mode 100644 index 498f4b5055f8..000000000000 --- a/website/days-of-week-habits/dir-locals.nix +++ /dev/null @@ -1,3 +0,0 @@ -let - briefcase = import <briefcase> {}; -in briefcase.utils.nixBufferFromShell ./shell.nix diff --git a/website/days-of-week-habits/shell.nix b/website/days-of-week-habits/shell.nix index ec2a1ce833fa..083254beefd0 100644 --- a/website/days-of-week-habits/shell.nix +++ b/website/days-of-week-habits/shell.nix @@ -1,5 +1,6 @@ let - pkgs = import <nixpkgs> {}; + briefcase = import <briefcase> {}; + pkgs = briefcase.third_party.pkgs; in pkgs.mkShell { buildInputs = with pkgs; [ nodejs diff --git a/website/goals/.envrc b/website/goals/.envrc new file mode 100644 index 000000000000..a4a62da526d3 --- /dev/null +++ b/website/goals/.envrc @@ -0,0 +1,2 @@ +source_up +use_nix diff --git a/website/goals/dir-locals.nix b/website/goals/dir-locals.nix deleted file mode 100644 index 498f4b5055f8..000000000000 --- a/website/goals/dir-locals.nix +++ /dev/null @@ -1,3 +0,0 @@ -let - briefcase = import <briefcase> {}; -in briefcase.utils.nixBufferFromShell ./shell.nix diff --git a/website/goals/shell.nix b/website/goals/shell.nix index ec2a1ce833fa..083254beefd0 100644 --- a/website/goals/shell.nix +++ b/website/goals/shell.nix @@ -1,5 +1,6 @@ let - pkgs = import <nixpkgs> {}; + briefcase = import <briefcase> {}; + pkgs = briefcase.third_party.pkgs; in pkgs.mkShell { buildInputs = with pkgs; [ nodejs diff --git a/website/habitgarden/.envrc b/website/habitgarden/.envrc new file mode 100644 index 000000000000..a4a62da526d3 --- /dev/null +++ b/website/habitgarden/.envrc @@ -0,0 +1,2 @@ +source_up +use_nix diff --git a/website/habitgarden/dir-locals.nix b/website/habitgarden/dir-locals.nix deleted file mode 100644 index 498f4b5055f8..000000000000 --- a/website/habitgarden/dir-locals.nix +++ /dev/null @@ -1,3 +0,0 @@ -let - briefcase = import <briefcase> {}; -in briefcase.utils.nixBufferFromShell ./shell.nix diff --git a/website/habitgarden/shell.nix b/website/habitgarden/shell.nix index ec2a1ce833fa..083254beefd0 100644 --- a/website/habitgarden/shell.nix +++ b/website/habitgarden/shell.nix @@ -1,5 +1,6 @@ let - pkgs = import <nixpkgs> {}; + briefcase = import <briefcase> {}; + pkgs = briefcase.third_party.pkgs; in pkgs.mkShell { buildInputs = with pkgs; [ nodejs diff --git a/website/sandbox/contentful/.envrc b/website/sandbox/contentful/.envrc index a6b0e978f430..98e1d2c821f9 100644 --- a/website/sandbox/contentful/.envrc +++ b/website/sandbox/contentful/.envrc @@ -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)" diff --git a/website/sandbox/contentful/default.nix b/website/sandbox/contentful/default.nix index 00714f45d098..f7125655ccdc 100644 --- a/website/sandbox/contentful/default.nix +++ b/website/sandbox/contentful/default.nix @@ -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; [ diff --git a/website/sandbox/contentful/shell.nix b/website/sandbox/contentful/shell.nix index ec2a1ce833fa..083254beefd0 100644 --- a/website/sandbox/contentful/shell.nix +++ b/website/sandbox/contentful/shell.nix @@ -1,5 +1,6 @@ let - pkgs = import <nixpkgs> {}; + briefcase = import <briefcase> {}; + pkgs = briefcase.third_party.pkgs; in pkgs.mkShell { buildInputs = with pkgs; [ nodejs diff --git a/website/sandbox/covid-uk/shell.nix b/website/sandbox/covid-uk/shell.nix index 38df7d4e8508..6442c39f9c47 100644 --- a/website/sandbox/covid-uk/shell.nix +++ b/website/sandbox/covid-uk/shell.nix @@ -1,5 +1,6 @@ let - pkgs = import <nixpkgs> {}; + briefcase = import <briefcase> {}; + pkgs = briefcase.third_party.pkgs; in pkgs.mkShell { buildInputs = with pkgs; [ yarn diff --git a/website/sandbox/learnpianochords/.envrc b/website/sandbox/learnpianochords/.envrc new file mode 100644 index 000000000000..a4a62da526d3 --- /dev/null +++ b/website/sandbox/learnpianochords/.envrc @@ -0,0 +1,2 @@ +source_up +use_nix diff --git a/website/sandbox/learnpianochords/dir-locals.nix b/website/sandbox/learnpianochords/dir-locals.nix deleted file mode 100644 index 498f4b5055f8..000000000000 --- a/website/sandbox/learnpianochords/dir-locals.nix +++ /dev/null @@ -1,3 +0,0 @@ -let - briefcase = import <briefcase> {}; -in briefcase.utils.nixBufferFromShell ./shell.nix diff --git a/website/sandbox/learnpianochords/shell.nix b/website/sandbox/learnpianochords/shell.nix index 1a9c967f7fea..00bb4b0b3edc 100644 --- a/website/sandbox/learnpianochords/shell.nix +++ b/website/sandbox/learnpianochords/shell.nix @@ -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 ]; } diff --git a/zoo/.envrc b/zoo/.envrc index 4a4726a5c73f..a4a62da526d3 100644 --- a/zoo/.envrc +++ b/zoo/.envrc @@ -1 +1,2 @@ +source_up use_nix |