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}" = {
@ -7,7 +9,7 @@
type = "disk"; type = "disk";
content = { content = {
type = "gpt"; type = "gpt";
partitions = { partitions = {
root = { root = {
size = "100%"; size = "100%";
content = { content = {

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 = {
@ -41,42 +37,44 @@
content = { content = {
type = "filesystem"; type = "filesystem";
format = "ext4"; format = "ext4";
mountpoint = "/persist"; mountpoint = "/persist";
};
}; };
}; };
}; };
}; };
}; };
}; };
};
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"; {
size = 64*1024; # 64 GB device = "/persist/swapfile";
}]; 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;
@ -30,7 +27,7 @@
content = { content = {
type = "filesystem"; type = "filesystem";
format = "ext4"; format = "ext4";
mountpoint = "/persist"; mountpoint = "/persist";
}; };
}; };
}; };
@ -41,10 +38,10 @@
fsType = "tmpfs"; fsType = "tmpfs";
}; };
"/nix" = { "/nix" = {
device = "/persist/nix"; device = "/persist/nix";
}; };
"/tmp" = { "/tmp" = {
device = "/persist/tmp"; device = "/persist/tmp";
}; };
}; };
}; };

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": {

248
flake.nix
View file

@ -78,114 +78,133 @@
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: {
src = super.fetchFromGitHub { ladybird = super.ladybird.overrideAttrs (old: {
owner = "LadybirdWebBrowser"; src = super.fetchFromGitHub {
repo = "ladybird"; owner = "LadybirdWebBrowser";
rev = "71222df4c4103d306fd05b9b0bffb1c1b8e5485e"; repo = "ladybird";
hash = "sha256-hJkK7nag3Z9E8etPFCo0atUEJJnPjjkl7sle/UwkzbE="; rev = "71222df4c4103d306fd05b9b0bffb1c1b8e5485e";
}; hash = "sha256-hJkK7nag3Z9E8etPFCo0atUEJJnPjjkl7sle/UwkzbE=";
version = "0-unstable-2025-05-22";
});};
nativePackagesOverlay = self: super: {
stdenv = super.impureUseNativeOptimizations super.stdenv;
};
kylekrein-homepc-pkgs = nixpkgs: import nixpkgs {
system = x86;
overlays = [
inputs.beeengine.overlays.${x86}
(final: prev: { #https://github.com/NixOS/nixpkgs/issues/388681
pythonPackagesExtensions = prev.pythonPackagesExtensions ++ [(
python-final: python-prev: {
onnxruntime = python-prev.onnxruntime.overridePythonAttrs (
oldAttrs: {
buildInputs = prev.lib.lists.remove prev.onnxruntime oldAttrs.buildInputs;
}
);
}
)];
})
#nativePackagesOverlay
#ladybirdMaster
];
config = {
allowBroken = true;
allowUnfree = true;
cudaSupport = true;
};
}; };
kylekrein-server-pkgs = nixpkgs: import nixpkgs { version = "0-unstable-2025-05-22";
system = x86; });
overlays = [
(self: super: {
conduwuit = inputs.conduwuit.packages."${x86}".all-features;
})
#nativePackagesOverlay
#ladybirdMaster
];
config = {
allowBroken = true;
allowUnfree = true;
};
};
kylekrein-framework12-pkgs = nixpkgs: import nixpkgs {
system = x86;
overlays = [
inputs.beeengine.overlays.${x86}
];
config = {
allowBroken = true;
allowUnfree = true;
};
}; };
kylekrein-mac-pkgs = nixpkgs: import nixpkgs { nativePackagesOverlay = self: super: {
system = arm; stdenv = super.impureUseNativeOptimizations super.stdenv;
overlays = [ };
inputs.beeengine.overlays.${arm} kylekrein-homepc-pkgs = nixpkgs:
#nativePackagesOverlay import nixpkgs {
#(import ./nixos/macos/widevine.nix) system = x86;
]; overlays = [
#config.replaceStdenv = {pkgs}: pkgs.impureUseNativeOptimizations pkgs.stdenv; inputs.beeengine.overlays.${x86}
config = { (final: prev: {
allowBroken = true; #https://github.com/NixOS/nixpkgs/issues/388681
allowUnfree = true; pythonPackagesExtensions =
allowUnsupportedSystem = true; prev.pythonPackagesExtensions
}; ++ [
(
python-final: python-prev: {
onnxruntime = python-prev.onnxruntime.overridePythonAttrs (
oldAttrs: {
buildInputs = prev.lib.lists.remove prev.onnxruntime oldAttrs.buildInputs;
}
);
}
)
];
})
#nativePackagesOverlay
#ladybirdMaster
];
config = {
allowBroken = true;
allowUnfree = true;
cudaSupport = true;
}; };
kylekrein-wsl-pkgs = nixpkgs: import nixpkgs { };
system = x86; kylekrein-server-pkgs = nixpkgs:
overlays = [ import nixpkgs {
#nativePackagesOverlay system = x86;
]; overlays = [
config = { (self: super: {
allowUnfree = true; conduwuit = inputs.conduwuit.packages."${x86}".all-features;
}; })
#nativePackagesOverlay
#ladybirdMaster
];
config = {
allowBroken = true;
allowUnfree = true;
}; };
andrej-pc-pkgs = nixpkgs: import nixpkgs { };
system = x86; kylekrein-framework12-pkgs = nixpkgs:
overlays = [ import nixpkgs {
inputs.beeengine.overlays.${x86} system = x86;
#nativePackagesOverlay overlays = [
]; inputs.beeengine.overlays.${x86}
config = { ];
#allowBroken = true; config = {
allowUnfree = true; allowBroken = true;
#cudaSupport = true; allowUnfree = true;
};
}; };
};
kylekrein-mac-pkgs = nixpkgs:
import nixpkgs {
system = arm;
overlays = [
inputs.beeengine.overlays.${arm}
#nativePackagesOverlay
#(import ./nixos/macos/widevine.nix)
];
#config.replaceStdenv = {pkgs}: pkgs.impureUseNativeOptimizations pkgs.stdenv;
config = {
allowBroken = true;
allowUnfree = true;
allowUnsupportedSystem = true;
};
};
kylekrein-wsl-pkgs = nixpkgs:
import nixpkgs {
system = x86;
overlays = [
#nativePackagesOverlay
];
config = {
allowUnfree = true;
};
};
andrej-pc-pkgs = nixpkgs:
import nixpkgs {
system = x86;
overlays = [
inputs.beeengine.overlays.${x86}
#nativePackagesOverlay
];
config = {
#allowBroken = true;
allowUnfree = true;
#cudaSupport = true;
};
};
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";
@ -213,13 +232,13 @@
hwconfig = { hwconfig = {
hostname = "kylekrein-homepc"; hostname = "kylekrein-homepc";
isLaptop = false; isLaptop = false;
hasTouchscreen = false; hasTouchscreen = false;
system = x86; system = x86;
useImpermanence = true; useImpermanence = true;
}; };
inherit first-nixos-install; inherit first-nixos-install;
inherit inputs; inherit inputs;
unstable-pkgs = kylekrein-homepc-pkgs nixpkgs-unstable; unstable-pkgs = kylekrein-homepc-pkgs nixpkgs-unstable;
}; };
system = x86; system = x86;
@ -234,13 +253,13 @@
hwconfig = { hwconfig = {
hostname = "kylekrein-framework12"; hostname = "kylekrein-framework12";
isLaptop = true; isLaptop = true;
hasTouchscreen = true; hasTouchscreen = true;
system = x86; system = x86;
useImpermanence = true; useImpermanence = true;
}; };
inherit first-nixos-install; inherit first-nixos-install;
inherit inputs; inherit inputs;
unstable-pkgs = kylekrein-framework12-pkgs nixpkgs-unstable; unstable-pkgs = kylekrein-framework12-pkgs nixpkgs-unstable;
}; };
system = x86; system = x86;
@ -248,7 +267,7 @@
modules = [ modules = [
(import ./disko/impermanence-tmpfs-luks.nix {device = "/dev/nvme0n1";}) (import ./disko/impermanence-tmpfs-luks.nix {device = "/dev/nvme0n1";})
./nixos/configuration.nix ./nixos/configuration.nix
inputs.nixos-hardware.nixosModules.framework-12-13th-gen-intel inputs.nixos-hardware.nixosModules.framework-12-13th-gen-intel
]; ];
}; };
"kylekrein-mac" = nixpkgs.lib.nixosSystem { "kylekrein-mac" = nixpkgs.lib.nixosSystem {
@ -256,13 +275,13 @@
hwconfig = { hwconfig = {
hostname = "kylekrein-mac"; hostname = "kylekrein-mac";
isLaptop = true; isLaptop = true;
hasTouchscreen = false; hasTouchscreen = false;
system = arm; system = arm;
useImpermanence = true; useImpermanence = true;
}; };
inherit first-nixos-install; inherit first-nixos-install;
inherit inputs; inherit inputs;
unstable-pkgs = kylekrein-mac-pkgs nixpkgs-unstable; unstable-pkgs = kylekrein-mac-pkgs nixpkgs-unstable;
}; };
system = arm; system = arm;
@ -276,13 +295,13 @@
hwconfig = { hwconfig = {
hostname = "kylekrein-server"; hostname = "kylekrein-server";
isLaptop = false; isLaptop = false;
hasTouchscreen = false; hasTouchscreen = false;
system = x86; system = x86;
useImpermanence = false; useImpermanence = false;
}; };
inherit first-nixos-install; inherit first-nixos-install;
inherit inputs; inherit inputs;
unstable-pkgs = kylekrein-server-pkgs nixpkgs-unstable; unstable-pkgs = kylekrein-server-pkgs nixpkgs-unstable;
}; };
system = x86; system = x86;
@ -296,13 +315,13 @@
hwconfig = { hwconfig = {
hostname = "kylekrein-wsl"; hostname = "kylekrein-wsl";
isLaptop = true; isLaptop = true;
hasTouchscreen = false; hasTouchscreen = false;
system = x86; system = x86;
useImpermanence = false; useImpermanence = false;
}; };
inherit first-nixos-install; inherit first-nixos-install;
inherit inputs; inherit inputs;
unstable-pkgs = kylekrein-wsl-pkgs nixpkgs-unstable; unstable-pkgs = kylekrein-wsl-pkgs nixpkgs-unstable;
}; };
system = x86; system = x86;
@ -317,20 +336,23 @@
hwconfig = { hwconfig = {
hostname = "andrej-pc"; hostname = "andrej-pc";
isLaptop = false; isLaptop = false;
hasTouchscreen = false; hasTouchscreen = false;
system = x86; system = x86;
useImpermanence = false; useImpermanence = false;
}; };
inherit first-nixos-install; inherit first-nixos-install;
inherit inputs; inherit inputs;
unstable-pkgs = andrej-pc-pkgs nixpkgs-unstable; unstable-pkgs = andrej-pc-pkgs nixpkgs-unstable;
}; };
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 {
(import ./disko/ext4.nix {device = "/dev/sdb";}) device = "/dev/sda";
swapSize = "16G";
})
(import ./disko/ext4.nix {device = "/dev/sdb";})
./nixos/hosts/andrej-pc/configuration.nix ./nixos/hosts/andrej-pc/configuration.nix
]; ];
}; };

View file

@ -10,33 +10,33 @@
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 inputs.disko.nixosModules.default
inputs.disko.nixosModules.default
./modules/firefox ./modules/firefox
./modules/flatpak ./modules/flatpak
./modules/steam ./modules/steam
./modules/ly ./modules/ly
./modules/sddm ./modules/sddm
./modules/services/autoupgrade ./modules/services/autoupgrade
./modules/sops ./modules/sops
./modules/dolphin ./modules/dolphin
./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;
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
@ -167,7 +169,7 @@ in
csharp-ls csharp-ls
element-desktop element-desktop
unstable-pkgs.fluffychat unstable-pkgs.fluffychat
beeengineeditor beeengineeditor
beelocalization beelocalization
]; ];
@ -223,102 +225,102 @@ in
security.polkit.enable = true; security.polkit.enable = true;
#programs.thunar = { #programs.thunar = {
# enable = true; # enable = true;
# plugins = with pkgs.xfce; [ # plugins = with pkgs.xfce; [
# thunar-archive-plugin # thunar-archive-plugin
# thunar-volman # thunar-volman
# ]; # ];
# }; # };
#programs.xfconf.enable = true; # so thunar can save config #programs.xfconf.enable = true; # so thunar can save config
#services.gvfs.enable = true; # Mount, trash, and other functionalities #services.gvfs.enable = true; # Mount, trash, and other functionalities
#services.tumbler.enable = true; # Thumbnail support for images #services.tumbler.enable = true; # Thumbnail support for images
security.rtkit.enable = true; security.rtkit.enable = true;
services.pipewire = { services.pipewire = {
enable = true; enable = true;
alsa.enable = true; alsa.enable = true;
alsa.support32Bit = true; alsa.support32Bit = true;
pulse.enable = true; pulse.enable = true;
jack.enable = true; jack.enable = true;
}; };
home-manager = { home-manager = {
useGlobalPkgs = true; useGlobalPkgs = true;
useUserPackages = true; useUserPackages = true;
}; };
programs.bash = { programs.bash = {
shellAliases = { shellAliases = {
ls = "${pkgs.eza}/bin/eza --icons=always"; ls = "${pkgs.eza}/bin/eza --icons=always";
}; };
}; };
#printing #printing
services.printing.enable = true; services.printing.enable = true;
services.avahi = { services.avahi = {
enable = true; enable = true;
nssmdns4 = true; nssmdns4 = true;
openFirewall = true; openFirewall = true;
}; };
#services.flatpak.enable = true; #services.flatpak.enable = true;
#services.flatpak.packages = [ #services.flatpak.packages = [
# "flathub:app/org.kde.dolphin//stable" # "flathub:app/org.kde.dolphin//stable"
# ]; # ];
# Some programs need SUID wrappers, can be configured further or are # Some programs need SUID wrappers, can be configured further or are
# started in user sessions. # started in user sessions.
# programs.mtr.enable = true; # programs.mtr.enable = true;
# programs.gnupg.agent = { # programs.gnupg.agent = {
# enable = true; # enable = true;
# enableSSHSupport = true; # enableSSHSupport = true;
# }; # };
kk.steam.enable = true; kk.steam.enable = true;
# List services that you want to enable: # List services that you want to enable:
# Enable the OpenSSH daemon. # Enable the OpenSSH daemon.
services.openssh = { services.openssh = {
enable = true; enable = true;
# require public key authentication for better security # require public key authentication for better security
settings.PasswordAuthentication = false; settings.PasswordAuthentication = false;
settings.KbdInteractiveAuthentication = false; settings.KbdInteractiveAuthentication = false;
settings.PermitRootLogin = "no"; settings.PermitRootLogin = "no";
extraConfig = "HostKey ${config.sops.secrets."ssh_keys/${hwconfig.hostname}".path}"; extraConfig = "HostKey ${config.sops.secrets."ssh_keys/${hwconfig.hostname}".path}";
}; };
# 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;
# This value determines the NixOS release from which the default # This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions # settings for stateful data, like file locations and database versions
# on your system were taken. Its perfectly fine and recommended to leave # on your system were taken. Its perfectly fine and recommended to leave
# this value at the release version of the first install of this system. # this value at the release version of the first install of this system.
# Before changing this value read the documentation for this option # Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "24.05"; # Did you read the comment? system.stateVersion = "24.05"; # Did you read the comment?
nix = { nix = {
settings = { settings = {
experimental-features = [ experimental-features = [
"nix-command" "nix-command"
"flakes" "flakes"
]; ];
auto-optimise-store = true; auto-optimise-store = true;
substituters = [ substituters = [
"https://hyprland.cachix.org" "https://hyprland.cachix.org"
"https://nix-gaming.cachix.org" "https://nix-gaming.cachix.org"
"https://nix-community.cachix.org" "https://nix-community.cachix.org"
]; ];
trusted-public-keys = [ trusted-public-keys = [
"hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc=" "hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc="
"nix-gaming.cachix.org-1:nbjlureqMbRAxR1gJ/f3hxemL9svXaZF/Ees8vCUUs4=" "nix-gaming.cachix.org-1:nbjlureqMbRAxR1gJ/f3hxemL9svXaZF/Ees8vCUUs4="
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
]; ];
}; };
}; };
} }

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,6 +1,5 @@
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,31 +13,29 @@ 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 "${distfiles_base}/${lacros_name}-${lacrosVersion}";
in
"${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
unsquashfs -q ${lacros-image} 'WidevineCdm/*' unsquashfs -q ${lacros-image} 'WidevineCdm/*'
python3 ${widevine-installer}/widevine_fixup.py squashfs-root/WidevineCdm/_platform_specific/cros_arm64/libwidevinecdm.so $out/libwidevinecdm.so python3 ${widevine-installer}/widevine_fixup.py squashfs-root/WidevineCdm/_platform_specific/cros_arm64/libwidevinecdm.so $out/libwidevinecdm.so
mv squashfs-root/WidevineCdm/manifest.json $out/ mv squashfs-root/WidevineCdm/manifest.json $out/
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,53 +1,56 @@
{ config, pkgs, lib, ... }:
{ {
config,
pkgs,
lib,
...
}: {
hardware = { hardware = {
graphics = { graphics = {
enable = true; enable = true;
extraPackages = with pkgs; [ extraPackages = with pkgs; [
nvidia-vaapi-driver nvidia-vaapi-driver
]; ];
}; };
nvidia = { nvidia = {
# https://nixos.wiki/wiki/Nvidia # https://nixos.wiki/wiki/Nvidia
# Modesetting is required. # Modesetting is required.
modesetting.enable = true; modesetting.enable = true;
# Nvidia power management. Experimental, and can cause sleep/suspend to fail. # Nvidia power management. Experimental, and can cause sleep/suspend to fail.
# 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).
powerManagement.finegrained = false; powerManagement.finegrained = false;
# Use the NVidia open source kernel module (not to be confused with the # Use the NVidia open source kernel module (not to be confused with the
# independent third-party "nouveau" open source driver). # independent third-party "nouveau" open source driver).
# Support is limited to the Turing and later architectures. Full list of # Support is limited to the Turing and later architectures. Full list of
# supported GPUs is at: # supported GPUs is at:
# https://github.com/NVIDIA/open-gpu-kernel-modules#compatible-gpus # https://github.com/NVIDIA/open-gpu-kernel-modules#compatible-gpus
# Only available from driver 515.43.04+ # Only available from driver 515.43.04+
# Currently alpha-quality/buggy, so false is currently the recommended setting. # Currently alpha-quality/buggy, so false is currently the recommended setting.
open = true; open = true;
# Enable the Nvidia settings menu, # Enable the Nvidia settings menu,
# accessible via `nvidia-settings`. # accessible via `nvidia-settings`.
nvidiaSettings = true; nvidiaSettings = true;
# Optionally, you may need to select the appropriate driver version for your specific GPU. # Optionally, you may need to select the appropriate driver version for your specific GPU.
package = config.boot.kernelPackages.nvidiaPackages.latest; package = config.boot.kernelPackages.nvidiaPackages.latest;
}; };
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=";
# openSha256 = "sha256-9l8N83Spj0MccA8+8R1uqiXBS0Ag4JrLPjrU3TaXHnM="; # openSha256 = "sha256-9l8N83Spj0MccA8+8R1uqiXBS0Ag4JrLPjrU3TaXHnM=";
# 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;
@ -30,16 +28,23 @@ in
# inherit inputs; # inherit inputs;
# inherit hwconfig; # inherit hwconfig;
# inherit lib; # inherit lib;
# } # }
#) #)
++ 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.
home.username = username; home.username = username;
home.homeDirectory = "/home/${username}"; home.homeDirectory = "/home/${username}";
#xdg.configFile."Kvantum/kvantum.kvconfig".source = (pkgs.formats.ini {}).generate "kvantum.kvconfig" { #xdg.configFile."Kvantum/kvantum.kvconfig".source = (pkgs.formats.ini {}).generate "kvantum.kvconfig" {
# General.theme = "Catppuccin-Mocha"; # General.theme = "Catppuccin-Mocha";
# }; # };
@ -102,7 +107,7 @@ in
]; ];
programs.kitty = { programs.kitty = {
enable = lib.strings.hasInfix "kylekrein" hwconfig.hostname; enable = lib.strings.hasInfix "kylekrein" hwconfig.hostname;
font = { font = {
name = "JetBrainsMono Nerd Font"; name = "JetBrainsMono Nerd Font";
size = 20; size = 20;

View file

@ -1,83 +1,89 @@
{pkgs, 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" ''
cat ${battery-path}/capacity 2>/dev/null || echo "N/A"
''}/bin/get-battery-level";
get-status = "${pkgs.writeShellScriptBin "get-status" ''
cat ${battery-path}/status 2>/dev/null || echo "Unknown"
''}/bin/get-status";
get-icon = "${pkgs.writeShellScriptBin "get-icon" ''
BATTERY_LEVEL=$(${get-battery-level})
STATUS=$(${get-status})
if [[ "$BATTERY_LEVEL" == "N/A" ]]; then
ICON="󰂑 "
elif [[ "$STATUS" == "Charging" ]]; then
if [[ $BATTERY_LEVEL -ge 90 ]]; then
ICON="󰂋 "
elif [[ $BATTERY_LEVEL -ge 80 ]]; then
ICON="󰂊 "
elif [[ $BATTERY_LEVEL -ge 70 ]]; then
ICON="󰢞 "
elif [[ $BATTERY_LEVEL -ge 60 ]]; then
ICON="󰂉 "
elif [[ $BATTERY_LEVEL -ge 50 ]]; then
ICON="󰢝 "
elif [[ $BATTERY_LEVEL -ge 40 ]]; then
ICON="󰂈 "
elif [[ $BATTERY_LEVEL -ge 30 ]]; then
ICON="󰂇 "
elif [[ $BATTERY_LEVEL -ge 20 ]]; then
ICON="󰂆 "
elif [[ $BATTERY_LEVEL -ge 10 ]]; then
ICON="󰢜 "
else
ICON="󰢜 "
fi
else
if [[ $BATTERY_LEVEL -ge 90 ]]; then
ICON="󰂂 "
elif [[ $BATTERY_LEVEL -ge 70 ]]; then
ICON="󰂀 "
elif [[ $BATTERY_LEVEL -ge 50 ]]; then
ICON="󰁾 "
elif [[ $BATTERY_LEVEL -ge 30 ]]; then
ICON="󰁼 "
elif [[ $BATTERY_LEVEL -ge 10 ]]; then
ICON="󰁺 "
else
ICON="󰁺 "
fi
fi
echo "$ICON"
''}/bin/get-icon";
get-remaining-time = "${pkgs.writeShellScriptBin "get-remaining-time" ''
REMAINING_ENERGY=$(cat ${battery-path}/energy_now)
POWER_USAGE=$(cat ${battery-path}/power_now)
if [[ -n "$REMAINING_ENERGY" && -n "$POWER_USAGE" && "$POWER_USAGE" -ne 0 ]]; then
TIME_LEFT=$((0 - (REMAINING_ENERGY / POWER_USAGE)))
MINUTES_LEFT=$(((0 - ( (REMAINING_ENERGY * 60) / POWER_USAGE )) - (TIME_LEFT * 60)))
echo "$TIME_LEFT h $MINUTES_LEFT min"
else
echo ""
fi
''}/bin/get-remaining-time";
in
{ {
pkgs,
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" ''
cat ${battery-path}/capacity 2>/dev/null || echo "N/A"
''}/bin/get-battery-level";
get-status = "${pkgs.writeShellScriptBin "get-status" ''
cat ${battery-path}/status 2>/dev/null || echo "Unknown"
''}/bin/get-status";
get-icon = "${pkgs.writeShellScriptBin "get-icon" ''
BATTERY_LEVEL=$(${get-battery-level})
STATUS=$(${get-status})
if [[ "$BATTERY_LEVEL" == "N/A" ]]; then
ICON="󰂑 "
elif [[ "$STATUS" == "Charging" ]]; then
if [[ $BATTERY_LEVEL -ge 90 ]]; then
ICON="󰂋 "
elif [[ $BATTERY_LEVEL -ge 80 ]]; then
ICON="󰂊 "
elif [[ $BATTERY_LEVEL -ge 70 ]]; then
ICON="󰢞 "
elif [[ $BATTERY_LEVEL -ge 60 ]]; then
ICON="󰂉 "
elif [[ $BATTERY_LEVEL -ge 50 ]]; then
ICON="󰢝 "
elif [[ $BATTERY_LEVEL -ge 40 ]]; then
ICON="󰂈 "
elif [[ $BATTERY_LEVEL -ge 30 ]]; then
ICON="󰂇 "
elif [[ $BATTERY_LEVEL -ge 20 ]]; then
ICON="󰂆 "
elif [[ $BATTERY_LEVEL -ge 10 ]]; then
ICON="󰢜 "
else
ICON="󰢜 "
fi
else
if [[ $BATTERY_LEVEL -ge 90 ]]; then
ICON="󰂂 "
elif [[ $BATTERY_LEVEL -ge 70 ]]; then
ICON="󰂀 "
elif [[ $BATTERY_LEVEL -ge 50 ]]; then
ICON="󰁾 "
elif [[ $BATTERY_LEVEL -ge 30 ]]; then
ICON="󰁼 "
elif [[ $BATTERY_LEVEL -ge 10 ]]; then
ICON="󰁺 "
else
ICON="󰁺 "
fi
fi
echo "$ICON"
''}/bin/get-icon";
get-remaining-time = "${pkgs.writeShellScriptBin "get-remaining-time" ''
REMAINING_ENERGY=$(cat ${battery-path}/energy_now)
POWER_USAGE=$(cat ${battery-path}/power_now)
if [[ -n "$REMAINING_ENERGY" && -n "$POWER_USAGE" && "$POWER_USAGE" -ne 0 ]]; then
TIME_LEFT=$((0 - (REMAINING_ENERGY / POWER_USAGE)))
MINUTES_LEFT=$(((0 - ( (REMAINING_ENERGY * 60) / POWER_USAGE )) - (TIME_LEFT * 60)))
echo "$TIME_LEFT h $MINUTES_LEFT min"
else
echo ""
fi
''}/bin/get-remaining-time";
in {
available = hwconfig.isLaptop; available = hwconfig.isLaptop;
icon = get-icon; icon = get-icon;
status = get-status; status = get-status;
time = get-remaining-time; time = get-remaining-time;
level = get-battery-level; level = get-battery-level;
labelAdaptive = "${pkgs.writeShellScriptBin "labelAdaptive" '' labelAdaptive = "${pkgs.writeShellScriptBin "labelAdaptive" ''
if [[ "$(${get-status})" == "Charging" ]]; then if [[ "$(${get-status})" == "Charging" ]]; then
echo "$(${get-battery-level})% $(${get-icon})" echo "$(${get-battery-level})% $(${get-icon})"
else else
echo "$(${get-remaining-time}) $(${get-icon})" echo "$(${get-remaining-time}) $(${get-icon})"
fi fi
''}/bin/labelAdaptive"; ''}/bin/labelAdaptive";
labelPercent = "${pkgs.writeShellScriptBin "labelPercent" '' labelPercent = "${pkgs.writeShellScriptBin "labelPercent" ''
echo "$(${get-battery-level})% $(${get-icon})" echo "$(${get-battery-level})% $(${get-icon})"
''}/bin/labelPercent"; ''}/bin/labelPercent";
} }

View file

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

View file

@ -1,21 +1,28 @@
{ 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 = {
general = { general = {
#enable_fingerprint = true; #enable_fingerprint = true;
disable_loading_bar = true; disable_loading_bar = true;
hide_cursor = true; hide_cursor = true;
no_fade_in = false; no_fade_in = false;
grace = 10; grace = 10;
}; };
background = { background = {
path = "${../../modules/hyprland/wallpaper.jpg}"; path = "${../../modules/hyprland/wallpaper.jpg}";
blur_passes = 1; blur_passes = 1;
blur_size = 7; blur_size = 7;
noise = 0.0117; noise = 0.0117;
@ -25,14 +32,14 @@ in
vibrancy_darkness = 0.0; vibrancy_darkness = 0.0;
}; };
image = { image = {
path = "${profile-image}"; path = "${profile-image}";
size = 150; size = 150;
border_size = 4; border_size = 4;
#border_color = "rgb(0C96F9)"; #border_color = "rgb(0C96F9)";
rounding = -1; # Negative means circle rounding = -1; # Negative means circle
position = "0, 220"; position = "0, 220";
halign = "center"; halign = "center";
valign = "center"; valign = "center";
}; };
input-field = { input-field = {
size = "600, 100"; size = "600, 100";
@ -52,41 +59,41 @@ in
halign = "center"; halign = "center";
valign = "center"; valign = "center";
}; };
label = [ label =
{ [
text = "$USER"; {
font_family = "Fira Code"; text = "$USER";
font_size = 56; font_family = "Fira Code";
position = "0, 100"; font_size = 56;
halign = "center"; position = "0, 100";
valign = "center"; halign = "center";
} valign = "center";
{ }
text = "$TIME"; {
font_family = "Roboto"; text = "$TIME";
font_size = 72; font_family = "Roboto";
position = "-40, -40"; font_size = 72;
halign = "right"; position = "-40, -40";
valign = "top"; halign = "right";
} valign = "top";
{ }
text = "$LAYOUT"; {
font_family = "JetBrains Mono"; text = "$LAYOUT";
font_size = 28; font_family = "JetBrains Mono";
position = "-20, 20"; font_size = 28;
halign = "right"; position = "-20, 20";
valign = "bottom"; halign = "right";
} 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,74 +21,76 @@
./waybar ./waybar
./hyprlock.nix ./hyprlock.nix
]; ];
home.packages = with pkgs;[ home.packages = with pkgs;
nwg-drawer [
wlogout nwg-drawer
brightnessctl wlogout
fuzzel brightnessctl
waybar fuzzel
swaybg waybar
libnotify swaybg
hyprlock libnotify
networkmanagerapplet hyprlock
] ++ lib.optionals (hwconfig.hasTouchscreen) (with pkgs;[ networkmanagerapplet
wvkbd # https://github.com/jjsullivan5196/wvkbd ]
]); ++ lib.optionals (hwconfig.hasTouchscreen) (with pkgs; [
wvkbd # https://github.com/jjsullivan5196/wvkbd
]);
programs.niri = { programs.niri = {
settings = { settings = {
outputs = lib.mkIf (hwconfig.hostname == "kylekrein-homepc") { outputs = lib.mkIf (hwconfig.hostname == "kylekrein-homepc") {
"DP-1" = { "DP-1" = {
scale = 1.6; scale = 1.6;
position.x = 1600; position.x = 1600;
position.y = 0; position.y = 0;
}; };
"DP-3" = { "DP-3" = {
scale = 1.6; scale = 1.6;
position.x = 0; position.x = 0;
position.y = 0; position.y = 0;
}; };
}; };
spawn-at-startup = let spawn-at-startup = let
set-low-brightness = lib.mkIf (hwconfig.isLaptop) { set-low-brightness = lib.mkIf (hwconfig.isLaptop) {
command = [
"${lib.getExe pkgs.brightnessctl}"
"set"
"25%"
];
};
touchscreen-gestures = lib.mkIf (hwconfig.hasTouchscreen) {
command = [ command = [
"${lib.getExe (import ./lisgd.nix { inherit pkgs; })}" #https://git.sr.ht/~mil/lisgd "${lib.getExe pkgs.brightnessctl}"
"set"
"25%"
];
};
touchscreen-gestures = lib.mkIf (hwconfig.hasTouchscreen) {
command = [
"${lib.getExe (import ./lisgd.nix {inherit pkgs;})}" #https://git.sr.ht/~mil/lisgd
]; ];
}; };
in [ in [
set-low-brightness set-low-brightness
touchscreen-gestures touchscreen-gestures
{ {
command = [ command = [
"${lib.getExe pkgs.networkmanagerapplet}" "${lib.getExe pkgs.networkmanagerapplet}"
]; ];
} }
{ {
command = [ command = [
"${lib.getExe pkgs.networkmanagerapplet}" "${lib.getExe pkgs.networkmanagerapplet}"
]; ];
} }
{ {
command = [ command = [
"dbus-update-activation-environment" "dbus-update-activation-environment"
"--systemd" "--systemd"
"--all" "--all"
]; ];
} }
{ {
command = [ command = [
"${pkgs.solaar}/bin/solaar" "${pkgs.solaar}/bin/solaar"
"-w" "-w"
"hide" "hide"
]; ];
} }
{ {
command = [ command = [
"${lib.getExe pkgs.swaybg}" "${lib.getExe pkgs.swaybg}"
"-m" "-m"
@ -90,7 +99,7 @@
"${../../modules/hyprland/wallpaper.jpg}" "${../../modules/hyprland/wallpaper.jpg}"
]; ];
} }
{ {
command = [ command = [
"emacs" "emacs"
"--daemon" "--daemon"
@ -99,96 +108,100 @@
]; ];
layout = { layout = {
preset-column-widths = [ preset-column-widths = [
{proportion = 1.0 / 2.0;} {proportion = 1.0 / 2.0;}
{proportion = 1.0;} {proportion = 1.0;}
{proportion = 2.0 / 3.0;} {proportion = 2.0 / 3.0;}
{proportion = 1.0 / 3.0;} {proportion = 1.0 / 3.0;}
]; ];
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}/";
screenshot-annotate = sh ''${lib.getExe pkgs.grim} -g "$(${lib.getExe pkgs.slurp} -w 0)" -t ppm - | ${lib.getExe pkgs.satty} --early-exit --copy-command 'wl-copy' --filename '-' --initial-tool brush''; screenshot-annotate = sh ''${lib.getExe pkgs.grim} -g "$(${lib.getExe pkgs.slurp} -w 0)" -t ppm - | ${lib.getExe pkgs.satty} --early-exit --copy-command 'wl-copy' --filename '-' --initial-tool brush'';
in { in {
"Mod+E".action = sh "emacsclient -c"; "Mod+E".action = sh "emacsclient -c";
"Mod+Shift+C".action = sh "dolphin"; "Mod+Shift+C".action = sh "dolphin";
"Mod+C".action = emacs ''(dirvish \"${homedir}\")''; "Mod+C".action = emacs ''(dirvish \"${homedir}\")'';
"Mod+T".action = spawn "kitty"; "Mod+T".action = spawn "kitty";
"Mod+D".action = spawn "fuzzel"; "Mod+D".action = spawn "fuzzel";
"Mod+B".action = spawn "librewolf"; "Mod+B".action = spawn "librewolf";
"Mod+H".action = show-hotkey-overlay; "Mod+H".action = show-hotkey-overlay;
"Mod+F".action = fullscreen-window; "Mod+F".action = fullscreen-window;
"Mod+R".action = switch-preset-column-width; "Mod+R".action = switch-preset-column-width;
"Mod+Q".action = close-window; "Mod+Q".action = close-window;
"Mod+Shift+S".action = screenshot-annotate; "Mod+Shift+S".action = screenshot-annotate;
"Mod+1".action = focus-workspace 1; "Mod+1".action = focus-workspace 1;
"Mod+2".action = focus-workspace 2; "Mod+2".action = focus-workspace 2;
"Mod+3".action = focus-workspace 3; "Mod+3".action = focus-workspace 3;
"Mod+4".action = focus-workspace 4; "Mod+4".action = focus-workspace 4;
"Mod+5".action = focus-workspace 5; "Mod+5".action = focus-workspace 5;
"Mod+6".action = focus-workspace 6; "Mod+6".action = focus-workspace 6;
"Mod+7".action = focus-workspace 7; "Mod+7".action = focus-workspace 7;
"Mod+8".action = focus-workspace 8; "Mod+8".action = focus-workspace 8;
"Mod+9".action = focus-workspace 9; "Mod+9".action = focus-workspace 9;
"Mod+0".action = focus-workspace 10; "Mod+0".action = focus-workspace 10;
"Mod+Shift+1".action.move-column-to-workspace = 1;
"Mod+Shift+2".action.move-column-to-workspace = 2;
"Mod+Shift+3".action.move-column-to-workspace = 3;
"Mod+Shift+4".action.move-column-to-workspace = 4;
"Mod+Shift+5".action.move-column-to-workspace = 5;
"Mod+Shift+6".action.move-column-to-workspace = 6;
"Mod+Shift+7".action.move-column-to-workspace = 7;
"Mod+Shift+8".action.move-column-to-workspace = 8;
"Mod+Shift+9".action.move-column-to-workspace = 9;
"Mod+Shift+0".action.move-column-to-workspace = 10;
"Mod+Left".action = focus-column-left;
"Mod+Right".action = focus-column-right;
"Mod+Up".action = focus-workspace-up;
"Mod+Down".action = focus-workspace-down;
"Mod+Shift+Left".action = move-column-left;
"Mod+Shift+Right".action = move-column-right;
"Mod+Shift+Up".action = move-column-to-workspace-up;
"Mod+Shift+Down".action = move-column-to-workspace-down;
"Mod+Ctrl+Left".action = focus-monitor-left;
"Mod+Ctrl+Right".action = focus-monitor-right;
"Mod+Shift+Ctrl+Left".action = move-column-to-monitor-left;
"Mod+Shift+Ctrl+Right".action = move-column-to-monitor-right;
"Mod+Shift+1".action.move-column-to-workspace = 1;
"Mod+Shift+2".action.move-column-to-workspace = 2;
"Mod+Shift+3".action.move-column-to-workspace = 3;
"Mod+Shift+4".action.move-column-to-workspace = 4;
"Mod+Shift+5".action.move-column-to-workspace = 5;
"Mod+Shift+6".action.move-column-to-workspace = 6;
"Mod+Shift+7".action.move-column-to-workspace = 7;
"Mod+Shift+8".action.move-column-to-workspace = 8;
"Mod+Shift+9".action.move-column-to-workspace = 9;
"Mod+Shift+0".action.move-column-to-workspace = 10;
"XF86AudioRaiseVolume".action = sh "wpctl set-volume @DEFAULT_AUDIO_SINK@ 0.1+"; "Mod+Left".action = focus-column-left;
"Mod+Right".action = focus-column-right;
"Mod+Up".action = focus-workspace-up;
"Mod+Down".action = focus-workspace-down;
"Mod+Shift+Left".action = move-column-left;
"Mod+Shift+Right".action = move-column-right;
"Mod+Shift+Up".action = move-column-to-workspace-up;
"Mod+Shift+Down".action = move-column-to-workspace-down;
"Mod+Ctrl+Left".action = focus-monitor-left;
"Mod+Ctrl+Right".action = focus-monitor-right;
"Mod+Shift+Ctrl+Left".action = move-column-to-monitor-left;
"Mod+Shift+Ctrl+Right".action = move-column-to-monitor-right;
"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";
"XF86MonBrightnessUp".action = sh "brightnessctl set 10%+"; "XF86MonBrightnessUp".action = sh "brightnessctl set 10%+";
"XF86MonBrightnessDown".action = sh "brightnessctl set 10%-"; "XF86MonBrightnessDown".action = sh "brightnessctl set 10%-";
#"Mod+Tab".action = focus-window-down-or-column-right; #"Mod+Tab".action = focus-window-down-or-column-right;
#"Mod+Shift+Tab".action = focus-window-up-or-column-left; #"Mod+Shift+Tab".action = focus-window-up-or-column-left;
"Mod+Tab".action = toggle-overview; "Mod+Tab".action = toggle-overview;
}; };
input = { input = {
focus-follows-mouse = { focus-follows-mouse = {
#enable = true; #enable = true;
}; };
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 =
track-layout = "window"; "grp:lctrl_toggle, ctrl:nocaps"
numlock = true; + (
}; if hwconfig.hostname == "kylekrein-mac"
touchpad = { then ", altwin:swap_alt_win"
tap = true; else ""
#accel-profile = "adaptive"; );
click-method = "clickfinger"; track-layout = "window";
}; numlock = true;
};
touchpad = {
tap = true;
#accel-profile = "adaptive";
click-method = "clickfinger";
};
}; };
cursor = { cursor = {
hide-after-inactive-ms = 10000; hide-after-inactive-ms = 10000;
}; };
gestures.hot-corners.enable = true; gestures.hot-corners.enable = true;
prefer-no-csd = true; prefer-no-csd = true;
@ -196,68 +209,77 @@
XDG_SESSION_TYPE = "wayland"; XDG_SESSION_TYPE = "wayland";
__GL_GSYNC_ALLOWED = "1"; __GL_GSYNC_ALLOWED = "1";
QT_QPA_PLATFORM = "wayland"; QT_QPA_PLATFORM = "wayland";
DISPLAY = ":0"; DISPLAY = ":0";
}; };
window-rules = [ window-rules = [
{ #active {
matches = [ #active
matches = [
{ {
is-active = true; is-active = true;
} }
]; ];
opacity = 1.0; opacity = 1.0;
} }
{ #inactive {
matches = [ #inactive
matches = [
{ {
is-active = false; is-active = false;
} }
]; ];
opacity = 1.0; opacity = 1.0;
} }
{ #opaque {
matches = [ #opaque
matches = [
{ {
app-id = "emacs"; app-id = "emacs";
} }
{
app-id = "blender";
}
];
opacity = 1.0;
}
{ #app-launcher
matches = [
{ {
title = "emacs-run-launcher"; app-id = "blender";
} }
]; ];
open-floating = true; opacity = 1.0;
open-focused = true; }
} {
{ #PiP #app-launcher
matches = [ matches = [
{ {
title = "Picture-in-Picture"; title = "emacs-run-launcher";
} }
]; ];
open-floating = true; open-floating = true;
open-focused = false; open-focused = true;
opacity = 1.0; }
default-floating-position = { x = 0; y = 0; relative-to = "top-right"; }; {
} #PiP
matches = [
{
title = "Picture-in-Picture";
}
];
open-floating = true;
open-focused = false;
opacity = 1.0;
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") {
render-drm-device = "/dev/dri/renderD128"; render-drm-device = "/dev/dri/renderD128";
}; };
xwayland-satellite = { xwayland-satellite = {
enable = true; enable = true;
path = "${lib.getExe pkgs.xwayland-satellite-unstable}"; path = "${lib.getExe pkgs.xwayland-satellite-unstable}";
}; };
}; };
}; };
services.hypridle = let services.hypridle = let
niri = lib.getExe config.programs.niri.package; niri = lib.getExe config.programs.niri.package;
loginctl = "${pkgs.systemd}/bin/loginctl"; loginctl = "${pkgs.systemd}/bin/loginctl";
pidof = "${pkgs.procps}/bin/pidof"; pidof = "${pkgs.procps}/bin/pidof";
@ -265,43 +287,44 @@
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:
# check if any player has status "Playing" pkgs.writeShellScript "suspend-script" ''
${lib.getExe pkgs.playerctl} -a status | ${lib.getExe pkgs.ripgrep} Playing -q # check if any player has status "Playing"
# only suspend if nothing is playing ${lib.getExe pkgs.playerctl} -a status | ${lib.getExe pkgs.ripgrep} Playing -q
if [ $? == 1 ]; then # only suspend if nothing is playing
${cmd} if [ $? == 1 ]; then
fi ${cmd}
''; 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";
after_sleep_cmd = "#${niri} msg action power-on-monitors"; after_sleep_cmd = "#${niri} msg action power-on-monitors";
lock_cmd = "${locking-script}"; lock_cmd = "${locking-script}";
}; };
settings.listener = let settings.listener = let
secondary = "${systemctl} suspend"; secondary = "${systemctl} suspend";
in lib.mkIf (hwconfig.isLaptop) [ in
#{ lib.mkIf (hwconfig.isLaptop) [
# timeout = 30; #{
# command = "pidof hyprlock && ${secondary}"; # timeout = 30;
#} # command = "pidof hyprlock && ${secondary}";
{ #}
timeout = 870; {
on-timeout = "${suspendScript ''${pkgs.libnotify}/bin/notify-send "You are idle. Going to sleep in 30 seconds"''}"; timeout = 870;
} on-timeout = "${suspendScript ''${pkgs.libnotify}/bin/notify-send "You are idle. Going to sleep in 30 seconds"''}";
{ }
timeout = 900; {
on-timeout = "${suspendScript "${systemctl} suspend"}"; timeout = 900;
} on-timeout = "${suspendScript "${systemctl} suspend"}";
]; }
];
}; };
services = { services = {
mako = { mako = {
enable = false; enable = false;
settings = { settings = {
}; };
}; };
}; };

View file

@ -1,67 +1,76 @@
{ 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;
#window#waybar { #window#waybar {
# background: transparent; # background: transparent;
#border-bottom: none; #border-bottom: none;
#} #}
#${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"
];
modules-left = [
"custom/drawer"
"wlr/taskbar"
"niri/workspaces"
"niri/window"
]; ];
modules-right = lib.optional hwconfig.isLaptop "backlight" modules-left = [
++ [ "custom/drawer"
"pulseaudio" "wlr/taskbar"
#"network" "niri/workspaces"
#"cpu" "niri/window"
"memory"
#"temperature"
"niri/language"
] ++ lib.optional battery.available "custom/battery"
++ [
"tray"
"custom/notification"
#"custom/disablehypridle"
"custom/power"
]; ];
modules-right =
lib.optional hwconfig.isLaptop "backlight"
++ [
"pulseaudio"
#"network"
#"cpu"
"memory"
#"temperature"
"niri/language"
]
++ lib.optional battery.available "custom/battery"
++ [
"tray"
"custom/notification"
#"custom/disablehypridle"
"custom/power"
];
battery = { battery = {
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;
warning = 20; warning = 20;
}; };
}; };
backlight = { backlight = {
format = "{percent}% 󰛩"; format = "{percent}% 󰛩";
on-scroll-up = "${pkgs.brightnessctl}/bin/brightnessctl s 5%+"; on-scroll-up = "${pkgs.brightnessctl}/bin/brightnessctl s 5%+";
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";
@ -69,7 +78,7 @@ ${builtins.readFile ./waybarstyle.css}'';
tooltip = true; tooltip = true;
}; };
clock = { clock = {
format = "{:%a %d | %H:%M}"; format = "{:%a %d | %H:%M}";
format-alt = "{:%d.%m.%Y}"; format-alt = "{:%d.%m.%Y}";
tooltip-format = "{:%d.%m.%Y | %H:%M}"; tooltip-format = "{:%d.%m.%Y | %H:%M}";
}; };
@ -77,30 +86,30 @@ ${builtins.readFile ./waybarstyle.css}'';
format = "{usage}% "; format = "{usage}% ";
tooltip = false; tooltip = false;
}; };
"custom/drawer" = { "custom/drawer" = {
format = "<span foreground='white'>󱄅</span>"; format = "<span foreground='white'>󱄅</span>";
tooltip = false; tooltip = false;
on-click = ''nwg-drawer -fm "dolphin" -closebtn "right" -nocats -term "kitty" -ovl -wm "niri" -s "${./drawerstyle.css}" ''; on-click = ''nwg-drawer -fm "dolphin" -closebtn "right" -nocats -term "kitty" -ovl -wm "niri" -s "${./drawerstyle.css}" '';
}; };
"niri/language" = { "niri/language" = {
format = "{}"; format = "{}";
format-en = "EN"; format-en = "EN";
format-ru = "RU"; format-ru = "RU";
format-de = "DE"; format-de = "DE";
on-click = "niri msg action switch-layout next"; on-click = "niri msg action switch-layout next";
on-click-right = "niri msg action switch-layout prev"; on-click-right = "niri msg action switch-layout prev";
};
"wlr/taskbar" = {
format = "{icon}";
icon-size = 18;
tooltip-format = "{title}";
on-click = "activate";
on-click-middle = "close";
};
memory = {
interval = 1;
format = " {used}/{total}Gb";
}; };
"wlr/taskbar" = {
format = "{icon}";
icon-size = 18;
tooltip-format = "{title}";
on-click = "activate";
on-click-middle = "close";
};
memory = {
interval = 1;
format = " {used}/{total}Gb";
};
network = { network = {
interval = 1; interval = 1;
format-alt = "{ifname}: {ipaddr}/{cidr}"; format-alt = "{ifname}: {ipaddr}/{cidr}";
@ -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,49 +138,49 @@ ${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" = {
disable-scroll = true; disable-scroll = true;
all-outputs = false; all-outputs = false;
warp-on-scroll = true; warp-on-scroll = true;
format = "{name}{icon} "; format = "{name}{icon} ";
format-icons = { format-icons = {
urgent = ""; urgent = "";
active = ""; active = "";
default = ""; default = "";
}; };
#persistent-workspaces = { #persistent-workspaces = {
# "*" = 3; # "*" = 3;
#}; #};
}; };
"custom/power" = { "custom/power" = {
format = ""; format = "";
tooltip = false; tooltip = false;
on-click = "wlogout"; on-click = "wlogout";
}; };
"custom/notification" = { "custom/notification" = {
tooltip = false; tooltip = false;
format = "{icon}"; format = "{icon}";
format-icons = { format-icons = {
notification = "<span foreground='red'></span>"; notification = "<span foreground='red'></span>";
none = ""; none = "";
dnd-notification = "<span foreground='red'></span>"; dnd-notification = "<span foreground='red'></span>";
dnd-none = ""; dnd-none = "";
}; };
return-type = "json"; return-type = "json";
exec-if = "which swaync-client"; exec-if = "which swaync-client";
exec = "swaync-client -swb"; exec = "swaync-client -swb";
on-click = "sleep 0.1 && swaync-client -t -sw"; on-click = "sleep 0.1 && swaync-client -t -sw";
on-click-right = "sleep 0.1 && swaync-client -d -sw"; on-click-right = "sleep 0.1 && swaync-client -d -sw";
escape = true; escape = true;
}; };
"custom/disablehypridle" = { "custom/disablehypridle" = {
@ -191,6 +200,7 @@ ${builtins.readFile ./waybarstyle.css}'';
fi fi
''; '';
}; };
}]; }
];
}; };
} }

View file

@ -10,27 +10,28 @@
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.stylix.nixosModules.stylix inputs.sops-nix.nixosModules.sops
inputs.nixos-facter-modules.nixosModules.facter inputs.stylix.nixosModules.stylix
inputs.home-manager.nixosModules.default inputs.nixos-facter-modules.nixosModules.facter
inputs.disko.nixosModules.default inputs.home-manager.nixosModules.default
inputs.disko.nixosModules.default
../../modules/firefox ../../modules/firefox
#../../modules/flatpak #../../modules/flatpak
../../modules/steam ../../modules/steam
../../modules/ly ../../modules/ly
../../modules/sddm ../../modules/sddm
../../modules/services/autoupgrade ../../modules/services/autoupgrade
../../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
@ -209,7 +209,7 @@
enable = true; enable = true;
}; };
logitech.wireless.enable = true; logitech.wireless.enable = true;
bluetooth = { bluetooth = {
enable = true; enable = true;
powerOnBoot = true; powerOnBoot = true;
settings = { settings = {
@ -222,110 +222,110 @@
services.blueman.enable = true; services.blueman.enable = true;
security.polkit.enable = true; security.polkit.enable = true;
security.rtkit.enable = true; security.rtkit.enable = true;
services.pipewire = { services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
jack.enable = true;
};
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
};
stylix = {
enable = false;
image = "${../../modules/hyprland/wallpaper.jpg}";
autoEnable = true;
opacity = {
desktop = 0.0; #0.5;
};
targets = {
gtk.enable = true;
plymouth = {
enable = true; enable = true;
alsa.enable = true; #logo = ./fastfetch/nixos.png;
alsa.support32Bit = true; logoAnimated = false;
pulse.enable = true;
jack.enable = true;
}; };
};
home-manager = { fonts = {
useGlobalPkgs = true; sizes = {
useUserPackages = true; applications = 14;
}; desktop = 12;
stylix = { popups = 12;
enable = false; terminal = 16;
image = "${../../modules/hyprland/wallpaper.jpg}";
autoEnable = true;
opacity = {
desktop = 0.0;#0.5;
};
targets = {
gtk.enable = true;
plymouth = {
enable = true;
#logo = ./fastfetch/nixos.png;
logoAnimated = false;
};
};
fonts = {
sizes = {
applications = 14;
desktop = 12;
popups = 12;
terminal = 16;
};
};
polarity = "dark";
base16Scheme = "${pkgs.base16-schemes}/share/themes/catppuccin-mocha.yaml";
}; };
};
polarity = "dark";
base16Scheme = "${pkgs.base16-schemes}/share/themes/catppuccin-mocha.yaml";
};
programs.bash = { programs.bash = {
shellAliases = { shellAliases = {
ls = "${pkgs.eza}/bin/eza --icons=always"; ls = "${pkgs.eza}/bin/eza --icons=always";
}; };
}; };
#services.flatpak.enable = true; #services.flatpak.enable = true;
#services.flatpak.packages = [ #services.flatpak.packages = [
# "flathub:app/org.kde.dolphin//stable" # "flathub:app/org.kde.dolphin//stable"
# ]; # ];
# Some programs need SUID wrappers, can be configured further or are # Some programs need SUID wrappers, can be configured further or are
# started in user sessions. # started in user sessions.
# programs.mtr.enable = true; # programs.mtr.enable = true;
# programs.gnupg.agent = { # programs.gnupg.agent = {
# enable = true; # enable = true;
# enableSSHSupport = true; # enableSSHSupport = true;
# }; # };
kk.steam.enable = true; kk.steam.enable = true;
# List services that you want to enable: # List services that you want to enable:
# Enable the OpenSSH daemon. # Enable the OpenSSH daemon.
services.openssh = { services.openssh = {
enable = true; enable = true;
# require public key authentication for better security # require public key authentication for better security
settings.PasswordAuthentication = false; settings.PasswordAuthentication = false;
settings.KbdInteractiveAuthentication = false; settings.KbdInteractiveAuthentication = false;
settings.PermitRootLogin = "no"; settings.PermitRootLogin = "no";
#extraConfig = "HostKey ${config.sops.secrets."ssh_keys/${hwconfig.hostname}".path}"; #extraConfig = "HostKey ${config.sops.secrets."ssh_keys/${hwconfig.hostname}".path}";
}; };
# 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;
# This value determines the NixOS release from which the default # This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions # settings for stateful data, like file locations and database versions
# on your system were taken. Its perfectly fine and recommended to leave # on your system were taken. Its perfectly fine and recommended to leave
# this value at the release version of the first install of this system. # this value at the release version of the first install of this system.
# Before changing this value read the documentation for this option # Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "24.11"; # Did you read the comment? system.stateVersion = "24.11"; # Did you read the comment?
nix = { nix = {
settings = { settings = {
experimental-features = [ experimental-features = [
"nix-command" "nix-command"
"flakes" "flakes"
]; ];
auto-optimise-store = true; auto-optimise-store = true;
substituters = [ substituters = [
"https://hyprland.cachix.org" "https://hyprland.cachix.org"
"https://nix-gaming.cachix.org" "https://nix-gaming.cachix.org"
"https://nix-community.cachix.org" "https://nix-community.cachix.org"
]; ];
trusted-public-keys = [ trusted-public-keys = [
"hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc=" "hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc="
"nix-gaming.cachix.org-1:nbjlureqMbRAxR1gJ/f3hxemL9svXaZF/Ees8vCUUs4=" "nix-gaming.cachix.org-1:nbjlureqMbRAxR1gJ/f3hxemL9svXaZF/Ees8vCUUs4="
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
]; ];
}; };
}; };
} }

View file

