Skip to content

Instantly share code, notes, and snippets.

View lucperkins's full-sized avatar
🎯
Focusing

Luc Perkins lucperkins

🎯
Focusing
View GitHub Profile
{
inputs = {
nixpkgs.url = "nixpkgs";
nuenv.url = "github:DeterminateSystems/nuenv";
};
outputs = { self, nixpkgs, nuenv }: let
overlays = [ nuenv.overlays.default ];
systems = [
"x86_64-linux"
nix build --print-build-logs "github:DeterminateSystems/nuenv"
# See the result
cat result/share/hello.txt
export PATH=
for i in $packages; do
if [ "$i" = / ]; then i=; fi
PATH=$PATH${PATH:+:}$i/bin
done
# Parse the __nu_packages environment variable string, where each
# package path is separate by a space, and convert to a list
let packages = ($env.__nu_packages | split row (char space))
# Convert the list to a colon-separated string
let $packagesPath = (
$packages
| each { |pkg| $"($pkg)/bin" }
| str collect (char esep)
)
{
mkNushellDerivation = {
nushell, # A Nushell package
name, # The name of the derivation
src, # The derivation's sources
system, # The host system
packages ? [], # Same as in stdenv
build ? "", # Same as in stdenv
}:
Say hello to <name> and add a ! to the end if <exclaim> is set.
Usage:
> sayHello {flags} <name>
Flags:
-e, --exclaim - Whether to add a ! at the end
-h, --help - Display the help message for this command
Parameters:
# Say hello to <name> and add a ! to the end if <exclaim> is set.
def sayHello [
name: string, # The person to say hello to
--exclaim(-e): bool, # Whether to add a ! at the end
] {
echo $"Hello, ($name)(if $exclaim { "!" })"
}
nix copy \
--to "s3://my-nix-stuff-bucket?region=ap-southeast-1" \
".#my-package"
nix copy \
--to ssh-ng://root@"${DROPLET_IP}" \
".#packages.x86_64-linux.ponysay"
nix copy \
--derivation \
--to ssh-ng://"${CLOUD_VM_IP}" \
".#packages.x86_64-linux.service-pkg"