Manually require dependencies for <nixpkgs>, <briefcase>

When I build socrates using `sudo nixos-rebuild [...] switch`, my
`nixos-config` (i.e. <briefcase/nixos/socrates/default.nix>) is a simple Nix
anonymous function. Typically readTree populates my pkgs, briefcase, depot
function parameters with <nixpkgs>, <briefcase>, <depot>, but `nixos-rebuild` is
unaware of `readTree`.

For now I'm manually importing these dependencies, and I'm leaving a TODO to
reconsider switching to the `{ pkgs, briefcase, ... }` style when I better
understand NixOS.
This commit is contained in:
William Carroll 2020-03-01 22:32:43 +00:00
parent 3e51bf600a
commit 6eb239dcce

View file

@ -1,6 +1,12 @@
{ pkgs, briefcase, ... }:
let let
# TODO(wpcarro): Instead of importing these dependencies as parameters that
# readTree will expose I need to import these dependencies manually because
# I'm building this using `nixos-rebuild`. When I better understand how to
# build socrates using readTree, prefer defining this as an anonymous
# function.
pkgs = import <nixpkgs> {};
briefcase = import <briefcase> {};
trimNewline = x: pkgs.lib.removeSuffix "\n" x; trimNewline = x: pkgs.lib.removeSuffix "\n" x;
readSecret = x: trimNewline (builtins.readFile ("/etc/secrets/" + x)); readSecret = x: trimNewline (builtins.readFile ("/etc/secrets/" + x));
in pkgs.lib.fix(self: { in pkgs.lib.fix(self: {