From d4a14b79c37e56c5592b7ecfbd474c8815ed552d Mon Sep 17 00:00:00 2001 From: m3tam3re Date: Mon, 9 Jan 2023 16:03:01 +0100 Subject: [PATCH] Skeleton for docker container, agenix added --- flake.nix | 8 +- home/features/cli/default.nix | 1 + home/features/cli/fish.nix | 4 +- home/features/cli/neofetch.nix | 6 +- home/features/cli/starship.nix | 4 +- home/features/cli/tmux.nix | 92 ++++++++++--------- home/features/desktop/#fonts.nix# | 22 ----- home/features/gaming/default.nix | 5 + home/features/gaming/emulation.nix | 0 home/features/gaming/steam.nix | 12 ++- home/features/gaming/sunshine.nix | 16 ++++ home/users/m3tam3re/#m3-nix.nix# | 18 ---- home/users/m3tam3re/.#m3-nix.nix | 1 - home/users/m3tam3re/lkk-nix-1.nix | 18 ++-- home/users/m3tam3re/m3-nix.nix | 43 +++++---- .../services/docker-containers/baserow.nix | 33 +++++++ .../services/docker-containers/default.nix | 5 + hosts/lkk-nix-1/services/docker.nix | 5 + secrets.nix | 6 ++ secrets/mj-smtp-pass.age | 16 ++++ secrets/mj-smtp-user.age | 16 ++++ 21 files changed, 208 insertions(+), 123 deletions(-) delete mode 100644 home/features/desktop/#fonts.nix# delete mode 100644 home/features/gaming/emulation.nix delete mode 100644 home/users/m3tam3re/#m3-nix.nix# delete mode 120000 home/users/m3tam3re/.#m3-nix.nix create mode 100644 hosts/lkk-nix-1/services/docker-containers/baserow.nix create mode 100644 hosts/lkk-nix-1/services/docker-containers/default.nix create mode 100644 secrets.nix create mode 100644 secrets/mj-smtp-pass.age create mode 100644 secrets/mj-smtp-user.age diff --git a/flake.nix b/flake.nix index dbdfcbc..9fbfe68 100644 --- a/flake.nix +++ b/flake.nix @@ -5,6 +5,7 @@ inputs = { home-manager = { + agenix.url = "github:ryantm/agenix"; url = "github:nix-community/home-manager"; inputs.nixpkgs.follows = "nixpkgs"; }; @@ -12,7 +13,7 @@ deploy-rs.url = "github:serokell/deploy-rs"; }; - outputs = { self, nixpkgs, home-manager, deploy-rs, ... }@inputs: + outputs = { self, nixpkgs, home-manager, agenix, deploy-rs, ... }@inputs: let inherit (self) outputs; lib = nixpkgs.lib; @@ -21,7 +22,10 @@ nixosConfigurations = { lkk-nix-1 = lib.nixosSystem { specialArgs = { inherit inputs; }; - modules = [ ./hosts/lkk-nix-1 ]; + modules = [ + ./hosts/lkk-nix-1 + agenix.nixosModules.age + ]; }; }; homeConfigurations = { diff --git a/home/features/cli/default.nix b/home/features/cli/default.nix index 1f43015..e6a7307 100644 --- a/home/features/cli/default.nix +++ b/home/features/cli/default.nix @@ -12,6 +12,7 @@ autojump bc comma + direnv exa fd httpie diff --git a/home/features/cli/fish.nix b/home/features/cli/fish.nix index 5eb767e..ca9982c 100644 --- a/home/features/cli/fish.nix +++ b/home/features/cli/fish.nix @@ -2,11 +2,11 @@ with lib; -let cfg = config.features.fish; +let cfg = config.features.cli.fish; in { - options.features.fish.enable = mkEnableOption "enable fish shell"; + options.features.cli.fish.enable = mkEnableOption "enable fish shell"; config = mkIf cfg.enable { programs.fish = { diff --git a/home/features/cli/neofetch.nix b/home/features/cli/neofetch.nix index b645ea2..093d8a8 100644 --- a/home/features/cli/neofetch.nix +++ b/home/features/cli/neofetch.nix @@ -2,11 +2,11 @@ with lib; -let cfg = config.features.neofetch; - +let cfg = config.features.cli.neofetch; + in { - options.features.neofetch.enable = mkEnableOption "enable neofetch shell"; + options.features.cli.neofetch.enable = mkEnableOption "enable neofetch"; config = mkIf cfg.enable { programs.fish.interactiveShellInit = "neofetch --ascii-distro nixos"; diff --git a/home/features/cli/starship.nix b/home/features/cli/starship.nix index f3952ae..ddd7014 100644 --- a/home/features/cli/starship.nix +++ b/home/features/cli/starship.nix @@ -2,11 +2,11 @@ with lib; -let cfg = config.features.fish; +let cfg = config.features.cli.starship; in { - options.features.starship.enable = mkEnableOption "enable starship prompt"; + options.features.cli.starship.enable = mkEnableOption "enable starship prompt"; config = mkIf cfg.enable { programs.starship = { diff --git a/home/features/cli/tmux.nix b/home/features/cli/tmux.nix index f20faae..1a5bc36 100644 --- a/home/features/cli/tmux.nix +++ b/home/features/cli/tmux.nix @@ -2,57 +2,59 @@ with lib; -let cfg = config.features.tmux; +let cfg = config.features.cli.tmux; in { - options.features.neofetch.enable = mkEnableOption "enable neofetch shell"; + options.features.cli.tmux.enable = mkEnableOption "enable tmux"; - programs.tmux = { - enable = true; - shortcut = "a"; - keyMode = "vi"; - clock24 = true; - extraConfig = '' - # Enable mouse mode (tmux 2.1 and above) - set -g mouse on + config = mkIf cfg.enable { + programs.tmux = { + enable = true; + shortcut = "a"; + keyMode = "vi"; + clock24 = true; + extraConfig = '' + # Enable mouse mode (tmux 2.1 and above) + set -g mouse on - # split panes using | and - - bind | split-window -h - bind - split-window -v - unbind '"' - unbind % + # split panes using | and - + bind | split-window -h + bind - split-window -v + unbind '"' + unbind % - # change status bar color - bind-key r source-file ~/.tmux.conf \; display-message "Konfiguration neu geladen" + # change status bar color + bind-key r source-file ~/.tmux.conf \; display-message "Konfiguration neu geladen" - # status bar theme - set -g status-bg 'colour235' - #set -g message-command-fg 'colour222' - set -g status-justify 'centre' - set -g status-left-length '100' - set -g status 'on' - #set -g pane-active-border-fg 'colour154' - #set -g message-bg 'colour238' - set -g status-right-length '100' - #set -g status-right-attr 'none' - #set -g message-fg 'colour222' - #set -g message-command-bg 'colour238' - #set -g status-attr 'none' - #set -g status-utf8 'on' - #set -g pane-border-fg 'colour238' - #set -g status-left-attr 'none' - #setw -g window-status-fg 'colour121' - #setw -g window-status-attr 'none' - #setw -g window-status-activity-bg 'colour235' - #setw -g window-status-activity-attr 'none' - #setw -g window-status-activity-fg 'colour154' - setw -g window-status-separator ' ' - #setw -g window-status-bg 'colour235' - set -g status-left '#[fg=colour232,bg=colour154] #S #[fg=colour154,bg=colour238,nobold,nounderscore,noitalics]î‚°#[fg=colour222,bg=colour238] #W #[fg=colour238,bg=colour235,nobold,nounderscore,noitalics]î‚°#[fg=colour121,bg=colour235] #(whoami)  #(uptime | cut -d " " -f 1,2,3) #[fg=colour235,bg=colour235,nobold,nounderscore,noitalics]î‚°' - set -g status-right '#[fg=colour235,bg=colour235,nobold,nounderscore,noitalics]#[fg=colour121,bg=colour235] %r  %a  %Y #[fg=colour238,bg=colour235,nobold,nounderscore,noitalics]#[fg=colour222,bg=colour238] #H #[fg=colour154,bg=colour238,nobold,nounderscore,noitalics]#[fg=colour232,bg=colour154] #(rainbarf --battery --remaining --no-rgb) ' - setw -g window-status-format '#[fg=colour235,bg=colour235,nobold,nounderscore,noitalics]î‚°#[default] #I  #W #[fg=colour235,bg=colour235,nobold,nounderscore,noitalics]î‚°' - setw -g window-status-current-format '#[fg=colour235,bg=colour238,nobold,nounderscore,noitalics]î‚°#[fg=colour222,bg=colour238] #I  #W  #F #[fg=colour238,bg=colour235,nobold,nounderscore,noitalics]î‚°' - ''; + # status bar theme + set -g status-bg 'colour235' + #set -g message-command-fg 'colour222' + set -g status-justify 'centre' + set -g status-left-length '100' + set -g status 'on' + #set -g pane-active-border-fg 'colour154' + #set -g message-bg 'colour238' + set -g status-right-length '100' + #set -g status-right-attr 'none' + #set -g message-fg 'colour222' + #set -g message-command-bg 'colour238' + #set -g status-attr 'none' + #set -g status-utf8 'on' + #set -g pane-border-fg 'colour238' + #set -g status-left-attr 'none' + #setw -g window-status-fg 'colour121' + #setw -g window-status-attr 'none' + #setw -g window-status-activity-bg 'colour235' + #setw -g window-status-activity-attr 'none' + #setw -g window-status-activity-fg 'colour154' + setw -g window-status-separator ' ' + #setw -g window-status-bg 'colour235' + set -g status-left '#[fg=colour232,bg=colour154] #S #[fg=colour154,bg=colour238,nobold,nounderscore,noitalics]î‚°#[fg=colour222,bg=colour238] #W #[fg=colour238,bg=colour235,nobold,nounderscore,noitalics]î‚°#[fg=colour121,bg=colour235] #(whoami)  #(uptime | cut -d " " -f 1,2,3) #[fg=colour235,bg=colour235,nobold,nounderscore,noitalics]î‚°' + set -g status-right '#[fg=colour235,bg=colour235,nobold,nounderscore,noitalics]#[fg=colour121,bg=colour235] %r  %a  %Y #[fg=colour238,bg=colour235,nobold,nounderscore,noitalics]#[fg=colour222,bg=colour238] #H #[fg=colour154,bg=colour238,nobold,nounderscore,noitalics]#[fg=colour232,bg=colour154] #(rainbarf --battery --remaining --no-rgb) ' + setw -g window-status-format '#[fg=colour235,bg=colour235,nobold,nounderscore,noitalics]î‚°#[default] #I  #W #[fg=colour235,bg=colour235,nobold,nounderscore,noitalics]î‚°' + setw -g window-status-current-format '#[fg=colour235,bg=colour238,nobold,nounderscore,noitalics]î‚°#[fg=colour222,bg=colour238] #I  #W  #F #[fg=colour238,bg=colour235,nobold,nounderscore,noitalics]î‚°' + ''; + }; }; } diff --git a/home/features/desktop/#fonts.nix# b/home/features/desktop/#fonts.nix# deleted file mode 100644 index 6591007..0000000 --- a/home/features/desktop/#fonts.nix# +++ /dev/null @@ -1,22 +0,0 @@ -{ config, lib, pkgs, ... }: - -with lib; - -let cfg = config.features.extrafonts; - -in { - - options.features.extrafonts.enable = mkEnableOption "install additional fonts for desktop apps"; - - config = mkIf cfg.enable { - home.packages = with pkgs; [ - fira-code - fira-code-symbols - font-manager - font-awesome - font-awesome_4 - nerdfonts - noto-fonts - ]; - }; -} diff --git a/home/features/gaming/default.nix b/home/features/gaming/default.nix index f703e8a..8a9b2f4 100644 --- a/home/features/gaming/default.nix +++ b/home/features/gaming/default.nix @@ -1,11 +1,16 @@ { pkgs, ... }: { + imports = [ ./steam.nix + ./sunshine.nix ]; + home.packages = with pkgs; [ gamescope goverlay mangohud + protonup-ng ]; + programs.gamemode.enable = true; } diff --git a/home/features/gaming/emulation.nix b/home/features/gaming/emulation.nix deleted file mode 100644 index e69de29..0000000 diff --git a/home/features/gaming/steam.nix b/home/features/gaming/steam.nix index a661434..2d9c713 100644 --- a/home/features/gaming/steam.nix +++ b/home/features/gaming/steam.nix @@ -1,4 +1,14 @@ -{ +{ 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; diff --git a/home/features/gaming/sunshine.nix b/home/features/gaming/sunshine.nix index e69de29..0aa615f 100644 --- a/home/features/gaming/sunshine.nix +++ b/home/features/gaming/sunshine.nix @@ -0,0 +1,16 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let cfg = config.features.gaming.steam; + +in { + + options.features.gaming.sunshine.enable = mkEnableOption "enable Steam"; + + config = mkIf cfg.enable { + + home.packages = with pkgs; [ sunshine ]; + + }; +} diff --git a/home/users/m3tam3re/#m3-nix.nix# b/home/users/m3tam3re/#m3-nix.nix# deleted file mode 100644 index 6840344..0000000 --- a/home/users/m3tam3re/#m3-nix.nix# +++ /dev/null @@ -1,18 +0,0 @@ -{ config, pkgs, ... }: - -{ - -imports = [ - -]; - -features = { - fish.enable = true; - neofetch.enable = true; - startship.enable = true; - tmux.enable = true; -}; - -home.stateVersion = "22.11"; - -} diff --git a/home/users/m3tam3re/.#m3-nix.nix b/home/users/m3tam3re/.#m3-nix.nix deleted file mode 120000 index d93b698..0000000 --- a/home/users/m3tam3re/.#m3-nix.nix +++ /dev/null @@ -1 +0,0 @@ -m3tam3re@m3-nix.4219:1672483267 \ No newline at end of file diff --git a/home/users/m3tam3re/lkk-nix-1.nix b/home/users/m3tam3re/lkk-nix-1.nix index 838b0c8..d68a52c 100644 --- a/home/users/m3tam3re/lkk-nix-1.nix +++ b/home/users/m3tam3re/lkk-nix-1.nix @@ -1,14 +1,12 @@ { config, pkgs, ... }: { - imports = [ - ./base - ../../features/cli - ]; - + imports = [ ./base ../../features/cli ]; + features = { - fish.enable = true; - starship.enable = true; - neofetch.enable = true; + cli = { + fish.enable = true; + starship.enable = true; + }; }; - - home.stateVersion = "22.11"; + + home.stateVersion = "22.11"; } diff --git a/home/users/m3tam3re/m3-nix.nix b/home/users/m3tam3re/m3-nix.nix index 8e8d11b..1282ebc 100644 --- a/home/users/m3tam3re/m3-nix.nix +++ b/home/users/m3tam3re/m3-nix.nix @@ -1,23 +1,32 @@ -{ config, lib, pkgs, ... }: +{ config, pkgs, ... }: { + imports = [ + ./base + ../../features/cli + ../../features/coding + ../../features/desktop + ../../features/gaming + ../../features/virtualization + ]; -with lib; - -let - cfg = config.features.foo; - features = { lib, config, ... }: { - options.foo = mkEnableOption "Enable CLI support"; + features = { + cli = { + fish.enable = true; + neofetch.enable = true; + starship.enable = true; + tmux.enable = true; }; + gaming = { + steam.enable = true; + sunshine.enable = true; + }; + desktop = { + + }; + virtualization = { -in { - - config = mkIf cfg.foo.enable { - import = ../../features/cli; + }; + }; - - # imports = [ - # ./base - # ../../features/cli - # ]; - # monitor config + home.stateVersion = "22.11"; } diff --git a/hosts/lkk-nix-1/services/docker-containers/baserow.nix b/hosts/lkk-nix-1/services/docker-containers/baserow.nix new file mode 100644 index 0000000..672a1ba --- /dev/null +++ b/hosts/lkk-nix-1/services/docker-containers/baserow.nix @@ -0,0 +1,33 @@ +{ config, inputs, settings, ... }: { + + + age.secrets.mj-smtp-user.file = ../../../../secrets/mj-smtp-user.age; + age.secrets.mj-smtp-pass.file = ../../../../secrets/mj-smtp-pass.age; + + virtualisation.arion = { + backend = "docker"; #//TODO continue here + # projects = { + # "baserow" = settings.services."baserow".service = { + # image = ""; + # restart = "unless-stopped"; + # environment = { + # BASEROW_PUBLIC_URL = "https://br.lanakk.com"; + # POSTGRES_USER = "baserow"; + # POSTGRES_PASSWORD = "baserow"; + # POSTGRES_DB = "baserow"; + # DATABASE_HOST = "postgres"; + # DATABASE_NAME = "baserow"; + # DATABASE_USER = "baserow"; + # DATABASE_PASSWORD = "baserow"; + # DATABASE_PORT = "5432"; + # FROM_EMAIL = "hi@lanakk.com"; + # EMAIL_SMTP = "in-v3.mailjet.com"; + # EMAIL_SMTP_HOST = "in-v3.mailjet.com"; + # EMAIL_SMTP_PORT = "587"; + # EMAIL_SMTP_USER = config.age.secrets.mj-smtp-user.path; + # EMAIL_SMTP_PASSWORD = config.age.secrets.mj-smtp-pass.path; + # }; + # }; + # }; + }; +} diff --git a/hosts/lkk-nix-1/services/docker-containers/default.nix b/hosts/lkk-nix-1/services/docker-containers/default.nix new file mode 100644 index 0000000..97a6b69 --- /dev/null +++ b/hosts/lkk-nix-1/services/docker-containers/default.nix @@ -0,0 +1,5 @@ +{ + imports = [ + ./baserow.nix + ]; +} diff --git a/hosts/lkk-nix-1/services/docker.nix b/hosts/lkk-nix-1/services/docker.nix index 6ea9019..d334888 100644 --- a/hosts/lkk-nix-1/services/docker.nix +++ b/hosts/lkk-nix-1/services/docker.nix @@ -3,5 +3,10 @@ virtualisation.docker = { enable = true; enableOnBoot = true; + storageDrive = "btrfs"; + rootless = { + enable = true; + setSocketVariable = true; + }; }; } diff --git a/secrets.nix b/secrets.nix new file mode 100644 index 0000000..854dec3 --- /dev/null +++ b/secrets.nix @@ -0,0 +1,6 @@ +let + m3tam3re = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQC3YEmpYbM+cpmyD10tzNRHEn526Z3LJOzYpWEKdJg8DaYyPbDn9iyVX30Nja2SrW4Wadws0Y8DW+Urs25/wVB6mKl7jgPJVkMi5hfobu3XAz8gwSdjDzRSWJrhjynuaXiTtRYED2INbvjLuxx3X8coNwMw58OuUuw5kNJp5aS2qFmHEYQErQsGT4MNqESe3jvTP27Z5pSneBj45LmGK+RcaSnJe7hG+KRtjuhjI7RdzMeDCX73SfUsal+rHeuEw/mmjYmiIItXhFTDn8ZvVwpBKv7xsJG90DkaX2vaTk0wgJdMnpVIuIRBa4EkmMWOQ3bMLGkLQeK/4FUkNcvQ/4+zcZsg4cY9Q7Fj55DD41hAUdF6SYODtn5qMPsTCnJz44glHt/oseKXMSd556NIw2HOvihbJW7Rwl4OEjGaO/dF4nUw4c9tHWmMn9dLslAVpUuZOb7ykgP0jk79ldT3Dv+2Hj0CdAWT2cJAdFX58KQ9jUPT3tBnObSF1lGMI7t77VU="; +in { + "mj-smtp-user.age".publicKeys = [ m3tam3re ]; + "mj-smtp-pass.age".publicKeys = [ m3tam3re ]; +} diff --git a/secrets/mj-smtp-pass.age b/secrets/mj-smtp-pass.age new file mode 100644 index 0000000..cbe88db --- /dev/null +++ b/secrets/mj-smtp-pass.age @@ -0,0 +1,16 @@ +age-encryption.org/v1 +-> ssh-rsa DQlE7w +TVcGTRFtB2aJ3Tq3S5k8jSSsF5DUq20hRlXFzi/SY2UczJjzPIO+Qax/7gBmPxGM +i9sp89CHAz1owTEzFkxsdj7AMoz6SMlvPL9Ixc3zrwKthhz2puv/JiKsmzycNQd1 +XvSzOKkJgZMG25Y7lBWjIy+SGTBDVUSaN1UUs2VRGhEBh0LW76+8dgJMdtzaFy4n +E2Yf3jj8MCjfBa6iX+G+ZTlWAl0ZhgBsJVmy9sN77AHQoUJVZ5FUllpy+sayV3iW +btwSlZMWlA4btbdZbV6PffGgHAMPCLu8OseIFDkLky12wt9ChK9A4OOZcFw4+bMb +YvDUOaQqtjqbZ8XSmokQVBNns9TxUcNcJ68cMz0qbm9Pj+gcY0k3zbsDfrpPNbpX +X3ZUWJVK594Uv2V9mKR6VVcYOrzvucD5iGqfO7SUTWJppldrB0/YGe3eGxmtG0D2 +4K0JntFoDRThSyyGx1/YvPxAJqKBWT7SARUxGjMaqnWM3OWppKDBYLGl/jRQQAqf + +-> VGV-grease OQ :S.YU\ +M4HB0MfSl0giX1GydEobdPW85+T6loiGtSWgzhWESbY28rwZulR83bUX8ftEzemT +LF9AKGIr50etdijB9uypYf9sQarujWXPsMyNQG/Xyfo +--- Ns60O8WsNVrAkDvDfoI/opMnBjlKrRiFehRcUDCPAXg +ZÞÞwŠÁÅTJ;´ÞÊ=k7·_U55ˆYFçàÂë&¦?÷‘Ã.øÛ…U¨çü"Ü ¹>ç D~Ïž qyÖÝD \ No newline at end of file diff --git a/secrets/mj-smtp-user.age b/secrets/mj-smtp-user.age new file mode 100644 index 0000000..7ddd890 --- /dev/null +++ b/secrets/mj-smtp-user.age @@ -0,0 +1,16 @@ +age-encryption.org/v1 +-> ssh-rsa DQlE7w +GZ5/RD7yNwlvFjNwv/rxjsl2GVF8lRm0qlXfOeQcYctyDo4xHFsIbhLpwV508rJf +zeLJpoQYFaqumEtgxBeZrQS+qYiOG3Ne2pO36MN3qq/wVVBPuWiupNBrZTUeHn2n +1BTENMzmPfqhuZL2D62NXKcIsbOiGADtdt/4h3Xk4CyroBuEfNFx0U9WTMGHx5mg +kUVC2jRzo0KbnFwFTeGYmUc90dgy/rciAqhkBOfbPpcYdUy6LTVrGbz0jxwutIq1 +SmkMW7pj/KSPAgVnX6p38gWobVxyRIFmC0wrFZ/NCy2Hq4ae0QdkX/I0TabEBtbj +vcacZDlfXEsV+n3gvl8qzOVJO1inc3ZV8QUgnK5QEaV6JF37XONeczi8/qFT7e9K +fCUw0gG5N7r6Ma3JcNctEtB5NsgBXJXe3Fy3j6yT5sQQayPW4eS2yYuClUcYaaIe +xwDLpuRESYx0oh9DJZqvmoSZriLpejsJ54ZUVDJ57NAd+Vl1iCFKKOyMr/aUDNSM + +-> r\&\-grease cT"t7WhI IM +LjM4kAZQbwNT8isi73f1V0PVVsJxWvjkSCLTaS8aD03LgYLYY9uCs6k/hyb3GdWw +1a/9BC907cyNGQ +--- ulEvcwLfcMfh78M+U9KeF1l39rdLG1NpVE9FLPCHOgI + ]ƒSþ³KÖˆÓUèä;NÊL[6á(î e+ WU øÍL ±ô57ºÀ£9L†Vy\ GhÆø±Ž "(´× \ No newline at end of file