Compare commits

..

No commits in common. "30512e5772d7ea40f521ea11d028fe7a0e369c2f" and "ec117d1dac9327d3ea4eebfe1da9bfef53ae759d" have entirely different histories.

18 changed files with 111 additions and 87 deletions

2
.gitignore vendored
View file

@ -1,4 +1,2 @@
result result
result-*
.DS_Store .DS_Store

View file

@ -127,7 +127,7 @@ in {
# naive but works(tm) # naive but works(tm)
# "http://127.0.0.1:1234/" -> "127.0.0.1 1234" # "http://127.0.0.1:1234/" -> "127.0.0.1 1234"
proxy = lib.replaceStrings ["http://" ":" "/"] ["" " " ""] cfg.proxy.httpProxy; proxy = builtins.replaceStrings ["http://" ":" "/"] ["" " " ""] cfg.proxy.httpProxy;
in in
lib.concatMapStrings (x: '' lib.concatMapStrings (x: ''
${networksetup} -setwebproxystate "${x}" on ${networksetup} -setwebproxystate "${x}" on

View file

@ -36,7 +36,7 @@ in {
### launchd service ### launchd service
# TODO: not run as root user # TODO: not run as root user
launchd.daemons."mihomo" = { launchd.daemons."mihomo" = {
command = lib.concatStringsSep " " [ command = builtins.concatStringsSep " " [
(lib.getExe cfg.package) (lib.getExe cfg.package)
"-d /etc/mihomo" "-d /etc/mihomo"
(lib.optionalString (cfg.webui != null) "-ext-ui ${cfg.webui}") (lib.optionalString (cfg.webui != null) "-ext-ui ${cfg.webui}")

View file

@ -1,7 +1,7 @@
{lib, ...}: { {lib, ...}: {
# Allow unfree applications # Allow unfree applications
nixpkgs.config.allowUnfreePredicate = pkg: nixpkgs.config.allowUnfreePredicate = pkg:
lib.elem (lib.getName pkg) [ builtins.elem (lib.getName pkg) [
"keka" "keka"
]; ];
} }

View file

@ -1,10 +1,15 @@
{ {
programs.eza = { programs.eza = {
enable = true; enable = true;
git = true;
icons = true; icons = true;
extraOptions = ["--header"];
# Fish have builtin aliases for `ls`, alias `ls` to `eza` is the only thing we want to do
#enableAliases = true;
}; };
home.shellAliases = { home.shellAliases = {
"tree" = "eza --tree"; "ls" = "eza";
"tree" = "ls --tree";
}; };
} }

View file

@ -1,14 +1,26 @@
{ {
programs.i3status-rust = { programs.i3status-rust = {
enable = true; enable = true;
bars.default = { bars = {
icons = "material-nf"; default = {
blocks = [ icons = "material-nf";
{block = "backlight";} blocks = [
{block = "sound";} ### Monitor
{block = "battery";} {
{block = "time";} block = "disk_space";
]; path = "/nix";
}
{block = "memory";}
{block = "cpu";}
{block = "load";}
### Stuff that I actually need
{block = "backlight";}
{block = "sound";}
{block = "battery";}
{block = "time";}
];
};
}; };
}; };
} }

View file

@ -1,10 +1,20 @@
{ {
lib,
config, config,
inputs,
pkgs, pkgs,
lib,
... ...
}: { }: let
# https://www.pixiv.net/en/artworks/49983419
image = pkgs.fetchurl {
url = "https://i.pximg.net/img-original/img/2015/04/23/12/43/35/49983419_p0.jpg";
hash = "sha256-JZ5VmsjVjZfHXpx3JxzAyYzZppZmgH38AiAA+B0TDiw=";
curlOptsList = ["-e" "https://www.pixiv.net/"];
};
# Crop 100px on top and bottom
background = pkgs.runCommandLocal "49983419_p0.jpg" {} ''
${lib.getExe pkgs.imagemagick} convert ${image} -crop 3500x1600+0+100 $out
'';
in {
imports = [ imports = [
../i3status-rust ../i3status-rust
../kanshi ../kanshi
@ -46,7 +56,7 @@
]; ];
### Visuals ### Visuals
output."*".bg = "${inputs.self.legacyPackages.${pkgs.stdenv.hostPlatform.system}.background} fill"; output."*".bg = "${background} fill";
bars = [ bars = [
{ {
statusCommand = "${lib.getExe pkgs.i3status-rust} $HOME/.config/i3status-rust/config-default.toml"; statusCommand = "${lib.getExe pkgs.i3status-rust} $HOME/.config/i3status-rust/config-default.toml";
@ -129,7 +139,7 @@
} }
// //
# workspace binds # workspace binds
lib.listToAttrs (lib.concatMap (x: [ builtins.listToAttrs (builtins.concatMap (x: [
{ {
name = "${modifier}+${x}"; name = "${modifier}+${x}";
value = "workspace ${x}"; value = "workspace ${x}";
@ -138,7 +148,7 @@
name = "${modifier}+Shift+${x}"; name = "${modifier}+Shift+${x}";
value = "move container to workspace ${x}"; value = "move container to workspace ${x}";
} }
]) (lib.genList (x: toString (x + 1)) 9)); ]) (builtins.genList (x: toString (x + 1)) 9));
}; };
}; };
} }

View file

@ -1,16 +1,39 @@
{ {pkgs, ...}: {
inputs,
pkgs,
...
}: {
programs.swaylock = { programs.swaylock = {
enable = true; enable = true;
package = pkgs.swaylock-effects;
settings = { settings = {
daemonize = true; daemonize = true;
show-failed-attempts = true; screenshots = true;
show-keyboard-layout = true; clock = true;
image = toString inputs.self.legacyPackages.${pkgs.stdenv.hostPlatform.system}.background.dark; indicator = true;
scaling = "fill";
# i forgot which colorscheme is this
# TODO: switch to tokyonight
line-color = "cdd6f4ff";
text-color = "cdd6f4ff";
inside-color = "1e1e2eff";
ring-color = "313244ff";
line-ver-color = "cdd6f4ff";
text-ver-color = "cdd6f4ff";
inside-ver-color = "1e1e2eff";
ring-ver-color = "313244ff";
line-clear-color = "cdd6f4ff";
text-clear-color = "cdd6f4ff";
inside-clear-color = "1e1e2eff";
ring-clear-color = "313244ff";
line-wrong-color = "cdd6f4ff";
text-wrong-color = "313244ff";
inside-wrong-color = "f38ba8ff";
ring-wrong-color = "313244ff";
key-hl-color = "cba6f7ff";
effect-blur = "7x5";
effect-vignette = "0.5:0.5";
fade-in = 0.2;
}; };
}; };
} }

View file

@ -4,7 +4,7 @@
allowNonSource = false; allowNonSource = false;
allowNonSourcePredicate = pkg: allowNonSourcePredicate = pkg:
lib.elem (lib.getName pkg) [ builtins.elem (lib.getName pkg) [
"adoptopenjdk-hotspot-bin" "adoptopenjdk-hotspot-bin"
"cargo-bootstrap" "cargo-bootstrap"
"cef-binary" "cef-binary"
@ -18,7 +18,7 @@
allowUnfree = false; allowUnfree = false;
allowUnfreePredicate = pkg: allowUnfreePredicate = pkg:
lib.elem (lib.getName pkg) [ builtins.elem (lib.getName pkg) [
"fcitx5-pinyin-minecraft" "fcitx5-pinyin-minecraft"
"fcitx5-pinyin-moegirl" "fcitx5-pinyin-moegirl"
"libXNVCtrl" "libXNVCtrl"

View file

@ -5,7 +5,7 @@
allowNonSource = false; allowNonSource = false;
allowNonSourcePredicate = pkg: allowNonSourcePredicate = pkg:
lib.elem (lib.getName pkg) [ builtins.elem (lib.getName pkg) [
"adoptopenjdk-hotspot-bin" "adoptopenjdk-hotspot-bin"
"cargo-bootstrap" "cargo-bootstrap"
"minecraft-server" "minecraft-server"
@ -17,7 +17,7 @@
allowUnfree = false; allowUnfree = false;
allowUnfreePredicate = pkg: allowUnfreePredicate = pkg:
lib.elem (lib.getName pkg) [ builtins.elem (lib.getName pkg) [
"broadcom-sta" "broadcom-sta"
"minecraft-server" "minecraft-server"
]; ];

View file

@ -24,7 +24,7 @@
######## Secrets ######## Secrets
sops = { sops = {
secrets = lib.mapAttrs (_name: value: value // {sopsFile = ./secrets.yaml;}) { secrets = builtins.mapAttrs (_name: value: value // {sopsFile = ./secrets.yaml;}) {
"synapse/secret" = { "synapse/secret" = {
restartUnits = ["matrix-synapse.service"]; restartUnits = ["matrix-synapse.service"];
owner = config.systemd.services.matrix-synapse.serviceConfig.User; owner = config.systemd.services.matrix-synapse.serviceConfig.User;

View file

@ -2,7 +2,7 @@
nixpkgs.config = { nixpkgs.config = {
allowNonSource = false; allowNonSource = false;
allowNonSourcePredicate = pkg: allowNonSourcePredicate = pkg:
lib.elem (lib.getName pkg) [ builtins.elem (lib.getName pkg) [
"adoptopenjdk-hotspot-bin" "adoptopenjdk-hotspot-bin"
"cargo-bootstrap" "cargo-bootstrap"
"rustc-bootstrap" "rustc-bootstrap"
@ -13,7 +13,7 @@
allowUnfree = false; allowUnfree = false;
allowUnfreePredicate = pkg: allowUnfreePredicate = pkg:
lib.elem (lib.getName pkg) [ builtins.elem (lib.getName pkg) [
]; ];
}; };
} }

View file

@ -31,18 +31,20 @@
boot.kernelPackages = pkgs.linuxPackages; boot.kernelPackages = pkgs.linuxPackages;
### Secrets ### Secrets
sops.secrets = lib.mapAttrs (_name: value: value // {sopsFile = ./secrets.yaml;}) { sops = {
"hysteria/auth" = { secrets = builtins.mapAttrs (_name: value: value // {sopsFile = ./secrets.yaml;}) {
restartUnits = ["hysteria.service"]; "hysteria/auth" = {
}; restartUnits = ["hysteria.service"];
"pixivfe/environment" = { };
restartUnits = ["pixivfe.service"]; "pixivfe/environment" = {
}; restartUnits = ["pixivfe.service"];
"searx/environment" = { };
restartUnits = ["searx.service"]; "searx/environment" = {
}; restartUnits = ["searx.service"];
"miniflux/environment" = { };
restartUnits = ["miniflux.service"]; "miniflux/environment" = {
restartUnits = ["miniflux.service"];
};
}; };
}; };

View file

@ -25,7 +25,7 @@
}; };
### sops-nix ### sops-nix
sops.secrets = lib.mapAttrs (_name: value: sops.secrets = builtins.mapAttrs (_name: value:
value value
// { // {
restartUnits = ["mihomo.service"]; restartUnits = ["mihomo.service"];
@ -42,7 +42,7 @@
sops.templates."clash.yaml".file = let sops.templates."clash.yaml".file = let
convert = url: "https://sub.maoxiongnet.com/sub?target=clash&list=true&url=${url}"; convert = url: "https://sub.maoxiongnet.com/sub?target=clash&list=true&url=${url}";
substituteV2 = {src, ...} @ args: let substituteV2 = {src, ...} @ args: let
args' = lib.removeAttrs args ["src"]; args' = builtins.removeAttrs args ["src"];
in in
pkgs.substitute { pkgs.substitute {
inherit src; inherit src;

View file

@ -1,5 +1,5 @@
{lib, ...}: { {lib, ...}: {
sops.secrets = lib.mapAttrs (_name: value: value // {sopsFile = ./secrets.yaml;}) { sops.secrets = builtins.mapAttrs (_name: value: value // {sopsFile = ./secrets.yaml;}) {
"wireless/wangxiaobo".path = "/var/lib/iwd/wangxiaobo.psk"; "wireless/wangxiaobo".path = "/var/lib/iwd/wangxiaobo.psk";
"wireless/ImmortalWrt".path = "/var/lib/iwd/ImmortalWrt.psk"; "wireless/ImmortalWrt".path = "/var/lib/iwd/ImmortalWrt.psk";
}; };

View file

@ -24,33 +24,33 @@ in {
sway-unwrapped = addPatches prev.sway-unwrapped [ sway-unwrapped = addPatches prev.sway-unwrapped [
# text_input: Implement input-method popups # text_input: Implement input-method popups
# https://github.com/swaywm/sway/pull/7226 # https://github.com/swaywm/sway/pull/7226
(prev.fetchpatch2 rec { (prev.fetchpatch rec {
name = "0001-text_input-Implement-input-method-popups.patch"; name = "0001-text_input-Implement-input-method-popups.patch";
url = "https://aur.archlinux.org/cgit/aur.git/plain/${name}?h=sway-im&id=b8434b3ad9e8c6946dbf7b14b0f7ef5679452b94"; url = "https://aur.archlinux.org/cgit/aur.git/plain/${name}?h=sway-im&id=b8434b3ad9e8c6946dbf7b14b0f7ef5679452b94";
hash = "sha256-aO21HgHVccD8vOlffcenSAn2spW7iEs0nTa5Tmebe3o="; hash = "sha256-A+rBaWMWs616WllVoo21AJaf9lxg/oCG0b9tHLfuJII=";
}) })
(prev.fetchpatch2 rec { (prev.fetchpatch rec {
name = "0002-chore-fractal-scale-handle.patch"; name = "0002-chore-fractal-scale-handle.patch";
url = "https://aur.archlinux.org/cgit/aur.git/plain/${name}?h=sway-im&id=b8434b3ad9e8c6946dbf7b14b0f7ef5679452b94"; url = "https://aur.archlinux.org/cgit/aur.git/plain/${name}?h=sway-im&id=b8434b3ad9e8c6946dbf7b14b0f7ef5679452b94";
hash = "sha256-QuV8J0sqh5L9kyYEOTDjWlPNKVb6zolG/cHO+wq2Qa8="; hash = "sha256-YOFm0A4uuRSuiwnvF9xbp8Wl7oGicFGnq61vLegqJ0E=";
}) })
(prev.fetchpatch2 rec { (prev.fetchpatch rec {
name = "0003-chore-left_pt-on-method-popup.patch"; name = "0003-chore-left_pt-on-method-popup.patch";
url = "https://aur.archlinux.org/cgit/aur.git/plain/${name}?h=sway-im&id=b8434b3ad9e8c6946dbf7b14b0f7ef5679452b94"; url = "https://aur.archlinux.org/cgit/aur.git/plain/${name}?h=sway-im&id=b8434b3ad9e8c6946dbf7b14b0f7ef5679452b94";
hash = "sha256-4zvVbAdxK05UWy+QMsHPHrVBwmO5279GqhYgJUPsCNI="; hash = "sha256-PzhQBRpyB1WhErn05UBtBfaDW5bxnQLRKWu8jy7dEiM=";
}) })
# Tray D-Bus Menu # Tray D-Bus Menu
# https://github.com/swaywm/sway/pull/6249 # https://github.com/swaywm/sway/pull/6249
(prev.fetchpatch2 { (prev.fetchpatch {
name = "0001-Tray-Implement-dbusmenu.patch"; name = "0001-Tray-Implement-dbusmenu.patch";
url = "https://github.com/NickHu/sway/commit/0fc5d7aed84415a77b718ca9dc3c0b3ad2c05b02.patch"; url = "https://github.com/NickHu/sway/commit/0fc5d7aed84415a77b718ca9dc3c0b3ad2c05b02.patch";
hash = "sha256-eosg6m2P6e8NRXjOAQL3SZg+Yc4Av9Wd+LOy0G3+xkA="; hash = "sha256-1KuGZGwyGJK8KO4OngS+tWKV/3Yu++bCNnp+xTrlGoY=";
}) })
(prev.fetchpatch2 { (prev.fetchpatch {
name = "0002-Tray-dont-invoke-dbus-menu-when-tray-is-disabled.patch"; name = "0002-Tray-dont-invoke-dbus-menu-when-tray-is-disabled.patch";
url = "https://github.com/NickHu/sway/commit/03c14421354e54332e12f78d029dcaa9919fd161.patch"; url = "https://github.com/NickHu/sway/commit/03c14421354e54332e12f78d029dcaa9919fd161.patch";
hash = "sha256-8RGtpfN/tnkA7nuGdXGHoKUoKVeG7brSQR6V4RU3z88="; hash = "sha256-GhBlCnk7aB6s57wV1FNOPAt6s0oJxLgf2bMw+8ktn8A=";
}) })
]; ];
}; };

View file

@ -1,24 +0,0 @@
{
fetchurl,
imagemagick,
runCommandLocal,
}:
runCommandLocal "49983419_p0.jpg" {
nativeBuildInputs = [imagemagick];
# https://www.pixiv.net/en/artworks/49983419
image = fetchurl {
url = "https://i.pximg.net/img-original/img/2015/04/23/12/43/35/49983419_p0.jpg";
hash = "sha256-JZ5VmsjVjZfHXpx3JxzAyYzZppZmgH38AiAA+B0TDiw=";
curlOptsList = ["-e" "https://www.pixiv.net/"];
};
outputs = ["out" "dark"];
} ''
magick $image -crop 3500x1600+0+100 $out
magick $image \
-crop 3500x1600+0+100 \
-blur 8x8 \
-brightness-contrast -10,0 \
$dark
''

View file

@ -6,8 +6,6 @@ in {
# https://github.com/NixOS/nixpkgs/pull/308720 # https://github.com/NixOS/nixpkgs/pull/308720
pixivfe = callPackage ./pixivfe.nix {}; pixivfe = callPackage ./pixivfe.nix {};
background = callPackage ./background.nix {};
scripts = lib.makeScope pkgs.newScope (self: let scripts = lib.makeScope pkgs.newScope (self: let
inherit (self) callPackage; inherit (self) callPackage;
in { in {