This commit is contained in:
emily 2024-04-03 15:35:54 +02:00
parent eeda91a6ac
commit 2839b1a2a8
Signed by: emily
GPG key ID: F6F4C66207FCF995
10 changed files with 121 additions and 160 deletions

View file

@ -1 +1 @@
ssh://nixremote@seras.kyouma.net x86_64-linux,aarch64-linux - 40 2 nixos-test,benchmark,big-parallel,kvm ssh://nixremote@seras.kyouma.net x86_64-linux,aarch64-linux - 40 5 nixos-test,benchmark,big-parallel,kvm

View file

@ -1,7 +1,7 @@
{ config, inputs, lib, pkgs, ... }: { { config, inputs, lib, pkgs, ... }: {
imports = [ imports = [
../../common ../../common
../../profiles/remote-builder.nix ../../profiles/remote-build.nix
../../profiles/rpi.nix ../../profiles/rpi.nix
../../profiles/headless.nix ../../profiles/headless.nix
]; ];

View file

@ -3,6 +3,7 @@
inputs.home-manager.nixosModules.home-manager inputs.home-manager.nixosModules.home-manager
inputs.stylix.nixosModules.stylix inputs.stylix.nixosModules.stylix
./nixvim.nix ./nixvim.nix
./scripts.nix
]; ];
kyouma.machine-type.graphical = true; kyouma.machine-type.graphical = true;
@ -114,6 +115,12 @@
enable = true; enable = true;
source = config.stylix.image; source = config.stylix.image;
}; };
home.file.".local/bin/hypr" = {
enable = true;
executable = true;
recursive = true;
source = ./files/scripts;
};
wayland.windowManager.hyprland = { wayland.windowManager.hyprland = {
enable = true; enable = true;
settings = let settings = let
@ -275,10 +282,6 @@
"CTRL_ALT, L, exec, ${swaylock} -f -i $XDG_PICTURES_DIR/wallpapers/lockscreen.png" "CTRL_ALT, L, exec, ${swaylock} -f -i $XDG_PICTURES_DIR/wallpapers/lockscreen.png"
# Function keys # Function keys
", XF86MonBrightnessUp, exec, ${brightnessctl} s +10%"
", XF86MonBrightnessDown, exec, ${brightnessctl} s 10%-"
", XF86AudioRaiseVolume, exec, ${pactl} set-sink-volume @DEFAULT_SINK@ +2dB"
", XF86AudioLowerVolume, exec, ${pactl} set-sink-volume @DEFAULT_SINK@ -2dB"
", XF86AudioMute, exec, ${pactl} set-sink-mute @DEFAULT_SINK@ toggle" ", XF86AudioMute, exec, ${pactl} set-sink-mute @DEFAULT_SINK@ toggle"
", XF86AudioMicMute, exec, ${pactl} set-source-mute @DEFAULT_SOURCE@ toggle" ", XF86AudioMicMute, exec, ${pactl} set-source-mute @DEFAULT_SOURCE@ toggle"
", XF86AudioNext, exec, ${playerctl} next" ", XF86AudioNext, exec, ${playerctl} next"
@ -294,7 +297,6 @@
", Print, exec, ${screenshot} --now" ", Print, exec, ${screenshot} --now"
"ALT, Print, exec, ${screenshot} --in5" "ALT, Print, exec, ${screenshot} --in5"
"SHIFT, Print, exec, ${screenshot} --in10" "SHIFT, Print, exec, ${screenshot} --in10"
"CTRL, Print, exec, ${screenshot} --win"
"$mod, Print, exec, ${screenshot} --area" "$mod, Print, exec, ${screenshot} --area"
# Hyprland # Hyprland
@ -374,6 +376,11 @@
"$mod SHIFT, O, toggleopaque" "$mod SHIFT, O, toggleopaque"
]; ];
binde = [ binde = [
# Function keys repeat
", XF86MonBrightnessUp, exec, ${brightnessctl} s +10%"
", XF86MonBrightnessDown, exec, ${brightnessctl} s 10%-"
", XF86AudioRaiseVolume, exec, ${pactl} set-sink-volume @DEFAULT_SINK@ +5%"
", XF86AudioLowerVolume, exec, ${pactl} set-sink-volume @DEFAULT_SINK@ -5%"
# Resize Active # Resize Active
"$mod CTRL, left, resizeactive, -20 0" "$mod CTRL, left, resizeactive, -20 0"
"$mod CTRL, H, resizeactive, -20 0" "$mod CTRL, H, resizeactive, -20 0"
@ -466,7 +473,7 @@
spacing = 8; spacing = 8;
}; };
clock = { clock = {
tooltip-format = "{:%A %d %B | %H:%M}"; #tooltip-format = "{:%A %d %B | %H:%M}";
format = " {:%Y-%m-%d %H:%M:%OS}"; format = " {:%Y-%m-%d %H:%M:%OS}";
format-alt = " {:%Y %b %d %a %H:%M:%OS}"; format-alt = " {:%Y %b %d %a %H:%M:%OS}";
interval = 1; interval = 1;
@ -668,12 +675,6 @@
BindsTo = "waybar.service"; BindsTo = "waybar.service";
After = "waybar.service"; After = "waybar.service";
}; };
home.file.".local/bin/hypr" = {
enable = true;
executable = true;
recursive = true;
source = ./files/scripts;
};
xdg.configFile."mako-icons" = { xdg.configFile."mako-icons" = {
enable = true; enable = true;
recursive = true; recursive = true;

View file

@ -1,17 +0,0 @@
#!/usr/bin/env bash
color=$(grim -g "`slurp -b 20262C00 -p`" -t ppm - | convert - -format '%[pixel:p{0,0}]' txt:- | tail -n1 | cut -d' ' -f4)
image=/tmp/${color}.png
main() {
if [[ "$color" ]]; then
# copy color code to clipboard
echo $color | tr -d "\n" | wl-copy
# generate preview
convert -size 48x48 xc:"$color" ${image}
# notify about it
notify-send -h string:x-canonical-private-synchronous:sys-notify-picker -u low -i ${image} "$color, copied to clipboard."
fi
}
main

View file

@ -1,78 +0,0 @@
#!/usr/bin/env bash
iDIR="$HOME/.config/mako-icons"
time=`date +%Y-%m-%d-%H-%M-%S`
dir="$HOME/Pictures/screenshots"
file="${time}.png"
# notify and view screenshot
notify_cmd_shot="notify-send -h string:x-canonical-private-synchronous:sys-notify-shot -u low -i ${iDIR}/picture.png"
notify_view () {
${notify_cmd_shot} "Copied to clipboard."
paplay /usr/share/sounds/freedesktop/stereo/screen-capture.oga &>/dev/null &
image-roll "${dir}/$file"
if [[ -e "$dir/$file" ]]; then
${notify_cmd_shot} "Screenshot Saved."
else
${notify_cmd_shot} "Screenshot Deleted."
fi
}
# countdown
countdown () {
for sec in `seq $1 -1 1`; do
notify-send -h string:x-canonical-private-synchronous:sys-notify-count -t 1000 -i "$iDIR"/timer.png "Taking shot in : $sec"
sleep 1
done
}
# take shots
shotnow () {
cd ${dir} && sleep 0.5 && grim - | tee "$file" | wl-copy
notify_view
}
shot5 () {
countdown '5'
sleep 1 && cd ${dir} && grim - | tee "$file" | wl-copy
notify_view
}
shot10 () {
countdown '10'
sleep 1 && cd ${dir} && grim - | tee "$file" | wl-copy
notify_view
}
shotwin () {
w_pos=`hyprctl activewindow | grep 'at:' | cut -d':' -f2 | tr -d ' ' | tail -n1`
w_size=`hyprctl activewindow | grep 'size:' | cut -d':' -f2 | tr -d ' ' | tail -n1 | sed s/,/x/g`
cd ${dir} && grim -g "$w_pos $w_size" - | tee "$file" | wl-copy
notify_view
}
shotarea () {
cd ${dir} && grim -g "$(slurp -b 20262CCC -c B4A1DBff -s B4A1DB0D -w 2 && sleep 0.3)" - | tee "$file" | wl-copy
notify_view
}
if [[ ! -d "$dir" ]]; then
mkdir -p "$dir"
fi
if [[ "$1" == "--now" ]]; then
shotnow
elif [[ "$1" == "--in5" ]]; then
shot5
elif [[ "$1" == "--in10" ]]; then
shot10
elif [[ "$1" == "--win" ]]; then
shotwin
elif [[ "$1" == "--area" ]]; then
shotarea
else
echo -e "Available Options : --now --in5 --in10 --win --area"
fi
exit 0

View file

@ -0,0 +1,87 @@
{ pkgs, inputs, ... }: {
imports = [
inputs.home-manager.nixosModules.home-manager
];
home-manager.users.emily.home.file.".local/bin/hypr/colorpicker.sh" = {
enable = true;
executable = true;
text = ''
#!/${pkgs.bash}/bin/bash
color=$(${pkgs.grim}/bin/grim -g "`${pkgs.slurp}/bin/slurp -b 20262C00 -p`" -t ppm - | \
${pkgs.imagemagick_light}/bin/convert - -format '%[pixel:p{0,0}]' txt:- | \
${pkgs.coreutils}/bin/tail -n1 | ${pkgs.coreutils}/bin/cut -d' ' -f4)
image=/tmp/''${color}.png
main() {
if [[ "$color" ]]; then
${pkgs.coreutils}/bin/echo $color | ${pkgs.coreutils}/bin/tr -d "\n" | ${pkgs.wl-clipboard}/bin/wl-copy
${pkgs.imagemagick_light}/bin/convert -size 48x48 xc:"$color" ''${image}
${pkgs.libnotify}/bin/notify-send -h string:x-canonical-private-synchronous:sys-notify-picker -u low -i ''${image} "$color, copied to clipboard."
fi
}
main
'';
};
home-manager.users.emily.home.file.".local/bin/hypr/screenshot.sh" = let
cu = "${pkgs.coreutils}/bin";
grim = "${pkgs.grim}/bin/grim";
notify-send = "${pkgs.libnotify}/bin/notify-send";
paplay = "${pkgs.pulseaudio}/bin/paplay";
slurp = "${pkgs.slurp}/bin/slurp";
image-roll = "${pkgs.image-roll}/bin/image-roll";
wl-copy = "${pkgs.wl-clipboard}/bin/wl-copy";
in {
enable = true;
executable = true;
text = ''
#!/${pkgs.bash}/bin/bash
iDIR="$HOME/.config/mako-icons"
time=`${cu}/date +%Y-%m-%d-%H-%M-%S`
dir="$HOME/Pictures/screenshots"
file="''${time}.png"
notify_cmd_shot="${notify-send} -h string:x-canonical-private-synchronous:sys-notify-shot -u low -i ''${iDIR}/picture.png"
notify_view () {
''${notify_cmd_shot} "Copied to clipboard."
${paplay} /usr/share/sounds/freedesktop/stereo/screen-capture.oga &>/dev/null &
${image-roll} "''${dir}/$file"
if [[ -e "$dir/$file" ]]; then
''${notify_cmd_shot} "Screenshot Saved."
else
''${notify_cmd_shot} "Screenshot Deleted."
fi
}
countdown () {
for sec in `${cu}/seq $1 -1 1`; do
${notify-send} -h string:x-canonical-private-synchronous:sys-notify-count -t 1000 -i "$iDIR"/timer.png "Taking shot in : $sec"
${cu}/sleep 1
done
}
shotnow () {
cd ''${dir} && ${cu}/sleep 0.5 && ${grim} - | ${cu}/tee "$file" | ${wl-copy}
notify_view
}
shotarea () {
cd ''${dir} && ${grim} -g "$(${slurp} -b 20262CCC -c B4A1DBff -s B4A1DB0D -w 2 && ${cu}/sleep 0.3)" - | ${cu}/tee "$file" | ${wl-copy}
notify_view
}
if [[ ! -d "$dir" ]]; then
${cu}/mkdir -p "$dir"
fi
if [[ "$1" == "--now" ]]; then
shotnow
elif [[ "$1" == "--in5" ]]; then
countdown '5'
shotnow
elif [[ "$1" == "--in10" ]]; then
countdown '10'
shotnow
elif [[ "$1" == "--area" ]]; then
shotarea
else
echo -e "Available Options : --now --in5 --in10 --area"
fi
exit 0
'';
};
}

View file

@ -1,5 +1,6 @@
{ config, lib, ... }: with lib; { { config, lib, ... }: with lib; {
kyouma.machine-type.headless = true; kyouma.machine-type.headless = true;
documentation.man.generateCaches = false;
services.openssh.enable = mkDefault true; services.openssh.enable = mkDefault true;
services.vnstat.enable = mkDefault true; services.vnstat.enable = mkDefault true;
} }

View file

@ -16,8 +16,6 @@
}; };
console.enable = false; console.enable = false;
documentation.man.generateCaches = false;
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
bluez bluez
bluez-tools bluez-tools
@ -43,10 +41,8 @@
dtsText = '' dtsText = ''
/dts-v1/; /dts-v1/;
/plugin/; /plugin/;
/ { / {
compatible = "brcm,bcm2711"; compatible = "brcm,bcm2711";
fragment@0 { fragment@0 {
target = <&uart0_pins>; target = <&uart0_pins>;
__overlay__ { __overlay__ {

View file

@ -458,27 +458,6 @@
} }
}, },
"home-manager_2": { "home-manager_2": {
"inputs": {
"nixpkgs": [
"nixvim",
"nixpkgs"
]
},
"locked": {
"lastModified": 1711133180,
"narHash": "sha256-WJOahf+6115+GMl3wUfURu8fszuNeJLv9qAWFQl3Vmo=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "1c2c5e4cabba4c43504ef0f8cc3f3dfa284e2dbb",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "home-manager",
"type": "github"
}
},
"home-manager_3": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [
"stylix", "stylix",
@ -502,7 +481,9 @@
"kyouma-www": { "kyouma-www": {
"inputs": { "inputs": {
"flake-utils": "flake-utils_3", "flake-utils": "flake-utils_3",
"nixpkgs": "nixpkgs_2" "nixpkgs": [
"nixpkgs"
]
}, },
"locked": { "locked": {
"lastModified": 1711306151, "lastModified": 1711306151,
@ -571,22 +552,6 @@
} }
}, },
"nixpkgs_2": { "nixpkgs_2": {
"locked": {
"lastModified": 1705133751,
"narHash": "sha256-rCIsyE80jgiOU78gCWN3A0wE0tR2GI5nH6MlS+HaaSQ=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "9b19f5e77dd906cb52dade0b7bd280339d2a1f3d",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_3": {
"locked": { "locked": {
"lastModified": 1711163522, "lastModified": 1711163522,
"narHash": "sha256-YN/Ciidm+A0fmJPWlHBGvVkcarYWSC+s3NTPk/P+q3c=", "narHash": "sha256-YN/Ciidm+A0fmJPWlHBGvVkcarYWSC+s3NTPk/P+q3c=",
@ -602,7 +567,7 @@
"type": "github" "type": "github"
} }
}, },
"nixpkgs_4": { "nixpkgs_3": {
"locked": { "locked": {
"lastModified": 1700856099, "lastModified": 1700856099,
"narHash": "sha256-RnEA7iJ36Ay9jI0WwP+/y4zjEhmeN6Cjs9VOFBH7eVQ=", "narHash": "sha256-RnEA7iJ36Ay9jI0WwP+/y4zjEhmeN6Cjs9VOFBH7eVQ=",
@ -623,7 +588,9 @@
"devshell": "devshell", "devshell": "devshell",
"flake-compat": "flake-compat", "flake-compat": "flake-compat",
"flake-parts": "flake-parts", "flake-parts": "flake-parts",
"home-manager": "home-manager_2", "home-manager": [
"home-manager"
],
"nix-darwin": "nix-darwin", "nix-darwin": "nix-darwin",
"nixpkgs": [ "nixpkgs": [
"nixpkgs" "nixpkgs"
@ -680,7 +647,7 @@
"home-manager": "home-manager", "home-manager": "home-manager",
"kyouma-www": "kyouma-www", "kyouma-www": "kyouma-www",
"nixos-hardware": "nixos-hardware", "nixos-hardware": "nixos-hardware",
"nixpkgs": "nixpkgs_3", "nixpkgs": "nixpkgs_2",
"nixvim": "nixvim", "nixvim": "nixvim",
"stylix": "stylix" "stylix": "stylix"
} }
@ -698,8 +665,8 @@
"base16-vim": "base16-vim", "base16-vim": "base16-vim",
"flake-compat": "flake-compat_3", "flake-compat": "flake-compat_3",
"gnome-shell": "gnome-shell", "gnome-shell": "gnome-shell",
"home-manager": "home-manager_3", "home-manager": "home-manager_2",
"nixpkgs": "nixpkgs_4" "nixpkgs": "nixpkgs_3"
}, },
"locked": { "locked": {
"lastModified": 1711224130, "lastModified": 1711224130,

View file

@ -5,7 +5,6 @@
nixos-hardware.url = "github:nixos/nixos-hardware"; nixos-hardware.url = "github:nixos/nixos-hardware";
fernglas.url = "github:wobcom/fernglas"; fernglas.url = "github:wobcom/fernglas";
flake-utils.url = "github:numtide/flake-utils"; flake-utils.url = "github:numtide/flake-utils";
kyouma-www.url = "git+https://git.bsd.gay/snaki/kyouma-net.git";
stylix.url = "github:danth/stylix"; stylix.url = "github:danth/stylix";
disko = { disko = {
url = "github:nix-community/disko"; url = "github:nix-community/disko";
@ -15,20 +14,25 @@
url = "github:nix-community/home-manager"; url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
kyouma-www = {
url = "git+https://git.bsd.gay/snaki/kyouma-net.git";
inputs.nixpkgs.follows = "nixpkgs";
};
nixvim = { nixvim = {
url = "github:nix-community/nixvim"; url = "github:nix-community/nixvim";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
inputs.home-manager.follows = "home-manager";
}; };
}; };
nixConfig = { nixConfig = {
builders-use-substitutes = true; builders-use-substitutes = true;
builders = "ssh://nixremote@seras.kyouma.net x86_64-linux,aarch64-linux - 40 2 nixos-test,benchmark,big-parallel,kvm"; builders = "ssh://nixremote@seras.kyouma.net x86_64-linux,aarch64-linux - 40 5 nixos-test,benchmark,big-parallel,kvm";
}; };
outputs = { self, nixpkgs, flake-utils, ... }@inputs: { outputs = { self, nixpkgs, flake-utils, ... }@inputs: {
colmena = let colmena = let
hosts = [ "web-dus" "crime" "ryuuko" "lain" "seras" ]; hosts = builtins.attrNames (nixpkgs.lib.filterAttrs (name: type: type == "directory") (builtins.readDir ./config/hosts));
hostCfg = hostname: { hostCfg = hostname: {
imports = [ (./config/hosts/${hostname}/configuration.nix) ]; imports = [ (./config/hosts/${hostname}/configuration.nix) ];
}; };
@ -42,7 +46,7 @@
}; };
specialArgs = { inherit inputs; }; specialArgs = { inherit inputs; };
}; };
} // (builtins.listToAttrs (builtins.map (hosts: nixpkgs.lib.attrsets.nameValuePair hosts (hostCfg hosts)) hosts)); } // nixpkgs.lib.attrsets.genAttrs hosts (hostCfg);
nixosConfigurations = { nixosConfigurations = {
ryuuko = nixpkgs.lib.nixosSystem { ryuuko = nixpkgs.lib.nixosSystem {