From a373a69ca5c417657164d78a2dbe57b1eedf00e5 Mon Sep 17 00:00:00 2001 From: Greg Hellings Date: Sun, 21 Apr 2024 23:30:44 -0500 Subject: [PATCH] Add devshell and process-compose --- flake.lock | 95 +++++++++++++++++++++++++++++++++++++++++++++++++++--- flake.nix | 32 ++++++++++++++---- 2 files changed, 115 insertions(+), 12 deletions(-) diff --git a/flake.lock b/flake.lock index f26f655..8bf0f18 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,24 @@ { "nodes": { + "devshell": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + }, + "locked": { + "lastModified": 1713532798, + "narHash": "sha256-wtBhsdMJA3Wa32Wtm1eeo84GejtI43pMrFrmwLXrsEc=", + "owner": "numtide", + "repo": "devshell", + "rev": "12e914740a25ea1891ec619bb53cf5e6ca922e40", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "devshell", + "type": "github" + } + }, "flake-parts": { "inputs": { "nixpkgs-lib": "nixpkgs-lib" @@ -33,13 +52,31 @@ "type": "github" } }, + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1701680307, + "narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "4022d587cbbfd70fe950c1e2083a02621806a725", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, "nixpkgs": { "locked": { - "lastModified": 1682960002, - "narHash": "sha256-5Zjh4pT3lAjFGN1gVrjqj1LLJHKCAlGdLD8raU7oEMc=", + "lastModified": 1704161960, + "narHash": "sha256-QGua89Pmq+FBAro8NriTuoO/wNaUtugt29/qqA8zeeM=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "8670e496ffd093b60e74e7fa53526aa5920d09eb", + "rev": "63143ac2c9186be6d9da6035fa22620018c85932", "type": "github" }, "original": { @@ -68,6 +105,22 @@ } }, "nixpkgs_2": { + "locked": { + "lastModified": 1682960002, + "narHash": "sha256-5Zjh4pT3lAjFGN1gVrjqj1LLJHKCAlGdLD8raU7oEMc=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "8670e496ffd093b60e74e7fa53526aa5920d09eb", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_3": { "locked": { "lastModified": 1708475490, "narHash": "sha256-g1v0TsWBQPX97ziznfJdWhgMyMGtoBFs102xSYO4syU=", @@ -83,17 +136,49 @@ "type": "github" } }, + "process-compose": { + "locked": { + "lastModified": 1713665906, + "narHash": "sha256-kuOJ5pK03axDx4F5GBhNMn6ZtTG3V4Cd85iHUsu5eWk=", + "owner": "Platonic-Systems", + "repo": "process-compose-flake", + "rev": "128a50fb7bb03eb41c8f65923c355ad4d7a57935", + "type": "github" + }, + "original": { + "owner": "Platonic-Systems", + "repo": "process-compose-flake", + "type": "github" + } + }, "root": { "inputs": { + "devshell": "devshell", "flake-parts": "flake-parts", "flake-root": "flake-root", - "nixpkgs": "nixpkgs", + "nixpkgs": "nixpkgs_2", + "process-compose": "process-compose", "treefmt-nix": "treefmt-nix" } }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, "treefmt-nix": { "inputs": { - "nixpkgs": "nixpkgs_2" + "nixpkgs": "nixpkgs_3" }, "locked": { "lastModified": 1711963903, diff --git a/flake.nix b/flake.nix index a256107..f962540 100644 --- a/flake.nix +++ b/flake.nix @@ -1,16 +1,21 @@ +# github.com/brianmcgee has lots of great ideas for going above and beyond for this { description = "Greg's homepage"; inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + devshell.url = "github:numtide/devshell"; flake-parts.url = "github:hercules-ci/flake-parts"; flake-root.url = "github:srid/flake-root"; + process-compose.url = "github:Platonic-Systems/process-compose-flake"; treefmt-nix.url = "github:numtide/treefmt-nix"; }; - outputs = { flake-parts, flake-root, treefmt-nix, ... }@inputs: + outputs = { devshell, flake-parts, flake-root, process-compose, treefmt-nix, ... }@inputs: flake-parts.lib.mkFlake { inherit inputs; } { imports = [ + inputs.devshell.flakeModule inputs.flake-root.flakeModule + inputs.process-compose.flakeModule inputs.treefmt-nix.flakeModule ]; flake = { @@ -20,13 +25,26 @@ "x86_64-linux" "aarch64-linux" ]; - perSystem = { config, pkgs, ... }: { - devShells.default = pkgs.mkShell { - nativeBuildInputs = [ - pkgs.bashInteractive - pkgs.hugo + perSystem = { config, pkgs, self', ... }: { + devshells.default = { + commands = [ + { + package = pkgs.hugo; + category = "server"; + } + { + package = self'.packages.dev-server; + category = "server"; + help = "Start the development server"; + } ]; - buildInputs = [ ]; + #devshell.startup.server.text = "${pkgs.hugo}/bin/hugo serve"; + }; + + process-compose = { + dev-server.settings.processes = { + hugo.command = "${pkgs.hugo}/bin/hugo serve"; + }; }; treefmt.config = {