From 88af6eee7c5976d95afebab888af15317dd5a98e Mon Sep 17 00:00:00 2001 From: Haak Saxberg Date: Tue, 16 Jun 2020 22:28:05 -0700 Subject: [PATCH] add obsidian notes, syncthing dependency --- nix/configuration.nix | 41 ++++++++++++++++++++++++----------- nix/obsidian.nix | 50 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 79 insertions(+), 12 deletions(-) create mode 100644 nix/obsidian.nix diff --git a/nix/configuration.nix b/nix/configuration.nix index f431446..e2583ee 100644 --- a/nix/configuration.nix +++ b/nix/configuration.nix @@ -52,8 +52,8 @@ cachix firefox inkscape + p7zip plasma-browser-integration - unzip vim wget xclip @@ -65,6 +65,21 @@ fonts.fonts = with pkgs; [ fira-code ]; + # Open ports in the firewall. + networking.firewall = { + allowedTCPPorts = [ + 631 # CUPs port for printing + 6881 # port for torrenting + ]; + allowedUDPPorts = [ + 631 + 6881 + ]; + }; + # Or disable the firewall altogether. + # networking.firewall.enable = false; + + # Some programs need SUID wrappers, can be configured further or are # started in user sessions. # programs.mtr.enable = true; @@ -75,18 +90,13 @@ # Enable the OpenSSH daemon. # services.openssh.enable = true; - # Open ports in the firewall. - networking.firewall = { - allowedTCPPorts = [ - 631 # CUPs port for printing - ]; - allowedUDPPorts = [ - 631 - ]; + # Torrenting! + services.deluge = { + enable = true; + declarative = true; + authFile = /home/haak/dotfiles/secrets/deluge_auth; + openFirewall = true; }; - # Or disable the firewall altogether. - # networking.firewall.enable = false; - # Enable CUPS to print documents. services.printing = { enable = true; @@ -116,6 +126,13 @@ desktopManager.plasma5.enable = true; }; + services.syncthing = { + enable = true; + user = "haak"; + dataDir = "/home/haak/synced"; + configDir = "/home/haak/synced/.config/syncthing"; + }; + # Define a user account. Don't forget to set a password with ‘passwd’. users.users.haak = { isNormalUser = true; diff --git a/nix/obsidian.nix b/nix/obsidian.nix new file mode 100644 index 0000000..d2f3ebd --- /dev/null +++ b/nix/obsidian.nix @@ -0,0 +1,50 @@ +{ stdenv, writeScript, gtk3, appimageTools }: + +# run this function like so: +# nix-shell --run obsidian -p "callPackage ./path/to/this/file.nix {}" + +let + inherit (appimageTools) extractType2 wrapType2; + + name = "obsidian"; + src = ~/Downloads/Obsidian-0.6.7.AppImage; + + # you can add more paths as required + xdg_dirs = builtins.concatStringsSep ":" [ + "${gtk3}/share/gsettings-schemas/${gtk3.name}" + ]; + + # not necessary, here for debugging purposes + # adapted from the original runScript of appimageTools + extracted_source = extractType2 { inherit name src; }; + debugScript = writeScript "run" '' + #!${stdenv.shell} + + export APPDIR=${extracted_source} + export APPIMAGE_SILENT_INSTALL=1 + + # >>> inspect the script running environment here <<< + echo "INSPECT: ''${GIO_EXTRA_MODULES:-no extra modules!}" + echo "INSPECT: ''${GSETTINGS_SCHEMA_DIR:-no schemas!}" + echo "INSPECT: ''${XDG_DATA_DIRS:-no data dirs!}" + + cd $APPDIR + exec ./AppRun "$@" + ''; +in wrapType2 { + inherit name src; + + # for debugging purposes only + #runScript = debugScript; + + extraPkgs = pkgs: with pkgs; [ + # put runtime dependencies if any here + ]; + + # the magic happens here + # other potential variables of interest: + # GIO_EXTRA_MODULES, GSETTINGS_SCHEMA_DIR + profile = '' + export XDG_DATA_DIRS="${xdg_dirs}''${XDG_DATA_DIRS:+:"''$XDG_DATA_DIRS"}" + ''; +}