diff options
| author | Mike Vink <mike@pionative.com> | 2024-02-11 15:53:44 +0100 |
|---|---|---|
| committer | Mike Vink <mike@pionative.com> | 2024-02-11 15:53:44 +0100 |
| commit | 3cc299a59572c8c9c09b67fc26cfc699355447fd (patch) | |
| tree | 7ca17359497f4b439c3a3c7ddd9e7da629a0e1c4 | |
| parent | 2524a1b80a983d0e4ef4796477bd2a8c812acb69 (diff) | |
setup syncthing on lemptop and pump
| -rw-r--r-- | flake.nix | 2 | ||||
| -rw-r--r-- | ivi/ivi.nix | 48 | ||||
| -rw-r--r-- | profiles/core/configuration.nix | 4 | ||||
| -rw-r--r-- | profiles/core/hm.nix | 2 | ||||
| -rw-r--r-- | profiles/core/home.nix | 3 | ||||
| -rw-r--r-- | profiles/core/syncthing.nix | 39 | ||||
| -rw-r--r-- | profiles/station/music.nix | 276 | ||||
| -rw-r--r-- | profiles/station/nonfree.nix | 3 | ||||
| -rw-r--r-- | profiles/station/packages.nix | 4 |
9 files changed, 270 insertions, 111 deletions
@@ -42,7 +42,7 @@ specialArgs = {inherit self machine inputs;}; modules = with lib; machine.modules - ++ inputs.home-manager.nixosModules.default + ++ [inputs.home-manager.nixosModules.default] ++ machineConfig ++ [ ({config, ...}: { diff --git a/ivi/ivi.nix b/ivi/ivi.nix index a12ce35..6858ada 100644 --- a/ivi/ivi.nix +++ b/ivi/ivi.nix @@ -54,25 +54,41 @@ self: lib: with lib; let default = false; }; tailnet = mkOption { + default = {}; type = with types; attrsOf (submodule ({ name, config, ... }: { - freeformType = attrs; - ipv4 = mkOption { - description = "The machine's tailnet IPv4 address"; - type = str; - default = null; - }; - ipv6 = mkOption { - description = "The machine's tailnet IPv6 address"; - type = str; - default = null; - }; - nodeKey = mkOption { - description = "The machine's tailnet public key"; - type = str; - default = null; + options = { + ipv4 = mkOption { + description = "The machine's tailnet IPv4 address"; + type = str; + default = null; + }; + ipv6 = mkOption { + description = "The machine's tailnet IPv6 address"; + type = str; + default = null; + }; + nodeKey = mkOption { + description = "The machine's tailnet public key"; + type = str; + default = null; + }; }; })); }; + syncthing = mkOption { + default = {}; + type = with types; submodule { + freeformType = attrs; + options = { + id = mkOption { + description = "The machine's syncting public id"; + type = str; + default = ""; + }; + enable = mkEnableOption "Add to syncthing cluster"; + }; + }; + }; }; config = { modules = @@ -147,7 +163,7 @@ self: lib: with lib; let ]; syncthing = { enable = true; - id = "45TTOOY-YAJCVGX-GGM2Z2M-2YUYDOR-GGFPHFH-TOCCBGQ-A4A2NUB-GEKLGQQ"; + id = "TGRWV6Z-5CJ4KRI-4VDTIUE-UA5LQYS-3ARZGNK-KL7HGXP-352PB5Q-ADTV6Q2"; }; }; pump = { diff --git a/profiles/core/configuration.nix b/profiles/core/configuration.nix index 36dc255..d8ad29f 100644 --- a/profiles/core/configuration.nix +++ b/profiles/core/configuration.nix @@ -66,7 +66,7 @@ file pstree bc - ] ++ optionals (!machine.isDarwin) [ + ] ++ (optionals (!machine.isDarwin) [ pkgsi686Linux.glibc gdb pciutils @@ -74,7 +74,7 @@ iputils inetutils usbutils - ]; + ]); nix.package = pkgs.nixUnstable; nix.extraOptions = '' diff --git a/profiles/core/hm.nix b/profiles/core/hm.nix index 76dd2e6..efa83af 100644 --- a/profiles/core/hm.nix +++ b/profiles/core/hm.nix @@ -1,4 +1,4 @@ -{inputs, lib, pkgs, ...}: with lib; { +{inputs, config, lib, pkgs, ...}: with lib; { imports = [ (mkAliasOptionModule [ "hm" ] [ "home-manager" "users" ivi.username ]) ]; diff --git a/profiles/core/home.nix b/profiles/core/home.nix index 7972a75..78abfe7 100644 --- a/profiles/core/home.nix +++ b/profiles/core/home.nix @@ -35,7 +35,7 @@ }; }; desktopEntries = with pkgs; optionalAttrs (!machine.isDarwin) { - text= { type = "Application"; name = "Text editor"; exec = "${st}/bin/st -e kak %u"; }; + text = { type = "Application"; name = "Text editor"; exec = "${st}/bin/st -e kak %u"; }; file = { type = "Application"; name = "File Manager"; exec = "${st}/bin/st -e lfub %u"; }; torrent = { type = "Application"; name = "Torrent"; exec = "${coreutils}/bin/env transadd %U"; }; img = { type = "Application"; name = "Image Viewer"; exec = "${sxiv}/bin/sxiv -a %u"; }; @@ -186,6 +186,7 @@ enableSshSupport = true; defaultCacheTtl = 34550000; maxCacheTtl = 34550000; + pinentryFlavor = "gtk2"; }; }; } diff --git a/profiles/core/syncthing.nix b/profiles/core/syncthing.nix index e5c19f7..a1767a6 100644 --- a/profiles/core/syncthing.nix +++ b/profiles/core/syncthing.nix @@ -3,16 +3,51 @@ enable = true; user = ivi.username; inherit (config.ivi) group; + dataDir = config.ivi.home; overrideDevices = true; overrideFolders = true; key = config.secrets.syncthing.path; - settings = { + settings = let + allDevices = (filterAttrs (_: m: m.syncthing.id != "") ivi.machines); + in { + gui = { + theme = "default"; + insecureAdminAccess = true; + }; + devices = mapAttrs (_: m: { inherit (m.syncthing) id; introducer = m.isServer; - }) (filterAttrs (_: m: m.syncthing.enable) ivi.machines); + }) allDevices; + + folders = let + trashcan = { + type = "trashcan"; + params.cleanoutDays = "0"; + }; + simple = { + type = "simple"; + params = { + keep = "5"; + cleanoutDays = "0"; + }; + }; + allNames = attrNames allDevices; + in { + my = { + path = "${config.ivi.home}/sync/my"; + devices = allNames; + versioning = simple; + }; + pictures = { + path = "${config.ivi.home}/sync/pictures"; + devices = allNames; + versioning = trashcan; + }; + }; }; }; + environment.systemPackages = [config.services.syncthing.package]; } diff --git a/profiles/station/music.nix b/profiles/station/music.nix index 78ed655..6f80c92 100644 --- a/profiles/station/music.nix +++ b/profiles/station/music.nix @@ -1,91 +1,199 @@ -{ machine, config, pkgs, lib, ... }: with lib; mkIf (!machine.isDarwin) { +{ + machine, + config, + pkgs, + lib, + ... +}: +with lib; + mkIf (!machine.isDarwin) { # TODO: what about secrets on nix-darwin... # secrets.mopidy.owner = lib.ivi.username; hm.home.packages = [pkgs.mpc-cli]; hm.services.mopidy = { - enable = true; - extensionPackages = with pkgs; [mopidy-spotify mopidy-mpd]; - settings = { - mpd = { - enabled = true; - hostname = "127.0.0.1"; - port = 6600; - max_connections = 20; - connection_timeout = 60; - };}; - extraConfigFiles = [ - config.secrets.mopidy.path - ]; + enable = true; + extensionPackages = with pkgs; [mopidy-spotify mopidy-mpd]; + settings = { + mpd = { + enabled = true; + hostname = "127.0.0.1"; + port = 6600; + max_connections = 20; + connection_timeout = 60; + }; + }; + extraConfigFiles = [ + config.secrets.mopidy.path + ]; }; hm.programs.ncmpcpp = { - enable = true; - bindings = [ - { key = "+"; command = "show_clock"; } - { key = "+"; command = "show_clock"; } - { key = "="; command = "volume_up"; } - { key = "j"; command = "scroll_down"; } - { key = "k"; command = "scroll_up"; } - { key = "ctrl-u"; command = "page_up"; } - { key = "ctrl-d"; command = "page_down"; } - { key = "u"; command = "page_up"; } - { key = "d"; command = "page_down"; } - { key = "h"; command = "previous_column"; } - { key = "l"; command = "next_column"; } - { key = "."; command = "show_lyrics"; } - { key = "n"; command = "next_found_item"; } - { key = "N"; command = "previous_found_item"; } - { key = "J"; command = "move_sort_order_down"; } - { key = "K"; command = "move_sort_order_up"; } - { key = "h"; command = "jump_to_parent_directory"; } - { key = "l"; command = "enter_directory"; } - { key = "l"; command = "run_action"; } - { key = "l"; command = "play_item"; } - { key = "m"; command = "show_media_library"; } - { key = "m"; command = "toggle_media_library_columns_mode"; } - { key = "t"; command = "show_tag_editor"; } - { key = "v"; command = "show_visualizer"; } - { key = "G"; command = "move_end"; } - { key = "g"; command = "move_home"; } - { key = "U"; command = "update_database"; } - { key = "s"; command = "reset_search_engine"; } - { key = "s"; command = "show_search_engine"; } - { key = "f"; command = "show_browser"; } - { key = "f"; command = "change_browse_mode"; } - { key = "x"; command = "delete_playlist_items"; } - { key = "P"; command = "show_playlist"; } - ]; - settings = { - ncmpcpp_directory = "~/.config/ncmpcpp"; - lyrics_directory = "~/.local/share/lyrics"; - message_delay_time = "1"; - # visualizer_type = "spectrum"; - song_list_format = "{$4%a - }{%t}|{$8%f$9}$R{$3(%l)$9}"; - song_status_format = ''$b{{$8"%t"}} $3by {$4%a{ $3in $7%b{ (%y)}} $3}|{$8%f}''; - song_library_format = "{%n - }{%t}|{%f}"; - alternative_header_first_line_format = "$b$1$aqqu$/a$9 {%t}|{%f} $1$atqq$/a$9$/b"; - alternative_header_second_line_format = "{{$4$b%a$/b$9}{ - $7%b$9}{ ($4%y$9)}}|{%D}"; - current_item_prefix = "$(cyan)$r$b"; - current_item_suffix = "$/r$(end)$/b"; - current_item_inactive_column_prefix = "$(magenta)$r"; - current_item_inactive_column_suffix = "$/r$(end)"; - playlist_display_mode = "columns"; - browser_display_mode = "columns"; - progressbar_look = "->"; - media_library_primary_tag = "album_artist"; - media_library_albums_split_by_date = "no"; - startup_screen = "media_library"; - display_volume_level = "no"; - ignore_leading_the = "yes"; - external_editor = "nvim"; - use_console_editor = "yes"; - empty_tag_color = "magenta"; - main_window_color = "white"; - progressbar_color = "black:b"; - progressbar_elapsed_color = "blue:b"; - statusbar_color = "red"; - statusbar_time_color = "cyan:b"; - execute_on_song_change=''"pkill -RTMIN+11 dwmblocks"''; - execute_on_player_state_change=''"pkill -RTMIN+11 dwmblocks"''; - }; + enable = true; + bindings = [ + { + key = "+"; + command = "show_clock"; + } + { + key = "+"; + command = "show_clock"; + } + { + key = "="; + command = "volume_up"; + } + { + key = "j"; + command = "scroll_down"; + } + { + key = "k"; + command = "scroll_up"; + } + { + key = "ctrl-u"; + command = "page_up"; + } + { + key = "ctrl-d"; + command = "page_down"; + } + { + key = "u"; + command = "page_up"; + } + { + key = "d"; + command = "page_down"; + } + { + key = "h"; + command = "previous_column"; + } + { + key = "l"; + command = "next_column"; + } + { + key = "."; + command = "show_lyrics"; + } + { + key = "n"; + command = "next_found_item"; + } + { + key = "N"; + command = "previous_found_item"; + } + { + key = "J"; + command = "move_sort_order_down"; + } + { + key = "K"; + command = "move_sort_order_up"; + } + { + key = "h"; + command = "jump_to_parent_directory"; + } + { + key = "l"; + command = "enter_directory"; + } + { + key = "l"; + command = "run_action"; + } + { + key = "l"; + command = "play_item"; + } + { + key = "m"; + command = "show_media_library"; + } + { + key = "m"; + command = "toggle_media_library_columns_mode"; + } + { + key = "t"; + command = "show_tag_editor"; + } + { + key = "v"; + command = "show_visualizer"; + } + { + key = "G"; + command = "move_end"; + } + { + key = "g"; + command = "move_home"; + } + { + key = "U"; + command = "update_database"; + } + { + key = "s"; + command = "reset_search_engine"; + } + { + key = "s"; + command = "show_search_engine"; + } + { + key = "f"; + command = "show_browser"; + } + { + key = "f"; + command = "change_browse_mode"; + } + { + key = "x"; + command = "delete_playlist_items"; + } + { + key = "P"; + command = "show_playlist"; + } + ]; + settings = { + ncmpcpp_directory = "~/.config/ncmpcpp"; + lyrics_directory = "~/.local/share/lyrics"; + message_delay_time = "1"; + # visualizer_type = "spectrum"; + song_list_format = "{$4%a - }{%t}|{$8%f$9}$R{$3(%l)$9}"; + song_status_format = ''$b{{$8"%t"}} $3by {$4%a{ $3in $7%b{ (%y)}} $3}|{$8%f}''; + song_library_format = "{%n - }{%t}|{%f}"; + alternative_header_first_line_format = "$b$1$aqqu$/a$9 {%t}|{%f} $1$atqq$/a$9$/b"; + alternative_header_second_line_format = "{{$4$b%a$/b$9}{ - $7%b$9}{ ($4%y$9)}}|{%D}"; + current_item_prefix = "$(cyan)$r$b"; + current_item_suffix = "$/r$(end)$/b"; + current_item_inactive_column_prefix = "$(magenta)$r"; + current_item_inactive_column_suffix = "$/r$(end)"; + playlist_display_mode = "columns"; + browser_display_mode = "columns"; + progressbar_look = "->"; + media_library_primary_tag = "album_artist"; + media_library_albums_split_by_date = "no"; + startup_screen = "media_library"; + display_volume_level = "no"; + ignore_leading_the = "yes"; + external_editor = "nvim"; + use_console_editor = "yes"; + empty_tag_color = "magenta"; + main_window_color = "white"; + progressbar_color = "black:b"; + progressbar_elapsed_color = "blue:b"; + statusbar_color = "red"; + statusbar_time_color = "cyan:b"; + execute_on_song_change = ''"pkill -RTMIN+11 dwmblocks"''; + execute_on_player_state_change = ''"pkill -RTMIN+11 dwmblocks"''; + }; }; -} + } diff --git a/profiles/station/nonfree.nix b/profiles/station/nonfree.nix index 1dd91d1..e9b9231 100644 --- a/profiles/station/nonfree.nix +++ b/profiles/station/nonfree.nix @@ -1,6 +1,5 @@ {pkgs, lib, ...}: with lib; { hm.home.packages = with pkgs; [ - teams discord slack ]; @@ -24,6 +23,6 @@ remotePlay.openFirewall = true; dedicatedServer.openFirewall = true; }; - hardware.opengl.driSupport32Bit = true; }; + hardware.opengl.driSupport32Bit = true; } diff --git a/profiles/station/packages.nix b/profiles/station/packages.nix index 4116e70..b388d24 100644 --- a/profiles/station/packages.nix +++ b/profiles/station/packages.nix @@ -20,7 +20,7 @@ (google-cloud-sdk.withExtraComponents (with google-cloud-sdk.components; [ gke-gcloud-auth-plugin ])) - ] ++ optionals (!machine.isDarwin) [ + ] ++ (optionals (!machine.isDarwin) [ pywal dasel ueberzug @@ -38,6 +38,6 @@ firefox-wayland libreoffice xclip - ]; + ]); }; } |
