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.
This commit is contained in:
Jess 2024-12-15 03:53:07 +13:00 committed by Sam Atkins
parent 6969d1eba3
commit 61fcccb104
Notes: github-actions[bot] 2024-12-18 15:16:44 +00:00
4 changed files with 50 additions and 34 deletions

View file

@ -114,10 +114,10 @@ nix develop
nix develop --command bash nix develop --command bash
# Using nix-shell # Using nix-shell
nix-shell UI nix-shell
# Using nix-shell and a custom shell # Using nix-shell and a custom shell
nix-shell UI --command bash nix-shell --command bash
``` ```
Then invoke `cmake` directly. For example: Then invoke `cmake` directly. For example:

View file

@ -1,5 +1,23 @@
{ {
"nodes": { "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": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1731676054, "lastModified": 1731676054,
@ -18,8 +36,8 @@
}, },
"root": { "root": {
"inputs": { "inputs": {
"nixpkgs": "nixpkgs", "flake-utils": "flake-utils",
"utils": "utils" "nixpkgs": "nixpkgs"
} }
}, },
"systems": { "systems": {
@ -36,24 +54,6 @@
"repo": "default", "repo": "default",
"type": "github" "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", "root": "root",

View file

@ -3,12 +3,24 @@
inputs = { inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; 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 outputs =
pkgs = import nixpkgs { inherit system; }; {
in { nixpkgs,
devShells.default = import ./UI { inherit pkgs; }; 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;
}
);
} }

View file

@ -1,15 +1,19 @@
{ pkgs ? import <nixpkgs> { } }: {
pkgs ? import <nixpkgs> { },
}:
pkgs.mkShell { pkgs.mkShell {
packages = with pkgs; [ inputsFrom = [
ccache pkgs.ladybird
] ++ (with qt6Packages; [ ];
packages = with pkgs.qt6Packages; [
qtbase.dev qtbase.dev
qttools qttools
qtwayland.dev qtwayland.dev
]);
inputsFrom = [ pkgs.ladybird ]; pkgs.ccache
];
shellHook = '' shellHook = ''
# NOTE: This is required to make it find the wayland platform plugin installed # NOTE: This is required to make it find the wayland platform plugin installed