I’m trying to make a ruby (jekyll) website and using nix to build it. This is my first time using nix flakes, and one of the first times I write nix stuff myself (have used existing ones, and tweaked here and there, but only wrote very very basic ones from scratch myself).
So I created a basic flake.nix with a dev shell that has buildInputs = [ ruby ];
, and used that to create my gemfile and stuff. I can use nix develop
and then bundle exec jekyll build
and that works.
My file structure looks like this:
-
_posts
(folder) _config.yaml
- …
flake.lock
flake.nix
Gemfile
Gemfile.lock
And my flake.nix
currently looks like this:
{
description = "My Jekyll Website";
inputs = {
nixpkgs.url = "nixpkgs/nixos-22.05";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
in with pkgs;
{
devShells.default =
mkShell {
buildInputs = [ ruby ];
};
packages.default =
stdenv.mkDerivation {
name = "website";
src = ./.;
buildInputs = [ ruby ];
buildPhase = "echo start && echo `ls` && bundle exec jekyll build";
};
}
);
}
When I run nix.build
I get the following output:
❯ nix build
error: builder for '/nix/store/813fpg5lf8d6mh0fjbg95y56gk64xicg-Cooking.drv' failed with exit code 10;
last 10 log lines:
> source root is hjaz58fg073by6fihlg68kn9r375jx78-source
> patching sources
> configuring
> no configure script, doing nothing
> building
> start
> flake.lock flake.nix
> `/homeless-shelter` is not a directory.
> Bundler will use `/build/bundler20220814-25-3zfowd25' as your home directory temporarily.
> Could not locate Gemfile or .bundle/ directory
For full logs, run 'nix log /nix/store/813fpg5lf8d6mh0fjbg95y56gk64xicg-Cooking.drv'.
The full log is:
❯ nix log /nix/store/813fpg5lf8d6mh0fjbg95y56gk64xicg-Cooking.drv
@nix { "action": "setPhase", "phase": "unpackPhase" }
unpacking sources
unpacking source archive /nix/store/v2y1wkshxjr41iz3wh4k78k2bkc1l086-hjaz58fg073by6fihlg68kn9r375jx78-source
source root is hjaz58fg073by6fihlg68kn9r375jx78-source
@nix { "action": "setPhase", "phase": "patchPhase" }
patching sources
@nix { "action": "setPhase", "phase": "configurePhase" }
configuring
no configure script, doing nothing
@nix { "action": "setPhase", "phase": "buildPhase" }
building
start
flake.lock flake.nix
`/homeless-shelter` is not a directory.
Bundler will use `/build/bundler20220814-25-3zfowd25' as your home directory temporarily.
Could not locate Gemfile or .bundle/ directory
So somehow it can see the two flake
files, but can’t find any of the other source files.
What am I missing? Or what am I doing wrong?
Note: I found something about a gemset.nix
file, but I wanted to first figure out this way that feels it should be pretty straight forward. As I’m only just learning to make nix stuff myself.