root on tmpfs, swaylock, some fixes, etc

This commit is contained in:
chayleaf 2023-02-03 13:07:57 +07:00
parent 69b707bb3f
commit b4ed70706f
12 changed files with 732 additions and 207 deletions

View file

@ -123,5 +123,6 @@
home.packages = with pkgs; [ home.packages = with pkgs; [
rclone fuse jq appimage-run python3Full killall rclone fuse jq appimage-run python3Full killall
comma
]; ];
} }

View file

@ -1,7 +1,10 @@
{ config, pkgs, lib, ... }: { config, pkgs, lib, ... }:
{ {
imports = [ ./terminal.nix ]; imports = [ ./terminal.nix ];
home.sessionVariables."ALSOFT_CONF" = "${config.xdg.configHome}/.config/alsoft.conf"; home.sessionVariables = {
ALSOFT_CONF = "${config.xdg.configHome}/.config/alsoft.conf";
SDL_AUDIODRIVER = "pipewire";
};
xdg.configFile."alsoft.conf".text = '' xdg.configFile."alsoft.conf".text = ''
[general] [general]
hrtf = true hrtf = true

View file

@ -50,44 +50,35 @@ commonConfig = {
]; ];
colors = { colors = {
focused = { focused = {
# background = "#913131";
#background = "#5e4651c9";
#border = "#5e4651c9";
childBorder = "#b0a3a5c0"; childBorder = "#b0a3a5c0";
background = "#24101ac0"; # background = "#24101ac0";
border = "#24101ac0"; background = "#4c4042e0";
# childBorder = "#5e4651c9"; # border = "#24101ac0";
border = "#4c4042e0";
indicator = "#b35656"; indicator = "#b35656";
text = "#ebdadd"; text = "#ebdadd";
}; };
focusedInactive = { focusedInactive = {
# background = "#782a2a"; # background = "#24101ac0";
# border = "#782a2a"; background = "#4c4042e0";
#background = "#5e4651c9"; # border = "#24101ac0";
#border = "#5e4651c9"; border = "#4c4042e0";
#childBorder = "#5e4651c9";
background = "#24101ac0";
border = "#24101ac0";
childBorder = "#24101ac0"; childBorder = "#24101ac0";
# childBorder = "#b32d2d";
indicator = "#b32d2d"; indicator = "#b32d2d";
text = "#ebdadd"; text = "#ebdadd";
}; };
unfocused = { unfocused = {
# background = "#4d2525";
# border = "#472222";
background = "#24101ac0"; background = "#24101ac0";
border = "#24101ac0"; # border = "#24101ac0";
border = "#4c4042e0";
childBorder = "#24101ac0"; childBorder = "#24101ac0";
# childBorder = "#4d2525";
indicator = "#661a1a"; indicator = "#661a1a";
text = "#8c8284"; text = "#ebdadd";
}; };
urgent = { urgent = {
background = "#993d3d"; background = "#993d3d";
border = "#734545"; border = "#734545";
childBorder = "#734545"; childBorder = "#734545";
# childBorder = "#993d3d";
indicator = "#993d3d"; indicator = "#993d3d";
text = "#ebdadd"; text = "#ebdadd";
}; };
@ -280,7 +271,7 @@ in
{ {
command = "${config.programs.waybar.package}/bin/waybar"; command = "${config.programs.waybar.package}/bin/waybar";
mode = "dock"; mode = "dock";
position = "bottom"; position = "top";
hiddenState = "hide"; hiddenState = "hide";
} }
]; ];
@ -293,6 +284,10 @@ in
}; } }; }
]; ];
assigns = { assigns = {
"2" = [
{ app_id = "org.telegram.desktop"; }
{ app_id = "nheko"; }
];
"3" = [{ app_id = "org.keepassxc.KeePassXC"; }]; "3" = [{ app_id = "org.keepassxc.KeePassXC"; }];
}; };
keybindings = genKeybindings options.wayland.windowManager.sway (with pkgs.sway-contrib; keybindings = genKeybindings options.wayland.windowManager.sway (with pkgs.sway-contrib;
@ -358,6 +353,9 @@ in
always = true; always = true;
command = "${pkgs.wl-clipboard}/bin/wl-paste -t text --watch ${pkgs.clipman}/bin/clipman store --no-persist"; command = "${pkgs.wl-clipboard}/bin/wl-paste -t text --watch ${pkgs.clipman}/bin/clipman store --no-persist";
} }
{
command = "${pkgs.swayidle}/bin/swayidle -w timeout 300 '' resume '${pkgs.sway}/bin/swaymsg \"output * dpms on\"'";
}
]; ];
output = { output = {
"*" = { "*" = {
@ -385,4 +383,58 @@ in
export XDG_CURRENT_DESKTOP=sway export XDG_CURRENT_DESKTOP=sway
''; '';
}; };
services.swayidle = {
enable = true;
events = [
{ event = "before-sleep"; command = "${pkgs.swaylock}/bin/swaylock"; }
# after-resume, lock, unlock
];
timeouts = [
{ timeout = 300;
command = "${pkgs.sway}/bin/swaymsg \"output * dpms off\"";
resumeCommand = "${pkgs.sway}/bin/swaymsg \"output * dpms on\""; }
{ timeout = 600;
command = "${pkgs.swaylock}/bin/swaylock"; }
];
};
programs.swaylock.settings = let textColor = "#ebdadd"; bgColor = "#24101ac0"; in {
image = "${config.home.homeDirectory}/var/wallpaper.jpg";
font = "Unifont";
font-size = 64;
indicator-caps-lock = true;
indicator-radius = 256;
indicator-thickness = 32;
separator-color = "#00000000";
layout-text-color = textColor;
layout-bg-color = bgColor;
layout-border-color = "#00000000";
line-uses-inside = true;
inside-color = bgColor;
text-color = textColor;
ring-color = "#8cbf73"; # green
key-hl-color = "#6398bf"; # blue
bs-hl-color = "#e66e6e"; # red
inside-caps-lock-color = bgColor;
text-caps-lock-color = textColor;
ring-caps-lock-color = "#ebbe5f"; # yellow
caps-lock-key-hl-color = "#6398bf"; # same as normal key-hl-color
caps-lock-bs-hl-color = "#e66e6e"; # same as normal bs-hl-color
inside-clear-color = bgColor;
text-clear-color = textColor;
ring-clear-color = "#8cbf73"; # green
inside-ver-color = bgColor;
text-ver-color = textColor;
ring-ver-color = "#a64999"; # purple
inside-wrong-color = bgColor;
text-wrong-color = textColor;
ring-wrong-color = "#e64e4e"; # deep-ish red
};
} }