@ -5,20 +5,19 @@
}: { }: {
imports = [ imports = [
]; ];
environment.packages = with pkgs; environment.packages = with pkgs; [
[ neovim
neovim git
git fastfetch
fastfetch asciiquarium
asciiquarium cmatrix
cmatrix #inputs.neovim.packages.aarch64-linux.default
#inputs.neovim.packages.aarch64-linux.default
(pkgs.writeShellScriptBin "droid-switch" '' (pkgs.writeShellScriptBin "droid-switch" ''
nix-on-droid switch --flake /data/data/com.termux.nix/files/home/nixos-config nix-on-droid switch --flake /data/data/com.termux.nix/files/home/nixos-config
'') '')
inputs.emacs-kylekrein.packages.aarch64-linux.default inputs.emacs-kylekrein.packages.aarch64-linux.default
]; ];
home-manager = { home-manager = {
config = ./home.nix; config = ./home.nix;
useGlobalPkgs = true; useGlobalPkgs = true;

View file

@ -1,17 +1,22 @@
{ pkgs, config, lib, ... }:
{ {
imports = [ pkgs,
#../../modules/nixvim config,
../../homes/kylekrein/git.nix lib,
]; ...
home.activation = { }: {
copyFont = let imports = [
font_src = "${pkgs.nerd-fonts.fira-code}/share/fonts/truetype/NerdFonts/FiraCode/FiraCodeNerdFont-Regular.ttf"; #../../modules/nixvim
font_dst = "${config.home.homeDirectory}/.termux/font.ttf"; ../../homes/kylekrein/git.nix
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}" home.activation = {
''; copyFont = let
}; font_src = "${pkgs.nerd-fonts.fira-code}/share/fonts/truetype/NerdFonts/FiraCode/FiraCodeNerdFont-Regular.ttf";
font_dst = "${config.home.homeDirectory}/.termux/font.ttf";
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}"
'';
};
home.stateVersion = "24.05"; home.stateVersion = "24.05";
} }

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
''; '';
@ -50,7 +50,7 @@
blender blender
ladybird ladybird
prismlauncher prismlauncher
#inputs.nix-gaming.packages.${pkgs.system}.star-citizen #inputs.nix-gaming.packages.${pkgs.system}.star-citizen
]; ];
@ -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
''; '';
@ -48,7 +48,7 @@
blender blender
ladybird ladybird
prismlauncher prismlauncher
#inputs.nix-gaming.packages.${pkgs.system}.star-citizen #inputs.nix-gaming.packages.${pkgs.system}.star-citizen
]; ];
@ -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,14 +106,17 @@
#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,25 +18,25 @@
]; ];
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";
}; };
boot = { boot = {
kernelParams = [ kernelParams = [
"zswap.enabled=1" "zswap.enabled=1"
"zswap.compressor=lzo" "zswap.compressor=lzo"

View file

@ -1,49 +1,53 @@
# 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" = {
device = "/dev/disk/by-label/nixos";
fsType = "ext4";
depends = ["/"];
neededForBoot = true;
}; };
fileSystems."/persist" =
{ device = "/dev/disk/by-label/nixos";
fsType = "ext4";
depends = [ "/" ];
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" = {
device = "/dev/disk/by-label/EFI\\x20-\\x20NIXOS";
fsType = "vfat";
#options = [ "fmask=0022" "dmask=0022" ];
}; };
fileSystems."/boot" =
{ device = "/dev/disk/by-label/EFI\\x20-\\x20NIXOS";
fsType = "vfat";
#options = [ "fmask=0022" "dmask=0022" ];
};
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).
@ -147,14 +145,14 @@ in
Note that database_path cannot be edited because of the service's reliance on systemd StateDir. Note that database_path cannot be edited because of the service's reliance on systemd StateDir.
''; '';
}; };
global.database_backup_path = lib.mkOption { global.database_backup_path = lib.mkOption {
type = lib.types.nullOr lib.types.path; type = lib.types.nullOr lib.types.path;
default = null; default = null;
description = '' description = ''
Path to the conduwuit database, the directory where conduwuit will backup its data. Path to the conduwuit database, the directory where conduwuit will backup its data.
''; '';
}; };
global.database_backups_to_keep = lib.mkOption { global.database_backups_to_keep = lib.mkOption {
type = lib.types.ints.positive; type = lib.types.ints.positive;
default = 1; default = 1;
description = ""; description = "";
@ -170,103 +168,103 @@ in
Disabled by default. Disabled by default.
''; '';
}; };
global.allow_local_presence = lib.mkOption { global.allow_local_presence = lib.mkOption {
type = lib.types.bool; type = lib.types.bool;
default = true; default = true;
description = '' description = ''
''; '';
}; };
global.allow_incoming_presence = lib.mkOption { global.allow_incoming_presence = lib.mkOption {
type = lib.types.bool; type = lib.types.bool;
default = true; default = true;
description = '' description = ''
''; '';
}; };
global.allow_outgoing_presence = lib.mkOption { global.allow_outgoing_presence = lib.mkOption {
type = lib.types.bool; type = lib.types.bool;
default = false; default = false;
description = '' description = ''
''; '';
}; };
global.require_auth_for_profile_requests = lib.mkOption { global.require_auth_for_profile_requests = lib.mkOption {
type = lib.types.bool; type = lib.types.bool;
default = false; default = false;
description = '' description = ''
''; '';
}; };
global.new_user_displayname_suffix = lib.mkOption { global.new_user_displayname_suffix = lib.mkOption {
type = lib.types.str; type = lib.types.str;
default = "🏳"; default = "🏳";
description = '' description = ''
''; '';
}; };
global.registration_token = lib.mkOption { global.registration_token = lib.mkOption {
type = lib.types.str; type = lib.types.str;
default = ""; default = "";
description = '' description = ''
''; '';
}; };
global.registration_token_file = lib.mkOption { global.registration_token_file = lib.mkOption {
type = lib.types.nullOr lib.types.path; type = lib.types.nullOr lib.types.path;
default = null; default = null;
description = '' description = ''
''; '';
}; };
global.allow_public_room_directory_over_federation = lib.mkOption { global.allow_public_room_directory_over_federation = lib.mkOption {
type = lib.types.bool; type = lib.types.bool;
default = false; default = false;
description = '' description = ''
''; '';
}; };
global.allow_public_room_directory_without_auth = lib.mkOption { global.allow_public_room_directory_without_auth = lib.mkOption {
type = lib.types.bool; type = lib.types.bool;
default = false; default = false;
description = '' description = ''
''; '';
}; };
global.allow_device_name_federation = lib.mkOption { global.allow_device_name_federation = lib.mkOption {
type = lib.types.bool; type = lib.types.bool;
default = false; default = false;
description = '' description = ''
''; '';
}; };
global.allow_inbound_profile_lookup_federation_requests = lib.mkOption { global.allow_inbound_profile_lookup_federation_requests = lib.mkOption {
type = lib.types.bool; type = lib.types.bool;
default = true; default = true;
description = '' description = ''
''; '';
}; };
global.turn_secret = lib.mkOption { global.turn_secret = lib.mkOption {
type = lib.types.nullOr lib.types.str; type = lib.types.nullOr lib.types.str;
default = null; default = null;
description = '' description = ''
''; '';
}; };
global.turn_uris = lib.mkOption { global.turn_uris = lib.mkOption {
type = lib.types.listOf lib.types.nonEmptyStr; type = lib.types.listOf lib.types.nonEmptyStr;
default = []; default = [];
description = '' description = ''
''; '';
}; };
global.turn_secret_file = lib.mkOption { global.turn_secret_file = lib.mkOption {
type = lib.types.nullOr lib.types.path; type = lib.types.nullOr lib.types.path;
default = null; default = null;
description = '' description = ''
''; '';
}; };
global.prevent_media_downloads_from = lib.mkOption { global.prevent_media_downloads_from = lib.mkOption {
type = lib.types.listOf lib.types.nonEmptyStr; type = lib.types.listOf lib.types.nonEmptyStr;
default = []; default = [];
description = '' description = ''
''; '';
}; };
global.well_known.client = lib.mkOption { global.well_known.client = lib.mkOption {
type = lib.types.str; type = lib.types.str;
default = ""; default = "";
description = '' description = ''
''; '';
}; };
global.well_known.server = lib.mkOption { global.well_known.server = lib.mkOption {
type = lib.types.str; type = lib.types.str;
default = ""; default = "";
description = '' description = ''
@ -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

@ -8,7 +8,7 @@
... ...
}: { }: {
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
inputs.home-manager.nixosModules.default inputs.home-manager.nixosModules.default
@ -21,177 +21,176 @@
./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}" = {};
boot.tmp.cleanOnBoot = true; boot.tmp.cleanOnBoot = true;
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 = {
mutableUsers = false;
users = { users = {
root = { mutableUsers = false;
# disable root login here, and also when installing nix by running nixos-install --no-root-passwd users = {
# https://discourse.nixos.org/t/how-to-disable-root-user-account-in-configuration-nix/13235/3 root = {
hashedPassword = "!"; # disable root logins, nothing hashes to ! # disable root login here, and also when installing nix by running nixos-install --no-root-passwd
# https://discourse.nixos.org/t/how-to-disable-root-user-account-in-configuration-nix/13235/3
hashedPassword = "!"; # disable root logins, nothing hashes to !
};
};
};
environment.systemPackages = with pkgs; [
neovim
git
];
programs.nh = {
enable = true;
clean.enable = true;
clean.extraArgs = "--keep-since 4d --keep 3";
flake = "/etc/nixos-config";
};
services.openssh = {
enable = true;
# require public key authentication for better security
settings.PasswordAuthentication = false;
settings.KbdInteractiveAuthentication = false;
settings.PermitRootLogin = "no";
#extraConfig = "HostKey ${config.sops.secrets."ssh_keys/${hwconfig.hostname}".path}";
};
zramSwap = {
enable = true; # Hopefully? helps with freezing when using swap
};
#Chat host
networking.firewall.allowedTCPPorts = [80 443 22 8448];
networking.firewall.allowedUDPPorts = [3478 5349];
#sops.secrets."services/conduwuit" = {mode = "0755";};
sops.secrets."services/gitlab/dbPassword" = {owner = "gitlab";};
sops.secrets."services/gitlab/rootPassword" = {owner = "gitlab";};
sops.secrets."services/gitlab/secret" = {owner = "gitlab";};
sops.secrets."services/gitlab/otpsecret" = {owner = "gitlab";};
sops.secrets."services/gitlab/dbsecret" = {owner = "gitlab";};
sops.secrets."services/gitlab/oidcKeyBase" = {owner = "gitlab";};
sops.secrets."services/gitlab/activeRecordSalt" = {owner = "gitlab";};
sops.secrets."services/gitlab/activeRecordPrimaryKey" = {owner = "gitlab";};
sops.secrets."services/gitlab/activeRecordDeterministicKey" = {owner = "gitlab";};
services.gitlab = {
enable = true;
host = "gitlab.kylekrein.com";
port = 443;
#statePath = "/persist/gitlab/state";
backup.startAt = "3:00";
databasePasswordFile = config.sops.secrets."services/gitlab/dbPassword".path;
initialRootPasswordFile = config.sops.secrets."services/gitlab/rootPassword".path;
secrets = {
secretFile = config.sops.secrets."services/gitlab/secret".path;
otpFile = config.sops.secrets."services/gitlab/otpsecret".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";
activeRecordSaltFile = config.sops.secrets."services/gitlab/activeRecordSalt".path;
activeRecordPrimaryKeyFile = config.sops.secrets."services/gitlab/activeRecordPrimaryKey".path;
activeRecordDeterministicKeyFile = config.sops.secrets."services/gitlab/activeRecordDeterministicKey".path;
};
};
systemd.services.gitlab-backup.environment.BACKUP = "dump";
kk.services.conduwuit = {
enable = true;
#user = "turnserver";
settings = {
global = {
server_name = "kylekrein.com";
well_known = {
server = "matrix.kylekrein.com:443";
client = "https://matrix.kylekrein.com";
};
port = [6167];
trusted_servers = ["matrix.org"];
allow_registration = false;
registration_token = ""; #nix shell nixpkgs#openssl -c openssl rand -base64 48 | tr -d '/+' | cut -c1-64
allow_federation = true;
allow_encryption = true;
allow_local_presence = true;
require_auth_for_profile_requests = true;
};
};
extraEnvironment = {
};
};
services.caddy = {
enable = true;
#virtualHosts."kylekrein.com:8448".extraConfig = ''
# reverse_proxy http://localhost:6167
#'';
virtualHosts."kylekrein.com".extraConfig = ''
handle_path /.well-known/matrix/* {
header Access-Control-Allow-Origin *
## `Content-Type: application/json` isn't required by the matrix spec
## but some browsers (firefox) and some other tooling might preview json
## content prettier when they are made aware via Content-Type
header Content-Type application/json
respond /client `{ "m.homeserver": { "base_url": "https://matrix.kylekrein.com/" }, "org.matrix.msc3575.proxy": { "url": "https://matrix.kylekrein.com/"}, "org.matrix.msc4143.rtc_foci": [ { "type": "livekit", "livekit_service_url": "https://livekit-jwt.call.matrix.org" } ] }`
respond /server `{ "m.server": "https://matrix.kylekrein.com" }`
## return http/404 if nothing matches
respond 404
}
respond /.well-known/element/element.json `{"call":{"widget_url":"https://call.element.io"}}`
reverse_proxy * http://localhost:6167
'';
# reverse_proxy /.well-known/* http://localhost:6167
#'';
virtualHosts."matrix.kylekrein.com".extraConfig = ''
handle_path /.well-known/matrix/* {
header Access-Control-Allow-Origin *
## `Content-Type: application/json` isn't required by the matrix spec
## but some browsers (firefox) and some other tooling might preview json
## content prettier when they are made aware via Content-Type
header Content-Type application/json
respond /client `{ "m.homeserver": { "base_url": "https://matrix.kylekrein.com/" }, "org.matrix.msc3575.proxy": { "url": "https://matrix.kylekrein.com/"}, "org.matrix.msc4143.rtc_foci": [ { "type": "livekit", "livekit_service_url": "https://livekit-jwt.call.matrix.org" } ] }`
respond /server `{ "m.server": "https://matrix.kylekrein.com" }`
## return http/404 if nothing matches
respond 404
}
respond /.well-known/element/element.json `{"call":{"widget_url":"https://call.element.io"}}`
reverse_proxy * http://localhost:6167
'';
virtualHosts."gitlab.kylekrein.com".extraConfig = ''
reverse_proxy * unix//run/gitlab/gitlab-workhorse.socket
'';
};
system.stateVersion = "24.11";
nix = {
settings = {
experimental-features = [
"nix-command"
"flakes"
];
auto-optimise-store = true;
substituters = [
"https://hyprland.cachix.org"
"https://nix-gaming.cachix.org"
"https://nix-community.cachix.org"
];
trusted-public-keys = [
"hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc="
"nix-gaming.cachix.org-1:nbjlureqMbRAxR1gJ/f3hxemL9svXaZF/Ees8vCUUs4="
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
];
}; };
}; };
}; };
environment.systemPackages = with pkgs; [
neovim
git
];
programs.nh = {
enable = true;
clean.enable = true;
clean.extraArgs = "--keep-since 4d --keep 3";
flake = "/etc/nixos-config";
};
services.openssh = {
enable = true;
# require public key authentication for better security
settings.PasswordAuthentication = false;
settings.KbdInteractiveAuthentication = false;
settings.PermitRootLogin = "no";
#extraConfig = "HostKey ${config.sops.secrets."ssh_keys/${hwconfig.hostname}".path}";
};
zramSwap = {
enable = true; # Hopefully? helps with freezing when using swap
};
#Chat host
networking.firewall.allowedTCPPorts = [ 80 443 22 8448 ];
networking.firewall.allowedUDPPorts = [ 3478 5349 ];
#sops.secrets."services/conduwuit" = {mode = "0755";};
sops.secrets."services/gitlab/dbPassword" = { owner = "gitlab"; };
sops.secrets."services/gitlab/rootPassword" = { owner = "gitlab"; };
sops.secrets."services/gitlab/secret" = { owner = "gitlab"; };
sops.secrets."services/gitlab/otpsecret" = { owner = "gitlab"; };
sops.secrets."services/gitlab/dbsecret" = { owner = "gitlab"; };
sops.secrets."services/gitlab/oidcKeyBase" = { owner = "gitlab"; };
sops.secrets."services/gitlab/activeRecordSalt" = { owner = "gitlab"; };
sops.secrets."services/gitlab/activeRecordPrimaryKey" = { owner = "gitlab"; };
sops.secrets."services/gitlab/activeRecordDeterministicKey" = { owner = "gitlab"; };
services.gitlab = {
enable = true;
host = "gitlab.kylekrein.com";
port = 443;
#statePath = "/persist/gitlab/state";
backup.startAt = "3:00";
databasePasswordFile = config.sops.secrets."services/gitlab/dbPassword".path;
initialRootPasswordFile = config.sops.secrets."services/gitlab/rootPassword".path;
secrets = {
secretFile = config.sops.secrets."services/gitlab/secret".path;
otpFile = config.sops.secrets."services/gitlab/otpsecret".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";
activeRecordSaltFile = config.sops.secrets."services/gitlab/activeRecordSalt".path;
activeRecordPrimaryKeyFile = config.sops.secrets."services/gitlab/activeRecordPrimaryKey".path;
activeRecordDeterministicKeyFile = config.sops.secrets."services/gitlab/activeRecordDeterministicKey".path;
};
};
systemd.services.gitlab-backup.environment.BACKUP = "dump";
kk.services.conduwuit = {
enable = true;
#user = "turnserver";
settings = {
global = {
server_name = "kylekrein.com";
well_known = {
server = "matrix.kylekrein.com:443";
client = "https://matrix.kylekrein.com";
};
port = [ 6167 ];
trusted_servers = [ "matrix.org" ];
allow_registration = false;
registration_token = ""; #nix shell nixpkgs#openssl -c openssl rand -base64 48 | tr -d '/+' | cut -c1-64
allow_federation = true;
allow_encryption = true;
allow_local_presence = true;
require_auth_for_profile_requests = true;
};
};
extraEnvironment = {
};
};
services.caddy = {
enable = true;
#virtualHosts."kylekrein.com:8448".extraConfig = ''
# reverse_proxy http://localhost:6167
#'';
virtualHosts."kylekrein.com".extraConfig = ''
handle_path /.well-known/matrix/* {
header Access-Control-Allow-Origin *
## `Content-Type: application/json` isn't required by the matrix spec
## but some browsers (firefox) and some other tooling might preview json
## content prettier when they are made aware via Content-Type
header Content-Type application/json
respond /client `{ "m.homeserver": { "base_url": "https://matrix.kylekrein.com/" }, "org.matrix.msc3575.proxy": { "url": "https://matrix.kylekrein.com/"}, "org.matrix.msc4143.rtc_foci": [ { "type": "livekit", "livekit_service_url": "https://livekit-jwt.call.matrix.org" } ] }`
respond /server `{ "m.server": "https://matrix.kylekrein.com" }`
## return http/404 if nothing matches
respond 404
}
respond /.well-known/element/element.json `{"call":{"widget_url":"https://call.element.io"}}`
reverse_proxy * http://localhost:6167
'';
# reverse_proxy /.well-known/* http://localhost:6167
#'';
virtualHosts."matrix.kylekrein.com".extraConfig = ''
handle_path /.well-known/matrix/* {
header Access-Control-Allow-Origin *
## `Content-Type: application/json` isn't required by the matrix spec
## but some browsers (firefox) and some other tooling might preview json
## content prettier when they are made aware via Content-Type
header Content-Type application/json
respond /client `{ "m.homeserver": { "base_url": "https://matrix.kylekrein.com/" }, "org.matrix.msc3575.proxy": { "url": "https://matrix.kylekrein.com/"}, "org.matrix.msc4143.rtc_foci": [ { "type": "livekit", "livekit_service_url": "https://livekit-jwt.call.matrix.org" } ] }`
respond /server `{ "m.server": "https://matrix.kylekrein.com" }`
## return http/404 if nothing matches
respond 404
}
respond /.well-known/element/element.json `{"call":{"widget_url":"https://call.element.io"}}`
reverse_proxy * http://localhost:6167
'';
virtualHosts."gitlab.kylekrein.com".extraConfig = ''
reverse_proxy * unix//run/gitlab/gitlab-workhorse.socket
'';
};
system.stateVersion = "24.11";
nix = {
settings = {
experimental-features = [
"nix-command"
"flakes"
];
auto-optimise-store = true;
substituters = [
"https://hyprland.cachix.org"
"https://nix-gaming.cachix.org"
"https://nix-community.cachix.org"
];
trusted-public-keys = [
"hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc="
"nix-gaming.cachix.org-1:nbjlureqMbRAxR1gJ/f3hxemL9svXaZF/Ees8vCUUs4="
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
];
};
};
};
} }

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,9 +1,10 @@
{ 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 = {
address = ""; address = "";
@ -14,19 +15,34 @@
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 = ''
ATTR{address}=="96:00:04:30:83:0e", NAME="eth0" ATTR{address}=="96:00:04:30:83:0e", NAME="eth0"
''; '';
} }

View file

@ -1,12 +1,12 @@
{ {
pkgs, pkgs,
lib, lib,
hwconfig, hwconfig,
inputs, inputs,
config, config,
unstable-pkgs, unstable-pkgs,
... ...
}: { }: {
imports = [ imports = [
]; ];
} }

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,49 +1,54 @@
{ pkgs, inputs, hwconfig, unstable-pkgs, ... }:
{ {
environment.systemPackages = with pkgs; [ pkgs,
kdePackages.qtwayland inputs,
kdePackages.qtsvg hwconfig,
kdePackages.kio-fuse #to mount remote filesystems via FUSE unstable-pkgs,
kdePackages.kio-extras #extra protocols support (sftp, fish and more) ...
kdePackages.kio-admin }: {
libheif #https://github.com/NixOS/nixpkgs/issues/164021 environment.systemPackages = with pkgs; [
libheif.out kdePackages.qtwayland
kdePackages.qtsvg
#kde kdePackages.kio-fuse #to mount remote filesystems via FUSE
kdePackages.breeze-icons kdePackages.kio-extras #extra protocols support (sftp, fish and more)
kdePackages.breeze kdePackages.kio-admin
kdePackages.kdesdk-thumbnailers libheif #https://github.com/NixOS/nixpkgs/issues/164021
kdePackages.kdegraphics-thumbnailers libheif.out
kdePackages.kservice
kdePackages.kdbusaddons
kdePackages.kfilemetadata
kdePackages.kconfig
kdePackages.kcoreaddons
kdePackages.kcrash
kdePackages.kguiaddons
kdePackages.ki18n
kdePackages.kitemviews
kdePackages.kwidgetsaddons
kdePackages.kwindowsystem
shared-mime-info
#kde support tools #kde
#libsForQt5.qt5ct kdePackages.breeze-icons
#qt6ct kdePackages.breeze
kdePackages.kimageformats kdePackages.kdesdk-thumbnailers
kdePackages.dolphin kdePackages.kdegraphics-thumbnailers
kdePackages.dolphin-plugins kdePackages.kservice
]; kdePackages.kdbusaddons
xdg = { kdePackages.kfilemetadata
menus.enable = true; kdePackages.kconfig
mime.enable = true; kdePackages.kcoreaddons
}; kdePackages.kcrash
kdePackages.kguiaddons
kdePackages.ki18n
kdePackages.kitemviews
kdePackages.kwidgetsaddons
kdePackages.kwindowsystem
shared-mime-info
#https://discourse.nixos.org/t/dolphin-does-not-have-mime-associations/48985/3 #kde support tools
# This fixes the unpopulated MIME menus #libsForQt5.qt5ct
environment.etc."/xdg/menus/plasma-applications.menu".text = builtins.readFile "${pkgs.kdePackages.plasma-workspace}/etc/xdg/menus/plasma-applications.menu"; #qt6ct
environment.etc."/xdg/menus/applications.menu".text = builtins.readFile "${pkgs.kdePackages.plasma-workspace}/etc/xdg/menus/plasma-applications.menu"; kdePackages.kimageformats
#environment.pathsToLink = [ kdePackages.dolphin
# "share/thumbnailers" kdePackages.dolphin-plugins
#]; ];
xdg = {
menus.enable = true;
mime.enable = true;
};
#https://discourse.nixos.org/t/dolphin-does-not-have-mime-associations/48985/3
# This fixes the unpopulated MIME menus
environment.etc."/xdg/menus/plasma-applications.menu".text = builtins.readFile "${pkgs.kdePackages.plasma-workspace}/etc/xdg/menus/plasma-applications.menu";
environment.etc."/xdg/menus/applications.menu".text = builtins.readFile "${pkgs.kdePackages.plasma-workspace}/etc/xdg/menus/plasma-applications.menu";
#environment.pathsToLink = [
# "share/thumbnailers"
#];
} }

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;
@ -23,91 +26,96 @@
}; };
modules = [ modules = [
"break" "break"
{ {
type = "custom"; type = "custom";
format = "Hardware"; format = "Hardware";
} }
{ {
type = "cpu"; type = "cpu";
key = " "; key = " ";
} }
{ {
type = "gpu"; type = "gpu";
key = " 󰍛 "; key = " 󰍛 ";
} }
{ {
type = "memory"; type = "memory";
key = " 󰑭 "; key = " 󰑭 ";
} }
{ {
type = "custom"; type = "custom";
format = ""; format = "";
} }
"break" "break"
{ {
type = "custom"; type = "custom";
format = "Software"; format = "Software";
} }
{ {
type = "custom"; type = "custom";
format = " OS -> NixOS btw"; format = " OS -> NixOS btw";
} }
{ {
type = "kernel"; type = "kernel";
key = " "; key = " ";
} }
{ {
type = "packages"; type = "packages";
key = " 󰏖 "; key = " 󰏖 ";
} }
{ {
type = "shell"; type = "shell";
key = " "; key = " ";
} }
"break" "break"
{ {
type = "wm"; type = "wm";
key = " WM"; key = " WM";
} }
{ {
type = "wmtheme"; type = "wmtheme";
key = " 󰉼 "; key = " 󰉼 ";
} }
{ {
type = "terminal"; type = "terminal";
key = " "; key = " ";
} }
{ {
type = "custom"; type = "custom";
format = ""; format = "";
} }
"break" "break"
{ {
type = "custom"; type = "custom";
format = "Age / Uptime"; format = "Age / Uptime";
} }
{ {
type = "command"; type = "command";
key = " "; key = " ";
text = #bash text =
'' #bash
birth_install=${if hwconfig.useImpermanence then "${first-nixos-install}" else "$(stat -c %W /)"} ''
current=$(date +%s) birth_install=${
delta=$((current - birth_install)) if hwconfig.useImpermanence
delta_days=$((delta / 86400)) then "${first-nixos-install}"
echo $delta_days days else "$(stat -c %W /)"
''; }
} current=$(date +%s)
{ delta=$((current - birth_install))
type = "uptime"; delta_days=$((delta / 86400))
key = " "; echo $delta_days days
} '';
{ }
type = "custom"; {
format = ""; type = "uptime";
} key = " ";
"break" }
{
type = "custom";
format = "";
}
"break"
]; ];
}; };
}; };

View file

@ -1,6 +1,5 @@
{ pkgs, ... }: {pkgs, ...}: {
{ nixpkgs = {
nixpkgs = {
overlays = [ overlays = [
(final: prev: { (final: prev: {
firefox = prev.firefox.overrideAttrs (old: { firefox = prev.firefox.overrideAttrs (old: {
@ -14,7 +13,7 @@
--set MOZ_GMP_PATH "$out/gmp-widevinecdm/system-installed" --set MOZ_GMP_PATH "$out/gmp-widevinecdm/system-installed"
''; '';
}); });
librewolf = prev.librewolf.overrideAttrs (old: { librewolf = prev.librewolf.overrideAttrs (old: {
buildCommand = buildCommand =
old.buildCommand old.buildCommand
+ '' + ''
@ -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,30 +1,35 @@
{ lib, config, pkgs, hwconfig, ... }:
let
lock-false = {
Value = false;
Status = "locked";
};
lock-true = {
Value = true;
Status = "locked";
};
in
{ {
lib,
config,
pkgs,
hwconfig,
...
}: let
lock-false = {
Value = false;
Status = "locked";
};
lock-true = {
Value = true;
Status = "locked";
};
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;
@ -39,19 +44,21 @@
DisplayBookmarksToolbar = "never"; # alternatives: "always" or "newtab" DisplayBookmarksToolbar = "never"; # alternatives: "always" or "newtab"
DisplayMenuBar = "default-off"; # alternatives: "always", "never" or "default-on" DisplayMenuBar = "default-off"; # alternatives: "always", "never" or "default-on"
SearchBar = "unified"; # alternative: "separate" SearchBar = "unified"; # alternative: "separate"
OfferToSaveLogins = false; OfferToSaveLogins = false;
OffertosaveloginsDefault = false; OffertosaveloginsDefault = false;
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";
@ -62,41 +69,45 @@
installation_mode = "force_installed"; installation_mode = "force_installed";
}; };
# Dark Reader # Dark Reader
"addon@darkreader.org" = { "addon@darkreader.org" = {
install_url = "https://addons.mozilla.org/firefox/downloads/latest/darkreader/latest.xpi"; install_url = "https://addons.mozilla.org/firefox/downloads/latest/darkreader/latest.xpi";
installation_mode = "force_installed"; installation_mode = "force_installed";
}; };
#auto tab discard #auto tab discard
"{c2c003ee-bd69-42a2-b0e9-6f34222cb046}" = { "{c2c003ee-bd69-42a2-b0e9-6f34222cb046}" = {
install_url = "https://addons.mozilla.org/firefox/downloads/latest/auto-tab-discard/latest.xpi"; install_url = "https://addons.mozilla.org/firefox/downloads/latest/auto-tab-discard/latest.xpi";
installation_mode = "force_installed"; installation_mode = "force_installed";
}; };
# global speed # global speed
"{f4961478-ac79-4a18-87e9-d2fb8c0442c4}" = { "{f4961478-ac79-4a18-87e9-d2fb8c0442c4}" = {
install_url = "https://addons.mozilla.org/firefox/downloads/latest/global-speed/latest.xpi"; install_url = "https://addons.mozilla.org/firefox/downloads/latest/global-speed/latest.xpi";
installation_mode = "force_installed"; installation_mode = "force_installed";
}; };
# sponsorblock # sponsorblock
"sponsorBlocker@ajay.app" = { "sponsorBlocker@ajay.app" = {
install_url = "https://addons.mozilla.org/firefox/downloads/latest/sponsorblock/latest.xpi"; install_url = "https://addons.mozilla.org/firefox/downloads/latest/sponsorblock/latest.xpi";
installation_mode = "force_installed"; installation_mode = "force_installed";
}; };
# Adguard adblocker
"adguardadblocker@adguard.com" = {
install_url = "https://addons.mozilla.org/firefox/downloads/latest/adguard-adblocker/latest.xpi";
installation_mode = "force_installed";
};
}; # Adguard adblocker
/* ---- PREFERENCES ---- */ "adguardadblocker@adguard.com" = {
install_url = "https://addons.mozilla.org/firefox/downloads/latest/adguard-adblocker/latest.xpi";
installation_mode = "force_installed";
};
};
/*
---- 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
"browser.topsites.contile.enabled" = lock-false; "browser.topsites.contile.enabled" = lock-false;
"browser.formfill.enable" = lock-false; "browser.formfill.enable" = lock-false;
"browser.search.suggest.enabled" = lock-false; "browser.search.suggest.enabled" = lock-false;

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,15 +1,19 @@
{ 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:
pass-otp with exts; [
pass-import pass-otp
])) pass-import
]))
]; ];
} }

View file

@ -1,83 +1,89 @@
{pkgs, 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" ''
cat ${battery-path}/capacity 2>/dev/null || echo "N/A"
''}/bin/get-battery-level";
get-status = "${pkgs.writeShellScriptBin "get-status" ''
cat ${battery-path}/status 2>/dev/null || echo "Unknown"
''}/bin/get-status";
get-icon = "${pkgs.writeShellScriptBin "get-icon" ''
BATTERY_LEVEL=$(${get-battery-level})
STATUS=$(${get-status})
if [[ "$BATTERY_LEVEL" == "N/A" ]]; then
ICON="󰂑 "
elif [[ "$STATUS" == "Charging" ]]; then
if [[ $BATTERY_LEVEL -ge 90 ]]; then
ICON="󰂋 "
elif [[ $BATTERY_LEVEL -ge 80 ]]; then
ICON="󰂊 "
elif [[ $BATTERY_LEVEL -ge 70 ]]; then
ICON="󰢞 "
elif [[ $BATTERY_LEVEL -ge 60 ]]; then
ICON="󰂉 "
elif [[ $BATTERY_LEVEL -ge 50 ]]; then
ICON="󰢝 "
elif [[ $BATTERY_LEVEL -ge 40 ]]; then
ICON="󰂈 "
elif [[ $BATTERY_LEVEL -ge 30 ]]; then
ICON="󰂇 "
elif [[ $BATTERY_LEVEL -ge 20 ]]; then
ICON="󰂆 "
elif [[ $BATTERY_LEVEL -ge 10 ]]; then
ICON="󰢜 "
else
ICON="󰢜 "
fi
else
if [[ $BATTERY_LEVEL -ge 90 ]]; then
ICON="󰂂 "
elif [[ $BATTERY_LEVEL -ge 70 ]]; then
ICON="󰂀 "
elif [[ $BATTERY_LEVEL -ge 50 ]]; then
ICON="󰁾 "
elif [[ $BATTERY_LEVEL -ge 30 ]]; then
ICON="󰁼 "
elif [[ $BATTERY_LEVEL -ge 10 ]]; then
ICON="󰁺 "
else
ICON="󰁺 "
fi
fi
echo "$ICON"
''}/bin/get-icon";
get-remaining-time = "${pkgs.writeShellScriptBin "get-remaining-time" ''
REMAINING_ENERGY=$(cat ${battery-path}/energy_now)
POWER_USAGE=$(cat ${battery-path}/power_now)
if [[ -n "$REMAINING_ENERGY" && -n "$POWER_USAGE" && "$POWER_USAGE" -ne 0 ]]; then
TIME_LEFT=$((0 - (REMAINING_ENERGY / POWER_USAGE)))
MINUTES_LEFT=$(((0 - ( (REMAINING_ENERGY * 60) / POWER_USAGE )) - (TIME_LEFT * 60)))
echo "$TIME_LEFT h $MINUTES_LEFT min"
else
echo ""
fi
''}/bin/get-remaining-time";
in
{ {
pkgs,
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" ''
cat ${battery-path}/capacity 2>/dev/null || echo "N/A"
''}/bin/get-battery-level";
get-status = "${pkgs.writeShellScriptBin "get-status" ''
cat ${battery-path}/status 2>/dev/null || echo "Unknown"
''}/bin/get-status";
get-icon = "${pkgs.writeShellScriptBin "get-icon" ''
BATTERY_LEVEL=$(${get-battery-level})
STATUS=$(${get-status})
if [[ "$BATTERY_LEVEL" == "N/A" ]]; then
ICON="󰂑 "
elif [[ "$STATUS" == "Charging" ]]; then
if [[ $BATTERY_LEVEL -ge 90 ]]; then
ICON="󰂋 "
elif [[ $BATTERY_LEVEL -ge 80 ]]; then
ICON="󰂊 "
elif [[ $BATTERY_LEVEL -ge 70 ]]; then
ICON="󰢞 "
elif [[ $BATTERY_LEVEL -ge 60 ]]; then
ICON="󰂉 "
elif [[ $BATTERY_LEVEL -ge 50 ]]; then
ICON="󰢝 "
elif [[ $BATTERY_LEVEL -ge 40 ]]; then
ICON="󰂈 "
elif [[ $BATTERY_LEVEL -ge 30 ]]; then
ICON="󰂇 "
elif [[ $BATTERY_LEVEL -ge 20 ]]; then
ICON="󰂆 "
elif [[ $BATTERY_LEVEL -ge 10 ]]; then
ICON="󰢜 "
else
ICON="󰢜 "
fi
else
if [[ $BATTERY_LEVEL -ge 90 ]]; then
ICON="󰂂 "
elif [[ $BATTERY_LEVEL -ge 70 ]]; then
ICON="󰂀 "
elif [[ $BATTERY_LEVEL -ge 50 ]]; then
ICON="󰁾 "
elif [[ $BATTERY_LEVEL -ge 30 ]]; then
ICON="󰁼 "
elif [[ $BATTERY_LEVEL -ge 10 ]]; then
ICON="󰁺 "
else
ICON="󰁺 "
fi
fi
echo "$ICON"
''}/bin/get-icon";
get-remaining-time = "${pkgs.writeShellScriptBin "get-remaining-time" ''
REMAINING_ENERGY=$(cat ${battery-path}/energy_now)
POWER_USAGE=$(cat ${battery-path}/power_now)
if [[ -n "$REMAINING_ENERGY" && -n "$POWER_USAGE" && "$POWER_USAGE" -ne 0 ]]; then
TIME_LEFT=$((0 - (REMAINING_ENERGY / POWER_USAGE)))
MINUTES_LEFT=$(((0 - ( (REMAINING_ENERGY * 60) / POWER_USAGE )) - (TIME_LEFT * 60)))
echo "$TIME_LEFT h $MINUTES_LEFT min"
else
echo ""
fi
''}/bin/get-remaining-time";
in {
available = hwconfig.isLaptop; available = hwconfig.isLaptop;
icon = get-icon; icon = get-icon;
status = get-status; status = get-status;
time = get-remaining-time; time = get-remaining-time;
level = get-battery-level; level = get-battery-level;
labelAdaptive = "${pkgs.writeShellScriptBin "labelAdaptive" '' labelAdaptive = "${pkgs.writeShellScriptBin "labelAdaptive" ''
if [[ "$(${get-status})" == "Charging" ]]; then if [[ "$(${get-status})" == "Charging" ]]; then
echo "$(${get-battery-level})% $(${get-icon})" echo "$(${get-battery-level})% $(${get-icon})"
else else
echo "$(${get-remaining-time}) $(${get-icon})" echo "$(${get-remaining-time}) $(${get-icon})"
fi fi
''}/bin/labelAdaptive"; ''}/bin/labelAdaptive";
labelPercent = "${pkgs.writeShellScriptBin "labelPercent" '' labelPercent = "${pkgs.writeShellScriptBin "labelPercent" ''
echo "$(${get-battery-level})% $(${get-icon})" echo "$(${get-battery-level})% $(${get-icon})"
''}/bin/labelPercent"; ''}/bin/labelPercent";
} }

View file

@ -1,134 +1,137 @@
{ 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;
plymouth = { plymouth = {
enable = false; enable = false;
#logo = ./fastfetch/nixos.png; #logo = ./fastfetch/nixos.png;
logoAnimated = false; logoAnimated = false;
};
};
fonts = {
sizes = {
applications = 14;
desktop = 12;
popups = 12;
terminal = 16;
};
};
polarity = "dark";
base16Scheme = "${pkgs.base16-schemes}/share/themes/catppuccin-mocha.yaml";
}; };
environment.systemPackages = with pkgs; [ };
#kando fonts = {
sizes = {
applications = 14;
desktop = 12;
popups = 12;
terminal = 16;
};
};
polarity = "dark";
base16Scheme = "${pkgs.base16-schemes}/share/themes/catppuccin-mocha.yaml";
};
environment.systemPackages = with pkgs; [
#kando
kdePackages.qtwayland kdePackages.qtwayland
#libsForQt5.qt5.qtwayland #libsForQt5.qt5.qtwayland
#libsForQt5.qt5.qtsvg #libsForQt5.qt5.qtsvg
kdePackages.qtsvg kdePackages.qtsvg
#kio-fuse #to mount remote filesystems via FUSE #kio-fuse #to mount remote filesystems via FUSE
#libsForQt5.kio-extras #extra protocols support (sftp, fish and more) #libsForQt5.kio-extras #extra protocols support (sftp, fish and more)
kdePackages.kio-fuse #to mount remote filesystems via FUSE kdePackages.kio-fuse #to mount remote filesystems via FUSE
kdePackages.kio-extras #extra protocols support (sftp, fish and more) kdePackages.kio-extras #extra protocols support (sftp, fish and more)
kdePackages.kio-admin kdePackages.kio-admin
waybar waybar
swaynotificationcenter swaynotificationcenter
libnotify libnotify
swww swww
hyprpicker hyprpicker
networkmanagerapplet networkmanagerapplet
hyprlock hyprlock
wlogout wlogout
hypridle hypridle
qpwgraph qpwgraph
pwvucontrol pwvucontrol
brightnessctl brightnessctl
unstable-pkgs.satty #fixes crash in 0.18.0 unstable-pkgs.satty #fixes crash in 0.18.0
grim grim
slurp slurp
clipse clipse
libheif #https://github.com/NixOS/nixpkgs/issues/164021 libheif #https://github.com/NixOS/nixpkgs/issues/164021
libheif.out libheif.out
#kde
kdePackages.breeze-icons
kdePackages.breeze
kdePackages.polkit-kde-agent-1
kdePackages.kdesdk-thumbnailers
kdePackages.kdegraphics-thumbnailers
kdePackages.kservice
kdePackages.kdbusaddons
kdePackages.kfilemetadata
kdePackages.kconfig
kdePackages.kcoreaddons
kdePackages.kcrash
kdePackages.kguiaddons
kdePackages.ki18n
kdePackages.kitemviews
kdePackages.kwidgetsaddons
kdePackages.kwindowsystem
shared-mime-info
#kdePackages.plasma-workspace
#kde support tools #kde
libsForQt5.qt5ct kdePackages.breeze-icons
qt6ct kdePackages.breeze
kdePackages.kimageformats kdePackages.polkit-kde-agent-1
kdePackages.dolphin kdePackages.kdesdk-thumbnailers
kdePackages.dolphin-plugins kdePackages.kdegraphics-thumbnailers
kdePackages.kservice
kdePackages.kdbusaddons
kdePackages.kfilemetadata
kdePackages.kconfig
kdePackages.kcoreaddons
kdePackages.kcrash
kdePackages.kguiaddons
kdePackages.ki18n
kdePackages.kitemviews
kdePackages.kwidgetsaddons
kdePackages.kwindowsystem
shared-mime-info
#kdePackages.plasma-workspace
#kde support tools
libsForQt5.qt5ct
qt6ct
kdePackages.kimageformats
kdePackages.dolphin
kdePackages.dolphin-plugins
];
programs.kdeconnect.enable = true;
programs.kdeconnect.package = pkgs.kdePackages.kdeconnect-kde;
programs.hyprlock.enable = true;
xdg = {
menus.enable = true;
mime.enable = true;
};
xdg.portal = {
enable = true;
config = {
hyprland = {
default = [
"hyprland"
"kde"
];
};
};
configPackages = with pkgs; [
xdg-desktop-portal-hyprland
kdePackages.xdg-desktop-portal-kde
]; ];
};
programs.kdeconnect.enable = true; #https://discourse.nixos.org/t/dolphin-does-not-have-mime-associations/48985/3
programs.kdeconnect.package = pkgs.kdePackages.kdeconnect-kde; # This fixes the unpopulated MIME menus
programs.hyprlock.enable = true; environment.etc."/xdg/menus/plasma-applications.menu".text = builtins.readFile "${pkgs.kdePackages.plasma-workspace}/etc/xdg/menus/plasma-applications.menu";
environment.etc."/xdg/menus/applications.menu".text = builtins.readFile "${pkgs.kdePackages.plasma-workspace}/etc/xdg/menus/plasma-applications.menu";
xdg = { #environment.pathsToLink = [
menus.enable = true; # "share/thumbnailers"
mime.enable = true; #];
};
xdg.portal = {
enable = true;
config = {
hyprland = {
default = [
"hyprland"
"kde"
];
};
};
configPackages = with pkgs; [
xdg-desktop-portal-hyprland
kdePackages.xdg-desktop-portal-kde
];
};
#https://discourse.nixos.org/t/dolphin-does-not-have-mime-associations/48985/3
# This fixes the unpopulated MIME menus
environment.etc."/xdg/menus/plasma-applications.menu".text = builtins.readFile "${pkgs.kdePackages.plasma-workspace}/etc/xdg/menus/plasma-applications.menu";
environment.etc."/xdg/menus/applications.menu".text = builtins.readFile "${pkgs.kdePackages.plasma-workspace}/etc/xdg/menus/plasma-applications.menu";
#environment.pathsToLink = [
# "share/thumbnailers"
#];
programs.hyprland = {
enable = true;
xwayland.enable = true;
systemd.setPath.enable = true;
};
services.hypridle.enable = true;
# qt = {
#enable = true;
#platformTheme = "qt5ct";
#style = "kvantum";
# };
programs.hyprland = {
enable = true;
xwayland.enable = true;
systemd.setPath.enable = true;
};
services.hypridle.enable = true;
# qt = {
#enable = true;
#platformTheme = "qt5ct";
#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 = {
enable = true;
services.hypridle = { settings = {
enable = true; general = {
settings = { lock_cmd = "pidof hyprlock || hyprlock";
before_sleep_cmd = "pidof hyprlock || loginctl lock-session"; # lock before suspend.
general = { after_sleep_cmd = "hyprctl dispatch dpms on"; # to avoid having to press a key twice to turn on the display.
lock_cmd="pidof hyprlock || hyprlock"; ignore_dbus_inhibit = false;
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.
ignore_dbus_inhibit = false;
};
listener = [
#{
# on-resume="brightnessctl -r"; # monitor backlight restore.
# on-timeout="brightnessctl -s set 10"; # set monitor backlight to minimum, avoid 0 on OLED monitor.
# timeout=240;
#}
#{
# on-resume="brightnessctl -rd rgb:kbd_backlight";
# on-timeout="brightnessctl -sd rgb:kbd_backlight set 0";
# timeout=300;
#}
{
on-timeout="notify-send \"You're idle. Locking in 30 seconds.\"";
timeout=830;
}
{
on-timeout = "pidof hyprlock && systemctl suspend";
timeout = 120;
}
#{
# on-timeout="loginctl lock-session";
# timeout=360;
#}
{
on-resume = "hyprctl dispatch dpms on";
on-timeout = suspendScript.outPath;
timeout = 900;
}
#{
# 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
# timeout=420;
#}
];
};
};
listener = [
#{
# on-resume="brightnessctl -r"; # monitor backlight restore.
# on-timeout="brightnessctl -s set 10"; # set monitor backlight to minimum, avoid 0 on OLED monitor.
# timeout=240;
#}
#{
# on-resume="brightnessctl -rd rgb:kbd_backlight";
# on-timeout="brightnessctl -sd rgb:kbd_backlight set 0";
# timeout=300;
#}
{
on-timeout = "notify-send \"You're idle. Locking in 30 seconds.\"";
timeout = 830;
}
{
on-timeout = "pidof hyprlock && systemctl suspend";
timeout = 120;
}
#{
# on-timeout="loginctl lock-session";
# timeout=360;
#}
{
on-resume = "hyprctl dispatch dpms on";
on-timeout = suspendScript.outPath;
timeout = 900;
}
#{
# 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
# timeout=420;
#}
];
};
};
} }

View file

@ -118,7 +118,7 @@ in {
"$mainMod ALT, L, exec, ${pkgs.hyprlock}/bin/hyprlock" "$mainMod ALT, L, exec, ${pkgs.hyprlock}/bin/hyprlock"
''$mainMod, E, exec, $emacs'' ''$mainMod, E, exec, $emacs''
#''$mainMod SHIFT, E, exec, emacsclient -e "(emacs-everywhere)"'' #''$mainMod SHIFT, E, exec, emacsclient -e "(emacs-everywhere)"''
]; ];
bindm = [ bindm = [
@ -126,17 +126,23 @@ in {
"$mod, mouse:273, resizewindow" "$mod, mouse:273, resizewindow"
]; ];
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;
disable_while_typing = false; #for games disable_while_typing = false; #for games
}; };
}; };
env = [ env = [
@ -159,7 +165,7 @@ in {
cursor = { cursor = {
no_hardware_cursors = true; no_hardware_cursors = true;
inactive_timeout = 10; inactive_timeout = 10;
}; };
general = { general = {
@ -173,8 +179,9 @@ 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 = 0; # Explicit sync breaks asahi driver https://github.com/hyprwm/Hyprland/issues/8158
explicit_sync = 0;
}; };
windowrule = [ windowrule = [
@ -212,9 +219,9 @@ in {
#emacs run launcher #emacs run launcher
"float, title:emacs-run-launcher" "float, title:emacs-run-launcher"
"pin, title:emacs-run-launcher" "pin, title:emacs-run-launcher"
#emacs #emacs
"opaque, class:emacs" "opaque, class:emacs"
]; ];
decoration = { decoration = {

View file

@ -1,18 +1,25 @@
{ 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 = {
general = { general = {
#enable_fingerprint = true; #enable_fingerprint = true;
disable_loading_bar = true; disable_loading_bar = true;
hide_cursor = true; hide_cursor = true;
no_fade_in = false; no_fade_in = false;
grace = 10; grace = 10;
}; };
background = { background = {
blur_passes = 1; blur_passes = 1;
@ -24,14 +31,14 @@ in
vibrancy_darkness = 0.0; vibrancy_darkness = 0.0;
}; };
image = { image = {
path = "${profile-image}"; path = "${profile-image}";
size = 150; size = 150;
border_size = 4; border_size = 4;
#border_color = "rgb(0C96F9)"; #border_color = "rgb(0C96F9)";
rounding = -1; # Negative means circle rounding = -1; # Negative means circle
position = "0, 220"; position = "0, 220";
halign = "center"; halign = "center";
valign = "center"; valign = "center";
}; };
input-field = { input-field = {
size = "600, 100"; size = "600, 100";
@ -51,41 +58,41 @@ in
halign = "center"; halign = "center";
valign = "center"; valign = "center";
}; };
label = [ label =
{ [
text = "$USER"; {
font_family = "Fira Code"; text = "$USER";
font_size = 56; font_family = "Fira Code";
position = "0, 100"; font_size = 56;
halign = "center"; position = "0, 100";
valign = "center"; halign = "center";
} valign = "center";
{ }
text = "$TIME"; {
font_family = "Roboto"; text = "$TIME";
font_size = 72; font_family = "Roboto";
position = "-40, -40"; font_size = 72;
halign = "right"; position = "-40, -40";
valign = "top"; halign = "right";
} valign = "top";
{ }
text = "$LAYOUT"; {
font_family = "JetBrains Mono"; text = "$LAYOUT";
font_size = 28; font_family = "JetBrains Mono";
position = "-20, 20"; font_size = 28;
halign = "right"; position = "-20, 20";
valign = "bottom"; halign = "right";
} 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,70 +1,79 @@
{ 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;
#window#waybar { #window#waybar {
# background: transparent; # background: transparent;
#border-bottom: none; #border-bottom: none;
#} #}
#${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}
* { * {
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"
];
modules-left = [
"hyprland/workspaces"
# "hyprland/window"
]; ];
modules-right = lib.optional hwconfig.isLaptop "backlight" modules-left = [
++ [ "hyprland/workspaces"
"pulseaudio" # "hyprland/window"
#"network"
#"cpu"
"memory"
#"temperature"
"hyprland/language"
] ++ lib.optional battery.available "custom/battery"
++ [
"tray"
"custom/notification"
#"custom/disablehypridle"
"custom/power"
]; ];
modules-right =
lib.optional hwconfig.isLaptop "backlight"
++ [
"pulseaudio"
#"network"
#"cpu"
"memory"
#"temperature"
"hyprland/language"
]
++ lib.optional battery.available "custom/battery"
++ [
"tray"
"custom/notification"
#"custom/disablehypridle"
"custom/power"
];
battery = { battery = {
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;
warning = 20; warning = 20;
}; };
}; };
backlight = { backlight = {
format = "{percent}% 󰛩"; format = "{percent}% 󰛩";
on-scroll-up = "${pkgs.brightnessctl}/bin/brightnessctl s 5%+"; on-scroll-up = "${pkgs.brightnessctl}/bin/brightnessctl s 5%+";
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";
@ -80,12 +89,12 @@ in
tooltip = false; tooltip = false;
}; };
"hyprland/language" = { "hyprland/language" = {
format = " {}"; format = " {}";
};
memory = {
interval = 1;
format = "{used}/{total}Gb ";
}; };
memory = {
interval = 1;
format = "{used}/{total}Gb ";
};
network = { network = {
interval = 1; interval = 1;
format-alt = "{ifname}: {ipaddr}/{cidr}"; format-alt = "{ifname}: {ipaddr}/{cidr}";
@ -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,57 +123,57 @@ 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" = {
disable-scroll = true; disable-scroll = true;
all-outputs = false; all-outputs = false;
warp-on-scroll = true; warp-on-scroll = true;
format = "{name}{icon} "; format = "{name}{icon} ";
format-icons = { format-icons = {
urgent = ""; urgent = "";
active = ""; active = "";
default = ""; default = "";
}; };
#persistent-workspaces = { #persistent-workspaces = {
# "*" = 3; # "*" = 3;
#}; #};
}; };
"custom/power" = { "custom/power" = {
format = " "; format = " ";
tooltip = false; tooltip = false;
#menu = "on-click"; #menu = "on-click";
#menu-file = ./power_menu.xml; #menu-file = ./power_menu.xml;
#menu-actions = { #menu-actions = {
# shutdown = "shutdown -h now"; # shutdown = "shutdown -h now";
# reboot = "reboot"; # reboot = "reboot";
# suspend = "systemctl suspend"; # suspend = "systemctl suspend";
# hibernate = "systemctl hibernate"; # hibernate = "systemctl hibernate";
#}; #};
on-click = "wlogout"; on-click = "wlogout";
}; };
"custom/notification" = { "custom/notification" = {
tooltip = false; tooltip = false;
format = "{icon}"; format = "{icon}";
format-icons = { format-icons = {
notification = " <span foreground='red'><small><sup></sup></small></span>"; notification = " <span foreground='red'><small><sup></sup></small></span>";
none = " "; none = " ";
dnd-notification = " <span foreground='red'><small><sup></sup></small></span>"; dnd-notification = " <span foreground='red'><small><sup></sup></small></span>";
dnd-none = " "; dnd-none = " ";
}; };
return-type = "json"; return-type = "json";
exec-if = "which swaync-client"; exec-if = "which swaync-client";
exec = "swaync-client -swb"; exec = "swaync-client -swb";
on-click = "sleep 0.1 && swaync-client -t -sw"; on-click = "sleep 0.1 && swaync-client -t -sw";
on-click-right = "sleep 0.1 && swaync-client -d -sw"; on-click-right = "sleep 0.1 && swaync-client -d -sw";
escape = true; escape = true;
}; };
"custom/disablehypridle" = { "custom/disablehypridle" = {
@ -184,6 +193,7 @@ in
fi fi
''; '';
}; };
}]; }
];
}; };
} }

View file

@ -1,9 +1,8 @@
{ ... }: {...}: 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,9 +1,8 @@
{ ... }: {...}: {
{ services.xserver.enable = true;
services.xserver.enable = true; services.desktopManager.plasma6.enable = true;
services.desktopManager.plasma6.enable = true;
programs.dconf.enable = true; programs.dconf.enable = true;
#stylix.targets.qt.platform = "qtct"; #stylix.targets.qt.platform = "qtct";
} }

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,12 +1,20 @@
{ 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]; config,
sops.defaultSopsFile = ./secrets/secrets.yaml; pkgs,
sops.defaultSopsFormat = "yaml"; inputs,
sops.age.keyFile = keyPath; lib,
# This will generate a new key if the key specified above does not exist hwconfig,
sops.age.generateKey = true; ...
}: let
keyPath =
if hwconfig.useImpermanence
then "/persist/sops/age/keys.txt"
else "/var/lib/sops/age/keys.txt";
in {
environment.systemPackages = with pkgs; [sops];
sops.defaultSopsFile = ./secrets/secrets.yaml;
sops.defaultSopsFormat = "yaml";
sops.age.keyFile = keyPath;
# This will generate a new key if the key specified above does not exist
sops.age.generateKey = true;
} }

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 = {
@ -15,92 +18,91 @@ in {
}; };
config = lib.mkIf cfg.enable ( config = lib.mkIf cfg.enable (
if hwconfig.system == "aarch64-linux" if hwconfig.system == "aarch64-linux"
then { then {
virtualisation.podman = { virtualisation.podman = {
enable = true; enable = true;
dockerCompat = true; dockerCompat = true;
}; };
environment.systemPackages = with pkgs;[
distrobox
(pkgs.writeShellScriptBin "steam-install" ''
set -e
echo "Проверяем контейнер Steam..."
if [ ! -d "${containerPath}" ]; then
echo "Контейнер не найден, создаем новый с Fedora..."
# Создаём контейнер с Fedora
export PATH=${pkgs.podman}/bin:$PATH
env -u SUDO_USER ${pkgs.distrobox}/bin/distrobox-create --name "${containerName}" --image registry.fedoraproject.org/fedora:latest --home ${containerPath} --hostname ${containerName} --yes
echo "Контейнер ${containerName} создан, устанавливаем Steam..."
# Устанавливаем Steam внутри контейнера
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 copr enable -y @asahi/steam
env -u SUDO_USER ${pkgs.distrobox}/bin/distrobox-enter "${containerName}" -- sudo dnf copr enable -y @asahi/fedora-remix-branding
env -u SUDO_USER ${pkgs.distrobox}/bin/distrobox-enter "${containerName}" -- sudo dnf copr enable -y @asahi/fedora-remix-scripts
env -u SUDO_USER ${pkgs.distrobox}/bin/distrobox-enter "${containerName}" -- sudo dnf copr enable -y @asahi/kernel
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/kernel-edge
env -u SUDO_USER ${pkgs.distrobox}/bin/distrobox-enter "${containerName}" -- sudo dnf copr enable -y @asahi/packit-builds
env -u SUDO_USER ${pkgs.distrobox}/bin/distrobox-enter "${containerName}" -- sudo dnf copr enable -y @asahi/u-boot
env -u SUDO_USER ${pkgs.distrobox}/bin/distrobox-enter "${containerName}" -- sudo dnf copr enable -y @asahi/rawhide-rebuilds
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 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 remove dhcpcd -y
fi
echo "Экспортируем Steam..."
env -u SUDO_USER ${pkgs.distrobox}/bin/distrobox enter "${containerName}" -- distrobox-export --app steam
'')
];
}
else
{
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
unzip distrobox
wget (pkgs.writeShellScriptBin "steam-install" ''
xdotool set -e
xorg.xprop echo "Проверяем контейнер Steam..."
xorg.xrandr
unixtools.xxd if [ ! -d "${containerPath}" ]; then
xorg.xwininfo echo "Контейнер не найден, создаем новый с Fedora..."
yad
protonup-qt # Создаём контейнер с Fedora
protontricks export PATH=${pkgs.podman}/bin:$PATH
bottles env -u SUDO_USER ${pkgs.distrobox}/bin/distrobox-create --name "${containerName}" --image registry.fedoraproject.org/fedora:latest --home ${containerPath} --hostname ${containerName} --yes
echo "Контейнер ${containerName} создан, устанавливаем Steam..."
# Устанавливаем Steam внутри контейнера
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 copr enable -y @asahi/steam
env -u SUDO_USER ${pkgs.distrobox}/bin/distrobox-enter "${containerName}" -- sudo dnf copr enable -y @asahi/fedora-remix-branding
env -u SUDO_USER ${pkgs.distrobox}/bin/distrobox-enter "${containerName}" -- sudo dnf copr enable -y @asahi/fedora-remix-scripts
env -u SUDO_USER ${pkgs.distrobox}/bin/distrobox-enter "${containerName}" -- sudo dnf copr enable -y @asahi/kernel
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/kernel-edge
env -u SUDO_USER ${pkgs.distrobox}/bin/distrobox-enter "${containerName}" -- sudo dnf copr enable -y @asahi/packit-builds
env -u SUDO_USER ${pkgs.distrobox}/bin/distrobox-enter "${containerName}" -- sudo dnf copr enable -y @asahi/u-boot
env -u SUDO_USER ${pkgs.distrobox}/bin/distrobox-enter "${containerName}" -- sudo dnf copr enable -y @asahi/rawhide-rebuilds
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 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 remove dhcpcd -y
fi
echo "Экспортируем Steam..."
env -u SUDO_USER ${pkgs.distrobox}/bin/distrobox enter "${containerName}" -- distrobox-export --app steam
'')
];
}
else {
environment.systemPackages = with pkgs; [
unzip
wget
xdotool
xorg.xprop
xorg.xrandr
unixtools.xxd
xorg.xwininfo
yad
protonup-qt
protontricks
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:
xorg.libXcursor with pkgs; [
xorg.libXi xorg.libXcursor
xorg.libXinerama xorg.libXi
xorg.libXScrnSaver xorg.libXinerama
libpng xorg.libXScrnSaver
libpulseaudio libpng
libvorbis libpulseaudio
sdl3 libvorbis
SDL2 sdl3
stdenv.cc.cc.lib SDL2
libkrb5 stdenv.cc.cc.lib
keyutils libkrb5
gamescope keyutils
]; gamescope
}; ];
};
}; };
programs.gamemode.enable = true; programs.gamemode.enable = true;
} }

View file

@ -1,25 +1,43 @@
{ pkgs, config, lib, hwconfig, inputs, first-nixos-install, ... }:
let username = "andrej";
in
{ {
imports = [ pkgs,
config,
lib,
hwconfig,
inputs,
first-nixos-install,
...
}: let
username = "andrej";
in {
imports = [
];
users.users.${username} = {
isNormalUser = true;
description = "Andrej Lebedev";
extraGroups = ["networkmanager"];
#initialPassword = "1234";
hashedPasswordFile = config.sops.secrets."users/${username}".path;
packages = with pkgs; [
flatpak
]; ];
users.users.${username} = { };
isNormalUser = true; sops.secrets = {
description = "Andrej Lebedev"; "users/${username}" = {
extraGroups = [ "networkmanager" ]; neededForUsers = true;
#initialPassword = "1234";
hashedPasswordFile = config.sops.secrets."users/${username}".path;
packages = with pkgs; [
flatpak
];
};
sops.secrets = {
"users/${username}" = {
neededForUsers = 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,24 +1,41 @@
{ pkgs, config, lib, hwconfig, inputs, first-nixos-install, ... }:
let username = "dima";
in
{ {
imports = [ pkgs,
config,
lib,
hwconfig,
inputs,
first-nixos-install,
...
}: let
username = "dima";
in {
imports = [
];
users.users.${username} = {
isNormalUser = true;
description = "Dima";
extraGroups = ["networkmanager"];
initialPassword = "1234";
#hashedPasswordFile = config.sops.secrets."users/${username}".path;
packages = with pkgs; [
]; ];
users.users.${username} = {
isNormalUser = true;
description = "Dima";
extraGroups = [ "networkmanager" ];
initialPassword = "1234";
#hashedPasswordFile = config.sops.secrets."users/${username}".path;
packages = with pkgs; [
];
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;
}; home-manager.users."${username}" = import ../../home.nix {
programs.ssh.forwardX11 = true; inherit lib;
inherit username;
home-manager.users."${username}" = import ../../home.nix { inherit lib; inherit username; inherit inputs; inherit first-nixos-install; inherit hwconfig; inherit config; inherit pkgs; }; inherit inputs;
systemd.tmpfiles.rules = (if hwconfig.useImpermanence then ["d /persist/home/${username} 0700 ${username} users -"] else []); # /persist/home/<user> created, owned by that user 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,24 +1,42 @@
{ pkgs, config, lib, hwconfig, inputs, first-nixos-install, ... }:
let username = "tania";
in
{ {
imports = [ pkgs,
config,
lib,
hwconfig,
inputs,
first-nixos-install,
...
}: let
username = "tania";
in {
imports = [
];
users.users.${username} = {
isNormalUser = true;
description = "Tetiana";
extraGroups = ["networkmanager"];
#initialPassword = "1234";
hashedPasswordFile = config.sops.secrets."users/${username}".path;
packages = with pkgs; [
]; ];
users.users.${username} = { };
isNormalUser = true; sops.secrets = {
description = "Tetiana"; "users/${username}" = {
extraGroups = [ "networkmanager" ]; neededForUsers = true;
#initialPassword = "1234";
hashedPasswordFile = config.sops.secrets."users/${username}".path;
packages = with pkgs; [
];
};
sops.secrets = {
"users/${username}" = {
neededForUsers = 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

@ -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";
@ -101,57 +101,57 @@
}; };
security.polkit.enable = true; security.polkit.enable = true;
security.rtkit.enable = true; security.rtkit.enable = true;
services.pipewire = { services.pipewire = {
enable = true; enable = true;
alsa.enable = true; alsa.enable = true;
alsa.support32Bit = true; alsa.support32Bit = true;
pulse.enable = true; pulse.enable = true;
jack.enable = true; jack.enable = true;
}; };
programs.bash = { programs.bash = {
shellAliases = { shellAliases = {
ls = "${pkgs.eza}/bin/eza --icons=always"; ls = "${pkgs.eza}/bin/eza --icons=always";
}; };
}; };
# List services that you want to enable: # List services that you want to enable:
# Enable the OpenSSH daemon. # Enable the OpenSSH daemon.
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;
# This value determines the NixOS release from which the default # This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions # settings for stateful data, like file locations and database versions
# on your system were taken. Its perfectly fine and recommended to leave # on your system were taken. Its perfectly fine and recommended to leave
# this value at the release version of the first install of this system. # this value at the release version of the first install of this system.
# Before changing this value read the documentation for this option # Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "24.05"; # Did you read the comment? system.stateVersion = "24.05"; # Did you read the comment?
nix = { nix = {
settings = { settings = {
experimental-features = [ experimental-features = [
"nix-command" "nix-command"
"flakes" "flakes"
]; ];
auto-optimise-store = true; auto-optimise-store = true;
substituters = [ substituters = [
"https://hyprland.cachix.org" "https://hyprland.cachix.org"
"https://nix-gaming.cachix.org" "https://nix-gaming.cachix.org"
"https://nix-community.cachix.org" "https://nix-community.cachix.org"
]; ];
trusted-public-keys = [ trusted-public-keys = [
"hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc=" "hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc="
"nix-gaming.cachix.org-1:nbjlureqMbRAxR1gJ/f3hxemL9svXaZF/Ees8vCUUs4=" "nix-gaming.cachix.org-1:nbjlureqMbRAxR1gJ/f3hxemL9svXaZF/Ees8vCUUs4="
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
]; ];
}; };
}; };
} }