Compare commits

...

4 commits

Author SHA1 Message Date
464c38e479
fixup! treewide: cleanup 2024-07-17 23:04:26 +08:00
a57e2d3050
fixup! aristotle: cleanup 2024-07-17 11:36:13 +08:00
0a5f07bef0
treewide: cleanup 2024-07-17 11:35:59 +08:00
8a6279673d
aristotle: cleanup 2024-07-17 10:16:20 +08:00
13 changed files with 141 additions and 313 deletions

View file

@ -3,10 +3,6 @@
It just works™ It just works™
## Structure ## Structure
Any directory or file that is prefixed with an `_` (underscore) means that the
whole directory/file is unused in this repository.
``` ```
 .  .
│ # Darwin configuration is not actively maintained and sometimes it might │ # Darwin configuration is not actively maintained and sometimes it might
@ -17,7 +13,7 @@ whole directory/file is unused in this repository.
│ ├──  modules │ ├──  modules
│ └──  profiles │ └──  profiles
│ # Personal packages, please see github:Guanran928/nur-packages instead │ # Internal packages, please see github:Guanran928/nur-packages instead
├──  pkgs ├──  pkgs
├──  hosts ├──  hosts
├──  overlays ├──  overlays
@ -27,54 +23,3 @@ whole directory/file is unused in this repository.
└──  README.md └──  README.md
``` ```
## Installation:
Please don't.
### NixOS:
1. Clone this repository
`$ git clone https://github.com/Guanran928/flake.git`
2. Add your device's hardware configuration in `./flake.nix` and
`./hosts/<hostname>`
3. Install NixOS
`$ nixos-install --flake <this flake's directory>#<hostname>`
### macOS:
1. Install Nix using [`Determinate Nix Installer`](https://github.com/DeterminateSystems/nix-installer)
`$ curl --proto '=https' --tlsv1.2 -fsSL https://install.determinate.systems/nix | sh -s -- install`
2. Clone this repository
`$ git clone https://github.com/Guanran928/flake.git`
3. Add your device's hardware configuration in `./flake.nix` and
`./hosts/<hostname>`
4. Install [`nix-darwin`](https://github.com/LnL7/nix-darwin?tab=readme-ov-file#flakes)
`$ nix run nix-darwin -- --flake <this flake's directory>#<hostname> switch`
### Nix-On-Droid:
1. Install [`nix-on-droid`](https://github.com/nix-community/nix-on-droid) and bootstrap with Flakes
F-Droid: https://f-droid.org/packages/com.termux.nix
2. Clone this repository
`$ nix shell nixpkgs#git`
`$ git clone https://github.com/Guanran928/flake.git`
3. Add your device's configuration in `./flake.nix` and `./hosts/<hostname>`
4. Setup Nix-On-Droid
`$ nix-on-droid --flake <this flake's directory>#<hostname>switch`

View file

@ -8,17 +8,7 @@
viAlias = true; viAlias = true;
vimAlias = true; vimAlias = true;
}) })
#pkgs.lunarvim
]; ];
home.sessionVariables."EDITOR" = "nvim"; home.sessionVariables."EDITOR" = "nvim";
# TODO: still couldn't make it work
#programs.neovim = {
# enable = true;
# viAlias = true;
# vimAlias = true;
#
# package = inputs.neovim.packages.${pkgs.stdenv.hostPlatform.system}.default;
#};
} }

View file

@ -1,9 +0,0 @@
{
programs.skim = {
enable = true;
# SPEED: fd > rg > find
# STARTUP TIME: find > rg > fd
defaultCommand = "fd --color never || rg --files --color never || find";
};
}

View file