View file

@ -36,8 +36,10 @@ in {
extraConfig = '' extraConfig = ''
eval %sh{kak-lsp --kakoune -s $kak_session} eval %sh{kak-lsp --kakoune -s $kak_session}
lsp-enable lsp-enable
hook global BufOpenFile .* autoconfigtab
hook global BufNewFile .* autoconfigtab
''; '';
plugins = with pkgs.kakounePlugins; [ kak-lsp sleuth-kak tabs-kak ]; plugins = with pkgs.kakounePlugins; [ kak-lsp smarttab-kak tabs-kak ];
}; };
xdg.configFile."kak-lsp/kak-lsp.toml".text = '' xdg.configFile."kak-lsp/kak-lsp.toml".text = ''
# bash, clangd, json, html, css, python work out of the box # bash, clangd, json, html, css, python work out of the box

View file

@ -5,17 +5,13 @@
#nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; #nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
#instead take it from system config #instead take it from system config
nur.url = "github:nix-community/NUR"; nur.url = "github:nix-community/NUR";
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};
home-manager = { home-manager = {
url = "github:nix-community/home-manager"; url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
}; };
outputs = { self, nixpkgs, home-manager, nur, rust-overlay }: outputs = { self, nixpkgs, home-manager, nur }:
let let
# IRL-related private config # IRL-related private config
priv = if builtins.pathExists ./private.nix then (import ./private.nix) else {}; priv = if builtins.pathExists ./private.nix then (import ./private.nix) else {};
@ -23,7 +19,7 @@
in { in {
homeConfigurations = { homeConfigurations = {
"user@nixmsi" = home-manager.lib.homeManagerConfiguration { "user@nixmsi" = home-manager.lib.homeManagerConfiguration {
pkgs = nixpkgs.legacyPackages."x86_64-linux".extend rust-overlay.overlays.default; pkgs = nixpkgs.legacyPackages."x86_64-linux";
modules = [ modules = [
nur.nixosModules.nur nur.nixosModules.nur
./hosts/nixmsi.nix ./hosts/nixmsi.nix

View file

@ -3,14 +3,37 @@
version = 3 version = 3
[[package]] [[package]]
name = "ahash" name = "aho-corasick"
version = "0.7.6" version = "0.7.20"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" checksum = "cc936419f96fa211c1b9166887b38e5e40b19958e5b895be7c1f93adec7071ac"
dependencies = [ dependencies = [
"getrandom", "memchr",
"once_cell", ]
"version_check",
[[package]]
name = "async-broadcast"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1b19760fa2b7301cf235360ffd6d3558b1ed4249edd16d6cca8d690cee265b95"
dependencies = [
"event-listener",
"futures-core",
"parking_lot",
]
[[package]]
name = "async-executor"
version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "17adb73da160dfb475c183343c8cccd80721ea5a605d3eb57125f0a7b7a92d0b"
dependencies = [
"async-lock",
"async-task",
"concurrent-queue",
"fastrand",
"futures-lite",
"slab",
] ]
[[package]] [[package]]
@ -55,15 +78,21 @@ dependencies = [
[[package]] [[package]]
name = "async-recursion" name = "async-recursion"
version = "0.3.2" version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d7d78656ba01f1b93024b7c3a0467f1608e4be67d725749fdcd7d2c7678fd7a2" checksum = "3b015a331cc64ebd1774ba119538573603427eaace0a1950c423ab971f903796"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn", "syn",
] ]
[[package]]
name = "async-task"
version = "4.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7a40729d2133846d9ed0ea60a8b9541bccddab49cd30f0715a1da672fe9a2524"
[[package]] [[package]]
name = "async-trait" name = "async-trait"
version = "0.1.63" version = "0.1.63"
@ -87,6 +116,21 @@ version = "1.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
[[package]]
name = "block-buffer"
version = "0.10.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "69cce20737498f97b993470a6e536b8523f0af7892a4f928cceb1ac5e52ebe7e"
dependencies = [
"generic-array",
]
[[package]]
name = "byteorder"
version = "1.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610"
[[package]] [[package]]
name = "bytes" name = "bytes"
version = "1.1.0" version = "1.1.0"
@ -114,6 +158,15 @@ dependencies = [
"crossbeam-utils", "crossbeam-utils",
] ]
[[package]]
name = "cpufeatures"
version = "0.2.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "28d997bd5e24a5928dd43e46dc529867e207907fe0b239c3477d924f7f2ca320"
dependencies = [
"libc",
]
[[package]] [[package]]
name = "crossbeam-utils" name = "crossbeam-utils"
version = "0.8.14" version = "0.8.14"
@ -124,58 +177,85 @@ dependencies = [
] ]
[[package]] [[package]]
name = "dbus-async" name = "crypto-common"
version = "2.3.1" version = "0.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "37657d5c76f7966ccee7cc3ab0cc0055bac1742021551ed212ea5ca3f72882aa" checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3"
dependencies = [
"generic-array",
"typenum",
]
[[package]]
name = "derivative"
version = "2.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "digest"
version = "0.10.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8168378f4e5023e7218c89c891c0fd8ecdb5e5e4f18cb78f38cf245dd021e76f"
dependencies = [
"block-buffer",
"crypto-common",
]
[[package]]
name = "dirs"
version = "4.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ca3aa72a6f96ea37bbc5aa912f6788242832f75369bdfdadcb0e38423f100059"
dependencies = [
"dirs-sys",
]
[[package]]
name = "dirs-sys"
version = "0.3.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1b1d1d91c932ef41c0f2663aa8b0ca0342d444d842c06914aa0a7e352d0bada6"
dependencies = [ dependencies = [
"async-recursion",
"async-trait",
"bitflags",
"bytes",
"dbus-message-parser",
"dbus-server-address-parser",
"futures",
"hex",
"libc", "libc",
"log", "redox_users",
"lru", "winapi",
"retain_mut",
"thiserror",
"tokio",
]
[[package]]
name = "dbus-message-parser"
version = "4.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a1cadcd65b6ff5e016ab3848a6dcebb6578ddbf3a7373093381e6590899ea750"
dependencies = [
"bitflags",
"bytes",
"cfg-if",
"lazy_static",
"thiserror",
]
[[package]]
name = "dbus-server-address-parser"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "87ba14fedfb911759c9b49fceee906d41f8e7e9442593d5f71a20cfb3effa9c4"
dependencies = [
"thiserror",
] ]
[[package]] [[package]]
name = "dotfiles-home-daemon" name = "dotfiles-home-daemon"
version = "0.1.0" version = "0.1.0"
dependencies = [ dependencies = [
"dbus-async",
"dbus-message-parser",
"futures-util", "futures-util",
"swayipc-async", "swayipc-async",
"tokio", "tokio",
"zbus",
]
[[package]]
name = "enumflags2"
version = "0.7.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e75d4cd21b95383444831539909fbb14b9dc3fdceb2a6f5d36577329a1f55ccb"
dependencies = [
"enumflags2_derive",
"serde",
]
[[package]]
name = "enumflags2_derive"
version = "0.7.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f58dc3c5e468259f19f2d46304a6b28f1c3d034442e14b322d2b850e36f6d5ae"
dependencies = [
"proc-macro2",
"quote",
"syn",
] ]
[[package]] [[package]]
@ -193,48 +273,12 @@ dependencies = [
"instant", "instant",
] ]
[[package]]
name = "futures"
version = "0.3.25"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "38390104763dc37a5145a53c29c63c1290b5d316d6086ec32c293f6736051bb0"
dependencies = [
"futures-channel",
"futures-core",
"futures-executor",
"futures-io",
"futures-sink",
"futures-task",
"futures-util",
]
[[package]]
name = "futures-channel"
version = "0.3.25"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "52ba265a92256105f45b719605a571ffe2d1f0fea3807304b522c1d778f79eed"
dependencies = [
"futures-core",
"futures-sink",
]
[[package]] [[package]]
name = "futures-core" name = "futures-core"
version = "0.3.25" version = "0.3.25"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "04909a7a7e4633ae6c4a9ab280aeb86da1236243a77b694a49eacd659a4bd3ac" checksum = "04909a7a7e4633ae6c4a9ab280aeb86da1236243a77b694a49eacd659a4bd3ac"
[[package]]
name = "futures-executor"
version = "0.3.25"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7acc85df6714c176ab5edf386123fafe217be88c0840ec11f199441134a074e2"
dependencies = [
"futures-core",
"futures-task",
"futures-util",
]
[[package]] [[package]]
name = "futures-io" name = "futures-io"
version = "0.3.25" version = "0.3.25"
@ -285,18 +329,25 @@ version = "0.3.25"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "197676987abd2f9cadff84926f410af1c183608d36641465df73ae8211dc65d6" checksum = "197676987abd2f9cadff84926f410af1c183608d36641465df73ae8211dc65d6"
dependencies = [ dependencies = [
"futures-channel",
"futures-core", "futures-core",
"futures-io",
"futures-macro", "futures-macro",
"futures-sink", "futures-sink",
"futures-task", "futures-task",
"memchr",
"pin-project-lite", "pin-project-lite",
"pin-utils", "pin-utils",
"slab", "slab",
] ]
[[package]]
name = "generic-array"
version = "0.14.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bff49e947297f3312447abdca79f45f4738097cc82b06e72054d2223f601f1b9"
dependencies = [
"typenum",
"version_check",
]
[[package]] [[package]]
name = "getrandom" name = "getrandom"
version = "0.2.8" version = "0.2.8"
@ -313,9 +364,6 @@ name = "hashbrown"
version = "0.12.3" version = "0.12.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888"
dependencies = [
"ahash",
]
[[package]] [[package]]
name = "hex" name = "hex"
@ -323,6 +371,16 @@ version = "0.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70"
[[package]]
name = "indexmap"
version = "1.9.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1885e79c1fc4b10f0e172c475f458b7f7b93061064d98c3293e98c5ba0c8b399"
dependencies = [
"autocfg",
"hashbrown",
]
[[package]] [[package]]
name = "instant" name = "instant"
version = "0.1.12" version = "0.1.12"
@ -350,6 +408,16 @@ version = "0.2.139"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79" checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79"
[[package]]
name = "lock_api"
version = "0.4.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "435011366fe56583b16cf956f9df0095b405b82d76425bc8981c0e22e60ec4df"
dependencies = [
"autocfg",
"scopeguard",
]
[[package]] [[package]]
name = "log" name = "log"
version = "0.4.17" version = "0.4.17"
@ -359,15 +427,6 @@ dependencies = [
"cfg-if", "cfg-if",
] ]
[[package]]
name = "lru"
version = "0.7.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e999beba7b6e8345721bd280141ed958096a2e4abdf74f67ff4ce49b4b54e47a"
dependencies = [
"hashbrown",
]
[[package]] [[package]]
name = "memchr" name = "memchr"
version = "2.5.0" version = "2.5.0"
@ -375,34 +434,47 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d"
[[package]] [[package]]
name = "mio" name = "memoffset"
version = "0.7.14" version = "0.6.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8067b404fe97c70829f082dec8bcf4f71225d7eaea1d8645349cb76fa06205cc" checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce"
dependencies = [
"autocfg",
]
[[package]]
name = "mio"
version = "0.8.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e5d732bc30207a6423068df043e3d02e0735b155ad7ce1a6f76fe2baa5b158de"
dependencies = [ dependencies = [
"libc", "libc",
"log", "log",
"miow", "wasi",
"ntapi", "windows-sys",
"winapi",
] ]
[[package]] [[package]]
name = "miow" name = "nix"
version = "0.3.7" version = "0.25.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b9f1c5b025cda876f66ef43a113f91ebc9f4ccef34843000e0adf6ebbab84e21" checksum = "f346ff70e7dbfd675fe90590b92d59ef2de15a8779ae305ebcbfd3f0caf59be4"
dependencies = [ dependencies = [
"winapi", "autocfg",
"bitflags",
"cfg-if",
"libc",
"memoffset",
"pin-utils",
] ]
[[package]] [[package]]
name = "ntapi" name = "nom8"
version = "0.3.7" version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c28774a7fd2fbb4f0babd8237ce554b73af68021b5f695a3cebd6c59bac0980f" checksum = "ae01545c9c7fc4486ab7debaf2aad7003ac19431791868fb2e8066df97fad2f8"
dependencies = [ dependencies = [
"winapi", "memchr",
] ]
[[package]] [[package]]
@ -411,12 +483,45 @@ version = "1.17.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6f61fba1741ea2b3d6a1e3178721804bb716a68a6aeba1149b5d52e3d464ea66" checksum = "6f61fba1741ea2b3d6a1e3178721804bb716a68a6aeba1149b5d52e3d464ea66"
[[package]]
name = "ordered-stream"
version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "360a24bdacdb7801a1a6af8500392864791c130ebe8bd9a063158cab00040c90"
dependencies = [
"futures-core",
"pin-project-lite",
]
[[package]] [[package]]
name = "parking" name = "parking"
version = "2.0.0" version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "427c3892f9e783d91cc128285287e70a59e206ca452770ece88a76f7a3eddd72" checksum = "427c3892f9e783d91cc128285287e70a59e206ca452770ece88a76f7a3eddd72"
[[package]]
name = "parking_lot"
version = "0.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f"
dependencies = [
"lock_api",
"parking_lot_core",
]
[[package]]
name = "parking_lot_core"
version = "0.9.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ba1ef8814b5c993410bb3adfad7a5ed269563e4a2f90c41f5d85be7fb47133bf"
dependencies = [
"cfg-if",
"libc",
"redox_syscall",
"smallvec",
"windows-sys",
]
[[package]] [[package]]
name = "pin-project-lite" name = "pin-project-lite"
version = "0.2.9" version = "0.2.9"
@ -443,6 +548,22 @@ dependencies = [
"windows-sys", "windows-sys",
] ]
[[package]]
name = "ppv-lite86"
version = "0.2.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de"
[[package]]
name = "proc-macro-crate"
version = "1.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "66618389e4ec1c7afe67d51a9bf34ff9236480f8d51e7489b7d5ab0303c13f34"
dependencies = [
"once_cell",
"toml_edit",
]
[[package]] [[package]]
name = "proc-macro2" name = "proc-macro2"
version = "1.0.50" version = "1.0.50"
@ -462,10 +583,80 @@ dependencies = [
] ]
[[package]] [[package]]
name = "retain_mut" name = "rand"
version = "0.1.9" version = "0.8.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4389f1d5789befaf6029ebd9f7dac4af7f7e3d61b69d4f30e2ac02b57e7712b0" checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404"
dependencies = [
"libc",
"rand_chacha",
"rand_core",
]
[[package]]
name = "rand_chacha"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88"
dependencies = [
"ppv-lite86",
"rand_core",
]
[[package]]
name = "rand_core"
version = "0.6.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
dependencies = [
"getrandom",
]
[[package]]
name = "redox_syscall"
version = "0.2.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a"
dependencies = [
"bitflags",
]
[[package]]
name = "redox_users"
version = "0.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b"
dependencies = [
"getrandom",
"redox_syscall",
"thiserror",
]
[[package]]
name = "regex"
version = "1.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "48aaa5748ba571fb95cd2c85c09f629215d3a6ece942baa100950af03a34f733"
dependencies = [
"aho-corasick",
"memchr",
"regex-syntax",
]
[[package]]
name = "regex-syntax"
version = "0.6.28"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848"
[[package]]
name = "remove_dir_all"
version = "0.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7"
dependencies = [
"winapi",
]
[[package]] [[package]]
name = "ryu" name = "ryu"
@ -473,6 +664,12 @@ version = "1.0.12"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7b4b9743ed687d4b4bcedf9ff5eaa7398495ae14e61cba0a295704edbc7decde" checksum = "7b4b9743ed687d4b4bcedf9ff5eaa7398495ae14e61cba0a295704edbc7decde"
[[package]]
name = "scopeguard"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
[[package]] [[package]]
name = "serde" name = "serde"
version = "1.0.152" version = "1.0.152"
@ -505,12 +702,25 @@ dependencies = [
] ]
[[package]] [[package]]
name = "signal-hook-registry" name = "serde_repr"
version = "1.4.0" version = "0.1.10"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e51e73328dc4ac0c7ccbda3a494dfa03df1de2f46018127f60c693f2648455b0" checksum = "9a5ec9fa74a20ebbe5d9ac23dac1fc96ba0ecfe9f50f2843b52e537b10fbcb4e"
dependencies = [ dependencies = [
"libc", "proc-macro2",
"quote",
"syn",
]
[[package]]
name = "sha1"
version = "0.10.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f04293dc80c3993519f2d7f6f511707ee7094fe0c6d3406feb330cdb3540eba3"
dependencies = [
"cfg-if",
"cpufeatures",
"digest",
] ]
[[package]] [[package]]
@ -522,6 +732,12 @@ dependencies = [
"autocfg", "autocfg",
] ]
[[package]]
name = "smallvec"
version = "1.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0"
[[package]] [[package]]
name = "socket2" name = "socket2"
version = "0.4.7" version = "0.4.7"
@ -532,6 +748,12 @@ dependencies = [
"winapi", "winapi",
] ]
[[package]]
name = "static_assertions"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
[[package]] [[package]]
name = "swayipc-async" name = "swayipc-async"
version = "2.0.1" version = "2.0.1"
@ -568,6 +790,20 @@ dependencies = [
"unicode-ident", "unicode-ident",
] ]
[[package]]
name = "tempfile"
version = "3.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5cdb1ef4eaeeaddc8fbd371e5017057064af0911902ef36b39801f67cc6d79e4"
dependencies = [
"cfg-if",
"fastrand",
"libc",
"redox_syscall",
"remove_dir_all",
"winapi",
]
[[package]] [[package]]
name = "thiserror" name = "thiserror"
version = "1.0.38" version = "1.0.38"
@ -590,19 +826,20 @@ dependencies = [
[[package]] [[package]]
name = "tokio" name = "tokio"
version = "1.15.0" version = "1.25.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fbbf1c778ec206785635ce8ad57fe52b3009ae9e0c9f574a728f3049d3e55838" checksum = "c8e00990ebabbe4c14c08aca901caed183ecd5c09562a12c824bb53d3c3fd3af"
dependencies = [ dependencies = [
"autocfg",
"bytes", "bytes",
"libc", "libc",
"memchr", "memchr",
"mio", "mio",
"once_cell",
"pin-project-lite", "pin-project-lite",
"signal-hook-registry", "socket2",
"tokio-macros", "tokio-macros",
"winapi", "tracing",
"windows-sys",
] ]
[[package]] [[package]]
@ -616,6 +853,71 @@ dependencies = [
"syn", "syn",
] ]
[[package]]
name = "toml_datetime"
version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4553f467ac8e3d374bc9a177a26801e5d0f9b211aa1673fb137a403afd1c9cf5"
[[package]]
name = "toml_edit"
version = "0.18.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "56c59d8dd7d0dcbc6428bf7aa2f0e823e26e43b3c9aca15bbc9475d23e5fa12b"
dependencies = [
"indexmap",
"nom8",
"toml_datetime",
]
[[package]]
name = "tracing"
version = "0.1.37"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8"
dependencies = [
"cfg-if",
"pin-project-lite",
"tracing-attributes",
"tracing-core",
]
[[package]]
name = "tracing-attributes"
version = "0.1.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4017f8f45139870ca7e672686113917c71c7a6e02d4924eda67186083c03081a"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "tracing-core"
version = "0.1.30"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "24eb03ba0eab1fd845050058ce5e616558e8f8d8fca633e6b163fe25c797213a"
dependencies = [
"once_cell",
]
[[package]]
name = "typenum"
version = "1.16.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba"
[[package]]
name = "uds_windows"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ce65604324d3cce9b966701489fbd0cf318cb1f7bd9dd07ac9a4ee6fb791930d"
dependencies = [
"tempfile",
"winapi",
]
[[package]] [[package]]
name = "unicode-ident" name = "unicode-ident"
version = "1.0.6" version = "1.0.6"
@ -727,3 +1029,93 @@ name = "windows_x86_64_msvc"
version = "0.42.1" version = "0.42.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "447660ad36a13288b1db4d4248e857b510e8c3a225c822ba4fb748c0aafecffd" checksum = "447660ad36a13288b1db4d4248e857b510e8c3a225c822ba4fb748c0aafecffd"
[[package]]
name = "zbus"
version = "3.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "23eaeb1859a3cd5c5f780b101dfe626bf250a5f34873c3c0226d6d9f7a4d107c"
dependencies = [
"async-broadcast",
"async-executor",
"async-io",
"async-lock",
"async-recursion",
"async-task",
"async-trait",
"byteorder",
"derivative",
"dirs",
"enumflags2",
"event-listener",
"futures-core",
"futures-sink",
"futures-util",
"hex",
"lazy_static",
"nix",
"once_cell",
"ordered-stream",
"rand",
"serde",
"serde_repr",
"sha1",
"static_assertions",
"tokio",
"tracing",
"uds_windows",
"winapi",
"zbus_macros",
"zbus_names",
"zvariant",
]
[[package]]
name = "zbus_macros"
version = "3.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e83c1c6d669caa4773ebe8cb2ebea2a8d0c6ea27fc6c5c8916c7308cbf1db3b1"
dependencies = [
"proc-macro-crate",
"proc-macro2",
"quote",
"regex",
"syn",
]
[[package]]
name = "zbus_names"
version = "2.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f34f314916bd89bdb9934154627fab152f4f28acdda03e7c4c68181b214fe7e3"
dependencies = [
"serde",
"static_assertions",
"zvariant",
]
[[package]]
name = "zvariant"
version = "3.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "576cc41e65c7f283e5460f5818073e68fb1f1631502b969ef228c2e03c862efb"
dependencies = [
"byteorder",
"enumflags2",
"libc",
"serde",
"static_assertions",
"zvariant_derive",
]
[[package]]
name = "zvariant_derive"
version = "3.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0fd4aafc0dee96ae7242a24249ce9babf21e1562822f03df650d4e68c20e41ed"
dependencies = [
"proc-macro-crate",
"proc-macro2",
"quote",
"syn",
]

