Add NixOS module and improve UI navigation and rendering
The flake now includes a NixOS module that enables integration with system configuration. The TUI has been enhanced with better file switching using arrow keys, space bar support for toggling values, improved scrolling logic, styled category headings, and visual selection feedback. Documentation comments were streamlined and placeholder files removed.
This commit is contained in:
50
flake.nix
50
flake.nix
@@ -23,7 +23,11 @@
|
||||
nixpkgs,
|
||||
naersk,
|
||||
fenix,
|
||||
lib,
|
||||
cfg,
|
||||
}: let
|
||||
inherit (lib) mkOption mkIf types;
|
||||
|
||||
system = "x86_64-linux";
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
|
||||
@@ -32,10 +36,6 @@
|
||||
cargo = rustToolchain;
|
||||
rustc = rustToolchain;
|
||||
};
|
||||
|
||||
cargoToml = builtins.fromTOML (builtins.readFile ./Cargo.toml);
|
||||
packageVersion = cargoToml.package.version;
|
||||
# ...
|
||||
in {
|
||||
packages.${system} = {
|
||||
default =
|
||||
@@ -44,11 +44,49 @@
|
||||
develop = naerskLib.buildPackage {
|
||||
name = "garandos-tui";
|
||||
src = ./.;
|
||||
# buildInputs = with pkgs; [];
|
||||
nativeBuildInputs = with pkgs; [pkg-config];
|
||||
};
|
||||
};
|
||||
|
||||
nixosModules.garandos-tui = {
|
||||
options.programs.garandos-tui = {
|
||||
enable = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = "Enable the Garandos TUI module";
|
||||
};
|
||||
package = mkOption {
|
||||
type = types.package;
|
||||
default = self.packages.${system}.default;
|
||||
defaultText = "self.packages.${system}.default";
|
||||
description = "The Garandos TUI package";
|
||||
};
|
||||
systemModulesFilePath = mkOption {
|
||||
type = types.path;
|
||||
default = "";
|
||||
example = "/home/\${username}/garandos/hosts/\${hostname}/system-modules.nix";
|
||||
description = "The path to the Host's system modules file";
|
||||
};
|
||||
homeModulesFilePath = mkOption {
|
||||
type = types.path;
|
||||
default = "";
|
||||
example = "/home/\${username}/garandos/hosts/\${hostname}/home-modules.nix";
|
||||
description = "The path to the Host's home modules file";
|
||||
};
|
||||
};
|
||||
config = mkIf (cfg.enable && cfg.systemModulesFilePath != "" && cfg.homeModulesFilePath != "") {
|
||||
environment.systemPackages = [
|
||||
(pkgs.writeScriptBin "garandos-tui" ''
|
||||
#!${pkgs.runtimeShell}
|
||||
exec ${cfg.package}/bin/garandos_tui \
|
||||
--sf '${cfg.systemModulesFilePath}' \
|
||||
--hf '${cfg.homeModulesFilePath}' \
|
||||
"$@"
|
||||
'')
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
devShells.${system}.default = pkgs.mkShell {
|
||||
env.RUST_SRC_PATH = "${pkgs.rust.packages.stable.rustPlatform.rustLibSrc}";
|
||||
buildInputs = [
|
||||
@@ -57,8 +95,6 @@
|
||||
nativeBuildInputs = with pkgs; [pkg-config];
|
||||
|
||||
shellHook = ''
|
||||
echo "garandos-tui v${packageVersion}"
|
||||
echo ""
|
||||
echo "Commands:"
|
||||
echo " nix build - Build production version"
|
||||
echo " nix run - Run production version"
|
||||
|
||||
Reference in New Issue
Block a user