Fix utility scripts

This commit is contained in:
Riley Apeldoorn 2022-05-15 20:02:26 +02:00
parent 030e457600
commit 953383d576
6 changed files with 26 additions and 10 deletions

View File

@ -14,6 +14,8 @@
outputs = args: with args.nixpkgs; { outputs = args: with args.nixpkgs; {
nixosConfigurations = { nixosConfigurations = {
# Desktop
"thor" = lib.nixosSystem { "thor" = lib.nixosSystem {
system = "x86_64-linux"; system = "x86_64-linux";
modules = [ modules = [
@ -22,6 +24,8 @@
]; ];
specialArgs = args; specialArgs = args;
}; };
# Laptop
"loki" = lib.nixosSystem { "loki" = lib.nixosSystem {
system = "x86_64-linux"; system = "x86_64-linux";
modules = [ modules = [
@ -30,6 +34,10 @@
]; ];
specialArgs = args; specialArgs = args;
}; };
# TODO: Pinebook Pro
# TODO: Raspberry Pi
}; };
}; };

View File

@ -34,7 +34,7 @@ let named = submodule {
hex = mkOption { type = themeType; }; hex = mkOption { type = themeType; };
}; };
}; };
scripts = (import ../scripts/clip.nix { inherit pkgs; });
in { in {
options.riley = with lib; { options.riley = with lib; {

View File

@ -1,10 +1,17 @@
{ config, lib, pkgs, scripts, ... }: { config, lib, pkgs, ... }:
(lib.mkIf (config.riley.gui) { let scripts = (import ../../scripts/clip.nix {
inherit pkgs;
});
in (lib.mkIf (config.riley.gui) {
# Add some shell scripts that abstract away the # Add some shell scripts that abstract away the
# horrible reality that the clipboard is managed by # horrible reality that the clipboard is managed by
# the display server. # the display server.
users.users."riley".packages = with scripts; [ c p ]; users.users."riley".packages =
with scripts; [
c p
];
}) })

View File

@ -1,6 +1,6 @@
{ pkgs, config, lib, ... }: { pkgs, config, lib, ... }:
let scripts = (import ./scripts.nix); let scripts = (import ./scripts.nix { inherit pkgs; });
theme = config.riley.theme.hex; theme = config.riley.theme.hex;
modifier = "Mod4"; modifier = "Mod4";
terminal = "${pkgs.alacritty}/bin/alacritty"; terminal = "${pkgs.alacritty}/bin/alacritty";

View File

@ -113,15 +113,15 @@ with lib; let mod = modifier;
utils = ({ lock ? null, sc ? null }: utils = ({ lock ? null, sc ? null }:
(optionalAttrs (lock != null) { (optionalAttrs (lock != null) {
"${mod}+Escape" = "exec ${lock}/bin/lock"; "${mod}+Escape" = "exec ${lock}/bin/lock";
}) // (optionalAttrs (sc ? null) { }) // (optionalAttrs (sc != null) {
"${mod}+d" = "exec ${sc}/bin/sc"; "${mod}+d --release" = "exec ${sc}/bin/sc";
}) })
); );
in (mkMerge [ in (mkMerge [
(media { inherit (pkgs) mpc_cli pulseaudio; }) (media { inherit (pkgs) mpc_cli pulseaudio; })
(utils { inherit (scripts) lock sc; }) (utils scripts)
(genDirectional directional) (genDirectional directional)
(genWorkspaces workspace) (genWorkspaces workspace)

View File

@ -12,8 +12,9 @@
name = "sc"; name = "sc";
runtimeInputs = [ xclip scrot ]; runtimeInputs = [ xclip scrot ];
text = '' text = ''
scrot -ozs /tmp/sc.png env > /tmp/env_sc.txt
xclip -t "image/png" -sel clip -i < /tmp/sc.png scrot -D :0 -ozs /tmp/sc.png 2>/tmp/aaa.txt
xclip -t "image/png" -sel clip -i < /tmp/sc.png 2>/tmp/bbb.txt
''; '';
}); });