@ -42,7 +42,6 @@
./applications/git ./applications/git
./applications/gpg ./applications/gpg
./applications/neovim ./applications/neovim
./applications/skim
./applications/starship ./applications/starship
./applications/tealdeer ./applications/tealdeer
./applications/tmux ./applications/tmux
@ -50,6 +49,7 @@
programs.jq.enable = true; programs.jq.enable = true;
programs.ripgrep.enable = true; programs.ripgrep.enable = true;
programs.skim.enable = true;
programs.zoxide.enable = true; programs.zoxide.enable = true;
home.packages = home.packages =
(with pkgs; [ (with pkgs; [

View file

@ -1,13 +0,0 @@
### About this device
### Hardware
```
$ hostnamectl --json short | jq -r '.HardwareVendor, .HardwareModel'
Lenovo
Lenovo Legion Y7000
```
### Description
My first computer & my main device (as of Feb. 2024).

View file

@ -5,7 +5,6 @@
./anti-feature.nix ./anti-feature.nix
./disko.nix ./disko.nix
./graphical
./hardware-configuration.nix ./hardware-configuration.nix
./impermanence.nix ./impermanence.nix
./lanzaboote.nix ./lanzaboote.nix
@ -15,39 +14,144 @@
time.timeZone = "Asia/Shanghai"; time.timeZone = "Asia/Shanghai";
system.stateVersion = "23.11"; system.stateVersion = "23.11";
home-manager.users.guanranwang = import ./home;
services.tailscale = { services.tailscale = {
enable = true; enable = true;
openFirewall = true; openFirewall = true;
}; };
environment.systemPackages = with pkgs; [
yubikey-manager
localsend
];
networking.firewall.allowedTCPPorts = [53317];
networking.firewall.allowedUDPPorts = [53317];
programs.adb.enable = true; programs.adb.enable = true;
programs.anime-game-launcher.enable = true; programs.anime-game-launcher.enable = true;
programs.seahorse.enable = true;
programs.steam.enable = true; programs.steam.enable = true;
programs.kdeconnect = {
enable = true;
package = pkgs.valent;
};
services.power-profiles-daemon.enable = true; services.power-profiles-daemon.enable = true;
services.gvfs.enable = true;
services.gnome = {
gnome-keyring.enable = true;
gnome-online-accounts.enable = true;
sushi.enable = true;
};
# https://wiki.archlinux.org/title/Gamepad#Connect_Xbox_Wireless_Controller_with_Bluetooth # https://wiki.archlinux.org/title/Gamepad#Connect_Xbox_Wireless_Controller_with_Bluetooth
hardware.xone.enable = true; # via wired or wireless dongle hardware.xone.enable = true; # via wired or wireless dongle
hardware.xpadneo.enable = true; # via Bluetooth hardware.xpadneo.enable = true; # via Bluetooth
### https://wiki.archlinux.org/title/Gaming#Improving_performance
systemd.tmpfiles.rules = [
"w /proc/sys/vm/min_free_kbytes - - - - 1048576"
"w /proc/sys/vm/swappiness - - - - 10"
"w /sys/kernel/mm/lru_gen/enabled - - - - 5"
"w /proc/sys/vm/zone_reclaim_mode - - - - 0"
"w /proc/sys/vm/page_lock_unfairness - - - - 1"
"w /proc/sys/kernel/sched_child_runs_first - - - - 0"
"w /proc/sys/kernel/sched_autogroup_enabled - - - - 1"
"w /proc/sys/kernel/sched_cfs_bandwidth_slice_us - - - - 500"
"w /sys/kernel/debug/sched/latency_ns - - - - 1000000"
"w /sys/kernel/debug/sched/migration_cost_ns - - - - 500000"
"w /sys/kernel/debug/sched/min_granularity_ns - - - - 500000"
"w /sys/kernel/debug/sched/wakeup_granularity_ns - - - - 0"
"w /sys/kernel/debug/sched/nr_migrate - - - - 8"
];
# yubikey # yubikey
environment.systemPackages = [pkgs.yubikey-manager];
services.pcscd.enable = true; services.pcscd.enable = true;
services.udev.packages = [pkgs.yubikey-personalization]; services.udev.packages = [pkgs.yubikey-personalization];
fonts = {
enableDefaultPackages = false;
packages = with pkgs; [
(nerdfonts.override {
fonts = ["NerdFontsSymbolsOnly"];
})
(inter.overrideAttrs {
installPhase = ''
runHook preInstall
install -Dm644 -t $out/share/fonts/truetype/ InterVariable*.ttf
runHook postInstall
'';
})
(jetbrains-mono.overrideAttrs {
installPhase = ''
runHook preInstall
install -Dm644 -t $out/share/fonts/truetype/ fonts/variable/*.ttf
runHook postInstall
'';
})
(source-sans.overrideAttrs {
installPhase = ''
runHook preInstall
install -Dm444 VF/*.otf -t $out/share/fonts/variable
runHook postInstall
'';
})
(source-serif.overrideAttrs {
installPhase = ''
runHook preInstall
install -Dm444 VAR/*.otf -t $out/share/fonts/variable
runHook postInstall
'';
})
source-han-sans-vf-otf
source-han-serif-vf-otf
noto-fonts-color-emoji
];
fontconfig.defaultFonts = {
emoji = [
"Noto Color Emoji"
];
# Append emoji font for Qt apps, they might use the monochrome emoji
monospace = [
"JetBrains Mono"
"Source Han Sans SC VF"
"Symbols Nerd Font"
"Noto Color Emoji"
];
sansSerif = [
"Inter Variable"
"Source Han Sans SC VF"
"Noto Color Emoji"
];
serif = [
"Source Serif 4 Variable"
"Source Han Serif SC VF"
"Noto Color Emoji"
];
};
};
# polkit
security.polkit.enable = true;
# systemd.user.services.polkit-gnome-authentication-agent-1 = {
# description = "polkit-gnome-authentication-agent-1";
# wantedBy = ["graphical-session.target"];
# wants = ["graphical-session.target"];
# after = ["graphical-session.target"];
# serviceConfig = {
# Type = "simple";
# ExecStart = "${pkgs.polkit_gnome}/libexec/polkit-gnome-authentication-agent-1";
# Restart = "on-failure";
# RestartSec = 1;
# TimeoutStopSec = 10;
# };
# };
# security.pam.services.swaylock = {};
# xdg.portal = {
# enable = true;
# xdgOpenUsePortal = true;
# wlr.enable = true;
# extraPortals = [pkgs.xdg-desktop-portal-gtk];
# # https://gitlab.archlinux.org/archlinux/packaging/packages/sway/-/blob/main/sway-portals.conf
# config."sway" = {
# default = "gtk";
# "org.freedesktop.impl.portal.ScreenCast" = "wlr";
# "org.freedesktop.impl.portal.Screenshot" = "wlr";
# "org.freedesktop.impl.portal.Inhibit" = "none";
# };
# };
### Removes debounce time
# https://www.reddit.com/r/linux_gaming/comments/ku6gth
environment.etc."libinput/local-overrides.quirks".text = ''
[Never Debounce]
MatchUdevType=mouse
ModelBouncingKeys=1
'';
} }

View file

@ -1,65 +0,0 @@
{pkgs, ...}: {
### home-manager
home-manager.users.guanranwang = import ./home;
# gnome keyring
programs.seahorse.enable = true;
# polkit
security.polkit.enable = true;
systemd.user.services.polkit-gnome-authentication-agent-1 = {
description = "polkit-gnome-authentication-agent-1";
wantedBy = ["graphical-session.target"];
wants = ["graphical-session.target"];
after = ["graphical-session.target"];
serviceConfig = {
Type = "simple";
ExecStart = "${pkgs.polkit_gnome}/libexec/polkit-gnome-authentication-agent-1";
Restart = "on-failure";
RestartSec = 1;
TimeoutStopSec = 10;
};
};
fonts.enableDefaultPackages = false;
security.pam.services.swaylock = {};
xdg.portal = {
enable = true;
xdgOpenUsePortal = true;
wlr.enable = true;
extraPortals = [pkgs.xdg-desktop-portal-gtk];
# https://gitlab.archlinux.org/archlinux/packaging/packages/sway/-/blob/main/sway-portals.conf
config."sway" = {
default = "gtk";
"org.freedesktop.impl.portal.ScreenCast" = "wlr";
"org.freedesktop.impl.portal.Screenshot" = "wlr";
"org.freedesktop.impl.portal.Inhibit" = "none";
};
};
services = {
gvfs.enable = true;
gnome = {
gnome-keyring.enable = true;
gnome-online-accounts.enable = true;
sushi.enable = true;
};
};
programs.kdeconnect = {
enable = true;
package = pkgs.valent;
};
environment.systemPackages = [pkgs.localsend];
networking.firewall.allowedTCPPorts = [53317];
networking.firewall.allowedUDPPorts = [53317];
### Removes debounce time
# https://www.reddit.com/r/linux_gaming/comments/ku6gth
environment.etc."libinput/local-overrides.quirks".text = ''
[Never Debounce]
MatchUdevType=mouse
ModelBouncingKeys=1
'';
}

View file

@ -1,76 +0,0 @@
{pkgs, ...}: {
# WARN: I don't know fontconfig and I have no idea what am I doing. Please do not use as reference.
xdg.configFile = {
"fontconfig/fonts.conf".source = ./fonts.conf;
"fontconfig/conf.d/10-web-ui-fonts.conf".source = pkgs.fetchurl {
url = "https://raw.githubusercontent.com/lilydjwg/dotconfig/1b22d4f0740bb5bbd7c65b6c468920775171b207/fontconfig/web-ui-fonts.conf";
hash = "sha256-A4DcV6HTW/IRxXN3NaI1GUfoFdalwgFLpCjgbWENdZU=";
};
"fontconfig/conf.d/10-source-han-for-noto-cjk.conf".source = pkgs.fetchurl {
url = "https://raw.githubusercontent.com/lilydjwg/dotconfig/1b22d4f0740bb5bbd7c65b6c468920775171b207/fontconfig/source-han-for-noto-cjk.conf";
hash = "sha256-jcdDr5VW1qZXbApgfT5FZgxonpRnLs9AY0QagfdL8ic=";
postFetch = ''
substitutionInPlace $out \
--replace-warn "Source Han Sans" "Source Han Sans VF" \
--replace-warn "Source Han Serif" "Source Han Serif VF"
'';
};
"fontconfig/conf.d/10-nerd-font-symbols.conf".source = pkgs.fetchurl {
url = "https://raw.githubusercontent.com/ryanoasis/nerd-fonts/${pkgs.nerdfonts.version}/10-nerd-font-symbols.conf";
hash = "sha256-XwJMkcDtGlI+LFMrjCl/gicAnoBWnq3p9adrmieNZwU=";
};
};
# Make GTK listen to fontconfig
dconf.settings = {
"org/gnome/desktop/wm/preferences" = {
"titlebar-font" = "Sans Bold 11";
};
"org/gnome/desktop/interface" = {
"font-name" = "Sans 11";
"document-font-name" = "Sans 11";
"monospace-font-name" = "Monospace 10";
};
};
# HM managed fonts
fonts.fontconfig.enable = true;
home.packages = with pkgs; [
(nerdfonts.override {
fonts = ["NerdFontsSymbolsOnly"];
})
(inter.overrideAttrs {
installPhase = ''
runHook preInstall
install -Dm644 -t $out/share/fonts/truetype/ InterVariable*.ttf
runHook postInstall
'';
})
(jetbrains-mono.overrideAttrs {
installPhase = ''
runHook preInstall
install -Dm644 -t $out/share/fonts/truetype/ fonts/variable/*.ttf
runHook postInstall
'';
})
(source-sans.overrideAttrs {
installPhase = ''
runHook preInstall
install -Dm444 VF/*.otf -t $out/share/fonts/variable
runHook postInstall
'';
})
(source-serif.overrideAttrs {
installPhase = ''
runHook preInstall
install -Dm444 VAR/*.otf -t $out/share/fonts/variable
runHook postInstall
'';
})
source-han-sans-vf-otf
source-han-serif-vf-otf
noto-fonts-color-emoji
];
}

View file

@ -1,37 +0,0 @@
<?xml version='1.0'?>
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
<fontconfig>
<its:rules version="1.0" xmlns:its="http://www.w3.org/2005/11/its">
<its:translateRule selector="/fontconfig/*[not(self::description)]" translate="no"/>
</its:rules>
<description>trash Font Config 4.0</description>
<!-- Default fonts -->
<alias binding="strong">
<family>serif</family>
<prefer>
<family>Source Serif 4 Variable</family>
<family>Source Han Serif SC VF</family>
<family>Noto Color Emoji</family>
</prefer>
</alias>
<alias binding="strong">
<family>sans-serif</family>
<prefer>
<family>Inter Variable</family>
<family>Source Han Sans SC VF</family>
<family>Noto Color Emoji</family>
</prefer>
</alias>
<alias binding="strong">
<family>monospace</family>
<prefer>
<family>JetBrains Mono</family>
<family>Source Han Sans SC VF</family>
<family>Noto Color Emoji</family>
</prefer>
</alias>
</fontconfig>

View file

@ -5,11 +5,10 @@
}: { }: {
imports = imports =
[ [
./fonts
./theme.nix ./theme.nix
./xdg-mime.nix ./xdg-mime.nix
] ]
++ map (n: ../../../../home/applications/${n}) [ ++ map (n: ../../../home/applications/${n}) [
"fcitx5" "fcitx5"
"firefox" "firefox"
"foot" "foot"

View file

@ -30,7 +30,21 @@
}; };
}; };
dconf.settings."org/gnome/desktop/interface"."color-scheme" = "prefer-dark"; dconf.settings = {
"org/gnome/desktop/interface" = {
"color-scheme" = "prefer-dark";
};
# Make GTK listen to fontconfig
"org/gnome/desktop/wm/preferences" = {
"titlebar-font" = "Sans Bold 11";
};
"org/gnome/desktop/interface" = {
"font-name" = "Sans 11";
"document-font-name" = "Sans 11";
"monospace-font-name" = "Monospace 10";
};
};
# ??? this commit broke nautilus's spacing ??? # ??? this commit broke nautilus's spacing ???
# https://github.com/nix-community/home-manager/commit/e9b9ecef4295a835ab073814f100498716b05a96 # https://github.com/nix-community/home-manager/commit/e9b9ecef4295a835ab073814f100498716b05a96

View file

@ -1,24 +0,0 @@
# About this device
### Hardware
```
$ hostnamectl --json short | jq -r '.HardwareVendor, .HardwareModel'
Apple Inc.
MacBookPro11,3
```
### Description
Homelab, hosting random stuff through tailscale and rathole.
### TODOs:
- [ ] backlight is always 33% when booted up
- [ ] encrypted swap
- [ ] impermanence
- [ ] luks1 -> luks2
- [ ] tpm luks unlocking
- [ ] nouveau -> nvidia
- [x] networkmanager -> iwd
- [ ] jellyfin hardware acceleration