View file

@ -6,11 +6,10 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies] [dependencies]
dbus-async = "2" zbus = { version = "3", features = ["tokio"] }
dbus-message-parser = "4"
futures-util = "0.3" futures-util = "0.3"
swayipc-async = "2" swayipc-async = "2"
[dependencies.tokio] [dependencies.tokio]
version = "1" version = "1"
features = ["rt"] features = ["rt", "macros"]

View file

@ -1,24 +1,16 @@
use dbus_async::DBus;
use dbus_message_parser::{message::Message, value::Value};
use futures_util::stream::StreamExt; use futures_util::stream::StreamExt;
use std::{collections::HashSet, sync::Arc}; use std::collections::HashSet;
use swayipc_async::{Connection, Event, EventType, WindowChange}; use swayipc_async::{Connection, Event, EventType, WindowChange};
#[tokio::main(flavor = "current_thread")] #[tokio::main(flavor = "current_thread")]
async fn main() { async fn main() {
let (sys_dbus, _server_handle) = DBus::system(false, false) let sys_dbus = Box::leak(Box::new(zbus::Connection::system().await.unwrap()));
.await let _ses_dbus = Box::leak(Box::new(zbus::Connection::session().await.unwrap()));
.expect("failed to get the DBus object");
let (ses_dbus, _server_handle) = DBus::session(false, false)
.await
.expect("failed to get the DBus object");
let sys_dbus = Arc::new(sys_dbus);
let _ses_dbus = Arc::new(ses_dbus);
let mut handlers = Vec::<Box<dyn SwayIpcHandler>>::new(); let mut handlers = Vec::<Box<dyn SwayIpcHandler>>::new();
for args in std::env::args().skip(1) { for args in std::env::args().skip(1) {
handlers.push(match args.as_str() { handlers.push(match args.as_str() {
"system76-scheduler" => Box::new(System76::new(sys_dbus.clone())), "system76-scheduler" => Box::new(System76::new(sys_dbus).await),
_ => panic!("handler not supported"), _ => panic!("handler not supported"),
}) })
} }
@ -31,45 +23,63 @@ async fn main() {
handler.register(&mut subs); handler.register(&mut subs);
} }
let subs = subs.into_iter().collect::<Vec<_>>(); let subs = subs.into_iter().collect::<Vec<_>>();
loop {
drop(start(&subs, &mut handlers).await);
tokio::time::sleep(std::time::Duration::from_secs(10)).await;
}
}
async fn start(subs: &[EventType], handlers: &mut [Box<dyn SwayIpcHandler>]) -> Result<(), swayipc_async::Error> {
let mut events = Connection::new() let mut events = Connection::new()
.await .await?
.unwrap()
.subscribe(&subs) .subscribe(&subs)
.await .await?;
.unwrap();
while let Some(event) = events.next().await { while let Some(event) = events.next().await {
if let Ok(event) = event { match event {
for handler in &mut handlers { Ok(event) => {
for handler in &mut *handlers {
handler.handle(&event); handler.handle(&event);
} }
} }
Err(err) => match err {
swayipc_async::Error::Io(_)
| swayipc_async::Error::InvalidMagic(_)
| swayipc_async::Error::SubscriptionFailed(_)
=> return Err(err),
_ => {}
} }
} }
}
Ok(())
}
trait SwayIpcHandler { trait SwayIpcHandler {
fn register(&mut self, subs: &mut HashSet<EventType>); fn register(&mut self, subs: &mut HashSet<EventType>);
fn handle(&mut self, event: &Event); fn handle(&mut self, event: &Event);
} }
struct System76 { #[zbus::dbus_proxy(
dbus: Arc<DBus>, interface = "com.system76.Scheduler",
msg: Message, default_service = "com.system76.Scheduler",
default_path = "/com/system76/Scheduler"
)]
pub trait System76Scheduler {
/// This process will have its process group prioritized over background processes
fn set_foreground_process(&mut self, pid: u32) -> zbus::fdo::Result<()>;
} }
impl System76 { struct System76<'a> {
pub fn new(dbus: Arc<DBus>) -> Self { proxy: System76SchedulerProxy<'a>,
let msg = Message::method_call( }
"com.system76.Scheduler".try_into().unwrap(),
"/com/system76/Scheduler".try_into().unwrap(), impl<'a> System76<'a> {
"com.system76.Scheduler".try_into().unwrap(), pub async fn new(dbus: &'a zbus::Connection) -> System76<'a> {
"SetForegroundProcess".try_into().unwrap(), let proxy = System76SchedulerProxy::new(dbus).await.unwrap();
); Self { proxy }
Self { dbus, msg }
} }
} }
impl SwayIpcHandler for System76 { impl SwayIpcHandler for System76<'static> {
fn register(&mut self, subs: &mut HashSet<EventType>) { fn register(&mut self, subs: &mut HashSet<EventType>) {
subs.insert(EventType::Window); subs.insert(EventType::Window);
} }
@ -79,11 +89,9 @@ impl SwayIpcHandler for System76 {
return; return;
} }
if let Some(pid) = window.container.pid.and_then(|x| u32::try_from(x).ok()) { if let Some(pid) = window.container.pid.and_then(|x| u32::try_from(x).ok()) {
let dbus = self.dbus.clone(); let mut proxy = self.proxy.clone();
let mut msg = self.msg.clone();
msg.add_value(Value::Uint32(pid));
tokio::spawn(async move { tokio::spawn(async move {
drop(dbus.call(msg).await); drop(proxy.set_foreground_process(pid).await);
}); });
} }
} }

