-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathdefault.nix
49 lines (42 loc) · 1.14 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
# Based off the amazing article by
# https://nixos.mayflower.consulting/blog/2018/09/11/custom-images/
{
nixpkgs ? <nixpkgs>,
configMixin ? null
}:
let
# The default configurations of this image.
# Want to make your own? You should **definitely** start from the minimal.
configurations = {
minimal = passedPkgs:
{
imports = [
"${nixpkgs}/nixos/modules/virtualisation/digital-ocean-image.nix"
];
networking.hostName = "nixos";
services = {
sshd.enable = true;
cloud-init.enable = true;
};
environment.systemPackages = with nixpkgs; [
];
};
};
mkConfiguredNixOsForDigitalOceanImage = configuration:
builtins.trace "Got config:"
builtins.trace configuration
(
let
instantiatedNixOs = import "${nixpkgs}/nixos" {
inherit configuration;
system = "x86_64-linux";
};
in
instantiatedNixOs.config.system.build.digitalOceanImage
);
in
{
minimal =
builtins.trace "Building minimal image..."
mkConfiguredNixOsForDigitalOceanImage (configurations.minimal nixpkgs);
}