Browse Source

refactor into lib/lxc-container,shared for grafana

container/radius
Astro 5 months ago
parent
commit
79db592b0a
5 changed files with 47 additions and 30 deletions
  1. 3
    0
      .gitmodules
  2. 2
    30
      hosts/storage-ng/grafana/configuration.nix
  3. 30
    0
      lib/lxc-container.nix
  4. 11
    0
      lib/shared.nix
  5. 1
    0
      secrets

+ 3
- 0
.gitmodules View File

@@ -0,0 +1,3 @@
1
+[submodule "secrets"]
2
+	path = secrets
3
+	url = ssh://git@gitea.c3d2.de:2222/c3d2-admins/secrets.git

+ 2
- 30
hosts/storage-ng/grafana/configuration.nix View File

@@ -2,48 +2,20 @@
2 2
 
3 3
 {
4 4
   imports =
5
-    [ <nixpkgs/nixos/modules/profiles/minimal.nix>
5
+    [ ../../../lib/lxc-container.nix
6
+      ../../../lib/shared.nix
6 7
     ];
7
-  nix.useSandbox = false;
8
-  nix.maxJobs = lib.mkDefault 2;
9
-  nix.buildCores = lib.mkDefault 16;
10
-
11
-  boot.isContainer = true;
12
-  # /sbin/init
13
-  boot.loader.initScript.enable = true;
14
-  boot.loader.grub.enable = false;
15
-
16
-  fileSystems."/" = { fsType = "rootfs"; device = "rootfs"; };
17 8
 
18 9
   networking.hostName = "grafana";
19 10
   networking.useNetworkd = true;
20 11
   networking.defaultGateway = "172.22.99.4";
21 12
 
22
-  # Set your time zone.
23
-  time.timeZone = "Europe/Berlin";
24
-  # Select internationalisation properties.
25
-  i18n = {
26
-    defaultLocale = "en_US.UTF-8";
27
-    supportedLocales = lib.mkForce [ "en_US.UTF-8/UTF-8" ];
28
-  };
29
-
30 13
   # List packages installed in system profile. To search, run:
31 14
   # $ nix search wget
32 15
   environment.systemPackages = with pkgs; [
33 16
     vim
34 17
   ];
35 18
 
36
-  # Create a few files early before packing tarball for Proxmox
37
-  # architecture/OS detection.
38
-  system.extraSystemBuilderCmds = 
39
-      ''
40
-          mkdir -m 0755 -p $out/bin
41
-          ln -s ${pkgs.bash}/bin/bash $out/bin/sh
42
-          mkdir -m 0755 -p $out/sbin
43
-          ln -s ../init $out/sbin/init
44
-      '';
45
-
46
-
47 19
   # http https
48 20
   networking.firewall.allowedTCPPorts = [ 80 443 ];
49 21
   # collectd

+ 30
- 0
lib/lxc-container.nix View File

@@ -0,0 +1,30 @@
1
+{ pkgs, lib, ... }:
2
+
3
+{
4
+  imports =
5
+    [ <nixpkgs/nixos/modules/profiles/minimal.nix>
6
+    ];
7
+  nix.useSandbox = false;
8
+  nix.maxJobs = lib.mkDefault 1;
9
+  nix.buildCores = lib.mkDefault 4;
10
+
11
+  boot.isContainer = true;
12
+  # /sbin/init
13
+  boot.loader.initScript.enable = true;
14
+  boot.loader.grub.enable = false;
15
+
16
+  # Create a few files early before packing tarball for Proxmox
17
+  # architecture/OS detection.
18
+  system.extraSystemBuilderCmds = 
19
+      ''
20
+          mkdir -m 0755 -p $out/bin
21
+          ln -s ${pkgs.bash}/bin/bash $out/bin/sh
22
+          mkdir -m 0755 -p $out/sbin
23
+          ln -s ../init $out/sbin/init
24
+      '';
25
+
26
+  fileSystems."/" = { fsType = "rootfs"; device = "rootfs"; };
27
+
28
+  # Required for remote deployment
29
+  services.openssh.enable = true;
30
+}

+ 11
- 0
lib/shared.nix View File

@@ -0,0 +1,11 @@
1
+{ lib, ... }:
2
+
3
+{
4
+  # Set your time zone.
5
+  time.timeZone = "Europe/Berlin";
6
+  # Select internationalisation properties.
7
+  i18n = {
8
+    defaultLocale = "en_US.UTF-8";
9
+    supportedLocales = lib.mkForce [ "en_US.UTF-8/UTF-8" ];
10
+  };
11
+}

+ 1
- 0
secrets

@@ -0,0 +1 @@
1
+Subproject commit 16d7de68c8468e0f347092526150d72d4fd5fc93

Loading…
Cancel
Save