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:
7 files changed
+69
-34
No files matched your search
@@ -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};
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
@@ -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 = {
|
||||
|
||||
@@ -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 = [];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
@@ -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'";
|
||||
};
|
||||
};
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in new issue
Block a user