Skip to content

Commit 43fbd10

Browse files
committed
add nix flake
1 parent 8a42e1b commit 43fbd10

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed

flake.nix

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
{
2+
description = "Callisto is a reverse polish notation programming language inspired by YSL-C3 and Forth";
3+
4+
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-24.05";
5+
6+
outputs = { nixpkgs, ... }:
7+
let
8+
supportedSystems = [ "x86_64-linux" "x86_64-darwin" "i686-linux" ];
9+
forEachSupportedSystem = f: nixpkgs.lib.genAttrs supportedSystems (system: f {
10+
pkgs = import nixpkgs { inherit system; };
11+
});
12+
in
13+
{
14+
packages =
15+
forEachSupportedSystem
16+
({ pkgs }:
17+
let
18+
cac = pkgs.buildDubPackage rec {
19+
pname = "cac";
20+
name = pname;
21+
22+
src = ./.;
23+
dubLock = ./dub-lock.json;
24+
25+
nativeBuildInputs = [ pkgs.makeWrapper ];
26+
27+
installPhase = ''
28+
runHook preInstall
29+
install -Dm755 cac -t $out/bin
30+
runHook postInstall
31+
'';
32+
33+
postFixup = with pkgs; ''
34+
wrapProgram $out/bin/cac --prefix PATH : "${lib.makeBinPath [ nasm stdenv.cc uxn ]}"
35+
'';
36+
};
37+
in
38+
{
39+
inherit cac;
40+
default = cac;
41+
});
42+
devShells =
43+
forEachSupportedSystem
44+
({ pkgs }: {
45+
default = pkgs.mkShell {
46+
packages = with pkgs; [ dmd dub nasm ];
47+
};
48+
});
49+
};
50+
}

0 commit comments

Comments
 (0)