Migrate to flake-parts, remove justfile

Move the justfile recipes to devshell commands.
This commit is contained in:
Oliver Davies 2025-06-03 23:35:21 +01:00
parent 34cee8e678
commit e642619988
3 changed files with 125 additions and 74 deletions

88
flake.lock generated
View file

@ -1,6 +1,73 @@
{
"nodes": {
"devshell": {
"inputs": {
"nixpkgs": "nixpkgs"
},
"locked": {
"lastModified": 1741473158,
"narHash": "sha256-kWNaq6wQUbUMlPgw8Y+9/9wP0F8SHkjy24/mN3UAppg=",
"owner": "numtide",
"repo": "devshell",
"rev": "7c9e793ebe66bcba8292989a68c0419b737a22a0",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "devshell",
"type": "github"
}
},
"flake-parts": {
"inputs": {
"nixpkgs-lib": "nixpkgs-lib"
},
"locked": {
"lastModified": 1748821116,
"narHash": "sha256-F82+gS044J1APL0n4hH50GYdPRv/5JWm34oCJYmVKdE=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "49f0870db23e8c1ca0b5259734a02cd9e1e371a1",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "flake-parts",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1722073938,
"narHash": "sha256-OpX0StkL8vpXyWOGUD6G+MA26wAXK6SpT94kLJXo6B4=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "e36e9f57337d0ff0cf77aceb58af4c805472bfae",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs-lib": {
"locked": {
"lastModified": 1748740939,
"narHash": "sha256-rQaysilft1aVMwF14xIdGS3sj1yHlI6oKQNBRTF40cc=",
"owner": "nix-community",
"repo": "nixpkgs.lib",
"rev": "656a64127e9d791a334452c6b6606d17539476e2",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "nixpkgs.lib",
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1744463964,
"narHash": "sha256-LWqduOgLHCFxiTNYi3Uj5Lgz0SR+Xhw3kr/3Xd0GPTM=",
@ -16,26 +83,11 @@
"type": "github"
}
},
"opdavies-theme": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"path": "./themes/opdavies",
"type": "path"
},
"original": {
"path": "./themes/opdavies",
"type": "path"
},
"parent": []
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs",
"opdavies-theme": "opdavies-theme"
"devshell": "devshell",
"flake-parts": "flake-parts",
"nixpkgs": "nixpkgs_2"
}
}
},

View file

@ -1,45 +1,64 @@
{
inputs={
inputs = {
devshell.url = "github:numtide/devshell";
flake-parts.url = "github:hercules-ci/flake-parts";
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
opdavies-theme = {
inputs.nixpkgs.follows = "nixpkgs";
url = "path:./themes/opdavies";
};
};
outputs =
{ nixpkgs, opdavies-theme, ... }:
let
system = "x86_64-linux";
pkgs = import nixpkgs { inherit system; };
inputs@{ flake-parts, ... }:
flake-parts.lib.mkFlake { inherit inputs; } ({
systems = [ "x86_64-linux" ];
php = pkgs.php83.buildEnv {
extraConfig = ''
upload_max_filesize = 50M;
post_max_size = 50M;
'';
};
phpPackages = pkgs.php83Packages;
in
{
devShells.${system}.default = pkgs.mkShell {
inputsFrom = [
opdavies-theme.devShells.${system}.default
];
imports = [
inputs.devshell.flakeModule
];
packages = with pkgs; [
just
lua-language-server
lua54Packages.luacheck
nixd
php
phpactor
phpPackages.composer
sqlite
];
};
perSystem =
{ pkgs, system, ... }:
let
php = pkgs.php83.buildEnv {
extraConfig = ''
upload_max_filesize = 50M;
post_max_size = 50M;
'';
};
phpPackages = pkgs.php83Packages;
in
{
devshells.default = {
packages = with pkgs; [
just
lua-language-server
lua54Packages.luacheck
nixd
php
phpactor
phpPackages.composer
sqlite
];
formatter.${system} = pkgs.nixfmt-rfc-style;
};
commands = [
{
name = "generate";
command = "vendor/bin/drush tome:static --uri https://www.oliverdavies.uk";
help = "Generate the static HTML";
}
{
name = "upload";
command = ''
generate
rsync -avzP html/ nixedo.oliverdavies.uk:/var/www/vhosts/website-tome \
--delete --delete-after
'';
help = "Generate the static HTML and upload it to the server";
}
];
};
formatter = pkgs.nixfmt-rfc-style;
};
});
}

View file

@ -1,20 +0,0 @@
_default:
just --list
db-backup:
sqlite3 web/db.sqlite ".backup 'web/backup-$(date '+%s').sqlite'"
export:
composer run export
git add config content
git commit -m "tome export"
generate-html:
drush tome:static --uri https://www.oliverdavies.uk
install-drupal:
drush si --db-url=sqlite://localhost/db.sqlite
upload: generate-html
rsync -avzP html/ nixedo.oliverdavies.uk:/var/www/vhosts/website-tome \
--delete --delete-after