-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathflake.nix
74 lines (59 loc) · 2.16 KB
/
flake.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
{
description = "Worm CLI game";
inputs = {
# Pointing to the current stable release of nixpkgs. You can
# customize this to point to an older version or unstable if you
# like everything shining.
#
# E.g.
#
# nixpkgs.url = "github:NixOS/nixpkgs/unstable";
nixpkgs.url = "github:NixOS/nixpkgs/22.11";
utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, ... }@inputs: inputs.utils.lib.eachSystem [
# Add the system/architecture you would like to support here. Note that not
# all packages in the official nixpkgs support all platforms.
"x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin"
] (system: let pkgs = import nixpkgs { inherit system; };
in {
# This block here is used when running `nix develop`
devShells.default = pkgs.mkShell rec {
# Update the name to something that suites your project.
name = "worm";
packages = with pkgs; [
llvmPackages_14.clang
ncurses6
];
# Setting up the environment variables you need during development.
# Todo figure out why I can't use clang on Asahi but can on Darwin
# Use "clang++" for most systems but OSX Asahi requires g++ for some reason or a runtime error occurs
shellHook = let
# This is for an icon that is used below for the command line input below
icon = "f121";
in ''
export PS1="$(echo -e '\u${icon}') {\[$(tput sgr0)\]\[\033[38;5;228m\]\w\[$(tput sgr0)\]\[\033[38;5;15m\]} (${name}) \\$ \[$(tput sgr0)\]"
export COMPILER="clang++"
#export COMPILER="g++"
'';
};
# This is used when running `nix build`
packages.default = pkgs.llvmPackages_14.stdenv.mkDerivation rec {
name = "worm";
version = "0.1.1";
src = ./src;
buildInputs = [ pkgs.ncurses6 ];
buildPhase = "COMPILER='clang++' make";
installPhase = ''
mkdir -p $out/bin;
install -t $out/bin worm
'';
meta = with inputs.utils.lib; {
homepage = "https://github.com/icecreammatt/ssu-cs315-worm";
description = ''
Terminal CLI Worm Game
'';
};
};
});
}