From d471aa77f9d3028eb4eb5028913c26b2b6f57ee2 Mon Sep 17 00:00:00 2001 From: Kenryu Shibata Date: Wed, 7 Jan 2026 01:42:09 +0900 Subject: [PATCH] update --- assets/README.md | 4 +- assets/default.nix | 4 +- assets/scripts/misskey.nix | 32 ++++++++ home/i3.nix | 73 ++++++++++++++++++- hosts/alanturing/default.nix | 27 +++++++ hosts/default.nix | 20 +++-- hosts/virtual-bird/default.nix | 2 +- hosts/virtual-bird/hardware-configuration.nix | 6 +- 8 files changed, 151 insertions(+), 17 deletions(-) create mode 100644 assets/scripts/misskey.nix create mode 100644 hosts/alanturing/default.nix diff --git a/assets/README.md b/assets/README.md index f39bd28..46ac19f 100644 --- a/assets/README.md +++ b/assets/README.md @@ -1,7 +1,7 @@ # Static Assets for ricing -All of stuff(Wallpapers, etc.) packaged in single nix deriv. +All of stuff(Wallpapers, Scripts, etc.) packaged in single nix deriv. -## Sources +## Wallpaper Sources * `` diff --git a/assets/default.nix b/assets/default.nix index d324bf7..28d55c8 100644 --- a/assets/default.nix +++ b/assets/default.nix @@ -2,7 +2,7 @@ stdenv.mkDerivation { name = "ricing-assets"; src = ./.; installPhase = '' - mkdir -p $out/share/wallpapers - cp -r wallpapers/ $out/share/wallpapers + mkdir -p $out/usr/local/share/wallpapers + cp -r wallpapers/ $out/usr/local/share/wallpapers ''; } diff --git a/assets/scripts/misskey.nix b/assets/scripts/misskey.nix new file mode 100644 index 0000000..eb29a84 --- /dev/null +++ b/assets/scripts/misskey.nix @@ -0,0 +1,32 @@ +{ config, pkgs, ... }: +let + getLatestN = writeShellApplication { + name = "misskey-getLatestN"; + runtimeInputs = [ + curl + jq + ]; + text = '' + if [[ -a /tmp/${config.networking.hostName}/misskey-scripts/getLatestN.fifo ]]; then + mkdir -p /tmp/${config.networking.hostName}/misskey-scripts + mkfifo /tmp/${config.networking.hostName}/misskey-scripts/getLatestN.fifo + fi + + pipeLocation=/tmp/${config.networking.hostName}/misskey-scripts/getLatestN.fifo + + curl https://misskey.io/api/notes -s --request POST --header 'Content-Type: application/json' --data '{"local": true, "reply": false, "renote": false, "withFiles": false, "poll": false, "limit": $1}' > "$pipeLocation" & + + echo "$(jq -M -r '.[].text' < $pipeLocation)" > $pipeLocation & + + while read line; do + echo "$line" + done < $pipeLocation + wait + ''; + }; + +in +pkgs.symlinkJoin { + name = "misskey-scripts"; + paths = [ getLatestN ]; +} diff --git a/home/i3.nix b/home/i3.nix index 1af6d6f..e9a774c 100644 --- a/home/i3.nix +++ b/home/i3.nix @@ -10,6 +10,72 @@ let EXIT = "i3-nagbar -t warning -m 'Exit i3?' -B 'Yes' 'i3-msg exit'"; in { + programs.i3status = { + enable = true; + general = { + output_format = "i3bar"; + interval = 1; + colors = true; + color_separator = "#FFFFFF"; + color_good = "#00FF00"; + color_degraded = "#00FFFF"; + color_bad = "#FF0000"; + separator = "][" + }; + modules = { + "time" = { + position = 1; + settings = { + format = "%Y %m/%d %a | %H:%M:%S"; + }; + }; + "load" = { + position = 2; + settings = { + format = "LD %1min:%5min:%15min"; + format_above_threshold = "LD H (%1min:%5min)"; + max_threshold = "0.9"; + }; + }; + "memory" = { + position = 3; + settings = { + memory_used_method = "classical"; + decimals = "1"; + unit = "Mi"; + format = "%available (%used) / %total"; + format = "Mem LOW (%available)" + threshold_degraded = "10%"; + threshold_critical = "6.25%"; + }; + }; + "disk /" = { + position = 4; + settings = { + prefix_type = "decimal"; + format = "/ %percentage_used" + }; + }; + "volume master" = { + position = 5; + settings = { + format = "Vol: %volume"; + format_muted = "Vol: Muted (%volume)"; + device = "pulse:1"; + }; + }; + "wireless _first_" = { + position = 6; + settings = { + format_up = "W: (%quality @ %essid w/ %bitrate) %ip"; + format_down = "W: down"; + format_bitrate = "%g %cb/s"; + format_quality = "%03d%s"; + }; + }; + }; + }; + xsession.windowManager.i3 = { enable = true; config = { @@ -17,6 +83,11 @@ in menu = MENU; terminal = TERM; workspaceLayout = "tabbed"; + gamps = { + smartBorders = true; + smartGaps = true; + inner = 10; + }; modes = { resize = { "${UP}" = "resize shrink height 10 px or 10 ppt"; @@ -76,5 +147,5 @@ in }; }; }; - } + diff --git a/hosts/alanturing/default.nix b/hosts/alanturing/default.nix new file mode 100644 index 0000000..db9efc3 --- /dev/null +++ b/hosts/alanturing/default.nix @@ -0,0 +1,27 @@ +{ config, lib, pkgs, ... }: + +{ + imports = + [ + ./hardware-configuration.nix + ../../profiles/base.nix + ../../profiles/desktop.nix + ]; + + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + + services.desktopManager.plasma6.enable = true; + + environment.systemPackages = with pkgs; [ + vim + tmux + ]; + + networking.hostName = "alanturing"; + networking.firewall.enable = true; + + system.stateVersion = "25.11"; + +} + diff --git a/hosts/default.nix b/hosts/default.nix index b9bff7d..db6f2ec 100644 --- a/hosts/default.nix +++ b/hosts/default.nix @@ -3,22 +3,24 @@ let inherit (self) inputs; common-intel = inputs.nixos-hardware.nixosModules.common-cpu-intel; + common-nvidia = inputs.nixos-hardware.nixosModules.common-gpu-nvidia-nonprime; framework16 = inputs.nixos-hardware.nixosModules.framework-16-7040-amd; - # mkHost - String -> Boolean -> Attr -> Attr - Create nixos system attributes + # mkHost - String -> Boolean -> [Attr] -> Attr - Create nixos system attribute set # @param name - String - Name of the system - # @param isDesktop - Boolean - If set true, adds xlibre overlays to modules - # @param machine - Attr - Attribute from nixos-hardware nixos Module for setting machine's preset - mkHost = name: isDesktop: machine: + # @param useXLibre - Boolean - If set true, adds xlibre overlays to modules + # @param machine - [Attr] - Array of attribute sets from nixos-hardware nixos Module for setting machine's preset + # @return - An attribute set that describes NixOS system configurations + + mkHost = name: useXLibre: machine: nixpkgs.lib.nixosSystem { modules = [ ./${name} ../overlays - machine - ] ++ builtins.attrValues self.nixosModules ++ (if isDesktop then [ + ] ++ builtins.attrValues self.nixosModules ++ (if useXLibre then [ inputs.xlibre-overlay.nixosModules.overlay-xlibre-xserver inputs.xlibre-overlay.nixosModules.overlay-all-xlibre-drivers - ] else []); + ] else []) ++ machine; specialArgs = { inherit inputs; @@ -26,5 +28,7 @@ let }; in { - "virtual-bird" = mkHost "virtual-bird" true common-intel; + "virtual-bird" = mkHost "virtual-bird" true [ common-intel ]; + "alanturing" = mkHost "alanturing" true [ common-intel common-nvidia ]; + "waku" = mkHost "waku" true [ framework16 ]; } diff --git a/hosts/virtual-bird/default.nix b/hosts/virtual-bird/default.nix index 568b798..17c41f1 100644 --- a/hosts/virtual-bird/default.nix +++ b/hosts/virtual-bird/default.nix @@ -23,7 +23,7 @@ networking.hostName = "virtual-bird"; networking.firewall.enable = true; - system.stateVersion = "25.11"; # Did you read the comment? + system.stateVersion = "25.11"; } diff --git a/hosts/virtual-bird/hardware-configuration.nix b/hosts/virtual-bird/hardware-configuration.nix index 74132b8..f577c23 100644 --- a/hosts/virtual-bird/hardware-configuration.nix +++ b/hosts/virtual-bird/hardware-configuration.nix @@ -14,18 +14,18 @@ boot.extraModulePackages = [ ]; fileSystems."/" = - { device = "/dev/disk/by-uuid/9705a174-c3ce-44f0-98eb-48d801e91cde"; + { device = "/dev/disk/by-label/NIXOS"; fsType = "ext4"; }; fileSystems."/boot" = - { device = "/dev/disk/by-uuid/3351-CE12"; + { device = "/dev/disk/by-label/EFI"; fsType = "vfat"; options = [ "fmask=0077" "dmask=0077" ]; }; swapDevices = - [ { device = "/dev/disk/by-uuid/2bf99498-58e9-429d-9636-115c8c06316a"; } + [ { device = "/dev/disk/by-label/SWAP"; } ]; nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";