Skip to content

Commit 5801ea3

Browse files
authored
Merge pull request #150 from julelang/nix/flake
nix: init flake
2 parents 7f952c6 + f5a77bc commit 5801ea3

File tree

5 files changed

+116
-0
lines changed

5 files changed

+116
-0
lines changed

flake.lock

Lines changed: 27 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
description = "Effective programming language designed to build efficient, fast, reliable and safe software while maintaining simplicity";
3+
4+
inputs = {
5+
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
6+
};
7+
8+
outputs =
9+
{ self, nixpkgs }:
10+
let
11+
systems = [
12+
"x86_64-linux"
13+
"aarch64-linux"
14+
"i686-linux"
15+
"x86_64-darwin"
16+
"aarch64-darwin"
17+
];
18+
19+
forAllSystems = f: nixpkgs.lib.genAttrs systems (system: f nixpkgs.legacyPackages.${system});
20+
in
21+
{
22+
packages = forAllSystems (pkgs: {
23+
default = pkgs.callPackage ./nix/default.nix { };
24+
});
25+
devShells = forAllSystems (pkgs: {
26+
default = pkgs.callPackage ./nix/shell.nix { };
27+
});
28+
formatter = forAllSystems (pkgs: pkgs.callPackage ./nix/formatter.nix { });
29+
};
30+
}

nix/default.nix

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
julec,
3+
}:
4+
5+
julec.overrideAttrs (old: {
6+
src = ../.;
7+
passthru = { };
8+
})

nix/formatter.nix

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{ pkgs }:
2+
3+
pkgs.treefmt.withConfig {
4+
runtimeInputs = with pkgs; [
5+
nixfmt-rfc-style
6+
julefmt
7+
];
8+
9+
settings = {
10+
on-unmatched = "info";
11+
tree-root-file = "flake.nix";
12+
13+
formatter = {
14+
julefmt = {
15+
command = "julefmt";
16+
options = [ "-w" ];
17+
includes = [ "*.jule" ];
18+
};
19+
20+
nixfmt = {
21+
command = "nixfmt";
22+
includes = [ "*.nix" ];
23+
};
24+
};
25+
};
26+
}

nix/shell.nix

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{ pkgs }:
2+
3+
let
4+
mainPkg = pkgs.callPackage ./default.nix { };
5+
packages =
6+
with pkgs;
7+
[
8+
clang
9+
julec
10+
julefmt
11+
typos
12+
]
13+
++ mainPkg.nativeBuildInputs;
14+
in
15+
pkgs.mkShell {
16+
inherit packages;
17+
18+
shellHook = ''
19+
echo -ne "------------------------------------\n "
20+
21+
echo -n "${toString (map (pkg: "• ${pkg.name}\n") packages)}"
22+
23+
echo "------------------------------------"
24+
'';
25+
}

0 commit comments

Comments
 (0)