From 84cc801e701ad63235be04ba7f628be39b57d321 Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Sun, 30 Mar 2025 21:17:25 +0100 Subject: [PATCH] Back to a regular flake --- .envrc | 6 +-- .tmux | 11 +++-- devenv.lock | 103 ------------------------------------------ devenv.nix | 47 ------------------- devenv.yaml | 15 ------ flake.lock | 27 +++++++++++ flake.nix | 21 +++++++++ tools/scripts/publish | 9 ++++ 8 files changed, 65 insertions(+), 174 deletions(-) delete mode 100644 devenv.lock delete mode 100644 devenv.nix delete mode 100644 devenv.yaml create mode 100644 flake.lock create mode 100644 flake.nix create mode 100755 tools/scripts/publish diff --git a/.envrc b/.envrc index 30da14fdc..3550a30f2 100644 --- a/.envrc +++ b/.envrc @@ -1,5 +1 @@ -export DIRENV_WARN_TIMEOUT=20s - -eval "$(devenv direnvrc)" - -use devenv +use flake diff --git a/.tmux b/.tmux index c0b37f130..4f1876015 100755 --- a/.tmux +++ b/.tmux @@ -1,9 +1,12 @@ #!/usr/bin/env bash -tmux new-window -dn shell -tmux new-window -dn server -tmux new-window -dn daily_emails -c "source/_daily_emails" +PATH="${PATH}:./vendor/bin" -tmux send-keys -t server "devenv up" Enter +tmux new-window -dn scratch +tmux new-window -dn sculpin +tmux new-window -dn tailwind + +tmux send-keys -t sculpin "sculpin generate --server --watch" Enter +tmux send-keys -t tailwind "cd assets && tailwindcss --input css/tailwind.css --output ../source/build/tailwind-new.css --watch" Enter nvim . diff --git a/devenv.lock b/devenv.lock deleted file mode 100644 index 342a17ee0..000000000 --- a/devenv.lock +++ /dev/null @@ -1,103 +0,0 @@ -{ - "nodes": { - "devenv": { - "locked": { - "dir": "src/modules", - "lastModified": 1740256804, - "owner": "cachix", - "repo": "devenv", - "rev": "b799e753d331086a1cc307405df7a93d2cfdab13", - "type": "github" - }, - "original": { - "dir": "src/modules", - "owner": "cachix", - "repo": "devenv", - "type": "github" - } - }, - "flake-compat": { - "flake": false, - "locked": { - "lastModified": 1733328505, - "owner": "edolstra", - "repo": "flake-compat", - "rev": "ff81ac966bb2cae68946d5ed5fc4994f96d0ffec", - "type": "github" - }, - "original": { - "owner": "edolstra", - "repo": "flake-compat", - "type": "github" - } - }, - "git-hooks": { - "inputs": { - "flake-compat": "flake-compat", - "gitignore": "gitignore", - "nixpkgs": [ - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1737465171, - "owner": "cachix", - "repo": "git-hooks.nix", - "rev": "9364dc02281ce2d37a1f55b6e51f7c0f65a75f17", - "type": "github" - }, - "original": { - "owner": "cachix", - "repo": "git-hooks.nix", - "type": "github" - } - }, - "gitignore": { - "inputs": { - "nixpkgs": [ - "git-hooks", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1709087332, - "owner": "hercules-ci", - "repo": "gitignore.nix", - "rev": "637db329424fd7e46cf4185293b9cc8c88c95394", - "type": "github" - }, - "original": { - "owner": "hercules-ci", - "repo": "gitignore.nix", - "type": "github" - } - }, - "nixpkgs": { - "locked": { - "lastModified": 1733477122, - "owner": "cachix", - "repo": "devenv-nixpkgs", - "rev": "7bd9e84d0452f6d2e63b6e6da29fe73fac951857", - "type": "github" - }, - "original": { - "owner": "cachix", - "ref": "rolling", - "repo": "devenv-nixpkgs", - "type": "github" - } - }, - "root": { - "inputs": { - "devenv": "devenv", - "git-hooks": "git-hooks", - "nixpkgs": "nixpkgs", - "pre-commit-hooks": [ - "git-hooks" - ] - } - } - }, - "root": "root", - "version": 7 -} diff --git a/devenv.nix b/devenv.nix deleted file mode 100644 index c6b4f4c4f..000000000 --- a/devenv.nix +++ /dev/null @@ -1,47 +0,0 @@ -{ pkgs, ... }: - -{ - packages = with pkgs; [ - git - tailwindcss - ]; - - languages = { - php.enable = true; - }; - - processes = { - sculpin.exec = "vendor/bin/sculpin generate --server --watch"; - - tailwind = { - exec = "tailwindcss --config tailwind.config.ts --input css/tailwind.css --output ../source/build/tailwind.css --watch"; - - process-compose = { - is_tty = true; - working_dir = "assets"; - }; - }; - }; - - tasks = { }; - - enterShell = '' - [[ ! -d vendor ]] && composer install - ''; - - enterTest = ''''; - - scripts = { - publish.exec = '' - sculpin generate --env prod - rsync -avz static/ output_prod - rsync -avz output_prod/ ssh.oliverdavies.uk:/var/www/vhosts/www.oliverdavies.uk - ''; - - "tailwind-build".exec = '' - cd assets - tailwindcss --config tailwind.config.ts --input css/tailwind.css --output ../source/build/tailwind.css --minify - ''; - }; - -} diff --git a/devenv.yaml b/devenv.yaml deleted file mode 100644 index 116a2adb3..000000000 --- a/devenv.yaml +++ /dev/null @@ -1,15 +0,0 @@ -# yaml-language-server: $schema=https://devenv.sh/devenv.schema.json -inputs: - nixpkgs: - url: github:cachix/devenv-nixpkgs/rolling - -# If you're using non-OSS software, you can set allowUnfree to true. -# allowUnfree: true - -# If you're willing to use a package that's vulnerable -# permittedInsecurePackages: -# - "openssl-1.1.1w" - -# If you have more than one devenv you can merge them -#imports: -# - ./backend diff --git a/flake.lock b/flake.lock new file mode 100644 index 000000000..d29d65a69 --- /dev/null +++ b/flake.lock @@ -0,0 +1,27 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1742422364, + "narHash": "sha256-mNqIplmEohk5jRkqYqG19GA8MbQ/D4gQSK0Mu4LvfRQ=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "a84ebe20c6bc2ecbcfb000a50776219f48d134cc", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 000000000..5408e8958 --- /dev/null +++ b/flake.nix @@ -0,0 +1,21 @@ +{ + inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + + outputs = + { nixpkgs, ... }: + let + system = "x86_64-linux"; + pkgs = import nixpkgs { inherit system; }; + in + { + devShells.${system}.default = pkgs.mkShell { + buildInputs = with pkgs; [ + php83 + php83Packages.composer + tailwindcss + ]; + }; + + formatter.${system} = pkgs.nixfmt-rfc-style; + }; +} diff --git a/tools/scripts/publish b/tools/scripts/publish new file mode 100755 index 000000000..963165049 --- /dev/null +++ b/tools/scripts/publish @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +set -o errexit +set -o nounset +set -o pipefail + +vendor/bin/sculpin generate --env prod +rsync -uvrP static/ output_prod "$@" +rsync -uvrP output_prod/ ssh.oliverdavies.uk:/var/www/vhosts/www.oliverdavies.uk "$@"