From 59f74814111045b6d74d2a8f5b4f4bfbd1cacd85 Mon Sep 17 00:00:00 2001 From: William Carroll Date: Mon, 17 Aug 2020 10:08:32 +0100 Subject: [PATCH] Revise previous opinions about absolute paths GT Unforeseen problem: `buildkite-agent` runs its builds in a separate directory, so if I want the `nix-build` command to build the newly checked out code, I need to set to the CWD. --- assessments/dotted-squares/shell.nix | 2 +- ci/scripts/build-socrates.sh | 3 ++- configs/.config/nixpkgs/home.nix | 2 +- nixos/socrates/default.nix | 2 +- nixos/socrates/hardware.nix | 2 +- nixos/socrates/rebuild.nix | 11 ----------- scratch/brilliant/default.nix | 2 +- website/sandbox/learnpianochords/shell.nix | 3 ++- .../sandbox/learnpianochords/src/server/default.nix | 2 +- website/sandbox/learnpianochords/src/server/shell.nix | 2 +- zoo/shell.nix | 2 +- 11 files changed, 12 insertions(+), 21 deletions(-) delete mode 100644 nixos/socrates/rebuild.nix diff --git a/assessments/dotted-squares/shell.nix b/assessments/dotted-squares/shell.nix index 75a72cb7e..87eb23d73 100644 --- a/assessments/dotted-squares/shell.nix +++ b/assessments/dotted-squares/shell.nix @@ -1,5 +1,5 @@ let - briefcase = import /home/wpcarro/briefcase {}; + briefcase = import {}; in briefcase.buildHaskell.shell { deps = hpkgs: with hpkgs; [ hspec diff --git a/ci/scripts/build-socrates.sh b/ci/scripts/build-socrates.sh index f62f97e89..6a9c48556 100644 --- a/ci/scripts/build-socrates.sh +++ b/ci/scripts/build-socrates.sh @@ -1,6 +1,7 @@ set -euo pipefail nix-build /home/wpcarro/nixpkgs/nixos \ - -I nixos-config=/home/wpcarro/briefcase/nixos/socrates/default.nix \ + -I briefcase="$(pwd)" \ + -I nixos-config=nixos/socrates/default.nix \ -A system \ --show-trace diff --git a/configs/.config/nixpkgs/home.nix b/configs/.config/nixpkgs/home.nix index ee461dc9b..d23d04f6a 100644 --- a/configs/.config/nixpkgs/home.nix +++ b/configs/.config/nixpkgs/home.nix @@ -8,7 +8,7 @@ # I believe these calls depend on nixpkgs being set in NIX_PATH, which is a # dependency that I'm trying to prune... let - briefcase = import /home/wpcarro/briefcase {}; + briefcase = import {}; in { home = { packages = with pkgs; [ diff --git a/nixos/socrates/default.nix b/nixos/socrates/default.nix index d98cdb993..ebb62036b 100644 --- a/nixos/socrates/default.nix +++ b/nixos/socrates/default.nix @@ -1,5 +1,5 @@ let - briefcase = import /home/wpcarro/briefcase {}; + briefcase = import {}; pkgs = briefcase.third_party.pkgs; trimNewline = x: pkgs.lib.removeSuffix "\n" x; readSecret = x: trimNewline (builtins.readFile ("/etc/secrets/" + x)); diff --git a/nixos/socrates/hardware.nix b/nixos/socrates/hardware.nix index d13ffd7e4..dde14eb1e 100644 --- a/nixos/socrates/hardware.nix +++ b/nixos/socrates/hardware.nix @@ -5,7 +5,7 @@ { imports = - [ /home/wpcarro/nixpkgs/nixos/modules/installer/scan/not-detected.nix + [ ]; boot.initrd.availableKernelModules = [ "ahci" "xhci_pci" "usbhid" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ]; diff --git a/nixos/socrates/rebuild.nix b/nixos/socrates/rebuild.nix deleted file mode 100644 index 1ab4f5133..000000000 --- a/nixos/socrates/rebuild.nix +++ /dev/null @@ -1,11 +0,0 @@ -{ pkgs, ... }: - -pkgs.writeShellScriptBin "rebuild" '' - set -ue - sudo nixos-rebuild \ - -I nixos-config=/home/wpcarro/briefcase/nixos/socrates/configuration.nix \ - -I nixpkgs=/home/wpcarro/nixpkgs \ - -I depot=/home/wpcarro/depot \ - -I briefcase=/home/wpcarro/briefcase \ - switch -'' diff --git a/scratch/brilliant/default.nix b/scratch/brilliant/default.nix index 5fba20d67..886ba87e1 100644 --- a/scratch/brilliant/default.nix +++ b/scratch/brilliant/default.nix @@ -1,5 +1,5 @@ let - briefcase = import /home/wpcarro/briefcase {}; + briefcase = import {}; in briefcase.buildHaskell.program { name = "transform-keyboard"; srcs = builtins.path { diff --git a/website/sandbox/learnpianochords/shell.nix b/website/sandbox/learnpianochords/shell.nix index 6cc05d099..1a9c967f7 100644 --- a/website/sandbox/learnpianochords/shell.nix +++ b/website/sandbox/learnpianochords/shell.nix @@ -1,5 +1,6 @@ let - pkgs = import /home/wpcarro/nixpkgs {}; + briefcase = import {}; + pkgs = briefcase.third_party.pkgs; in pkgs.mkShell { buildInputs = with pkgs; [ elmPackages.elm diff --git a/website/sandbox/learnpianochords/src/server/default.nix b/website/sandbox/learnpianochords/src/server/default.nix index 6ed68d441..87de69cbd 100644 --- a/website/sandbox/learnpianochords/src/server/default.nix +++ b/website/sandbox/learnpianochords/src/server/default.nix @@ -1,5 +1,5 @@ let - briefcase = import /home/wpcarro/briefcase {}; + briefcase = import {}; in briefcase.buildHaskell.program { name = "server"; srcs = builtins.path { diff --git a/website/sandbox/learnpianochords/src/server/shell.nix b/website/sandbox/learnpianochords/src/server/shell.nix index a655c1587..ab470841e 100644 --- a/website/sandbox/learnpianochords/src/server/shell.nix +++ b/website/sandbox/learnpianochords/src/server/shell.nix @@ -1,5 +1,5 @@ let - briefcase = import /home/wpcarro/briefcase {}; + briefcase = import {}; in briefcase.buildHaskell.shell { deps = hpkgs: with hpkgs; [ hspec diff --git a/zoo/shell.nix b/zoo/shell.nix index 04655ada8..944c5acc7 100644 --- a/zoo/shell.nix +++ b/zoo/shell.nix @@ -1,5 +1,5 @@ let - briefcase = import /home/wpcarro/briefcase {}; + briefcase = import {}; in briefcase.buildHaskell.shell { deps = hpkgs: with hpkgs; [ servant-server