View file

@ -34,7 +34,7 @@
bottles bottles
gimp krita blender gimp krita blender
tdesktop tdesktop
rustc rustfmt cargo clang rustc rustfmt cargo clippy
(import ../common/home-daemon.nix { inherit lib pkgs; }) (import ../common/home-daemon.nix { inherit lib pkgs; })
# waiting until the PR gets merged # waiting until the PR gets merged
(looking-glass-client.overrideAttrs (old: { (looking-glass-client.overrideAttrs (old: {

View file

@ -1 +1,2 @@
[ (import (builtins.fetchTarball "https://github.com/oxalica/rust-overlay/archive/master.tar.gz")) ] # [ (import (builtins.fetchTarball "https://github.com/oxalica/rust-overlay/archive/master.tar.gz")) ]
[ (import <rust-overlay>) ]

View file

@ -5,9 +5,15 @@
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
utils.url = "github:gytis-ivaskevicius/flake-utils-plus"; utils.url = "github:gytis-ivaskevicius/flake-utils-plus";
nixos-hardware.url = "github:NixOS/nixos-hardware"; nixos-hardware.url = "github:NixOS/nixos-hardware";
impermanence.url = "github:nix-community/impermanence";
# simply make rust-overlay available for the whole system
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};
}; };
outputs = inputs@{ self, nixpkgs, utils, nixos-hardware }: outputs = inputs@{ self, nixpkgs, utils, nixos-hardware, rust-overlay, impermanence }:
let let
hw = nixos-hardware.nixosModules; hw = nixos-hardware.nixosModules;
# IRL-related stuff I'd rather not put into git # IRL-related stuff I'd rather not put into git
@ -31,6 +37,7 @@
system = "x86_64-linux"; system = "x86_64-linux";
modules = [ modules = [
./hosts/nixmsi.nix ./hosts/nixmsi.nix
impermanence.nixosModule
hw.common-pc-ssd # enables fstrim hw.common-pc-ssd # enables fstrim
hw.common-cpu-amd # microcode hw.common-cpu-amd # microcode
hw.common-cpu-amd-pstate # amd-pstate hw.common-cpu-amd-pstate # amd-pstate

View file

@ -58,6 +58,14 @@ in {
steam-hardware.enable = true; steam-hardware.enable = true;
video.hidpi.enable = true; video.hidpi.enable = true;
enableRedistributableFirmware = true; enableRedistributableFirmware = true;
opengl.driSupport32Bit = true;
};
services.tlp.settings = {
USB_DENYLIST = "0bda:8156";
USB_EXCLUDE_PHONE = 1;
START_CHARGE_THRESH_BAT0 = 75;
STOP_CHARGE_THRESH_BAT0 = 80;
}; };
# see common/vfio.nix # see common/vfio.nix
@ -72,21 +80,64 @@ in {
# max compression! my cpu is pretty good anyway # max compression! my cpu is pretty good anyway
compress = "compress=zstd:15"; compress = "compress=zstd:15";
discard = "discard=async"; discard = "discard=async";
neededForBoot = true;
in { in {
"/" = { inherit device fsType; # mount root on tmpfs
"/" = { device = "none"; fsType = "tmpfs"; inherit neededForBoot;
options = [ "defaults" "size=2G" "mode=755" ]; };
"/persist" =
{ inherit device fsType neededForBoot;
options = [ discard compress "subvol=@" ]; }; options = [ discard compress "subvol=@" ]; };
"/nix" = { inherit device fsType; "/nix" = { inherit device fsType neededForBoot;
options = [ discard compress "subvol=@nix" "noatime" ]; }; options = [ discard compress "subvol=@nix" "noatime" ]; };
"/swap" = { inherit device fsType; "/swap" = { inherit device fsType neededForBoot;
options = [ discard "subvol=@swap" "noatime" ]; }; options = [ discard "subvol=@swap" "noatime" ]; };
"/home" = { inherit device fsType; "/home" = { inherit device fsType;
options = [ discard compress "subvol=@home" ]; }; options = [ discard compress "subvol=@home" ]; };
"/.snapshots" = "/.snapshots" =
{ inherit device fsType; { inherit device fsType;
options = [ discard compress "subvol=@snapshots" ]; }; options = [ discard compress "subvol=@snapshots" ]; };
"/boot" = { inherit device fsType neededForBoot;
options = [ discard compress "subvol=@boot" ]; };
"/boot/efi" = "/boot/efi" =
{ device = efiPart; { device = efiPart; fsType = "vfat"; inherit neededForBoot; };
fsType = "vfat"; }; };
environment.persistence."/persist" = {
hideMounts = true;
directories = [
# nixos files
"/etc/nixos"
"/var/lib/nixos"
# mullvad vpn
"/etc/mullvad-vpn"
"/var/cache/mullvad-vpn"
# as weird as it sounds, I won't use tmpfs for /tmp in case I'll have to put files over 2GB there
"/tmp"
# qemu/libvirt
"/var/cache/libvirt"
"/var/lib/libvirt"
"/var/lib/swtpm-localca"
# stored network info
"/var/lib/iwd"
"/var/db/dhcpcd"
# persist this since everything here is cleaned up by systemd-tmpfiles over time anyway
# ...or so I'd like to believe
"/var/lib/systemd"
"/var/db/sudo/lectured"
"/var/log"
];
files = [
# hardware-related
"/etc/adjtime"
"/etc/machine-id"
];
}; };
swapDevices = [ { device = "/swap/swapfile"; } ]; swapDevices = [ { device = "/swap/swapfile"; } ];
@ -131,18 +182,33 @@ in {
pulse.enable = true; pulse.enable = true;
jack.enable = true; jack.enable = true;
}; };
# zsh
environment.pathsToLink = [ "/share/zsh" ];
programs.fuse.userAllowOther = true;
xdg.portal = { xdg.portal = {
enable = true; enable = true;
extraPortals = with pkgs; [ xdg-desktop-portal-gtk xdg-desktop-portal-wlr ]; extraPortals = with pkgs; [ xdg-desktop-portal-gtk xdg-desktop-portal-wlr ];
}; };
users.mutableUsers = false;
users.users.user = { users.users.user = {
isNormalUser = true; isNormalUser = true;
extraGroups = [ "networkmanager" "wheel" ]; extraGroups = [ "networkmanager" "wheel" ];
# initialHashedPassword = ...set in private.nix;
}; };
# users.users.root.initialHashedPassword = ...set in private.nix;
nix = { nix = {
settings.allowed-users = [ "user" ]; settings = {
allowed-users = [ "user" ];
auto-optimise-store = true;
};
gc = {
automatic = true;
dates = "weekly";
options = "--delete-older-than 30d";
};
package = pkgs.nixFlakes; package = pkgs.nixFlakes;
extraOptions = '' extraOptions = ''
experimental-features = nix-command flakes experimental-features = nix-command flakes
@ -151,10 +217,8 @@ in {
### RANDOM PATCHES ### ### RANDOM PATCHES ###
programs.fuse.userAllowOther = true; # why is this not part of base NixOS?
systemd.tmpfiles.rules = [ "d /var/lib/systemd/pstore 0755 root root 14d" ];
# zsh
environment.pathsToLink = [ "/share/zsh" ];
# dedupe # dedupe
@ -162,7 +226,7 @@ in {
filesystems.cryptroot = { filesystems.cryptroot = {
spec = "UUID=${cryptrootUuid}"; spec = "UUID=${cryptrootUuid}";
hashTableSizeMB = 128; hashTableSizeMB = 128;
# extraOptions = [ ]; extraOptions = [ "--loadavg-target" "8.0" ];
}; };
}; };