From 61fcccb104c57b09a5bb5457ad41b10a0e054755 Mon Sep 17 00:00:00 2001 From: Jess Date: Sun, 15 Dec 2024 03:53:07 +1300 Subject: [PATCH] Flake: Add and run formatter + Rename devshell Add a formatter output to the flake (`nix fmt`), along with moving + renaming the devshell so it will work by running `nix-shell` in the root of the project. --- Documentation/BuildInstructionsLadybird.md | 4 +-- flake.lock | 40 +++++++++++----------- flake.nix | 24 +++++++++---- UI/default.nix => shell.nix | 16 +++++---- 4 files changed, 50 insertions(+), 34 deletions(-) rename UI/default.nix => shell.nix (71%) diff --git a/Documentation/BuildInstructionsLadybird.md b/Documentation/BuildInstructionsLadybird.md index 902c6a04b8c..17e89dd0c3a 100644 --- a/Documentation/BuildInstructionsLadybird.md +++ b/Documentation/BuildInstructionsLadybird.md @@ -114,10 +114,10 @@ nix develop nix develop --command bash # Using nix-shell -nix-shell UI +nix-shell # Using nix-shell and a custom shell -nix-shell UI --command bash +nix-shell --command bash ``` Then invoke `cmake` directly. For example: diff --git a/flake.lock b/flake.lock index 32ef6eba211..09983e11bda 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,23 @@ { "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, "nixpkgs": { "locked": { "lastModified": 1731676054, @@ -18,8 +36,8 @@ }, "root": { "inputs": { - "nixpkgs": "nixpkgs", - "utils": "utils" + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" } }, "systems": { @@ -36,24 +54,6 @@ "repo": "default", "type": "github" } - }, - "utils": { - "inputs": { - "systems": "systems" - }, - "locked": { - "lastModified": 1731533236, - "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } } }, "root": "root", diff --git a/flake.nix b/flake.nix index f13ebace7b2..9c8599f5625 100644 --- a/flake.nix +++ b/flake.nix @@ -3,12 +3,24 @@ inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; - utils.url = "github:numtide/flake-utils"; + flake-utils.url = "github:numtide/flake-utils"; }; - outputs = { self, nixpkgs, utils, }: utils.lib.eachDefaultSystem (system: let - pkgs = import nixpkgs { inherit system; }; - in { - devShells.default = import ./UI { inherit pkgs; }; - }); + outputs = + { + nixpkgs, + flake-utils, + ... + }: + flake-utils.lib.eachDefaultSystem ( + system: + let + pkgs = nixpkgs.legacyPackages.${system}; + in + { + devShells.default = import ./shell.nix { inherit pkgs; }; + + formatter = pkgs.nixfmt-rfc-style; + } + ); } diff --git a/UI/default.nix b/shell.nix similarity index 71% rename from UI/default.nix rename to shell.nix index bce0045a15f..15370a50dba 100644 --- a/UI/default.nix +++ b/shell.nix @@ -1,15 +1,19 @@ -{ pkgs ? import { } }: +{ + pkgs ? import { }, +}: pkgs.mkShell { - packages = with pkgs; [ - ccache - ] ++ (with qt6Packages; [ + inputsFrom = [ + pkgs.ladybird + ]; + + packages = with pkgs.qt6Packages; [ qtbase.dev qttools qtwayland.dev - ]); - inputsFrom = [ pkgs.ladybird ]; + pkgs.ccache + ]; shellHook = '' # NOTE: This is required to make it find the wayland platform plugin installed