Add various tweaks & fixes

- Add standalone home-manager conf usable outside nixos
- Fix HID devices being suspended by powertop
- Fix emacs font config & add deps for vterm module compilation
- Fix Network setup with per-device gateway
- Replace onetab with foss alternative (Tab Stash)
- Improve README.md
This commit is contained in:
Tristan D. 2023-09-19 05:43:42 +02:00 committed by Tristan Druyen
parent ab7249df82
commit e66122aa4c
Signed by: tristan
SSH key fingerprint: SHA256:U7y6eMb7CQDaTHv9XoX6/BaQnPqyxxKc+Xnfcefi6rY
6 changed files with 401 additions and 346 deletions

View file

@ -1,5 +1,11 @@
# My nix conf
## 🏠 Home Setup
```bash
nix run home-manager/release-23.05 -- switch --flake .
```
## 🏗️ System Setup
### 👷 "Manual"
@ -32,6 +38,12 @@ nix flake update
sudo nixos-rebuild --flake .#nixos-pulse switch
```
Run this to keep your home up-to-date.
```bash
nix flake update
home-manager switch --flake .
```
## 🙏 Made possible by
- NixOS: https://nixos.org/

View file

@ -15,10 +15,12 @@
};
fonts.fonts = with pkgs; [
emacs-all-the-icons-fonts
noto-fonts
noto-fonts-cjk
noto-fonts-emoji
liberation_ttf
fira
fira-code
fira-code-symbols
mplus-outline-fonts.githubRelease
@ -145,6 +147,13 @@
virtualisation.libvirtd.enable = true;
powerManagement.powertop.enable = true;
systemd.services.powertop.postStart = ''
HIDDEVICES=$(ls /sys/bus/usb/drivers/usbhid | grep -oE '^[0-9]+-[0-9\.]+' | sort -u)
for i in $HIDDEVICES; do
echo -n "Enabling " | cat - /sys/bus/usb/devices/$i/product
echo 'on' > /sys/bus/usb/devices/$i/power/control
done
'';
# This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions

View file

@ -34,33 +34,53 @@
emacs-overlay,
disko,
nur,
}: {
}: let
system = "x86_64-linux";
customPkgs = import nixpkgs {
system = "${system}";
overlays = [emacs-overlay.overlay];
config = {
allowUnfree = true;
};
};
pkgs = nixpkgs.legacyPackages.${system};
in {
formatter = {
x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.alejandra;
};
diskoConfigurations = {
nixos-pulse = import ./disko.nix;
};
nixosConfigurations = let
customPkgs = import nixpkgs {
system = "x86_64-linux";
overlays = [emacs-overlay.overlay];
config = {
allowUnfree = true;
};
homeConfigurations = {
"tristand" = home-manager.lib.homeManagerConfiguration {
inherit pkgs;
modules = [
./home.nix
nur.hmModules.nur
{
_module.args.customPkgs = customPkgs;
# inherit customPkgs;
# pkgs.pkgs = customPkgs;
# home-manager.useUserPackages = true;
# home-manager.useGlobalPkgs = true;
}
];
};
in {
};
nixosConfigurations = {
nixos-pulse = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
./configuration.nix
./home.nix
./users.nix
./disko.nix
disko.nixosModules.disko
home-manager.nixosModules.home-manager
tuxedo-nixos.nixosModules.default
nur.nixosModules.nur
{
_module.args.customPkgs = customPkgs;
nixpkgs.pkgs = customPkgs;
home-manager.useUserPackages = true;
home-manager.useGlobalPkgs = true;

View file

@ -37,19 +37,21 @@
prefixLength = 24;
}
];
ipv4.routes = [
{
address = "192.168.0.0";
prefixLength = 24;
}
{
address = "0.0.0.0";
prefixLength = 0;
via = "192.168.0.5";
}
];
};
};
# TODO delete if network specific gateway is validated to work
# defaultGateway = {
# address = "192.168.0.5";
# interface = "enp5s0f4u1u1c2";
# };
};
# TODO validate his works
systemd.network.networks.enp5s0f4u1u1c2.gateway = "192.168.0.5";
# This manually configures the automatically created network-adresses service to be more flexible
# regarding booting without the the device being available on boot
# It prevents slow timeouts & errors on boot while preserving Plug & Play ability

645
home.nix
View file

@ -1,355 +1,346 @@
{
pkgs,
customPkgs,
config,
...
}: {
fonts.fonts = [pkgs.emacs-all-the-icons-fonts];
users.users.tristand = {
isNormalUser = true;
description = "Tristan Druyen";
extraGroups = ["networkmanager" "wheel" "libvirtd"];
shell = pkgs.fish;
home = "/home/tristand";
hashedPassword = "$6$Wj.XY8JgH5EWuog4$HnbtPJXDEqKXFrzkPVEjih3PytcpBCrkfL7TAwkXd0IFced7kGMlZNliNsAqQ3XqfyUzAYiiKTIqoPVJEk.s..";
dconf.settings = {
"org/virt-manager/virt-manager/connections" = {
autoconnect = ["qemu:///system"];
uris = ["qemu:///system"];
};
};
home-manager.users.tristand = {pkgs, ...}: {
nix = {
settings.experimental-features = ["nix-command" "flakes"];
};
dconf.settings = {
"org/virt-manager/virt-manager/connections" = {
autoconnect = ["qemu:///system"];
uris = ["qemu:///system"];
programs.alacritty = {
enable = true;
settings = {
window.opacity = 0.88;
window.dimensions = {
lines = 40;
columns = 150;
};
};
};
programs.alacritty = {
enable = true;
settings = {
window.opacity = 0.88;
window.dimensions = {
lines = 40;
columns = 150;
services.emacs = {
enable = true;
defaultEditor = true;
package = customPkgs.emacs-unstable-pgtk;
};
programs.fish = {
enable = true;
functions = {
ec = "emacsclient $argv";
ecc = "emacsclient -c $argv";
ecr = "emacsclient -r $argv";
ecrr = "emacsclient -r $argv";
};
};
programs.firefox = {
enable = true;
profiles = {
default = {
isDefault = true;
settings = {
# Extensions are managed with Nix, so don't update.
"extensions.update.autoUpdateDefault" = false;
"extensions.update.enabled" = false;
# Sync
# "services.sync.username" = config.etu.user.email;
"services.sync.engine.addons" = false; # Do not sync extensions.
"general.autoScroll" = true; # Middle click to scroll
"browser.startup.page" = 3; # Restore previous windows and tabs.
# Privacy enhancements
"browser.newtabpage.activity-stream.feeds.telemetry" = false;
"browser.newtabpage.activity-stream.telemetry" = false;
"browser.newtabpage.activity-stream.feeds.snippets" = false;
"browser.newtabpage.activity-stream.feeds.section.topstories" = false;
"browser.newtabpage.activity-stream.section.highlights.includePocket" = false;
"browser.newtabpage.activity-stream.showSponsored" = false;
"browser.newtabpage.activity-stream.feeds.discoverystreamfeed" = false;
"browser.newtabpage.activity-stream.showSponsoredTopSites" = false;
# Improve performance
"gfx.webrender.all" = true;
# Do Not Track header
"privacy.donottrackheader.enabled" = true;
"privacy.donottrackheader.value" = 1;
# Enable userChrome customisations
# "toolkit.legacyUserProfileCustomizations.stylesheets" = true;
};
};
};
services.emacs = {
enable = true;
defaultEditor = true;
package = pkgs.emacs-unstable-pgtk;
};
extensions = with config.nur.repos.rycee.firefox-addons; [
bitwarden
clearurls
consent-o-matic
darkreader
localcdn
plasma-integration
privacy-badger
rust-search-extension
skip-redirect
sponsorblock
tab-stash
ublock-origin
unpaywall
];
programs.fish = {
enable = true;
search = {
force = true;
default = "DuckDuckGo";
order = ["DuckDuckGo" "Nix Packages" "Nix Options" "NixOS Wiki"];
functions = {
ec = "emacsclient $argv";
ecc = "emacsclient -c $argv";
ecr = "emacsclient -r $argv";
};
};
programs.firefox = {
enable = true;
profiles = {
default = {
isDefault = true;
settings = {
# Extensions are managed with Nix, so don't update.
"extensions.update.autoUpdateDefault" = false;
"extensions.update.enabled" = false;
# Sync
# "services.sync.username" = config.etu.user.email;
"services.sync.engine.addons" = false; # Do not sync extensions.
"general.autoScroll" = true; # Middle click to scroll
"browser.startup.page" = 3; # Restore previous windows and tabs.
# Privacy enhancements
"browser.newtabpage.activity-stream.feeds.telemetry" = false;
"browser.newtabpage.activity-stream.telemetry" = false;
"browser.newtabpage.activity-stream.feeds.snippets" = false;
"browser.newtabpage.activity-stream.feeds.section.topstories" = false;
"browser.newtabpage.activity-stream.section.highlights.includePocket" = false;
"browser.newtabpage.activity-stream.showSponsored" = false;
"browser.newtabpage.activity-stream.feeds.discoverystreamfeed" = false;
"browser.newtabpage.activity-stream.showSponsoredTopSites" = false;
# Improve performance
"gfx.webrender.all" = true;
# Do Not Track header
"privacy.donottrackheader.enabled" = true;
"privacy.donottrackheader.value" = 1;
# Enable userChrome customisations
# "toolkit.legacyUserProfileCustomizations.stylesheets" = true;
};
extensions = with config.nur.repos.rycee.firefox-addons; [
betterttv
bitwarden
clearurls
consent-o-matic
darkreader
localcdn
onetab
plasma-integration
privacy-badger
rust-search-extension
skip-redirect
sponsorblock
ublock-origin
unpaywall
];
search = {
force = true;
default = "DuckDuckGo";
order = ["DuckDuckGo" "Nix Packages" "Nix Options" "NixOS Wiki"];
engines = {
"DuckDuckGo".metaData = {
alias = "@ddg";
};
"Nix Packages" = {
urls = [
{
template = "https://search.nixos.org/packages";
params = [
{
name = "type";
value = "packages";
}
{
name = "query";
value = "{searchTerms}";
}
];
}
];
icon = "/run/current-system/sw/share/icons/hicolor/scalable/apps/nix-snowflake.svg";
definedAliases = ["@np"];
};
"Nix Options" = {
urls = [
{
template = "https://search.nixos.org/options";
params = [
{
name = "type";
value = "options";
}
{
name = "query";
value = "{searchTerms}";
}
];
}
];
icon = "/run/current-system/sw/share/icons/hicolor/scalable/apps/nix-snowflake.svg";
definedAliases = ["@no"];
};
"Home-Manager Options" = {
urls = [
{
template = "https://mipmip.github.io/home-manager-option-search";
params = [
{
name = "query";
value = "{searchTerms}";
}
];
}
];
icon = "/run/current-system/sw/share/icons/hicolor/scalable/apps/nix-snowflake.svg";
definedAliases = ["@ho"];
};
"NixOS Wiki" = {
urls = [
{
template = "https://nixos.wiki/index.php?search={searchTerms}";
}
];
iconUpdateURL = "https://nixos.wiki/favicon.png";
updateInterval = 24 * 60 * 60 * 1000;
definedAliases = ["@nw"];
};
"Bing".metaData.hidden = true;
"Amazon.de".metaData.hidden = true;
"Google".metaData = {
alias = "@g";
hidden = true;
};
engines = {
"DuckDuckGo".metaData = {
alias = "@ddg";
};
};
bookmarks = [
{
toolbar = true;
bookmarks = [
"Nix Packages" = {
urls = [
{
name = "Home Manager";
url = "https://nixos.wiki/wiki/Home_Manager";
}
];
}
{
name = "wikipedia";
tags = ["wiki"];
keyword = "wiki";
url = "https://en.wikipedia.org/wiki/Special:Search?search=%s&go=Go";
}
{
name = "kernel.org";
url = "https://www.kernel.org";
}
{
name = "Nix sites";
bookmarks = [
{
name = "homepage";
url = "https://nixos.org/";
}
{
name = "wiki";
tags = ["wiki" "nix"];
url = "https://nixos.wiki/";
}
{
name = "Nix sites";
bookmarks = [
template = "https://search.nixos.org/packages";
params = [
{
name = "homepage";
url = "https://nixos.org/";
name = "type";
value = "packages";
}
{
name = "wiki";
url = "https://nixos.wiki/";
name = "query";
value = "{searchTerms}";
}
];
}
];
}
];
icon = "/run/current-system/sw/share/icons/hicolor/scalable/apps/nix-snowflake.svg";
definedAliases = ["@np"];
};
"Nix Options" = {
urls = [
{
template = "https://search.nixos.org/options";
params = [
{
name = "type";
value = "options";
}
{
name = "query";
value = "{searchTerms}";
}
];
}
];
icon = "/run/current-system/sw/share/icons/hicolor/scalable/apps/nix-snowflake.svg";
definedAliases = ["@no"];
};
"Home-Manager Options" = {
urls = [
{
template = "https://mipmip.github.io/home-manager-option-search";
params = [
{
name = "query";
value = "{searchTerms}";
}
];
}
];
icon = "/run/current-system/sw/share/icons/hicolor/scalable/apps/nix-snowflake.svg";
definedAliases = ["@ho"];
};
"NixOS Wiki" = {
urls = [
{
template = "https://nixos.wiki/index.php?search={searchTerms}";
}
];
iconUpdateURL = "https://nixos.wiki/favicon.png";
updateInterval = 24 * 60 * 60 * 1000;
definedAliases = ["@nw"];
};
"Bing".metaData.hidden = true;
"Amazon.de".metaData.hidden = true;
"Google".metaData = {
alias = "@g";
hidden = true;
};
};
};
bookmarks = [
{
toolbar = true;
bookmarks = [
{
name = "Home Manager";
url = "https://nixos.wiki/wiki/Home_Manager";
}
];
}
{
name = "wikipedia";
tags = ["wiki"];
keyword = "wiki";
url = "https://en.wikipedia.org/wiki/Special:Search?search=%s&go=Go";
}
{
name = "kernel.org";
url = "https://www.kernel.org";
}
{
name = "Nix sites";
bookmarks = [
{
name = "homepage";
url = "https://nixos.org/";
}
{
name = "wiki";
tags = ["wiki" "nix"];
url = "https://nixos.wiki/";
}
{
name = "Nix sites";
bookmarks = [
{
name = "homepage";
url = "https://nixos.org/";
}
{
name = "wiki";
url = "https://nixos.wiki/";
}
];
}
];
}
];
};
};
programs.git = {
enable = true;
userName = "Tristan Druyen";
userEmail = "tristan@vault81.de";
aliases = {
ci = "commit";
co = "checkout";
s = "status";
};
extraConfig = {
user.signingkey = "/home/tristand/.ssh/id_ed25519";
commit.gpgsign = true;
gpg.format = "ssh";
};
};
programs.ssh = {
enable = true;
matchBlocks = {
"he3" = {
host = "he3";
hostname = "he3.vault81.de";
user = "root";
identityFile = "~/.ssh/id_hetz_ed25519";
};
"he2" = {
host = "he2";
hostname = "he2.vault81.de";
user = "root";
identityFile = "~/.ssh/id_v81_ed25519";
};
"desk-arch" = {
host = "desk-arch";
hostname = "tristan-desk-arch";
user = "tristand";
identityFile = "~/.ssh/id_v81_ed25519";
};
};
};
programs.gpg = {
enable = true;
};
services.gpg-agent = {
enable = true;
enableExtraSocket = true;
enableSshSupport = true;
};
home.packages = with pkgs; [
alejandra
atool
alacritty
aspell
aspellDicts.en
aspellDicts.en-computers
aspellDicts.en-science
aspellDicts.de
bitwarden
binutils
brave
btop
direnv
emacs-unstable-pgtk
firefox
jellyfin-media-player
neofetch
nodejs_20
kate
rcm
rustup
rust-motd
(ripgrep.override {withPCRE2 = true;})
gnutls
fd
imagemagick
pinentry-emacs
python311Full
zstd
rnix-lsp
texlive.combined.scheme-medium
signal-desktop
statix
tailscale
tokei
thunderbird
zellij
];
home.sessionVariables = {
BROWSER = "firefox";
TERMINAL = "alacritty";
};
home.stateVersion = "23.05";
};
programs.git = {
enable = true;
userName = "Tristan Druyen";
userEmail = "tristan@vault81.de";
aliases = {
ci = "commit";
co = "checkout";
s = "status";
};
extraConfig = {
user.signingkey = "/home/tristand/.ssh/id_ed25519";
commit.gpgsign = true;
gpg.format = "ssh";
};
};
programs.ssh = {
enable = true;
matchBlocks = {
"he3" = {
host = "he3";
hostname = "he3.vault81.de";
user = "root";
identityFile = "~/.ssh/id_hetz_ed25519";
};
"he2" = {
host = "he2";
hostname = "he2.vault81.de";
user = "root";
identityFile = "~/.ssh/id_v81_ed25519";
};
"desk-arch" = {
host = "desk-arch";
hostname = "tristan-desk-arch";
user = "tristand";
identityFile = "~/.ssh/id_v81_ed25519";
};
};
};
programs.gpg = {
enable = true;
};
services.gpg-agent = {
enable = true;
enableExtraSocket = true;
enableSshSupport = true;
};
home.username = "tristand";
home.homeDirectory = "/home/tristand";
home.packages = with pkgs; [
alejandra
atool
alacritty
aspell
aspellDicts.en
aspellDicts.en-computers
aspellDicts.en-science
aspellDicts.de
bitwarden
binutils
brave
btop
direnv
cmake
customPkgs.emacs-unstable-pgtk
firefox
jellyfin-media-player
neofetch
nodejs_20
kate
rcm
rustup
rust-motd
(ripgrep.override {withPCRE2 = true;})
gnutls
gnumake
gcc
libtool
fd
imagemagick
pinentry-emacs
python311Full
zstd
rnix-lsp
texlive.combined.scheme-medium
signal-desktop
statix
tailscale
tokei
thunderbird
zellij
];
home.sessionVariables = {
BROWSER = "firefox";
TERMINAL = "alacritty";
};
home.stateVersion = "23.05";
}

21
users.nix Normal file
View file

@ -0,0 +1,21 @@
{
pkgs,
config,
customPkgs,
...
}: {
users.users.tristand = {
isNormalUser = true;
description = "Tristan Druyen";
extraGroups = ["networkmanager" "wheel" "libvirtd"];
shell = pkgs.fish;
home = "/home/tristand";
hashedPassword = "$6$Wj.XY8JgH5EWuog4$HnbtPJXDEqKXFrzkPVEjih3PytcpBCrkfL7TAwkXd0IFced7kGMlZNliNsAqQ3XqfyUzAYiiKTIqoPVJEk.s..";
};
home-manager.users.tristand = import ./home.nix {
inherit pkgs;
inherit config;
inherit customPkgs;
};
}