Formatting + update

This commit is contained in:
Aleksandr Lebedev 2025-07-25 22:56:40 +02:00
parent 93de64c64e
commit 9c895e9cc0
61 changed files with 2350 additions and 2100 deletions

View file

@ -1,5 +1,7 @@
{ device, swapSize ? "16G" }:
{ {
device,
swapSize ? "16G",
}: {
disko.devices = { disko.devices = {
disk.${device} = { disk.${device} = {
type = "disk"; type = "disk";
@ -7,7 +9,8 @@
content = { content = {
type = "gpt"; # Initialize the disk with a GPT partition table type = "gpt"; # Initialize the disk with a GPT partition table
partitions = { partitions = {
ESP = { # Setup the EFI System Partition ESP = {
# Setup the EFI System Partition
type = "EF00"; # Set the partition type type = "EF00"; # Set the partition type
size = "1000M"; # Make the partition a gig size = "1000M"; # Make the partition a gig
content = { content = {
@ -16,7 +19,8 @@
mountpoint = "/boot"; # Mount it to /boot mountpoint = "/boot"; # Mount it to /boot
}; };
}; };
primary = { # Setup the LVM partition primary = {
# Setup the LVM partition
size = "100%"; # Fill up the rest of the drive with it size = "100%"; # Fill up the rest of the drive with it
content = { content = {
type = "lvm_pv"; # pvcreate type = "lvm_pv"; # pvcreate
@ -26,17 +30,22 @@
}; };
}; };
}; };
lvm_vg = { # vgcreate lvm_vg = {
vg1 = { # /dev/vg1 # vgcreate
vg1 = {
# /dev/vg1
type = "lvm_vg"; type = "lvm_vg";
lvs = { # lvcreate lvs = {
swap = { # Logical Volume = "swap", /dev/vg1/swap # lvcreate
swap = {
# Logical Volume = "swap", /dev/vg1/swap
size = swapSize; size = swapSize;
content = { content = {
type = "swap"; type = "swap";
}; };
}; };
root = { # Logical Volume = "root", /dev/vg1/root root = {
# Logical Volume = "root", /dev/vg1/root
size = "100%FREE"; # Use the remaining space in the Volume Group size = "100%FREE"; # Use the remaining space in the Volume Group
content = { content = {
type = "filesystem"; type = "filesystem";

View file

@ -1,5 +1,7 @@
{ device, mountpoint ? "/run/extraDrive" }:
{ {
device,
mountpoint ? "/run/extraDrive",
}: {
disko.devices = { disko.devices = {
disk = { disk = {
"${device}" = { "${device}" = {

View file

@ -1,7 +1,4 @@
{ {device ? throw "Set this to your disk device, e.g. /dev/sda", ...}: {
device ? throw "Set this to your disk device, e.g. /dev/sda",
...
}: {
disko.devices = { disko.devices = {
disk.main = { disk.main = {
inherit device; inherit device;

View file

@ -1,8 +1,4 @@
{ {device ? throw "Set this to your disk device, e.g. /dev/sda", ...}: {
device ? throw "Set this to your disk device, e.g. /dev/sda",
...
}:
{
disko.devices = { disko.devices = {
disk = { disk = {
main = { main = {
@ -52,31 +48,33 @@
nodev = { nodev = {
"/" = { "/" = {
fsType = "tmpfs"; fsType = "tmpfs";
mountOptions = [ "defaults" "size=8G" "mode=755" ]; mountOptions = ["defaults" "size=8G" "mode=755"];
}; };
}; };
}; };
fileSystems."/persist" = { fileSystems."/persist" = {
depends = [ "/" ]; depends = ["/"];
neededForBoot = true; neededForBoot = true;
}; };
fileSystems."/nix" = { fileSystems."/nix" = {
device = "/persist/nix"; device = "/persist/nix";
options = [ "bind" ]; options = ["bind"];
depends = [ "/persist" ]; depends = ["/persist"];
neededForBoot = true; neededForBoot = true;
}; };
fileSystems."/tmp" = { fileSystems."/tmp" = {
device = "/persist/tmp"; device = "/persist/tmp";
options = [ "bind" ]; options = ["bind"];
depends = [ "/persist" ]; depends = ["/persist"];
neededForBoot = true; neededForBoot = true;
}; };
swapDevices = [{ swapDevices = [
{
device = "/persist/swapfile"; device = "/persist/swapfile";
size = 64*1024; # 64 GB size = 64 * 1024; # 64 GB
}]; }
];
boot.resumeDevice = "/persist/swapfile"; boot.resumeDevice = "/persist/swapfile";
} }

View file

@ -1,7 +1,4 @@
{ {device ? throw "Set this to your disk device, e.g. /dev/sda", ...}: {
device ? throw "Set this to your disk device, e.g. /dev/sda",
...
}: {
disko.devices = { disko.devices = {
disk.main = { disk.main = {
inherit device; inherit device;

18
flake.lock generated
View file

@ -333,11 +333,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1753393138, "lastModified": 1753476892,
"narHash": "sha256-mJp8QEFiVQNc3fZLf5zeKGIHeigMj33LYQ0EogcHz5g=", "narHash": "sha256-VZg9Oq9apTi2JEnlOSiCGl6iglwqNFr6A2u3CTWqGpQ=",
"owner": "kylekrein", "owner": "kylekrein",
"repo": "emacs-config", "repo": "emacs-config",
"rev": "f3880c6f9f32661dfae8d10f2fd522561dc73f25", "rev": "1b0367dca5e6b37e2ca9c53f41f2316a5bf335eb",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -358,11 +358,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1753376867, "lastModified": 1753460825,
"narHash": "sha256-FAPCW/szK3qvCUD+ThOX4sFyqz/MSadJ4SltA8lNamc=", "narHash": "sha256-MNu9l5nukxFpT5LzsT7Q83BqmO36EByn6/o/xA7hu7I=",
"owner": "nix-community", "owner": "nix-community",
"repo": "emacs-overlay", "repo": "emacs-overlay",
"rev": "b8df6094952273f3b7e5e7c99b96ed1bf9830034", "rev": "07c08ea0037b2fd7e0b5416361586d4552ac8255",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -1233,11 +1233,11 @@
}, },
"nixpkgs-master": { "nixpkgs-master": {
"locked": { "locked": {
"lastModified": 1753468267, "lastModified": 1753473560,
"narHash": "sha256-KnwZCY92VjKvGyjnsnNHOvG9mllpFbKyeUkDpD//nvs=", "narHash": "sha256-bT4abIU3eGDraRATwkdeJAeIvxt9e23dhpjjp2dsRqg=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "dd386adc75a0061fbb9b1b62595dbc8c52330648", "rev": "a6b41ef5e0c274f96b1f1b52b3d382302763f62a",
"type": "github" "type": "github"
}, },
"original": { "original": {

View file

@ -78,17 +78,18 @@
nixpkgs-unstable, nixpkgs-unstable,
... ...
} @ inputs: let } @ inputs: let
#systems = ["aarch64-linux" "x86_64-linux" ]; systems = ["aarch64-linux" "x86_64-linux"];
#forAllSystems = nixpkgs.lib.genAttrs systems; eachSystem = nixpkgs.lib.genAttrs systems;
#pkgs = import nixpkgs { pkgsFor = eachSystem (system:
# inherit system; import nixpkgs {
# config = { localSystem = system;
# allowUnfree = true; overlays = [
# }; ];
#}; });
arm = "aarch64-linux"; arm = "aarch64-linux";
x86 = "x86_64-linux"; x86 = "x86_64-linux";
ladybirdMaster = self: super: { ladybird = super.ladybird.overrideAttrs(old: { ladybirdMaster = self: super: {
ladybird = super.ladybird.overrideAttrs (old: {
src = super.fetchFromGitHub { src = super.fetchFromGitHub {
owner = "LadybirdWebBrowser"; owner = "LadybirdWebBrowser";
repo = "ladybird"; repo = "ladybird";
@ -96,16 +97,22 @@
hash = "sha256-hJkK7nag3Z9E8etPFCo0atUEJJnPjjkl7sle/UwkzbE="; hash = "sha256-hJkK7nag3Z9E8etPFCo0atUEJJnPjjkl7sle/UwkzbE=";
}; };
version = "0-unstable-2025-05-22"; version = "0-unstable-2025-05-22";
});}; });
};
nativePackagesOverlay = self: super: { nativePackagesOverlay = self: super: {
stdenv = super.impureUseNativeOptimizations super.stdenv; stdenv = super.impureUseNativeOptimizations super.stdenv;
}; };
kylekrein-homepc-pkgs = nixpkgs: import nixpkgs { kylekrein-homepc-pkgs = nixpkgs:
import nixpkgs {
system = x86; system = x86;
overlays = [ overlays = [
inputs.beeengine.overlays.${x86} inputs.beeengine.overlays.${x86}
(final: prev: { #https://github.com/NixOS/nixpkgs/issues/388681 (final: prev: {
pythonPackagesExtensions = prev.pythonPackagesExtensions ++ [( #https://github.com/NixOS/nixpkgs/issues/388681
pythonPackagesExtensions =
prev.pythonPackagesExtensions
++ [
(
python-final: python-prev: { python-final: python-prev: {
onnxruntime = python-prev.onnxruntime.overridePythonAttrs ( onnxruntime = python-prev.onnxruntime.overridePythonAttrs (
oldAttrs: { oldAttrs: {
@ -113,7 +120,8 @@
} }
); );
} }
)]; )
];
}) })
#nativePackagesOverlay #nativePackagesOverlay
#ladybirdMaster #ladybirdMaster
@ -124,7 +132,8 @@
cudaSupport = true; cudaSupport = true;
}; };
}; };
kylekrein-server-pkgs = nixpkgs: import nixpkgs { kylekrein-server-pkgs = nixpkgs:
import nixpkgs {
system = x86; system = x86;
overlays = [ overlays = [
(self: super: { (self: super: {
@ -138,7 +147,8 @@
allowUnfree = true; allowUnfree = true;
}; };
}; };
kylekrein-framework12-pkgs = nixpkgs: import nixpkgs { kylekrein-framework12-pkgs = nixpkgs:
import nixpkgs {
system = x86; system = x86;
overlays = [ overlays = [
inputs.beeengine.overlays.${x86} inputs.beeengine.overlays.${x86}
@ -148,7 +158,8 @@
allowUnfree = true; allowUnfree = true;
}; };
}; };
kylekrein-mac-pkgs = nixpkgs: import nixpkgs { kylekrein-mac-pkgs = nixpkgs:
import nixpkgs {
system = arm; system = arm;
overlays = [ overlays = [
inputs.beeengine.overlays.${arm} inputs.beeengine.overlays.${arm}
@ -162,7 +173,8 @@
allowUnsupportedSystem = true; allowUnsupportedSystem = true;
}; };
}; };
kylekrein-wsl-pkgs = nixpkgs: import nixpkgs { kylekrein-wsl-pkgs = nixpkgs:
import nixpkgs {
system = x86; system = x86;
overlays = [ overlays = [
#nativePackagesOverlay #nativePackagesOverlay
@ -171,7 +183,8 @@
allowUnfree = true; allowUnfree = true;
}; };
}; };
andrej-pc-pkgs = nixpkgs: import nixpkgs { andrej-pc-pkgs = nixpkgs:
import nixpkgs {
system = x86; system = x86;
overlays = [ overlays = [
inputs.beeengine.overlays.${x86} inputs.beeengine.overlays.${x86}
@ -186,6 +199,12 @@
first-nixos-install = "1729112485"; #stat -c %W / first-nixos-install = "1729112485"; #stat -c %W /
in { in {
formatter = eachSystem (
system: let
pkgs = pkgsFor.${system};
in
pkgs.alejandra
);
nixOnDroidConfigurations.default = inputs.nix-on-droid.lib.nixOnDroidConfiguration { nixOnDroidConfigurations.default = inputs.nix-on-droid.lib.nixOnDroidConfiguration {
pkgs = import nixpkgs { pkgs = import nixpkgs {
system = "aarch64-linux"; system = "aarch64-linux";
@ -329,7 +348,10 @@
system = x86; system = x86;
pkgs = andrej-pc-pkgs nixpkgs; pkgs = andrej-pc-pkgs nixpkgs;
modules = [ modules = [
(import ./disko/ext4-swap.nix {device = "/dev/sda"; swapSize = "16G";}) (import ./disko/ext4-swap.nix {
device = "/dev/sda";
swapSize = "16G";
})
(import ./disko/ext4.nix {device = "/dev/sdb";}) (import ./disko/ext4.nix {device = "/dev/sdb";})
./nixos/hosts/andrej-pc/configuration.nix ./nixos/hosts/andrej-pc/configuration.nix
]; ];

View file

@ -10,11 +10,10 @@
inputs, inputs,
unstable-pkgs, unstable-pkgs,
... ...
}: }: let
let in {
in imports =
{ [
imports = [
inputs.sops-nix.nixosModules.sops inputs.sops-nix.nixosModules.sops
inputs.nixos-facter-modules.nixosModules.facter inputs.nixos-facter-modules.nixosModules.facter
inputs.home-manager.nixosModules.default inputs.home-manager.nixosModules.default
@ -32,11 +31,12 @@ in
./modules/gnupg ./modules/gnupg
./modules/direnv ./modules/direnv
./hosts/${hwconfig.hostname} ./hosts/${hwconfig.hostname}
] ++ lib.optional (hwconfig.useImpermanence) ./modules/impermanence; ]
++ lib.optional (hwconfig.useImpermanence) ./modules/impermanence;
facter.reportPath = ./hosts/${hwconfig.hostname}/facter.json; facter.reportPath = ./hosts/${hwconfig.hostname}/facter.json;
kylekrein.services.autoUpgrade = { kylekrein.services.autoUpgrade = {
enable = true; enable = true;
pushUpdates = false;#if hwconfig.hostname == "kylekrein-homepc" then true else false; pushUpdates = false; #if hwconfig.hostname == "kylekrein-homepc" then true else false;
configDir = "/etc/nixos-config"; configDir = "/etc/nixos-config";
user = "root"; user = "root";
}; };
@ -45,7 +45,10 @@ in
kernelPackages = lib.mkDefault pkgs.linuxPackages_6_14; kernelPackages = lib.mkDefault pkgs.linuxPackages_6_14;
loader = { loader = {
systemd-boot.enable = true; systemd-boot.enable = true;
efi.canTouchEfiVariables = if hwconfig.hostname != "kylekrein-mac" then true else false; efi.canTouchEfiVariables =
if hwconfig.hostname != "kylekrein-mac"
then true
else false;
}; };
# Hide the OS choice for bootloaders. # Hide the OS choice for bootloaders.
# It's still possible to open the bootloader list by pressing any key # It's still possible to open the bootloader list by pressing any key
@ -63,7 +66,6 @@ in
#flatpak #flatpak
#kk.services.flatpak.enable = hwconfig.system != "aarch64-linux"; #kk.services.flatpak.enable = hwconfig.system != "aarch64-linux";
services.flatpak.packages = [ services.flatpak.packages = [
]; ];
# Enable networking # Enable networking
@ -289,8 +291,8 @@ in
}; };
# Open ports in the firewall. # Open ports in the firewall.
networking.firewall.allowedTCPPorts = [ 22 53317 ]; networking.firewall.allowedTCPPorts = [22 53317];
networking.firewall.allowedUDPPorts = [ 22 53317 ]; networking.firewall.allowedUDPPorts = [22 53317];
# Or disable the firewall altogether. # Or disable the firewall altogether.
#networking.firewall.enable = false; #networking.firewall.enable = false;

View file

@ -4,12 +4,12 @@
inputs, inputs,
... ...
}: let }: let
pkgs-master = import inputs.nixpkgs-master { pkgs-master = import inputs.nixpkgs-master {
inherit (pkgs) system; inherit (pkgs) system;
config.allowUnfree = true; config.allowUnfree = true;
}; };
in { in {
nixpkgs = { nixpkgs = {
overlays = [ overlays = [
(self: super: { (self: super: {
widevine-cdm = pkgs-master.widevine-cdm; widevine-cdm = pkgs-master.widevine-cdm;
@ -23,17 +23,17 @@ nixpkgs = {
imports = [ imports = [
#./apple-silicon-support #./apple-silicon-support
]; ];
programs.firefox.policies.Preferences = { programs.firefox.policies.Preferences = {
"media.gmp-widevinecdm.version" = "system-installed"; "media.gmp-widevinecdm.version" = "system-installed";
"media.gmp-widevinecdm.visible" = true; "media.gmp-widevinecdm.visible" = true;
"media.gmp-widevinecdm.enabled" = true; "media.gmp-widevinecdm.enabled" = true;
"media.gmp-widevinecdm.autoupdate" = false; "media.gmp-widevinecdm.autoupdate" = false;
"media.eme.enabled" = true; "media.eme.enabled" = true;
"media.eme.encrypted-media-encryption-scheme.enabled" = true; "media.eme.encrypted-media-encryption-scheme.enabled" = true;
}; };
programs.firefox.autoConfig = '' programs.firefox.autoConfig = ''
// Zhu // Zhu
lockPref("general.useragent.override","Mozilla/5.0 (X11; CrOS aarch64 15236.80.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.5414.125 Safari/537.36");''; #doesn't work. You need to manually add this to about:config lockPref("general.useragent.override","Mozilla/5.0 (X11; CrOS aarch64 15236.80.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.5414.125 Safari/537.36");''; #doesn't work. You need to manually add this to about:config
hardware.asahi = { hardware.asahi = {
peripheralFirmwareDirectory = ./firmware; peripheralFirmwareDirectory = ./firmware;
useExperimentalGPUDriver = true; #deprecated useExperimentalGPUDriver = true; #deprecated

View file

@ -1,5 +1,4 @@
{pkgs, ...}: {pkgs, ...}: {
{
programs.firefox.profiles.default.settings = { programs.firefox.profiles.default.settings = {
"media.gmp-widevinecdm.version" = pkgs.widevinecdm-aarch64.version; "media.gmp-widevinecdm.version" = pkgs.widevinecdm-aarch64.version;
"media.gmp-widevinecdm.visible" = true; "media.gmp-widevinecdm.visible" = true;
@ -12,7 +11,7 @@
home.file."firefox-widevinecdm" = { home.file."firefox-widevinecdm" = {
enable = true; enable = true;
target = ".mozilla/firefox/default/gmp-widevinecdm"; target = ".mozilla/firefox/default/gmp-widevinecdm";
source = pkgs.runCommandLocal "firefox-widevinecdm" { } '' source = pkgs.runCommandLocal "firefox-widevinecdm" {} ''
out=$out/${pkgs.widevinecdm-aarch64.version} out=$out/${pkgs.widevinecdm-aarch64.version}
mkdir -p $out mkdir -p $out
ln -s ${pkgs.widevinecdm-aarch64}/manifest.json $out/manifest.json ln -s ${pkgs.widevinecdm-aarch64}/manifest.json $out/manifest.json
@ -20,5 +19,4 @@
''; '';
recursive = true; recursive = true;
}; };
} }

View file

@ -1,5 +1,4 @@
prev: final: prev: final: {
{
widevinecdm-aarch64 = import ./widevine.nix { widevinecdm-aarch64 = import ./widevine.nix {
inherit (final) stdenvNoCC fetchFromGitHub fetchurl python3 squashfsTools nspr; inherit (final) stdenvNoCC fetchFromGitHub fetchurl python3 squashfsTools nspr;
}; };

View file

@ -1,11 +1,11 @@
{ stdenvNoCC {
, fetchFromGitHub stdenvNoCC,
, fetchurl fetchFromGitHub,
, python3 fetchurl,
, squashfsTools python3,
, nspr squashfsTools,
}: nspr,
let }: let
widevine-installer = fetchFromGitHub { widevine-installer = fetchFromGitHub {
owner = "AsahiLinux"; owner = "AsahiLinux";
repo = "widevine-installer"; repo = "widevine-installer";
@ -13,24 +13,22 @@ let
sha256 = "sha256-XI1y4pVNpXS+jqFs0KyVMrxcULOJ5rADsgvwfLF6e0Y="; sha256 = "sha256-XI1y4pVNpXS+jqFs0KyVMrxcULOJ5rADsgvwfLF6e0Y=";
}; };
lacros-image = fetchurl { lacros-image = fetchurl {
url = url = let
let
distfiles_base = "https://commondatastorage.googleapis.com/chromeos-localmirror/distfiles"; distfiles_base = "https://commondatastorage.googleapis.com/chromeos-localmirror/distfiles";
lacros_name = "chromeos-lacros-arm64-squash-zstd"; lacros_name = "chromeos-lacros-arm64-squash-zstd";
lacrosVersion = "120.0.6098.0"; lacrosVersion = "120.0.6098.0";
in in "${distfiles_base}/${lacros_name}-${lacrosVersion}";
"${distfiles_base}/${lacros_name}-${lacrosVersion}";
hash = "sha256-OKV8w5da9oZ1oSGbADVPCIkP9Y0MVLaQ3PXS3ZBLFXY="; hash = "sha256-OKV8w5da9oZ1oSGbADVPCIkP9Y0MVLaQ3PXS3ZBLFXY=";
}; };
in in
stdenvNoCC.mkDerivation { stdenvNoCC.mkDerivation {
name = "widevine"; name = "widevine";
version = "4.10.2662.3"; version = "4.10.2662.3";
dontUnpack = true; dontUnpack = true;
dontBuild = true; dontBuild = true;
buildInputs = [ python3 squashfsTools ]; buildInputs = [python3 squashfsTools];
installPhase = '' installPhase = ''
mkdir $out mkdir $out
@ -40,4 +38,4 @@ stdenvNoCC.mkDerivation {
mv squashfs-root/WidevineCdm/LICENSE $out/ mv squashfs-root/WidevineCdm/LICENSE $out/
patchelf --add-rpath ${nspr}/lib $out/libwidevinecdm.so patchelf --add-rpath ${nspr}/lib $out/libwidevinecdm.so
''; '';
} }

View file

@ -1,5 +1,9 @@
{ config, pkgs, lib, ... }:
{ {
config,
pkgs,
lib,
...
}: {
hardware = { hardware = {
graphics = { graphics = {
enable = true; enable = true;
@ -16,7 +20,7 @@
# Enable this if you have graphical corruption issues or application crashes after waking # Enable this if you have graphical corruption issues or application crashes after waking
# up from sleep. This fixes it by saving the entire VRAM memory to /tmp/ instead # up from sleep. This fixes it by saving the entire VRAM memory to /tmp/ instead
# of just the bare essentials. # of just the bare essentials.
powerManagement.enable = true;#false; powerManagement.enable = true; #false;
# Fine-grained power management. Turns off GPU when not in use. # Fine-grained power management. Turns off GPU when not in use.
# Experimental and only works on modern Nvidia GPUs (Turing or newer). # Experimental and only works on modern Nvidia GPUs (Turing or newer).
@ -41,7 +45,7 @@
logitech.wireless.enable = true; logitech.wireless.enable = true;
}; };
services.xserver.videoDrivers = [ "nvidia" ]; services.xserver.videoDrivers = ["nvidia"];
#hardware.nvidia.package = config.boot.kernelPackages.nvidiaPackages.mkDriver { #fixes https://github.com/NixOS/nixpkgs/issues/375730 temporary #hardware.nvidia.package = config.boot.kernelPackages.nvidiaPackages.mkDriver { #fixes https://github.com/NixOS/nixpkgs/issues/375730 temporary
# version = "570.133.07"; # use new 570 drivers # version = "570.133.07"; # use new 570 drivers
# sha256_64bit = "sha256-LUPmTFgb5e9VTemIixqpADfvbUX1QoTT2dztwI3E3CY="; # sha256_64bit = "sha256-LUPmTFgb5e9VTemIixqpADfvbUX1QoTT2dztwI3E3CY=";
@ -49,5 +53,4 @@
# settingsSha256 = "sha256-ZpuVZybW6CFN/gz9rx+UJvQ715FZnAOYfHn5jt5Z2C8="; # settingsSha256 = "sha256-ZpuVZybW6CFN/gz9rx+UJvQ715FZnAOYfHn5jt5Z2C8=";
# usePersistenced = false; # usePersistenced = false;
#}; #};
} }

View file

@ -7,16 +7,14 @@
username, username,
inputs, inputs,
... ...
}: }: let
let in {
in
{
imports = imports =
[ [
#./modules/fastfetch #./modules/fastfetch
#./modules/tmux/home.nix #./modules/tmux/home.nix
] ]
++ lib.optional (lib.strings.hasInfix "kylekrein" hwconfig.hostname) ./modules/fastfetch ++ lib.optional (lib.strings.hasInfix "kylekrein" hwconfig.hostname) ./modules/fastfetch
++ lib.optional (hwconfig.useImpermanence) ( ++ lib.optional (hwconfig.useImpermanence) (
import ./modules/impermanence/home.nix { import ./modules/impermanence/home.nix {
inherit username; inherit username;
@ -33,7 +31,14 @@ in
# } # }
#) #)
++ lib.optional (builtins.pathExists ./homes/${username}) ( ++ lib.optional (builtins.pathExists ./homes/${username}) (
import ./homes/${username} { inherit username; inherit config; inherit pkgs; inherit lib; inherit inputs; inherit hwconfig; } import ./homes/${username} {
inherit username;
inherit config;
inherit pkgs;
inherit lib;
inherit inputs;
inherit hwconfig;
}
); );
# Home Manager needs a bit of information about you and the paths it should # Home Manager needs a bit of information about you and the paths it should
# manage. # manage.

View file

@ -1,6 +1,13 @@
{pkgs, hwconfig, ...}: {
let pkgs,
battery-path = "/sys/class/power_supply/${if hwconfig.hostname == "kylekrein-mac" then "macsmc-battery" else "BAT0"}"; hwconfig,
...
}: let
battery-path = "/sys/class/power_supply/${
if hwconfig.hostname == "kylekrein-mac"
then "macsmc-battery"
else "BAT0"
}";
get-battery-level = "${pkgs.writeShellScriptBin "get-battery-level" '' get-battery-level = "${pkgs.writeShellScriptBin "get-battery-level" ''
cat ${battery-path}/capacity 2>/dev/null || echo "N/A" cat ${battery-path}/capacity 2>/dev/null || echo "N/A"
''}/bin/get-battery-level"; ''}/bin/get-battery-level";
@ -8,11 +15,11 @@ let
cat ${battery-path}/status 2>/dev/null || echo "Unknown" cat ${battery-path}/status 2>/dev/null || echo "Unknown"
''}/bin/get-status"; ''}/bin/get-status";
get-icon = "${pkgs.writeShellScriptBin "get-icon" '' get-icon = "${pkgs.writeShellScriptBin "get-icon" ''
BATTERY_LEVEL=$(${get-battery-level}) BATTERY_LEVEL=$(${get-battery-level})
STATUS=$(${get-status}) STATUS=$(${get-status})
if [[ "$BATTERY_LEVEL" == "N/A" ]]; then if [[ "$BATTERY_LEVEL" == "N/A" ]]; then
ICON="󰂑 " ICON="󰂑 "
elif [[ "$STATUS" == "Charging" ]]; then elif [[ "$STATUS" == "Charging" ]]; then
if [[ $BATTERY_LEVEL -ge 90 ]]; then if [[ $BATTERY_LEVEL -ge 90 ]]; then
ICON="󰂋 " ICON="󰂋 "
elif [[ $BATTERY_LEVEL -ge 80 ]]; then elif [[ $BATTERY_LEVEL -ge 80 ]]; then
@ -34,7 +41,7 @@ elif [[ "$STATUS" == "Charging" ]]; then
else else
ICON="󰢜 " ICON="󰢜 "
fi fi
else else
if [[ $BATTERY_LEVEL -ge 90 ]]; then if [[ $BATTERY_LEVEL -ge 90 ]]; then
ICON="󰂂 " ICON="󰂂 "
elif [[ $BATTERY_LEVEL -ge 70 ]]; then elif [[ $BATTERY_LEVEL -ge 70 ]]; then
@ -48,23 +55,22 @@ else
else else
ICON="󰁺 " ICON="󰁺 "
fi fi
fi fi
echo "$ICON" echo "$ICON"
''}/bin/get-icon"; ''}/bin/get-icon";
get-remaining-time = "${pkgs.writeShellScriptBin "get-remaining-time" '' get-remaining-time = "${pkgs.writeShellScriptBin "get-remaining-time" ''
REMAINING_ENERGY=$(cat ${battery-path}/energy_now) REMAINING_ENERGY=$(cat ${battery-path}/energy_now)
POWER_USAGE=$(cat ${battery-path}/power_now) POWER_USAGE=$(cat ${battery-path}/power_now)
if [[ -n "$REMAINING_ENERGY" && -n "$POWER_USAGE" && "$POWER_USAGE" -ne 0 ]]; then if [[ -n "$REMAINING_ENERGY" && -n "$POWER_USAGE" && "$POWER_USAGE" -ne 0 ]]; then
TIME_LEFT=$((0 - (REMAINING_ENERGY / POWER_USAGE))) TIME_LEFT=$((0 - (REMAINING_ENERGY / POWER_USAGE)))
MINUTES_LEFT=$(((0 - ( (REMAINING_ENERGY * 60) / POWER_USAGE )) - (TIME_LEFT * 60))) MINUTES_LEFT=$(((0 - ( (REMAINING_ENERGY * 60) / POWER_USAGE )) - (TIME_LEFT * 60)))
echo "$TIME_LEFT h $MINUTES_LEFT min" echo "$TIME_LEFT h $MINUTES_LEFT min"
else else
echo "" echo ""
fi fi
''}/bin/get-remaining-time"; ''}/bin/get-remaining-time";
in in {
{
available = hwconfig.isLaptop; available = hwconfig.isLaptop;
icon = get-icon; icon = get-icon;
status = get-status; status = get-status;

View file

@ -1,7 +1,17 @@
{config, username, pkgs, lib, inputs, hwconfig, ...}: { {
imports = [ config,
username,
pkgs,
lib,
inputs,
hwconfig,
...
}: {
imports =
[
./git.nix ./git.nix
] ++ lib.optional (lib.strings.hasInfix "kylekrein" hwconfig.hostname) ( ]
++ lib.optional (lib.strings.hasInfix "kylekrein" hwconfig.hostname) (
import ./niri.nix { import ./niri.nix {
inherit pkgs; inherit pkgs;
inherit config; inherit config;

View file

@ -1,9 +1,16 @@
{ pkgs, lib, hwconfig, ... }:
let
profile-image = ./nixos-warbler.png;
battery-level = (import ./battery-status.nix {inherit pkgs; inherit hwconfig;}).labelPercent;
in
{ {
pkgs,
lib,
hwconfig,
...
}: let
profile-image = ./nixos-warbler.png;
battery-level =
(import ./battery-status.nix {
inherit pkgs;
inherit hwconfig;
}).labelPercent;
in {
programs.hyprlock = { programs.hyprlock = {
enable = true; enable = true;
settings = { settings = {
@ -52,7 +59,8 @@ in
halign = "center"; halign = "center";
valign = "center"; valign = "center";
}; };
label = [ label =
[
{ {
text = "$USER"; text = "$USER";
font_family = "Fira Code"; font_family = "Fira Code";
@ -77,16 +85,15 @@ in
halign = "right"; halign = "right";
valign = "bottom"; valign = "bottom";
} }
] ++ lib.optional (hwconfig.isLaptop) ( ]
{ ++ lib.optional (hwconfig.isLaptop) {
text = ''cmd[update:10000] ${battery-level}''; text = ''cmd[update:10000] ${battery-level}'';
font_family = "JetBrains Mono"; font_family = "JetBrains Mono";
font_size = 28; font_size = 28;
position = "20, 20"; position = "20, 20";
halign = "left"; halign = "left";
valign = "bottom"; valign = "bottom";
}); };
}; };
}; };
} }

View file

@ -1,2 +1,2 @@
{ pkgs }: {pkgs}:
pkgs.lisgd.override { conf = ./lisgd-config.h; } pkgs.lisgd.override {conf = ./lisgd-config.h;}

View file

@ -1,8 +1,15 @@
#https://github.com/sodiboo/niri-flake/blob/main/default-config.kdl.nix #https://github.com/sodiboo/niri-flake/blob/main/default-config.kdl.nix
#https://github.com/sodiboo/niri-flake/blob/main/docs.md #https://github.com/sodiboo/niri-flake/blob/main/docs.md
#https://github.com/sodiboo/system/blob/main/niri.mod.nix #https://github.com/sodiboo/system/blob/main/niri.mod.nix
{config, pkgs, lib, inputs, hwconfig, username, ...}:
{ {
config,
pkgs,
lib,
inputs,
hwconfig,
username,
...
}: {
programs.fuzzel = { programs.fuzzel = {
enable = true; enable = true;
settings.main.terminal = "kitty"; settings.main.terminal = "kitty";
@ -14,7 +21,8 @@
./waybar ./waybar
./hyprlock.nix ./hyprlock.nix
]; ];
home.packages = with pkgs;[ home.packages = with pkgs;
[
nwg-drawer nwg-drawer
wlogout wlogout
brightnessctl brightnessctl
@ -24,7 +32,8 @@
libnotify libnotify
hyprlock hyprlock
networkmanagerapplet networkmanagerapplet
] ++ lib.optionals (hwconfig.hasTouchscreen) (with pkgs;[ ]
++ lib.optionals (hwconfig.hasTouchscreen) (with pkgs; [
wvkbd # https://github.com/jjsullivan5196/wvkbd wvkbd # https://github.com/jjsullivan5196/wvkbd
]); ]);
programs.niri = { programs.niri = {
@ -51,7 +60,7 @@
}; };
touchscreen-gestures = lib.mkIf (hwconfig.hasTouchscreen) { touchscreen-gestures = lib.mkIf (hwconfig.hasTouchscreen) {
command = [ command = [
"${lib.getExe (import ./lisgd.nix { inherit pkgs; })}" #https://git.sr.ht/~mil/lisgd "${lib.getExe (import ./lisgd.nix {inherit pkgs;})}" #https://git.sr.ht/~mil/lisgd
]; ];
}; };
in [ in [
@ -106,8 +115,7 @@
]; ];
default-column-width = {proportion = 1.0 / 2.0;}; default-column-width = {proportion = 1.0 / 2.0;};
}; };
binds = with config.lib.niri.actions; binds = with config.lib.niri.actions; let
let
sh = spawn "sh" "-c"; sh = spawn "sh" "-c";
emacs = action: sh "emacsclient -c --eval \"${action}\""; emacs = action: sh "emacsclient -c --eval \"${action}\"";
homedir = "/home/${username}/"; homedir = "/home/${username}/";
@ -159,7 +167,6 @@
"Mod+Shift+Ctrl+Left".action = move-column-to-monitor-left; "Mod+Shift+Ctrl+Left".action = move-column-to-monitor-left;
"Mod+Shift+Ctrl+Right".action = move-column-to-monitor-right; "Mod+Shift+Ctrl+Right".action = move-column-to-monitor-right;
"XF86AudioRaiseVolume".action = sh "wpctl set-volume @DEFAULT_AUDIO_SINK@ 0.1+"; "XF86AudioRaiseVolume".action = sh "wpctl set-volume @DEFAULT_AUDIO_SINK@ 0.1+";
"XF86AudioLowerVolume".action = sh "wpctl set-volume @DEFAULT_AUDIO_SINK@ 0.1-"; "XF86AudioLowerVolume".action = sh "wpctl set-volume @DEFAULT_AUDIO_SINK@ 0.1-";
"XF86AudioMute".action = sh "wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle"; "XF86AudioMute".action = sh "wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle";
@ -177,7 +184,13 @@
warp-mouse-to-focus.enable = true; warp-mouse-to-focus.enable = true;
keyboard = { keyboard = {
xkb.layout = "us, ru, de"; xkb.layout = "us, ru, de";
xkb.options = "grp:lctrl_toggle, ctrl:nocaps" + (if hwconfig.hostname == "kylekrein-mac" then ", altwin:swap_alt_win" else ""); xkb.options =
"grp:lctrl_toggle, ctrl:nocaps"
+ (
if hwconfig.hostname == "kylekrein-mac"
then ", altwin:swap_alt_win"
else ""
);
track-layout = "window"; track-layout = "window";
numlock = true; numlock = true;
}; };
@ -199,7 +212,8 @@
DISPLAY = ":0"; DISPLAY = ":0";
}; };
window-rules = [ window-rules = [
{ #active {
#active
matches = [ matches = [
{ {
is-active = true; is-active = true;
@ -207,7 +221,8 @@
]; ];
opacity = 1.0; opacity = 1.0;
} }
{ #inactive {
#inactive
matches = [ matches = [
{ {
is-active = false; is-active = false;
@ -215,7 +230,8 @@
]; ];
opacity = 1.0; opacity = 1.0;
} }
{ #opaque {
#opaque
matches = [ matches = [
{ {
app-id = "emacs"; app-id = "emacs";
@ -226,7 +242,8 @@
]; ];
opacity = 1.0; opacity = 1.0;
} }
{ #app-launcher {
#app-launcher
matches = [ matches = [
{ {
title = "emacs-run-launcher"; title = "emacs-run-launcher";
@ -235,7 +252,8 @@
open-floating = true; open-floating = true;
open-focused = true; open-focused = true;
} }
{ #PiP {
#PiP
matches = [ matches = [
{ {
title = "Picture-in-Picture"; title = "Picture-in-Picture";
@ -244,7 +262,11 @@
open-floating = true; open-floating = true;
open-focused = false; open-focused = false;
opacity = 1.0; opacity = 1.0;
default-floating-position = { x = 0; y = 0; relative-to = "top-right"; }; default-floating-position = {
x = 0;
y = 0;
relative-to = "top-right";
};
} }
]; ];
debug = lib.mkIf (hwconfig.hostname == "kylekrein-mac") { debug = lib.mkIf (hwconfig.hostname == "kylekrein-mac") {
@ -265,7 +287,8 @@
systemctl = "${pkgs.systemd}/bin/systemctl"; systemctl = "${pkgs.systemd}/bin/systemctl";
#locking-script = "${pkgs.swaylock}/bin/swaylock --daemonize"; #locking-script = "${pkgs.swaylock}/bin/swaylock --daemonize";
#unlocking-script = "pkill -SIGUSR1 swaylock"; #unlocking-script = "pkill -SIGUSR1 swaylock";
suspendScript = cmd: pkgs.writeShellScript "suspend-script" '' suspendScript = cmd:
pkgs.writeShellScript "suspend-script" ''
# check if any player has status "Playing" # check if any player has status "Playing"
${lib.getExe pkgs.playerctl} -a status | ${lib.getExe pkgs.ripgrep} Playing -q ${lib.getExe pkgs.playerctl} -a status | ${lib.getExe pkgs.ripgrep} Playing -q
# only suspend if nothing is playing # only suspend if nothing is playing
@ -273,7 +296,7 @@
${cmd} ${cmd}
fi fi
''; '';
in{ in {
enable = true; enable = true;
settings.general = { settings.general = {
before_sleep_cmd = "${pidof} hyprlock || ${loginctl} lock-session;#${niri} msg action power-off-monitors"; before_sleep_cmd = "${pidof} hyprlock || ${loginctl} lock-session;#${niri} msg action power-off-monitors";
@ -282,7 +305,8 @@ in{
}; };
settings.listener = let settings.listener = let
secondary = "${systemctl} suspend"; secondary = "${systemctl} suspend";
in lib.mkIf (hwconfig.isLaptop) [ in
lib.mkIf (hwconfig.isLaptop) [
#{ #{
# timeout = 30; # timeout = 30;
# command = "pidof hyprlock && ${secondary}"; # command = "pidof hyprlock && ${secondary}";
@ -301,7 +325,6 @@ in{
mako = { mako = {
enable = false; enable = false;
settings = { settings = {
}; };
}; };
}; };

View file

@ -1,8 +1,14 @@
{ pkgs, lib, hwconfig, ... }:
let
battery = (import ../battery-status.nix {inherit pkgs; inherit hwconfig;});
in
{ {
pkgs,
lib,
hwconfig,
...
}: let
battery = import ../battery-status.nix {
inherit pkgs;
inherit hwconfig;
};
in {
programs.waybar = { programs.waybar = {
enable = true; enable = true;
systemd.enable = true; systemd.enable = true;
@ -13,12 +19,13 @@ in
#} #}
#${builtins.readFile "${pkgs.waybar}/etc/xdg/waybar/style.css"} #${builtins.readFile "${pkgs.waybar}/etc/xdg/waybar/style.css"}
style = '' style = ''
${builtins.readFile ./waybarstyle.css}''; ${builtins.readFile ./waybarstyle.css}'';
settings = [{ settings = [
{
height = 36; height = 36;
layer = "top"; layer = "top";
position = "top"; position = "top";
tray = { spacing = 3; }; tray = {spacing = 3;};
modules-center = [ modules-center = [
#"hyprland/window" #"hyprland/window"
"clock" "clock"
@ -29,7 +36,8 @@ ${builtins.readFile ./waybarstyle.css}'';
"niri/workspaces" "niri/workspaces"
"niri/window" "niri/window"
]; ];
modules-right = lib.optional hwconfig.isLaptop "backlight" modules-right =
lib.optional hwconfig.isLaptop "backlight"
++ [ ++ [
"pulseaudio" "pulseaudio"
#"network" #"network"
@ -37,7 +45,8 @@ ${builtins.readFile ./waybarstyle.css}'';
"memory" "memory"
#"temperature" #"temperature"
"niri/language" "niri/language"
] ++ lib.optional battery.available "custom/battery" ]
++ lib.optional battery.available "custom/battery"
++ [ ++ [
"tray" "tray"
"custom/notification" "custom/notification"
@ -48,7 +57,7 @@ ${builtins.readFile ./waybarstyle.css}'';
format = " {time} {icon} "; format = " {time} {icon} ";
format-alt = " {capacity}% {icon} "; format-alt = " {capacity}% {icon} ";
format-charging = " {capacity}% "; format-charging = " {capacity}% ";
format-icons = [ "" "" "" "" "" ]; format-icons = ["" "" "" "" ""];
format-plugged = " {capacity}% "; format-plugged = " {capacity}% ";
states = { states = {
critical = 10; critical = 10;
@ -61,7 +70,7 @@ ${builtins.readFile ./waybarstyle.css}'';
on-scroll-down = "${pkgs.brightnessctl}/bin/brightnessctl s 5%-"; on-scroll-down = "${pkgs.brightnessctl}/bin/brightnessctl s 5%-";
}; };
"custom/battery" = { "custom/battery" = {
exec ="${pkgs.writeShellScriptBin "battery-widget" '' exec = "${pkgs.writeShellScriptBin "battery-widget" ''
${battery.labelAdaptive} ${battery.labelAdaptive}
${battery.labelPercent} ${battery.labelPercent}
''}/bin/battery-widget"; ''}/bin/battery-widget";
@ -117,7 +126,7 @@ ${builtins.readFile ./waybarstyle.css}'';
format-bluetooth-muted = " {format_source}"; format-bluetooth-muted = " {format_source}";
format-icons = { format-icons = {
car = ""; car = "";
default = [ " " " " " " ]; default = [" " " " " "];
handsfree = ""; handsfree = "";
headphones = ""; headphones = "";
headset = ""; headset = "";
@ -129,11 +138,11 @@ ${builtins.readFile ./waybarstyle.css}'';
format-source-muted = " "; format-source-muted = " ";
on-click = "${pkgs.pwvucontrol}/bin/pwvucontrol"; on-click = "${pkgs.pwvucontrol}/bin/pwvucontrol";
}; };
"hyprland/submap" = { format = ''<span style="italic">{}</span>''; }; "hyprland/submap" = {format = ''<span style="italic">{}</span>'';};
temperature = { temperature = {
critical-threshold = 80; critical-threshold = 80;
format = "{temperatureC}°C {icon}"; format = "{temperatureC}°C {icon}";
format-icons = [ "" "" "" ]; format-icons = ["" "" ""];
}; };
"hyprland/workspaces" = { "hyprland/workspaces" = {
@ -191,6 +200,7 @@ ${builtins.readFile ./waybarstyle.css}'';
fi fi
''; '';
}; };
}]; }
];
}; };
} }

View file

@ -10,11 +10,11 @@
inputs, inputs,
unstable-pkgs, unstable-pkgs,
... ...
}: }: {
{
programs.firefox.policies.Preferences."browser.startup.page" = lib.mkForce 1; programs.firefox.policies.Preferences."browser.startup.page" = lib.mkForce 1;
imports = [ imports =
[
inputs.sops-nix.nixosModules.sops inputs.sops-nix.nixosModules.sops
inputs.stylix.nixosModules.stylix inputs.stylix.nixosModules.stylix
inputs.nixos-facter-modules.nixosModules.facter inputs.nixos-facter-modules.nixosModules.facter
@ -30,7 +30,8 @@
../../modules/sops ../../modules/sops
#../../modules/emacs #../../modules/emacs
./default.nix ./default.nix
] ++ lib.optional (hwconfig.useImpermanence) ./modules/impermanence; ]
++ lib.optional (hwconfig.useImpermanence) ./modules/impermanence;
facter.reportPath = ./facter.json; facter.reportPath = ./facter.json;
kylekrein.services.autoUpgrade = { kylekrein.services.autoUpgrade = {
enable = true; enable = true;
@ -39,7 +40,6 @@
user = "root"; user = "root";
}; };
boot = { boot = {
kernelPackages = lib.mkDefault pkgs.linuxPackages_6_14; kernelPackages = lib.mkDefault pkgs.linuxPackages_6_14;
loader = { loader = {
@ -62,11 +62,10 @@
#flatpak #flatpak
kk.services.flatpak.enable = true; kk.services.flatpak.enable = true;
services.flatpak.packages = [ services.flatpak.packages = [
]; ];
services.pipewire = { services.pipewire = {
extraLv2Packages = [ pkgs.rnnoise-plugin ]; extraLv2Packages = [pkgs.rnnoise-plugin];
configPackages = [ configPackages = [
(pkgs.writeTextDir "share/pipewire/pipewire.conf.d/20-rnnoise.conf" '' (pkgs.writeTextDir "share/pipewire/pipewire.conf.d/20-rnnoise.conf" ''
context.modules = [ context.modules = [
@ -190,7 +189,8 @@
clean.extraArgs = "--keep-since 4d --keep 3"; clean.extraArgs = "--keep-since 4d --keep 3";
flake = "/etc/nixos-config"; flake = "/etc/nixos-config";
}; };
fonts.packages = with unstable-pkgs; [ #TODO change to pkgs when 25.05 comes out fonts.packages = with unstable-pkgs; [
#TODO change to pkgs when 25.05 comes out
nerd-fonts.jetbrains-mono nerd-fonts.jetbrains-mono
font-awesome font-awesome
nerd-fonts.symbols-only nerd-fonts.symbols-only
@ -240,7 +240,7 @@
image = "${../../modules/hyprland/wallpaper.jpg}"; image = "${../../modules/hyprland/wallpaper.jpg}";
autoEnable = true; autoEnable = true;
opacity = { opacity = {
desktop = 0.0;#0.5; desktop = 0.0; #0.5;
}; };
targets = { targets = {
gtk.enable = true; gtk.enable = true;
@ -296,8 +296,8 @@
}; };
# Open ports in the firewall. # Open ports in the firewall.
networking.firewall.allowedTCPPorts = [ 22 25565 ]; networking.firewall.allowedTCPPorts = [22 25565];
networking.firewall.allowedUDPPorts = [ 22 25565 ]; networking.firewall.allowedUDPPorts = [22 25565];
# Or disable the firewall altogether. # Or disable the firewall altogether.
#networking.firewall.enable = false; #networking.firewall.enable = false;

View file

@ -5,8 +5,7 @@
}: { }: {
imports = [ imports = [
]; ];
environment.packages = with pkgs; environment.packages = with pkgs; [
[
neovim neovim
git git
fastfetch fastfetch

View file

@ -1,14 +1,19 @@
{ pkgs, config, lib, ... }:
{ {
pkgs,
config,
lib,
...
}: {
imports = [ imports = [
#../../modules/nixvim #../../modules/nixvim
../../homes/kylekrein/git.nix ../../homes/kylekrein/git.nix
]; ];
home.activation = { home.activation = {
copyFont = let copyFont = let
font_src = "${pkgs.nerd-fonts.fira-code}/share/fonts/truetype/NerdFonts/FiraCode/FiraCodeNerdFont-Regular.ttf"; font_src = "${pkgs.nerd-fonts.fira-code}/share/fonts/truetype/NerdFonts/FiraCode/FiraCodeNerdFont-Regular.ttf";
font_dst = "${config.home.homeDirectory}/.termux/font.ttf"; font_dst = "${config.home.homeDirectory}/.termux/font.ttf";
in lib.hm.dag.entryAfter ["writeBoundary"] '' in
lib.hm.dag.entryAfter ["writeBoundary"] ''
( test ! -e "${font_dst}" || test $(sha1sum "${font_src}"|cut -d' ' -f1 ) != $(sha1sum "${font_dst}" |cut -d' ' -f1)) && $DRY_RUN_CMD install $VERBOSE_ARG -D "${font_src}" "${font_dst}" ( test ! -e "${font_dst}" || test $(sha1sum "${font_src}"|cut -d' ' -f1 ) != $(sha1sum "${font_dst}" |cut -d' ' -f1)) && $DRY_RUN_CMD install $VERBOSE_ARG -D "${font_src}" "${font_dst}"
''; '';
}; };

View file

@ -28,8 +28,8 @@
(self: super: { (self: super: {
prismlauncher = pkgs.symlinkJoin { prismlauncher = pkgs.symlinkJoin {
name = "prismlauncher"; name = "prismlauncher";
paths = [ super.prismlauncher]; paths = [super.prismlauncher];
buildInputs = [ pkgs.makeWrapper ]; buildInputs = [pkgs.makeWrapper];
postBuild = '' postBuild = ''
wrapProgram $out/bin/prismlauncher --set HOME /persist/home/kylekrein wrapProgram $out/bin/prismlauncher --set HOME /persist/home/kylekrein
''; '';
@ -38,8 +38,8 @@
(self: super: { (self: super: {
bottles = pkgs.symlinkJoin { bottles = pkgs.symlinkJoin {
name = "bottles"; name = "bottles";
paths = [ super.bottles]; paths = [super.bottles];
buildInputs = [ pkgs.makeWrapper ]; buildInputs = [pkgs.makeWrapper];
postBuild = '' postBuild = ''
wrapProgram $out/bin/bottles --set HOME /persist/home/kylekrein wrapProgram $out/bin/bottles --set HOME /persist/home/kylekrein
''; '';
@ -68,14 +68,14 @@
#LLMs #LLMs
services.ollama = { services.ollama = {
enable = true; enable = true;
loadModels = [ "qwq" "llama3.1" "qwen2.5-coder:7b" ]; loadModels = ["qwq" "llama3.1" "qwen2.5-coder:7b"];
acceleration = "cuda"; acceleration = "cuda";
home = "/persist/ollama"; home = "/persist/ollama";
user = "ollama"; user = "ollama";
group = "ollama"; group = "ollama";
}; };
boot.binfmt.emulatedSystems = [ "aarch64-linux" "riscv64-linux" ]; boot.binfmt.emulatedSystems = ["aarch64-linux" "riscv64-linux"];
services.open-webui.enable = true; services.open-webui.enable = true;
#services.open-webui.package = unstable-pkgs.open-webui; #services.open-webui.package = unstable-pkgs.open-webui;
@ -87,7 +87,7 @@
systemd.services.open-webui.serviceConfig.DynamicUser = lib.mkForce false; systemd.services.open-webui.serviceConfig.DynamicUser = lib.mkForce false;
#Chat host #Chat host
networking.firewall.allowedTCPPorts = [ 80 443 22 8448 9993 8081] ++ [ config.services.zerotierone.port ]; networking.firewall.allowedTCPPorts = [80 443 22 8448 9993 8081] ++ [config.services.zerotierone.port];
networking.firewall.allowedUDPPorts = [config.services.zerotierone.port]; networking.firewall.allowedUDPPorts = [config.services.zerotierone.port];
systemd.network.wait-online.enable = lib.mkForce false; systemd.network.wait-online.enable = lib.mkForce false;

View file

@ -26,8 +26,8 @@
(self: super: { (self: super: {
prismlauncher = pkgs.symlinkJoin { prismlauncher = pkgs.symlinkJoin {
name = "prismlauncher"; name = "prismlauncher";
paths = [ super.prismlauncher]; paths = [super.prismlauncher];
buildInputs = [ pkgs.makeWrapper ]; buildInputs = [pkgs.makeWrapper];
postBuild = '' postBuild = ''
wrapProgram $out/bin/prismlauncher --set HOME /persist/home/kylekrein wrapProgram $out/bin/prismlauncher --set HOME /persist/home/kylekrein
''; '';
@ -36,8 +36,8 @@
(self: super: { (self: super: {
bottles = pkgs.symlinkJoin { bottles = pkgs.symlinkJoin {
name = "bottles"; name = "bottles";
paths = [ super.bottles]; paths = [super.bottles];
buildInputs = [ pkgs.makeWrapper ]; buildInputs = [pkgs.makeWrapper];
postBuild = '' postBuild = ''
wrapProgram $out/bin/bottles --set HOME /persist/home/kylekrein wrapProgram $out/bin/bottles --set HOME /persist/home/kylekrein
''; '';
@ -66,14 +66,14 @@
#LLMs #LLMs
services.ollama = { services.ollama = {
enable = true; enable = true;
loadModels = [ "qwq" "llama3.1" "qwen2.5-coder:7b" ]; loadModels = ["qwq" "llama3.1" "qwen2.5-coder:7b"];
acceleration = "cuda"; acceleration = "cuda";
home = "/persist/ollama"; home = "/persist/ollama";
user = "ollama"; user = "ollama";
group = "ollama"; group = "ollama";
}; };
boot.binfmt.emulatedSystems = [ "aarch64-linux" "riscv64-linux" ]; boot.binfmt.emulatedSystems = ["aarch64-linux" "riscv64-linux"];
services.open-webui.enable = true; services.open-webui.enable = true;
#services.open-webui.package = unstable-pkgs.open-webui; #services.open-webui.package = unstable-pkgs.open-webui;
@ -85,9 +85,9 @@
systemd.services.open-webui.serviceConfig.DynamicUser = lib.mkForce false; systemd.services.open-webui.serviceConfig.DynamicUser = lib.mkForce false;
#Chat host #Chat host
networking.firewall.allowedTCPPorts = [ 80 443 22 8448 9993 8081] ++ [ config.services.zerotierone.port ]; networking.firewall.allowedTCPPorts = [80 443 22 8448 9993 8081] ++ [config.services.zerotierone.port];
networking.firewall.allowedUDPPorts = [config.services.zerotierone.port]; networking.firewall.allowedUDPPorts = [config.services.zerotierone.port];
# users.users.nginx.extraGroups = [ "acme" ]; # users.users.nginx.extraGroups = [ "acme" ];
services.hypridle.enable = lib.mkForce false; services.hypridle.enable = lib.mkForce false;
programs.hyprlock.enable = lib.mkForce false; programs.hyprlock.enable = lib.mkForce false;
@ -106,13 +106,16 @@
#forceSSL = true; #forceSSL = true;
#useACMEHost = "kylekrein.com"; #useACMEHost = "kylekrein.com";
#acmeRoot = "/var/lib/acme/challenges-kylekrein"; #acmeRoot = "/var/lib/acme/challenges-kylekrein";
}; in { };
"chat.kylekrein.com" = (SSL // { in {
"chat.kylekrein.com" =
SSL
// {
locations."/" = { locations."/" = {
proxyPass = "http://localhost:8080/"; proxyPass = "http://localhost:8080/";
proxyWebsockets = true; proxyWebsockets = true;
}; };
}); };
}; };
systemd.network.wait-online.enable = lib.mkForce false; systemd.network.wait-online.enable = lib.mkForce false;

View file

@ -1,17 +1,21 @@
# Do not modify this file! It was generated by nixos-generate-config # Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes # and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead. # to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:
{ {
imports = config,
[ (modulesPath + "/installer/scan/not-detected.nix") lib,
pkgs,
modulesPath,
...
}: {
imports = [
(modulesPath + "/installer/scan/not-detected.nix")
]; ];
boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "ahci" "usbhid" "sd_mod" ]; boot.initrd.availableKernelModules = ["nvme" "xhci_pci" "ahci" "usbhid" "sd_mod"];
boot.initrd.kernelModules = [ ]; boot.initrd.kernelModules = [];
boot.kernelModules = [ "kvm-amd" ]; boot.kernelModules = ["kvm-amd"];
boot.extraModulePackages = [ ]; boot.extraModulePackages = [];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking # Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's # (the default) this is the recommended approach. When using systemd-networkd it's

View file

@ -18,19 +18,19 @@
]; ];
sops.secrets."ssh_keys/${hwconfig.hostname}" = {}; sops.secrets."ssh_keys/${hwconfig.hostname}" = {};
facter.reportPath = lib.mkForce null; #fails to generate facter.reportPath = lib.mkForce null; #fails to generate
boot.binfmt.emulatedSystems = [ "x86_64-linux" ]; boot.binfmt.emulatedSystems = ["x86_64-linux"];
nix.settings.extra-platforms = config.boot.binfmt.emulatedSystems; nix.settings.extra-platforms = config.boot.binfmt.emulatedSystems;
services.displayManager.sddm = { services.displayManager.sddm = {
wayland.enable = lib.mkForce false; # black screen wayland.enable = lib.mkForce false; # black screen
}; };
environment.systemPackages = with pkgs;[ environment.systemPackages = with pkgs; [
prismlauncher prismlauncher
unstable-pkgs.mcpelauncher-ui-qt unstable-pkgs.mcpelauncher-ui-qt
]; ];
services.ollama = { services.ollama = {
enable = true; enable = true;
loadModels = [ "llama3.1" "qwen2.5-coder:7b" ]; loadModels = ["llama3.1" "qwen2.5-coder:7b"];
home = "/persist/ollama"; home = "/persist/ollama";
user = "ollama"; user = "ollama";
group = "ollama"; group = "ollama";

View file

@ -1,41 +1,45 @@
# Do not modify this file! It was generated by nixos-generate-config # Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes # and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead. # to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:
{ {
imports = config,
[ (modulesPath + "/installer/scan/not-detected.nix") lib,
pkgs,
modulesPath,
...
}: {
imports = [
(modulesPath + "/installer/scan/not-detected.nix")
]; ];
boot.initrd.availableKernelModules = [ "usb_storage" ]; boot.initrd.availableKernelModules = ["usb_storage"];
boot.initrd.kernelModules = [ ]; boot.initrd.kernelModules = [];
boot.kernelModules = [ ]; boot.kernelModules = [];
boot.extraModulePackages = [ ]; boot.extraModulePackages = [];
fileSystems."/" = { fileSystems."/" = {
device = "tmpfs"; device = "tmpfs";
fsType = "tmpfs"; fsType = "tmpfs";
options = [ "defaults" "size=8G" "mode=755" ]; options = ["defaults" "size=8G" "mode=755"];
}; };
fileSystems."/persist" = fileSystems."/persist" = {
{ device = "/dev/disk/by-label/nixos"; device = "/dev/disk/by-label/nixos";
fsType = "ext4"; fsType = "ext4";
depends = [ "/" ]; depends = ["/"];
neededForBoot = true; neededForBoot = true;
}; };
fileSystems."/nix" = { fileSystems."/nix" = {
device = "/persist/nix"; device = "/persist/nix";
options = [ "bind" ]; options = ["bind"];
depends = [ "/persist" ]; depends = ["/persist"];
}; };
fileSystems."/tmp" = { fileSystems."/tmp" = {
device = "/persist/tmp"; device = "/persist/tmp";
options = [ "bind" ]; options = ["bind"];
depends = [ "/persist" ]; depends = ["/persist"];
}; };
fileSystems."/boot" = fileSystems."/boot" = {
{ device = "/dev/disk/by-label/EFI\\x20-\\x20NIXOS"; device = "/dev/disk/by-label/EFI\\x20-\\x20NIXOS";
fsType = "vfat"; fsType = "vfat";
#options = [ "fmask=0022" "dmask=0022" ]; #options = [ "fmask=0022" "dmask=0022" ];
}; };
@ -43,7 +47,7 @@
swapDevices = [ swapDevices = [
{ {
device = "/persist/swapfile"; device = "/persist/swapfile";
size = 16*1024; size = 16 * 1024;
} }
]; ];

View file

@ -3,17 +3,15 @@
lib, lib,
pkgs, pkgs,
... ...
}: }: let
let
cfg = config.kk.services.conduwuit; cfg = config.kk.services.conduwuit;
defaultUser = "conduwuit"; defaultUser = "conduwuit";
defaultGroup = "conduwuit"; defaultGroup = "conduwuit";
format = pkgs.formats.toml { }; format = pkgs.formats.toml {};
configFile = format.generate "conduwuit.toml" cfg.settings; configFile = format.generate "conduwuit.toml" cfg.settings;
in in {
{ meta.maintainers = with lib.maintainers; [niklaskorz];
meta.maintainers = with lib.maintainers; [ niklaskorz ];
options.kk.services.conduwuit = { options.kk.services.conduwuit = {
enable = lib.mkEnableOption "conduwuit"; enable = lib.mkEnableOption "conduwuit";
@ -36,13 +34,13 @@ in
extraEnvironment = lib.mkOption { extraEnvironment = lib.mkOption {
type = lib.types.attrsOf lib.types.str; type = lib.types.attrsOf lib.types.str;
description = "Extra Environment variables to pass to the conduwuit server."; description = "Extra Environment variables to pass to the conduwuit server.";
default = { }; default = {};
example = { example = {
RUST_BACKTRACE = "yes"; RUST_BACKTRACE = "yes";
}; };
}; };
package = lib.mkPackageOption pkgs "conduwuit" { }; package = lib.mkPackageOption pkgs "conduwuit" {};
settings = lib.mkOption { settings = lib.mkOption {
type = lib.types.submodule { type = lib.types.submodule {
@ -68,7 +66,7 @@ in
}; };
global.port = lib.mkOption { global.port = lib.mkOption {
type = lib.types.listOf lib.types.port; type = lib.types.listOf lib.types.port;
default = [ 6167 ]; default = [6167];
description = '' description = ''
The port(s) conduwuit will be running on. The port(s) conduwuit will be running on.
You need to set up a reverse proxy in your web server (e.g. apache or nginx), You need to set up a reverse proxy in your web server (e.g. apache or nginx),
@ -127,7 +125,7 @@ in
}; };
global.trusted_servers = lib.mkOption { global.trusted_servers = lib.mkOption {
type = lib.types.listOf lib.types.nonEmptyStr; type = lib.types.listOf lib.types.nonEmptyStr;
default = [ "matrix.org" ]; default = ["matrix.org"];
description = '' description = ''
Servers listed here will be used to gather public keys of other servers Servers listed here will be used to gather public keys of other servers
(notary trusted key servers). (notary trusted key servers).
@ -274,7 +272,7 @@ in
}; };
}; };
}; };
default = { }; default = {};
# TOML does not allow null values, so we use null to omit those fields # TOML does not allow null values, so we use null to omit those fields
apply = lib.filterAttrsRecursive (_: v: v != null); apply = lib.filterAttrsRecursive (_: v: v != null);
description = '' description = ''
@ -314,19 +312,19 @@ in
}; };
users.groups = lib.mkIf (cfg.group == defaultGroup) { users.groups = lib.mkIf (cfg.group == defaultGroup) {
${defaultGroup} = { }; ${defaultGroup} = {};
}; };
systemd.services.conduwuit = { systemd.services.conduwuit = {
description = "Conduwuit Matrix Server"; description = "Conduwuit Matrix Server";
documentation = [ "https://conduwuit.puppyirl.gay/" ]; documentation = ["https://conduwuit.puppyirl.gay/"];
wantedBy = [ "multi-user.target" ]; wantedBy = ["multi-user.target"];
wants = [ "network-online.target" ]; wants = ["network-online.target"];
after = [ "network-online.target" ]; after = ["network-online.target"];
environment = lib.mkMerge ([ environment = lib.mkMerge [
{ CONDUWUIT_CONFIG = configFile; } {CONDUWUIT_CONFIG = configFile;}
cfg.extraEnvironment cfg.extraEnvironment
]); ];
startLimitBurst = 5; startLimitBurst = 5;
startLimitIntervalSec = 60; startLimitIntervalSec = 60;
serviceConfig = { serviceConfig = {

View file

@ -21,8 +21,8 @@
./hardware.nix ./hardware.nix
./networking.nix ./networking.nix
]; ];
#options.services.conduwuit.settings.global.database_path = lib.mkOption { apply = old: "/persist/conduwuit/";}; #options.services.conduwuit.settings.global.database_path = lib.mkOption { apply = old: "/persist/conduwuit/";};
config = { config = {
home-manager.users = lib.mkForce {}; home-manager.users = lib.mkForce {};
stylix.image = ../../modules/hyprland/wallpaper.jpg; stylix.image = ../../modules/hyprland/wallpaper.jpg;
#sops.secrets."ssh_keys/${hwconfig.hostname}" = {}; #sops.secrets."ssh_keys/${hwconfig.hostname}" = {};
@ -30,7 +30,7 @@ config = {
boot.loader.grub.enable = true; boot.loader.grub.enable = true;
boot.loader.grub.device = "/dev/sda"; boot.loader.grub.device = "/dev/sda";
networking.hostName = hwconfig.hostname; networking.hostName = hwconfig.hostname;
users = { users = {
mutableUsers = false; mutableUsers = false;
users = { users = {
root = { root = {
@ -63,20 +63,19 @@ users = {
enable = true; # Hopefully? helps with freezing when using swap enable = true; # Hopefully? helps with freezing when using swap
}; };
#Chat host #Chat host
networking.firewall.allowedTCPPorts = [ 80 443 22 8448 ]; networking.firewall.allowedTCPPorts = [80 443 22 8448];
networking.firewall.allowedUDPPorts = [ 3478 5349 ]; networking.firewall.allowedUDPPorts = [3478 5349];
#sops.secrets."services/conduwuit" = {mode = "0755";}; #sops.secrets."services/conduwuit" = {mode = "0755";};
sops.secrets."services/gitlab/dbPassword" = {owner = "gitlab";};
sops.secrets."services/gitlab/dbPassword" = { owner = "gitlab"; }; sops.secrets."services/gitlab/rootPassword" = {owner = "gitlab";};
sops.secrets."services/gitlab/rootPassword" = { owner = "gitlab"; }; sops.secrets."services/gitlab/secret" = {owner = "gitlab";};
sops.secrets."services/gitlab/secret" = { owner = "gitlab"; }; sops.secrets."services/gitlab/otpsecret" = {owner = "gitlab";};
sops.secrets."services/gitlab/otpsecret" = { owner = "gitlab"; }; sops.secrets."services/gitlab/dbsecret" = {owner = "gitlab";};
sops.secrets."services/gitlab/dbsecret" = { owner = "gitlab"; }; sops.secrets."services/gitlab/oidcKeyBase" = {owner = "gitlab";};
sops.secrets."services/gitlab/oidcKeyBase" = { owner = "gitlab"; }; sops.secrets."services/gitlab/activeRecordSalt" = {owner = "gitlab";};
sops.secrets."services/gitlab/activeRecordSalt" = { owner = "gitlab"; }; sops.secrets."services/gitlab/activeRecordPrimaryKey" = {owner = "gitlab";};
sops.secrets."services/gitlab/activeRecordPrimaryKey" = { owner = "gitlab"; }; sops.secrets."services/gitlab/activeRecordDeterministicKey" = {owner = "gitlab";};
sops.secrets."services/gitlab/activeRecordDeterministicKey" = { owner = "gitlab"; };
services.gitlab = { services.gitlab = {
enable = true; enable = true;
host = "gitlab.kylekrein.com"; host = "gitlab.kylekrein.com";
@ -89,7 +88,7 @@ users = {
secretFile = config.sops.secrets."services/gitlab/secret".path; secretFile = config.sops.secrets."services/gitlab/secret".path;
otpFile = config.sops.secrets."services/gitlab/otpsecret".path; otpFile = config.sops.secrets."services/gitlab/otpsecret".path;
dbFile = config.sops.secrets."services/gitlab/dbsecret".path; dbFile = config.sops.secrets."services/gitlab/dbsecret".path;
jwsFile = config.sops.secrets."services/gitlab/oidcKeyBase".path;#pkgs.runCommand "oidcKeyBase" {} "${pkgs.openssl}/bin/openssl genrsa 2048 > $out"; jwsFile = config.sops.secrets."services/gitlab/oidcKeyBase".path; #pkgs.runCommand "oidcKeyBase" {} "${pkgs.openssl}/bin/openssl genrsa 2048 > $out";
activeRecordSaltFile = config.sops.secrets."services/gitlab/activeRecordSalt".path; activeRecordSaltFile = config.sops.secrets."services/gitlab/activeRecordSalt".path;
activeRecordPrimaryKeyFile = config.sops.secrets."services/gitlab/activeRecordPrimaryKey".path; activeRecordPrimaryKeyFile = config.sops.secrets."services/gitlab/activeRecordPrimaryKey".path;
activeRecordDeterministicKeyFile = config.sops.secrets."services/gitlab/activeRecordDeterministicKey".path; activeRecordDeterministicKeyFile = config.sops.secrets."services/gitlab/activeRecordDeterministicKey".path;
@ -108,8 +107,8 @@ users = {
server = "matrix.kylekrein.com:443"; server = "matrix.kylekrein.com:443";
client = "https://matrix.kylekrein.com"; client = "https://matrix.kylekrein.com";
}; };
port = [ 6167 ]; port = [6167];
trusted_servers = [ "matrix.org" ]; trusted_servers = ["matrix.org"];
allow_registration = false; allow_registration = false;
registration_token = ""; #nix shell nixpkgs#openssl -c openssl rand -base64 48 | tr -d '/+' | cut -c1-64 registration_token = ""; #nix shell nixpkgs#openssl -c openssl rand -base64 48 | tr -d '/+' | cut -c1-64
allow_federation = true; allow_federation = true;
@ -128,7 +127,7 @@ users = {
# reverse_proxy http://localhost:6167 # reverse_proxy http://localhost:6167
#''; #'';
virtualHosts."kylekrein.com".extraConfig = '' virtualHosts."kylekrein.com".extraConfig = ''
handle_path /.well-known/matrix/* { handle_path /.well-known/matrix/* {
header Access-Control-Allow-Origin * header Access-Control-Allow-Origin *
@ -143,14 +142,14 @@ handle_path /.well-known/matrix/* {
## return http/404 if nothing matches ## return http/404 if nothing matches
respond 404 respond 404
} }
respond /.well-known/element/element.json `{"call":{"widget_url":"https://call.element.io"}}` respond /.well-known/element/element.json `{"call":{"widget_url":"https://call.element.io"}}`
reverse_proxy * http://localhost:6167 reverse_proxy * http://localhost:6167
''; '';
# reverse_proxy /.well-known/* http://localhost:6167 # reverse_proxy /.well-known/* http://localhost:6167
#''; #'';
virtualHosts."matrix.kylekrein.com".extraConfig = '' virtualHosts."matrix.kylekrein.com".extraConfig = ''
handle_path /.well-known/matrix/* { handle_path /.well-known/matrix/* {
header Access-Control-Allow-Origin * header Access-Control-Allow-Origin *
@ -165,14 +164,14 @@ handle_path /.well-known/matrix/* {
## return http/404 if nothing matches ## return http/404 if nothing matches
respond 404 respond 404
} }
respond /.well-known/element/element.json `{"call":{"widget_url":"https://call.element.io"}}` respond /.well-known/element/element.json `{"call":{"widget_url":"https://call.element.io"}}`
reverse_proxy * http://localhost:6167 reverse_proxy * http://localhost:6167
''; '';
virtualHosts."gitlab.kylekrein.com".extraConfig = '' virtualHosts."gitlab.kylekrein.com".extraConfig = ''
reverse_proxy * unix//run/gitlab/gitlab-workhorse.socket reverse_proxy * unix//run/gitlab/gitlab-workhorse.socket
''; '';
}; };
system.stateVersion = "24.11"; system.stateVersion = "24.11";
nix = { nix = {
settings = { settings = {
@ -193,5 +192,5 @@ respond /.well-known/element/element.json `{"call":{"widget_url":"https://call.e
]; ];
}; };
}; };
}; };
} }

View file

@ -1,21 +1,25 @@
{ config, lib, pkgs, modulesPath, ... }:
{ {
imports = config,
[ (modulesPath + "/profiles/qemu-guest.nix") lib,
pkgs,
modulesPath,
...
}: {
imports = [
(modulesPath + "/profiles/qemu-guest.nix")
]; ];
boot.initrd.availableKernelModules = [ "ahci" "xhci_pci" "virtio_pci" "virtio_scsi" "sd_mod" "sr_mod" ]; boot.initrd.availableKernelModules = ["ahci" "xhci_pci" "virtio_pci" "virtio_scsi" "sd_mod" "sr_mod"];
boot.initrd.kernelModules = [ ]; boot.initrd.kernelModules = [];
boot.kernelModules = [ ]; boot.kernelModules = [];
boot.extraModulePackages = [ ]; boot.extraModulePackages = [];
fileSystems."/" = fileSystems."/" = {
{ device = "/dev/disk/by-uuid/4f7e141c-0fc7-415a-815d-944b36f93806"; device = "/dev/disk/by-uuid/4f7e141c-0fc7-415a-815d-944b36f93806";
fsType = "ext4"; fsType = "ext4";
}; };
swapDevices = [ ]; swapDevices = [];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking # Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's # (the default) this is the recommended approach. When using systemd-networkd it's

View file

@ -1,8 +1,9 @@
{ lib, ... }: { {lib, ...}: {
# This file was populated at runtime with the networking # This file was populated at runtime with the networking
# details gathered from the active system. # details gathered from the active system.
networking = { networking = {
nameservers = [ "8.8.8.8" nameservers = [
"8.8.8.8"
]; ];
defaultGateway = "172.31.1.1"; defaultGateway = "172.31.1.1";
defaultGateway6 = { defaultGateway6 = {
@ -14,15 +15,30 @@
interfaces = { interfaces = {
eth0 = { eth0 = {
ipv4.addresses = [ ipv4.addresses = [
{ address="91.99.0.169"; prefixLength=32; } {
address = "91.99.0.169";
prefixLength = 32;
}
]; ];
ipv6.addresses = [ ipv6.addresses = [
{ address="fe80::9400:4ff:fe30:830e"; prefixLength=64; } {
address = "fe80::9400:4ff:fe30:830e";
prefixLength = 64;
}
];
ipv4.routes = [
{
address = "172.31.1.1";
prefixLength = 32;
}
];
ipv6.routes = [
{
address = "";
prefixLength = 128;
}
]; ];
ipv4.routes = [ { address = "172.31.1.1"; prefixLength = 32; } ];
ipv6.routes = [ { address = ""; prefixLength = 128; } ];
}; };
}; };
}; };
services.udev.extraRules = '' services.udev.extraRules = ''

View file

@ -1,5 +1,4 @@
{ ... }: {...}: {
{
services.desktopManager.cosmic.enable = true; services.desktopManager.cosmic.enable = true;
services.displayManager.cosmic-greeter.enable = true; services.displayManager.cosmic-greeter.enable = true;
} }

View file

@ -1,5 +1,4 @@
{ pkgs, ...}: {pkgs, ...}: {
{
programs.direnv = { programs.direnv = {
enable = true; enable = true;
nix-direnv.enable = true; nix-direnv.enable = true;

View file

@ -1,5 +1,10 @@
{ pkgs, inputs, hwconfig, unstable-pkgs, ... }:
{ {
pkgs,
inputs,
hwconfig,
unstable-pkgs,
...
}: {
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
kdePackages.qtwayland kdePackages.qtwayland
kdePackages.qtsvg kdePackages.qtsvg

View file

@ -1,8 +1,7 @@
{ {
pkgs, pkgs,
emacs, emacs,
}: }: {
{
packages = with pkgs; [ packages = with pkgs; [
git git
gzip gzip

View file

@ -1,5 +1,8 @@
{ hwconfig, first-nixos-install, ... }:
{ {
hwconfig,
first-nixos-install,
...
}: {
programs.fastfetch = { programs.fastfetch = {
enable = true; enable = true;
@ -90,9 +93,14 @@
{ {
type = "command"; type = "command";
key = " "; key = " ";
text = #bash text =
#bash
'' ''
birth_install=${if hwconfig.useImpermanence then "${first-nixos-install}" else "$(stat -c %W /)"} birth_install=${
if hwconfig.useImpermanence
then "${first-nixos-install}"
else "$(stat -c %W /)"
}
current=$(date +%s) current=$(date +%s)
delta=$((current - birth_install)) delta=$((current - birth_install))
delta_days=$((delta / 86400)) delta_days=$((delta / 86400))

View file

@ -1,5 +1,4 @@
{ pkgs, ... }: {pkgs, ...}: {
{
nixpkgs = { nixpkgs = {
overlays = [ overlays = [
(final: prev: { (final: prev: {
@ -25,6 +24,7 @@
--set MOZ_GMP_PATH "$out/gmp-widevinecdm/system-installed" --set MOZ_GMP_PATH "$out/gmp-widevinecdm/system-installed"
''; '';
}); });
})]; })
];
}; };
} }

View file

@ -1,6 +1,10 @@
{ lib, config, pkgs, hwconfig, ... }: {
lib,
let config,
pkgs,
hwconfig,
...
}: let
lock-false = { lock-false = {
Value = false; Value = false;
Status = "locked"; Status = "locked";
@ -9,22 +13,23 @@
Value = true; Value = true;
Status = "locked"; Status = "locked";
}; };
in in {
{
imports = [] ++ lib.optional (hwconfig.system == "aarch64-linux") ./aarch64-linux.nix; imports = [] ++ lib.optional (hwconfig.system == "aarch64-linux") ./aarch64-linux.nix;
programs = { programs = {
firefox = { firefox = {
package = pkgs.librewolf; package = pkgs.librewolf;
enable = true; enable = true;
languagePacks = [ "de" "en-US" "ru"]; languagePacks = ["de" "en-US" "ru"];
/* ---- POLICIES ---- */ /*
---- POLICIES ----
*/
# Check about:policies#documentation for options. # Check about:policies#documentation for options.
policies = { policies = {
DisableTelemetry = true; DisableTelemetry = true;
DisableFirefoxStudies = true; DisableFirefoxStudies = true;
EnableTrackingProtection = { EnableTrackingProtection = {
Value= true; Value = true;
Locked = true; Locked = true;
Cryptomining = true; Cryptomining = true;
Fingerprinting = true; Fingerprinting = true;
@ -44,14 +49,16 @@
PasswordManagerEnabled = false; PasswordManagerEnabled = false;
NoDefaultBookmarks = true; NoDefaultBookmarks = true;
/* ---- EXTENSIONS ---- */ /*
---- EXTENSIONS ----
*/
# Check about:support for extension/add-on ID strings. # Check about:support for extension/add-on ID strings.
# Valid strings for installation_mode are "allowed", "blocked", # Valid strings for installation_mode are "allowed", "blocked",
# "force_installed" and "normal_installed". # "force_installed" and "normal_installed".
#https://mozilla.github.io/policy-templates/#extensionsettings #https://mozilla.github.io/policy-templates/#extensionsettings
ExtensionSettings = { ExtensionSettings = {
"*".installation_mode = "allowed"; # blocks all addons except the ones specified below "*".installation_mode = "allowed"; # blocks all addons except the ones specified below
# uBlock Origin # uBlock Origin
"uBlock0@raymondhill.net" = { "uBlock0@raymondhill.net" = {
install_url = "https://addons.mozilla.org/firefox/downloads/latest/ublock-origin/latest.xpi"; install_url = "https://addons.mozilla.org/firefox/downloads/latest/ublock-origin/latest.xpi";
installation_mode = "force_installed"; installation_mode = "force_installed";
@ -88,12 +95,16 @@
install_url = "https://addons.mozilla.org/firefox/downloads/latest/adguard-adblocker/latest.xpi"; install_url = "https://addons.mozilla.org/firefox/downloads/latest/adguard-adblocker/latest.xpi";
installation_mode = "force_installed"; installation_mode = "force_installed";
}; };
}; };
/* ---- PREFERENCES ---- */ /*
---- PREFERENCES ----
*/
# Check about:config for options. # Check about:config for options.
Preferences = { Preferences = {
"browser.contentblocking.category" = { Value = "strict"; Status = "locked"; }; "browser.contentblocking.category" = {
Value = "strict";
Status = "locked";
};
"extensions.pocket.enabled" = lock-false; "extensions.pocket.enabled" = lock-false;
"extensions.screenshots.disabled" = lock-true; "extensions.screenshots.disabled" = lock-true;
"browser.startup.page" = 3; # restore session on startup "browser.startup.page" = 3; # restore session on startup

View file

@ -1,5 +1,4 @@
{ pkgs, ... }: {pkgs, ...}: {
{
services.xserver = { services.xserver = {
enable = true; enable = true;
displayManager.gdm.enable = true; displayManager.gdm.enable = true;

View file

@ -1,13 +1,17 @@
{ pkgs, lib,... }:
{ {
pkgs,
lib,
...
}: {
programs.gnupg.agent = { programs.gnupg.agent = {
enable = true; enable = true;
settings = { settings = {
pinentry-program = lib.mkForce "${pkgs.pinentry-curses}/bin/pinentry-curses"; pinentry-program = lib.mkForce "${pkgs.pinentry-curses}/bin/pinentry-curses";
}; };
}; };
environment.systemPackages = with pkgs;[ environment.systemPackages = with pkgs; [
(pass.withExtensions (exts: with exts;[ (pass.withExtensions (exts:
with exts; [
pass-otp pass-otp
pass-import pass-import
])) ]))

View file

@ -1,6 +1,13 @@
{pkgs, hwconfig, ...}: {
let pkgs,
battery-path = "/sys/class/power_supply/${if hwconfig.hostname == "kylekrein-mac" then "macsmc-battery" else "BAT0"}"; hwconfig,
...
}: let
battery-path = "/sys/class/power_supply/${
if hwconfig.hostname == "kylekrein-mac"
then "macsmc-battery"
else "BAT0"
}";
get-battery-level = "${pkgs.writeShellScriptBin "get-battery-level" '' get-battery-level = "${pkgs.writeShellScriptBin "get-battery-level" ''
cat ${battery-path}/capacity 2>/dev/null || echo "N/A" cat ${battery-path}/capacity 2>/dev/null || echo "N/A"
''}/bin/get-battery-level"; ''}/bin/get-battery-level";
@ -8,11 +15,11 @@ let
cat ${battery-path}/status 2>/dev/null || echo "Unknown" cat ${battery-path}/status 2>/dev/null || echo "Unknown"
''}/bin/get-status"; ''}/bin/get-status";
get-icon = "${pkgs.writeShellScriptBin "get-icon" '' get-icon = "${pkgs.writeShellScriptBin "get-icon" ''
BATTERY_LEVEL=$(${get-battery-level}) BATTERY_LEVEL=$(${get-battery-level})
STATUS=$(${get-status}) STATUS=$(${get-status})
if [[ "$BATTERY_LEVEL" == "N/A" ]]; then if [[ "$BATTERY_LEVEL" == "N/A" ]]; then
ICON="󰂑 " ICON="󰂑 "
elif [[ "$STATUS" == "Charging" ]]; then elif [[ "$STATUS" == "Charging" ]]; then
if [[ $BATTERY_LEVEL -ge 90 ]]; then if [[ $BATTERY_LEVEL -ge 90 ]]; then
ICON="󰂋 " ICON="󰂋 "
elif [[ $BATTERY_LEVEL -ge 80 ]]; then elif [[ $BATTERY_LEVEL -ge 80 ]]; then
@ -34,7 +41,7 @@ elif [[ "$STATUS" == "Charging" ]]; then
else else
ICON="󰢜 " ICON="󰢜 "
fi fi
else else
if [[ $BATTERY_LEVEL -ge 90 ]]; then if [[ $BATTERY_LEVEL -ge 90 ]]; then
ICON="󰂂 " ICON="󰂂 "
elif [[ $BATTERY_LEVEL -ge 70 ]]; then elif [[ $BATTERY_LEVEL -ge 70 ]]; then
@ -48,23 +55,22 @@ else
else else
ICON="󰁺 " ICON="󰁺 "
fi fi
fi fi
echo "$ICON" echo "$ICON"
''}/bin/get-icon"; ''}/bin/get-icon";
get-remaining-time = "${pkgs.writeShellScriptBin "get-remaining-time" '' get-remaining-time = "${pkgs.writeShellScriptBin "get-remaining-time" ''
REMAINING_ENERGY=$(cat ${battery-path}/energy_now) REMAINING_ENERGY=$(cat ${battery-path}/energy_now)
POWER_USAGE=$(cat ${battery-path}/power_now) POWER_USAGE=$(cat ${battery-path}/power_now)
if [[ -n "$REMAINING_ENERGY" && -n "$POWER_USAGE" && "$POWER_USAGE" -ne 0 ]]; then if [[ -n "$REMAINING_ENERGY" && -n "$POWER_USAGE" && "$POWER_USAGE" -ne 0 ]]; then
TIME_LEFT=$((0 - (REMAINING_ENERGY / POWER_USAGE))) TIME_LEFT=$((0 - (REMAINING_ENERGY / POWER_USAGE)))
MINUTES_LEFT=$(((0 - ( (REMAINING_ENERGY * 60) / POWER_USAGE )) - (TIME_LEFT * 60))) MINUTES_LEFT=$(((0 - ( (REMAINING_ENERGY * 60) / POWER_USAGE )) - (TIME_LEFT * 60)))
echo "$TIME_LEFT h $MINUTES_LEFT min" echo "$TIME_LEFT h $MINUTES_LEFT min"
else else
echo "" echo ""
fi fi
''}/bin/get-remaining-time"; ''}/bin/get-remaining-time";
in in {
{
available = hwconfig.isLaptop; available = hwconfig.isLaptop;
icon = get-icon; icon = get-icon;
status = get-status; status = get-status;

View file

@ -1,11 +1,16 @@
{ pkgs, inputs, hwconfig, unstable-pkgs, ... }:
{ {
pkgs,
inputs,
hwconfig,
unstable-pkgs,
...
}: {
stylix = { stylix = {
enable = true; enable = true;
image = "${./wallpaper.jpg}"; image = "${./wallpaper.jpg}";
autoEnable = true; autoEnable = true;
opacity = { opacity = {
desktop = 0.0;#0.5; desktop = 0.0; #0.5;
}; };
targets = { targets = {
gtk.enable = true; gtk.enable = true;
@ -129,6 +134,4 @@
#platformTheme = "qt5ct"; #platformTheme = "qt5ct";
#style = "kvantum"; #style = "kvantum";
# }; # };
} }

View file

@ -4,8 +4,7 @@
lib, lib,
hwconfig, hwconfig,
... ...
}: }: {
{
imports = [ imports = [
(import ./hyprland.nix { (import ./hyprland.nix {
inherit pkgs; inherit pkgs;

View file

@ -1,65 +1,66 @@
{ pkgs, lib, hwconfig, ... }: {
let pkgs,
suspendScript = pkgs.writeShellScript "suspend-script" '' lib,
hwconfig,
...
}: let
suspendScript = pkgs.writeShellScript "suspend-script" ''
# check if any player has status "Playing" # check if any player has status "Playing"
${lib.getExe pkgs.playerctl} -a status | ${lib.getExe pkgs.ripgrep} Playing -q ${lib.getExe pkgs.playerctl} -a status | ${lib.getExe pkgs.ripgrep} Playing -q
# only suspend if nothing is playing # only suspend if nothing is playing
if [ $? == 1 ]; then if [ $? == 1 ]; then
${if hwconfig.isLaptop then "${pkgs.systemd}/bin/systemctl suspend" else "loginctl lock-session"} ${
if hwconfig.isLaptop
then "${pkgs.systemd}/bin/systemctl suspend"
else "loginctl lock-session"
}
fi fi
''; '';
in in {
{ services.hypridle = {
services.hypridle = {
enable = true; enable = true;
settings = { settings = {
general = {
general = { lock_cmd = "pidof hyprlock || hyprlock";
lock_cmd="pidof hyprlock || hyprlock";
before_sleep_cmd = "pidof hyprlock || loginctl lock-session"; # lock before suspend. before_sleep_cmd = "pidof hyprlock || loginctl lock-session"; # lock before suspend.
after_sleep_cmd = "hyprctl dispatch dpms on"; # to avoid having to press a key twice to turn on the display. after_sleep_cmd = "hyprctl dispatch dpms on"; # to avoid having to press a key twice to turn on the display.
ignore_dbus_inhibit = false; ignore_dbus_inhibit = false;
}; };
listener = [ listener = [
#{
#{ # on-resume="brightnessctl -r"; # monitor backlight restore.
# on-resume="brightnessctl -r"; # monitor backlight restore. # on-timeout="brightnessctl -s set 10"; # set monitor backlight to minimum, avoid 0 on OLED monitor.
# on-timeout="brightnessctl -s set 10"; # set monitor backlight to minimum, avoid 0 on OLED monitor. # timeout=240;
# timeout=240; #}
#} #{
#{ # on-resume="brightnessctl -rd rgb:kbd_backlight";
# on-resume="brightnessctl -rd rgb:kbd_backlight"; # on-timeout="brightnessctl -sd rgb:kbd_backlight set 0";
# on-timeout="brightnessctl -sd rgb:kbd_backlight set 0"; # timeout=300;
# timeout=300; #}
#} {
{ on-timeout = "notify-send \"You're idle. Locking in 30 seconds.\"";
on-timeout="notify-send \"You're idle. Locking in 30 seconds.\""; timeout = 830;
timeout=830; }
} {
{
on-timeout = "pidof hyprlock && systemctl suspend"; on-timeout = "pidof hyprlock && systemctl suspend";
timeout = 120; timeout = 120;
} }
#{ #{
# on-timeout="loginctl lock-session"; # on-timeout="loginctl lock-session";
# timeout=360; # timeout=360;
#} #}
{ {
on-resume = "hyprctl dispatch dpms on"; on-resume = "hyprctl dispatch dpms on";
on-timeout = suspendScript.outPath; on-timeout = suspendScript.outPath;
timeout = 900; timeout = 900;
} }
#{ #{
# on-resume="hyprctl dispatch dpms on"; # screen on when activity is detected after timeout has fired. # on-resume="hyprctl dispatch dpms on"; # screen on when activity is detected after timeout has fired.
# on-timeout="hyprctl dispatch dpms off"; # screen off when timeout has passed # on-timeout="hyprctl dispatch dpms off"; # screen off when timeout has passed
# timeout=420; # timeout=420;
#} #}
]; ];
};
}; };
};
} }

View file

@ -128,11 +128,17 @@ in {
misc = { misc = {
vfr = true; #lowers the amount of frames when nothing happens vfr = true; #lowers the amount of frames when nothing happens
allow_session_lock_restore = true; # hope that it fixes the crash of hyprlock allow_session_lock_restore = true; # hope that it fixes the crash of hyprlock
disable_hyprland_logo = true;# disables the random Hyprland logo / anime girl background. :( disable_hyprland_logo = true; # disables the random Hyprland logo / anime girl background. :(
}; };
input = { input = {
kb_layout = "us, ru"; kb_layout = "us, ru";
kb_options = "grp:lctrl_toggle, ctrl:nocaps" + (if hwconfig.hostname == "kylekrein-mac" then ", altwin:swap_alt_win" else ""); # "ctrl:nocaps, grp:toggle" kb_options =
"grp:lctrl_toggle, ctrl:nocaps"
+ (
if hwconfig.hostname == "kylekrein-mac"
then ", altwin:swap_alt_win"
else ""
); # "ctrl:nocaps, grp:toggle"
touchpad = { touchpad = {
natural_scroll = true; natural_scroll = true;
@ -173,7 +179,8 @@ in {
allow_tearing = false; allow_tearing = false;
layout = "dwindle"; layout = "dwindle";
}; };
render = lib.mkIf (hwconfig.system == "aarch64-linux") { # Explicit sync breaks asahi driver https://github.com/hyprwm/Hyprland/issues/8158 render = lib.mkIf (hwconfig.system == "aarch64-linux") {
# Explicit sync breaks asahi driver https://github.com/hyprwm/Hyprland/issues/8158
explicit_sync = 0; explicit_sync = 0;
}; };

View file

@ -1,9 +1,16 @@
{ pkgs, lib, hwconfig, ... }:
let
profile-image = ./profile-image.png;
battery-level = (import ./battery-status.nix {inherit pkgs; inherit hwconfig;}).labelPercent;
in
{ {
pkgs,
lib,
hwconfig,
...
}: let
profile-image = ./profile-image.png;
battery-level =
(import ./battery-status.nix {
inherit pkgs;
inherit hwconfig;
}).labelPercent;
in {
programs.hyprlock = { programs.hyprlock = {
enable = true; enable = true;
settings = { settings = {
@ -51,7 +58,8 @@ in
halign = "center"; halign = "center";
valign = "center"; valign = "center";
}; };
label = [ label =
[
{ {
text = "$USER"; text = "$USER";
font_family = "Fira Code"; font_family = "Fira Code";
@ -76,16 +84,15 @@ in
halign = "right"; halign = "right";
valign = "bottom"; valign = "bottom";
} }
] ++ lib.optional (hwconfig.isLaptop) ( ]
{ ++ lib.optional (hwconfig.isLaptop) {
text = ''cmd[update:10000] ${battery-level}''; text = ''cmd[update:10000] ${battery-level}'';
font_family = "JetBrains Mono"; font_family = "JetBrains Mono";
font_size = 28; font_size = 28;
position = "20, 20"; position = "20, 20";
halign = "left"; halign = "left";
valign = "bottom"; valign = "bottom";
}); };
}; };
}; };
} }

View file

@ -1,8 +1,14 @@
{ pkgs, lib, hwconfig, ... }:
let
battery = (import ./battery-status.nix {inherit pkgs; inherit hwconfig;});
in
{ {
pkgs,
lib,
hwconfig,
...
}: let
battery = import ./battery-status.nix {
inherit pkgs;
inherit hwconfig;
};
in {
programs.waybar = { programs.waybar = {
enable = true; enable = true;
#systemd.enable = true; #systemd.enable = true;
@ -19,11 +25,12 @@ in
font-size: 15px; font-size: 15px;
} }
''; '';
settings = [{ settings = [
{
height = 36; height = 36;
layer = "top"; layer = "top";
position = "top"; position = "top";
tray = { spacing = 3; }; tray = {spacing = 3;};
modules-center = [ modules-center = [
#"hyprland/window" #"hyprland/window"
"clock" "clock"
@ -32,7 +39,8 @@ in
"hyprland/workspaces" "hyprland/workspaces"
# "hyprland/window" # "hyprland/window"
]; ];
modules-right = lib.optional hwconfig.isLaptop "backlight" modules-right =
lib.optional hwconfig.isLaptop "backlight"
++ [ ++ [
"pulseaudio" "pulseaudio"
#"network" #"network"
@ -40,7 +48,8 @@ in
"memory" "memory"
#"temperature" #"temperature"
"hyprland/language" "hyprland/language"
] ++ lib.optional battery.available "custom/battery" ]
++ lib.optional battery.available "custom/battery"
++ [ ++ [
"tray" "tray"
"custom/notification" "custom/notification"
@ -51,7 +60,7 @@ in
format = " {time} {icon} "; format = " {time} {icon} ";
format-alt = " {capacity}% {icon} "; format-alt = " {capacity}% {icon} ";
format-charging = " {capacity}% "; format-charging = " {capacity}% ";
format-icons = [ "" "" "" "" "" ]; format-icons = ["" "" "" "" ""];
format-plugged = " {capacity}% "; format-plugged = " {capacity}% ";
states = { states = {
critical = 10; critical = 10;
@ -64,7 +73,7 @@ in
on-scroll-down = "${pkgs.brightnessctl}/bin/brightnessctl s 5%-"; on-scroll-down = "${pkgs.brightnessctl}/bin/brightnessctl s 5%-";
}; };
"custom/battery" = { "custom/battery" = {
exec ="${pkgs.writeShellScriptBin "battery-widget" '' exec = "${pkgs.writeShellScriptBin "battery-widget" ''
${battery.labelAdaptive} ${battery.labelAdaptive}
${battery.labelPercent} ${battery.labelPercent}
''}/bin/battery-widget"; ''}/bin/battery-widget";
@ -102,7 +111,7 @@ in
format-bluetooth-muted = " {icon} {format_source}"; format-bluetooth-muted = " {icon} {format_source}";
format-icons = { format-icons = {
car = ""; car = "";
default = [ "" "" "" ]; default = ["" "" ""];
handsfree = ""; handsfree = "";
headphones = ""; headphones = "";
headset = ""; headset = "";
@ -114,11 +123,11 @@ in
format-source-muted = ""; format-source-muted = "";
on-click = "${pkgs.pwvucontrol}/bin/pwvucontrol"; on-click = "${pkgs.pwvucontrol}/bin/pwvucontrol";
}; };
"hyprland/submap" = { format = ''<span style="italic">{}</span>''; }; "hyprland/submap" = {format = ''<span style="italic">{}</span>'';};
temperature = { temperature = {
critical-threshold = 80; critical-threshold = 80;
format = "{temperatureC}°C {icon}"; format = "{temperatureC}°C {icon}";
format-icons = [ "" "" "" ]; format-icons = ["" "" ""];
}; };
"hyprland/workspaces" = { "hyprland/workspaces" = {
@ -184,6 +193,7 @@ in
fi fi
''; '';
}; };
}]; }
];
}; };
} }

View file

@ -1,7 +1,6 @@
{ ... }: {...}: let
let folder = ".config/kando"; folder = ".config/kando";
in in {
{
home.file = { home.file = {
#"${folder}/config.json".source = ./config.json; #"${folder}/config.json".source = ./config.json;
"${folder}/menus.json".source = ./menus.json; "${folder}/menus.json".source = ./menus.json;

View file

@ -1,5 +1,4 @@
{ ... }: {...}: {
{
services.xserver.enable = true; services.xserver.enable = true;
services.desktopManager.plasma6.enable = true; services.desktopManager.plasma6.enable = true;

View file

@ -1,5 +1,4 @@
{ pkgs, ... }: {pkgs, ...}: {
{
virtualisation = { virtualisation = {
libvirtd = { libvirtd = {
enable = true; enable = true;
@ -7,7 +6,7 @@
package = pkgs.qemu_kvm; package = pkgs.qemu_kvm;
swtpm.enable = true; swtpm.enable = true;
ovmf.enable = true; ovmf.enable = true;
ovmf.packages = [ pkgs.OVMFFull.fd ]; ovmf.packages = [pkgs.OVMFFull.fd];
}; };
}; };
spiceUSBRedirection.enable = true; spiceUSBRedirection.enable = true;

View file

@ -1,11 +1,10 @@
{ username, ... }: {username, ...}: {
{ users.users.${username}.extraGroups = ["libvirtd"];
users.users.${username}.extraGroups = [ "libvirtd" ];
home-manager.users.${username} = { home-manager.users.${username} = {
dconf.settings = { dconf.settings = {
"org/virt-manager/virt-manager/connections" = { "org/virt-manager/virt-manager/connections" = {
autoconnect = [ "qemu:///system" ]; autoconnect = ["qemu:///system"];
uris = [ "qemu:///system" ]; uris = ["qemu:///system"];
}; };
}; };
}; };

View file

@ -1,5 +1,8 @@
{ pkgs, inputs, ...}:
{ {
pkgs,
inputs,
...
}: {
nixpkgs.overlays = [ nixpkgs.overlays = [
inputs.niri-flake.overlays.niri inputs.niri-flake.overlays.niri
]; ];
@ -12,7 +15,7 @@
package = pkgs.niri-unstable; package = pkgs.niri-unstable;
}; };
niri-flake.cache.enable = true; niri-flake.cache.enable = true;
environment.systemPackages = with pkgs;[ environment.systemPackages = with pkgs; [
wl-clipboard wl-clipboard
wayland-utils wayland-utils
libsecret libsecret

View file

@ -3,13 +3,10 @@
config, config,
lib, lib,
... ...
}: }: let
let
cfg = config.kylekrein.services.autoUpgrade; cfg = config.kylekrein.services.autoUpgrade;
script = ./nixos-upgrade-script.sh; script = ./nixos-upgrade-script.sh;
in in {
{
options = { options = {
kylekrein.services.autoUpgrade = { kylekrein.services.autoUpgrade = {
enable = lib.mkEnableOption "Enables automatic system updates."; enable = lib.mkEnableOption "Enables automatic system updates.";
@ -69,15 +66,31 @@ in
unitConfig.RequiresMountsFor = cfg.configDir; unitConfig.RequiresMountsFor = cfg.configDir;
script = script =
"${script} --operation ${cfg.operation} " "${script} --operation ${cfg.operation} "
+ (if (cfg.configDir != "") then "--flake ${cfg.configDir} " else "") + (
+ (if (cfg.user != "") then "--user ${cfg.user} " else "") if (cfg.configDir != "")
+ (if (cfg.pushUpdates) then "--update " else "") then "--flake ${cfg.configDir} "
+ (if (cfg.extraFlags != "") then cfg.extraFlags else ""); else ""
)
+ (
if (cfg.user != "")
then "--user ${cfg.user} "
else ""
)
+ (
if (cfg.pushUpdates)
then "--update "
else ""
)
+ (
if (cfg.extraFlags != "")
then cfg.extraFlags
else ""
);
}; };
timers."nixos-upgrade" = { timers."nixos-upgrade" = {
wants = [ "network-online.target" ]; wants = ["network-online.target"];
after = [ "network-online.target" ]; after = ["network-online.target"];
wantedBy = [ "timers.target" ]; wantedBy = ["timers.target"];
timerConfig = { timerConfig = {
OnCalendar = cfg.onCalendar; OnCalendar = cfg.onCalendar;
Persistent = cfg.persistent; Persistent = cfg.persistent;

View file

@ -1,8 +1,16 @@
{ config, pkgs, inputs, lib, hwconfig, ... }:
let
keyPath = (if hwconfig.useImpermanence then "/persist/sops/age/keys.txt" else "/var/lib/sops/age/keys.txt");
in
{ {
config,
pkgs,
inputs,
lib,
hwconfig,
...
}: let
keyPath =
if hwconfig.useImpermanence
then "/persist/sops/age/keys.txt"
else "/var/lib/sops/age/keys.txt";
in {
environment.systemPackages = with pkgs; [sops]; environment.systemPackages = with pkgs; [sops];
sops.defaultSopsFile = ./secrets/secrets.yaml; sops.defaultSopsFile = ./secrets/secrets.yaml;
sops.defaultSopsFormat = "yaml"; sops.defaultSopsFormat = "yaml";

View file

@ -7,7 +7,10 @@
... ...
}: let }: let
cfg = config.kk.steam; cfg = config.kk.steam;
containerPath = if hwconfig.useImpermanence then "/persist/home/containers/steam" else "/var/containers/steam"; containerPath =
if hwconfig.useImpermanence
then "/persist/home/containers/steam"
else "/var/containers/steam";
containerName = "fedora-steam"; containerName = "fedora-steam";
in { in {
options.kk.steam = { options.kk.steam = {
@ -21,7 +24,7 @@ in {
enable = true; enable = true;
dockerCompat = true; dockerCompat = true;
}; };
environment.systemPackages = with pkgs;[ environment.systemPackages = with pkgs; [
distrobox distrobox
(pkgs.writeShellScriptBin "steam-install" '' (pkgs.writeShellScriptBin "steam-install" ''
set -e set -e
@ -50,22 +53,20 @@ in {
env -u SUDO_USER ${pkgs.distrobox}/bin/distrobox-enter "${containerName}" -- sudo dnf copr enable -y @asahi/mesa env -u SUDO_USER ${pkgs.distrobox}/bin/distrobox-enter "${containerName}" -- sudo dnf copr enable -y @asahi/mesa
env -u SUDO_USER ${pkgs.distrobox}/bin/distrobox-enter "${containerName}" -- sudo dnf copr enable -y @asahi/mesa env -u SUDO_USER ${pkgs.distrobox}/bin/distrobox-enter "${containerName}" -- sudo dnf copr enable -y @asahi/mesa
env -u SUDO_USER ${pkgs.distrobox}/bin/distrobox-enter "${containerName}" -- sudo dnf upgrade --refresh -y env -u SUDO_USER ${pkgs.distrobox}/bin/distrobox-enter "${containerName}" -- sudo dnf upgrade --refresh -y
env -u SUDO_USER ${pkgs.distrobox}/bin/distrobox-enter "${containerName}" -- sudo dnf install --best --setopt=allow_vendor_change=true asahi-repos -y env -u SUDO_USER ${pkgs.distrobox}/bin/distrobox-enter "${containerName}" -- sudo dnf install --best --setopt=allow_vendor_change=true asahi-repos -y
env -u SUDO_USER ${pkgs.distrobox}/bin/distrobox-enter "${containerName}" -- sudo dnf install --best --setopt=allow_vendor_change=true steam -y env -u SUDO_USER ${pkgs.distrobox}/bin/distrobox-enter "${containerName}" -- sudo dnf install --best --setopt=allow_vendor_change=true steam -y
env -u SUDO_USER ${pkgs.distrobox}/bin/distrobox-enter "${containerName}" -- sudo dnf remove dhcpcd -y env -u SUDO_USER ${pkgs.distrobox}/bin/distrobox-enter "${containerName}" -- sudo dnf remove dhcpcd -y
fi fi
echo "Экспортируем Steam..." echo "Экспортируем Steam..."
env -u SUDO_USER ${pkgs.distrobox}/bin/distrobox enter "${containerName}" -- distrobox-export --app steam env -u SUDO_USER ${pkgs.distrobox}/bin/distrobox enter "${containerName}" -- distrobox-export --app steam
'') '')
]; ];
} }
else else {
{
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
unzip unzip
wget wget
@ -80,12 +81,13 @@ env -u SUDO_USER ${pkgs.distrobox}/bin/distrobox-enter "${containerName}" -- sud
bottles bottles
]; ];
programs.steam = { programs.steam = {
enable = true;#!hwconfig.useImpermanence; enable = true; #!hwconfig.useImpermanence;
remotePlay.openFirewall = true; # Open ports in the firewall for Steam Remote Play remotePlay.openFirewall = true; # Open ports in the firewall for Steam Remote Play
dedicatedServer.openFirewall = true; # Open ports in the firewall for Source Dedicated Server dedicatedServer.openFirewall = true; # Open ports in the firewall for Source Dedicated Server
localNetworkGameTransfers.openFirewall = true; # Open ports in the firewall for Steam Local Network Game Transfers localNetworkGameTransfers.openFirewall = true; # Open ports in the firewall for Steam Local Network Game Transfers
package = pkgs.steam.override { package = pkgs.steam.override {
extraPkgs = pkgs: with pkgs; [ extraPkgs = pkgs:
with pkgs; [
xorg.libXcursor xorg.libXcursor
xorg.libXi xorg.libXi
xorg.libXinerama xorg.libXinerama

View file

@ -1,13 +1,20 @@
{ pkgs, config, lib, hwconfig, inputs, first-nixos-install, ... }:
let username = "andrej";
in
{ {
pkgs,
config,
lib,
hwconfig,
inputs,
first-nixos-install,
...
}: let
username = "andrej";
in {
imports = [ imports = [
]; ];
users.users.${username} = { users.users.${username} = {
isNormalUser = true; isNormalUser = true;
description = "Andrej Lebedev"; description = "Andrej Lebedev";
extraGroups = [ "networkmanager" ]; extraGroups = ["networkmanager"];
#initialPassword = "1234"; #initialPassword = "1234";
hashedPasswordFile = config.sops.secrets."users/${username}".path; hashedPasswordFile = config.sops.secrets."users/${username}".path;
packages = with pkgs; [ packages = with pkgs; [
@ -20,6 +27,17 @@ in
}; };
}; };
home-manager.users."${username}" = import ../../home.nix { inherit lib; inherit username; inherit inputs; inherit first-nixos-install; inherit hwconfig; inherit config; inherit pkgs; }; home-manager.users."${username}" = import ../../home.nix {
systemd.tmpfiles.rules = (if hwconfig.useImpermanence then ["d /persist/home/${username} 0700 ${username} users -"] else []); # /persist/home/<user> created, owned by that user inherit lib;
inherit username;
inherit inputs;
inherit first-nixos-install;
inherit hwconfig;
inherit config;
inherit pkgs;
};
systemd.tmpfiles.rules =
if hwconfig.useImpermanence
then ["d /persist/home/${username} 0700 ${username} users -"]
else []; # /persist/home/<user> created, owned by that user
} }

View file

@ -1,13 +1,20 @@
{ pkgs, config, lib, hwconfig, inputs, first-nixos-install, ... }:
let username = "dima";
in
{ {
pkgs,
config,
lib,
hwconfig,
inputs,
first-nixos-install,
...
}: let
username = "dima";
in {
imports = [ imports = [
]; ];
users.users.${username} = { users.users.${username} = {
isNormalUser = true; isNormalUser = true;
description = "Dima"; description = "Dima";
extraGroups = [ "networkmanager" ]; extraGroups = ["networkmanager"];
initialPassword = "1234"; initialPassword = "1234";
#hashedPasswordFile = config.sops.secrets."users/${username}".path; #hashedPasswordFile = config.sops.secrets."users/${username}".path;
packages = with pkgs; [ packages = with pkgs; [
@ -15,10 +22,20 @@ in
openssh.authorizedKeys.keys = [ openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILIc/J6YxwWKajJ923/PZ2fcgLgWZdVMcZQ4oZZ+2hwn dima@dragonarch" "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILIc/J6YxwWKajJ923/PZ2fcgLgWZdVMcZQ4oZZ+2hwn dima@dragonarch"
]; ];
}; };
programs.ssh.forwardX11 = true; programs.ssh.forwardX11 = true;
home-manager.users."${username}" = import ../../home.nix { inherit lib; inherit username; inherit inputs; inherit first-nixos-install; inherit hwconfig; inherit config; inherit pkgs; }; home-manager.users."${username}" = import ../../home.nix {
systemd.tmpfiles.rules = (if hwconfig.useImpermanence then ["d /persist/home/${username} 0700 ${username} users -"] else []); # /persist/home/<user> created, owned by that user inherit lib;
inherit username;
inherit inputs;
inherit first-nixos-install;
inherit hwconfig;
inherit config;
inherit pkgs;
};
systemd.tmpfiles.rules =
if hwconfig.useImpermanence
then ["d /persist/home/${username} 0700 ${username} users -"]
else []; # /persist/home/<user> created, owned by that user
} }

View file

@ -1,13 +1,20 @@
{ pkgs, config, lib, hwconfig, inputs, first-nixos-install, ... }:
let username = "tania";
in
{ {
pkgs,
config,
lib,
hwconfig,
inputs,
first-nixos-install,
...
}: let
username = "tania";
in {
imports = [ imports = [
]; ];
users.users.${username} = { users.users.${username} = {
isNormalUser = true; isNormalUser = true;
description = "Tetiana"; description = "Tetiana";
extraGroups = [ "networkmanager" ]; extraGroups = ["networkmanager"];
#initialPassword = "1234"; #initialPassword = "1234";
hashedPasswordFile = config.sops.secrets."users/${username}".path; hashedPasswordFile = config.sops.secrets."users/${username}".path;
packages = with pkgs; [ packages = with pkgs; [
@ -19,6 +26,17 @@ in
}; };
}; };
home-manager.users."${username}" = import ../../home.nix { inherit lib; inherit username; inherit inputs; inherit first-nixos-install; inherit hwconfig; inherit config; inherit pkgs; }; home-manager.users."${username}" = import ../../home.nix {
systemd.tmpfiles.rules = (if hwconfig.useImpermanence then ["d /persist/home/${username} 0700 ${username} users -"] else []); # /persist/home/<user> created, owned by that user inherit lib;
inherit username;
inherit inputs;
inherit first-nixos-install;
inherit hwconfig;
inherit config;
inherit pkgs;
};
systemd.tmpfiles.rules =
if hwconfig.useImpermanence
then ["d /persist/home/${username} 0700 ${username} users -"]
else []; # /persist/home/<user> created, owned by that user
} }

View file

@ -7,16 +7,17 @@
inputs, inputs,
unstable-pkgs, unstable-pkgs,
... ...
}: }: {
{ imports =
imports = [ [
./modules/firefox ./modules/firefox
./modules/flatpak ./modules/flatpak
./modules/emacs ./modules/emacs
./modules/gnupg ./modules/gnupg
./modules/direnv ./modules/direnv
./hosts/${hwconfig.hostname} ./hosts/${hwconfig.hostname}
] ++ lib.optional (hwconfig.useImpermanence) ./modules/impermanence; ]
++ lib.optional (hwconfig.useImpermanence) ./modules/impermanence;
networking.hostName = hwconfig.hostname; networking.hostName = hwconfig.hostname;
time.timeZone = "Europe/Berlin"; time.timeZone = "Europe/Berlin";
@ -29,7 +30,6 @@
#flatpak #flatpak
#kk.services.flatpak.enable = hwconfig.system != "aarch64-linux"; #kk.services.flatpak.enable = hwconfig.system != "aarch64-linux";
services.flatpak.packages = [ services.flatpak.packages = [
]; ];
# Enable common container config files in /etc/containers # Enable common container config files in /etc/containers
@ -74,7 +74,7 @@
}; };
services.ollama = { services.ollama = {
enable = true; enable = true;
loadModels = [ "llama3.1" "qwen2.5-coder:7b" ]; loadModels = ["llama3.1" "qwen2.5-coder:7b"];
acceleration = "cuda"; acceleration = "cuda";
user = "ollama"; user = "ollama";
group = "ollama"; group = "ollama";
@ -122,8 +122,8 @@
services.openssh.enable = true; services.openssh.enable = true;
# Open ports in the firewall. # Open ports in the firewall.
networking.firewall.allowedTCPPorts = [ 22 ]; networking.firewall.allowedTCPPorts = [22];
networking.firewall.allowedUDPPorts = [ 22 ]; networking.firewall.allowedUDPPorts = [22];
# Or disable the firewall altogether. # Or disable the firewall altogether.
#networking.firewall.enable = false; #networking.firewall.enable = false;