Compare commits

..

No commits in common. "464c38e479ce9736ee5a5f391a157dce33545449" and "4cbde560d7205ee8ad123bc86b8a82eb5fbc4976" have entirely different histories.

13 changed files with 313 additions and 141 deletions

View file

@ -3,6 +3,10 @@
It just works™
## 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
@ -13,7 +17,7 @@ It just works™
│ ├──  modules
│ └──  profiles
│ # Internal packages, please see github:Guanran928/nur-packages instead
│ # Personal packages, please see github:Guanran928/nur-packages instead
├──  pkgs
├──  hosts
├──  overlays
@ -23,3 +27,54 @@ It just works™
└──  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,7 +8,17 @@
viAlias = true;
vimAlias = true;
})
#pkgs.lunarvim
];
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

@ -0,0 +1,9 @@
{
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,6 +42,7 @@
./applications/git
./applications/gpg
./applications/neovim
./applications/skim
./applications/starship
./applications/tealdeer
./applications/tmux
@ -49,7 +50,6 @@
programs.jq.enable = true;
programs.ripgrep.enable = true;
programs.skim.enable = true;
programs.zoxide.enable = true;
home.packages =
(with pkgs; [

13
hosts/aristotle/README.md Normal file
View file

@ -0,0 +1,13 @@
### 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,6 +5,7 @@
./anti-feature.nix
./disko.nix
./graphical
./hardware-configuration.nix
./impermanence.nix
./lanzaboote.nix
@ -14,144 +15,39 @@
time.timeZone = "Asia/Shanghai";
system.stateVersion = "23.11";
home-manager.users.guanranwang = import ./home;
services.tailscale = {
enable = true;
openFirewall = true;
};
environment.systemPackages = with pkgs; [
yubikey-manager
localsend
];
networking.firewall.allowedTCPPorts = [53317];
networking.firewall.allowedUDPPorts = [53317];
programs.adb.enable = true;
programs.anime-game-launcher.enable = true;
programs.seahorse.enable = true;
programs.steam.enable = true;
programs.kdeconnect = {
enable = true;
package = pkgs.valent;
};
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
hardware.xone.enable = true; # via wired or wireless dongle
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
environment.systemPackages = [pkgs.yubikey-manager];
services.pcscd.enable = true;
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

@ -0,0 +1,65 @@
{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

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

View file

@ -0,0 +1,76 @@
{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

@ -0,0 +1,37 @@
<?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

@ -30,21 +30,7 @@
};
};
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";
};
};
dconf.settings."org/gnome/desktop/interface"."color-scheme" = "prefer-dark";
# ??? this commit broke nautilus's spacing ???
# https://github.com/nix-community/home-manager/commit/e9b9ecef4295a835ab073814f100498716b05a96

View file

@ -0,0 +1,24 @@
# 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