https://github.com/byteshiva/nix-executable-pkl
Pkl CLI setup on NixOS for streamlined app configuration
https://github.com/byteshiva/nix-executable-pkl
Last synced: about 1 year ago
JSON representation
Pkl CLI setup on NixOS for streamlined app configuration
- Host: GitHub
- URL: https://github.com/byteshiva/nix-executable-pkl
- Owner: byteshiva
- License: mit
- Created: 2024-02-11T09:38:15.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-06-03T23:38:15.000Z (almost 2 years ago)
- Last Synced: 2025-01-22T12:12:46.896Z (over 1 year ago)
- Language: Nix
- Homepage: https://byteshiva.medium.com/simplifying-configuration-with-pkl-cli-on-nixos-08790fbe4e5c
- Size: 10.7 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Pkl CLI on NixOS
This repository provides a streamlined setup for using the Pkl CLI tool on NixOS, utilizing Nix flakes for easy configuration.
## Getting Started
### Prerequisites
Make sure you have Nix installed. If not, you can install it using the following command:
```bash
sh <(curl -L https://nixos.org/nix/install) --daemon
```
### Setup
1. Clone this repository:
```bash
git clone https://github.com/byteshiva/nix-executable-pkl.git
cd nix-executable-pkl
```
2. Enter the development environment:
```bash
nix develop
```
3. Run the sample Pkl configuration:
```bash
# Evaluate Pkl configuration file
jpkl eval bird.pkl
# Evaluate Pkl configuration file and output in JSON format
jpkl eval -f json bird.pkl
# Evaluate Pkl configuration file and output in XML (plist) format
jpkl eval -f plist bird.pkl
```
4. Customize the configuration:
Edit the `bird.pkl` file to modify the sample Pkl configuration. Rerun the `jpkl eval` commands to see the changes.
```bash
jpkl eval bird.pkl
```
## Sample Configuration
The provided `bird.pkl` file contains a simple configuration for a bird. Here's an example:
```pkl
name = "Swallow"
job {
title = "Sr. Nest Maker"
company = "Nests R Us"
yearsOfExperience = 2
}
```
Feel free to experiment with different configurations to see how Pkl handles them.
Happy configuring!