Move custom packages
This commit is contained in:
parent
386c68813a
commit
23cc6c99a0
7 changed files with 87 additions and 66 deletions
11
drafts.nix
11
drafts.nix
|
@ -1,11 +0,0 @@
|
|||
{ pkgs }:
|
||||
|
||||
pkgs.writeShellApplication {
|
||||
name = "drafts";
|
||||
|
||||
runtimeInputs = with pkgs; [ gnugrep ];
|
||||
|
||||
text = ''
|
||||
grep -r 'draft: true' "''${1:-source}"
|
||||
'';
|
||||
}
|
|
@ -3,24 +3,26 @@
|
|||
{
|
||||
imports = [ inputs.devshell.flakeModule ];
|
||||
|
||||
perSystem.devshells.default =
|
||||
{ pkgs, ... }:
|
||||
perSystem =
|
||||
{ pkgs, self', ... }:
|
||||
{
|
||||
packages = with pkgs; [
|
||||
nodePackages.browser-sync
|
||||
devshells.default = {
|
||||
packages = with pkgs; [
|
||||
self'.packages.drafts
|
||||
self'.packages.new-draft
|
||||
self'.packages.publish
|
||||
|
||||
(php83.buildEnv {
|
||||
extraConfig = ''
|
||||
error_reporting = E_ALL & ~E_DEPRECATED & ~E_USER_DEPRECATED
|
||||
'';
|
||||
})
|
||||
nodePackages.browser-sync
|
||||
|
||||
php83Packages.composer
|
||||
tailwindcss
|
||||
(php83.buildEnv {
|
||||
extraConfig = ''
|
||||
error_reporting = E_ALL & ~E_DEPRECATED & ~E_USER_DEPRECATED
|
||||
'';
|
||||
})
|
||||
|
||||
(import ../drafts.nix { inherit pkgs; })
|
||||
(import ../new-draft.nix { inherit pkgs; })
|
||||
(import ../publish.nix { inherit pkgs; })
|
||||
];
|
||||
php83Packages.composer
|
||||
tailwindcss
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
16
flake-modules/drafts.nix
Normal file
16
flake-modules/drafts.nix
Normal file
|
@ -0,0 +1,16 @@
|
|||
{
|
||||
perSystem =
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
packages.drafts = pkgs.writeShellApplication {
|
||||
name = "drafts";
|
||||
|
||||
runtimeInputs = with pkgs; [ gnugrep ];
|
||||
|
||||
text = ''
|
||||
echo "oob"
|
||||
grep -r 'draft: true' "''${1:-source}"
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
33
flake-modules/new-draft.nix
Normal file
33
flake-modules/new-draft.nix
Normal file
|
@ -0,0 +1,33 @@
|
|||
{
|
||||
perSystem =
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
packages.new-draft = pkgs.writeShellApplication {
|
||||
name = "new-draft";
|
||||
|
||||
runtimeInputs = with pkgs; [
|
||||
coreutils
|
||||
git
|
||||
];
|
||||
|
||||
text = ''
|
||||
title="$1"
|
||||
|
||||
exclude_words="for|at|and"
|
||||
|
||||
filtered_title=$(echo "$title" | sed -E "s/\b($exclude_words)\b//g")
|
||||
|
||||
slug=$(echo "$filtered_title" | tr '[:upper:]' '[:lower:]' | sed -e 's/[^a-z0-9]/-/g' -e 's/-\+/-/g' -e 's/^-//g' -e 's/-$//g')
|
||||
|
||||
file="source/_posts/$slug.md"
|
||||
|
||||
echo -e "---\ntitle: $title\ndate: ~\ndraft: true\n---" > "$file"
|
||||
|
||||
echo "File created: $file"
|
||||
|
||||
git add "$file"
|
||||
git commit -s -m "Add draft: $title"
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
21
flake-modules/publish.nix
Normal file
21
flake-modules/publish.nix
Normal file
|
@ -0,0 +1,21 @@
|
|||
{
|
||||
perSystem =
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
packages.publish = pkgs.writeShellApplication {
|
||||
name = "publish";
|
||||
|
||||
runtimeInputs = with pkgs; [
|
||||
rsync
|
||||
php
|
||||
];
|
||||
|
||||
text = ''
|
||||
vendor/bin/sculpin generate --env prod
|
||||
|
||||
rsync -uvrP static/ output_prod "$@"
|
||||
rsync -uvrP output_prod/ nixedo.oliverdavies.uk:/var/www/vhosts/website-sculpin "$@"
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,26 +0,0 @@
|
|||
{ pkgs }:
|
||||
|
||||
pkgs.writeShellApplication {
|
||||
name = "new-draft";
|
||||
|
||||
runtimeInputs = with pkgs; [ coreutils git ];
|
||||
|
||||
text = ''
|
||||
title="$1"
|
||||
|
||||
exclude_words="for|at|and"
|
||||
|
||||
filtered_title=$(echo "$title" | sed -E "s/\b($exclude_words)\b//g")
|
||||
|
||||
slug=$(echo "$filtered_title" | tr '[:upper:]' '[:lower:]' | sed -e 's/[^a-z0-9]/-/g' -e 's/-\+/-/g' -e 's/^-//g' -e 's/-$//g')
|
||||
|
||||
file="source/_posts/$slug.md"
|
||||
|
||||
echo -e "---\ntitle: $title\ndate: ~\ndraft: true\n---" > "$file"
|
||||
|
||||
echo "File created: $file"
|
||||
|
||||
git add "$file"
|
||||
git commit -s -m "Add draft: $title"
|
||||
'';
|
||||
}
|
14
publish.nix
14
publish.nix
|
@ -1,14 +0,0 @@
|
|||
{ pkgs }:
|
||||
|
||||
pkgs.writeShellApplication {
|
||||
name = "publish";
|
||||
|
||||
runtimeInputs = with pkgs; [ rsync php ];
|
||||
|
||||
text = ''
|
||||
vendor/bin/sculpin generate --env prod
|
||||
|
||||
rsync -uvrP static/ output_prod "$@"
|
||||
rsync -uvrP output_prod/ nixedo.oliverdavies.uk:/var/www/vhosts/website-sculpin "$@"
|
||||
'';
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue