From 9fbd9cbbc9f05ae3de673690d64f0e7d8e790d7f Mon Sep 17 00:00:00 2001 From: m3tam3re Date: Sun, 5 Feb 2023 14:36:38 +0100 Subject: [PATCH] finished m3-nix homeconfig --- flake.nix | 31 ++++++++----------- home/default.nix | 20 ------------ home/features/cli/default.nix | 5 ++- home/features/coding/default.nix | 8 +++++ home/features/coding/emacs.nix | 4 +++ home/features/coding/nix.nix | 4 +++ home/features/desktop/crypto.nix | 16 ++++++++++ home/features/desktop/default.nix | 13 ++++---- home/features/desktop/design.nix | 26 ++++++++++++++++ home/features/desktop/extrafonts.nix | 22 +++++++++++++ home/features/desktop/fonts.nix | 4 +-- home/features/desktop/media.nix | 31 +++++++++++++++++++ home/features/desktop/polybar.nix | 2 ++ home/features/desktop/rofi.nix | 2 +- home/features/desktop/syncthing.nix | 5 +++ home/features/gaming/default.nix | 2 -- home/features/gaming/steam.nix | 17 ---------- home/features/gaming/sunshine.nix | 2 +- home/features/virtualization/default.nix | 4 +++ home/features/virtualization/podman.nix | 16 ++++++++++ home/features/virtualization/qemu.nix | 14 +++++++++ home/users/m3tam3re/base/default.nix | 4 +++ home/users/m3tam3re/m3-nix.nix | 16 +++++----- hosts/lkk-nix-1/default.nix | 2 +- hosts/lkk-nix-1/hardware-configuration.nix | 5 +++ .../lkk-nix-1/services/containers/default.nix | 2 ++ .../lkk-nix-1/services/containers/matomo.nix | 16 ++++++++++ .../services/containers/wordpress.nix | 14 +++++++++ hosts/lkk-nix-1/services/default.nix | 4 +++ hosts/lkk-nix-1/services/gitea.nix | 5 +++ hosts/lkk-nix-1/services/mariadb.nix | 9 ++++++ hosts/lkk-nix-1/services/postgres.nix | 6 +++- hosts/lkk-nix-1/services/traefik.nix | 20 ++++++++++++ 33 files changed, 274 insertions(+), 77 deletions(-) delete mode 100644 home/default.nix create mode 100644 home/features/desktop/extrafonts.nix create mode 100644 home/features/desktop/syncthing.nix delete mode 100644 home/features/gaming/steam.nix create mode 100644 hosts/lkk-nix-1/services/containers/matomo.nix create mode 100644 hosts/lkk-nix-1/services/containers/wordpress.nix diff --git a/flake.nix b/flake.nix index 4001317..0b46c6e 100644 --- a/flake.nix +++ b/flake.nix @@ -17,32 +17,27 @@ let inherit (self) outputs; lib = nixpkgs.lib; - homecfg = home-manager.lib.homeManagerConfiguration; + allowUnfree = { nixpkgs.config.allowUnfree = true; }; in { -nixosConfigurations = { + nixosConfigurations = { lkk-nix-1 = lib.nixosSystem { specialArgs = { inherit inputs; }; - modules = [ - ./hosts/lkk-nix-1 - agenix.nixosModule - ]; + modules = [ ./hosts/lkk-nix-1 agenix.nixosModule ]; }; - }; homeConfigurations = { + }; + homeConfigurations = { # Laptop - "m3tam3re@m3-nix" = { - homecfg = { - extraSpecialArgs = { # pass things to the home configuration - }; - modules = [ ./home/users/m3tam3re/m3-nix.nix ]; + "m3tam3re@m3-nix" = home-manager.lib.homeManagerConfiguration { + pkgs = nixpkgs.legacyPackages."x86_64-linux"; + extraSpecialArgs = { # pass things to the home configuration }; + modules = [ ./home/users/m3tam3re/m3-nix.nix allowUnfree ]; }; - # Company Root Server - "m3tam3re@lkk-nix-1" = { - homecfg = { - extraSpecialArgs = { # pass things to the home configuration - }; - modules = [ ./home/users/m3tam3re/lkk-nix-1.nix ]; + # Company Root Servera + "m3tam3re@lkk-nix-1" = home-manager.lib.homeManagerConfiguration { + extraSpecialArgs = { # pass things to the home configuration }; + modules = [ ./home/users/m3tam3re/lkk-nix-1.nix ]; }; }; deploy.nodes.lkk-nix-1 = { diff --git a/home/default.nix b/home/default.nix deleted file mode 100644 index ffedea7..0000000 --- a/home/default.nix +++ /dev/null @@ -1,20 +0,0 @@ -{ ... }: - -{ - imports = [ ./tmux ]; - - nixpkgs.config = { - allowBroken = true; - allowUnfree = true; - - manual.manpages.enable = true; - }; - - systemd.user.startServices = true; - - programs = { - home-manager.enable = true; - git.enable = true; - }; - -} diff --git a/home/features/cli/default.nix b/home/features/cli/default.nix index dcd9029..e60e433 100644 --- a/home/features/cli/default.nix +++ b/home/features/cli/default.nix @@ -4,6 +4,7 @@ ./bat.nix ./fish.nix ./neofetch.nix + ./secrets.nix ./starship.nix ./tmux.nix ]; @@ -19,14 +20,16 @@ htop httpie jq - nixfmt procs progress ripgrep tldr trash-cli tree +<<<<<<< HEAD +======= unrar +>>>>>>> f7c149b (Various changes in home-config) unzip zip ]; diff --git a/home/features/coding/default.nix b/home/features/coding/default.nix index e69de29..a79e3b9 100644 --- a/home/features/coding/default.nix +++ b/home/features/coding/default.nix @@ -0,0 +1,8 @@ +{ pkgs, ... }: { + imports = [ ./emacs.nix ./golang.nix ./nix.nix ./nodejs.nix ./tools.nix ]; + + home.packages = with pkgs; + [ + + ]; +} diff --git a/home/features/coding/emacs.nix b/home/features/coding/emacs.nix index 8efe4c2..8987a7f 100644 --- a/home/features/coding/emacs.nix +++ b/home/features/coding/emacs.nix @@ -1,5 +1,9 @@ { pkgs, ... }: { +<<<<<<< HEAD + services.emacs.enable = true; +======= services.emacs.anable = true; +>>>>>>> f7c149b (Various changes in home-config) programs.emacs = { # 310 enable = true; extraPackages = epkgs: [ diff --git a/home/features/coding/nix.nix b/home/features/coding/nix.nix index dd7a931..c705419 100644 --- a/home/features/coding/nix.nix +++ b/home/features/coding/nix.nix @@ -2,7 +2,11 @@ { home.packages = with pkgs; [ appimage-run +<<<<<<< HEAD + deploy-rs +======= deloy-rs +>>>>>>> f7c149b (Various changes in home-config) nil nix-prefetch-git nixfmt diff --git a/home/features/desktop/crypto.nix b/home/features/desktop/crypto.nix index 1f5e9cc..c2eb5e3 100644 --- a/home/features/desktop/crypto.nix +++ b/home/features/desktop/crypto.nix @@ -1,3 +1,18 @@ +<<<<<<< HEAD +{ config, lib, pkgs, ... }: + +with lib; + +let cfg = config.features.desktop.crypto; + +in { + + options.features.desktop.crypto.enable = mkEnableOption "Enable Crypto"; + + config = mkIf cfg.enable { + home.packages = with pkgs; [ bisq-desktop monero-gui trezord trezor-suite ]; + }; +======= { pkgs, ... }: { home.packages = with pkgs; [ @@ -6,4 +21,5 @@ trezord trezor-suite ]; +>>>>>>> f7c149b (Various changes in home-config) } diff --git a/home/features/desktop/default.nix b/home/features/desktop/default.nix index 26def77..9fb9c5c 100644 --- a/home/features/desktop/default.nix +++ b/home/features/desktop/default.nix @@ -1,18 +1,15 @@ { pkgs, lib, outputs, ... }: { imports = [ - ./alacritty.nix ./crypto.nix ./design.nix ./i3-gaps.nix - ./fonts.nix + ./extrafonts.nix ./media.nix ./polybar.nix ./qt.nix ./rofi.nix - ./social.nix ./syncthing.nix - ./video.nix ]; xdg.mimeApps.enable = true; @@ -33,10 +30,10 @@ autotiling brave blueberry - brighnessctl + brightnessctl feh flameshot - gnome.fileroller + gnome.file-roller gnome.seahorse gnome.vinagre gsettings-desktop-schemas @@ -46,7 +43,11 @@ pasystray pavucontrol picom +<<<<<<< HEAD + qt5ct +======= qt5-ct +>>>>>>> f7c149b (Various changes in home-config) rustdesk unrar unzip diff --git a/home/features/desktop/design.nix b/home/features/desktop/design.nix index fa61ee3..e0098ac 100644 --- a/home/features/desktop/design.nix +++ b/home/features/desktop/design.nix @@ -1,3 +1,28 @@ +<<<<<<< HEAD +{ config, lib, pkgs, ... }: + +with lib; + +let cfg = config.features.desktop.design; + +in { + + options.features.desktop.design.enable = mkEnableOption "enable design tools"; + + config = mkIf cfg.enable { + home.packages = with pkgs; [ + argyllcms + darktable + gimp-with-plugins + gimpPlugins.gmic + gmic + gmic-qt + imagemagick + inkscape + lcms2 + ]; + }; +======= { pkgs, ... }: { home.packages = with pkgs; [ @@ -11,4 +36,5 @@ inkscape lcms2 ]; +>>>>>>> f7c149b (Various changes in home-config) } diff --git a/home/features/desktop/extrafonts.nix b/home/features/desktop/extrafonts.nix new file mode 100644 index 0000000..4afda44 --- /dev/null +++ b/home/features/desktop/extrafonts.nix @@ -0,0 +1,22 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let cfg = config.features.desktop.extrafonts; + +in { + + options.features.desktop.extrafonts.enable = mkEnableOption "install additional fonts for desktop apps"; + + config = mkIf cfg.enable { + home.packages = with pkgs; [ + emacs-all-the-icons-fonts + fira-code + fira-code-symbols + font-manager + font-awesome + font-awesome_4 + noto-fonts + ]; + }; +} diff --git a/home/features/desktop/fonts.nix b/home/features/desktop/fonts.nix index 9502bf6..4afda44 100644 --- a/home/features/desktop/fonts.nix +++ b/home/features/desktop/fonts.nix @@ -2,11 +2,11 @@ with lib; -let cfg = config.features.extrafonts; +let cfg = config.features.desktop.extrafonts; in { - options.features.extrafonts.enable = mkEnableOption "install additional fonts for desktop apps"; + options.features.desktop.extrafonts.enable = mkEnableOption "install additional fonts for desktop apps"; config = mkIf cfg.enable { home.packages = with pkgs; [ diff --git a/home/features/desktop/media.nix b/home/features/desktop/media.nix index ccf0faf..1ca2fc7 100644 --- a/home/features/desktop/media.nix +++ b/home/features/desktop/media.nix @@ -1,3 +1,33 @@ +<<<<<<< HEAD +{ config, lib, pkgs, ... }: + +with lib; + +let cfg = config.features.desktop.media; + +in { + + options.features.desktop.media.enable = mkEnableOption "enable media features"; + + config = mkIf cfg.enable { + home.packages = with pkgs; [ + betterdiscordctl + davinci-resolve + discord + element-desktop + ffmpeg + freetube + gphoto2 + handbrake + makemkv + mpv + obs-studio + plexamp + vlc + youtube-dl + ]; + }; +======= { pkgs, ... }: { home.packages = with pkgs; [ @@ -16,4 +46,5 @@ vlc youtube-dl ]; +>>>>>>> f7c149b (Various changes in home-config) } diff --git a/home/features/desktop/polybar.nix b/home/features/desktop/polybar.nix index fe375db..be2ff83 100644 --- a/home/features/desktop/polybar.nix +++ b/home/features/desktop/polybar.nix @@ -1,3 +1,5 @@ +{ pkgs, ... }: + { services.polybar = { enable = true; diff --git a/home/features/desktop/rofi.nix b/home/features/desktop/rofi.nix index cc2ac2e..8c4857e 100644 --- a/home/features/desktop/rofi.nix +++ b/home/features/desktop/rofi.nix @@ -1,4 +1,4 @@ -{ +{ pkgs, ... }: { programs.rofi = { enable = true; plugins = [ pkgs.rofi-calc pkgs.rofi-emoji ]; diff --git a/home/features/desktop/syncthing.nix b/home/features/desktop/syncthing.nix new file mode 100644 index 0000000..270652d --- /dev/null +++ b/home/features/desktop/syncthing.nix @@ -0,0 +1,5 @@ +{ pkgs, ... }: + +{ + services.syncthing = { enable = true; }; +} diff --git a/home/features/gaming/default.nix b/home/features/gaming/default.nix index 3fc58a1..2fddfd5 100644 --- a/home/features/gaming/default.nix +++ b/home/features/gaming/default.nix @@ -1,7 +1,6 @@ { pkgs, ... }: { imports = [ - ./steam.nix ./sunshine.nix ]; @@ -14,5 +13,4 @@ winetricks ]; - programs.gamemode.enable = true; } diff --git a/home/features/gaming/steam.nix b/home/features/gaming/steam.nix deleted file mode 100644 index 2d9c713..0000000 --- a/home/features/gaming/steam.nix +++ /dev/null @@ -1,17 +0,0 @@ -{ config, lib, pkgs, ... }: - -with lib; - -let cfg = config.features.gaming.steam; - -in { - - options.features.gaming.steam.enable = mkEnableOption "enable Steam"; - - config = mkIf cfg.enable { - programs.steam = { - enable = true; - remotePlay.openFirewall = true; - dedicatedServer.openFirewall = true; - }; -} diff --git a/home/features/gaming/sunshine.nix b/home/features/gaming/sunshine.nix index 806c85d..54af93a 100644 --- a/home/features/gaming/sunshine.nix +++ b/home/features/gaming/sunshine.nix @@ -2,7 +2,7 @@ with lib; -let cfg = config.features.gaming.steam; +let cfg = config.features.gaming.sunshine; in { diff --git a/home/features/virtualization/default.nix b/home/features/virtualization/default.nix index 7f9e43c..190ec36 100644 --- a/home/features/virtualization/default.nix +++ b/home/features/virtualization/default.nix @@ -1,4 +1,8 @@ +<<<<<<< HEAD +{ imports = [ ./podman.nix ./qemu.nix ]; } +======= imports = [ ./podman.nix ./qemu.nix ]; +>>>>>>> f7c149b (Various changes in home-config) diff --git a/home/features/virtualization/podman.nix b/home/features/virtualization/podman.nix index e69de29..6e0c7b3 100644 --- a/home/features/virtualization/podman.nix +++ b/home/features/virtualization/podman.nix @@ -0,0 +1,16 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let cfg = config.features.virtualization.podman; + +in { + + options.features.virtualization.podman.enable = mkEnableOption "install podman"; + + config = mkIf cfg.enable { + home.packages = with pkgs; [ + podman + ]; + }; +} diff --git a/home/features/virtualization/qemu.nix b/home/features/virtualization/qemu.nix index ec4d45c..8b680fa 100644 --- a/home/features/virtualization/qemu.nix +++ b/home/features/virtualization/qemu.nix @@ -1,7 +1,21 @@ +<<<<<<< HEAD +{ config, lib, pkgs, ... }: + +with lib; + +let cfg = config.features.virtualization.qemu; + +in { + + options.features.virtualization.qemu.enable = mkEnableOption "install qemu tools"; + config = + mkIf cfg.enable { home.packages = with pkgs; [ virt-manager virtiofsd ]; }; +======= { pkgs, ... }: { home.packages = with pkgs; [ virt-manager virtiofsd ]; +>>>>>>> f7c149b (Various changes in home-config) } diff --git a/home/users/m3tam3re/base/default.nix b/home/users/m3tam3re/base/default.nix index 9d01ce9..5602638 100644 --- a/home/users/m3tam3re/base/default.nix +++ b/home/users/m3tam3re/base/default.nix @@ -4,6 +4,10 @@ let in { programs = { home-manager.enable = true; +<<<<<<< HEAD + git.enable = true; +======= +>>>>>>> f7c149b (Various changes in home-config) git = { userName = "m3tam3re"; userEmail = "m@m3tam3re.com"; diff --git a/home/users/m3tam3re/m3-nix.nix b/home/users/m3tam3re/m3-nix.nix index 1282ebc..eed9b11 100644 --- a/home/users/m3tam3re/m3-nix.nix +++ b/home/users/m3tam3re/m3-nix.nix @@ -12,20 +12,22 @@ cli = { fish.enable = true; neofetch.enable = true; + secrets.enable = true; starship.enable = true; tmux.enable = true; }; - gaming = { - steam.enable = true; - sunshine.enable = true; - }; + gaming = { sunshine.enable = true; }; desktop = { - + crypto.enable = true; + design.enable = true; + extrafonts.enable = true; + media.enable = true; }; virtualization = { - + podman.enable = true; + qemu.enable = true; }; - + }; home.stateVersion = "22.11"; diff --git a/hosts/lkk-nix-1/default.nix b/hosts/lkk-nix-1/default.nix index 528b5b8..9ffb05b 100644 --- a/hosts/lkk-nix-1/default.nix +++ b/hosts/lkk-nix-1/default.nix @@ -19,7 +19,7 @@ from = 3000; to = 3100; }]; - firewall.allowedTCPPorts = [ 80 443 5432 3478 ]; + firewall.allowedTCPPorts = [ 80 443 5432 3306 3478 ]; firewall.allowedUDPPortRanges = [{ from = 3478; to = 3481; diff --git a/hosts/lkk-nix-1/hardware-configuration.nix b/hosts/lkk-nix-1/hardware-configuration.nix index 0063d0a..aa4baa7 100644 --- a/hosts/lkk-nix-1/hardware-configuration.nix +++ b/hosts/lkk-nix-1/hardware-configuration.nix @@ -36,6 +36,11 @@ fsType = "vfat"; }; + fileSystems."/var/backup" = + { device = "46.38.248.210:/voln527829a1"; + fsType = "nfs"; + }; + swapDevices = [ ]; # Enables DHCP on each ethernet and wireless interface. In case of scripted networking diff --git a/hosts/lkk-nix-1/services/containers/default.nix b/hosts/lkk-nix-1/services/containers/default.nix index 97a6b69..19213ea 100644 --- a/hosts/lkk-nix-1/services/containers/default.nix +++ b/hosts/lkk-nix-1/services/containers/default.nix @@ -1,5 +1,7 @@ { imports = [ ./baserow.nix + ./matomo.nix + ./wordpress.nix ]; } diff --git a/hosts/lkk-nix-1/services/containers/matomo.nix b/hosts/lkk-nix-1/services/containers/matomo.nix new file mode 100644 index 0000000..06f7700 --- /dev/null +++ b/hosts/lkk-nix-1/services/containers/matomo.nix @@ -0,0 +1,16 @@ +{ config, outputs, ... }: { + virtualisation.oci-containers.containers."matomo" = { + image = "docker.io/matomo"; + environment = { + MATOMO_DATABASE_HOST = "mysql"; + MATOMO_DATABASE_USERNAME = "matomo"; + MATOMO_DATABASE_PASSWORD = "matomo"; + MATOMO_DATABASE_DBNAME = "matomo"; + PHP_MEMORY_LIMIT="2048M"; + + }; + ports = [ "3003:80" ]; + volumes = [ "matomo_data:/var/www/html" ]; + extraOptions = [ "--add-host=mysql:10.88.0.1" ]; + }; +} diff --git a/hosts/lkk-nix-1/services/containers/wordpress.nix b/hosts/lkk-nix-1/services/containers/wordpress.nix new file mode 100644 index 0000000..3ff8f90 --- /dev/null +++ b/hosts/lkk-nix-1/services/containers/wordpress.nix @@ -0,0 +1,14 @@ +{ config, outputs, ... }: { + virtualisation.oci-containers.containers."lanakk_blog" = { + image = "docker.io/wordpress"; + environment = { + WORDPRESS_DB_HOST = "mysql"; + WORDPRESS_DB_USER = "wp"; + WORDPRESS_DB_PASSWORD = "wp"; + WORDPRESS_DB_NAME = "lanakk_blog"; + }; + ports = [ "3002:80" ]; + volumes = [ "lanakk_blog_data:/var/www/html" ]; + extraOptions = [ "--add-host=mysql:10.88.0.1" ]; + }; +} diff --git a/hosts/lkk-nix-1/services/default.nix b/hosts/lkk-nix-1/services/default.nix index 7714f01..6e27b8f 100644 --- a/hosts/lkk-nix-1/services/default.nix +++ b/hosts/lkk-nix-1/services/default.nix @@ -2,7 +2,11 @@ imports = [ ./container.nix ./gitea.nix +<<<<<<< HEAD + ./mariadb.nix +======= ./mysql.nix +>>>>>>> f7c149b (Various changes in home-config) ./n8n.nix ./postgres.nix ./traefik.nix diff --git a/hosts/lkk-nix-1/services/gitea.nix b/hosts/lkk-nix-1/services/gitea.nix index 52eed93..48ae586 100644 --- a/hosts/lkk-nix-1/services/gitea.nix +++ b/hosts/lkk-nix-1/services/gitea.nix @@ -2,5 +2,10 @@ services.gitea = { enable = true; rootUrl = "https://code.lanakk.com"; + dump = { + enable = true; + interval = "03:30:00"; + backupDir = "/var/backup/gitea"; + }; }; } diff --git a/hosts/lkk-nix-1/services/mariadb.nix b/hosts/lkk-nix-1/services/mariadb.nix index 2246d78..a5430ee 100644 --- a/hosts/lkk-nix-1/services/mariadb.nix +++ b/hosts/lkk-nix-1/services/mariadb.nix @@ -4,4 +4,13 @@ services.mysql = { enable = true; package = pkgs.mariadb; +<<<<<<< HEAD + }; + services.mysqlBackup = { + enable = true; + calendar = "03:00:00"; + databases = [ "lanakk_blog" ]; + }; +======= +>>>>>>> f7c149b (Various changes in home-config) } diff --git a/hosts/lkk-nix-1/services/postgres.nix b/hosts/lkk-nix-1/services/postgres.nix index 2d24fd0..e234a36 100644 --- a/hosts/lkk-nix-1/services/postgres.nix +++ b/hosts/lkk-nix-1/services/postgres.nix @@ -18,5 +18,9 @@ ALTER DATABASE baserow OWNER to baserow; ''; }; - # services.postgresqlBackup.enable = true; + services.postgresqlBackup = { + enable = true; + startAt = "03:10:00"; + databases = [ "baserow" ]; + }; } diff --git a/hosts/lkk-nix-1/services/traefik.nix b/hosts/lkk-nix-1/services/traefik.nix index 5842d28..c82be15 100644 --- a/hosts/lkk-nix-1/services/traefik.nix +++ b/hosts/lkk-nix-1/services/traefik.nix @@ -37,6 +37,8 @@ baserow.loadBalancer.servers = [{ url = "http://localhost:3001/"; }]; gitea.loadBalancer.servers = [{ url = "http://localhost:3000/"; }]; n8n.loadBalancer.servers = [{ url = "http://localhost:5678/"; }]; + lanakk_blog.loadBalancer.servers = [{ url = "http://localhost:3002/"; }]; + matomo.loadBalancer.servers = [{ url = "http://localhost:3003/"; }]; }; routers = { api = { @@ -70,6 +72,24 @@ service = "n8n"; entrypoints = "websecure"; }; + lanakk_blog = { + rule = "Host(`www.weltkarte-pinnwand.com`)"; + tls = { + certResolver = "godaddy"; + domains = "www.weltkarte-pinnwand.com"; + }; + service = "lanakk_blog"; + entrypoints = "websecure"; + }; + matomo = { + rule = "Host(`stats.lanakk.com`)"; + tls = { + certResolver = "godaddy"; + domains = "stats.lanakk.com"; + }; + service = "matomo"; + entrypoints = "websecure"; + }; }; }; };