From f4b2644bd1bb82bdab04ba84c36b2e6d06340c8e Mon Sep 17 00:00:00 2001 From: Filippo Berto Date: Tue, 15 Aug 2023 11:57:26 +0200 Subject: [PATCH] S3: removed unnecessary gateways --- flake.nix | 3 -- instances/baldur/hm.nix | 2 +- instances/baldur/hm_tiziano.nix | 2 +- instances/odin/common_configuration.nix | 3 +- instances/odin/hm.nix | 31 +-------------- instances/thor/hm.nix | 23 +----------- modules/hm/__basic.nix | 1 + modules/hm/joshuto.nix | 50 +++++++++++++++++++++++++ modules/nixos/garage.nix | 7 ++-- 9 files changed, 60 insertions(+), 62 deletions(-) create mode 100644 modules/hm/joshuto.nix diff --git a/flake.nix b/flake.nix index 870262c..ad20bcb 100644 --- a/flake.nix +++ b/flake.nix @@ -129,7 +129,6 @@ ./modules/nixos/pentablet.nix ./modules/nixos/steam-link.nix ./modules/nixos/kdeconnect.nix - ./modules/nixos/garage.nix ] ++ homeManagerModules ++ [ { home-manager.users.bertof = import ./instances/thor/hm.nix; } ]; @@ -154,7 +153,6 @@ ./modules/nixos/pentablet.nix ./modules/nixos/steam-link.nix ./modules/nixos/kdeconnect.nix - ./modules/nixos/garage.nix ] ++ homeManagerModules ++ [ { home-manager.users.bertof = import ./instances/odin/hm.nix; } ]; @@ -209,7 +207,6 @@ "${nixpkgs}/nixos/modules/virtualisation/digital-ocean-config.nix" ./modules/nixos/digitalocean.nix - ./modules/nixos/garage.nix ./modules/nixos/users/tiziano.nix ] ++ homeManagerModules ++ [{ home-manager.users.bertof = import ./instances/baldur/hm.nix; diff --git a/instances/baldur/hm.nix b/instances/baldur/hm.nix index da15254..0ab0920 100644 --- a/instances/baldur/hm.nix +++ b/instances/baldur/hm.nix @@ -19,7 +19,7 @@ Wants = [ "network.target" "network-online.target" ]; }; Service = { - ExecStart = "${pkgs.s3fs}/bin/s3fs -f -d bertof /home/bertof/s3 -o passwd_file=${nixosConfig.age.secrets.garage_bertof_baldur_key.path},use_path_request_style,url=http://localhost:3900"; + ExecStart = "${pkgs.s3fs}/bin/s3fs -f -d bertof /home/bertof/s3 -o passwd_file=${nixosConfig.age.secrets.garage_bertof_baldur_key.path},use_path_request_style,url=http://freya.local:3900"; Restart = "always"; RestartSec = 30; Type = "exec"; diff --git a/instances/baldur/hm_tiziano.nix b/instances/baldur/hm_tiziano.nix index ec80205..de54f68 100644 --- a/instances/baldur/hm_tiziano.nix +++ b/instances/baldur/hm_tiziano.nix @@ -18,7 +18,7 @@ Wants = [ "network.target" "network-online.target" ]; }; Service = { - ExecStart = "${pkgs.s3fs}/bin/s3fs -f -d tiziano /home/tiziano/s3 -o passwd_file=${nixosConfig.age.secrets.garage_tiziano_baldur_key.path},use_path_request_style,url=http://localhost:3900"; + ExecStart = "${pkgs.s3fs}/bin/s3fs -f -d tiziano /home/tiziano/s3 -o passwd_file=${nixosConfig.age.secrets.garage_tiziano_baldur_key.path},use_path_request_style,url=http://freya.local:3900"; Restart = "always"; RestartSec = 30; Type = "exec"; diff --git a/instances/odin/common_configuration.nix b/instances/odin/common_configuration.nix index 8ab9b9d..6de8049 100644 --- a/instances/odin/common_configuration.nix +++ b/instances/odin/common_configuration.nix @@ -186,8 +186,7 @@ with lib; { # List packages installed in system profile. To search, run: # $ nix search wget - environment.systemPackages = - builtins.attrValues { inherit (pkgs) tmux helix vim git ntfs3g s3fs; }; + environment.systemPackages = builtins.attrValues { inherit (pkgs) tmux helix vim git ntfs3g; }; # Some programs need SUID wrappers, can be configured further or are # started in user sessions. diff --git a/instances/odin/hm.nix b/instances/odin/hm.nix index 69812ab..d4b834c 100644 --- a/instances/odin/hm.nix +++ b/instances/odin/hm.nix @@ -1,4 +1,4 @@ -{ pkgs, nixosConfig, ... }: { +{ pkgs, ... }: { home = { language.base = "it_IT.UTF-8"; keyboard = { @@ -42,35 +42,6 @@ ''; }; - systemd.user.services.garage-home-s3-bertof = - let - path = "/home/bertof/s3/bertof"; - in - { - Unit = { - After = [ "network.target" "network-online.target" "local-fs.target" ]; - # AssertPathIsDirectory = path; - # AssertPathIsReadWrite = path; - Description = "Mount S3 bucket in bertof's home"; - StartLimitBurst = 5; - StartLimitInterval = 200; - Wants = [ "network.target" "network-online.target" ]; - }; - Service = { - ExecStart = pkgs.writeShellScript "garage-home-s3-bertof" '' - set -e - ${pkgs.coreutils}/bin/mkdir -p '${path}' - ${pkgs.s3fs}/bin/s3fs -f -d bertof ${path} -o passwd_file=${nixosConfig.age.secrets.garage_bertof_odin_key.path},use_path_request_style,url=http://localhost:3900 - ''; - Restart = "always"; - RestartSec = 30; - Type = "exec"; - }; - Install = { - # WantedBy = [ "default.target" ]; - }; - }; - imports = [ ../../modules/hm/__basic.nix diff --git a/instances/thor/hm.nix b/instances/thor/hm.nix index d230567..0656ea9 100644 --- a/instances/thor/hm.nix +++ b/instances/thor/hm.nix @@ -1,4 +1,4 @@ -{ pkgs, nixosConfig, ... }: { +{ pkgs, ... }: { home = { language.base = "it_IT.UTF-8"; keyboard = { @@ -31,27 +31,6 @@ }; }; - systemd.user.services.garage-home-s3-bertof = { - Unit = { - After = [ "network.target" "network-online.target" "local-fs.target" ]; - AssertPathIsDirectory = "/home/bertof/s3/bertof"; - AssertPathIsReadWrite = "/home/bertof/s3/bertof"; - Description = "Mount S3 bucket in bertof's home"; - StartLimitBurst = 5; - StartLimitInterval = 200; - Wants = [ "network.target" "network-online.target" ]; - }; - Service = { - ExecStart = "${pkgs.s3fs}/bin/s3fs -f -d bertof /home/bertof/s3/bertof -o passwd_file=${nixosConfig.age.secrets.garage_bertof_thor_key.path},use_path_request_style,url=http://localhost:3900"; - Restart = "always"; - RestartSec = 30; - Type = "exec"; - }; - Install = { - WantedBy = [ "default.target" ]; - }; - }; - services = { gnome-keyring.enable = true; }; imports = [ diff --git a/modules/hm/__basic.nix b/modules/hm/__basic.nix index 2c5ce97..95fce5e 100644 --- a/modules/hm/__basic.nix +++ b/modules/hm/__basic.nix @@ -23,6 +23,7 @@ ./gpg.nix ./info.nix ./jq.nix + ./joshuto.nix ./keychain.nix ./lf.nix ./man.nix diff --git a/modules/hm/joshuto.nix b/modules/hm/joshuto.nix new file mode 100644 index 0000000..789fbc5 --- /dev/null +++ b/modules/hm/joshuto.nix @@ -0,0 +1,50 @@ +{ pkgs, ... }: +let tomlGenerate = (pkgs.formats.toml { }).generate; in +{ + # TODO: switch to module on next release + + home.packages = [ pkgs.unstable_pkgs.joshuto ]; + home.shellAliases."fm" = "joshuto --change-directory"; + + xdg.configFile = { + "johsuto/joshuto.toml".source = tomlGenerate "joshuto.toml" { + scroll_offset = 6; + xdg_open = true; + xdg_open_fork = true; + use_trash = true; + watch_files = true; + display = { + mode = "default"; + collapse_preview = true; + column_ratio = [ 1 3 4 ]; + show_borders = true; + show_hidden = false; + show_icons = true; + tilde_in_titlebar = true; + line_number_style = "absolute"; + linemode = "size"; + }; + display.sort = { + sort_method = "natural"; + case_sensitive = false; + directories_first = true; + reverse = false; + }; + search = { + string_case_sensitivity = "insensitive"; + glob_case_sensitivity = "sensitive"; + fzf_case_sensitivity = "insensitive"; + }; + tab = { + display_mode = "all"; + home_page = "inherit"; + }; + }; + "johsuto/mimetype.toml".source = tomlGenerate "joshuto.toml" { + # xdg_open = true; + # xdg_open_fork = true; + # line_number_style = "absolute"; + # tab.home_page = "inherit"; + }; + }; +} diff --git a/modules/nixos/garage.nix b/modules/nixos/garage.nix index cace47b..72fd3d1 100644 --- a/modules/nixos/garage.nix +++ b/modules/nixos/garage.nix @@ -4,6 +4,7 @@ age.secrets.garage_rpc_secret = { file = ../../secrets/garage_rpc_secret.age; owner = "garage"; }; networking.firewall.interfaces."ztmjfdwjkp".allowedTCPPorts = [ + 3900 3901 ]; @@ -19,17 +20,17 @@ settings = { replication_mode = 2; rpc_secret_file = config.age.secrets.garage_rpc_secret.path; - rpc_bind_addr = "[::]:3901"; + rpc_bind_addr = "0.0.0.0:3901"; bootstrap_peers = [ ]; s3_api = { - api_bind_addr = "[::]:3900"; + api_bind_addr = "0.0.0.0:3900"; s3_region = "garage"; root_domain = ".s3.bertof.net"; }; s3_web = { - bind_addr = "[::]:3902"; + bind_addr = "0.0.0.0:3902"; root_domain = ".web.bertof.net"; };