parent
5227e82c15
commit
d18476da73
16 changed files with 1 additions and 1 deletions
13
packages/backup-websites.nix
Normal file
13
packages/backup-websites.nix
Normal file
|
@ -0,0 +1,13 @@
|
|||
{ lib, pkgs, ... }:
|
||||
|
||||
pkgs.writeShellApplication {
|
||||
name = "backup-websites";
|
||||
|
||||
text = ''
|
||||
backup_path="''${HOME}/server-backup"
|
||||
|
||||
mkdir -p "''${backup_path}"
|
||||
|
||||
${lib.getExe pkgs.rsync} -avzP nixedo.local:/var/www/vhosts/ "''${backup_path}" --delete-after
|
||||
'';
|
||||
}
|
43
packages/build-glove80.nix
Normal file
43
packages/build-glove80.nix
Normal file
|
@ -0,0 +1,43 @@
|
|||
{ pkgs, ... }:
|
||||
|
||||
with pkgs;
|
||||
|
||||
writeShellApplication {
|
||||
name = "build-glove80";
|
||||
|
||||
runtimeInputs = [
|
||||
cachix
|
||||
git
|
||||
nix
|
||||
];
|
||||
|
||||
text = ''
|
||||
BRANCH="''${1:-main}"
|
||||
SRC_DIR="''${PWD}/src"
|
||||
CONFIG_DIR="''${PWD}/config"
|
||||
NIX_FILE="''${CONFIG_DIR}/default.nix"
|
||||
|
||||
# Ensure cachix is configured
|
||||
echo "Using moergo-glove80-zmk-dev cache"
|
||||
cachix use moergo-glove80-zmk-dev
|
||||
|
||||
# Clone or update the ZMK repository
|
||||
if [ ! -d "$SRC_DIR" ]; then
|
||||
echo "Cloning ZMK repository into ./src..."
|
||||
git clone https://github.com/moergo-sc/zmk "$SRC_DIR"
|
||||
else
|
||||
echo "Updating ZMK repository in ./src..."
|
||||
git -C "$SRC_DIR" fetch --all
|
||||
fi
|
||||
|
||||
# Checkout the specified branch or tag
|
||||
echo "Checking out branch/tag: $BRANCH in ./src"
|
||||
git -C "$SRC_DIR" checkout -q --detach "$BRANCH"
|
||||
|
||||
# Build firmware using Nix
|
||||
echo "Building firmware from: $NIX_FILE"
|
||||
nix-build "$NIX_FILE" --arg firmware "import ''${SRC_DIR}/default.nix {}" -j2 -o ./glove80.uf2 --show-trace
|
||||
|
||||
echo "Firmware built successfully: $(realpath ./glove80.uf2)"
|
||||
'';
|
||||
}
|
21
packages/default.nix
Normal file
21
packages/default.nix
Normal file
|
@ -0,0 +1,21 @@
|
|||
{ pkgs, prev, ... }:
|
||||
|
||||
let
|
||||
inherit (pkgs) callPackage;
|
||||
|
||||
vimPlugins = callPackage ./vim-plugins { };
|
||||
in
|
||||
{
|
||||
backup-websites = callPackage ./backup-websites.nix { };
|
||||
build-glove80 = callPackage ./build-glove80.nix { };
|
||||
dev-commit = callPackage ./dev-commit.nix { };
|
||||
displayselect = callPackage ./displayselect { };
|
||||
notes = callPackage ./notes { };
|
||||
passmenu-otp = callPackage ./passmenu-otp.nix { };
|
||||
todos-add = callPackage ./todos/todos-add.nix { };
|
||||
todos-edit = callPackage ./todos/todos-edit.nix { };
|
||||
tmux-sessionizer = callPackage ./tmux-sessionizer { };
|
||||
upload-to-files = callPackage ./upload-to-files.nix { };
|
||||
|
||||
vimPlugins = prev.vimPlugins // vimPlugins;
|
||||
}
|
26
packages/dev-commit.nix
Normal file
26
packages/dev-commit.nix
Normal file
|
@ -0,0 +1,26 @@
|
|||
{ pkgs, ... }:
|
||||
|
||||
pkgs.writeShellApplication {
|
||||
name = "dev-commit";
|
||||
|
||||
runtimeInputs = with pkgs; [
|
||||
coreutils
|
||||
git
|
||||
openssh
|
||||
];
|
||||
|
||||
text = ''
|
||||
IFS=':' read -ra repos <<< "$DEV_COMMIT_PATHS"
|
||||
|
||||
for repo in "''${repos[@]}"; do
|
||||
echo "Processing $repo"
|
||||
pushd "$repo"
|
||||
|
||||
git add .
|
||||
git commit -m "Automated dev commit" || true
|
||||
git push
|
||||
|
||||
popd
|
||||
done
|
||||
'';
|
||||
}
|
32
packages/displayselect/default.nix
Normal file
32
packages/displayselect/default.nix
Normal file
|
@ -0,0 +1,32 @@
|
|||
{ pkgs, ... }:
|
||||
|
||||
pkgs.stdenv.mkDerivation {
|
||||
pname = "displayselect";
|
||||
version = "unstable-2024-05-11";
|
||||
|
||||
src = builtins.fetchurl {
|
||||
url = "https://raw.githubusercontent.com/lukesmithxyz/voidrice/97687287bdfd332398b82a196b5f1feaec73f1d7/.local/bin/displayselect";
|
||||
sha256 = "sha256:11r561pfhb48a3xmi42zzvpljahnwlfad9rz8qmmp64dhz1f2vp0";
|
||||
};
|
||||
|
||||
dontUnpack = true;
|
||||
|
||||
buildInputs = with pkgs; [
|
||||
bash
|
||||
xorg.xrandr
|
||||
];
|
||||
|
||||
prePatch = ''
|
||||
cp $src displayselect
|
||||
'';
|
||||
|
||||
patches = [ ./scaling.patch ];
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out/bin
|
||||
cp displayselect $out/bin
|
||||
chmod +x $out/bin/displayselect
|
||||
'';
|
||||
|
||||
meta.mainProgram = "displayselect";
|
||||
}
|
26
packages/displayselect/scaling.patch
Normal file
26
packages/displayselect/scaling.patch
Normal file
|
@ -0,0 +1,26 @@
|
|||
diff --git a/.local/bin/displayselect b/.local/bin/displayselect
|
||||
index 51dd468..c132b7a 100755
|
||||
--- a/displayselect
|
||||
+++ b/displayselect
|
||||
@@ -15,20 +15,13 @@ twoscreen() { # If multi-monitor is selected and there are two screens.
|
||||
|
||||
res_external=$(xrandr --query | sed -n "/^$external/,/\+/p" | \
|
||||
tail -n 1 | awk '{print $1}')
|
||||
- res_internal=$(xrandr --query | sed -n "/^$internal/,/\+/p" | \
|
||||
- tail -n 1 | awk '{print $1}')
|
||||
|
||||
res_ext_x=$(echo "$res_external" | sed 's/x.*//')
|
||||
res_ext_y=$(echo "$res_external" | sed 's/.*x//')
|
||||
- res_int_x=$(echo "$res_internal" | sed 's/x.*//')
|
||||
- res_int_y=$(echo "$res_internal" | sed 's/.*x//')
|
||||
-
|
||||
- scale_x=$(echo "$res_ext_x / $res_int_x" | bc -l)
|
||||
- scale_y=$(echo "$res_ext_y / $res_int_y" | bc -l)
|
||||
|
||||
xrandr --output "$external" --auto --scale 1.0x1.0 \
|
||||
--output "$internal" --auto --same-as "$external" \
|
||||
- --scale "$scale_x"x"$scale_y"
|
||||
+ --scale-from "${res_ext_x}x${res_ext_y}"
|
||||
else
|
||||
|
||||
primary=$(echo "$screens" | dmenu -i -p "Select primary display:")
|
13
packages/notes/change-filename-format.patch
Normal file
13
packages/notes/change-filename-format.patch
Normal file
|
@ -0,0 +1,13 @@
|
|||
diff --git a/notes b/notes
|
||||
index 3351903..34364bf 100755
|
||||
--- a/notes
|
||||
+++ b/notes
|
||||
@@ -14,7 +14,7 @@ set -e
|
||||
readonly NOTES_DIRECTORY="${NOTES_DIRECTORY:-${HOME}/notes}"
|
||||
readonly NOTES_EDITOR="${EDITOR}"
|
||||
|
||||
-readonly NOTES_FILE="$(date +%Y-%m).txt"
|
||||
+readonly NOTES_FILE="$(date +%Y-%m-%d).txt"
|
||||
readonly NOTES_PATH="${NOTES_DIRECTORY}/${NOTES_FILE}"
|
||||
|
||||
if [ ! -d "${NOTES_DIRECTORY}" ]; then
|
27
packages/notes/default.nix
Normal file
27
packages/notes/default.nix
Normal file
|
@ -0,0 +1,27 @@
|
|||
{ pkgs, ... }:
|
||||
|
||||
with pkgs;
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "notes";
|
||||
version = "unstable-2024-12-07";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "nickjj";
|
||||
repo = "notes";
|
||||
rev = "f4f0aab865c19132484a2c3998cd984bdb3b9514";
|
||||
sha256 = "sha256-y5SkS+22tW9wf3gH26NHSnrnJ0rkBWSgKvansP8Hlbg=";
|
||||
};
|
||||
|
||||
buildInputs = [ bash ];
|
||||
|
||||
patches = [
|
||||
./change-filename-format.patch
|
||||
];
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out/bin
|
||||
cp notes $out/bin/notes
|
||||
chmod +x $out/bin/notes
|
||||
'';
|
||||
}
|
30
packages/passmenu-otp.nix
Normal file
30
packages/passmenu-otp.nix
Normal file
|
@ -0,0 +1,30 @@
|
|||
{ pkgs, ... }:
|
||||
|
||||
with pkgs;
|
||||
|
||||
stdenv.mkDerivation {
|
||||
pname = "passmenu-otp";
|
||||
version = "unstable-2019-04-21";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "petrmanek";
|
||||
repo = "passmenu-otp";
|
||||
rev = "2623a0845cc2bb68b636a743862693fce9ec8b02";
|
||||
sha256 = "sha256-2EGomeK/p3uVfgho5xGR11ovJQ2q3cPZoFG+z88DyxA=";
|
||||
};
|
||||
|
||||
buildInputs = [
|
||||
pass
|
||||
];
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out/bin
|
||||
cp passmenu-otp $out/bin/passmenu-otp
|
||||
chmod +x $out/bin/passmenu-otp
|
||||
'';
|
||||
|
||||
meta = {
|
||||
homepage = "https://github.com/petrmanek/passmenu-otp";
|
||||
mainProgram = "passmenu-otp";
|
||||
};
|
||||
}
|
35
packages/tmux-sessionizer/default.nix
Normal file
35
packages/tmux-sessionizer/default.nix
Normal file
|
@ -0,0 +1,35 @@
|
|||
{ pkgs, ... }:
|
||||
|
||||
with pkgs;
|
||||
|
||||
stdenv.mkDerivation {
|
||||
pname = "tmux-sessionizer";
|
||||
version = "unstable-2025-06-19";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "theprimeagen";
|
||||
repo = "tmux-sessionizer";
|
||||
rev = "7edf8211e36368c29ffc0d2c6d5d2d350b4d729b";
|
||||
sha256 = "sha256-4QGlq/cLbed7AZhQ3R1yH+44gmgp9gSzbiQft8X5NwU=";
|
||||
};
|
||||
|
||||
buildInputs = [
|
||||
bash
|
||||
fzf
|
||||
tmux
|
||||
];
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out/bin
|
||||
cp tmux-sessionizer $out/bin/tmux-sessionizer
|
||||
chmod +x $out/bin/tmux-sessionizer
|
||||
'';
|
||||
|
||||
patches = [
|
||||
(fetchpatch {
|
||||
name = "Sort directories alphabetically #23";
|
||||
sha256 = "sha256-+YvXIV3VLdxzIDPYCNaJDHLxUxWuInnNNdS3VrqTpIs=";
|
||||
url = "https://patch-diff.githubusercontent.com/raw/ThePrimeagen/tmux-sessionizer/pull/23.patch";
|
||||
})
|
||||
];
|
||||
}
|
13
packages/todos/todos-add.nix
Normal file
13
packages/todos/todos-add.nix
Normal file
|
@ -0,0 +1,13 @@
|
|||
{ pkgs, ... }:
|
||||
|
||||
pkgs.writeShellApplication {
|
||||
name = "todos-add";
|
||||
|
||||
text = ''
|
||||
TODOS_DIRECTORY="''${TODOS_DIRECTORY:-"$XDG_DOCUMENTS_DIR/todos"}"
|
||||
export TODOS_DIRECTORY
|
||||
|
||||
echo "$*" >> "$TODOS_DIRECTORY/$(date +%Y-%m-%d).txt"
|
||||
'';
|
||||
}
|
||||
|
12
packages/todos/todos-edit.nix
Normal file
12
packages/todos/todos-edit.nix
Normal file
|
@ -0,0 +1,12 @@
|
|||
{ pkgs, ... }:
|
||||
|
||||
pkgs.writeShellApplication {
|
||||
name = "todos-edit";
|
||||
|
||||
text = ''
|
||||
TODOS_DIRECTORY="''${TODOS_DIRECTORY:-"$XDG_DOCUMENTS_DIR/todos"}"
|
||||
export TODOS_DIRECTORY
|
||||
|
||||
"$EDITOR" "$TODOS_DIRECTORY/$(date +%Y-%m-%d).txt";
|
||||
'';
|
||||
}
|
11
packages/upload-to-files.nix
Normal file
11
packages/upload-to-files.nix
Normal file
|
@ -0,0 +1,11 @@
|
|||
{ pkgs }:
|
||||
|
||||
with pkgs;
|
||||
|
||||
writeShellApplication {
|
||||
name = "upload-to-files";
|
||||
|
||||
text = ''
|
||||
${pkgs.rsync}/bin/rsync -avz --info=progress2 "$1" ssh.oliverdavies.uk:/var/www/vhosts/files.oliverdavies.uk
|
||||
'';
|
||||
}
|
23
packages/vim-plugins/default.nix
Normal file
23
packages/vim-plugins/default.nix
Normal file
|
@ -0,0 +1,23 @@
|
|||
{ pkgs, lib }:
|
||||
|
||||
let
|
||||
pluginsData = builtins.fromJSON (builtins.readFile ./vim-plugins.json);
|
||||
|
||||
mkPlugin =
|
||||
name: attrs:
|
||||
with attrs;
|
||||
with pkgs;
|
||||
vimUtils.buildVimPlugin {
|
||||
inherit name version;
|
||||
|
||||
src = fetchFromGitHub {
|
||||
inherit
|
||||
hash
|
||||
owner
|
||||
repo
|
||||
rev
|
||||
;
|
||||
};
|
||||
};
|
||||
in
|
||||
lib.mapAttrs mkPlugin pluginsData
|
18
packages/vim-plugins/vim-plugins.json
Normal file
18
packages/vim-plugins/vim-plugins.json
Normal file
|
@ -0,0 +1,18 @@
|
|||
{
|
||||
"vim-textobj-indent": {
|
||||
"owner": "kana",
|
||||
"repo": "vim-textobj-indent",
|
||||
"rev": "deb76867c302f933c8f21753806cbf2d8461b548",
|
||||
"version": "0.0.6",
|
||||
"hash": "sha256-oFzUPG+IOkbKZ2gU/kduQ3G/LsLDlEjFhRP0BHBE+1Q="
|
||||
},
|
||||
|
||||
"vim-textobj-xmlattr": {
|
||||
"owner": "whatyouhide",
|
||||
"repo": "vim-textobj-xmlattr",
|
||||
"rev": "694a297f1d75fd527e87da9769f3c6519a87ebb1",
|
||||
"version": "unstable-2016-06-03",
|
||||
"hash": "sha256-+91FVP95oh00flINdltqx6qJuijYo56tHIh3J098G2Q="
|
||||
}
|
||||
}
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue