refactor(module): move shell configuration to common modules

This commit is contained in:
Jo 2024-09-07 02:13:24 +02:00
parent 11b1410d2c
commit 70347dd40b
4 changed files with 37 additions and 7 deletions

View file

@ -32,6 +32,7 @@ in {
networking.enable = true; # Networkmanager configuration
kernel.enable = true; # Kernel modifications
bluetooth.enable = true; # Bluetooth support
shell.enable = true; # Shell environment configuration
};
desktop.gnome.enable = true;

View file

@ -19,7 +19,7 @@ in {
options.${namespace}.common.kernel = {
enable = mkEnableOption "Modify the standard kernel settings";
version = mkOption {
type = lib.types.str;
type = types.str;
default = "linuxPackages_latest";
example = "linuxPackages_latest";
description = "Set the kernel version to be used by your system";

View file

@ -0,0 +1,34 @@
{
lib,
pkgs,
inputs,
namespace, # The flake namespace, set in flake.nix. If not set, defaults to "internal".
system, # The system architecture for this host (eg. `x86_64-linux`).
target, # The Snowfall Lib target for this system (eg. `x86_64-iso`).
format, # A normalized name for the system target (eg. `iso`).
virtual, # A boolean to determine whether this system is a virtual target using nixos-generators.
systems, # An attribute map of your defined hosts.
config,
...
}: with lib; with lib.${namespace};
let
cfg = config.${namespace}.common.shell;
in {
options.${namespace}.common.shell = {
enable = mkEnableOption "Modify the standard shell options";
package = mkOption {
type = types.str;
default = "fish";
example = "fish";
description = "Select an appropriate shell environment (bash, fish, zsh...)";
};
};
config = mkIf cfg.enable {
environment.shells = with pkgs; [ ${cfg.package} ];
users.defaultUserShell = pkgs.${cfg.package};
programs.${cfg.package}.enable = true;
};
}

View file

@ -98,11 +98,6 @@ with lib.${namespace};
# Enable support for flipper zero devices
hardware.flipperzero.enable = true;
# Configure system-wide default shell.
environment.shells = with pkgs; [ fish ];
users.defaultUserShell = pkgs.fish;
programs.fish.enable = true;
# Configure users.
snowfallorg.users.jo.admin = true;
@ -111,7 +106,7 @@ with lib.${namespace};
# Configure home-manager
home-manager = {
backupFileExtension = "homeManagerBackupFile69";
backupFileExtension = "homeManagerBackupFile";
};
# Provide users with some sane default packages.