From ab7d500fab44351ae286e08574a06c66b7e754ef Mon Sep 17 00:00:00 2001 From: Ingolf Wagner Date: Fri, 22 Dec 2023 20:28:52 +0100 Subject: [PATCH] working on home-manager migration --- nixos/components/default.nix | 9 + nixos/components/network/default.nix | 2 + nixos/components/network/hosts.nix | 6 +- nixos/components/network/nginx.nix | 260 +++++++++++++++ .../all => components/network}/syncthing.nix | 75 +---- nixos/components/terminal/default.nix | 2 + nixos/homes/common/packages.nix | 3 +- nixos/homes/palo/git.nix | 8 +- nixos/homes/palo/i3.nix | 299 ++++++++--------- nixos/homes/palo/packages/development.nix | 9 +- nixos/homes/palo/packages/nextcloud.nix | 1 + nixos/machines/cherry/configuration.nix | 2 +- nixos/machines/cream/configuration.nix | 8 +- nixos/machines/cream/tinc_retiolum.nix | 14 + nixos/machines/orbi/configuration.nix | 2 +- nixos/machines/orbi/media-syncthing.nix | 2 +- nixos/machines/robi/configuration.nix | 2 +- nixos/machines/robi/media-syncthing.nix | 2 +- nixos/system/all/default.nix | 9 - nixos/system/desktop/default.nix | 5 - nixos/system/desktop/packages.nix | 313 ------------------ nixos/system/desktop/user.nix | 11 - 22 files changed, 470 insertions(+), 574 deletions(-) create mode 100644 nixos/components/network/nginx.nix rename nixos/{system/all => components/network}/syncthing.nix (55%) delete mode 100644 nixos/system/desktop/packages.nix delete mode 100644 nixos/system/desktop/user.nix diff --git a/nixos/components/default.nix b/nixos/components/default.nix index c665d18..4c429af 100644 --- a/nixos/components/default.nix +++ b/nixos/components/default.nix @@ -1,3 +1,4 @@ +{ lib, ... }: { imports = [ ./gui @@ -8,4 +9,12 @@ ./terminal ./yubikey.nix ]; + + # some system stuff + # ----------------- + time.timeZone = lib.mkDefault "Europe/Berlin"; + #time.timeZone = lib.mkDefault "Pacific/Auckland"; + #time.timeZone = lib.mkDefault "Asia/Singapore"; + #time.timeZone = lib.mkDefault "Asia/Makassar"; + } diff --git a/nixos/components/network/default.nix b/nixos/components/network/default.nix index 9fce18b..5e73817 100644 --- a/nixos/components/network/default.nix +++ b/nixos/components/network/default.nix @@ -15,6 +15,8 @@ with types; ./hosts.nix ./wifi.nix #./avahi.nix + ./syncthing.nix + ./nginx.nix ]; config = mkIf config.components.network.enable { }; diff --git a/nixos/components/network/hosts.nix b/nixos/components/network/hosts.nix index 6f03b1e..6247065 100644 --- a/nixos/components/network/hosts.nix +++ b/nixos/components/network/hosts.nix @@ -1,5 +1,5 @@ { - #networking.extraHosts = '' - # 144.76.13.147 robi - #''; + networking.extraHosts = '' + 144.76.13.147 robi + ''; } diff --git a/nixos/components/network/nginx.nix b/nixos/components/network/nginx.nix new file mode 100644 index 0000000..3fd63db --- /dev/null +++ b/nixos/components/network/nginx.nix @@ -0,0 +1,260 @@ +{ config, lib, pkgs, ... }: +with lib; +{ + options.components.network.nginx.enable = mkOption { + type = lib.types.bool; + default = config.components.network.enable; + }; + + config = mkIf (config.components.network.nginx.enable) { + + security.acme.defaults.email = "contact@ingolf-wagner.de"; + security.acme.acceptTerms = true; + + services.nginx = { + + # Use recommended settings + recommendedGzipSettings = lib.mkDefault true; + recommendedOptimisation = lib.mkDefault true; + recommendedProxySettings = lib.mkDefault true; + recommendedTlsSettings = lib.mkDefault true; + + # for loki logging + commonHttpConfig = '' + log_format logfmt escape=json 'timestamp=$time_iso8601 ' + 'facility=nginx ' + 'src_addr=$remote_addr ' + 'body_bytes_sent=$body_bytes_sent ' + 'request_time=$request_time ' + 'response_status=$status ' + 'request="$request" ' + 'request_method="$request_method" ' + 'host="$host" ' + 'upstream_cache_status="$upstream_cache_status" ' + 'upstream_addr="$upstream_addr" ' + 'http_x_forwarded_for="$http_x_forwarded_for" ' + 'http_referrer="$http_referer" ' + 'http_user_agent="$http_user_agent"'; + + # log to local journald + access_log syslog:server=unix:/dev/log logfmt; + ''; + + }; + + services.nginx.package = pkgs.nginxMainline; + services.nginx.virtualHosts."${config.networking.hostName}.private" = { + default = true; + locations."/" = { + root = pkgs.landingpage.override { + jsonConfig = [ + { title = "System Links"; } + { + text = "Syncthings"; + items = map + ({ name, host ? "${name}.private", ... }: { + label = name; + href = "http://${host}:8384/"; + image = "https://media.giphy.com/media/JoyU4vuzwj6ZA7Ging/giphy.gif"; + }) + (lib.flatten (lib.mapAttrsToList (name: { ... }: { inherit name; }) + config.services.tinc.networks."private".hostSettings)); + } + { + text = "robi"; + items = [ + { + label = "Jellyfin"; + href = "http://flix.ingolf-wagner.de/"; + image = "https://media.giphy.com/media/fyLi0OuWysotq/giphy.gif"; + } + { + label = "netdata"; + href = "http://robi.private:19999/"; + image = "https://media.giphy.com/media/BkjdN6MQCDPaw/giphy.gif"; + } + { + label = "logs"; + href = "http://grafana.robi.private/explore"; + image = "https://raw.githubusercontent.com/cncf/landscape/master/hosted_logos/grafana-loki.svg"; + } + { + label = "grafana"; + href = "http://grafana.robi.private/"; + image = "https://www.vectorlogo.zone/logos/grafana/grafana-icon.svg"; + } + { + label = "prometheus"; + href = "http://prometheus.robi.private/"; + image = "https://www.vectorlogo.zone/logos/prometheusio/prometheusio-icon.svg"; + } + + ]; + } + { + text = "chungus"; + items = [ + { + label = "HomeAssistant"; + href = "http://chungus.private:8123/"; + image = "https://media.giphy.com/media/fyLi0OuWysotq/giphy.gif"; + } + { + label = "Zigbee2Mqtt"; + href = "http://chungus.private:9666/"; + image = "https://media.giphy.com/media/fyLi0OuWysotq/giphy.gif"; + } + { + label = "Tdarr"; + href = "http://tdarr.chungus.private/"; + image = "https://media.giphy.com/media/fyLi0OuWysotq/giphy.gif"; + } + { + label = "Jellyfin"; + href = "http://chungus:8096/"; + image = "https://media.giphy.com/media/fyLi0OuWysotq/giphy.gif"; + } + { + label = "netdata"; + href = "http://chungus.private:19999/"; + image = "https://media.giphy.com/media/BkjdN6MQCDPaw/giphy.gif"; + } + { + label = "logs"; + href = "http://grafana.chungus.private/explore"; + image = "https://raw.githubusercontent.com/cncf/landscape/master/hosted_logos/grafana-loki.svg"; + } + { + label = "grafana"; + href = "http://grafana.chungus.private/"; + image = "https://www.vectorlogo.zone/logos/grafana/grafana-icon.svg"; + } + { + label = "prometheus"; + href = "http://prometheus.chungus.private/"; + image = "https://www.vectorlogo.zone/logos/prometheusio/prometheusio-icon.svg"; + } + ]; + } + { + text = "pepe"; + items = [ + { + label = "netdata"; + href = "http://pepe.private:19999/"; + image = "https://media.giphy.com/media/BkjdN6MQCDPaw/giphy.gif"; + } + { + label = "logs"; + href = "http://grafana.pepe.private/explore"; + image = "https://raw.githubusercontent.com/cncf/landscape/master/hosted_logos/grafana-loki.svg"; + } + { + label = "grafana"; + href = "http://grafana.pepe.private/"; + image = "https://www.vectorlogo.zone/logos/grafana/grafana-icon.svg"; + } + { + label = "prometheus"; + href = "http://prometheus.pepe.private/"; + image = "https://www.vectorlogo.zone/logos/prometheusio/prometheusio-icon.svg"; + } + ]; + } + + { + title = "Various Links"; + items = [ + { + label = "NeverSSL"; + href = "https://oldslowfreshlight.neverssl.com/"; + image = "https://media.giphy.com/media/fyLi0OuWysotq/giphy.gif"; + } + { + label = "Hetzner Cloud"; + href = "https://console.hetzner.cloud/projects"; + image = + "https://media.giphy.com/media/NECZ8crkbXR0k/giphy.gif"; + } + { + label = "Pass the Popcorn"; + href = "https://passthepopcorn.me/"; + image = + "https://media.giphy.com/media/NipFetnQOuKhW/giphy.gif"; + } + { + label = "redacted"; + href = "https://redacted.ch/"; + image = + "https://media.giphy.com/media/ku5EcFe4PNGWA/giphy.gif"; + } + { + label = "Cups"; + href = "http://localhost:631/"; + image = + "https://media.giphy.com/media/7hU7x4GPurk2c/giphy.gif"; + } + ]; + } + { + text = "NixOS Links"; + items = [ + { + label = "NixOS Manual"; + href = "https://nixos.org/nixos/manual/"; + image = + "https://media.giphy.com/media/dsdVyKkSqccEzoPufX/giphy.gif"; + } + { + label = "Nixpkgs Manual"; + href = "https://nixos.org/nixpkgs/manual/"; + image = + "https://media.giphy.com/media/dsdVyKkSqccEzoPufX/giphy.gif"; + } + { + label = "NixOS Reference"; + href = + "https://storage.googleapis.com/files.tazj.in/nixdoc/manual.html#sec-functions-library"; + image = + "https://media.giphy.com/media/LkjlH3rVETgsg/giphy.gif"; + } + { + label = "Nix Packages"; + href = "https://nixos.org/nixos/packages.html"; + image = + "https://media.giphy.com/media/l2YWlohvjPnsvkdEc/giphy.gif"; + } + { + label = "NixOS Language specific helpers"; + href = + "https://nixos.wiki/wiki/Language-specific_package_helpers"; + image = + "https://media.giphy.com/media/LkjlH3rVETgsg/giphy.gif"; + } + { + label = "NixOS Weekly"; + href = "https://weekly.nixos.org/"; + image = + "https://media.giphy.com/media/lXiRLb0xFzmreM8k8/giphy.gif"; + } + { + label = "NixOS Security"; + href = "https://broken.sh/"; + image = + "https://media.giphy.com/media/BqILAHjH1Ttm0/giphy.gif"; + } + { + label = "NixOS RFCs"; + href = "https://github.com/NixOS/rfcs/"; + image = + "https://media.giphy.com/media/Uq9bGjGKg08M0/giphy.gif"; + } + ]; + } + { urlEncode = true; } + ]; + }; + }; + }; + }; +} diff --git a/nixos/system/all/syncthing.nix b/nixos/components/network/syncthing.nix similarity index 55% rename from nixos/system/all/syncthing.nix rename to nixos/components/network/syncthing.nix index c23e9d8..2ff2fcc 100644 --- a/nixos/system/all/syncthing.nix +++ b/nixos/components/network/syncthing.nix @@ -47,31 +47,10 @@ with lib; { # needs to be on encrypted drives # ------------------------------- - private = { - enable = lib.mkDefault false; - #watch = lib.mkDefault false; - path = lib.mkDefault "/tmp/private"; - devices = [ "chungus" "pepe" "cream" "sterni" "mobi" "bobi" ]; - versioning = { - type = "simple"; - params.keep = "10"; - }; - }; - art = { - enable = lib.mkDefault false; - #watch = lib.mkDefault false; - path = lib.mkDefault "/tmp/art"; - devices = [ "chungus" "pepe" "cream" "sterni" "bumba" ]; - versioning = { - type = "simple"; - params.keep = "2"; - }; - }; books = { enable = lib.mkDefault false; - #watch = lib.mkDefault false; path = lib.mkDefault "/tmp/books"; - devices = [ "chungus" "robi" ]; + devices = [ "chungus" "robi" "cream" "cherry" ]; versioning = { type = "simple"; params.keep = "2"; @@ -79,9 +58,8 @@ with lib; { }; password-store = { enable = lib.mkDefault false; - #watch = lib.mkDefault false; path = lib.mkDefault "/tmp/password-store"; - devices = [ "chungus" "pepe" "cream" "sterni" "mobi" "bobi" "cherry" ]; + devices = [ "chungus" "cream" "sterni" "mobi" "bobi" "cherry" ]; versioning = { type = "simple"; params.keep = "10"; @@ -89,64 +67,23 @@ with lib; { }; desktop = { enable = lib.mkDefault false; - #watch = lib.mkDefault false; path = lib.mkDefault "/tmp/desktop"; - devices = [ "chungus" "pepe" "cream" "sterni" "mobi" "bobi" "cherry" ]; + devices = [ "chungus" "cream" "sterni" "mobi" "bobi" "cherry" ]; }; finance = { enable = lib.mkDefault false; - #watch = lib.mkDefault false; path = lib.mkDefault "/tmp/finance"; - devices = [ "chungus" "pepe" "cream" "sterni" "mobi" "bobi" ]; - versioning = { - type = "simple"; - params.keep = "10"; - }; - }; - fotos = { - enable = lib.mkDefault false; - #watch = lib.mkDefault false; - path = lib.mkDefault "/tmp/fotos"; - devices = [ "chungus" "pepe" ]; - versioning = { - type = "simple"; - params.keep = "10"; - }; - }; - - # no need to be stored on encrypted drives - # ---------------------------------------- - lost-fotos = { - enable = lib.mkDefault false; - #watch = lib.mkDefault false; - path = lib.mkDefault "/tmp/lost-fotos"; - devices = [ "chungus" "pepe" "robi" ]; - versioning = { - type = "simple"; - params.keep = "10"; - }; - }; - #media = { - # enable = lib.mkDefault false; - # watch = lib.mkDefault false; - # devices = [ "chungus" "pepe" "robi" ]; - #}; - music-projects = { - enable = lib.mkDefault false; - id = "acfhu-r4t4f"; - path = lib.mkDefault "/tmp/lost-fotos"; - #watch = lib.mkDefault false; - devices = [ "chungus" "pepe" "cream" "sterni" "robi" ]; + devices = [ "chungus" "cream" "sterni" "mobi" "bobi" ]; versioning = { type = "simple"; params.keep = "10"; }; }; + # todo remove if zfs is is used nextcloud_backup = { enable = lib.mkDefault false; - #watch = lib.mkDefault false; path = lib.mkDefault "/tmp/lost-fotos"; - devices = [ "chungus" "pepe" "robi" ]; + devices = [ "chungus" "robi" ]; versioning = { type = "simple"; params.keep = "2"; diff --git a/nixos/components/terminal/default.nix b/nixos/components/terminal/default.nix index 7d5f975..edef90c 100644 --- a/nixos/components/terminal/default.nix +++ b/nixos/components/terminal/default.nix @@ -23,6 +23,8 @@ with lib; environment.systemPackages = [ pkgs.ranger # datei browser pkgs.retry # retry command till success + pkgs.silver-searcher + pkgs.treefmt ]; }; } diff --git a/nixos/homes/common/packages.nix b/nixos/homes/common/packages.nix index b3ffcd0..df134aa 100644 --- a/nixos/homes/common/packages.nix +++ b/nixos/homes/common/packages.nix @@ -8,6 +8,7 @@ with lib; bind.dnsutils nmap hexyl + ipcalc units ]; @@ -25,7 +26,7 @@ with lib; joplin-desktop - #yt-dlp + evince ]; }) ]; diff --git a/nixos/homes/palo/git.nix b/nixos/homes/palo/git.nix index c2be9fc..7e77c54 100644 --- a/nixos/homes/palo/git.nix +++ b/nixos/homes/palo/git.nix @@ -15,6 +15,7 @@ with pkgs; init.defaultBranch = "main"; pull.ff = "only"; }; + diff-so-fancy.enable = true; }; @@ -27,13 +28,6 @@ with pkgs; gitAndTools.gitflow gitAndTools.gitSVN gitAndTools.git2cl - - # merge tools - meld - - # activate using : - # git config --global core.pager "diff-so-fancy | less --tabs=4 -RFX" - gitAndTools.diff-so-fancy ]; } diff --git a/nixos/homes/palo/i3.nix b/nixos/homes/palo/i3.nix index 03e4f4a..250e5b0 100644 --- a/nixos/homes/palo/i3.nix +++ b/nixos/homes/palo/i3.nix @@ -16,7 +16,7 @@ let /dev/shm/background.png && \ ${pkgs.imagemagick}/bin/convert /dev/shm/background.png \ -font ${pkgs.ubuntu_font_family}/share/fonts/ubuntu/UbuntuMono-B.ttf \ - -gravity Center -pointsize 30 -annotate 0 '+${osConfig.networking.hostName}' \ + -gravity Center -pointsize 30 -annotate 0 '${osConfig.networking.hostName}' \ /dev/shm/background_with_text.png && \ ${pkgs.feh}/bin/feh --bg-scale /dev/shm/background_with_text.png ''; @@ -126,176 +126,179 @@ in enable = true; }; - xsession.windowManager.i3 = { + xsession = { enable = true; - extraConfig = '' - default_border pixel - ''; - config = { - modifier = "Mod4"; - terminal = "alacritty"; - focus = { - followMouse = true; - }; - colors.focused = - with config.lib.stylix.colors.withHashtag; - { - # stylix color overrides - border = lib.mkForce base08; - background = lib.mkForce base0A; - text = lib.mkForce base00; + windowManager.i3 = { + enable = true; + extraConfig = '' + default_border pixel + ''; + config = { + modifier = "Mod4"; + terminal = "alacritty"; + focus = { + followMouse = true; }; - startup = - [ - { command = "${pkgs.albert}/bin/albert"; always = true; } - { command = toString backgroundCommand; always = true; } + colors.focused = + with config.lib.stylix.colors.withHashtag; { - command = toString (pkgs.writers.writeDash "xsettings" '' - # to allow sudo commands to access X - ${pkgs.xorg.xhost}/bin/xhost + - # no shitty pcspkr crap - ${pkgs.xorg.xset}/bin/xset -b - # no sleeping monitor - ${pkgs.xorg.xset}/bin/xset -dpms - ${pkgs.xorg.xset}/bin/xset s off - ''); - always = true; - } + # stylix color overrides + border = lib.mkForce base08; + background = lib.mkForce base0A; + text = lib.mkForce base00; + }; + startup = + [ + { command = "${pkgs.albert}/bin/albert"; always = true; } + { command = toString backgroundCommand; always = true; } + { + command = toString (pkgs.writers.writeDash "xsettings" '' + # to allow sudo commands to access X + ${pkgs.xorg.xhost}/bin/xhost + + # no shitty pcspkr crap + ${pkgs.xorg.xset}/bin/xset -b + # no sleeping monitor + ${pkgs.xorg.xset}/bin/xset -dpms + ${pkgs.xorg.xset}/bin/xset s off + ''); + always = true; + } + ]; + bars = [ + (config.lib.stylix.i3.bar // + { + #mode = "hide"; + hiddenState = "hide"; + position = "top"; + workspaceButtons = true; + workspaceNumbers = true; + statusCommand = "${pkgs.i3status-rust}/bin/i3status-rs ${config.home.homeDirectory}/.config/i3status-rust/config-my.toml"; + fonts.size = 10.0; + trayOutput = "primary"; + } + ) ]; - bars = [ - (config.lib.stylix.i3.bar // - { - #mode = "hide"; - hiddenState = "hide"; - position = "top"; - workspaceButtons = true; - workspaceNumbers = true; - statusCommand = "${pkgs.i3status-rust}/bin/i3status-rs ${config.home.homeDirectory}/.config/i3status-rust/config-my.toml"; - fonts.size = 10.0; - trayOutput = "primary"; - } - ) - ]; - keybindings = { - "Print" = "exec ${pkgs.flameshot}/bin/flameshot gui -c -p /share/"; - "${cfg.config.modifier}+Return" = "exec ${cfg.config.terminal}"; - "${cfg.config.modifier}+Shift+q" = "exit"; - "${cfg.config.modifier}+q" = "kill"; + keybindings = { + "Print" = "exec ${pkgs.flameshot}/bin/flameshot gui -c -p /share/"; + "${cfg.config.modifier}+Return" = "exec ${cfg.config.terminal}"; + "${cfg.config.modifier}+Shift+q" = "exit"; + "${cfg.config.modifier}+q" = "kill"; - "${cfg.config.modifier}+Left" = "focus left"; - "${cfg.config.modifier}+Down" = "focus down"; - "${cfg.config.modifier}+Up" = "focus up"; - "${cfg.config.modifier}+Right" = "focus right"; - "${cfg.config.modifier}+j" = "focus next"; - "${cfg.config.modifier}+k" = "focus prev"; + "${cfg.config.modifier}+Left" = "focus left"; + "${cfg.config.modifier}+Down" = "focus down"; + "${cfg.config.modifier}+Up" = "focus up"; + "${cfg.config.modifier}+Right" = "focus right"; + "${cfg.config.modifier}+j" = "focus next"; + "${cfg.config.modifier}+k" = "focus prev"; - "${cfg.config.modifier}+Shift+Left" = "move left"; - "${cfg.config.modifier}+Shift+Down" = "move down"; - "${cfg.config.modifier}+Shift+Up" = "move up"; - "${cfg.config.modifier}+Shift+Right" = "move right"; + "${cfg.config.modifier}+Shift+Left" = "move left"; + "${cfg.config.modifier}+Shift+Down" = "move down"; + "${cfg.config.modifier}+Shift+Up" = "move up"; + "${cfg.config.modifier}+Shift+Right" = "move right"; - "${cfg.config.modifier}+h" = "split h"; - "${cfg.config.modifier}+v" = "split v"; - "${cfg.config.modifier}+f" = "fullscreen toggle"; + "${cfg.config.modifier}+h" = "split h"; + "${cfg.config.modifier}+v" = "split v"; + "${cfg.config.modifier}+f" = "fullscreen toggle"; - "${cfg.config.modifier}+s" = "layout stacking"; - "${cfg.config.modifier}+w" = "layout tabbed"; - "${cfg.config.modifier}+e" = "layout toggle split"; + "${cfg.config.modifier}+s" = "layout stacking"; + "${cfg.config.modifier}+w" = "layout tabbed"; + "${cfg.config.modifier}+e" = "layout toggle split"; - "${cfg.config.modifier}+t" = "floating toggle"; - #"${cfg.config.modifier}+space" = "focus mode_toggle"; + "${cfg.config.modifier}+t" = "floating toggle"; + #"${cfg.config.modifier}+space" = "focus mode_toggle"; - "${cfg.config.modifier}+b" = "exec ${backgroundCommand}"; + "${cfg.config.modifier}+b" = "exec ${backgroundCommand}"; - "${cfg.config.modifier}+p" = "focus parent"; + "${cfg.config.modifier}+p" = "focus parent"; - "${cfg.config.modifier}+Shift+minus" = "move scratchpad"; - "${cfg.config.modifier}+minus" = "scratchpad show"; + "${cfg.config.modifier}+Shift+minus" = "move scratchpad"; + "${cfg.config.modifier}+minus" = "scratchpad show"; - "${cfg.config.modifier}+1" = "workspace 1"; - "${cfg.config.modifier}+2" = "workspace 2"; - "${cfg.config.modifier}+3" = "workspace 3"; - "${cfg.config.modifier}+4" = "workspace 4"; - "${cfg.config.modifier}+5" = "workspace 5"; - "${cfg.config.modifier}+6" = "workspace 6"; - "${cfg.config.modifier}+7" = "workspace 7"; - "${cfg.config.modifier}+8" = "workspace 8"; - "${cfg.config.modifier}+9" = "workspace 9"; - "${cfg.config.modifier}+0" = "workspace 10"; + "${cfg.config.modifier}+1" = "workspace 1"; + "${cfg.config.modifier}+2" = "workspace 2"; + "${cfg.config.modifier}+3" = "workspace 3"; + "${cfg.config.modifier}+4" = "workspace 4"; + "${cfg.config.modifier}+5" = "workspace 5"; + "${cfg.config.modifier}+6" = "workspace 6"; + "${cfg.config.modifier}+7" = "workspace 7"; + "${cfg.config.modifier}+8" = "workspace 8"; + "${cfg.config.modifier}+9" = "workspace 9"; + "${cfg.config.modifier}+0" = "workspace 10"; - "${cfg.config.modifier}+Shift+1" = "move container to workspace number 1"; - "${cfg.config.modifier}+Shift+2" = "move container to workspace number 2"; - "${cfg.config.modifier}+Shift+3" = "move container to workspace number 3"; - "${cfg.config.modifier}+Shift+4" = "move container to workspace number 4"; - "${cfg.config.modifier}+Shift+5" = "move container to workspace number 5"; - "${cfg.config.modifier}+Shift+6" = "move container to workspace number 6"; - "${cfg.config.modifier}+Shift+7" = "move container to workspace number 7"; - "${cfg.config.modifier}+Shift+8" = "move container to workspace number 8"; - "${cfg.config.modifier}+Shift+9" = "move container to workspace number 9"; - "${cfg.config.modifier}+Shift+0" = "move container to workspace number 10"; + "${cfg.config.modifier}+Shift+1" = "move container to workspace number 1"; + "${cfg.config.modifier}+Shift+2" = "move container to workspace number 2"; + "${cfg.config.modifier}+Shift+3" = "move container to workspace number 3"; + "${cfg.config.modifier}+Shift+4" = "move container to workspace number 4"; + "${cfg.config.modifier}+Shift+5" = "move container to workspace number 5"; + "${cfg.config.modifier}+Shift+6" = "move container to workspace number 6"; + "${cfg.config.modifier}+Shift+7" = "move container to workspace number 7"; + "${cfg.config.modifier}+Shift+8" = "move container to workspace number 8"; + "${cfg.config.modifier}+Shift+9" = "move container to workspace number 9"; + "${cfg.config.modifier}+Shift+0" = "move container to workspace number 10"; - "${cfg.config.modifier}+Escape" = "workspace back_and_forth"; + "${cfg.config.modifier}+Escape" = "workspace back_and_forth"; - # rename workspace - "${cfg.config.modifier}+n" = '' - exec i3-input -F 'rename workspace to "%s"' -P 'New name for this workspace: ' - ''; + # rename workspace + "${cfg.config.modifier}+n" = '' + exec i3-input -F 'rename workspace to "%s"' -P 'New name for this workspace: ' + ''; - # change to named workspace - "${cfg.config.modifier}+grave" = - let - script = pkgs.writers.writeBash "select-workspace" '' - set -e - set -o pipefail - ${pkgs.i3}/bin/i3-msg -t get_workspaces | \ - ${pkgs.jq}/bin/jq --raw-output '.[] | .name' | \ - ${pkgs.rofi}/bin/rofi -dmenu -p 'Select Workspace' | \ - while read line - do - ${pkgs.i3}/bin/i3-msg workspace "$line" - done - ''; - in - "exec ${script}"; + # change to named workspace + "${cfg.config.modifier}+grave" = + let + script = pkgs.writers.writeBash "select-workspace" '' + set -e + set -o pipefail + ${pkgs.i3}/bin/i3-msg -t get_workspaces | \ + ${pkgs.jq}/bin/jq --raw-output '.[] | .name' | \ + ${pkgs.rofi}/bin/rofi -dmenu -p 'Select Workspace' | \ + while read line + do + ${pkgs.i3}/bin/i3-msg workspace "$line" + done + ''; + in + "exec ${script}"; - "${cfg.config.modifier}+Shift+grave" = - let - script = pkgs.writers.writeBash "move-workspace" '' - set -e - set -o pipefail - ${pkgs.i3}/bin/i3-msg -t get_workspaces | \ - ${pkgs.jq}/bin/jq --raw-output '.[] | .name' | \ - ${pkgs.rofi}/bin/rofi -dmenu -p 'Move to Workspace' | \ - while read line - do - ${pkgs.i3}/bin/i3-msg move container to workspace "$line" - done - ''; - in - "exec ${script}"; + "${cfg.config.modifier}+Shift+grave" = + let + script = pkgs.writers.writeBash "move-workspace" '' + set -e + set -o pipefail + ${pkgs.i3}/bin/i3-msg -t get_workspaces | \ + ${pkgs.jq}/bin/jq --raw-output '.[] | .name' | \ + ${pkgs.rofi}/bin/rofi -dmenu -p 'Move to Workspace' | \ + while read line + do + ${pkgs.i3}/bin/i3-msg move container to workspace "$line" + done + ''; + in + "exec ${script}"; - "${cfg.config.modifier}+Shift+c" = "reload"; - "${cfg.config.modifier}+Shift+r" = "restart"; - "${cfg.config.modifier}+Shift+e" = "exec i3-nagbar -t warning -m 'Do you want to exit i3?' -b 'Yes' 'i3-msg exit'"; + "${cfg.config.modifier}+Shift+c" = "reload"; + "${cfg.config.modifier}+Shift+r" = "restart"; + "${cfg.config.modifier}+Shift+e" = "exec i3-nagbar -t warning -m 'Do you want to exit i3?' -b 'Yes' 'i3-msg exit'"; - "${cfg.config.modifier}+r" = "mode resize"; + "${cfg.config.modifier}+r" = "mode resize"; - # multiple monitors - # autorandr --save docked # to save setup - # autorandr --save undocked # to save setup - # autorandr --change # automatically detects the setup - "${cfg.config.modifier}+BackSpace" = - let - script = pkgs.writers.writeBash "autorandr" '' - ${pkgs.autorandr}/bin/autorandr --change - ${backgroundCommand} - ''; - in - "exec ${toString script}"; + # multiple monitors + # autorandr --save docked # to save setup + # autorandr --save undocked # to save setup + # autorandr --change # automatically detects the setup + "${cfg.config.modifier}+BackSpace" = + let + script = pkgs.writers.writeBash "autorandr" '' + ${pkgs.autorandr}/bin/autorandr --change + ${backgroundCommand} + ''; + in + "exec ${toString script}"; - # like vimperator - "${cfg.config.modifier}+a" = "exec ${pkgs.i3-easyfocus}/bin/i3-easyfocus"; + # like vimperator + "${cfg.config.modifier}+a" = "exec ${pkgs.i3-easyfocus}/bin/i3-easyfocus"; + }; }; }; }; diff --git a/nixos/homes/palo/packages/development.nix b/nixos/homes/palo/packages/development.nix index 3c4cd77..1843f91 100644 --- a/nixos/homes/palo/packages/development.nix +++ b/nixos/homes/palo/packages/development.nix @@ -143,8 +143,15 @@ with lib; unstable.mdbook + nodePackages.prettier + shfmt + black + pre-commit + nixpkgs-fmt + treefmt + ] ++ (map pandocScript (lib.cartesianProductOfSets { - inputFormat = [ "man" "markdown" "mediawiki" ]; + inputFormat = [ "man" "markdown" "mediawiki" "asciidoc" ]; outputFormat = [ "mediawiki" "docbook5" "html5" "man" "jira" "markdown" ]; })); diff --git a/nixos/homes/palo/packages/nextcloud.nix b/nixos/homes/palo/packages/nextcloud.nix index a5bf1c4..7acaf8d 100644 --- a/nixos/homes/palo/packages/nextcloud.nix +++ b/nixos/homes/palo/packages/nextcloud.nix @@ -20,6 +20,7 @@ in (nextcloudSync "Pictures") (nextcloudSync "Unterlagen") (nextcloudSync "Nähen") + (nextcloudSync "NähenTina") (nextcloudSync "Video") (nextcloudSync "Kunstbuch") (nextcloudSync "AWS-SolutionArchitect-Professional") diff --git a/nixos/machines/cherry/configuration.nix b/nixos/machines/cherry/configuration.nix index 427c6a3..9c7f2d2 100644 --- a/nixos/machines/cherry/configuration.nix +++ b/nixos/machines/cherry/configuration.nix @@ -5,7 +5,7 @@ # last system packages that need to be migrated to components ../../system/all/borg-jobs.nix - ../../system/all/syncthing.nix + #../../system/all/syncthing.nix ../../system/server/netdata.nix ../../modules diff --git a/nixos/machines/cream/configuration.nix b/nixos/machines/cream/configuration.nix index 064adba..9357464 100644 --- a/nixos/machines/cream/configuration.nix +++ b/nixos/machines/cream/configuration.nix @@ -3,9 +3,13 @@ imports = [ - ../../components - ../../system/desktop + # last system packages that need to be migrated to components + ../../system/all/borg-jobs.nix + #../../system/all/syncthing.nix ../../system/server/netdata.nix + ../../modules + + ../../components ./hardware-configuration.nix diff --git a/nixos/machines/cream/tinc_retiolum.nix b/nixos/machines/cream/tinc_retiolum.nix index 53a0e42..4be55b5 100644 --- a/nixos/machines/cream/tinc_retiolum.nix +++ b/nixos/machines/cream/tinc_retiolum.nix @@ -10,4 +10,18 @@ ed25519PrivateKeyFile = config.sops.secrets.tinc_retiolum_ed25519_key.path; rsaPrivateKeyFile = config.sops.secrets.tinc_retiolum_rsa_key.path; }; + + fileSystems."/retiolum/sicily" = { + device = "//sicily.r/tonne"; + fsType = "cifs"; + options = [ + "guest" + "nofail" + "noauto" + "ro" + "rsize=16777216" + "cache=loose" + "x-systemd.after=network.target" + ]; + }; } diff --git a/nixos/machines/orbi/configuration.nix b/nixos/machines/orbi/configuration.nix index d1690e8..34b8885 100644 --- a/nixos/machines/orbi/configuration.nix +++ b/nixos/machines/orbi/configuration.nix @@ -4,7 +4,7 @@ ../../system/all/nginx.nix ../../system/all/borg-jobs.nix ../../system/all/defaults.nix - ../../system/all/syncthing.nix + #../../system/all/syncthing.nix ../../system/server/netdata.nix ../../system/server/packages.nix diff --git a/nixos/machines/orbi/media-syncthing.nix b/nixos/machines/orbi/media-syncthing.nix index ae5629d..e388bff 100644 --- a/nixos/machines/orbi/media-syncthing.nix +++ b/nixos/machines/orbi/media-syncthing.nix @@ -1,6 +1,6 @@ { config, pkgs, lib, ... }: { - imports = [ ../../system/all/syncthing.nix ]; + #imports = [ ../../system/all/syncthing.nix ]; sops.secrets.syncthing_cert = { }; sops.secrets.syncthing_key = { }; diff --git a/nixos/machines/robi/configuration.nix b/nixos/machines/robi/configuration.nix index a92ff2b..aa28a9f 100644 --- a/nixos/machines/robi/configuration.nix +++ b/nixos/machines/robi/configuration.nix @@ -4,7 +4,7 @@ ../../system/all/nginx.nix ../../system/all/borg-jobs.nix ../../system/all/defaults.nix - ../../system/all/syncthing.nix + #../../system/all/syncthing.nix ../../system/server/netdata.nix ../../system/server/packages.nix diff --git a/nixos/machines/robi/media-syncthing.nix b/nixos/machines/robi/media-syncthing.nix index ae5629d..446b7a9 100644 --- a/nixos/machines/robi/media-syncthing.nix +++ b/nixos/machines/robi/media-syncthing.nix @@ -1,6 +1,6 @@ { config, pkgs, lib, ... }: { - imports = [ ../../system/all/syncthing.nix ]; + # imports = [ ../../system/all/syncthing.nix ]; sops.secrets.syncthing_cert = { }; sops.secrets.syncthing_key = { }; diff --git a/nixos/system/all/default.nix b/nixos/system/all/default.nix index 74311b7..33d574e 100644 --- a/nixos/system/all/default.nix +++ b/nixos/system/all/default.nix @@ -7,21 +7,12 @@ ./defaults.nix - # needed - # - - # cross-compiling - # - ./grub.nix - #./networking-qos.nix ./nginx-landingpage.nix ./nginx.nix ./packages.nix ./borg-jobs.nix ./borg-scripts.nix - ./syncthing.nix - ./on-failure.nix ]; diff --git a/nixos/system/desktop/default.nix b/nixos/system/desktop/default.nix index 0abc6f2..35437e5 100644 --- a/nixos/system/desktop/default.nix +++ b/nixos/system/desktop/default.nix @@ -1,14 +1,9 @@ { config, pkgs, lib, ... }: { imports = [ - ../all - #./packages.nix - #./yubikey.nix ]; - #components.network.sshd.onlyTincAccess = lib.mkDefault true; - backup.dirs = [ "${config.users.users.mainUser.home}/.config/noti" "${config.users.users.mainUser.home}/.password-store" diff --git a/nixos/system/desktop/packages.nix b/nixos/system/desktop/packages.nix deleted file mode 100644 index 853edd3..0000000 --- a/nixos/system/desktop/packages.nix +++ /dev/null @@ -1,313 +0,0 @@ -{ pkgs, config, lib, ... }: - -with lib; - -let - - library = import ../../library { inherit pkgs lib; }; - - allLicenses = - let - licenses = builtins.map - (license: "echo '${license.shortName} : ${license.fullName}'") - (builtins.attrValues pkgs.lib.licenses); - in - pkgs.writers.writeBashBin "all-licenses" - (lib.concatStringsSep "\n" licenses); - - #joplin = pkgs.joplin-desktop; - joplin = pkgs.unstable.joplin-desktop; - #joplin = pkgs.writers.writeBashBin "joplin" '' - # if [[ ! -x "$HOME/programs/Joplin.AppImage" ]] - # then - # echo "$HOME/programs/Joplin.AppImage does not exist or is not executable"; - # exit 1 - # fi - # exec ${pkgs.appimage-run}/bin/appimage-run "$HOME/programs/Joplin.AppImage" - #''; - - parseUrl = pkgs.writers.writeBashBin "parseUrl" '' - echo "$@" | \ - ${pkgs.jq}/bin/jq --raw-input --raw-output ' - def parseURL: capture( "^((?[^:/?#]+):)?(//(?(?[^/?#:]*)(:(?[0-9]*))?))?((?[^?#]*)\\?)?((?([^#]*)))?(#(?(.*)))?"); - parseURL - ' - ''; - - parseAndCopyLink = pkgs.writers.writeBashBin "parseAndCopyLink" '' - ${parseUrl}/bin/parseUrl "$@" | \ - ${pkgs.jq}/bin/jq --raw-output '"\(.scheme)://\(.domain)\(.path)"' | \ - ${pkgs.xclip}/bin/xclip - ''; - - replaceLinks = pkgs.writers.writeBashBin "replace-link-with-content" # sh - '' - if [ ! -L "$1" ] - then - echo "$1 does not exist or is not a file" - exit 1 - fi - - cp -rL "$1" "$1.backup" - unlink "$1" - mv "$1.backup" "$1" - ''; - - connectToSpeaker = name: id: - pkgs.writeShellScriptBin "connect-to-speaker-${name}" # sh - '' - # hacky script because I have problems with - # automatically connecting to trusted bluetooth devices. - - echo "Connect to Speaker ${name}" - - bluetoothctl <