Skip to content
This repository has been archived by the owner on Oct 15, 2022. It is now read-only.

Commit

Permalink
Merge pull request #81 from target/message-over-socket
Browse files Browse the repository at this point in the history
`lorri daemon`
  • Loading branch information
Profpatsch authored Jun 20, 2019
2 parents 2a0999b + 40dc0d3 commit 2b9c420
Show file tree
Hide file tree
Showing 30 changed files with 1,301 additions and 203 deletions.
76 changes: 57 additions & 19 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ notify = "4.0.6"
serde = "1.0.88"
serde_derive = "1.0.88"
serde_json = "1.0.38"
bincode = "1.1.3"
tempfile = "3.0.7"
vec1 = "1.1.0"
proptest = "0.9.1"
nix = "0.14.0"
2 changes: 1 addition & 1 deletion default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ pkgs.rustPlatform.buildRustPackage rec {
BUILD_REV_COUNT = src.revCount or 1;
RUN_TIME_CLOSURE = pkgs.callPackage ./nix/runtime.nix {};

cargoSha256 = "0lx4r05hf3snby5mky7drbnp006dzsg9ypsi4ni5wfl0hffx3a8g";
cargoSha256 = "094w2lp6jvxs8j59cjqp6b3kg4y4crlnqka5v2wmq4j0mn6hvhsj";

NIX_PATH = "nixpkgs=${./nix/bogus-nixpkgs}";

Expand Down
3 changes: 3 additions & 0 deletions nix/pre-check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ TEST_ROOT_DEST=${TMPDIR:-/tmp}/nix-test/nix
mkdir -p $TEST_ROOT_DEST
TEST_ROOT=$(realpath $TEST_ROOT_DEST)

# prevent us from creating $HOME if it doesn’t exist
export XDG_CACHE_HOME=${TMPDIR:-/tmp}/nix-test/xdg-cache-dir

export NIX_STORE_DIR=$TEST_ROOT/store
mkdir -p $NIX_STORE_DIR
export NIX_LOCALSTATE_DIR=$TEST_ROOT/var
Expand Down
9 changes: 8 additions & 1 deletion release.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,15 @@
package = import ./default.nix { inherit src; };

changelog = {
# Find the current version number with `git log --prety=%h | wc -l`
# Find the current version number with `git log --pretty=%h | wc -l`
entries = [
{
version = 171;
changes = ''
gc_root dirs move from `~/.cache/lorri` to `~/.cache/lorri/gc_roots`.
You can delete every file in `~/.cache/lorri`.
'';
}
{
version = 132;
changes = ''
Expand Down
5 changes: 3 additions & 2 deletions src/build_loop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use crate::pathreduction::reduce_paths;
use crate::roots;
use crate::roots::Roots;
use crate::watch::Watch;
use crate::NixFile;
use std::collections::HashMap;
use std::path::PathBuf;
use std::sync::mpsc::Sender;
Expand Down Expand Up @@ -44,7 +45,7 @@ pub struct BuildExitFailure {
/// Additionally, we create GC roots for the build results.
pub struct BuildLoop {
/// A nix source file which can be built
nix_root_path: PathBuf,
nix_root_path: NixFile,
roots: Roots,
/// Watches all input files for changes.
/// As new input files are discovered, they are added to the watchlist.
Expand All @@ -54,7 +55,7 @@ pub struct BuildLoop {
impl BuildLoop {
/// Instatiate a new BuildLoop. Uses an internal filesystem
/// watching implementation.
pub fn new(nix_root_path: PathBuf, roots: Roots) -> BuildLoop {
pub fn new(nix_root_path: NixFile, roots: Roots) -> BuildLoop {
BuildLoop {
nix_root_path,
roots,
Expand Down
6 changes: 4 additions & 2 deletions src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,13 @@ use std::io::{BufRead, BufReader};
use std::path::PathBuf;
use std::process::{Command, Stdio};
use std::thread;
use NixFile;

/// Builds the Nix expression in `root_nix_file`.
///
/// Instruments the nix file to gain extra information,
/// which is valuable even if the build fails.
pub fn run(root_nix_file: &PathBuf) -> Result<Info, Error> {
pub fn run(root_nix_file: &NixFile) -> Result<Info, Error> {
// We're looking for log lines matching:
//
// copied source '...' -> '/nix/store/...'
Expand All @@ -32,6 +33,7 @@ pub fn run(root_nix_file: &PathBuf) -> Result<Info, Error> {

cmd.args(&[
"-vv",
// TODO: we should pass this as a file instead of a 12k argv string
"--expr",
include_str!("./logged-evaluation.nix"),
"--no-out-link",
Expand All @@ -41,7 +43,7 @@ pub fn run(root_nix_file: &PathBuf) -> Result<Info, Error> {
"--argstr",
"src",
])
.arg(root_nix_file)
.arg(root_nix_file.as_os_str())
.stdin(Stdio::null())
.stdout(Stdio::piped())
.stderr(Stdio::piped());
Expand Down
Loading

0 comments on commit 2b9c420

Please sign in to comment.