-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathflake.nix
72 lines (66 loc) · 2.29 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
{
description = "NixCon 2024 - NixOS on garnix: Production-grade hosting as a game";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
inputs.flake-utils.url = "github:numtide/flake-utils";
inputs.garnix-lib = {
url = "github:garnix-io/garnix-lib";
inputs = {
nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, nixpkgs, garnix-lib, flake-utils }:
let
system = "x86_64-linux";
in
(flake-utils.lib.eachSystem [ "x86_64-linux" ] (system:
let pkgs = import nixpkgs { inherit system; };
in rec {
packages = {
webserver = pkgs.hello;
default = packages.webserver;
};
apps.default = {
type = "app";
program = pkgs.lib.getExe (
pkgs.writeShellApplication {
name = "start-webserver";
runtimeEnv = {
PORT = "8080";
};
text = ''
${pkgs.lib.getExe packages.webserver}
'';
}
);
};
}))
//
{
nixosConfigurations.server = nixpkgs.lib.nixosSystem {
inherit system;
modules = [
garnix-lib.nixosModules.garnix
self.nixosModules.nixcon-garnix-player-module
({ pkgs, ... }: {
playerConfig = {
# Your github user:
githubLogin = "GITHUB_USER";
# You only need to change this if you changed the forked repo name.
githubRepo = "nixcon-2024-player-template";
# The nix derivation that will be used as the server process. It
# should open a webserver on port 8080.
# The port is also provided to the process as the environment variable "PORT".
webserver = self.packages.${system}.webserver;
# If you want to log in to your deployed server, put your SSH key
# here:
sshKey = "<YOUR_PUBLIC_SSH_KEY>";
};
})
];
};
nixosModules.nixcon-garnix-player-module = ./nixcon-garnix-player-module.nix;
nixosModules.default = self.nixosModules.nixcon-garnix-player-module;
# Remove before starting the workshop - this is just for development
checks = import ./checks.nix { inherit nixpkgs self; };
};
}