add new external flake to provide helper functions
This commit is contained in:
18 files changed
+73
-163
No files matched your search
Generated
+21
@@ -180,6 +180,26 @@
|
||||
"type": "gitlab"
|
||||
}
|
||||
},
|
||||
"helpers": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1788016189,
|
||||
"narHash": "sha256-O57BYyiEsgdQAluguEWMQtkog5puR2JjUx4+A1br7Q0=",
|
||||
"ref": "refs/heads/main",
|
||||
"rev": "6bb0221b270bf8a54c4efe646e8ec39d74e55f9f",
|
||||
"revCount": 4,
|
||||
"type": "git",
|
||||
"url": "https://git.greyweather.dev/greyweather/nix-helper-flake"
|
||||
},
|
||||
"original": {
|
||||
"type": "git",
|
||||
"url": "https://git.greyweather.dev/greyweather/nix-helper-flake"
|
||||
}
|
||||
},
|
||||
"home-manager": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
@@ -315,6 +335,7 @@
|
||||
"inputs": {
|
||||
"firefox-addons": "firefox-addons",
|
||||
"flake-parts": "flake-parts",
|
||||
"helpers": "helpers",
|
||||
"home-manager": "home-manager",
|
||||
"import-tree": "import-tree",
|
||||
"nh": "nh",
|
||||
|
||||
@@ -8,6 +8,11 @@
|
||||
|
||||
import-tree.url = "github:vic/import-tree";
|
||||
|
||||
helpers = {
|
||||
url = "git+https://git.greyweather.dev/greyweather/nix-helper-flake";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
#nixpkgs-mesa-overlay.url = "github:nixos/nixpkgs/e4f9df8a27c2b4871c665368e65bdb6852dd93e6";
|
||||
|
||||
home-manager = {
|
||||
|
||||
@@ -9,14 +9,14 @@
|
||||
|
||||
home-manager.users.grey = lib.mkIf (config.features.nixos.home-manager.enable) ({ lib, config, ... }: {
|
||||
home.activation = {
|
||||
symlinkNoctaliaState = lib.hm.dag.entryAfter ["writeBoundary"] (config.helpers.mkSymlinkActivationScript {
|
||||
target = ".local/state/noctalia/settings.toml";
|
||||
source = "dotfiles/${config.info.hostName}/noctalia/settings.toml";
|
||||
symlinkNoctaliaState = lib.hm.dag.entryAfter ["writeBoundary"] (inputs.helpers.mkSymlinkActivationScript {
|
||||
target = "${config.users.grey.homeDir}/.local/state/noctalia/settings.toml";
|
||||
source = "${config.info.rootPath}/dotfiles/${config.info.hostName}/noctalia/settings.toml";
|
||||
});
|
||||
|
||||
symlinkNoctaliaStatePlugins = lib.hm.dag.entryAfter ["writeBoundary"] (config.helpers.mkSymlinkActivationScript {
|
||||
target = ".local/state/noctalia/plugins";
|
||||
source = "dotfiles/${config.info.hostName}/noctalia/plugins";
|
||||
symlinkNoctaliaStatePlugins = lib.hm.dag.entryAfter ["writeBoundary"] (inputs.helpers.mkSymlinkActivationScript {
|
||||
target = "${config.users.grey.homeDir}/.local/state/noctalia/plugins";
|
||||
source = "${config.info.rootPath}/dotfiles/${config.info.hostName}/noctalia/plugins";
|
||||
isDir = true;
|
||||
});
|
||||
};
|
||||
|
||||
@@ -38,9 +38,9 @@
|
||||
};
|
||||
|
||||
home-manager.users.grey = lib.mkIf (config.features.nixos.home-manager.enable) ({ lib, config, ... }: {
|
||||
home.activation.symlinkNiriConfig = lib.hm.dag.entryAfter ["writeBoundary"] (config.helpers.mkSymlinkActivationScript {
|
||||
target = ".config/niri/config.kdl";
|
||||
source = "dotfiles/${config.info.hostName}/niri.kdl";
|
||||
home.activation.symlinkNiriConfig = lib.hm.dag.entryAfter ["writeBoundary"] (inputs.helpers.mkSymlinkActivationScript {
|
||||
target = "${config.users.grey.homeDir}/.config/niri/config.kdl";
|
||||
source = "${config.info.rootPath}/dotfiles/${config.info.hostName}/niri.kdl";
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
@@ -2,13 +2,7 @@
|
||||
flake.nixosModules.global = { pkgs, lib, config, ... }: {
|
||||
options.features.applications.cli.fastfetch.enable = lib.mkEnableOption "fastfetch";
|
||||
|
||||
config = let
|
||||
mkIfElse = with lib; p: yes: no:
|
||||
mkMerge [
|
||||
(mkIf p yes)
|
||||
(mkIf (!p) no)
|
||||
];
|
||||
in lib.mkIf (config.features.applications.cli.fastfetch.enable) (mkIfElse (config.features.nixos.home-manager.enable) {
|
||||
config = lib.mkIf (config.features.applications.cli.fastfetch.enable) (inputs.helpers.mkIfElse (config.features.nixos.home-manager.enable) {
|
||||
home-manager.users.grey.features.applications.cli.fastfetch.enable = lib.mkDefault true;
|
||||
} {
|
||||
environment.systemPackages = [ pkgs.fastfetch ];
|
||||
|
||||
@@ -2,12 +2,7 @@
|
||||
flake.nixosModules.graphics = { pkgs, lib, config, ...}: {
|
||||
options.features.applications.gui.equibop.enable = lib.mkEnableOption "equibop";
|
||||
|
||||
config = let
|
||||
mkIfElse = with lib; p: yes: no: mkMerge [
|
||||
(mkIf p yes)
|
||||
(mkIf (!p) no)
|
||||
];
|
||||
in lib.mkIf (config.features.applications.gui.equibop.enable) (mkIfElse (config.features.nixos.home-manager.enable) {
|
||||
config = lib.mkIf (config.features.applications.gui.equibop.enable) (inputs.helpers.mkIfElse (config.features.nixos.home-manager.enable) {
|
||||
home-manager.users.grey.features.applications.gui.equibop.enable = lib.mkDefault true;
|
||||
} {
|
||||
environment.systemPackages = [ pkgs.equibop ];
|
||||
@@ -21,19 +16,19 @@
|
||||
programs.equibop.enable = true;
|
||||
|
||||
home.activation = {
|
||||
linkEquibopConfigSettings = lib.hm.dag.entryAfter ["writeBoundary"] (config.helpers.mkSymlinkActivationScript {
|
||||
target = ".config/equibop/settings.json";
|
||||
source = "dotfiles/${config.info.hostName}/equibop/settings.json";
|
||||
linkEquibopConfigSettings = lib.hm.dag.entryAfter ["writeBoundary"] (inputs.helpers.mkSymlinkActivationScript {
|
||||
target = "${config.home.homeDirectory}/.config/equibop/settings.json";
|
||||
source = "${config.info.rootPath}/dotfiles/${config.info.hostName}/equibop/settings.json";
|
||||
});
|
||||
|
||||
linkEquibopConfigEquicordSettings = lib.hm.dag.entryAfter ["writeBoundary"] (config.helpers.mkSymlinkActivationScript {
|
||||
target = ".config/equibop/settings/settings.json";
|
||||
source = "dotfiles/${config.info.hostName}/equibop/equicord-settings.json";
|
||||
linkEquibopConfigEquicordSettings = lib.hm.dag.entryAfter ["writeBoundary"] (inputs.helpers.mkSymlinkActivationScript {
|
||||
target = "${config.home.homeDirectory}/.config/equibop/settings/settings.json";
|
||||
source = "${config.info.rootPath}/dotfiles/${config.info.hostName}/equibop/equicord-settings.json";
|
||||
});
|
||||
|
||||
linkEquibopConfigQuickCss = lib.hm.dag.entryAfter ["writeBoundary"] (config.helpers.mkSymlinkActivationScript {
|
||||
target = ".config/equibop/settings/quickCss.css";
|
||||
source = "dotfiles/${config.info.hostName}/equibop/quickCss.css";
|
||||
linkEquibopConfigQuickCss = lib.hm.dag.entryAfter ["writeBoundary"] (inputs.helpers.mkSymlinkActivationScript {
|
||||
target = "${config.home.homeDirectory}/.config/equibop/settings/quickCss.css";
|
||||
source = "${config.info.rootPath}/dotfiles/${config.info.hostName}/equibop/quickCss.css";
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
@@ -2,12 +2,7 @@
|
||||
flake.nixosModules.graphics = { pkgs, lib, config, ... }: {
|
||||
options.features.applications.gui.floorp.enable = lib.mkEnableOption "floorp";
|
||||
|
||||
config = let
|
||||
mkIfElse = with lib; p: yes: no: mkMerge [
|
||||
(mkIf p yes)
|
||||
(mkIf (!p) no)
|
||||
];
|
||||
in lib.mkIf (config.features.applications.gui.floorp.enable) (mkIfElse (config.features.nixos.home-manager.enable) {
|
||||
config = lib.mkIf (config.features.applications.gui.floorp.enable) (inputs.helpers.mkIfElse (config.features.nixos.home-manager.enable) {
|
||||
home-manager.users.grey.features.applications.gui.floorp.enable = lib.mkDefault true;
|
||||
} {
|
||||
environment.systemPackages = [ pkgs.floorp-bin ];
|
||||
|
||||
@@ -63,11 +63,6 @@
|
||||
platforms = [ "x86_64-linux" ];
|
||||
};
|
||||
};
|
||||
mkIfElse = with lib; p: yes: no:
|
||||
mkMerge [
|
||||
(mkIf p yes)
|
||||
(mkIf (!p) no)
|
||||
];
|
||||
in {
|
||||
flake.nixosModules.graphics = { pkgs, config, lib, ... }: {
|
||||
options.features.applications.gui = {
|
||||
@@ -75,13 +70,13 @@ in {
|
||||
fluxer-canary.enable = lib.mkEnableOption "fluxer-canary";
|
||||
};
|
||||
|
||||
config = lib.mkIf (config.features.applications.gui.fluxer.enable) (mkIfElse (config.features.nixos.home-manager.enable) {
|
||||
config = lib.mkIf (config.features.applications.gui.fluxer.enable) (inputs.helpers.mkIfElse (config.features.nixos.home-manager.enable) {
|
||||
home-manager.users.grey.features.applications.gui.fluxer.enable = lib.mkDefault true;
|
||||
} {
|
||||
environment.systemPackages = [
|
||||
(pkgs.callPackage (fluxer-package) {})
|
||||
];
|
||||
}) // lib.mkIf (config.features.applications.gui.fluxer-canary.enable) (mkIfElse (config.features.nixos.home-manager.enable) {
|
||||
}) // lib.mkIf (config.features.applications.gui.fluxer-canary.enable) (inputs.helpers.mkIfElse (config.features.nixos.home-manager.enable) {
|
||||
home-manager.users.grey.features.applications.gui.fluxer-canary.enable = lib.mkDefault true;
|
||||
} {
|
||||
environment.systemPackages = [
|
||||
|
||||
@@ -3,11 +3,7 @@
|
||||
options.features.applications.gui.kitty.enable = lib.mkEnableOption "kitty";
|
||||
|
||||
config = let
|
||||
mkIfElse = with lib; p: yes: no: mkMerge [
|
||||
(mkIf p yes)
|
||||
(mkIf (!p) no)
|
||||
];
|
||||
in lib.mkIf (config.features.applications.gui.kitty.enable) (mkIfElse (config.features.nixos.home-manager.enable) {
|
||||
in lib.mkIf (config.features.applications.gui.kitty.enable) (inputs.helpers.mkIfElse (config.features.nixos.home-manager.enable) {
|
||||
home-manager.users.grey.features.applications.gui.kitty.enable = lib.mkDefault true;
|
||||
} {
|
||||
environment.systemPackages = [ pkgs.kitty ];
|
||||
|
||||
@@ -2,13 +2,7 @@
|
||||
flake.nixosModules.graphics = { pkgs, config, lib, ... }: {
|
||||
options.features.applications.gui.remmina.enable = lib.mkEnableOption "remmina";
|
||||
|
||||
config = let
|
||||
mkIfElse = with lib; p: yes: no:
|
||||
mkMerge [
|
||||
(mkIf p yes)
|
||||
(mkIf (!p) no)
|
||||
];
|
||||
in lib.mkIf (config.features.applications.gui.remmina.enable) (mkIfElse (config.features.nixos.home-manager.enable) {
|
||||
config = lib.mkIf (config.features.applications.gui.remmina.enable) (inputs.helpers.mkIfElse (config.features.nixos.home-manager.enable) {
|
||||
home-manager.users.grey.features.applications.gui.remmina.enable = lib.mkDefault true;
|
||||
} {
|
||||
environment.systemPackages = with pkgs; [
|
||||
@@ -27,9 +21,9 @@
|
||||
freerdp
|
||||
];
|
||||
|
||||
home.activation.linkRemminaPresets = lib.hm.dag.entryAfter ["writeBoundary"] (config.helpers.mkSymlinkActivationScript {
|
||||
target = ".local/share/remmina";
|
||||
source = "dotfiles/${config.info.hostName}/remmina";
|
||||
home.activation.linkRemminaPresets = lib.hm.dag.entryAfter ["writeBoundary"] (inputs.helpers.mkSymlinkActivationScript {
|
||||
target = "${config.home.homeDirectory}/.local/share/remmina";
|
||||
source = "${config.info.rootPath}/dotfiles/${config.info.hostName}/remmina";
|
||||
isDir = true;
|
||||
});
|
||||
};
|
||||
|
||||
@@ -5,13 +5,7 @@
|
||||
spicetify.enable = lib.mkEnableOption "spicetify";
|
||||
};
|
||||
|
||||
config = let
|
||||
mkIfElse = with lib; p: yes: no:
|
||||
mkMerge [
|
||||
(mkIf p yes)
|
||||
(mkIf (!p) no)
|
||||
];
|
||||
in lib.mkIf (config.features.applications.gui.spotify.enable) (mkIfElse (config.features.nixos.home-manager.enable) {
|
||||
config = lib.mkIf (config.features.applications.gui.spotify.enable) (inputs.helpers.mkIfElse (config.features.nixos.home-manager.enable) {
|
||||
home-manager.users.grey.features.applications.gui.spotify = {
|
||||
enable = lib.mkDefault true;
|
||||
spicetify.enable = lib.mkDefault config.features.applications.gui.spotify.spicetify.enable;
|
||||
|
||||
@@ -2,12 +2,7 @@
|
||||
flake.nixosModules.graphics = { config, pkgs, lib, ... }: {
|
||||
options.features.applications.gui.vscode.enable = lib.mkEnableOption "vscode";
|
||||
|
||||
config = let
|
||||
mkIfElse = with lib; p: yes: no: mkMerge [
|
||||
(mkIf p yes)
|
||||
(mkIf (!p) no)
|
||||
];
|
||||
in lib.mkIf (config.features.applications.gui.vscode.enable) (mkIfElse (config.features.nixos.home-manager.enable) {
|
||||
config = lib.mkIf (config.features.applications.gui.vscode.enable) (inputs.helpers.mkIfElse (config.features.nixos.home-manager.enable) {
|
||||
home-manager.users.grey.features.applications.gui.vscode.enable = lib.mkDefault true;
|
||||
} {
|
||||
environment.systemPackages = [ pkgs.vscode ];
|
||||
@@ -21,14 +16,14 @@
|
||||
home.packages = [ pkgs.vscode ];
|
||||
|
||||
home.activation = {
|
||||
linkVsCodeConfigSettings = lib.hm.dag.entryAfter ["writeBoundary"] (config.helpers.mkSymlinkActivationScript {
|
||||
target = ".config/Code/User/settings.json";
|
||||
source = "dotfiles/global/vscode/settings.json";
|
||||
linkVsCodeConfigSettings = lib.hm.dag.entryAfter ["writeBoundary"] (inputs.helpers.mkSymlinkActivationScript {
|
||||
target = "${config.home.homeDirectory}/.config/Code/User/settings.json";
|
||||
source = "${config.info.rootPath}/dotfiles/global/vscode/settings.json";
|
||||
});
|
||||
|
||||
linkVsCodeConfigKeybindings = lib.hm.dag.entryAfter ["writeBoundary"] (config.helpers.mkSymlinkActivationScript {
|
||||
target = ".config/Code/User/keybindings.json";
|
||||
source = "dotfiles/global/vscode/keybindings.json";
|
||||
linkVsCodeConfigKeybindings = lib.hm.dag.entryAfter ["writeBoundary"] (inputs.helpers.mkSymlinkActivationScript {
|
||||
target = "${config.home.homeDirectory}/.config/Code/User/keybindings.json";
|
||||
source = "${config.info.rootPath}/dotfiles/global/vscode/keybindings.json";
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
@@ -6,12 +6,7 @@
|
||||
|
||||
options.features.nixos.stylix.enable = lib.mkEnableOption "stylix";
|
||||
|
||||
config = let
|
||||
mkIfElse = with lib; p: yes: no: mkMerge [
|
||||
(mkIf p yes)
|
||||
(mkIf (!p) no)
|
||||
];
|
||||
in lib.mkIf (config.features.nixos.stylix.enable) {
|
||||
config = lib.mkIf (config.features.nixos.stylix.enable) {
|
||||
stylix.enable = true;
|
||||
stylix.image = builtins.path { path = "${self}/modules/hosts/${config.info.hostName}/wallpaper.jpg"; };
|
||||
stylix.polarity = "dark";
|
||||
|
||||
@@ -1,69 +0,0 @@
|
||||
{ inputs, self, ... }: {
|
||||
flake.nixosModules.global = { pkgs, config, lib, ... }: {
|
||||
options.helpers = {
|
||||
typeOf = lib.mkOption {
|
||||
type = lib.types.functionTo lib.types.str;
|
||||
default = value: (
|
||||
if builtins.isAttrs value then "attrs" else (
|
||||
if builtins.isBool value then "bool" else (
|
||||
if builtins.isFloat value then "float" else (
|
||||
if builtins.isFunction value then "function" else (
|
||||
if builtins.isInt value then "int" else (
|
||||
if builtins.isList value then "list" else (
|
||||
if builtins.isPath value then "path" else (
|
||||
if builtins.isString value then "str" else ""
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
readOnly = true;
|
||||
};
|
||||
|
||||
attrByStrPath = lib.mkOption {
|
||||
default = strPath: set:
|
||||
lib.attrsets.attrByPath (lib.strings.splitString "." strPath) null set;
|
||||
readOnly = true;
|
||||
};
|
||||
|
||||
homeManagerInheritEnableOptionElse = lib.mkOption {
|
||||
# type = lib.types.functionTo lib.types.attrs;
|
||||
default = optionName: systemAttrs: let
|
||||
mkIfElse = with lib; p: yes: no: mkMerge [
|
||||
(mkIf p yes)
|
||||
(mkIf (!p) no)
|
||||
];
|
||||
|
||||
attrByStrPath = strPath: set:
|
||||
lib.attrsets.attrByPath (lib.strings.splitString "." strPath) null set;
|
||||
|
||||
setAttrByStrPath = strPath: value:
|
||||
lib.attrsets.setAttrByPath (lib.strings.splitString "." strPath) value;
|
||||
in builtins.trace "hi" lib.mkIf (attrByStrPath optionName config) (mkIfElse (config.features.nixos.home-manager.enable) {
|
||||
home-manager.sharedModules = [
|
||||
({ lib, ... }: (setAttrByStrPath optionName (lib.mkDefault true)))
|
||||
];
|
||||
} (systemAttrs));
|
||||
readOnly = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
flake.homeModules.global = { pkgs, config, lib, ... }: {
|
||||
options.helpers = {
|
||||
mkSymlinkActivationScript = lib.mkOption {
|
||||
type = lib.types.functionTo lib.types.str;
|
||||
default = {target, source, isDir ? false}: ''
|
||||
if [ ${if isDir then "-d" else "-f"} /home/grey/${target} ]; then
|
||||
rm${if isDir then " -rf" else ""} /home/grey/${target}
|
||||
fi
|
||||
ln -s ${config.info.rootPath}/${source} /home/grey/${target}
|
||||
'';
|
||||
readOnly = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -83,8 +83,12 @@
|
||||
};
|
||||
|
||||
home-manager.users.grey = lib.mkIf (config.features.nixos.home-manager.enable) {
|
||||
info.isStandalone = lib.mkDefault false;
|
||||
# home.stateVersion = lib.mkDefault config.info.stateVersion;
|
||||
info = {
|
||||
rootPath = lib.mkDefault config.info.rootPath;
|
||||
hostName = lib.mkDefault config.info.hostName;
|
||||
stateVersion = lib.mkDefault config.info.stateVersion;
|
||||
isStandalone = lib.mkDefault false;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -96,11 +96,6 @@
|
||||
graphics
|
||||
];
|
||||
|
||||
info = {
|
||||
hostName = "kitagawa";
|
||||
stateVersion = "26.05";
|
||||
};
|
||||
|
||||
features = {
|
||||
applications = {
|
||||
extraPackages = with pkgs; [
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
{ inputs, self, ... }: {
|
||||
flake.homeModules.takamaki = { config, pkgs, ... }: {
|
||||
programs.zsh.shellAliases = {
|
||||
apply-config = "zsh -c 'cd /home/grey/flake; 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'";
|
||||
update-config = "zsh -c 'cd ${config.info.rootPath}; git add .; nix flake update; home-manager switch --flake .#takamaki -b bak'";
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -60,7 +60,7 @@
|
||||
WRITTEN=$(echo $RESULT | grep -oP "Writing.+\(\K\d{1,3}\)" | sed 's/)//')
|
||||
CONTROL=$(echo $RESULT | grep -oP "Control.+\+/\K\d{1,3}/100" | sed 's/\/100//')
|
||||
LOOP_COUNTER=$(($LOOP_COUNTER + 1))
|
||||
[[ "$WRITTEN" != "$CONTROL" ]] && [ $LOOP_COUNTER -lt 10 ]
|
||||
[[ "$WRITTEN" != "$CONTROL" ]] && [ $LOOP_COUNTER -lt 5 ]
|
||||
do true; done
|
||||
|
||||
noctalia msg notification-show "Set brightness to $WRITTEN for display $PRETTY_NAME"
|
||||
@@ -74,7 +74,7 @@
|
||||
WRITTEN=$(echo $RESULT | grep -oP "Writing.+\(\K\d{1,3}\)" | sed 's/)//')
|
||||
CONTROL=$(echo $RESULT | grep -oP "Control.+\+/\K\d{1,3}/100" | sed 's/\/100//')
|
||||
LOOP_COUNTER=$(($LOOP_COUNTER + 1))
|
||||
[[ "$WRITTEN" != "$CONTROL" ]] && [ $LOOP_COUNTER -lt 10 ]
|
||||
[[ "$WRITTEN" != "$CONTROL" ]] && [ $LOOP_COUNTER -lt 5 ]
|
||||
do true; done
|
||||
|
||||
noctalia msg notification-show "Set brightness to $WRITTEN for display $PRETTY_NAME"
|
||||
|
||||
Reference in new issue
Block a user