From c2eeb342e9bb53b30a35b07fa57d1f66e74746a2 Mon Sep 17 00:00:00 2001 From: Alexandre LUCAZEAU Date: Thu, 26 May 2022 19:24:07 +0000 Subject: [PATCH] DEL unused services/common.nix and services/users.nix ADD grafana.nix --- hosts/services/common.nix | 13 ---------- hosts/services/configuration.nix | 1 + hosts/services/users.nix | 41 -------------------------------- modules/grafana.nix | 35 +++++++++++++++++++++++++++ 4 files changed, 36 insertions(+), 54 deletions(-) delete mode 100644 hosts/services/common.nix delete mode 100644 hosts/services/users.nix create mode 100644 modules/grafana.nix diff --git a/hosts/services/common.nix b/hosts/services/common.nix deleted file mode 100644 index fc6dfb3..0000000 --- a/hosts/services/common.nix +++ /dev/null @@ -1,13 +0,0 @@ -{ config, pkgs, ...}: -{ - environment.variables.EDITOR = "nvim"; - environment.systemPackages = with pkgs; [ - gitAndTools.gitFull - unzip - zip - tmux - lshw - bc - neovim - ]; -} diff --git a/hosts/services/configuration.nix b/hosts/services/configuration.nix index ef3d509..fc961ae 100644 --- a/hosts/services/configuration.nix +++ b/hosts/services/configuration.nix @@ -3,6 +3,7 @@ ./hardware-configuration.nix ../modules/users.nix ../modules/common.nix + ../modules/grafana.nix ]; diff --git a/hosts/services/users.nix b/hosts/services/users.nix deleted file mode 100644 index 80e35a7..0000000 --- a/hosts/services/users.nix +++ /dev/null @@ -1,41 +0,0 @@ -{ config, pkgs, ...}: -{ - users = { - groups = { - alexandre = {}; - }; - users = { - alexandre = { - isNormalUser = true; - createHome = true; - home = "/home/alexandre"; - description = "Alexandre LUCAZEAU"; - extraGroups = [ "wheel" ]; - group = "alexandre"; - shell = pkgs.fish; - openssh.authorizedKeys.keys = [ "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKUA1RW6JwZasspAp8qmFRFnlV5WXjhLfStAAkM+KYLv lucazeau.alexandre@gmail.com" ]; - }; - }; - }; - programs.git = { - enable = true; - config.user.email = "lucazeau.alexandre@gmail.com"; - config.user.name = "Alexandre LUCAZEAU"; - config.init.defaultBranch = "main"; - config.core.sshCommand = "ssh -i ~/.ssh/id_ed25519-perso"; - }; - programs.fish.enable = true; - programs.fish.shellAliases = { - ll = "ls -l"; - ls = "ls --color=tty"; - vi = "nvim"; - vim = "nvim"; - }; - security.sudo = { - enable = true; - execWheelOnly = true; - extraRules = [ - { users = [ "alexandre" ]; commands = [ { command = "ALL"; options = [ "NOPASSWD" ]; } ]; } - ]; - }; -} diff --git a/modules/grafana.nix b/modules/grafana.nix new file mode 100644 index 0000000..1a18162 --- /dev/null +++ b/modules/grafana.nix @@ -0,0 +1,35 @@ +{ config, pkgs, ...}: +let + caddyDir = "/var/lib/caddy"; +in +{ +services.grafana = { + enable = true; + domain = "sup.atlanticaweb"; + port = 2342; + addr = "127.0.0.1"; + }; +services.caddy = { + enable = true; + email = "lucazeau.alexandre@gmail.com"; + config = '' + { + storage file_system { + root ${caddyDir} + } + } + https://grafana.atlanticaweb.fr { + reverse_proxy http://127.0.0.1:${toString config.services.grafana.port} + } + ''; +}; +users.users.caddy = { + group = "caddy"; + uid = config.ids.uids.caddy; + home = caddyDir; + createHome = true; + extraGroups = [ "users" ]; +}; + +users.groups.caddy.gid = config.ids.uids.caddy; +}