add features.applications.shellScripts option

uses a custom function from my helper flake to convert a basic attrset of strings into a format `home.file` will accept
This commit is contained in:
greyweather committed 2026-08-30 02:54:08 +01:00
1 parent 06e958ae71
commit 023fc0c424
7 files changed
+69 -34

No files matched your search

+17
View File
@@ -0,0 +1,17 @@
{ inputs, self, ... }: {
flake.nixosModules.global = { config, pkgs, lib, ... }: {
options.features.shells.defaultShell = lib.mkOption {
type = lib.types.enum (map (name: lib.removeSuffix ".nix" name) (
builtins.attrNames (builtins.readDir "${self}/modules/features/shells")
));
default = "zsh";
};
config = {
programs.${config.features.shells.defaultShell}.enable = true;
users.defaultUserShell = pkgs.${config.features.shells.defaultShell};
users.users."grey".shell = pkgs.${config.features.shells.defaultShell};
};
};
}
-2
View File
@@ -7,8 +7,6 @@
config = lib.mkIf (config.features.shells.zsh.enable) {
programs.zsh.enable = true;
users.defaultUserShell = pkgs.zsh;
users.users."grey".shell = pkgs.zsh;
home-manager.users.grey = lib.mkIf (config.features.nixos.home-manager.enable) {
features.shells.zsh.enable = lib.mkDefault true;
+6
View File
@@ -24,6 +24,12 @@
username = "grey";
homeDirectory = "/home/${config.home.username}";
file = inputs.helpers.homeFilesFromStringAttrs {
dir = ".local/bin";
attrs = config.features.applications.shellScripts;
exec = true;
};
};
xdg = {
+10 -3
View File
@@ -56,9 +56,16 @@
};
};
features.applications.extraPackages = lib.mkOption {
type = lib.types.listOf (lib.types.package);
default = [];
features.applications = {
shellScripts = lib.mkOption {
type = lib.types.attrsOf (lib.types.str);
default = [];
};
extraPackages = lib.mkOption {
type = lib.types.listOf (lib.types.package);
default = [];
};
};
};
};
+1
View File
@@ -2,6 +2,7 @@
flake.homeModules.takamaki = { config, pkgs, ... }: {
programs.zsh.shellAliases = {
apply-config = "zsh -c 'cd ${config.info.rootPath}; git add .; home-manager switch --flake .#takamaki -b bak'";
apply-config-trace = "zsh -c 'cd ${config.info.rootPath}; git add .; home-manager switch --flake .#takamaki -b bak --show-trace'";
update-config = "zsh -c 'cd ${config.info.rootPath}; git add .; nix flake update; home-manager switch --flake .#takamaki -b bak'";
};
};
+13 -7
View File
@@ -3,6 +3,7 @@
pkgs = inputs.nixpkgs.legacyPackages.x86_64-linux;
modules = with self.homeModules; [
takamaki
inputs.stylix.homeModules.stylix
];
extraSpecialArgs = { inherit inputs; };
};
@@ -41,17 +42,22 @@
vscode.enable = true;
};
extraPackages = with pkgs; [
(writeShellScriptBin "switch-os" ''
shellScripts = {
switch-os = ''
sudo efibootmgr --bootnext 0000
sudo reboot
'')
(writeShellScriptBin "universal-reboot" ''
'';
universal-reboot = ''
sudo reboot
'')
(writeShellScriptBin "universal-shutdown" ''
'';
universal-shutdown = ''
sudo systemctl poweroff
'')
'';
};
extraPackages = with pkgs; [
(writeShellScriptBin "increase-brightness" ''
LOOP_COUNTER=0
DEVICE=$1