rohanshukla94 / flakes

My presonal NixOS config

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

简体中文(**大陆) | English (UK)

Ruixi-rebirth's NixOS Config

系统组件

NixOS(Wayland) Nixos(Xorg)
Window Manager Sway, Hyprland bspwm
Terminal Emulator Kitty Kitty
Bar Waybar Polybar
Application Launcher Rofi-wayland rofi
Notification Daemon Mako Dunst
Display Manager None(TTY1 Login) None(TTY1 Login)
network management tool NetworkManager NetworkManager
Input method framework Fcitx5 Fcitx5
System resource monitor Btop Btop
File Manager Ranger, Nemo Ranger, Nemo
Lockscreen Swaylock-effects i3lock-fancy
Shell Fish Fish
Music Player mpd, ncmpcpp, mpc, Netease-cloud-music-gtk mpd, ncmpcpp, mpc, Netease-cloud-music-gtk
Media Player mpv mpv
Text Editor Neovim Neovim
Icons Papirus Papirus
Fonts Nerd fonts Nerd fonts
Image Viewer imv feh
Screenshot Software grimshot,grimblast flameshot
Screen Recording wf-recorder, OBS OBS
Clipboard wl-clipboard xclip
Color Picker hyprpicker

窗口管理器

sway & hyprland

a.mp4

sway 与 hyprland 外观一致,此处展示的是 hyprland

bspwm

动画极为流畅,只是录制视频有点卡卡的样子

2023-02-22.22-36-48.mp4

主题

hyprland & sway

Load (Click to expand)

catppuccin-light 2023-01-12T02:21:59

catppuccin-dark 2023-01-12T03:00:29

nord 2023-01-17T00:15:22

bspwm

Load (Click to expand)

2023-02-22_21-30

目录结构

├── blog
│  ├── archetypes
│  ├── assets
│  ├── content
│  ├── layouts
│  ├── static
│  └── themes
├── hosts
│  ├── laptop
│  └── server
├── modules
│  ├── desktop
│  ├── devlop
│  ├── editors
│  ├── environment
│  ├── fonts
│  ├── hardware
│  ├── programs
│  ├── scripts
│  ├── shell
│  ├── theme
│  └── virtualisation
├── overlays
│  ├── cinnamon.nemo
│  └── flameshot
├── pkgs
│  ├── catppuccin-cursors
│  ├── catppuccin-frappe-gtk
│  ├── catppuccin-latte-gtk
│  ├── fcitx5-pinyin-moegirl
│  ├── fcitx5-pinyin-zhwiki
│  ├── go-musicfox
│  └── swww
└── secrets
   └── _public_keys_

如何安装?

最小安装(包含 wm,没有 tmpfs as root),前往此处

如何安装?(root on tmpfs)

  1. 准备一个 64 位的 nixos minimal iso image 烧录好,然后进入 live 系统。假设我已经分好两个分区/dev/nvme0n1p1 /dev/nvme0n1p3
  2. 格式化分区
  mkfs.fat -F 32 /dev/nvme0n1p1
  mkfs.ext4 /dev/nvme0n1p3
  1. 挂载
  mount -t tmpfs none /mnt
  mkdir -p /mnt/{boot,nix,etc/nixos}
  mount /dev/nvme0n1p3 /mnt/nix
  mount /dev/nvme0n1p1 /mnt/boot
  mkdir -p /mnt/nix/persist/etc/nixos
  mount -o bind /mnt/nix/persist/etc/nixos /mnt/etc/nixos
  1. 生成一个基本的配置
  nixos-generate-config --root /mnt
  1. 克隆仓库到本地
nix-shell -p git
git clone  https://github.com/Ruixi-rebirth/flakes.git /mnt/etc/nixos/Flakes
cd  /mnt/etc/nixos/Flakes/
nix develop --extra-experimental-features nix-command --extra-experimental-features flakes
  1. 将 /mnt/etc/nixos 中的 hardware-configuration.nix 拷贝到 /mnt/etc/nixos/Flakes/hosts/laptop/hardware-configuration.nix
cp /mnt/etc/nixos/hardware-configuration.nix /mnt/etc/nixos/Flakes/hosts/laptop/hardware-configuration.nix
  1. 修改被覆盖后的 hardware-configuration.nix
nvim /mnt/etc/nixos/Flakes/hosts/laptop/hardware-configuration.nix
...
#这只是一个例子
#请参考 `https://elis.nu/blog/2020/05/nixos-tmpfs-as-root/#step-4-1-configure-disks`

  fileSystems."/" =
    { device = "none";
      fsType = "tmpfs";
      options = [ "defaults" "size=8G" "mode=755"  ];
    };

  fileSystems."/nix" =
    { device = "/dev/disk/by-uuid/49e24551-c0e0-48ed-833d-da8289d79cdd";
      fsType = "ext4";
    };

  fileSystems."/boot" =
    { device = "/dev/disk/by-uuid/3C0D-7D32";
      fsType = "vfat";
    };

  fileSystems."/etc/nixos" =
    { device = "/nix/persist/etc/nixos";
      fsType = "none";
      options = [ "bind" ];
    };
...
  1. 移除 '/mnt/etc/nixos/Flakes/.git'
rm -rf .git
  1. 用户名修改: 编辑 /mnt/etc/nixos/Flakes/flake.nix 修改 user 变量,主机名修改: 编辑 /mnt/etc/nixos/Flakes/hosts/system.nix 修改 networking 属性组中的 hostName

  2. 使用 mkpasswd {PASSWORD} -m sha-512 命令生成的密码哈希串替换掉 /mnt/etc/nixos/Flakes/hosts/laptop/wayland/default.nix 中的 users.users.<name>.hashedPassword 值替换掉。(在文件中有两处需要替换的内容)

  3. 选择 Window Manager

    Wayland: 这行这行 取消注释, 并且注释 这行这行

Hyprland: 如果 这行这行 有注释, 则均取消注释, 并且注释掉下面涉及到 sway 的两行

Sway: 如果 这行这行 有注释, 则均取消注释, 并且注释掉上面涉及到 hyprland 的两行

Xorg: 这行这行 取消注释, 并且注释 这行这行

Bspwm: 默认

  1. 选择主题

    Wayland

这里 任意选择一个

Xorg

nord: 默认

  1. 安装
nixos-install --no-root-passwd --flake .#laptop

#或者指定源:
nixos-install --option substituters "https://mirrors.tuna.tsinghua.edu.cn/nix-channels/store" --no-root-passwd --flake .#laptop
  1. 重启
reboot
  1. 享受它吧!

About

My presonal NixOS config


Languages

Language:Nix 78.8%Language:Lua 18.8%Language:Shell 2.4%Language:Haskell 0.0%Language:Nushell 0.0%