This repository has been archived by the owner on May 12, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdefault.nix
79 lines (65 loc) · 1.88 KB
/
default.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
{ sources ? import ./nix/sources.nix
}:
let
# default nixpkgs
pkgs = import sources.nixpkgs { };
pre-commit-hooks = (import sources."pre-commit-hooks.nix");
gitignoreSource = (import sources."gitignore.nix" { inherit (pkgs) lib; }).gitignoreSource;
src = gitignoreSource ./.;
face-detect-app = import ./nix/face-detect-app.nix { };
# A VM that can be used for testing the NixOS configuration
vm = (
import "${sources.nixpkgs}/nixos" {
configuration = {
imports = [ ./nixos/configuration.nix ];
networking.hostName = "face-detect-app";
users = {
mutableUsers = false;
users.root.password = "";
};
virtualisation = {
cores = 2;
memorySize = "4096";
};
};
system = "x86_64-linux";
}
).vm;
# The NixOS configuration that reflects the EC2 instance we run on
machine = (
import "${sources.nixpkgs}/nixos" {
configuration = {
imports = [ ./nixos/configuration.nix "${sources.nixpkgs}/nixos/modules/virtualisation/amazon-image.nix" ];
networking.hostName = "face-detect-app";
ec2.hvm = true;
swapDevices = [{ device = "/dev/xvdb"; }];
};
system = "x86_64-linux";
}
).system;
in
{
inherit pkgs src;
# provided by shell.nix
devTools = {
inherit (pkgs) niv;
inherit (pre-commit-hooks) pre-commit;
inherit (pre-commit-hooks) nixpkgs-fmt;
inherit (face-detect-app) face-detect-app-env;
};
# to be built by github actions
ci = {
pre-commit-check = pre-commit-hooks.run {
inherit src;
hooks = {
shellcheck.enable = true;
nixpkgs-fmt.enable = true;
nix-linter.enable = true;
};
# generated files
excludes = [ "^nix/sources\.nix$" "^nixos/cachix*" ];
};
inherit src vm machine;
inherit (face-detect-app) face-detect-app-env;
};
}