This commit is contained in:
Keisuke Hirata 2025-01-30 21:55:28 +09:00
commit d725ad06a7
22 changed files with 550 additions and 0 deletions

9
README.md Normal file
View File

@ -0,0 +1,9 @@
# Play.nix
my nixos configuration
## TODO
- [ ] More adjustments about uwsm and hyprland
- [ ] Setting up for uniform configuration for common applications
- [ ] Make it selectable for NixOS/Nix-darwin/Standalone

17
flake.nix Normal file
View File

@ -0,0 +1,17 @@
{
description = "my config flake";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
home-manager.url = "github:nix-community/home-manager";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
nixos-hardware.url = "github:NixOS/nixos-hardware";
};
outputs = inputs: {
nixosConfigurations = (import ./hosts inputs).nixos;
homeConfigurations = (import ./hosts inputs).home-manager;
};
}

9
home-manager/direnv.nix Normal file
View File

@ -0,0 +1,9 @@
{
programs = {
direnv = {
enable = true;
enableFishIntegration = true; # see note on other shells below
nix-direnv.enable = true;
};
};
}

196
home-manager/hyprland.nix Normal file
View File

@ -0,0 +1,196 @@
{
programs.kitty.enable = true;
wayland.windowManager.hyprland = {
enable = true;
systemd.enable = false;
settings = {
exec-once = [
# "/usr/lib/polkit-kde-authentication-agent-1"
# "dunst"
"swww-daemon"
"swww img ./backgrounds/arknights-02.jpg"
# "hypridle"
# "copyq --start-server"
# "wl-paste --type text --watch cliphist store"
# "wl-paste --type image --watch cliphist store"
"eww daemon"
"eww open bar"
"eww open roundedEdge"
"dconf write /org/gnome/desktop/interface/gtk-theme 'Adwaita Dark'"
"dconf write /org/gnome/desktop/interface/icon-theme 'Adwaita Dark'"
"dconf write /org/gnome/desktop/interface/document-font-name 'Noto Sans Medium 11'"
"dconf write /org/gnome/desktop/interface/font-name 'Noto Sans Medium 11'"
"dconf write /org/gnome/desktop/interface/monospace-font-name 'Noto Sans Mono Medium 11'"
];
input = {
kb_layout = "us";
kb_variant = "";
kb_model = "";
kb_options = "";
kb_rules = "";
follow_mouse = true;
touchpad = {
natural_scroll = true;
};
natural_scroll = true;
sensitivity = -1.0;
};
general = {
gaps_in = 8;
gaps_out = 10;
border_size = 4;
"col.active_border" = "rgba(6e848cee) rgba(ffffffee) 45deg";
"col.inactive_border" = "rgba(595959aa)";
layout = "dwindle";
allow_tearing = true;
};
decoration = {
rounding = 10;
blur = {
enabled = true;
size = 6;
passes = 2;
noise = 0.01;
contrast = 0.8;
brightness = 0.5;
vibrancy = 0.25;
vibrancy_darkness = 0.1;
};
shadow = {
enabled = false;
range = 4;
render_power = 3;
color = "rgba(1a1a1aee)";
};
dim_inactive = false;
};
animations = {
enabled = true;
animation = [
"windowsIn, 1, 1, default, popin 90%"
"windowsOut, 1, 100, default, popin 80%"
"windowsMove, 1, 3, default"
"border, 1, 10, default"
"borderangle, 1, 8, default"
"fade, 1, 7, default"
"workspaces, 1, 5, default, slidefade 10%"
];
};
dwindle = {
pseudotile = true;
preserve_split = true;
};
misc = {
force_default_wallpaper = false;
disable_hyprland_logo = false;
};
windowrulev2 = [
"animation windowsIn 0,title:^(.*wofi.*)$"
"float,title:^(.*feh.*)$"
"center,title:^(.*feh.*)$"
"float,title:^(Picture.*)$"
"pin,title:^(Picture.*)$"
"immediate, class:^(Terraria)$"
];
workspace = [
"1, monitor:DP-2, default:true"
"r[2-9], monitor:DP-2"
"name:sub, monitor:DP-1, default:true"
];
"$menu" = "uwsm app -- $(tofi-drun)";
"$terminal" = "kitty";
"$lock" = "hyprlock";
bindm = [
# Window Movement & Resizing
"SUPER, mouse:272, movewindow"
"SUPER, mouse:273, resizewindow"
];
bind =
[
# basic
"SUPER, return, exec, $menu"
"SUPER, E, exec, $terminal"
"SUPER, Q, killactive,"
"SUPER, L, exec, $lock"
"SUPER_SHIFT, M, exec, uwsm stop"
# prsc
", Print, exec, hyprshot -m window -m active --clipboard-only"
# Clipboard
"SUPER, C, exec, copyq show"
"SUPER, V, exec, clipman pick -t dmenu"
# Window navigation
"SUPER, F, fullscreen,"
"SUPER, Y, pin"
"SUPER, I, togglefloating,"
"SUPER, O, togglesplit," # dwindle
"SUPER, P, pseudo," # dwindle
# Window focus
"SUPER, mouse_down, cyclenext, next"
"SUPER, mouse_up, cyclenext, prev"
"SUPER, left, movefocus, l"
"SUPER, right, movefocus, r"
"SUPER, up, movefocus, u"
"SUPER, down, movefocus, d"
"SUPER_SHIFT, left, movewindow, l"
"SUPER_SHIFT, right, movewindow, r"
"SUPER_SHIFT, up, movewindow, u"
"SUPER_SHIFT, down, movewindow, d"
# workspaces
"SUPER, 1, workspace, 1"
"SUPER, 2, workspace, 2"
"SUPER, 3, workspace, 3"
"SUPER_CTRL, left, workspace, m-1"
"SUPER_CTRL, right, workspace, m+1"
"SUPER_CTRL_SHIFT, left, workspace, r-1"
"SUPER_CTRL_SHIFT, right, workspace, r+1"
]
++ (
# workspaces
# binds $mod + [shift +] {1..9} to [move to] workspace {1..9}
builtins.concatLists (
builtins.genList (
i:
let
ws = i + 1;
in
[
"SUPER, code:1${toString i}, workspace, ${toString ws}"
"SUPER SHIFT, code:1${toString i}, movetoworkspace, ${toString ws}"
]
) 9
)
);
};
};
home.sessionVariables = {
# HYPRCURSOR_THEME = "rose-pine-cursor-hyprcursor";
# HYPRCURSOR_SIZE = "24";
# XCURSOR_SIZE = "24";
# GTK_BACKEND = "wayland";
# QT_QPA_PLATFORM = "wayland;xcb";
# QT_QPA_PLATFORMTHEME = "qt5ct";
# XDG_SESSION_TYPE = "wayland";
# XDG_CURRENT_DESKTOP = "Hyprland";
# XDG_SESSION_DESKTOP = "Hyprland";
};
}

