From a743f2c9438583d7e2c8564422253f64b16d8f0c Mon Sep 17 00:00:00 2001 From: Kenryu Shibata Date: Sun, 28 Dec 2025 14:48:30 +0900 Subject: [PATCH] started new config --- README.md | 3 + assets/README.md | 7 + assets/default.nix | 8 + flake.lock | 181 ++++++++++++++++++ flake.nix | 28 +++ home/cmd_tools.nix | 37 ++++ home/default.nix | 17 ++ home/i3.nix | 80 ++++++++ home/media.nix | 9 + home/tmux.nix | 14 ++ home/vim.nix | 25 +++ hosts/default.nix | 30 +++ hosts/virtual-bird/default.nix | 29 +++ hosts/virtual-bird/hardware-configuration.nix | 32 ++++ overlays/default.nix | 4 + profiles/base.nix | 109 +++++++++++ profiles/desktop.nix | 48 +++++ 17 files changed, 661 insertions(+) create mode 100644 README.md create mode 100644 assets/README.md create mode 100644 assets/default.nix create mode 100644 flake.lock create mode 100644 flake.nix create mode 100644 home/cmd_tools.nix create mode 100644 home/default.nix create mode 100644 home/i3.nix create mode 100644 home/media.nix create mode 100644 home/tmux.nix create mode 100644 home/vim.nix create mode 100644 hosts/default.nix create mode 100644 hosts/virtual-bird/default.nix create mode 100644 hosts/virtual-bird/hardware-configuration.nix create mode 100644 overlays/default.nix create mode 100644 profiles/base.nix create mode 100644 profiles/desktop.nix diff --git a/README.md b/README.md new file mode 100644 index 0000000..5d971ba --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# NixOS Config flake + + diff --git a/assets/README.md b/assets/README.md new file mode 100644 index 0000000..f39bd28 --- /dev/null +++ b/assets/README.md @@ -0,0 +1,7 @@ +# Static Assets for ricing + +All of stuff(Wallpapers, etc.) packaged in single nix deriv. + +## Sources + +* `` diff --git a/assets/default.nix b/assets/default.nix new file mode 100644 index 0000000..d324bf7 --- /dev/null +++ b/assets/default.nix @@ -0,0 +1,8 @@ +stdenv.mkDerivation { + name = "ricing-assets"; + src = ./.; + installPhase = '' + mkdir -p $out/share/wallpapers + cp -r wallpapers/ $out/share/wallpapers + ''; +} diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..8fcb1f3 --- /dev/null +++ b/flake.lock @@ -0,0 +1,181 @@ +{ + "nodes": { + "fetchurl-sources": { + "flake": false, + "locked": { + "path": "./consumer-overridable/fetchurl-sources.nix", + "type": "path" + }, + "original": { + "path": "./consumer-overridable/fetchurl-sources.nix", + "type": "path" + }, + "parent": [ + "xlibre-overlay" + ] + }, + "flake-parts": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib" + }, + "locked": { + "lastModified": 1762980239, + "narHash": "sha256-8oNVE8TrD19ulHinjaqONf9QWCKK+w4url56cdStMpM=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "52a2caecc898d0b46b2b905f058ccc5081f842da", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "home-manager": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1766553861, + "narHash": "sha256-ZbnG01yA3O8Yr1vUm3+NQ2qk9iRhS5bloAnuXHHy7+c=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "0999ed8f965bbbd991437ad9c5ed3434cecbc30e", + "type": "github" + }, + "original": { + "owner": "nix-community", + "ref": "release-25.11", + "repo": "home-manager", + "type": "github" + } + }, + "nixos-hardware": { + "locked": { + "lastModified": 1766568855, + "narHash": "sha256-UXVtN77D7pzKmzOotFTStgZBqpOcf8cO95FcupWp4Zo=", + "owner": "NixOS", + "repo": "nixos-hardware", + "rev": "c5db9569ac9cc70929c268ac461f4003e3e5ca80", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "master", + "repo": "nixos-hardware", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1766622938, + "narHash": "sha256-Eovt/DOCYjFFBZuYbbG9j5jhklzxdNbUGVYYxh3lG3s=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "5900a0a8850cbba98e16d5a7a6ed389402dfcf4f", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-25.11", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-lib": { + "locked": { + "lastModified": 1761765539, + "narHash": "sha256-b0yj6kfvO8ApcSE+QmA6mUfu8IYG6/uU28OFn4PaC8M=", + "owner": "nix-community", + "repo": "nixpkgs.lib", + "rev": "719359f4562934ae99f5443f20aa06c2ffff91fc", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixpkgs.lib", + "type": "github" + } + }, + "root": { + "inputs": { + "home-manager": "home-manager", + "nixos-hardware": "nixos-hardware", + "nixpkgs": "nixpkgs", + "xlibre-overlay": "xlibre-overlay" + } + }, + "systems": { + "flake": false, + "locked": { + "path": "./systems.nix", + "type": "path" + }, + "original": { + "path": "./systems.nix", + "type": "path" + }, + "parent": [ + "xlibre-overlay" + ] + }, + "xlibre-drivers-overlay-choice": { + "flake": false, + "locked": { + "path": "./consumer-overridable/drivers-overlay-choice.nix", + "type": "path" + }, + "original": { + "path": "./consumer-overridable/drivers-overlay-choice.nix", + "type": "path" + }, + "parent": [ + "xlibre-overlay" + ] + }, + "xlibre-overlay": { + "inputs": { + "fetchurl-sources": "fetchurl-sources", + "flake-parts": "flake-parts", + "nixpkgs": [ + "nixpkgs" + ], + "systems": "systems", + "xlibre-drivers-overlay-choice": "xlibre-drivers-overlay-choice", + "xserver-meson-flags": "xserver-meson-flags" + }, + "locked": { + "lastModified": 1766204441, + "narHash": "sha256-CKoWqMDv7O81q6v6RTUGfMilx5aulOCw+HHdtkJM1qc=", + "ref": "refs/heads/main", + "rev": "bb35b081bb7256cbafb1c53c911985d86f51da04", + "revCount": 140, + "type": "git", + "url": "https://codeberg.org/takagemacoed/xlibre-overlay" + }, + "original": { + "type": "git", + "url": "https://codeberg.org/takagemacoed/xlibre-overlay" + } + }, + "xserver-meson-flags": { + "flake": false, + "locked": { + "path": "./consumer-overridable/xserver-meson-flags.nix", + "type": "path" + }, + "original": { + "path": "./consumer-overridable/xserver-meson-flags.nix", + "type": "path" + }, + "parent": [ + "xlibre-overlay" + ] + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..693635d --- /dev/null +++ b/flake.nix @@ -0,0 +1,28 @@ +{ + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.11"; + nixos-hardware.url = "github:NixOS/nixos-hardware/master"; + home-manager = { + url = "github:nix-community/home-manager/release-25.11"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + xlibre-overlay = { + url = "git+https://codeberg.org/takagemacoed/xlibre-overlay"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + }; + outputs = inputs@{ self, nixpkgs, ... }: { + nixosModules = { + hm = inputs.home-manager.nixosModules.home-manager; + hmConfig = { + home-manager = { + useGlobalPkgs = true; + useUserPackages = true; + users."bitbang" = ./home/default.nix; + }; + }; + }; + nixosConfigurations = import ./hosts inputs; + }; +} + diff --git a/home/cmd_tools.nix b/home/cmd_tools.nix new file mode 100644 index 0000000..ccc8a6d --- /dev/null +++ b/home/cmd_tools.nix @@ -0,0 +1,37 @@ +{ config, pkgs, lib, ... }: +{ + programs.eza = { + enable = true; + git = true; + icons = "always"; + enableZshIntegration = true; + }; + + programs.fzf = { + enable = true; + enableZshIntegration = true; + tmux.enableShellIntegration = true; + }; + + programs.bat = { + enable = true; + config = { + tabs = "4"; + wrap = "character"; + italic-text = "never"; + theme = "ansi"; + }; + }; + + programs.zoxide = { + enable = true; + enableZshIntegration = true; + options = [ + "--cmd cd" + ]; + }; + + programs.gitui = { + enable = true; + }; +} diff --git a/home/default.nix b/home/default.nix new file mode 100644 index 0000000..8d11cee --- /dev/null +++ b/home/default.nix @@ -0,0 +1,17 @@ +{ config, pkgs, lib, ... }: +let + name = "bitbang"; +in +{ + imports = [ + ./i3.nix + ./vim.nix + ]; + + home = { + username = name; + homeDirectory = "/home/${name}"; + + stateVersion = "25.11"; + }; +} diff --git a/home/i3.nix b/home/i3.nix new file mode 100644 index 0000000..1af6d6f --- /dev/null +++ b/home/i3.nix @@ -0,0 +1,80 @@ +{ config, pkgs, lib, ... }: +let + modKey = "Mod1"; + UP = "k"; + DOWN = "j"; + LEFT = "h"; + RIGHT = "l"; + MENU = "rofi -show drun"; + TERM = "alacritty"; + EXIT = "i3-nagbar -t warning -m 'Exit i3?' -B 'Yes' 'i3-msg exit'"; +in +{ + xsession.windowManager.i3 = { + enable = true; + config = { + modifier = modKey; + menu = MENU; + terminal = TERM; + workspaceLayout = "tabbed"; + modes = { + resize = { + "${UP}" = "resize shrink height 10 px or 10 ppt"; + "${DOWN}" = "resize grow height 10 px or 10 ppt"; + "${LEFT}" = "resize shrink width 10 px or 10 ppt"; + "${RIGHT}" = "resize grow width 10 px or 10 ppt"; + Escape = "mode default"; + }; + }; + keybindings = { + "${modKey}+Return" = "exec ${TERM}"; + "${modKey}+d" = "exec ${MENU}"; + "${modKey}+Shift+q" = "kill"; + "${modKey}+${LEFT}" = "focus left"; + "${modKey}+${RIGHT}" = "focus right"; + "${modKey}+${UP}" = "focus up"; + "${modKey}+${DOWN}" = "focus down"; + "${modKey}+Shift+${LEFT}" = "move left"; + "${modKey}+Shift+${RIGHT}" = "move right"; + "${modKey}+Shift+${UP}" = "move up"; + "${modKey}+Shift+${DOWN}" = "move down"; + "${modKey}+y" = "split h"; + "${modKey}+t" = "split v"; + "${modKey}+f" = "fullscreen toggle"; + "${modKey}+s" = "layout stacking"; + "${modKey}+w" = "layout tabbed"; + "${modKey}+e" = "layout split"; + "${modKey}+Shift+space" = "floating toggle"; + "${modKey}+space" = "focus mode_toggle"; + "${modKey}+Shift+minus" = "move scratchpad"; + "${modKey}+n" = "workspace next"; + "${modKey}+p" = "workspace prev"; + "${modKey}+Shift+c" = "reload"; + "${modKey}+Shift+r" = "restart"; + "${modKey}+Shift+e" = "exec ${EXIT}"; + "${modKey}+r" = "mode resize"; + "${modKey}+1" = ''workspace number "1"''; + "${modKey}+2" = ''workspace number "2"''; + "${modKey}+3" = ''workspace number "3"''; + "${modKey}+4" = ''workspace number "4"''; + "${modKey}+5" = ''workspace number "5"''; + "${modKey}+6" = ''workspace number "6"''; + "${modKey}+7" = ''workspace number "7"''; + "${modKey}+8" = ''workspace number "8"''; + "${modKey}+9" = ''workspace number "9"''; + "${modKey}+0" = ''workspace number "10"''; + "${modKey}+Shift+1" = ''move container to workspace number "1"''; + "${modKey}+Shift+2" = ''move container to workspace number "2"''; + "${modKey}+Shift+3" = ''move container to workspace number "3"''; + "${modKey}+Shift+4" = ''move container to workspace number "4"''; + "${modKey}+Shift+5" = ''move container to workspace number "5"''; + "${modKey}+Shift+6" = ''move container to workspace number "6"''; + "${modKey}+Shift+7" = ''move container to workspace number "7"''; + "${modKey}+Shift+8" = ''move container to workspace number "8"''; + "${modKey}+Shift+9" = ''move container to workspace number "9"''; + "${modKey}+Shift+0" = ''move container to workspace number "10"''; + }; + }; + }; + +} diff --git a/home/media.nix b/home/media.nix new file mode 100644 index 0000000..2b1f08c --- /dev/null +++ b/home/media.nix @@ -0,0 +1,9 @@ +{ config, lib, pkgs, ... }: +{ + environment.systemPackages = with pkgs; [ + mpv + vlc + ffmpeg + kdenlive + ]; +} diff --git a/home/tmux.nix b/home/tmux.nix new file mode 100644 index 0000000..4fc2824 --- /dev/null +++ b/home/tmux.nix @@ -0,0 +1,14 @@ +{ config, pkgs, lib, ... }: +{ + programs.tmux = { + enable = true; + clock24 = true; + keyMode = "vi"; + newSession = true; + historyLimit = 10000; + baseIndex = 1; + disableConfirmationPrompt = false; + customPaneNavigationAndResize = true; + terminal = "tmux-direct"; + }; +} diff --git a/home/vim.nix b/home/vim.nix new file mode 100644 index 0000000..5f937c3 --- /dev/null +++ b/home/vim.nix @@ -0,0 +1,25 @@ +{ config, pkgs, lib, ... }: +{ + programs.vim.enable = true; + + programs.vim.settings = { + expandtab = true; + shiftwidth = 4; + tabstop = 4; + history = 128; + ignorecase = true; + smartcase = true; + number = true; + relativenumber = true; + }; + + programs.vim.extraConfig = '' + set encoding=utf-8 + set fileencodings=utf-8,euc-jp,sjis + set autoindent + set smartindent + set wrap + set incsearch + syntax enable + ''; +} diff --git a/hosts/default.nix b/hosts/default.nix new file mode 100644 index 0000000..b9bff7d --- /dev/null +++ b/hosts/default.nix @@ -0,0 +1,30 @@ +{ self, nixpkgs, ... }: +let + inherit (self) inputs; + + common-intel = inputs.nixos-hardware.nixosModules.common-cpu-intel; + framework16 = inputs.nixos-hardware.nixosModules.framework-16-7040-amd; + + # mkHost - String -> Boolean -> Attr -> Attr - Create nixos system attributes + # @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: + nixpkgs.lib.nixosSystem { + modules = [ + ./${name} + ../overlays + machine + ] ++ builtins.attrValues self.nixosModules ++ (if isDesktop then [ + inputs.xlibre-overlay.nixosModules.overlay-xlibre-xserver + inputs.xlibre-overlay.nixosModules.overlay-all-xlibre-drivers + ] else []); + + specialArgs = { + inherit inputs; + }; + }; +in +{ + "virtual-bird" = mkHost "virtual-bird" true common-intel; +} diff --git a/hosts/virtual-bird/default.nix b/hosts/virtual-bird/default.nix new file mode 100644 index 0000000..568b798 --- /dev/null +++ b/hosts/virtual-bird/default.nix @@ -0,0 +1,29 @@ +{ 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.xserver.windowManager.i3.enable = true; + + environment.systemPackages = with pkgs; [ + rofi + dunst + vim + tmux + ]; + + networking.hostName = "virtual-bird"; + networking.firewall.enable = true; + + system.stateVersion = "25.11"; # Did you read the comment? + +} + diff --git a/hosts/virtual-bird/hardware-configuration.nix b/hosts/virtual-bird/hardware-configuration.nix new file mode 100644 index 0000000..74132b8 --- /dev/null +++ b/hosts/virtual-bird/hardware-configuration.nix @@ -0,0 +1,32 @@ +# Do not modify this file! It was generated by ‘nixos-generate-config’ +# and may be overwritten by future invocations. Please make changes +# to /etc/nixos/configuration.nix instead. +{ config, lib, pkgs, modulesPath, ... }: + +{ + imports = + [ (modulesPath + "/profiles/qemu-guest.nix") + ]; + + boot.initrd.availableKernelModules = [ "ata_piix" "uhci_hcd" "ehci_pci" "ahci" "virtio_pci" "sr_mod" "virtio_blk" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/9705a174-c3ce-44f0-98eb-48d801e91cde"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/3351-CE12"; + fsType = "vfat"; + options = [ "fmask=0077" "dmask=0077" ]; + }; + + swapDevices = + [ { device = "/dev/disk/by-uuid/2bf99498-58e9-429d-9636-115c8c06316a"; } + ]; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; +} diff --git a/overlays/default.nix b/overlays/default.nix new file mode 100644 index 0000000..051fb4b --- /dev/null +++ b/overlays/default.nix @@ -0,0 +1,4 @@ +{ config, pkgs, lib, ... }: +{ + nixpkgs.overlays = []; +} diff --git a/profiles/base.nix b/profiles/base.nix new file mode 100644 index 0000000..561a74e --- /dev/null +++ b/profiles/base.nix @@ -0,0 +1,109 @@ +{ config, lib, pkgs, ... }: +{ + networking.networkmanager.enable = lib.mkDefault true; + time.timeZone = "Asia/Tokyo"; + + i18n = { + defaultLocale = "en_US.UTF-8"; + defaultCharset = "UTF-8"; + extraLocales = [ + "ja_JP.UTF-8/UTF-8" + "ja_JP.EUC-JP/EUC-JP" + ]; + }; + + services.pipewire = { + enable = true; + pulse.enable = true; + }; + + services.openssh = { + enable = true; + }; + + programs.mtr.enable = true; + programs.gnupg = { + agent = { + enable = true; + enableSSHSupport = true; + }; + }; + + hardware.gpgSmartcards.enable = true; + + users.users.bitbang = { + isNormalUser = true; + extraGroups = [ "wheel" "video" "audio" "nix" "dialout" "networkmanager" ]; + }; + + programs.zoxide = { + enable = true; + enableBashIntegration = false; + enableZshIntegration = true; + }; + + programs.tmux = { + enable = true; + clock24 = true; + baseIndex = 1; + keyMode = "vi"; + customPaneNavigationAndResize = true; + newSession = true; + historyLimit = 10000; + terminal = "tmux-direct"; + }; + + programs.bat = { + enable = true; + }; + + programs.nix-ld = { + enable = true; + libraries = with pkgs; [ + zlib + zstd + stdenv.cc.cc + curl + openssl + attr + libssh + bzip2 + libxml2 + acl + libsodium + util-linux + xz + systemd + ffmpeg + ]; + }; + + nix.gc = { + automatic = true; + dates = "monthly"; + persistent = true; + }; + + nix.settings = { + cores = 4; + sandbox = true; + allowed-users = [ "@wheel" ]; + trusted-users = [ "@wheel" ]; + log-lines = 50; + auto-optimise-store = true; + experimental-features = [ "nix-command" "flakes" ]; + substituters = [ + "https://cache.nixos.org" + ]; + accept-flake-config = true; + }; + + environment.systemPackages = with pkgs; [ + micro + wget + git + btop + fastfetch + stow + ]; +} diff --git a/profiles/desktop.nix b/profiles/desktop.nix new file mode 100644 index 0000000..4324227 --- /dev/null +++ b/profiles/desktop.nix @@ -0,0 +1,48 @@ +{ config, pkgs, lib, ... }: +{ + i18n.inputMethod = { + enable = true; + enableGtk3 = true; + enableGtk2 = true; + type = "fcitx5"; + fcitx5 = { + addons = with pkgs; [ + fcitx5-skk + ]; + }; + }; + + services.xserver = { + enable = true; + xkb = { + layout = "us"; + }; + resolutions = [ + { x = 1920; y = 1080; } + { x = 2560; y = 1600; } + ]; + dpi = 96; + displayManager.lightdm = { + enable = true; + greeters.gtk = { + enable = true; + }; + }; + }; + + services.libinput = { + enable = true; + touchpad = { + tapping = true; + scrollMethod = "twofinger"; + disableWhileTyping = true; + accelProfile = "flat"; + accelSpeed = "0.5"; + }; + }; + + environment.systemPackages = with pkgs; [ + alacritty + xfe + ]; +}