-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Permit installation of dev/test dependencies via Nix #89
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# If using a flake-enabled version of Nix (minimum 2.4, with experimental | ||
# features enabled), ''nix develop'' will spawn an environment in which | ||
# ''./scripts/test'' will work as intended. | ||
|
||
# For older versions of Nix, ''nix-shell'' will invoke this same code via the | ||
# shell.nix compatibility layer. | ||
|
||
{ | ||
inputs = { | ||
nixpkgs.url = "github:NixOS/nixpkgs/release-21.11"; | ||
flake-compat.url = "github:edolstra/flake-compat"; | ||
flake-compat.flake = false; | ||
flake-utils.url = "github:numtide/flake-utils"; | ||
}; | ||
outputs = { self, nixpkgs, flake-utils, ... }: | ||
flake-utils.lib.eachDefaultSystem (system: | ||
let pkgs = import nixpkgs { inherit system; }; | ||
in rec { | ||
devShell = pkgs.mkShell { | ||
buildInputs = with pkgs; [ | ||
buildkit | ||
go | ||
rootlesskit | ||
runc | ||
]; | ||
shellHook = '' | ||
if ! type newuidmap >/dev/null 2>&1; then { | ||
echo "WARNING: newuidmap and newgid map are required but not found" | ||
echo " Because these tools require a setuid bit to operate," | ||
echo " they cannot be installed in a local Nix shell." | ||
echo | ||
} >&2; fi | ||
PS1='[oci-build-task devshell] '"$PS1" | ||
''; | ||
}; | ||
}); | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#!/bin/bash | ||
#!/usr/bin/env bash | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you give some info about this line? Thx. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure. NixOS doesn't have a Using |
||
|
||
set -e -u | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
(import | ||
( | ||
let lock = builtins.fromJSON (builtins.readFile ./flake.lock); in | ||
fetchTarball { | ||
url = "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz"; | ||
sha256 = lock.nodes.flake-compat.locked.narHash; | ||
} | ||
) | ||
{ src = ./.; } | ||
).shellNix |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this one related or is it a bug left from before?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not strictly NixOS-specific, and certainly reasonable to separate out into a different PR to be individually evaluated. While debugging, it came up that buildkit (or at least, the version shipped in NixOS 21.11) has a
--rootless
which is documented to enable configuration changes for better compatibility with rootlesskit -- but that said, I didn't go back after getting other issues ironed out to confirm that we were unable to run tests without it.I'll do that now and follow up with findings.