35
home-manager/tofi.nix Normal file
View File

@ -0,0 +1,35 @@
{
programs.tofi.enable = true;
programs.tofi.settings = {
history = true;
text-cursor = true;
text-cursor-style = "underscore";
text-cursor-corner-radius = 0;
auto-accept-single = true;
font = "monospace";
text-color = "#C8C093";
prompt-text = "˙˙ <";
prompt-padding = 20;
prompt-color = "#C8C093";
placeholder-text = "Hello, World!";
placeholder-color = "#49443C";
selection-color = "#76946A";
selection-match-color = "#98BB6C";
num-results = 0;
width = 1280;
height = 720;
result-spacing = 8;
background-color = "#1F1F28";
outline-width = 0;
outline-color = "#000000";
border-width = 6;
border-color = "#727169";
corner-radius = 50;
padding-top = 20;
padding-bottom = 20;
padding-left = 100;
padding-right = 100;
};
}

75
hosts/default.nix Normal file
View File

@ -0,0 +1,75 @@
inputs:
let
mkHost =
{
system,
hostname,
username,
systemModules,
homeModule,
}:
{
nixos = inputs.nixpkgs.lib.nixosSystem {
modules =
with inputs;
systemModules
++ [
{
users.users.${username} = {
isNormalUser = true;
description = "";
extraGroups = [
"networkmanager"
"wheel"
];
};
programs.git.enable = true;
}
];
inherit system;
specialArgs = {
inherit inputs hostname username;
};
};
home-manager = inputs.home-manager.lib.homeManagerConfiguration {
pkgs = import inputs.nixpkgs {
inherit system;
config.allowUnfree = true;
};
extraSpecialArgs = {
inherit inputs hostname username;
};
modules = homeModule ++ [
{
home = {
inherit username;
homeDirectory = "/home/${username}";
stateVersion = "24.11";
};
programs.home-manager.enable = true;
}
];
};
};
in
rec {
hosts = {
myNixOS = mkHost {
system = "x86_64-linux";
hostname = "myNixOS";
username = "hare";
systemModules = [
./myNixOS/nixos.nix
];
homeModule = [
./myNixOS/home-manager.nix
];
};
};
nixos = {
myNixOS = hosts.myNixOS.nixos;
};
home-manager = {
myNixOS = hosts.myNixOS.home-manager;
};
}

View File

@ -0,0 +1,19 @@
{ pkgs, ... }:
{
programs = {
hyprland = {
enable = true;
xwayland.enable = true;
withUWSM = true;
};
hyprlock.enable = true;
regreet.enable = true;
};
services.hypridle.enable = true;
environment.systemPackages = with pkgs; [
swww
eww
];
}

