Add nixgen package to quickly create development shells #211

Manually merged
rarias merged 2 commits from nixgen into master 2025-10-29 16:32:03 +01:00
Owner

Adds a simple nixgen program that creates a flake.nix file with the specified packages or build dependencies for the specified packages. Example:

apex% mkdir test
apex% cd test
apex% nixgen ovni bigotes -b nosv tampi
apex% nix develop
warning: creating lock file '"/home/Computational/rarias/test/flake.lock"':
• Added input 'jungle':
    'git+https://jungle.bsc.es/git/rarias/jungle?ref=refs/heads/master&rev=019826d09eebb342146d40d7f3251f81fc126c3d' (2025-10-28)
• Added input 'jungle/nixpkgs':
    'github:NixOS/nixpkgs/dfcd5b901dbab46c9c6e80b265648481aafb01f8?narHash=sha256-Kt1UIPi7kZqkSc5HVj6UY5YLHHEzPBkgpNUByuyxtlw%3D' (2025-07-13)
apex$ ovniver
LD_LIBRARY_PATH not set
libovni: build v1.12.0 (a73afcf), dynamic v1.12.0 (a73afcf)
apex$ bigotes -h
Usage:
    bigotes [options] [--] COMMAND [ARGS...]
    bigotes [options] -i
See the bigotes(1) manual for more details.
apex$ echo $buildInputs
/nix/store/z1yma90qbskrsrza5rjngrlx06419m0c-numactl-2.0.18-dev /nix/store/8basivick7rwy3416a9sxcp4arld82zw-hwloc-2.12.1-dev /nix/store/lj90ql1480y41n52q8z46368yn7s9jim-ovni-1.12.0 /nix/store/8n4a9idvb5xnmglid3d6fmfi33r19689-papi-7.1.0 /nix/store/hp8fsx1sg3dadia1i092188ll9d216sg-boost-1.87.0-dev /nix/store/mvagawi70xc1z9j4lkbnm3dli69s8s52-mpich-4.3.0 /nix/store/lj90ql1480y41n52q8z46368yn7s9jim-ovni-1.12.0

The nixgen program is a standalone POSIX shell script which can be placed in any machine.

Adds a simple `nixgen` program that creates a flake.nix file with the specified packages or build dependencies for the specified packages. Example: ``` apex% mkdir test apex% cd test apex% nixgen ovni bigotes -b nosv tampi apex% nix develop warning: creating lock file '"/home/Computational/rarias/test/flake.lock"': • Added input 'jungle': 'git+https://jungle.bsc.es/git/rarias/jungle?ref=refs/heads/master&rev=019826d09eebb342146d40d7f3251f81fc126c3d' (2025-10-28) • Added input 'jungle/nixpkgs': 'github:NixOS/nixpkgs/dfcd5b901dbab46c9c6e80b265648481aafb01f8?narHash=sha256-Kt1UIPi7kZqkSc5HVj6UY5YLHHEzPBkgpNUByuyxtlw%3D' (2025-07-13) apex$ ovniver LD_LIBRARY_PATH not set libovni: build v1.12.0 (a73afcf), dynamic v1.12.0 (a73afcf) apex$ bigotes -h Usage: bigotes [options] [--] COMMAND [ARGS...] bigotes [options] -i See the bigotes(1) manual for more details. apex$ echo $buildInputs /nix/store/z1yma90qbskrsrza5rjngrlx06419m0c-numactl-2.0.18-dev /nix/store/8basivick7rwy3416a9sxcp4arld82zw-hwloc-2.12.1-dev /nix/store/lj90ql1480y41n52q8z46368yn7s9jim-ovni-1.12.0 /nix/store/8n4a9idvb5xnmglid3d6fmfi33r19689-papi-7.1.0 /nix/store/hp8fsx1sg3dadia1i092188ll9d216sg-boost-1.87.0-dev /nix/store/mvagawi70xc1z9j4lkbnm3dli69s8s52-mpich-4.3.0 /nix/store/lj90ql1480y41n52q8z46368yn7s9jim-ovni-1.12.0 ``` The nixgen program is a *standalone* POSIX shell script which can be placed in any machine.
rarias added 2 commits 2025-10-29 12:47:23 +01:00
Add nixgen to all machines
All checks were successful
CI / build:cross (pull_request) Successful in 6s
CI / build:all (pull_request) Successful in 17s
9a05fa35d7
rarias requested review from abonerib 2025-10-29 12:47:34 +01:00
abonerib approved these changes 2025-10-29 14:26:06 +01:00
Dismissed
abonerib left a comment
Collaborator

Tested a couple of shells and things seem to work as intended.

The only thing I don't like is that it leaves a trailing whitespace in the lists, but I think keeping things simple is better.

Tested a couple of shells and things seem to work as intended. The only thing I don't like is that it leaves a trailing whitespace in the lists, but I think keeping things simple is better.
rarias force-pushed nixgen from 9a05fa35d7 to 6293a07b5b 2025-10-29 15:50:04 +01:00 Compare
Author
Owner

The only thing I don't like that it leaves a trailing whitespace in the lists, but I think keeping things simple is better.

Should be fixed now

> The only thing I don't like that it leaves a trailing whitespace in the lists, but I think keeping things simple is better. Should be fixed now
rarias requested review from abonerib 2025-10-29 15:52:19 +01:00
abonerib reviewed 2025-10-29 16:15:39 +01:00
@ -0,0 +50,4 @@
if [ "$mode" == "package" ]; then
packages+="${packages+ }$1"
else
inputsFrom+="${inputsFrom+ }$1"
Collaborator

I think that we need :+ (${inputsFrom:+ }) since inputsFrom is defined (but empty). Otherwise, we'll have leading whitespace :D

I think that we need `:+` (`${inputsFrom:+ }`) since inputsFrom is defined (but empty). Otherwise, we'll have leading whitespace :D
Author
Owner

Damm, I tested ${foo:+ } on bash but wrote the wrong thing :D

Damm, I tested `${foo:+ }` on bash but wrote the wrong thing :D
rarias marked this conversation as resolved
rarias force-pushed nixgen from 6293a07b5b to 5e0209ba3a 2025-10-29 16:20:17 +01:00 Compare
abonerib approved these changes 2025-10-29 16:23:11 +01:00
rarias force-pushed nixgen from 5e0209ba3a to 5ff1b1343b 2025-10-29 16:28:24 +01:00 Compare
rarias manually merged commit 5ff1b1343b into master 2025-10-29 16:32:03 +01:00
Sign in to join this conversation.
No Reviewers
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: rarias/jungle#211
No description provided.