Skip to content
This repository was archived by the owner on May 17, 2024. It is now read-only.

Commit 892658e

Browse files
committed
fix(build): ensure that profiles are also saved to the specified store
1 parent b1d8954 commit 892658e

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

Makefile

+2-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ docker-push:
3232
# may build all environments.
3333
# The --privileged flag is necessary to avoid `error: cloning builder process: Operation not permitted`
3434
# (see https://github.com/NixOS/nix/issues/2636 and other issues)
35-
# This mounts the local ./nixroot directory and tells Nixster (and thus Nix :) to build into it
35+
# This mounts the local `./nixroot` directory and tells Nixster (and thus Nix :) to build into it.
36+
# We need to build into `/nixroot/nix/store` because in the container, `/nix/store` has `nix-env` which is used for the build.
3637
docker-build:
3738
docker run --rm --interactive --tty \
3839
--privileged \

src/nix.ts

+12-4
Original file line numberDiff line numberDiff line change
@@ -283,15 +283,23 @@ export async function install (env: string, pkgs: Array<string>, clean: boolean
283283
for (let channel in channels) {
284284
let args = [
285285
'--install',
286-
'--file', `channel:${channel}`,
287-
'--profile', path.join(profiles, env)
286+
'--file', `channel:${channel}`
288287
]
289288
if (clean) args = args.concat('--remove-all')
289+
let profile
290290
if (store) {
291291
// The store argument must be an absolute path so we ensure that here.
292-
args = args.concat('--store', path.resolve(store))
292+
const nixroot = path.resolve(store)
293+
args = args.concat('--store', nixroot)
294+
// The profile needs to be saved into the same nixroot as well...
295+
profile = path.join(nixroot, 'nix', 'profiles', env)
296+
} else {
297+
profile = path.join(profiles, env)
293298
}
294-
args = args.concat('--attr', channels[channel].map((pkg: any) => pkg.attr))
299+
args = args.concat(
300+
'--profile', profile,
301+
'--attr', channels[channel].map((pkg: any) => pkg.attr)
302+
)
295303

296304
await spawn('nix-env', args, {
297305
stdio: 'inherit'

0 commit comments

Comments
 (0)