3
programs/docker.nix Normal file
View File

@ -0,0 +1,3 @@
{
virtualisation.docker.enable = true;
}

11
programs/fcitx.nix Normal file
View File

@ -0,0 +1,11 @@
{ pkgs, ... }:
{
i18n.inputMethod = {
type = "fcitx5";
enable = true;
fcitx5.addons = with pkgs; [
fcitx5-mozc
fcitx5-gtk
];
};
}

24
programs/shell.nix Normal file
View File

@ -0,0 +1,24 @@
{ pkgs, ... }:
{
programs = {
fish.enable = true;
git.enable = true;
neovim = {
enable = true;
defaultEditor = true;
viAlias = true;
vimAlias = true;
};
};
environment.systemPackages = with pkgs; [
bc
jq
socat
acpi
btrfs-progs
duf
lsof
pciutils
];
}

24
programs/ssh.nix Normal file
View File

@ -0,0 +1,24 @@
{
services.openssh = {
enable = true;
ports = [ 22 ];
settings = {
PasswordAuthentication = false;
AllowUsers = [ "hare" ];
UseDns = true;
X11Forwarding = false;
PermitRootLogin = "prohibit-password";
};
hostKeys = [
{
bits = 4096;
path = "/etc/ssh/ssh_host_rsa_key";
type = "rsa";
}
{
path = "/etc/ssh/ssh_host_ed25519_key";
type = "ed25519";
}
];
};
}

14
programs/utility.nix Normal file
View File

@ -0,0 +1,14 @@
{ pkgs, ... }:
{
environment.systemPackages = with pkgs; [
zip
unzip
ripgrep
btop
bat
neovim
wezterm
kitty
nixfmt-rfc-style
];}

7
programs/v4l2.nix Normal file
View File

@ -0,0 +1,7 @@
{ pkgs, ... }:
{
environment.systemPackages = with pkgs; [
v4l-utils
ffmpeg
];
}

View File

@ -0,0 +1,16 @@
{ pkgs, ... }:
{
imports = [
(fetchTarball {
url = "https://github.com/msteen/nixos-vscode-server/tarball/master";
sha256 = "09j4kvsxw1d5dvnhbsgih0icbrxqv90nzf0b589rb5z6gnzwjnqf";
})
];
environment.systemPackages = with pkgs; [
code-server
];
services.vscode-server.enable = true;
services.vscode-server.enableFHS = true;
services.vscode-server.nodejsPackage = pkgs.nodejs_22;
}

6
system/core/boot.nix Normal file
View File

@ -0,0 +1,6 @@
{ pkgs, ... }:
{
boot = {
supportedFilesystems = [ "ext4" "btrfs" "xfs" "vfat" "ntfs" ];
};
}

11
system/core/default.nix Normal file
View File

@ -0,0 +1,11 @@
{
imports = [
./nix.nix
./boot.nix
./uwsm.nix
./locale.nix
./network.nix
./fonts.nix
./sound.nix
];
}

18
system/core/fonts.nix Normal file
View File

@ -0,0 +1,18 @@
{ pkgs, ... }:
{
fonts = {
packages = with pkgs; [
noto-fonts
noto-fonts-cjk-sans
noto-fonts-emoji
ibm-plex
];
fontconfig = {
defaultFonts = {
serif = [ "Noto Serif" ];
sansSerif = [ "Noto Sans" ];
monospace = [ "IBM Plex Mono" ];
};
};
};
}

5
system/core/locale.nix Normal file
View File

@ -0,0 +1,5 @@
{
time.timeZone = "Asia/Tokyo";
i18n.defaultLocale = "en_US.UTF-8";
time.hardwareClockInLocalTime = true;
}

13
system/core/network.nix Normal file
View File

@ -0,0 +1,13 @@
{ config, hostname, ... }:
{
networking = {
hostName = hostname;
networkmanager.enable = true;
firewall = {
enable = true;
};
};
# nixpkgs issue#180175
systemd.services.NetworkManager-wait-online.enable = false;
}

17
system/core/nix.nix Normal file
View File

@ -0,0 +1,17 @@
{
nix = {
settings = {
experimental-features = [
"nix-command"
"flakes"
];
};
gc = {
automatic = true;
dates = "weekly";
options = "--delete-older-than 7d";
};
};
nixpkgs.config.allowUnfree = true;
}

9
system/core/sound.nix Normal file
View File

@ -0,0 +1,9 @@
{
security.rtkit.enable = true;
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
};
}

12
system/core/uwsm.nix Normal file
View File

@ -0,0 +1,12 @@
{
programs.uwsm = {
enable = true;
waylandCompositors = {
hyprland = {
prettyName = "Hyprland";
comment = "Hyprland compositor managed by UWSM";
binPath = "/run/current-system/sw/bin/Hyprland";
};
};
};
}