forked from sio2project/oioioi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
90 lines (82 loc) · 2.79 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
{
description = "The main component of the SIO2 project";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/release-24.05";
inputs.flake-utils.url = "github:numtide/flake-utils";
inputs.filetracker = {
url = "github:Stowarzyszenie-Talent/filetracker";
inputs.nixpkgs.follows = "nixpkgs";
};
inputs.sioworkers = {
url = "github:Stowarzyszenie-Talent/sioworkers";
inputs.nixpkgs.follows = "nixpkgs";
inputs.filetracker.follows = "filetracker";
};
inputs.extra-container = {
url = "github:erikarvstedt/extra-container";
inputs.nixpkgs.follows = "nixpkgs";
};
outputs = { self, nixpkgs, flake-utils, filetracker, sioworkers, extra-container }:
let
overlays = [
sioworkers.overlays.default
filetracker.overlays.default
];
module = { pkgs, lib, config, ... }: import ./nix/module.nix {
# Use pinned nixpkgs from our input for epic reproducibility.
pkgs = import nixpkgs {
inherit (pkgs) system; inherit overlays;
};
inherit lib config;
};
in
{
lib = import ./nix/lib { inherit (nixpkgs) lib; };
nixosModules.default = {
nixpkgs.overlays = overlays;
imports = [
filetracker.nixosModules.default
sioworkers.nixosModules.self
module
];
};
} // (flake-utils.lib.eachSystem [ "x86_64-linux" ] (system:
let
pkgs = import nixpkgs {
inherit system overlays;
};
in
{
packages.default = pkgs.python311Packages.callPackage ./nix/package.nix { };
packages.extra-container = extra-container.lib.buildContainers {
inherit nixpkgs system;
# Only set this if the `system.stateVersion` of your container
# host is < 22.05
# legacyInstallDirs = true;
config.containers.oioioi = {
extra = {
# Sets
# privateNetwork = true
# hostAddress = "${addressPrefix}.1"
# localAddress = "${addressPrefix}.2"
# addressPrefix = "10.221.0";
addressPrefix = "10.250.0";
# Enable internet access for the container
enableWAN = true;
# Always allow connections from hostAddress
firewallAllowHost = true;
# Make the container's localhost reachable via localAddress
exposeLocalhost = true;
};
# sio2jail requires this capability
additionalCapabilities = [ "CAP_PERFMON" ];
extraFlags = [ "--system-call-filter=perf_event_open" ];
config = { system, ... }: {
imports = [
self.nixosModules.default
./nix/container.nix
];
};
};
};
}));
}