aboutsummaryrefslogtreecommitdiffstats
path: root/pkgs/sources/scripts/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/sources/scripts/default.nix')
-rw-r--r--pkgs/sources/scripts/default.nix412
1 files changed, 0 insertions, 412 deletions
diff --git a/pkgs/sources/scripts/default.nix b/pkgs/sources/scripts/default.nix
deleted file mode 100644
index 09c8d411..00000000
--- a/pkgs/sources/scripts/default.nix
+++ /dev/null
@@ -1,412 +0,0 @@
-{
- sysLib,
- homeConfig,
- nixosConfig,
-}: [
- (
- final: prev: let
- inherit (prev) lib;
-
- write_shell = {
- name,
- path,
- dependencies ? [],
- keepPath ? false,
- completions ? false,
- }:
- sysLib.writeShellScript {
- inherit name keepPath;
- src = ./source/${path}/${name}.sh;
- dependencies = dependencies ++ [prev.dash];
- generateCompletions = completions;
- };
- write_python = {
- name,
- path,
- dependencies_system ? [],
- dependencies_python ? _: [],
- keepPath ? false,
- }: let
- src = ./source/${path}/${name}.py;
- dependencies =
- [(prev.python3.withPackages dependencies_python)]
- ++ dependencies_system;
- path_setting =
- if keepPath
- then "--prefix PATH :"
- else "--set PATH";
- in
- prev.runCommandLocal name {
- nativeBuildInputs = [prev.makeWrapper] ++ dependencies;
- }
- ''
- install -m755 ${src} -D "$out/bin/${name}"
- patchShebangs "$out/bin/${name}"
- wrapProgram "$out/bin/${name}" ${path_setting} ${prev.lib.makeBinPath dependencies};
- '';
-
- ## Begin of shell scripts
- aumo-scr = write_shell {
- name = "aumo";
- path = "apps";
- dependencies = builtins.attrValues {
- inherit
- (prev)
- udisks
- findutils
- rofi
- ;
- };
- };
-
- battery-scr = write_shell {
- name = "battery";
- path = "wrappers";
- dependencies = [];
- };
-
- brightness-scr = lib.mkIf nixosConfig.soispha.laptop.enable (write_shell {
- name = "brightness";
- path = "small_functions";
- generateCompletions = true;
- dependencies = [];
- replacementStrings = {BACKLIGHT_NAME = nixosConfig.soispha.laptop.backlight;};
- });
-
- con2pdf-scr = sysLib.writeShellScript {
- name = "con2pdf";
- src = ./source/apps/con2pdf.sh;
- dependencies = builtins.attrValues {inherit (prev) sane-backends imagemagick coreutils fd;};
- generateCompletions = true;
- replacementStrings = {
- DEVICE_FUNCTION =
- # This is here, because escaping the whole function, to use it in the shell script
- # directly just isn't possible
- prev.writeText "DEVICE_FUNCTION"
- /*
- bash
- */
- ''
- scanimage -L | awk 'BEGIN { FS = "`" } { gsub(/'.*/, "", $2); print $2 }'
- '';
- };
- };
-
- description-scr = write_shell {
- name = "description";
- path = "specific/ytcc";
- dependencies = builtins.attrValues {
- inherit (prev) jq fmt less locale;
- };
- };
-
- fupdate-scr = write_shell {
- name = "fupdate";
- path = "apps";
- keepPath = true;
- completions = true;
- dependencies = builtins.attrValues {
- inherit
- (prev)
- dash
- nix
- gnugrep
- fd
- coreutils
- bat # used by batgrep
- gnused # required by batgrep
- git # needed to fetch through git
- ;
- inherit (prev.bat-extras) batgrep;
- };
- };
-
- git-edit-index-scr = write_shell {
- name = "git-edit-index";
- path = "apps";
- completions = true;
- # This starts neovim, wich might want to shell out
- keepPath = true;
- dependencies = builtins.attrValues {
- inherit
- (prev)
- git
- gnused
- # $EDITOR
-
- ;
- };
- };
-
- hibernate-scr = write_shell {
- name = "hibernate";
- path = "wrappers";
- dependencies = builtins.attrValues {
- inherit
- (prev)
- systemd
- taskwarrior
- ;
- };
- };
-
- ll-scr = sysLib.writeShellScript {
- name = "ll";
- src = ./source/wrappers/ll.sh;
- wrap = false;
- };
-
- # TODO: this need to be replaced with a wayland alternative
- # llp-scr = write_shell {
- # name = "llp";
- # path = "wrappers";
- # dependencies = builtins.attrValues {inherit (prev) lf ueberzug;};
- # };
-
- lock-scr = write_shell {
- name = "lock";
- path = "wrappers";
- dependencies = builtins.attrValues {
- inherit
- (prev)
- taskwarrior
- swaylock
- ;
- };
- };
-
- lyrics-scr = write_shell {
- name = "lyrics";
- path = "wrappers";
- dependencies = builtins.attrValues {
- inherit
- (prev)
- exiftool
- mpc-cli
- jq
- less
- locale # dependency of less
- ;
- };
- };
-
- mpc-fav-scr = write_shell {
- name = "mpc-fav";
- path = "wrappers";
- dependencies = builtins.attrValues {
- inherit
- (prev)
- mpc-cli
- ;
- };
- };
-
- mpc-rm-scr = write_shell {
- name = "mpc-rm";
- path = "wrappers";
- dependencies = builtins.attrValues {
- inherit
- (prev)
- mpc-cli
- trash-cli
- ;
- };
- };
-
- mpc-scr = write_shell {
- name = "mpc";
- path = "wrappers";
- dependencies = [
- mpc-fav-scr
- mpc-rm-scr
- prev.mpc-cli
- ];
- };
-
- nato-scr = write_python {
- name = "nato";
- path = "small_functions";
- dependencies_python = ps: [];
- };
-
- neorg-scr = sysLib.writeShellScriptMultiPart {
- name = "neorg";
- keepPath = true;
- src = ./source/specific/neorg/sh;
- baseName = "main.sh";
- cmdPrefix = "functions";
- cmdNames = [
- "add.sh"
- "context.sh"
- "dmenu.sh"
- "f_start.sh"
- "f_stop.sh"
- "list.sh"
- "project.sh"
- "review.sh"
- "utils.sh"
- "workspace.sh"
- ];
- dependencies = with prev; [
- cocogitto
- rofi
- libnotify
- ];
- generateCompletions = true;
- replacementStrings = {
- DEFAULT_NEORG_PROJECT_DIR =
- homeConfig.programs.nixvim.plugins.neorg.modules."core.dirman".config.workspaces.projects;
- HOME_TASKRC = "${homeConfig.xdg.configHome}/task/home-manager-taskrc";
- NEORG_REVIEW_PATH = "${homeConfig.xdg.dataHome}/neorg/review";
- ALL_PROJECTS_NEWLINE = "${homeConfig.soispha.taskwarrior.projects.projects_newline}";
- ALL_PROJECTS_COMMA = "${homeConfig.soispha.taskwarrior.projects.projects_comma}";
- ALL_PROJECTS_PIPE = "${homeConfig.soispha.taskwarrior.projects.projects_pipe}";
- ALL_WORKSPACES = "${lib.strings.concatStringsSep "|" (builtins.attrNames homeConfig.programs.nixvim.plugins.neorg.modules."core.dirman".config.workspaces)}";
- ID_GENERATION_FUNCTION = "${sysLib.writeShellScript {
- name = "neorg_id_function";
- src = ./source/specific/neorg/neorg_id_function.sh;
- dependencies = with prev; [
- taskwarrior
- gawk
- findutils # xargs
- ];
- }}/bin/neorg_id_function";
-
- # TODO: Replace the hard-coded path here with some reference <2023-10-20>
- TASK_PROJECT_FILE = "/home/soispha/repos/nix/nixos-config/hm/soispha/conf/taskwarrior/projects/default.nix";
- };
- };
-
- screenshot_persistent-scr = write_shell {
- name = "screenshot_persistent";
- path = "small_functions";
- keepPath = true;
- dependencies = builtins.attrValues {
- inherit
- (prev)
- grim
- slurp
- alacritty
- rofi
- libnotify
- lf # TODO: add llp
- ;
- };
- };
-
- screenshot_temporary-scr = write_shell {
- name = "screenshot_temporary";
- path = "small_functions";
- dependencies = builtins.attrValues {inherit (prev) grim slurp wl-clipboard;};
- };
-
- show-scr = write_shell {
- name = "show";
- path = "wrappers";
- keepPath = true; # I might want to use nvim in less (and shell escapes)
- dependencies = builtins.attrValues {inherit (prev) less locale;};
- };
-
- sort_song-scr = write_shell {
- name = "sort_song";
- path = "wrappers";
- dependencies = builtins.attrValues {inherit (prev) mediainfo jq gawk;};
- };
-
- spodi-scr = sysLib.writeShellScriptMultiPart {
- name = "spodi";
- keepPath = false;
- src = ./source/specific/spodi;
- baseName = "spodi.sh";
- cmdPrefix = "sh";
- cmdNames = [
- "download.sh"
- "update.sh"
- ];
- dependencies = with prev; [
- gawk
- expect
- spotdl
- fd
- coreutils
- ];
- generateCompletions = true;
- replacementStrings = {
- XDG_CACHE_HOME = homeConfig.xdg.cacheHome;
- XDG_MUSIC_DIR = homeConfig.xdg.userDirs.music;
- };
- };
-
- update-sys-scr = write_shell {
- name = "update-sys";
- path = "small_functions";
- completions = true;
- dependencies = builtins.attrValues {
- inherit
- (prev)
- git
- nixos-rebuild
- sudo
- openssh
- coreutils
- mktemp
- gnugrep
- gnused
- systemd
- ;
- };
- };
-
- virsh-del-scr = write_shell {
- name = "virsh-del";
- path = "wrappers";
- dependencies = builtins.attrValues {inherit (prev) libvirt;};
- };
-
- yti-scr = write_shell {
- name = "yti";
- path = "wrappers";
- dependencies = builtins.attrValues {inherit (prev) gawk expect yt-dlp;};
- };
- in {
- scripts = {
- # llp = llp-scr; # TODO: see above
- aumo = aumo-scr;
- battery = battery-scr;
- brightness = brightness-scr;
- con2pdf = con2pdf-scr;
- description = description-scr;
- fupdate = fupdate-scr;
- git-edit-index = git-edit-index-scr;
- hibernate = hibernate-scr;
- ll = ll-scr;
- lock = lock-scr;
- lyrics = lyrics-scr;
- mpc = mpc-scr;
- mpc-fav = mpc-fav-scr;
- mpc-rm = mpc-rm-scr;
- nato = nato-scr;
- neorg = neorg-scr;
- screenshot_persistent = screenshot_persistent-scr;
- screenshot_temporary = screenshot_temporary-scr;
- show = show-scr;
- sort_song = sort_song-scr;
- spodi = spodi-scr;
- update-sys = update-sys-scr;
- virsh-del = virsh-del-scr;
- yti = yti-scr;
- };
- }
- )
-]
-
-
- pkgs = import nixpkgs (import ./sys/nixpkgs {
- inherit (nixpkgs) lib;
- inherit system sysLib;
-
- # FIXME: Don't unconditionally use tiamat here <2024-02-24>
- homeConfig = self.nixosConfigurations.tiamat.config.home-manager.users.soispha;
- nixosConfig = self.nixosConfigurations.tiamat.config;
- overlays = [];
- });