Commit 7a1b9936dd6e

Vincent Demeester <vincent@sbr.pm>
2019-04-19 14:59:11
modules: use pkgs.writeScriptBin instead of links
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
1 parent 9d19cb4
Changed files (3)
modules
modules/profiles/assets/bin/capture
@@ -1,2 +0,0 @@
-#!/usr/bin/env bash
-emacsclient -n -F '((name . "capture") (width . 75) (height . 30))' -e '(org-capture)'
modules/profiles/desktop.nix
@@ -3,6 +3,7 @@
 with lib;
 let
   cfg = config.profiles.desktop;
+
   dim-screen = pkgs.writeScript "dim-sreen.sh" ''
 #!${pkgs.stdenv.shell}
 export PATH=${lib.getBin pkgs.xlibs.xbacklight}/bin:$PATH
@@ -12,6 +13,15 @@ xbacklight -time 5000 -steps 400 -set 0 &
 sleep 2147483647 &
 wait
   '';
+
+  pbpaste = pkgs.writeScriptBin "pbcopy" ''
+    #!${pkgs.stdenv.shell}
+    ${pkgs.xsel}/bin/xsel --clipboard --input
+  '';
+  pbcopy = pkgs.writeScriptBin "pbpaste" ''
+    #!${pkgs.stdenv.shell}
+    ${pkgs.xsel}/bin/xsel --clipboard --output
+  '';
 in
 {
   options = {
@@ -111,25 +121,13 @@ in
       gnome3.gnome_themes_standard
       keybase
       mpv
+      pbcopy
+      pbpaste
       peco
       pass
       xdg-user-dirs
       xdg_utils
       xsel
     ];
-    home.file."bin/pbcopy" = {
-      text = ''
-      #!${pkgs.stdenv.shell}
-      ${pkgs.xsel}/bin/xsel --clipboard --input
-      '';
-      executable = true;
-    };
-    home.file."bin/pbpaste" = {
-      text = ''
-      #!${pkgs.stdenv.shell}
-      ${pkgs.xsel}/bin/xsel --clipboard --output
-      '';
-      executable = true;
-    };
   };
 }
modules/profiles/emacs.nix
@@ -3,6 +3,11 @@
 with lib;
 let
   cfg = config.profiles.emacs;
+
+  capture = pkgs.writeScriptBin "capture" ''
+  #!${pkgs.stdenv.shell}
+  emacsclient -n -F '((name . "capture") (width . 75) (height . 30))' -e '(org-capture)'
+  '';
 in
 {
   options = {
@@ -195,11 +200,7 @@ in
       };
     }
     (mkIf config.profiles.desktop.enable {
-      home.file."bin/capture" = {
-        source = ./assets/bin/capture;
-        executable = true;
-      };
-      home.packages = with pkgs; [ wmctrl ];
+      home.packages = with pkgs; [ wmctrl capture ];
     })
     (mkIf config.services.gpg-agent.enable {
       services.gpg-agent.extraConfig = ''