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

Generated
+22 -22
View File
@@ -76,11 +76,11 @@
}, },
"locked": { "locked": {
"dir": "pkgs/firefox-addons", "dir": "pkgs/firefox-addons",
"lastModified": 1787630552, "lastModified": 1787976477,
"narHash": "sha256-w3LGSHkHWKRH5K4A8plRWaFbaSWfdZAIxv32kO2mpOg=", "narHash": "sha256-N4ljMPGSikj3Yl4EZv7xa6KSGkmm+G5wFZBhnOCwqZw=",
"owner": "rycee", "owner": "rycee",
"repo": "nur-expressions", "repo": "nur-expressions",
"rev": "25227969423d7ef599f70e16364ac550a0f713cd", "rev": "2e2c50de599df9787f6aa735ceea0a7aabcfae2a",
"type": "gitlab" "type": "gitlab"
}, },
"original": { "original": {
@@ -187,11 +187,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1788016189, "lastModified": 1788053103,
"narHash": "sha256-O57BYyiEsgdQAluguEWMQtkog5puR2JjUx4+A1br7Q0=", "narHash": "sha256-+H+8us7JvdcVbPQMq2d0RJLpShaptiRjKfcpx9en8g0=",
"ref": "refs/heads/main", "ref": "refs/heads/main",
"rev": "6bb0221b270bf8a54c4efe646e8ec39d74e55f9f", "rev": "ab89bd7fc180b742838a4883acbaf9ff47994695",
"revCount": 4, "revCount": 7,
"type": "git", "type": "git",
"url": "https://git.greyweather.dev/greyweather/nix-helper-flake" "url": "https://git.greyweather.dev/greyweather/nix-helper-flake"
}, },
@@ -207,11 +207,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1787680808, "lastModified": 1787797243,
"narHash": "sha256-9168tNt0NZdtlx5RM5huEuc9NCWMLACJA9O4UK/l2Zc=", "narHash": "sha256-8+Q7NOB7RPajRjA4pbCDLzqH+MTjnG9x6LUPLfL2joA=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "6840c9a8f50722944eb106ce8bb237c138584f2a", "rev": "99c9ec63390f1d8c14d95d9e8b17cc29cfbd4e11",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -242,11 +242,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1787418077, "lastModified": 1787933897,
"narHash": "sha256-xK0xZND1YXdTdtqhQHAWdgj32KIBYci77aNXRKbXDOM=", "narHash": "sha256-nnMvRwXgRUktCsWf2S+9SkVVlff3QEDwUAys49zTuSc=",
"owner": "nix-community", "owner": "nix-community",
"repo": "nh", "repo": "nh",
"rev": "3dada800495f9c016e0f8d3e61419c876557b40e", "rev": "0556d89ba6d63df9d423f3e0df8450d6653a0aae",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -257,11 +257,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1787498568, "lastModified": 1787900134,
"narHash": "sha256-9i/VTdusq/+NM/tz+J1Re+ojkMB8MBf0QshnYfzHz30=", "narHash": "sha256-VYXO0XZlgj06dxJZRhrD3WoSsvq/c7+/Akyoa22pefw=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "56c02bc00adcf003215cc4bd996d6efaf4cff188", "rev": "83199d0d373dd3ac2b9a1996b1d0263f76ab7a4c",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -293,11 +293,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1787661534, "lastModified": 1788050744,
"narHash": "sha256-KMKnvnrst1sEr9GA88HCSR7ffSohZb7ubH+fUatiUBI=", "narHash": "sha256-O+GIRtyRZhn2Cv5NosvsoQzaPBpI2T3AGNqxwcS65Oc=",
"owner": "noctalia-dev", "owner": "noctalia-dev",
"repo": "noctalia", "repo": "noctalia",
"rev": "67addbd529cfd9db30c9d0ee6e08d5f6836c9e1a", "rev": "99296b25b0aa6e293fad10ae77a56e567cd6120c",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -386,11 +386,11 @@
"tinted-zed": "tinted-zed" "tinted-zed": "tinted-zed"
}, },
"locked": { "locked": {
"lastModified": 1787175104, "lastModified": 1787771653,
"narHash": "sha256-tzNjlb0loxeWlipvxSNAUUihloeTZoyGFhEen87yM9k=", "narHash": "sha256-DkkJSBOXWV/mja5Vy8az5g1KpZlsbUwlmH0BsQhowaQ=",
"owner": "nix-community", "owner": "nix-community",
"repo": "stylix", "repo": "stylix",
"rev": "a9e5a76a1b75b137f266e4f445e1eaba82e9783e", "rev": "5e3809851f486e7fc7e84b40f174c74b60ecc784",
"type": "github" "type": "github"
}, },
"original": { "original": {
+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) { config = lib.mkIf (config.features.shells.zsh.enable) {
programs.zsh.enable = true; 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) { home-manager.users.grey = lib.mkIf (config.features.nixos.home-manager.enable) {
features.shells.zsh.enable = lib.mkDefault true; features.shells.zsh.enable = lib.mkDefault true;
+6
View File
@@ -24,6 +24,12 @@
username = "grey"; username = "grey";
homeDirectory = "/home/${config.home.username}"; homeDirectory = "/home/${config.home.username}";
file = inputs.helpers.homeFilesFromStringAttrs {
dir = ".local/bin";
attrs = config.features.applications.shellScripts;
exec = true;
};
}; };
xdg = { xdg = {
+10 -3
View File
@@ -56,9 +56,16 @@
}; };
}; };
features.applications.extraPackages = lib.mkOption { features.applications = {
type = lib.types.listOf (lib.types.package); shellScripts = lib.mkOption {
default = []; 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, ... }: { flake.homeModules.takamaki = { config, pkgs, ... }: {
programs.zsh.shellAliases = { programs.zsh.shellAliases = {
apply-config = "zsh -c 'cd ${config.info.rootPath}; git add .; home-manager switch --flake .#takamaki -b bak'"; 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'"; 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; pkgs = inputs.nixpkgs.legacyPackages.x86_64-linux;
modules = with self.homeModules; [ modules = with self.homeModules; [
takamaki takamaki
inputs.stylix.homeModules.stylix
]; ];
extraSpecialArgs = { inherit inputs; }; extraSpecialArgs = { inherit inputs; };
}; };
@@ -41,17 +42,22 @@
vscode.enable = true; vscode.enable = true;
}; };
extraPackages = with pkgs; [ shellScripts = {
(writeShellScriptBin "switch-os" '' switch-os = ''
sudo efibootmgr --bootnext 0000 sudo efibootmgr --bootnext 0000
sudo reboot sudo reboot
'') '';
(writeShellScriptBin "universal-reboot" ''
universal-reboot = ''
sudo reboot sudo reboot
'') '';
(writeShellScriptBin "universal-shutdown" ''
universal-shutdown = ''
sudo systemctl poweroff sudo systemctl poweroff
'') '';
};
extraPackages = with pkgs; [
(writeShellScriptBin "increase-brightness" '' (writeShellScriptBin "increase-brightness" ''
LOOP_COUNTER=0 LOOP_COUNTER=0
DEVICE=$1 DEVICE=$1