Compare commits

...

6 commits

18 changed files with 88 additions and 112 deletions

2
.gitignore vendored
View file

@ -1,2 +1,4 @@
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 = builtins.replaceStrings ["http://" ":" "/"] ["" " " ""] cfg.proxy.httpProxy; proxy = lib.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 = builtins.concatStringsSep " " [ command = lib.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:
builtins.elem (lib.getName pkg) [ lib.elem (lib.getName pkg) [
"keka" "keka"
]; ];
} }

View file

@ -1,15 +1,10 @@
{ {
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 = {
"ls" = "eza"; "tree" = "eza --tree";
"tree" = "ls --tree";
}; };
} }

View file

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

View file

@ -1,20 +1,10 @@
{ {
config,
pkgs,
lib, lib,
config,
inputs,
pkgs,
... ...
}: 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
@ -56,7 +46,7 @@ in {
]; ];
### Visuals ### Visuals
output."*".bg = "${background} fill"; output."*".bg = "${inputs.self.legacyPackages.${pkgs.stdenv.hostPlatform.system}.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";
@ -139,7 +129,7 @@ in {
} }
// //
# workspace binds # workspace binds
builtins.listToAttrs (builtins.concatMap (x: [ lib.listToAttrs (lib.concatMap (x: [
{ {
name = "${modifier}+${x}"; name = "${modifier}+${x}";
value = "workspace ${x}"; value = "workspace ${x}";
@ -148,7 +138,7 @@ in {
name = "${modifier}+Shift+${x}"; name = "${modifier}+Shift+${x}";
value = "move container to workspace ${x}"; value = "move container to workspace ${x}";
} }
]) (builtins.genList (x: toString (x + 1)) 9)); ]) (lib.genList (x: toString (x + 1)) 9));
}; };
}; };
} }

View file

@ -1,39 +1,16 @@
{pkgs, ...}: { {
inputs,
pkgs,
...
}: {
programs.swaylock = { programs.swaylock = {
enable = true; enable = true;
package = pkgs.swaylock-effects;
settings = { settings = {
daemonize = true; daemonize = true;
screenshots = true; show-failed-attempts = true;
clock = true; show-keyboard-layout = true;
indicator = true; image = toString inputs.self.legacyPackages.${pkgs.stdenv.hostPlatform.system}.background.dark;
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:
builtins.elem (lib.getName pkg) [ lib.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:
builtins.elem (lib.getName pkg) [ lib.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:
builtins.elem (lib.getName pkg) [ lib.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:
builtins.elem (lib.getName pkg) [ lib.elem (lib.getName pkg) [
"broadcom-sta" "broadcom-sta"
"minecraft-server" "minecraft-server"
]; ];

View file

@ -24,7 +24,7 @@
######## Secrets ######## Secrets
sops = { sops = {
secrets = builtins.mapAttrs (_name: value: value // {sopsFile = ./secrets.yaml;}) { secrets = lib.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:
builtins.elem (lib.getName pkg) [ lib.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:
builtins.elem (lib.getName pkg) [ lib.elem (lib.getName pkg) [
]; ];
}; };
} }

View file

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

View file

@ -25,7 +25,7 @@
}; };
### sops-nix ### sops-nix
sops.secrets = builtins.mapAttrs (_name: value: sops.secrets = lib.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' = builtins.removeAttrs args ["src"]; args' = lib.removeAttrs args ["src"];
in in
pkgs.substitute { pkgs.substitute {
inherit src; inherit src;

View file

@ -1,5 +1,5 @@
{lib, ...}: { {lib, ...}: {
sops.secrets = builtins.mapAttrs (_name: value: value // {sopsFile = ./secrets.yaml;}) { sops.secrets = lib.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.fetchpatch rec { (prev.fetchpatch2 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-A+rBaWMWs616WllVoo21AJaf9lxg/oCG0b9tHLfuJII="; hash = "sha256-aO21HgHVccD8vOlffcenSAn2spW7iEs0nTa5Tmebe3o=";
}) })
(prev.fetchpatch rec { (prev.fetchpatch2 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-YOFm0A4uuRSuiwnvF9xbp8Wl7oGicFGnq61vLegqJ0E="; hash = "sha256-QuV8J0sqh5L9kyYEOTDjWlPNKVb6zolG/cHO+wq2Qa8=";
}) })
(prev.fetchpatch rec { (prev.fetchpatch2 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-PzhQBRpyB1WhErn05UBtBfaDW5bxnQLRKWu8jy7dEiM="; hash = "sha256-4zvVbAdxK05UWy+QMsHPHrVBwmO5279GqhYgJUPsCNI=";
}) })
# Tray D-Bus Menu # Tray D-Bus Menu
# https://github.com/swaywm/sway/pull/6249 # https://github.com/swaywm/sway/pull/6249
(prev.fetchpatch { (prev.fetchpatch2 {
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-1KuGZGwyGJK8KO4OngS+tWKV/3Yu++bCNnp+xTrlGoY="; hash = "sha256-eosg6m2P6e8NRXjOAQL3SZg+Yc4Av9Wd+LOy0G3+xkA=";
}) })
(prev.fetchpatch { (prev.fetchpatch2 {
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-GhBlCnk7aB6s57wV1FNOPAt6s0oJxLgf2bMw+8ktn8A="; hash = "sha256-8RGtpfN/tnkA7nuGdXGHoKUoKVeG7brSQR6V4RU3z88=";
}) })
]; ];
}; };

24
pkgs/background.nix Normal file
View file

@ -0,0 +1,24 @@
{
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,6 +6,8 @@ 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 {