https://github.com/zetavg/nix-hello-world
Hello world program to experience on Nix derivation/packages.
https://github.com/zetavg/nix-hello-world
hello-world helloworld helloworld-programs nix nix-expressions nixpkgs
Last synced: about 2 months ago
JSON representation
Hello world program to experience on Nix derivation/packages.
- Host: GitHub
- URL: https://github.com/zetavg/nix-hello-world
- Owner: zetavg
- Created: 2019-03-04T20:29:00.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-03-06T04:57:37.000Z (over 6 years ago)
- Last Synced: 2025-04-10T12:10:27.337Z (about 2 months ago)
- Topics: hello-world, helloworld, helloworld-programs, nix, nix-expressions, nixpkgs
- Language: Nix
- Size: 8.79 KB
- Stars: 7
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Nix Hello World
This is just a simple program to experience on Nix derivation/packages.
## Build or Install in Nix Environment
### Build
To build this program by Nix, clone or download this project and run the following command at the root directory of the project:
```bash
nix-build
```or the long version by specifying the file: `nix-build default.nix`, or even doing instantiate and realise step-by-step: `nix-store -r $(nix-instantiate default.nix)`.
### Install
To install this program in Nix Environment, run the following command at the root directory of the project:
```bash
nix-env -i -f default.nix
```or the long version: `nix-env --install --file default.nix`.
### Inspect
You can get the out path by running `nix-store -q --outputs $(nix-instantiate default.nix)` or `nix eval '("${import ./default.nix}")'` before installation, or `nix-env -q --out-path --no-name hello` after installing.
To see the contents of the .drv file, run: `nix show-derivation $(nix-instantiate default.nix)` or `nix show-derivation $(nix-store -q --deriver $(nix eval '("${import ./default.nix}")' | cut -d '"' -f 1))`.
## Build Manually
You can build it manually with `gcc` by running:
```bash
gcc src/hello.c -o hello
```## References
- [Nix Pills](https://nixos.org/nixos/nix-pills/)