Compare commits

...

2 Commits

14 changed files with 52 additions and 23 deletions

View File

@@ -5,6 +5,7 @@
inherit (nixpkgs) lib; inherit (nixpkgs) lib;
username = "alex"; username = "alex";
useremail = "reizero@live.com"; useremail = "reizero@live.com";
sourcepath = "/home/${username}/.nix";
libs = import ./libs; libs = import ./libs;
in in
rec { rec {
@@ -19,7 +20,7 @@
(profile: { (profile: {
name = profile; name = profile;
value = import ./profiles/${profile} { value = import ./profiles/${profile} {
inherit self inputs outputs libs username useremail; inherit self inputs outputs libs sourcepath username useremail;
}; };
}) })
(attrNames (readDir ./profiles)) (attrNames (readDir ./profiles))

View File

@@ -5,7 +5,4 @@ in
{ {
# 导出mkNixosSystem函数 # 导出mkNixosSystem函数
inherit (mkNixosSystemLib) mkNixosSystem; inherit (mkNixosSystemLib) mkNixosSystem;
# 转换相对路径到绝对路径
absolutePath = path: "${builtins.path { name = "path"; path = path; }}";
} }

18
libs/home-libs.nix Normal file
View File

@@ -0,0 +1,18 @@
{ lib, config, sourcepath, ... }: # 声明你可能需要的参数
{
options = {
# 使用一个独特的顶层选项名,如 myLib
home-libs = lib.mkOption {
type = lib.types.attrsOf lib.types.anything;
default = { };
description = "Home manager custom utility functions.";
};
};
config.home-libs = {
# path 参数目前无法通过内置函数的方式获取
# 需要是相对于 flake 的相对路径,直接由目录开始不需要加 `./`。
mkOutOfStoreSymlink = path:
config.home-libs.mkOutOfStoreSymlink "${sourcepath}/${path}";
};
}

View File

@@ -17,7 +17,7 @@ $filemanager = dolphin
################################################ ################################################
# Main actions # Main actions
################################################ ################################################
bind = $mainMod, Q, exec, ~/.config/hypr/scripts/dontkillsteam.sh # killactive, # kill the window on focus bind = $mainMod, C, exec, ~/.config/hypr/scripts/dontkillsteam.sh # killactive, # kill the window on focus
bind = $mainMod CTRL, delete, exit, # kill hyperland session bind = $mainMod CTRL, delete, exit, # kill hyperland session
bind = $mainMod, F, togglefloating, # toggle the window on focus to float bind = $mainMod, F, togglefloating, # toggle the window on focus to float
bind = $mainMod CTRL, L, exec, swaylock # lock screen bind = $mainMod CTRL, L, exec, swaylock # lock screen

View File

@@ -22,6 +22,9 @@ windowrulev2 = center,class:^(.*)$,title:^(Save [Ff]ile)
windowrulev2 = float,class:^(.*)$,title:^(Save [Aa]s) windowrulev2 = float,class:^(.*)$,title:^(Save [Aa]s)
windowrulev2 = center,class:^(.*)$,title:^(Save [Aa]s) windowrulev2 = center,class:^(.*)$,title:^(Save [Aa]s)
windowrulev2 = float,class:^(wechat)$,title:^(预览)$
windowrulev2 = center,class:^(wechat)$,title:^(预览)$
windowrulev2 = center,class:^(.*)$,title:^(Location)$ windowrulev2 = center,class:^(.*)$,title:^(Location)$
windowrulev2 = center,class:^(Code)$ windowrulev2 = center,class:^(Code)$

View File

@@ -66,13 +66,17 @@
"format-window-separator": " ", "format-window-separator": " ",
"window-rewrite-default": "", "window-rewrite-default": "",
"window-rewrite": { "window-rewrite": {
"fcitx": "󰌌",
"code": "󰨞",
"Cursor": "󰅪",
"jetbrains-idea-ce": "",
"dbeaver": "",
"class<microsoft-edge>": "", "class<microsoft-edge>": "",
"class<chromium-browser>": "", "class<chromium-browser>": "",
"title<.*youtube.*>": "", "title<.*youtube.*>": "",
"rofi": "󱓞", "rofi": "󱓞",
"kitty": "", "kitty": "",
"code": "󰨞",
"Cursor": "󰅪",
"org.gnome.Nautilus": "󰪶", "org.gnome.Nautilus": "󰪶",
"wechat": "", "wechat": "",
"wps": "󰈬", "wps": "󰈬",
@@ -129,14 +133,14 @@
}, },
"cpu": { "cpu": {
"interval": 10, "interval": 5,
"format": "󰍛 {usage}%", "format": "󰍛 {usage}%",
"format-alt": "{icon0}{icon1}{icon2}{icon3}", "format-alt": "{icon0}{icon1}{icon2}{icon3}",
"format-icons": ["▁", "▂", "▃", "▄", "▅", "▆", "▇", "█"] "format-icons": ["▁", "▂", "▃", "▄", "▅", "▆", "▇", "█"]
}, },
"temperature": { "temperature": {
"interval": 10, "interval": 5,
"hwmon-path": "/sys/devices/platform/coretemp.0/hwmon/hwmon2/temp1_input", "hwmon-path": "/sys/devices/platform/coretemp.0/hwmon/hwmon2/temp1_input",
"format": " {temperatureC}°C" "format": " {temperatureC}°C"
}, },
@@ -151,14 +155,14 @@
}, },
"network": { "network": {
"interval": 5,
// "interface": "wlp2*", // (Optional) To force the use of this interface // "interface": "wlp2*", // (Optional) To force the use of this interface
"format-wifi": "󰤨 {essid}", "format-wifi": "󰤨 {essid}",
"format-ethernet": "󱘖 Wired", "format-ethernet": "󱘖 Wired",
"tooltip-format": "󱘖 {ipaddr}  {bandwidthUpBytes}  {bandwidthDownBytes}", "tooltip-format": "󱘖 {ipaddr}  {bandwidthUpBytes}  {bandwidthDownBytes}",
"format-linked": "󱘖 {ifname} (No IP)", "format-linked": "󱘖 {ifname} (No IP)",
"format-disconnected": " Disconnected", "format-disconnected": " Disconnected",
"format-alt": "󰤨 {signalStrength}%", "format-alt": "󰤨 {signalStrength}%"
"interval": 5
}, },
"bluetooth": { "bluetooth": {

View File

@@ -1,7 +1,7 @@
{ config, libs, pkgs, ... }: { config, libs, pkgs, ... }:
let let
conf = [ "hypr" "waybar" "rofi" "kitty" "mako" "wlogout" ]; conf = [ "hypr" "waybar" "rofi" "kitty" "mako" "wlogout" ];
confPath = "${config.home.homeDirectory}/.nix/modules/home/hyprland/conf"; confPath = "modules/home/hyprland/conf";
in in
{ {
imports = [ imports = [
@@ -52,7 +52,7 @@ in
(name: { (name: {
inherit name; inherit name;
value = { value = {
source = config.lib.file.mkOutOfStoreSymlink "${confPath}/${name}"; source = config.home-libs.mkOutOfStoreSymlink "${confPath}/${name}";
}; };
}) })
conf conf

View File

@@ -24,10 +24,10 @@
xdg.configFile = { xdg.configFile = {
"Code/User/keybindings.json" = { "Code/User/keybindings.json" = {
source = config.lib.file.mkOutOfStoreSymlink "${config.home.homeDirectory}/.nix/modules/home/vscode/keybindings.json"; source = config.home-libs.mkOutOfStoreSymlink "modules/home/vscode/keybindings.json";
}; };
"Code/User/settings.json" = { "Code/User/settings.json" = {
source = config.lib.file.mkOutOfStoreSymlink "${config.home.homeDirectory}/.nix/modules/home/vscode/settings.json"; source = config.home-libs.mkOutOfStoreSymlink "modules/home/vscode/settings.json";
}; };
}; };
} }

View File

@@ -75,8 +75,8 @@
download = config.home.homeDirectory + "/tmp"; download = config.home.homeDirectory + "/tmp";
videos = config.home.homeDirectory + "/tmp"; videos = config.home.homeDirectory + "/tmp";
pictures = config.home.homeDirectory + "/tmp"; pictures = config.home.homeDirectory + "/tmp";
templates = config.home.homeDirectory + "/tmp"; # templates = config.home.homeDirectory + "/tmp";
publicShare = config.home.homeDirectory + "/tmp"; # publicShare = config.home.homeDirectory + "/tmp";
extraConfig = { extraConfig = {
XDG_SCREENSHOTS_DIR = config.home.homeDirectory + "/tmp/Screenshots"; XDG_SCREENSHOTS_DIR = config.home.homeDirectory + "/tmp/Screenshots";
}; };

View File

@@ -17,7 +17,7 @@
history.size = 10000; history.size = 10000;
history.ignoreAllDups = true; history.ignoreAllDups = true;
history.path = "$HOME/.zsh_history"; history.path = "$HOME/.zsh_history";
history.ignorePatterns = [ "rm *" "pkill *" "cp *" ]; # history.ignorePatterns = [ "rm *" "pkill *" "cp *" ];
oh-my-zsh = { oh-my-zsh = {
enable = true; enable = true;

View File

@@ -20,11 +20,12 @@ args@{ self, pkgs, home-manager, username, sysversion, ... }: {
# home-manager.useUserPackages = true; # home-manager.useUserPackages = true;
home-manager = { home-manager = {
extraSpecialArgs = { extraSpecialArgs = {
inherit (args) self inputs outputs libs hostname username useremail sysversion; inherit (args) self inputs outputs libs sourcepath hostname username useremail sysversion;
}; };
users."${username}" = { ... }: { users."${username}" = { ... }: {
imports = [ imports = [
./hm ./hm
"${self}/libs/home-libs.nix"
"${self}/home/desktop.nix" "${self}/home/desktop.nix"
"${self}/modules/home/develop.nix" "${self}/modules/home/develop.nix"
]; ];

View File

@@ -1,6 +1,10 @@
{ ... }: { { pkgs, ... }: {
imports = [ imports = [
./ssh ./ssh
./hyprland.nix ./hyprland.nix
]; ];
home.packages = with pkgs; [
nextcloud-client
];
} }

View File

@@ -5,7 +5,8 @@
sessionVariables = { sessionVariables = {
# for hyprland with nvidia gpu, ref https://wiki.hyprland.org/Nvidia/ # for hyprland with nvidia gpu, ref https://wiki.hyprland.org/Nvidia/
# 启用注释部分会导致NVIDIA下无法启动hyprland # 启用注释部分会导致NVIDIA下无法启动hyprland
WLR_DRM_DEVICES = "/dev/dri/card1:/dev/dri/card0"; WLR_DRM_DEVICES = "/dev/dri/card1";
AQ_DRM_DEVICES = "/dev/dri/card1";
}; };
}; };
} }

View File

@@ -1,9 +1,9 @@
{ config, ... }: { { config, flakesPath, ... }: {
programs.ssh = { programs.ssh = {
enable = true; enable = true;
}; };
home.file.".ssh/config" = { home.file.".ssh/config" = {
source = config.lib.file.mkOutOfStoreSymlink "${config.home.homeDirectory}/.nix/profiles/apollo/hm/ssh/config"; source = config.home-libs.mkOutOfStoreSymlink "profiles/apollo/hm/ssh/config";
}; };
} }