Skip to content

Commit

Permalink
Add Nim Template (#85)
Browse files Browse the repository at this point in the history
* add: nim template

* fix: rename the package name to "nim"

* fix: better code formatting + moving inherit
  • Loading branch information
SecretVal authored Feb 25, 2025
1 parent c69290d commit f542f4c
Show file tree
Hide file tree
Showing 9 changed files with 90 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/flake-language.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ jobs:
- swiftpm
- zig
- vite-react
- nim
steps:
- uses: cachix/install-nix-action@v30
with:
Expand Down Expand Up @@ -63,6 +64,7 @@ jobs:
- rust
- swiftpm
- zig
- nim
steps:
- uses: cachix/install-nix-action@v30
with:
Expand Down
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -352,3 +352,13 @@ docgen_tmp/

# Include .envrc used by direnv and part of each template directory
!**/.envrc

# Created by https://www.toptal.com/developers/gitignore/api/nim
# Edit at https://www.toptal.com/developers/gitignore?templates=nim

### Nim ###
nimcache/
nimblecache/
htmldocs/

# End of https://www.toptal.com/developers/gitignore/api/nim
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ Kickstart your Nix environments.
- [Swift](#swift)
- [Vite (React)](#vite-react)
- [Zig](#zig)
- [Nim](#nim)
- Systems
- Linux
- [Home Manager](#home-manager)
Expand Down Expand Up @@ -476,6 +477,14 @@ Used for Zig applications.
nix flake init -t github:ALT-F4-LLC/kickstart.nix#zig
```

#### Nim

Used for Nim applications.

```bash
nix flake init -t github:ALT-F4-LLC/kickstart.nix#nim
```

### Systems

#### Home Manager
Expand Down
6 changes: 6 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,11 @@
description = "Kickstart Zig package flake.";
path = ./template/zig;
};

nim = {
description = "Kickstart Nim package flake.";
path = ./template/nim;
};
};
};

Expand Down Expand Up @@ -172,6 +177,7 @@
example-swiftpm = mkLanguage {name = "swiftpm";};
example-vite-react = mkLanguage {name = "vite-react";};
example-zig = mkLanguage {name = "zig";};
example-nim = mkLanguage {name = "nim";};
};
};
};
Expand Down
1 change: 1 addition & 0 deletions template/nim/.envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use flake
11 changes: 11 additions & 0 deletions template/nim/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
direnv/

# Created by https://www.toptal.com/developers/gitignore/api/nim
# Edit at https://www.toptal.com/developers/gitignore?templates=nim

### Nim ###
nimcache/
nimblecache/
htmldocs/

# End of https://www.toptal.com/developers/gitignore/api/nim
33 changes: 33 additions & 0 deletions template/nim/flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
description = "Kickstart Nim package flake.";

inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";

outputs = inputs @ {flake-parts, ...}:
flake-parts.lib.mkFlake {inherit inputs;} {
systems = ["x86_64-linux" "aarch64-linux" "aarch64-darwin" "x86_64-darwin"];

perSystem = {
self',
pkgs,
...
}: let
inherit (pkgs) buildNimPackage;

name = "nim";
version = "0.1.0";
in {
devShells.default = pkgs.mkShell {
inputsFrom = [self'.packages.default];
};

packages = {
default = buildNimPackage {
inherit version;
pname = name;
src = ./.;
};
};
};
};
}
13 changes: 13 additions & 0 deletions template/nim/nim.nimble
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Package

version = "0.1.0"
author = "Anonymous"
description = "A new awesome nimble package"
license = "MIT"
srcDir = "src"
bin = @["nim"]


# Dependencies

requires "nim >= 2.2.0"
5 changes: 5 additions & 0 deletions template/nim/src/nim.nim
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# This is just an example to get you started. A typical binary package
# uses this file as the main entry point of the application.

when isMainModule:
echo("Hello, World!")

0 comments on commit f542f4c

Please sign in to comment.