diff --git a/.gitignore b/.gitignore index 812980f..d132e40 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ /result /.env +/claude-docker diff --git a/default-configurations/gitignore b/default-configurations/gitignore index 5afd477..959ff33 100644 --- a/default-configurations/gitignore +++ b/default-configurations/gitignore @@ -11,15 +11,21 @@ # build related directories /build target +result zig-out zig-build # secrets .env +# direnv +.envrc +.direnv + # py __pycache__/ .pytest_cache .mypy_cache .ruff_cache .coverage* +core.[0-9]* diff --git a/flake.lock b/flake.lock index f5cc9bc..f53a159 100644 --- a/flake.lock +++ b/flake.lock @@ -68,17 +68,17 @@ "systems": "systems" }, "locked": { - "lastModified": 1746476573, - "narHash": "sha256-n8492bBXn4GY7JHzgIB1LvCTCr9EkWQW+3zVHjS6B9Y=", + "lastModified": 1770489230, + "narHash": "sha256-qFcJSENXS9GtBFLpFiVaY6WTmWqt6BarVHcT4uUSAKc=", "owner": "kp2pml30", "repo": "kp2pml30.github.io", - "rev": "0babadc3ebeddc96dbe84a90f3d36117c5e942a4", + "rev": "c70b7cc290dc4ca341d791fe952ea5e5e2e36e1b", "type": "github" }, "original": { "owner": "kp2pml30", "repo": "kp2pml30.github.io", - "rev": "0babadc3ebeddc96dbe84a90f3d36117c5e942a4", + "rev": "c70b7cc290dc4ca341d791fe952ea5e5e2e36e1b", "type": "github" } }, @@ -158,16 +158,16 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1761999846, - "narHash": "sha256-IYlYnp4O4dzEpL77BD/lj5NnJy2J8qbHkNSFiPBCbqo=", + "lastModified": 1770056022, + "narHash": "sha256-yvCz+Qmci1bVucXEyac3TdoSPMtjqVJmVy5wro6j/70=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "3de8f8d73e35724bf9abef41f1bdbedda1e14a31", + "rev": "d04d8548aed39902419f14a8537006426dc1e4fa", "type": "github" }, "original": { "owner": "NixOS", - "ref": "nixos-25.05", + "ref": "nixos-25.11", "repo": "nixpkgs", "type": "github" } diff --git a/flake.nix b/flake.nix index d0929d6..4169978 100644 --- a/flake.nix +++ b/flake.nix @@ -1,6 +1,6 @@ { inputs = { - nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.05"; + nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.11"; nixos-wsl = { url = "github:nix-community/NixOS-WSL/main"; inputs.nixpkgs.follows = "nixpkgs"; @@ -19,7 +19,7 @@ #}; kp2pml30-moe = { - url = "github:kp2pml30/kp2pml30.github.io/0babadc3ebeddc96dbe84a90f3d36117c5e942a4"; + url = "github:kp2pml30/kp2pml30.github.io/c70b7cc290dc4ca341d791fe952ea5e5e2e36e1b"; inputs.nixpkgs.follows = "nixpkgs"; }; }; @@ -31,6 +31,12 @@ lib = nixpkgs.lib; in { + packages.x86_64-linux.docker-nix-node = import ./nix/docker-images/nix-node.nix { + pkgs = import nixpkgs { system = "x86_64-linux"; }; + inherit lib; + rootPath = self; + }; + nixosConfigurations = { server = nixpkgs.lib.nixosSystem { system = "x86_64-linux"; @@ -64,12 +70,15 @@ personal-pc = nixpkgs.lib.nixosSystem rec { system = "x86_64-linux"; modules = [ - { + ({ pkgs, ...}: { networking.hostName = "kp2pml30-personal-pc"; networking.hostId = "e31a5cc2"; time.timeZone = "Asia/Tokyo"; - } + environment.systemPackages = [ + # pkgs.claude-code + ]; + }) ./nix/hardware/mini.nix diff --git a/home/.config/awesome/rc.lua b/home/.config/awesome/rc.lua index b947707..106e4d0 100644 --- a/home/.config/awesome/rc.lua +++ b/home/.config/awesome/rc.lua @@ -199,6 +199,15 @@ local function screen_delta(delta) if tag == nil then return end + local other_tag = nil + + for _, some_tag in ipairs(cur_screen.tags) do + if some_tag ~= tag then + other_tag = some_tag + break + end + end + local all_screens = {} local i = 0 local idx = 0 @@ -214,6 +223,11 @@ local function screen_delta(delta) local next_screen = all_screens[(idx + delta + i) % i] tag.screen = next_screen + next_screen.selected_tag = tag + + if other_tag ~= nil then + cur_screen.selected_tag = other_tag + end end awful.screen.connect_for_each_screen(function(s) @@ -349,10 +363,6 @@ globalkeys = gears.table.join( {description = "increase the number of columns", group = "layout"}), awful.key({ modkey, "Control" }, "l", function () awful.tag.incncol(-1, nil, true) end, {description = "decrease the number of columns", group = "layout"}), - awful.key({ modkey, }, "space", function () awful.layout.inc( 1) end, - {description = "select next", group = "layout"}), - awful.key({ modkey, "Shift" }, "space", function () awful.layout.inc(-1) end, - {description = "select previous", group = "layout"}), awful.key({ modkey, "Control" }, "n", function () diff --git a/nix/docker-images/nix-node.nix b/nix/docker-images/nix-node.nix new file mode 100644 index 0000000..18e3537 --- /dev/null +++ b/nix/docker-images/nix-node.nix @@ -0,0 +1,113 @@ +{ pkgs, lib, rootPath }: +let + user = "devuser"; + uid = "1000"; + gid = "1000"; + + baseVim = rootPath + "/home/.config/nvim/base.vim"; + + fromGitHub = rev: repo: pkgs.vimUtils.buildVimPlugin { + pname = "${lib.strings.sanitizeDerivationName repo}"; + version = rev; + src = builtins.fetchGit { + url = "https://github.com/${repo}.git"; + inherit rev; + }; + }; + + customNeovim = pkgs.neovim.override { + configure = { + customRC = builtins.readFile baseVim; + packages.myPlugins = with pkgs.vimPlugins; { + start = [ + nvim-treesitter.withAllGrammars + nvim-autopairs + nerdtree + tokyonight-nvim + barbar-nvim + ((fromGitHub "3587f57480b88e8009df7b36dc84e9c7ff8f2c49" "famiu/feline.nvim").overrideAttrs (old: { + doCheck = false; + })) + (fromGitHub "d63c811337b2f75de52f16efee176695f31e7fbc" "timakro/vim-yadi") + (fromGitHub "aafa5c187a15701a7299a392b907ec15d9a7075f" "nvim-tree/nvim-web-devicons") + ]; + }; + }; + }; + + # Create passwd/group/shadow as a package + userSetup = pkgs.runCommand "user-setup" {} '' + mkdir -p $out/etc + echo "root:x:0:0:root:/root:/bin/bash" > $out/etc/passwd + echo "${user}:x:${uid}:${gid}:${user}:/home/${user}:${pkgs.bash}/bin/bash" >> $out/etc/passwd + + echo "root:x:0:" > $out/etc/group + echo "${user}:x:${gid}:" >> $out/etc/group + + echo "root:!:1::::::" > $out/etc/shadow + echo "${user}:!:1::::::" >> $out/etc/shadow + + mkdir -p $out/etc/nix + cat > $out/etc/nix/nix.conf < $out/etc/sudoers.d/${user} + chmod 440 $out/etc/sudoers.d/${user} + + mkdir -p $out/tmp + chmod 1777 $out/tmp + ''; + + entrypoint = pkgs.writeShellScriptBin "entrypoint" '' + if ! command -v claude &> /dev/null; then + echo "Installing claude-code..." + npm install -g @anthropic-ai/claude-code + fi + exec "$@" + ''; +in +pkgs.dockerTools.buildLayeredImage { + name = "nix-node"; + tag = "latest"; + contents = with pkgs; [ + nix + nodejs + bash + coreutils + cacert + git + fish + curl + wget + htop + sudo + customNeovim + userSetup + entrypoint + ]; + fakeRootCommands = '' + mkdir -p ./home/${user}/.npm-global + chown -R ${uid}:${gid} ./home/${user} + + mkdir -p ./usr/bin + ln -s ${pkgs.coreutils}/bin/env ./usr/bin/env + ''; + enableFakechroot = true; + config = { + Entrypoint = [ "${entrypoint}/bin/entrypoint" ]; + Cmd = [ "${pkgs.bash}/bin/bash" ]; + User = "${user}"; + WorkingDir = "/home/${user}"; + Env = [ + "HOME=/home/${user}" + "USER=${user}" + "NIX_PAGER=cat" + "SSL_CERT_FILE=${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt" + "NIX_CONF_DIR=/etc/nix" + "NPM_CONFIG_PREFIX=/home/${user}/.npm-global" + "PATH=/home/${user}/.npm-global/bin:/usr/bin:/bin" + ]; + }; +} diff --git a/nix/hardware/mini.nix b/nix/hardware/mini.nix index e8954bc..d2c3bde 100644 --- a/nix/hardware/mini.nix +++ b/nix/hardware/mini.nix @@ -7,7 +7,7 @@ { imports = [ ./common.nix - # ./nvidia.nix + ./nvidia.nix ]; fileSystems."/" = { @@ -37,6 +37,7 @@ environment.systemPackages = with pkgs; [ exfat + pciutils ]; hardware.cpu.amd.updateMicrocode = true; @@ -53,20 +54,22 @@ graphics = { enable = true; enable32Bit = true; + extraPackages = with pkgs; [ + ]; + + extraPackages32 = with pkgs; [ + ]; }; - amdgpu.amdvlk = { - enable = true; - support32Bit.enable = true; + + nvidia.prime = { + offload = { + enable = true; + enableOffloadCmd = true; + }; + nvidiaBusId = "PCI:5:0:0"; + amdgpuBusId = "PCI:198:0:0"; }; - - opengl.extraPackages = with pkgs; [ - amdvlk - ]; - - opengl.extraPackages32 = with pkgs; [ - driversi686Linux.amdvlk - ]; }; networking = { diff --git a/nix/hardware/nvidia.nix b/nix/hardware/nvidia.nix index bed6b44..7c9227e 100644 --- a/nix/hardware/nvidia.nix +++ b/nix/hardware/nvidia.nix @@ -8,9 +8,9 @@ services.xserver.videoDrivers = ["nvidia"]; hardware.nvidia = { - package = config.boot.kernelPackages.nvidiaPackages.production; + package = config.boot.kernelPackages.nvidiaPackages.beta; modesetting.enable = true; - open = false; + open = true; nvidiaSettings = true; }; } diff --git a/nix/hardware/server.nix b/nix/hardware/server.nix index 0645cbe..9f9a79b 100644 --- a/nix/hardware/server.nix +++ b/nix/hardware/server.nix @@ -42,12 +42,12 @@ services.qemuGuest.enable = true; networking = { - hostName = "v168671"; + hostName = "v633633"; interfaces.ens3.ipv4.addresses = [ { prefixLength = 24; - address = "185.121.233.63"; + address = "146.103.126.11"; } ]; - defaultGateway = "185.121.233.1"; + defaultGateway = "146.103.126.1"; nameservers = [ "1.1.1.1" "8.8.8.8" diff --git a/nix/personal/default.nix b/nix/personal/default.nix index 0d9afbe..3e3cf37 100644 --- a/nix/personal/default.nix +++ b/nix/personal/default.nix @@ -36,10 +36,10 @@ in { boot.supportedFilesystems = [ "zfs" ]; boot.zfs.forceImportRoot = false; - services.logind.extraConfig = '' - HandlePowerKey=poweroff - HandleLidSwitch=hibernate - ''; + services.logind.settings.Login = { + HandlePowerKey = "poweroff"; + HandleLidSwitch = "hibernate"; + }; services.pcscd = { enable = true; @@ -85,6 +85,7 @@ in { "discord" "slack" "anytype" + "claude-code" ]; }; } diff --git a/nix/personal/graphical/default.nix b/nix/personal/graphical/default.nix index cf24440..679a617 100644 --- a/nix/personal/graphical/default.nix +++ b/nix/personal/graphical/default.nix @@ -11,23 +11,41 @@ in { ./kitty.nix ./vscode.nix - ./opera.nix ./steam.nix ./messengers.nix ./messengers-work.nix ]; - environment.systemPackages = [ pkgs.anytype ]; + xdg.portal = { + enable = true; + extraPortals = [ pkgs.xdg-desktop-portal-gtk ]; + }; + services.flatpak.enable = true; + systemd.services.flatpak-repo = { + wantedBy = [ "multi-user.target" ]; + path = [ pkgs.flatpak ]; + script = '' + flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo + ''; + }; - fonts.enableDefaultFonts = true; + environment.systemPackages = with pkgs; [ + anytype + flatpak + gnome-software + + nodePackages.npm + nodejs + ]; + + fonts.enableDefaultPackages = true; fonts.packages = with pkgs; [ noto-fonts noto-fonts-cjk-sans noto-fonts-cjk-sans fira-code - fira-code-nerdfont fira-code-symbols nerd-fonts.fira-code diff --git a/nix/personal/graphical/messengers.nix b/nix/personal/graphical/messengers.nix index e1a2498..ee718bb 100644 --- a/nix/personal/graphical/messengers.nix +++ b/nix/personal/graphical/messengers.nix @@ -7,15 +7,9 @@ }: let cfg = config.kp2pml30; - signal-pkgs = import (builtins.fetchTarball { - url = "https://github.com/NixOS/nixpkgs/archive/71cbb752aa36854eb4a7deb3685b9789256d643c.tar.gz"; - sha256 = "10dnjv2c28bjgplyj6nbk2q9lng6f95jf75i5yh541zngrr8b2qg"; - }) { - system = pkgs.system; - }; in lib.mkIf cfg.messengers.personal { users.users.${cfg.username}.packages = with pkgs; [ discord telegram-desktop - ] ++ [signal-pkgs.signal-desktop]; + ]; } diff --git a/nix/personal/graphical/opera.nix b/nix/personal/graphical/opera.nix deleted file mode 100644 index 5c3caa9..0000000 --- a/nix/personal/graphical/opera.nix +++ /dev/null @@ -1,42 +0,0 @@ -{ pkgs -, lib -, rootPath -, config -, ... -}: -let - cfg = config.kp2pml30; - version = "123.0.5669.23"; - legacy-nixpkgs = import (builtins.fetchTarball { - url = "https://github.com/NixOS/nixpkgs/archive/refs/tags/24.11.tar.gz"; - sha256 = "1gx0hihb7kcddv5h0k7dysp2xhf1ny0aalxhjbpj2lmvj7h9g80a"; - }) { - system = pkgs.system; - config.allowUnfreePredicate = pkg: - builtins.elem (pkgs.lib.getName pkg) [ - "vscode" - "steam" - "steam-run" - "steam-original" - "steam-unwrapped" - "nvidia-x11" - "nvidia-settings" - "nvidia-persistenced" - "opera" - "discord" - "slack" - "anytype" - ]; - }; -in lib.mkIf cfg.opera { - home-manager.users.${cfg.username}.home = { - packages = with legacy-nixpkgs; [ - ((opera.override { proprietaryCodecs = true; }).overrideAttrs (finalAttrs: previousAttrs: { - src = fetchurl { - url = "https://get.geo.opera.com/pub/opera/desktop/${version}/linux/opera-stable_${version}_amd64.deb"; - hash = "sha256-j2kHdg8d60S9j3bLychjmH/cRAXHGIjOgGKqmNIhnHU="; - }; - })) - ]; - }; -} diff --git a/nix/personal/home.nix b/nix/personal/home.nix index 6fe5079..2151584 100644 --- a/nix/personal/home.nix +++ b/nix/personal/home.nix @@ -26,7 +26,8 @@ in { ]; sessionVariables = { - TERMINAL = "kitty"; + TERMINAL = "xterm-kitty"; + NPM_CONFIG_PREFIX = "$HOME/.local/share/npm-global"; }; activation = { diff --git a/nix/personal/tui.nix b/nix/personal/tui.nix index 2dc48d9..693d721 100644 --- a/nix/personal/tui.nix +++ b/nix/personal/tui.nix @@ -17,6 +17,7 @@ in { environment.systemPackages = with pkgs; [ ncdu timewarrior + p7zip ]; };