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
+67
-32
No files matched your search
Generated
+22
-22
@@ -76,11 +76,11 @@
|
||||
},
|
||||
"locked": {
|
||||
"dir": "pkgs/firefox-addons",
|
||||
"lastModified": 1787630552,
|
||||
"narHash": "sha256-w3LGSHkHWKRH5K4A8plRWaFbaSWfdZAIxv32kO2mpOg=",
|
||||
"lastModified": 1787976477,
|
||||
"narHash": "sha256-N4ljMPGSikj3Yl4EZv7xa6KSGkmm+G5wFZBhnOCwqZw=",
|
||||
"owner": "rycee",
|
||||
"repo": "nur-expressions",
|
||||
"rev": "25227969423d7ef599f70e16364ac550a0f713cd",
|
||||
"rev": "2e2c50de599df9787f6aa735ceea0a7aabcfae2a",
|
||||
"type": "gitlab"
|
||||
},
|
||||
"original": {
|
||||
@@ -187,11 +187,11 @@
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1788016189,
|
||||
"narHash": "sha256-O57BYyiEsgdQAluguEWMQtkog5puR2JjUx4+A1br7Q0=",
|
||||
"lastModified": 1788053103,
|
||||
"narHash": "sha256-+H+8us7JvdcVbPQMq2d0RJLpShaptiRjKfcpx9en8g0=",
|
||||
"ref": "refs/heads/main",
|
||||
"rev": "6bb0221b270bf8a54c4efe646e8ec39d74e55f9f",
|
||||
"revCount": 4,
|
||||
"rev": "ab89bd7fc180b742838a4883acbaf9ff47994695",
|
||||
"revCount": 7,
|
||||
"type": "git",
|
||||
"url": "https://git.greyweather.dev/greyweather/nix-helper-flake"
|
||||
},
|
||||
@@ -207,11 +207,11 @@
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1787680808,
|
||||
"narHash": "sha256-9168tNt0NZdtlx5RM5huEuc9NCWMLACJA9O4UK/l2Zc=",
|
||||
"lastModified": 1787797243,
|
||||
"narHash": "sha256-8+Q7NOB7RPajRjA4pbCDLzqH+MTjnG9x6LUPLfL2joA=",
|
||||
"owner": "nix-community",
|
||||
"repo": "home-manager",
|
||||
"rev": "6840c9a8f50722944eb106ce8bb237c138584f2a",
|
||||
"rev": "99c9ec63390f1d8c14d95d9e8b17cc29cfbd4e11",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -242,11 +242,11 @@
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1787418077,
|
||||
"narHash": "sha256-xK0xZND1YXdTdtqhQHAWdgj32KIBYci77aNXRKbXDOM=",
|
||||
"lastModified": 1787933897,
|
||||
"narHash": "sha256-nnMvRwXgRUktCsWf2S+9SkVVlff3QEDwUAys49zTuSc=",
|
||||
"owner": "nix-community",
|
||||
"repo": "nh",
|
||||
"rev": "3dada800495f9c016e0f8d3e61419c876557b40e",
|
||||
"rev": "0556d89ba6d63df9d423f3e0df8450d6653a0aae",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -257,11 +257,11 @@
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1787498568,
|
||||
"narHash": "sha256-9i/VTdusq/+NM/tz+J1Re+ojkMB8MBf0QshnYfzHz30=",
|
||||
"lastModified": 1787900134,
|
||||
"narHash": "sha256-VYXO0XZlgj06dxJZRhrD3WoSsvq/c7+/Akyoa22pefw=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "56c02bc00adcf003215cc4bd996d6efaf4cff188",
|
||||
"rev": "83199d0d373dd3ac2b9a1996b1d0263f76ab7a4c",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -293,11 +293,11 @@
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1787661534,
|
||||
"narHash": "sha256-KMKnvnrst1sEr9GA88HCSR7ffSohZb7ubH+fUatiUBI=",
|
||||
"lastModified": 1788050744,
|
||||
"narHash": "sha256-O+GIRtyRZhn2Cv5NosvsoQzaPBpI2T3AGNqxwcS65Oc=",
|
||||
"owner": "noctalia-dev",
|
||||
"repo": "noctalia",
|
||||
"rev": "67addbd529cfd9db30c9d0ee6e08d5f6836c9e1a",
|
||||
"rev": "99296b25b0aa6e293fad10ae77a56e567cd6120c",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -386,11 +386,11 @@
|
||||
"tinted-zed": "tinted-zed"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1787175104,
|
||||
"narHash": "sha256-tzNjlb0loxeWlipvxSNAUUihloeTZoyGFhEen87yM9k=",
|
||||
"lastModified": 1787771653,
|
||||
"narHash": "sha256-DkkJSBOXWV/mja5Vy8az5g1KpZlsbUwlmH0BsQhowaQ=",
|
||||
"owner": "nix-community",
|
||||
"repo": "stylix",
|
||||
"rev": "a9e5a76a1b75b137f266e4f445e1eaba82e9783e",
|
||||
"rev": "5e3809851f486e7fc7e84b40f174c74b60ecc784",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
||||
@@ -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,10 +56,17 @@
|
||||
};
|
||||
};
|
||||
|
||||
features.applications.extraPackages = lib.mkOption {
|
||||
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