all: format .nix filex with nixfmt-rfc

This commit is contained in:
Asmir A 2025-01-10 18:11:42 +01:00
parent e571ae07c0
commit 77e24e385a
Signed by: asmir
GPG Key ID: 020C42B7A9ABA3E2
22 changed files with 863 additions and 547 deletions

View File

@ -2,7 +2,8 @@
config, config,
pkgs, pkgs,
... ...
}: { }:
{
imports = [ imports = [
]; ];
@ -14,13 +15,16 @@
gc.automatic = true; gc.automatic = true;
gc.options = "--delete-older-than 7d"; gc.options = "--delete-older-than 7d";
package = pkgs.nixVersions.latest; package = pkgs.nixVersions.latest;
settings.experimental-features = ["nix-command" "flakes"]; settings.experimental-features = [
"nix-command"
"flakes"
];
}; };
boot = { boot = {
kernelPackages = pkgs.linuxPackages_latest; kernelPackages = pkgs.linuxPackages_latest;
kernelParams = ["msr.allow_writes=on"]; kernelParams = [ "msr.allow_writes=on" ];
supportedFilesystems = ["btrfs"]; supportedFilesystems = [ "btrfs" ];
tmpOnTmpfs = true; tmpOnTmpfs = true;
initrd.compressor = "zstd"; initrd.compressor = "zstd";
loader.systemd-boot = { loader.systemd-boot = {
@ -39,7 +43,7 @@
doas.enable = true; doas.enable = true;
doas.extraRules = [ doas.extraRules = [
{ {
users = ["akill"]; users = [ "akill" ];
keepEnv = true; keepEnv = true;
persist = true; persist = true;
} }
@ -53,15 +57,16 @@
networking = { networking = {
firewall.enable = true; firewall.enable = true;
hostName = "blue"; hostName = "blue";
nameservers = ["127.0.0.1" "::1"]; nameservers = [
"127.0.0.1"
"::1"
];
dhcpcd.extraConfig = "nohook resolv.conf"; dhcpcd.extraConfig = "nohook resolv.conf";
networkmanager = { networkmanager = {
enable = true; enable = true;
dns = "none"; dns = "none";
/* # wifi.backend = "iwd";
wifi.backend = "iwd";
*/
}; };
}; };
@ -92,8 +97,8 @@
services = { services = {
"caps2esc" = { "caps2esc" = {
description = "Intercepts keyboard udev events"; description = "Intercepts keyboard udev events";
wants = ["systemd-udevd.service"]; wants = [ "systemd-udevd.service" ];
wantedBy = ["multi-user.target"]; wantedBy = [ "multi-user.target" ];
serviceConfig.Nice = -20; serviceConfig.Nice = -20;
script = '' script = ''
${pkgs.interception-tools}/bin/intercept \ ${pkgs.interception-tools}/bin/intercept \
@ -152,7 +157,10 @@
windowManager.i3.enable = true; windowManager.i3.enable = true;
}; };
udev.packages = [pkgs.rtl-sdr pkgs.openhantek6022]; udev.packages = [
pkgs.rtl-sdr
pkgs.openhantek6022
];
tlp = { tlp = {
enable = true; enable = true;
@ -162,32 +170,38 @@
enable = true; enable = true;
bindings = [ bindings = [
{ {
keys = [113]; keys = [ 113 ];
events = ["key"]; events = [ "key" ];
command = "/run/current-system/sw/bin/runuser -l akill -c 'amixer -q set Master toggle'"; command = "/run/current-system/sw/bin/runuser -l akill -c 'amixer -q set Master toggle'";
} }
{ {
keys = [114]; keys = [ 114 ];
events = ["key" "rep"]; events = [
"key"
"rep"
];
command = "/run/current-system/sw/bin/runuser -l akill -c 'amixer -q set Master 5%- unmute'"; command = "/run/current-system/sw/bin/runuser -l akill -c 'amixer -q set Master 5%- unmute'";
} }
{ {
keys = [115]; keys = [ 115 ];
events = ["key" "rep"]; events = [
"key"
"rep"
];
command = "/run/current-system/sw/bin/runuser -l akill -c 'amixer -q set Master 5%+ unmute'"; command = "/run/current-system/sw/bin/runuser -l akill -c 'amixer -q set Master 5%+ unmute'";
} }
{ {
keys = [224]; keys = [ 224 ];
events = ["key"]; events = [ "key" ];
command = "${pkgs.light}/bin/light -U 5"; command = "${pkgs.light}/bin/light -U 5";
} }
{ {
keys = [225]; keys = [ 225 ];
events = ["key"]; events = [ "key" ];
command = "${pkgs.light}/bin/light -A 5"; command = "${pkgs.light}/bin/light -A 5";
} }
]; ];
@ -237,7 +251,7 @@
allowBitmaps = true; allowBitmaps = true;
useEmbeddedBitmaps = true; useEmbeddedBitmaps = true;
defaultFonts = { defaultFonts = {
monospace = ["JetBrainsMono"]; monospace = [ "JetBrainsMono" ];
}; };
}; };
@ -306,6 +320,14 @@
users.users.akill = { users.users.akill = {
isNormalUser = true; isNormalUser = true;
shell = pkgs.zsh; shell = pkgs.zsh;
extraGroups = ["wireshark" "kvm" "tty" "audio" "sound" "adbusers" "dialout"]; extraGroups = [
"wireshark"
"kvm"
"tty"
"audio"
"sound"
"adbusers"
"dialout"
];
}; };
} }

View File

@ -6,47 +6,77 @@
lib, lib,
modulesPath, modulesPath,
... ...
}: { }:
{
imports = [ imports = [
(modulesPath + "/installer/scan/not-detected.nix") (modulesPath + "/installer/scan/not-detected.nix")
]; ];
boot.initrd.availableKernelModules = ["xhci_pci" "ahci" "nvme" "usbhid" "usb_storage" "sd_mod" "sr_mod"]; boot.initrd.availableKernelModules = [
boot.initrd.kernelModules = []; "xhci_pci"
boot.kernelModules = ["kvm-intel"]; "ahci"
boot.extraModulePackages = []; "nvme"
"usbhid"
"usb_storage"
"sd_mod"
"sr_mod"
];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
fileSystems."/" = { fileSystems."/" = {
device = "/dev/disk/by-uuid/0af4dcb9-6e59-4946-87b2-0d2f14b808d4"; device = "/dev/disk/by-uuid/0af4dcb9-6e59-4946-87b2-0d2f14b808d4";
fsType = "btrfs"; fsType = "btrfs";
options = ["subvol=root" "compress=zstd" "noatime"]; options = [
"subvol=root"
"compress=zstd"
"noatime"
];
}; };
boot.initrd.luks.devices."enc_root".device = "/dev/disk/by-uuid/8eb8ac22-d89d-4406-bfbd-ce43e283649f"; boot.initrd.luks.devices."enc_root".device =
"/dev/disk/by-uuid/8eb8ac22-d89d-4406-bfbd-ce43e283649f";
fileSystems."/home" = { fileSystems."/home" = {
device = "/dev/disk/by-uuid/0af4dcb9-6e59-4946-87b2-0d2f14b808d4"; device = "/dev/disk/by-uuid/0af4dcb9-6e59-4946-87b2-0d2f14b808d4";
fsType = "btrfs"; fsType = "btrfs";
options = ["subvol=home" "compress=zstd" "noatime"]; options = [
"subvol=home"
"compress=zstd"
"noatime"
];
}; };
fileSystems."/nix" = { fileSystems."/nix" = {
device = "/dev/disk/by-uuid/0af4dcb9-6e59-4946-87b2-0d2f14b808d4"; device = "/dev/disk/by-uuid/0af4dcb9-6e59-4946-87b2-0d2f14b808d4";
fsType = "btrfs"; fsType = "btrfs";
options = ["subvol=nix" "compress=zstd" "noatime"]; options = [
"subvol=nix"
"compress=zstd"
"noatime"
];
}; };
fileSystems."/var/log" = { fileSystems."/var/log" = {
device = "/dev/disk/by-uuid/0af4dcb9-6e59-4946-87b2-0d2f14b808d4"; device = "/dev/disk/by-uuid/0af4dcb9-6e59-4946-87b2-0d2f14b808d4";
fsType = "btrfs"; fsType = "btrfs";
options = ["subvol=log" "compress=zstd" "noatime"]; options = [
"subvol=log"
"compress=zstd"
"noatime"
];
neededForBoot = true; neededForBoot = true;
}; };
fileSystems."/persist" = { fileSystems."/persist" = {
device = "/dev/disk/by-uuid/0af4dcb9-6e59-4946-87b2-0d2f14b808d4"; device = "/dev/disk/by-uuid/0af4dcb9-6e59-4946-87b2-0d2f14b808d4";
fsType = "btrfs"; fsType = "btrfs";
options = ["subvol=persist" "compress=zstd" "noatime"]; options = [
"subvol=persist"
"compress=zstd"
"noatime"
];
}; };
fileSystems."/boot" = { fileSystems."/boot" = {
@ -54,7 +84,7 @@
fsType = "vfat"; fsType = "vfat";
}; };
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

@ -3,8 +3,10 @@
nix-xilinx, nix-xilinx,
system, system,
... ...
}: { }:
environment.systemPackages = with pkgs; {
environment.systemPackages =
with pkgs;
[ [
acpi acpi
binutils binutils
@ -92,5 +94,11 @@
zip zip
z-lua z-lua
] ]
++ (with nix-xilinx.packages.${system}; [vivado vitis vitis_hls model_composer xilinx-shell]); ++ (with nix-xilinx.packages.${system}; [
vivado
vitis
vitis_hls
model_composer
xilinx-shell
]);
} }

View File

@ -4,9 +4,11 @@
pkgs, pkgs,
... ...
}: }:
with lib; let with lib;
let
cfg = config.services.batteryNotifier; cfg = config.services.batteryNotifier;
in { in
{
options = { options = {
services.batteryNotifier = { services.batteryNotifier = {
enable = mkOption { enable = mkOption {
@ -42,7 +44,7 @@ in {
timerConfig.OnBootSec = "1m"; timerConfig.OnBootSec = "1m";
timerConfig.OnUnitInactiveSec = "1m"; timerConfig.OnUnitInactiveSec = "1m";
timerConfig.Unit = "lowbatt.service"; timerConfig.Unit = "lowbatt.service";
wantedBy = ["timers.target"]; wantedBy = [ "timers.target" ];
}; };
systemd.user.services."lowbatt" = { systemd.user.services."lowbatt" = {
description = "battery level notifier"; description = "battery level notifier";

247
flake.nix
View File

@ -50,130 +50,137 @@
}; };
}; };
outputs = inputs @ { outputs =
home-manager, inputs@{
nixpkgs, home-manager,
nix-xilinx, nixpkgs,
nvim, nix-xilinx,
peerix, nvim,
project-cloud, peerix,
simple-nixos-mailserver, project-cloud,
sops-nix, simple-nixos-mailserver,
swaysw, sops-nix,
zremap, swaysw,
... zremap,
}: let ...
pkgs = nixpkgs.legacyPackages.x86_64-linux.pkgs; }:
in { let
nixosConfigurations = rec { pkgs = nixpkgs.legacyPackages.x86_64-linux.pkgs;
nixy = nixpkgs.lib.nixosSystem rec { in
system = "x86_64-linux"; {
modules = [ nixosConfigurations = rec {
{_module.args = inputs;} nixy = nixpkgs.lib.nixosSystem rec {
{_module.args.system = system;} system = "x86_64-linux";
{nix.registry.nixpkgs.flake = nixpkgs;} modules = [
./common/packages.nix { _module.args = inputs; }
./common/suspend.nix { _module.args.system = system; }
./nixy/configuration.nix { nix.registry.nixpkgs.flake = nixpkgs; }
./nixy/hardware-configuration.nix ./common/packages.nix
sops-nix.nixosModules.sops ./common/suspend.nix
home-manager.nixosModules.home-manager ./nixy/configuration.nix
{ ./nixy/hardware-configuration.nix
home-manager.useGlobalPkgs = true; sops-nix.nixosModules.sops
home-manager.useUserPackages = true; home-manager.nixosModules.home-manager
home-manager.users.akill = import ./home/home.nix; {
home-manager.extraSpecialArgs = {inherit inputs system;}; home-manager.useGlobalPkgs = true;
home-manager.backupFileExtension = "home_backup"; home-manager.useUserPackages = true;
} home-manager.users.akill = import ./home/home.nix;
peerix.nixosModules.peerix home-manager.extraSpecialArgs = { inherit inputs system; };
{ home-manager.backupFileExtension = "home_backup";
services.peerix = { }
enable = true; peerix.nixosModules.peerix
globalCacheTTL = 10; {
package = peerix.packages.x86_64-linux.peerix; services.peerix = {
openFirewall = true; # UDP/12304 enable = true;
privateKeyFile = nixy.config.sops.secrets."peerix/private".path; globalCacheTTL = 10;
publicKeyFile = ./nixy/peerix-public; package = peerix.packages.x86_64-linux.peerix;
publicKey = "peerix-mediabox:UDgG3xdQYv7bmx2l4ZPNRPJtp2zMmY++H/fnGeJ9BQw="; openFirewall = true; # UDP/12304
}; privateKeyFile = nixy.config.sops.secrets."peerix/private".path;
} publicKeyFile = ./nixy/peerix-public;
]; publicKey = "peerix-mediabox:UDgG3xdQYv7bmx2l4ZPNRPJtp2zMmY++H/fnGeJ9BQw=";
};
}
];
};
mediabox = nixpkgs.lib.nixosSystem rec {
system = "x86_64-linux";
modules = [
{ _module.args = inputs; }
{ _module.args.system = system; }
{ nix.registry.nixpkgs.flake = nixpkgs; }
./common/packages.nix
./common/suspend.nix
./mediabox/configuration.nix
./mediabox/hardware-configuration.nix
./modules/qbittorrent.nix
sops-nix.nixosModules.sops
home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.akill = import ./home/home.nix;
home-manager.extraSpecialArgs = { inherit inputs system; };
}
peerix.nixosModules.peerix
{
services.peerix = {
enable = true;
globalCacheTTL = 10;
package = peerix.packages.x86_64-linux.peerix;
openFirewall = true; # UDP/12304
privateKeyFile = mediabox.config.sops.secrets."peerix/private".path;
publicKeyFile = ./mediabox/peerix-public;
publicKey = "peerix-nixy:8THqS0R2zWF/47ai0RFmqJnieYTZ1jaWOD9tnzpvA6s=";
};
}
];
};
blue = nixpkgs.lib.nixosSystem rec {
system = "x86_64-linux";
modules = [
{ _module.args = inputs; }
{ _module.args.system = system; }
{ nix.registry.nixpkgs.flake = nixpkgs; }
./blue/configuration.nix
./blue/hardware-configuration.nix
./common/packages.nix
home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.akill = import ./home/home.nix;
home-manager.extraSpecialArgs = { inherit inputs system; };
}
];
};
magpie = nixpkgs.lib.nixosSystem rec {
system = "aarch64-linux";
modules = [
{ _module.args = inputs; }
{ _module.args.system = system; }
{ nix.registry.nixpkgs.flake = nixpkgs; }
./magpie/configuration.nix
./magpie/hardware-configuration.nix
simple-nixos-mailserver.nixosModule
sops-nix.nixosModules.sops
(builtins.toPath "${nixpkgs}/nixos/modules/profiles/qemu-guest.nix")
];
};
}; };
mediabox = nixpkgs.lib.nixosSystem rec { devShell.x86_64-linux = pkgs.mkShell {
system = "x86_64-linux"; buildInputs = with pkgs; [
modules = [ sops
{_module.args = inputs;} ssh-to-age
{_module.args.system = system;} age
{nix.registry.nixpkgs.flake = nixpkgs;}
./common/packages.nix
./common/suspend.nix
./mediabox/configuration.nix
./mediabox/hardware-configuration.nix
./modules/qbittorrent.nix
sops-nix.nixosModules.sops
home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.akill = import ./home/home.nix;
home-manager.extraSpecialArgs = {inherit inputs system;};
}
peerix.nixosModules.peerix
{
services.peerix = {
enable = true;
globalCacheTTL = 10;
package = peerix.packages.x86_64-linux.peerix;
openFirewall = true; # UDP/12304
privateKeyFile = mediabox.config.sops.secrets."peerix/private".path;
publicKeyFile = ./mediabox/peerix-public;
publicKey = "peerix-nixy:8THqS0R2zWF/47ai0RFmqJnieYTZ1jaWOD9tnzpvA6s=";
};
}
]; ];
shellHook = ''
echo "Configuring NixOS!"
'';
}; };
blue = nixpkgs.lib.nixosSystem rec { formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.alejandra;
system = "x86_64-linux";
modules = [
{_module.args = inputs;}
{_module.args.system = system;}
{nix.registry.nixpkgs.flake = nixpkgs;}
./blue/configuration.nix
./blue/hardware-configuration.nix
./common/packages.nix
home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.akill = import ./home/home.nix;
home-manager.extraSpecialArgs = {inherit inputs system;};
}
];
};
magpie = nixpkgs.lib.nixosSystem rec {
system = "aarch64-linux";
modules = [
{_module.args = inputs;}
{_module.args.system = system;}
{nix.registry.nixpkgs.flake = nixpkgs;}
./magpie/configuration.nix
./magpie/hardware-configuration.nix
simple-nixos-mailserver.nixosModule
sops-nix.nixosModules.sops
(builtins.toPath "${nixpkgs}/nixos/modules/profiles/qemu-guest.nix")
];
};
}; };
devShell.x86_64-linux = pkgs.mkShell {
buildInputs = with pkgs; [sops ssh-to-age age];
shellHook = ''
echo "Configuring NixOS!"
'';
};
formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.alejandra;
};
} }

View File

@ -2,12 +2,21 @@
lib, lib,
pkgs, pkgs,
... ...
}: let }:
let
qutebrowser_firejail = pkgs.writeShellScriptBin "qutebrowser" '' qutebrowser_firejail = pkgs.writeShellScriptBin "qutebrowser" ''
firejail -- ${lib.getExe pkgs.qutebrowser} "$@" firejail -- ${lib.getExe pkgs.qutebrowser} "$@"
''; '';
in { in
imports = [./zsh.nix ./i3status-rust.nix ./sway.nix ./i3.nix ./home_packages.nix ./whatsapp-for-linux.nix]; {
imports = [
./zsh.nix
./i3status-rust.nix
./sway.nix
./i3.nix
./home_packages.nix
./whatsapp-for-linux.nix
];
home.stateVersion = "22.11"; home.stateVersion = "22.11";
home.username = "akill"; home.username = "akill";
@ -41,7 +50,9 @@ in {
WLR_RENDERER = "vulkan"; WLR_RENDERER = "vulkan";
}; };
wayland.windowManager.sway = {enable = true;}; wayland.windowManager.sway = {
enable = true;
};
programs = { programs = {
home-manager.enable = true; home-manager.enable = true;
@ -60,7 +71,11 @@ in {
clock24 = true; clock24 = true;
keyMode = "vi"; keyMode = "vi";
terminal = "screen-256color"; terminal = "screen-256color";
plugins = with pkgs.tmuxPlugins; [sysstat net-speed gruvbox]; plugins = with pkgs.tmuxPlugins; [
sysstat
net-speed
gruvbox
];
}; };
mpv = { mpv = {
@ -137,7 +152,9 @@ in {
font = "JetBrainsMono:size=10"; font = "JetBrainsMono:size=10";
dpi-aware = "yes"; dpi-aware = "yes";
}; };
mouse = {hide-when-typing = "yes";}; mouse = {
hide-when-typing = "yes";
};
}; };
}; };
@ -183,8 +200,12 @@ in {
userEmail = "asmir.abdulahovic@gmail.com"; userEmail = "asmir.abdulahovic@gmail.com";
extraConfig = { extraConfig = {
init.defaultBranch = "master"; init.defaultBranch = "master";
pull = {rebase = true;}; pull = {
credential = {helper = "store";}; rebase = true;
};
credential = {
helper = "store";
};
}; };
signing.key = "020C42B7A9ABA3E2"; signing.key = "020C42B7A9ABA3E2";
signing.signByDefault = true; signing.signByDefault = true;
@ -192,7 +213,14 @@ in {
obs-studio = { obs-studio = {
enable = true; enable = true;
plugins = with pkgs.obs-studio-plugins; [obs-vkcapture input-overlay obs-multi-rtmp obs-pipewire-audio-capture wlrobs obs-vaapi]; plugins = with pkgs.obs-studio-plugins; [
obs-vkcapture
input-overlay
obs-multi-rtmp
obs-pipewire-audio-capture
wlrobs
obs-vaapi
];
}; };
i3status-rust.enable = true; i3status-rust.enable = true;
@ -220,36 +248,38 @@ in {
enableSshSupport = true; enableSshSupport = true;
}; };
swayidle = let swayidle =
locker = pkgs.writeShellScriptBin "swaylock_fancy" '' let
TMP_FILE=$(${pkgs.coreutils}/bin/mktemp /tmp/.swaylock_ss_XXXXXX.jpg) locker = pkgs.writeShellScriptBin "swaylock_fancy" ''
${lib.getExe pkgs.grim} -t ppm - | ${pkgs.imagemagick}/bin/convert - -blur 0x12 "$TMP_FILE" TMP_FILE=$(${pkgs.coreutils}/bin/mktemp /tmp/.swaylock_ss_XXXXXX.jpg)
${lib.getExe pkgs.swaylock} -f -i "$TMP_FILE" ${lib.getExe pkgs.grim} -t ppm - | ${pkgs.imagemagick}/bin/convert - -blur 0x12 "$TMP_FILE"
${pkgs.coreutils}/bin/rm "$TMP_FILE" ${lib.getExe pkgs.swaylock} -f -i "$TMP_FILE"
''; ${pkgs.coreutils}/bin/rm "$TMP_FILE"
in { '';
enable = true; in
events = [ {
{ enable = true;
event = "before-sleep"; events = [
command = "${locker}/bin/swaylock_fancy"; {
} event = "before-sleep";
{ command = "${locker}/bin/swaylock_fancy";
event = "lock"; }
command = "${locker}/bin/swaylock_fancy"; {
} event = "lock";
{ command = "${locker}/bin/swaylock_fancy";
event = "after-resume"; }
command = "${pkgs.procps}/bin/pkill -USR1 i3status-rs"; {
} event = "after-resume";
]; command = "${pkgs.procps}/bin/pkill -USR1 i3status-rs";
timeouts = [ }
{ ];
timeout = 15 * 60; timeouts = [
command = "${locker}/bin/swaylock_fancy"; {
} timeout = 15 * 60;
]; command = "${locker}/bin/swaylock_fancy";
}; }
];
};
kanshi = { kanshi = {
enable = true; enable = true;
@ -286,17 +316,17 @@ in {
systemd.user = { systemd.user = {
services = { services = {
/* /*
himalaya = { himalaya = {
Unit.Description = "Himalaya new messages notifier"; Unit.Description = "Himalaya new messages notifier";
Service = { Service = {
ExecStart = "himalaya notify"; ExecStart = "himalaya notify";
Restart = "always"; Restart = "always";
RestartSec = 10; RestartSec = 10;
}; };
Install = { Install = {
WantedBy = [ "multi-user.target" ]; WantedBy = [ "multi-user.target" ];
}; };
}; };
*/ */
}; };
}; };

View File

@ -4,7 +4,8 @@
inputs, inputs,
system, system,
... ...
}: let }:
let
chromium_teams = pkgs.writeShellScriptBin "chromium_teams" '' chromium_teams = pkgs.writeShellScriptBin "chromium_teams" ''
${lib.getExe pkgs.ungoogled-chromium} --socket=wayland org.chromium.Chromium --app=https://teams.microsoft.com/ ${lib.getExe pkgs.ungoogled-chromium} --socket=wayland org.chromium.Chromium --app=https://teams.microsoft.com/
''; '';
@ -25,9 +26,10 @@
PROXY_PORT="1337" PROXY_PORT="1337"
${lib.getExe pkgs.openssh} -D "$PROXY_PORT" -q -N "$@" ${lib.getExe pkgs.openssh} -D "$PROXY_PORT" -q -N "$@"
''; '';
wrap_sh = let wrap_sh =
bubblewrap = pkgs.callPackage ../packages/bubblewrap/default.nix {}; let
in bubblewrap = pkgs.callPackage ../packages/bubblewrap/default.nix { };
in
pkgs.writeShellScriptBin "wrap.sh" '' pkgs.writeShellScriptBin "wrap.sh" ''
if ${pkgs.coreutils-full}/bin/test $# -ne 1; then if ${pkgs.coreutils-full}/bin/test $# -ne 1; then
echo "Usage: $0 <directory>" echo "Usage: $0 <directory>"
@ -41,8 +43,10 @@
--tmp-overlay "$FULL_PATH" \ --tmp-overlay "$FULL_PATH" \
"$SHELL" "$SHELL"
''; '';
in { in
home.packages = with pkgs; {
home.packages =
with pkgs;
[ [
anydesk anydesk
appimage-run appimage-run
@ -57,7 +61,7 @@ in {
ungoogled-chromium ungoogled-chromium
cmake cmake
compsize compsize
/*cura*/ # cura
deluge deluge
dfu-util dfu-util
discord discord
@ -153,7 +157,7 @@ in {
yt-dlp yt-dlp
zapzap zapzap
zathura zathura
/*zeal-qt6*/ # zeal-qt6
zig zig
] ]
++ [ ++ [
@ -166,7 +170,7 @@ in {
] ]
++ [ ++ [
inputs.swaysw.packages.${system}.swaysw inputs.swaysw.packages.${system}.swaysw
(pkgs.callPackage ../packages/viber/default.nix {}) (pkgs.callPackage ../packages/viber/default.nix { })
(pkgs.callPackage ../packages/bubblewrap/default.nix {}) (pkgs.callPackage ../packages/bubblewrap/default.nix { })
]; ];
} }

View File

@ -2,9 +2,11 @@
lib, lib,
pkgs, pkgs,
... ...
}: let }:
let
scratchpad_cmd = "floating enable, resize set 1502 845, move position center, move scratchpad, scratchpad show"; scratchpad_cmd = "floating enable, resize set 1502 845, move position center, move scratchpad, scratchpad show";
in { in
{
xsession.windowManager.i3 = { xsession.windowManager.i3 = {
enable = true; enable = true;
package = pkgs.i3; package = pkgs.i3;
@ -53,24 +55,28 @@ in {
"${modifier}+Escape" = "workspace back_and_forth"; "${modifier}+Escape" = "workspace back_and_forth";
"${modifier}+p" = "exec ${pkgs.dmenu}/bin/dmenu_run"; "${modifier}+p" = "exec ${pkgs.dmenu}/bin/dmenu_run";
"Mod4+l" = "exec i3-msg [instance=\"python3_scr\"] scratchpad show || exec alacritty --class python3_scr -e python3"; "Mod4+l" =
"exec i3-msg [instance=\"python3_scr\"] scratchpad show || exec alacritty --class python3_scr -e python3";
"Mod4+j" = "exec i3-msg [class=\"ViberPC\"] scratchpad show || exec viber"; "Mod4+j" = "exec i3-msg [class=\"ViberPC\"] scratchpad show || exec viber";
"Mod4+m" = "exec i3-msg [class=\"Thunderbird\"] scratchpad show || exec thunderbird"; "Mod4+m" = "exec i3-msg [class=\"Thunderbird\"] scratchpad show || exec thunderbird";
"Mod4+y" = "exec i3-msg [instance=\"pulsemixer_scr\"] scratchpad show || exec alacritty --class pulsemixer_scr -e pulsemixer"; "Mod4+y" =
"exec i3-msg [instance=\"pulsemixer_scr\"] scratchpad show || exec alacritty --class pulsemixer_scr -e pulsemixer";
}; };
window = { window = {
/* # border = 4;
border = 4;
*/
commands = [ commands = [
{ {
command = scratchpad_cmd; command = scratchpad_cmd;
criteria = {instance = "pulsemixer_scr|python3_scr";}; criteria = {
instance = "pulsemixer_scr|python3_scr";
};
} }
{ {
command = scratchpad_cmd; command = scratchpad_cmd;
criteria = {class = "Thunderbird";}; criteria = {
class = "Thunderbird";
};
} }
{ {
command = scratchpad_cmd; command = scratchpad_cmd;
@ -81,7 +87,9 @@ in {
} }
{ {
command = "focus child, layout tabbed, focus"; command = "focus child, layout tabbed, focus";
criteria = {class = "qutebrowser";}; criteria = {
class = "qutebrowser";
};
} }
]; ];
}; };
@ -90,7 +98,10 @@ in {
{ {
position = "top"; position = "top";
fonts = { fonts = {
names = ["DejaVu Sans Mono" "FontAwesome5Free"]; names = [
"DejaVu Sans Mono"
"FontAwesome5Free"
];
style = "Fixed Bold SemiCondensed"; style = "Fixed Bold SemiCondensed";
size = 7.0; size = 7.0;
}; };

View File

@ -1,4 +1,5 @@
{...}: { { ... }:
{
programs.i3status-rust = { programs.i3status-rust = {
bars.top = { bars.top = {
icons = "awesome5"; icons = "awesome5";

View File

@ -4,7 +4,8 @@
system, system,
lib, lib,
... ...
}: let }:
let
cliphist_sway = pkgs.writeShellScriptBin "cliphist_sway" '' cliphist_sway = pkgs.writeShellScriptBin "cliphist_sway" ''
${lib.getExe pkgs.cliphist} list | \ ${lib.getExe pkgs.cliphist} list | \
${lib.getExe pkgs.wofi} --dmenu --insensitive | \ ${lib.getExe pkgs.wofi} --dmenu --insensitive | \
@ -16,9 +17,10 @@
${lib.getExe pkgs.grim} -g "$GEOM" - | ${pkgs.wl-clipboard}/bin/wl-copy ${lib.getExe pkgs.grim} -g "$GEOM" - | ${pkgs.wl-clipboard}/bin/wl-copy
''; '';
swaysw = inputs.swaysw.packages.${system}.swaysw; swaysw = inputs.swaysw.packages.${system}.swaysw;
viber = pkgs.callPackage ../packages/viber/default.nix {}; viber = pkgs.callPackage ../packages/viber/default.nix { };
term = "${pkgs.foot}/bin/footclient"; term = "${pkgs.foot}/bin/footclient";
in { in
{
wayland.windowManager.sway = { wayland.windowManager.sway = {
enable = true; enable = true;
extraSessionCommands = ""; extraSessionCommands = "";
@ -26,7 +28,7 @@ in {
config = { config = {
fonts = { fonts = {
names = ["JetBrainsMono"]; names = [ "JetBrainsMono" ];
style = "Bold Semi-Condensed"; style = "Bold Semi-Condensed";
size = 11.0; size = 11.0;
}; };
@ -34,15 +36,21 @@ in {
window.commands = [ window.commands = [
{ {
command = "move scratchpad, resize set 1152 648"; command = "move scratchpad, resize set 1152 648";
criteria = {app_id = "pulsemixer|python3|com.rtosta.zapzap|whatsapp-for-linux|com.viber";}; criteria = {
app_id = "pulsemixer|python3|com.rtosta.zapzap|whatsapp-for-linux|com.viber";
};
} }
{ {
command = "move scratchpad, resize set 1502 845"; command = "move scratchpad, resize set 1502 845";
criteria = {app_id = "com.viber";}; criteria = {
app_id = "com.viber";
};
} }
{ {
command = "floating enable"; command = "floating enable";
criteria = {app_id = "sws_cli";}; criteria = {
app_id = "sws_cli";
};
} }
]; ];
@ -50,8 +58,8 @@ in {
output = { output = {
eDP-1 = { eDP-1 = {
/* /*
bg = "~/pic/wallpaper stretch"; bg = "~/pic/wallpaper stretch";
scale = "1.4"; scale = "1.4";
*/ */
}; };
@ -61,16 +69,25 @@ in {
}; };
input = { input = {
"type:keyboard" = {repeat_delay = "150";}; "type:keyboard" = {
"type:keyboard" = {repeat_rate = "70";}; repeat_delay = "150";
"type:touchpad" = {tap = "enabled";}; };
"type:keyboard" = {
repeat_rate = "70";
};
"type:touchpad" = {
tap = "enabled";
};
}; };
bars = [ bars = [
{ {
position = "top"; position = "top";
fonts = { fonts = {
names = ["Iosevka" "FontAwesome"]; names = [
"Iosevka"
"FontAwesome"
];
style = "Bold Semi-Condensed"; style = "Bold Semi-Condensed";
size = 12.0; size = 12.0;
}; };
@ -124,12 +141,14 @@ in {
"Alt+bracketright" = "focus output right"; "Alt+bracketright" = "focus output right";
"Alt+bracketleft" = "focus output left"; "Alt+bracketleft" = "focus output left";
"Mod4+l" = '' "Mod4+l" =
exec ${pkgs.sway}/bin/swaymsg [app_id="python3"] scratchpad show || exec ${term} -a python3 ${lib.getExe pkgs.python3}''; ''exec ${pkgs.sway}/bin/swaymsg [app_id="python3"] scratchpad show || exec ${term} -a python3 ${lib.getExe pkgs.python3}'';
"Mod4+j" = "exec ${pkgs.sway}/bin/swaymsg [app_id=com.rtosta.zapzap] scratchpad show || exec ${lib.getExe pkgs.zapzap}"; "Mod4+j" =
"Mod4+h" = "exec ${pkgs.sway}/bin/swaymsg [app_id=com.viber] scratchpad show || exec ${viber}/bin/viber"; "exec ${pkgs.sway}/bin/swaymsg [app_id=com.rtosta.zapzap] scratchpad show || exec ${lib.getExe pkgs.zapzap}";
"Mod4+y" = '' "Mod4+h" =
exec ${pkgs.sway}/bin/swaymsg [app_id="pulsemixer"] scratchpad show || exec ${term} -a pulsemixer ${lib.getExe pkgs.pulsemixer}''; "exec ${pkgs.sway}/bin/swaymsg [app_id=com.viber] scratchpad show || exec ${viber}/bin/viber";
"Mod4+y" =
''exec ${pkgs.sway}/bin/swaymsg [app_id="pulsemixer"] scratchpad show || exec ${term} -a pulsemixer ${lib.getExe pkgs.pulsemixer}'';
"Mod4+p" = "exec ${lib.getExe pkgs.tessen} -a copy"; "Mod4+p" = "exec ${lib.getExe pkgs.tessen} -a copy";
}; };
}; };

View File

@ -1,7 +1,8 @@
{lib, ...}: { lib, ... }:
with lib; { with lib;
{
xdg.configFile."whatsapp-for-linux/settings.conf".source = builtins.toFile "settings.conf" ( xdg.configFile."whatsapp-for-linux/settings.conf".source = builtins.toFile "settings.conf" (
generators.toINI {} { generators.toINI { } {
General = { General = {
zoom_level = 1; zoom_level = 1;
close_to_tray = false; close_to_tray = false;

View File

@ -1,4 +1,5 @@
{pkgs, ...}: { { pkgs, ... }:
{
programs.z-lua = { programs.z-lua = {
enableAliases = true; enableAliases = true;
enableZshIntegration = true; enableZshIntegration = true;
@ -63,45 +64,45 @@
file = "sudo.plugin.zsh"; file = "sudo.plugin.zsh";
} }
{ {
name = "zsh-fast-syntax-highlighting"; name = "zsh-fast-syntax-highlighting";
src = pkgs.zsh-fast-syntax-highlighting; src = pkgs.zsh-fast-syntax-highlighting;
file = "share/zsh/site-functions/fast-syntax-highlighting.plugin.zsh"; file = "share/zsh/site-functions/fast-syntax-highlighting.plugin.zsh";
} }
]; ];
envExtra = ''''; envExtra = '''';
initExtra = '' initExtra = ''
# binds # binds
bindkey '^K' fzf-file-widget bindkey '^K' fzf-file-widget
# options # options
setopt nobeep setopt nobeep
setopt nopromptcr setopt nopromptcr
setopt c_bases setopt c_bases
setopt completeinword setopt completeinword
setopt completealiases setopt completealiases
setopt notify setopt notify
# #
RPS1="" RPS1=""
# #
function chpwd() { function chpwd() {
ls; ls;
} }
eval "$(direnv hook zsh)" eval "$(direnv hook zsh)"
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Za-z}' zstyle ':completion:*' matcher-list 'm:{a-z}={A-Za-z}'
if [[ -n "$PS1" ]] && [[ -z "$TMUX" ]] && [[ -n "$SSH_CONNECTION" ]]; then if [[ -n "$PS1" ]] && [[ -z "$TMUX" ]] && [[ -n "$SSH_CONNECTION" ]]; then
TMUX_EXE="${pkgs.tmux}/bin/tmux" TMUX_EXE="${pkgs.tmux}/bin/tmux"
systemd-run --scope --user $TMUX_EXE attach-session -t $USER || systemd-run --scope --user $TMUX_EXE new-session -s $USER systemd-run --scope --user $TMUX_EXE attach-session -t $USER || systemd-run --scope --user $TMUX_EXE new-session -s $USER
fi fi
if [[ -n "$BUBBLEWRAP_DIR" ]]; then if [[ -n "$BUBBLEWRAP_DIR" ]]; then
RPS1="{{$BUBBLEWRAP_DIR}}" RPS1="{{$BUBBLEWRAP_DIR}}"
fi fi
''; '';
}; };
} }

View File

@ -6,11 +6,15 @@
nvim, nvim,
system, system,
... ...
}: { }:
imports = []; {
imports = [ ];
nix.optimise.automatic = true; nix.optimise.automatic = true;
nix.settings.experimental-features = ["nix-command" "flakes"]; nix.settings.experimental-features = [
"nix-command"
"flakes"
];
system.switch = { system.switch = {
enable = false; enable = false;
enableNg = true; enableNg = true;
@ -21,7 +25,10 @@
boot.loader.systemd-boot.configurationLimit = 2; boot.loader.systemd-boot.configurationLimit = 2;
boot.loader.efi.canTouchEfiVariables = true; boot.loader.efi.canTouchEfiVariables = true;
boot.kernelPackages = pkgs.linuxPackages_latest; boot.kernelPackages = pkgs.linuxPackages_latest;
boot.kernelParams = ["ip=dhcp" "console=tty"]; boot.kernelParams = [
"ip=dhcp"
"console=tty"
];
boot.kernel.sysctl = { boot.kernel.sysctl = {
"net.core.default_qdisc" = "fq"; "net.core.default_qdisc" = "fq";
"net.ipv4.tcp_congestion_control" = "bbr"; "net.ipv4.tcp_congestion_control" = "bbr";
@ -29,14 +36,17 @@
boot.initrd = { boot.initrd = {
compressor = "zstd"; compressor = "zstd";
availableKernelModules = ["virtio-pci" "virtio-gpu"]; availableKernelModules = [
"virtio-pci"
"virtio-gpu"
];
systemd.enable = true; systemd.enable = true;
network = { network = {
enable = true; enable = true;
ssh = { ssh = {
enable = true; enable = true;
hostKeys = [/etc/ssh_dummy_ed25519_key]; hostKeys = [ /etc/ssh_dummy_ed25519_key ];
authorizedKeyFiles = [../nixy/ssh_pubkey]; authorizedKeyFiles = [ ../nixy/ssh_pubkey ];
}; };
}; };
}; };
@ -74,7 +84,7 @@
enable = true; enable = true;
debug = false; debug = false;
fqdn = "mail.project-cloud.net"; fqdn = "mail.project-cloud.net";
domains = ["project-cloud.net"]; domains = [ "project-cloud.net" ];
enableSubmissionSsl = true; enableSubmissionSsl = true;
enableImap = false; enableImap = false;
enableImapSsl = true; enableImapSsl = true;
@ -84,11 +94,11 @@
loginAccounts = { loginAccounts = {
"gitea@project-cloud.net" = { "gitea@project-cloud.net" = {
hashedPasswordFile = config.sops.secrets."gitea_mail_pw_hash".path; hashedPasswordFile = config.sops.secrets."gitea_mail_pw_hash".path;
aliases = ["git@project-cloud.net"]; aliases = [ "git@project-cloud.net" ];
}; };
"asmir@project-cloud.net" = { "asmir@project-cloud.net" = {
hashedPasswordFile = config.sops.secrets."asmir_mail_pw_hash".path; hashedPasswordFile = config.sops.secrets."asmir_mail_pw_hash".path;
aliases = ["asmir.abdulahovic@project-cloud.net"]; aliases = [ "asmir.abdulahovic@project-cloud.net" ];
}; };
}; };
certificateScheme = "acme-nginx"; certificateScheme = "acme-nginx";
@ -170,12 +180,12 @@
}; };
/* /*
virtualHosts.${config.services.nextcloud.hostName} = { virtualHosts.${config.services.nextcloud.hostName} = {
quic = true; quic = true;
http3 = true; http3 = true;
forceSSL = true; forceSSL = true;
enableACME = true; enableACME = true;
}; };
*/ */
virtualHosts."miniflux.project-cloud.net" = { virtualHosts."miniflux.project-cloud.net" = {
@ -236,15 +246,21 @@
REGISTER_EMAIL_CONFIRM = true; REGISTER_EMAIL_CONFIRM = true;
}; };
settings."markup.restructuredtext" = let settings."markup.restructuredtext" =
docutils = let
pkgs.python3.withPackages (ps: with ps; [docutils pygments]); docutils = pkgs.python3.withPackages (
in { ps: with ps; [
ENABLED = true; docutils
FILE_EXTENSIONS = ".rst"; pygments
RENDER_COMMAND = "${docutils}/bin/rst2html.py"; ]
IS_INPUT_FILE = false; );
}; in
{
ENABLED = true;
FILE_EXTENSIONS = ".rst";
RENDER_COMMAND = "${docutils}/bin/rst2html.py";
IS_INPUT_FILE = false;
};
}; };
services.nfs.server.enable = false; services.nfs.server.enable = false;
@ -262,7 +278,7 @@
paths = [ paths = [
"/var/lib/gitea" "/var/lib/gitea"
]; ];
exclude = []; exclude = [ ];
repo = "ssh://na9fqv67@na9fqv67.repo.borgbase.com/./repo"; repo = "ssh://na9fqv67@na9fqv67.repo.borgbase.com/./repo";
encryption = { encryption = {
mode = "repokey-blake2"; mode = "repokey-blake2";
@ -279,12 +295,10 @@
adminEmail = "asmir.abdulahovic" + "@" + "gmail.com"; adminEmail = "asmir.abdulahovic" + "@" + "gmail.com";
}; };
/* # needed for sendmail mail functionality
needed for sendmail mail functionality users.users.gitea.extraGroups = [ "postdrop" ];
*/
users.users.gitea.extraGroups = ["postdrop"];
systemd.services.gitea.serviceConfig = { systemd.services.gitea.serviceConfig = {
RestrictAddressFamilies = ["AF_NETLINK"]; RestrictAddressFamilies = [ "AF_NETLINK" ];
ProtectSystem = lib.mkForce false; ProtectSystem = lib.mkForce false;
}; };
@ -294,7 +308,7 @@
}; };
sops = { sops = {
age.sshKeyPaths = ["/etc/ssh/ssh_host_ed25519_key"]; age.sshKeyPaths = [ "/etc/ssh/ssh_host_ed25519_key" ];
secrets = { secrets = {
"asmir_mail_pw_hash".sopsFile = ./secrets/asmir_mail_pw_hash.yaml; "asmir_mail_pw_hash".sopsFile = ./secrets/asmir_mail_pw_hash.yaml;
"borgbase_enc_key".sopsFile = ./secrets/borgbase_enc_key.yaml; "borgbase_enc_key".sopsFile = ./secrets/borgbase_enc_key.yaml;
@ -310,10 +324,10 @@
owner = config.users.users.gitea.name; owner = config.users.users.gitea.name;
}; };
/* /*
"nextcloud_admin" = { "nextcloud_admin" = {
sopsFile = ./secrets/nextcloud_admin.yaml; sopsFile = ./secrets/nextcloud_admin.yaml;
owner = config.users.users.nextcloud.name; owner = config.users.users.nextcloud.name;
}; };
*/ */
}; };
}; };
@ -321,21 +335,29 @@
networking.hostName = "magpie"; networking.hostName = "magpie";
networking.firewall.enable = true; networking.firewall.enable = true;
networking.firewall.allowedTCPPorts = [80 443 587 2049]; # http, mail, mail, nfs networking.firewall.allowedTCPPorts = [
networking.firewall.allowedUDPPorts = [443 51820]; #mail, wireguard 80
443
587
2049
]; # http, mail, mail, nfs
networking.firewall.allowedUDPPorts = [
443
51820
]; # mail, wireguard
networking.firewall.allowPing = true; networking.firewall.allowPing = true;
networking.firewall.logRefusedConnections = lib.mkDefault false; networking.firewall.logRefusedConnections = lib.mkDefault false;
networking.nat.enable = true; networking.nat.enable = true;
networking.nat.externalInterface = "enp1s0"; networking.nat.externalInterface = "enp1s0";
networking.nat.internalInterfaces = ["wg0"]; networking.nat.internalInterfaces = [ "wg0" ];
networking.networkmanager.enable = true; networking.networkmanager.enable = true;
networking.wireless.enable = false; networking.wireless.enable = false;
networking.wireguard.interfaces = { networking.wireguard.interfaces = {
wg0 = { wg0 = {
ips = ["10.100.0.1/24"]; ips = [ "10.100.0.1/24" ];
listenPort = 51820; listenPort = 51820;
# This allows the wireguard server to route your traffic to the internet and hence be like a VPN # This allows the wireguard server to route your traffic to the internet and hence be like a VPN
@ -353,17 +375,17 @@
{ {
publicKey = builtins.readFile ../nixy/wg_pubkey; publicKey = builtins.readFile ../nixy/wg_pubkey;
presharedKeyFile = config.sops.secrets."wg_preshared/nixy".path; presharedKeyFile = config.sops.secrets."wg_preshared/nixy".path;
allowedIPs = ["10.100.0.6/32"]; allowedIPs = [ "10.100.0.6/32" ];
} }
{ {
publicKey = builtins.readFile ../mediabox/wg_pubkey; publicKey = builtins.readFile ../mediabox/wg_pubkey;
presharedKeyFile = config.sops.secrets."wg_preshared/mediabox".path; presharedKeyFile = config.sops.secrets."wg_preshared/mediabox".path;
allowedIPs = ["10.100.0.5/32"]; allowedIPs = [ "10.100.0.5/32" ];
} }
{ {
publicKey = builtins.readFile ../common/wg_pubkey_workstation; publicKey = builtins.readFile ../common/wg_pubkey_workstation;
presharedKeyFile = config.sops.secrets."wg_preshared/workstation".path; presharedKeyFile = config.sops.secrets."wg_preshared/workstation".path;
allowedIPs = ["10.100.0.4/32"]; allowedIPs = [ "10.100.0.4/32" ];
} }
]; ];
}; };

View File

@ -5,15 +5,21 @@
lib, lib,
modulesPath, modulesPath,
... ...
}: { }:
{
imports = [ imports = [
(modulesPath + "/installer/scan/not-detected.nix") (modulesPath + "/installer/scan/not-detected.nix")
]; ];
boot.initrd.availableKernelModules = ["xhci_pci" "virtio_pci" "usbhid" "sr_mod"]; boot.initrd.availableKernelModules = [
boot.initrd.kernelModules = []; "xhci_pci"
boot.kernelModules = []; "virtio_pci"
boot.extraModulePackages = []; "usbhid"
"sr_mod"
];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ ];
boot.extraModulePackages = [ ];
fileSystems."/" = { fileSystems."/" = {
device = "/dev/disk/by-uuid/118de1e5-f23e-4af3-a10a-054eded78152"; device = "/dev/disk/by-uuid/118de1e5-f23e-4af3-a10a-054eded78152";
@ -25,7 +31,7 @@
fsType = "vfat"; fsType = "vfat";
}; };
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

@ -8,13 +8,14 @@
system, system,
nvim, nvim,
... ...
}: { }:
imports = []; {
imports = [ ];
system.stateVersion = "23.05"; system.stateVersion = "23.05";
system.autoUpgrade.enable = false; system.autoUpgrade.enable = false;
sops.age.sshKeyPaths = ["/etc/ssh/ssh_host_ed25519_key"]; sops.age.sshKeyPaths = [ "/etc/ssh/ssh_host_ed25519_key" ];
sops.secrets."peerix/private" = { sops.secrets."peerix/private" = {
sopsFile = ./secrets/peerix.yaml; sopsFile = ./secrets/peerix.yaml;
mode = "0400"; mode = "0400";
@ -36,28 +37,31 @@
gc.options = "--delete-older-than 7d"; gc.options = "--delete-older-than 7d";
package = pkgs.nixVersions.latest; package = pkgs.nixVersions.latest;
settings = { settings = {
experimental-features = ["nix-command" "flakes"]; experimental-features = [
"nix-command"
"flakes"
];
}; };
}; };
boot = { boot = {
initrd = { initrd = {
compressor = "zstd"; compressor = "zstd";
availableKernelModules = ["e1000e"]; availableKernelModules = [ "e1000e" ];
network = { network = {
enable = true; enable = true;
udhcpc.enable = true; udhcpc.enable = true;
ssh = { ssh = {
enable = true; enable = true;
hostKeys = [/etc/ssh_dummy_ed25519_key]; hostKeys = [ /etc/ssh_dummy_ed25519_key ];
authorizedKeys = [(builtins.readFile ../nixy/ssh_pubkey)]; authorizedKeys = [ (builtins.readFile ../nixy/ssh_pubkey) ];
}; };
}; };
}; };
kernelModules = ["acpi_call"]; kernelModules = [ "acpi_call" ];
kernelPackages = pkgs.linuxPackages_latest; kernelPackages = pkgs.linuxPackages_latest;
kernelParams = ["msr.allow_writes=on"]; kernelParams = [ "msr.allow_writes=on" ];
kernel.sysctl = { kernel.sysctl = {
"net.core.default_qdisc" = "fq"; "net.core.default_qdisc" = "fq";
"net.ipv4.tcp_congestion_control" = "bbr"; "net.ipv4.tcp_congestion_control" = "bbr";
@ -68,7 +72,7 @@
memtest86.enable = true; memtest86.enable = true;
}; };
readOnlyNixStore = true; readOnlyNixStore = true;
supportedFilesystems = ["btrfs"]; supportedFilesystems = [ "btrfs" ];
tmp.useTmpfs = true; tmp.useTmpfs = true;
tmp.tmpfsSize = "80%"; tmp.tmpfsSize = "80%";
}; };
@ -89,7 +93,11 @@
networking = { networking = {
firewall = { firewall = {
enable = true; enable = true;
allowedTCPPorts = [80 443 51820]; allowedTCPPorts = [
80
443
51820
];
}; };
hostName = "mediabox"; hostName = "mediabox";
@ -97,8 +105,11 @@
interfaces.wlp3s0.useDHCP = false; interfaces.wlp3s0.useDHCP = false;
useDHCP = false; useDHCP = false;
wireless.enable = false; wireless.enable = false;
wireless.interfaces = ["wlp3s0"]; wireless.interfaces = [ "wlp3s0" ];
nameservers = ["127.0.0.1" "::1"]; nameservers = [
"127.0.0.1"
"::1"
];
dhcpcd.extraConfig = "nohook resolv.conf"; dhcpcd.extraConfig = "nohook resolv.conf";
networkmanager.dns = "none"; networkmanager.dns = "none";
extraHosts = '' extraHosts = ''
@ -112,13 +123,13 @@
wireguard.interfaces = { wireguard.interfaces = {
wg0 = { wg0 = {
ips = ["10.100.0.5/24"]; ips = [ "10.100.0.5/24" ];
privateKeyFile = config.sops.secrets."wg_privkey".path; privateKeyFile = config.sops.secrets."wg_privkey".path;
peers = [ peers = [
{ {
publicKey = builtins.readFile ../magpie/wg_pubkey; publicKey = builtins.readFile ../magpie/wg_pubkey;
presharedKeyFile = config.sops.secrets."wg_preshared/mediabox".path; presharedKeyFile = config.sops.secrets."wg_preshared/mediabox".path;
allowedIPs = ["10.100.0.0/24"]; allowedIPs = [ "10.100.0.0/24" ];
endpoint = "5.75.229.224:51820"; endpoint = "5.75.229.224:51820";
persistentKeepalive = 25; persistentKeepalive = 25;
} }
@ -130,7 +141,7 @@
time.timeZone = "Europe/Sarajevo"; time.timeZone = "Europe/Sarajevo";
nixpkgs.config.allowUnfree = true; nixpkgs.config.allowUnfree = true;
nixpkgs.overlays = [nvim.overlays.${system}.overlay]; nixpkgs.overlays = [ nvim.overlays.${system}.overlay ];
environment = { environment = {
homeBinInPath = true; homeBinInPath = true;
variables = { variables = {
@ -153,13 +164,13 @@
systemd = { systemd = {
services = { services = {
"macchanger-wireless" = { "macchanger-wireless" = {
after = ["sys-subsystem-net-devices-wlp3s0.device"]; after = [ "sys-subsystem-net-devices-wlp3s0.device" ];
before = ["network-pre.target"]; before = [ "network-pre.target" ];
bindsTo = ["sys-subsystem-net-devices-wlp3s0.device"]; bindsTo = [ "sys-subsystem-net-devices-wlp3s0.device" ];
description = "Changes MAC of my wireless interface for privacy reasons"; description = "Changes MAC of my wireless interface for privacy reasons";
stopIfChanged = false; stopIfChanged = false;
wantedBy = ["multi-user.target"]; wantedBy = [ "multi-user.target" ];
wants = ["network-pre.target"]; wants = [ "network-pre.target" ];
script = '' script = ''
${pkgs.macchanger}/bin/macchanger -e wlp3s0 || true ${pkgs.macchanger}/bin/macchanger -e wlp3s0 || true
''; '';
@ -168,8 +179,8 @@
"zremap" = { "zremap" = {
description = "Intercepts keyboard udev events"; description = "Intercepts keyboard udev events";
wants = ["systemd-udevd.service"]; wants = [ "systemd-udevd.service" ];
wantedBy = ["multi-user.target"]; wantedBy = [ "multi-user.target" ];
serviceConfig.Nice = -20; serviceConfig.Nice = -20;
script = '' script = ''
sleep 1 sleep 1
@ -180,26 +191,30 @@
"wakeonlan" = { "wakeonlan" = {
description = "Reenable wake on lan every boot"; description = "Reenable wake on lan every boot";
after = ["network.target"]; after = [ "network.target" ];
serviceConfig = { serviceConfig = {
Type = "oneshot"; Type = "oneshot";
ExecStart = "${pkgs.ethtool}/sbin/ethtool -s enp0s25 wol m"; ExecStart = "${pkgs.ethtool}/sbin/ethtool -s enp0s25 wol m";
}; };
wantedBy = ["default.target" "suspend.target" "shutdown.target"]; wantedBy = [
"default.target"
"suspend.target"
"shutdown.target"
];
}; };
/* /*
"cpu_setting" = { "cpu_setting" = {
description = "Enable turboot boost and undervolt cpu after suspend"; description = "Enable turboot boost and undervolt cpu after suspend";
wantedBy = ["post-resume.target" "multi-user.target"]; wantedBy = ["post-resume.target" "multi-user.target"];
after = ["post-resume.target"]; after = ["post-resume.target"];
script = '' script = ''
echo 1 > /sys/devices/system/cpu/intel_pstate/no_turbo echo 1 > /sys/devices/system/cpu/intel_pstate/no_turbo
echo 0 > /sys/devices/system/cpu/intel_pstate/no_turbo echo 0 > /sys/devices/system/cpu/intel_pstate/no_turbo
${pkgs.undervolt}/bin/undervolt --core -105 --cache -105 --uncore -105 --gpu -15 -p1 47 28 -p2 57 0.0025 ${pkgs.undervolt}/bin/undervolt --core -105 --cache -105 --uncore -105 --gpu -15 -p1 47 28 -p2 57 0.0025
''; '';
serviceConfig.Type = "oneshot"; serviceConfig.Type = "oneshot";
}; };
*/ */
}; };
}; };
@ -313,39 +328,45 @@
windowManager.icewm.enable = true; windowManager.icewm.enable = true;
}; };
udev.packages = []; udev.packages = [ ];
tlp = { tlp = {
enable = true; enable = true;
settings = {}; settings = { };
}; };
actkbd = { actkbd = {
enable = true; enable = true;
bindings = [ bindings = [
{ {
keys = [121]; keys = [ 121 ];
events = ["key"]; events = [ "key" ];
command = "${pkgs.alsaUtils}/bin/amixer -q set Master toggle"; command = "${pkgs.alsaUtils}/bin/amixer -q set Master toggle";
} }
{ {
keys = [122]; keys = [ 122 ];
events = ["key" "rep"]; events = [
"key"
"rep"
];
command = "${pkgs.alsaUtils}/bin/amixer -q set Master ${config.sound.mediaKeys.volumeStep}- unmute"; command = "${pkgs.alsaUtils}/bin/amixer -q set Master ${config.sound.mediaKeys.volumeStep}- unmute";
} }
{ {
keys = [123]; keys = [ 123 ];
events = ["key" "rep"]; events = [
"key"
"rep"
];
command = "${pkgs.alsaUtils}/bin/amixer -q set Master ${config.sound.mediaKeys.volumeStep}+ unmute"; command = "${pkgs.alsaUtils}/bin/amixer -q set Master ${config.sound.mediaKeys.volumeStep}+ unmute";
} }
{ {
keys = [224]; keys = [ 224 ];
events = ["key"]; events = [ "key" ];
command = "/run/current-system/sw/bin/light -U 5"; command = "/run/current-system/sw/bin/light -U 5";
} }
{ {
keys = [225]; keys = [ 225 ];
events = ["key"]; events = [ "key" ];
command = "/run/current-system/sw/bin/light -A 5"; command = "/run/current-system/sw/bin/light -A 5";
} }
]; ];
@ -438,7 +459,16 @@
users.users.akill = { users.users.akill = {
isNormalUser = true; isNormalUser = true;
shell = pkgs.zsh; shell = pkgs.zsh;
extraGroups = ["wireshark" "wheel" "kvm" "tty" "audio" "sound" "adbusers" "transmission"]; extraGroups = [
"wireshark"
"wheel"
"kvm"
"tty"
"audio"
"sound"
"adbusers"
"transmission"
];
openssh.authorizedKeys.keys = [ openssh.authorizedKeys.keys = [
(builtins.readFile ../nixy/ssh_pubkey) (builtins.readFile ../nixy/ssh_pubkey)
]; ];
@ -447,12 +477,21 @@
users.users.ado = { users.users.ado = {
isNormalUser = true; isNormalUser = true;
shell = pkgs.zsh; shell = pkgs.zsh;
extraGroups = ["wireshark" "wheel" "kvm" "tty" "audio" "sound" "adbusers" "transmission"]; extraGroups = [
"wireshark"
"wheel"
"kvm"
"tty"
"audio"
"sound"
"adbusers"
"transmission"
];
}; };
users.users.mediauser = { users.users.mediauser = {
isNormalUser = true; isNormalUser = true;
shell = pkgs.bash; shell = pkgs.bash;
extraGroups = []; extraGroups = [ ];
}; };
} }

View File

@ -5,20 +5,32 @@
lib, lib,
modulesPath, modulesPath,
... ...
}: { }:
{
imports = [ imports = [
(modulesPath + "/installer/scan/not-detected.nix") (modulesPath + "/installer/scan/not-detected.nix")
]; ];
boot.initrd.availableKernelModules = ["xhci_pci" "ehci_pci" "ahci" "usb_storage" "sd_mod" "rtsx_pci_sdmmc"]; boot.initrd.availableKernelModules = [
boot.initrd.kernelModules = []; "xhci_pci"
boot.kernelModules = ["kvm-intel"]; "ehci_pci"
boot.extraModulePackages = []; "ahci"
"usb_storage"
"sd_mod"
"rtsx_pci_sdmmc"
];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
fileSystems."/" = { fileSystems."/" = {
device = "/dev/disk/by-uuid/ae774285-60dc-4b08-ab26-8208e8f4e81e"; device = "/dev/disk/by-uuid/ae774285-60dc-4b08-ab26-8208e8f4e81e";
fsType = "btrfs"; fsType = "btrfs";
options = ["subvol=root" "compress=lzo" "noatime"]; options = [
"subvol=root"
"compress=lzo"
"noatime"
];
}; };
boot.initrd.luks.devices."enc".device = "/dev/disk/by-uuid/60aa7671-bfee-451b-b871-ac7c5a4a9f3a"; boot.initrd.luks.devices."enc".device = "/dev/disk/by-uuid/60aa7671-bfee-451b-b871-ac7c5a4a9f3a";
@ -26,25 +38,41 @@
fileSystems."/home" = { fileSystems."/home" = {
device = "/dev/disk/by-uuid/ae774285-60dc-4b08-ab26-8208e8f4e81e"; device = "/dev/disk/by-uuid/ae774285-60dc-4b08-ab26-8208e8f4e81e";
fsType = "btrfs"; fsType = "btrfs";
options = ["subvol=home" "compress=lzo" "noatime"]; options = [
"subvol=home"
"compress=lzo"
"noatime"
];
}; };
fileSystems."/nix" = { fileSystems."/nix" = {
device = "/dev/disk/by-uuid/ae774285-60dc-4b08-ab26-8208e8f4e81e"; device = "/dev/disk/by-uuid/ae774285-60dc-4b08-ab26-8208e8f4e81e";
fsType = "btrfs"; fsType = "btrfs";
options = ["subvol=nix" "compress=lzo" "noatime"]; options = [
"subvol=nix"
"compress=lzo"
"noatime"
];
}; };
fileSystems."/persist" = { fileSystems."/persist" = {
device = "/dev/disk/by-uuid/ae774285-60dc-4b08-ab26-8208e8f4e81e"; device = "/dev/disk/by-uuid/ae774285-60dc-4b08-ab26-8208e8f4e81e";
fsType = "btrfs"; fsType = "btrfs";
options = ["subvol=persist" "compress=lzo" "noatime"]; options = [
"subvol=persist"
"compress=lzo"
"noatime"
];
}; };
fileSystems."/var/log" = { fileSystems."/var/log" = {
device = "/dev/disk/by-uuid/ae774285-60dc-4b08-ab26-8208e8f4e81e"; device = "/dev/disk/by-uuid/ae774285-60dc-4b08-ab26-8208e8f4e81e";
fsType = "btrfs"; fsType = "btrfs";
options = ["subvol=log" "compress=lzo" "noatime"]; options = [
"subvol=log"
"compress=lzo"
"noatime"
];
neededForBoot = true; neededForBoot = true;
}; };
@ -54,7 +82,7 @@
}; };
swapDevices = [ swapDevices = [
{device = "/dev/disk/by-uuid/7b44ab02-84ff-4ffd-be26-58247cf5a982";} { device = "/dev/disk/by-uuid/7b44ab02-84ff-4ffd-be26-58247cf5a982"; }
]; ];
hardware.cpu.intel.updateMicrocode = true; hardware.cpu.intel.updateMicrocode = true;

View File

@ -2,7 +2,8 @@
config, config,
pkgs, pkgs,
... ...
}: { }:
{
# Enable Nginx # Enable Nginx
services.nginx = { services.nginx = {
enable = true; enable = true;
@ -61,7 +62,7 @@
enable = true; enable = true;
# Ensure the database, user, and permissions always exist # Ensure the database, user, and permissions always exist
ensureDatabases = ["nextcloud"]; ensureDatabases = [ "nextcloud" ];
ensureUsers = [ ensureUsers = [
{ {
name = "nextcloud"; name = "nextcloud";
@ -72,7 +73,7 @@
# Ensure that postgres is running before running the setup # Ensure that postgres is running before running the setup
systemd.services."nextcloud-setup" = { systemd.services."nextcloud-setup" = {
requires = ["postgresql.service"]; requires = [ "postgresql.service" ];
after = ["postgresql.service"]; after = [ "postgresql.service" ];
}; };
} }

View File

@ -4,11 +4,13 @@
pkgs, pkgs,
... ...
}: }:
with lib; let with lib;
let
cfg = config.services.qbittorrent; cfg = config.services.qbittorrent;
configDir = "${cfg.dataDir}/.config"; configDir = "${cfg.dataDir}/.config";
openFilesLimit = 4096; openFilesLimit = 4096;
in { in
{
options.services.qbittorrent = { options.services.qbittorrent = {
enable = mkOption { enable = mkOption {
type = types.bool; type = types.bool;
@ -67,24 +69,24 @@ in {
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
environment.systemPackages = [pkgs.qbittorrent]; environment.systemPackages = [ pkgs.qbittorrent ];
nixpkgs.overlays = [ nixpkgs.overlays = [
(final: prev: { (final: prev: {
qbittorrent = prev.qbittorrent.override {guiSupport = false;}; qbittorrent = prev.qbittorrent.override { guiSupport = false; };
}) })
]; ];
networking.firewall = mkIf cfg.openFirewall { networking.firewall = mkIf cfg.openFirewall {
allowedTCPPorts = [cfg.port]; allowedTCPPorts = [ cfg.port ];
allowedUDPPorts = [cfg.port]; allowedUDPPorts = [ cfg.port ];
}; };
systemd.services.qbittorrent = { systemd.services.qbittorrent = {
after = ["network.target"]; after = [ "network.target" ];
description = "qBittorrent Daemon"; description = "qBittorrent Daemon";
wantedBy = ["multi-user.target"]; wantedBy = [ "multi-user.target" ];
path = [pkgs.qbittorrent]; path = [ pkgs.qbittorrent ];
serviceConfig = { serviceConfig = {
ExecStart = '' ExecStart = ''
${pkgs.qbittorrent}/bin/qbittorrent-nox \ ${pkgs.qbittorrent}/bin/qbittorrent-nox \
@ -110,7 +112,10 @@ in {
}; };
}; };
users.groups = users.groups = mkIf (cfg.group == "qbittorrent") {
mkIf (cfg.group == "qbittorrent") {qbittorrent = {gid = null;};}; qbittorrent = {
gid = null;
};
};
}; };
} }

View File

@ -6,8 +6,9 @@
system, system,
zremap, zremap,
... ...
}: { }:
imports = []; {
imports = [ ];
system.stateVersion = "23.05"; system.stateVersion = "23.05";
system.autoUpgrade.enable = false; system.autoUpgrade.enable = false;
@ -17,7 +18,7 @@
}; };
sops = { sops = {
age.sshKeyPaths = ["/etc/ssh/ssh_host_ed25519_key"]; age.sshKeyPaths = [ "/etc/ssh/ssh_host_ed25519_key" ];
secrets = { secrets = {
"peerix/private" = { "peerix/private" = {
sopsFile = ./secrets/peerix.yaml; sopsFile = ./secrets/peerix.yaml;
@ -61,17 +62,29 @@
package = pkgs.nixVersions.latest; package = pkgs.nixVersions.latest;
settings = { settings = {
sandbox = true; sandbox = true;
experimental-features = ["nix-command" "flakes"]; experimental-features = [
"nix-command"
"flakes"
];
}; };
}; };
boot = { boot = {
extraModulePackages = with config.boot.kernelPackages; [usbip v4l2loopback]; extraModulePackages = with config.boot.kernelPackages; [
usbip
v4l2loopback
];
initrd.compressor = "zstd"; initrd.compressor = "zstd";
initrd.kernelModules = []; initrd.kernelModules = [ ];
initrd.systemd.enable = true; initrd.systemd.enable = true;
binfmt.emulatedSystems = ["wasm32-wasi" "x86_64-windows"]; binfmt.emulatedSystems = [
kernelParams = ["psmouse.synaptics_intertouch=0" "mem_sleep_default=deep"]; "wasm32-wasi"
"x86_64-windows"
];
kernelParams = [
"psmouse.synaptics_intertouch=0"
"mem_sleep_default=deep"
];
kernel.sysctl = { kernel.sysctl = {
"net.core.default_qdisc" = "fq"; "net.core.default_qdisc" = "fq";
"net.ipv4.tcp_congestion_control" = "bbr"; "net.ipv4.tcp_congestion_control" = "bbr";
@ -83,7 +96,10 @@
memtest86.enable = true; memtest86.enable = true;
}; };
readOnlyNixStore = true; readOnlyNixStore = true;
supportedFilesystems = ["f2fs" "xfs"]; supportedFilesystems = [
"f2fs"
"xfs"
];
tmp.useTmpfs = true; tmp.useTmpfs = true;
}; };
@ -94,7 +110,7 @@
doas.enable = true; doas.enable = true;
doas.extraRules = [ doas.extraRules = [
{ {
users = ["akill"]; users = [ "akill" ];
keepEnv = true; keepEnv = true;
persist = true; persist = true;
} }
@ -109,11 +125,19 @@
nftables.enable = true; nftables.enable = true;
firewall = { firewall = {
enable = true; enable = true;
allowedTCPPorts = [80 443 51820 8020]; allowedTCPPorts = [
80
443
51820
8020
];
}; };
hostName = "nixy"; hostName = "nixy";
nameservers = ["127.0.0.1" "::1"]; nameservers = [
"127.0.0.1"
"::1"
];
dhcpcd.extraConfig = "nohook resolv.conf"; dhcpcd.extraConfig = "nohook resolv.conf";
extraHosts = '' extraHosts = ''
@ -144,13 +168,13 @@
wireguard.interfaces = { wireguard.interfaces = {
wg0 = { wg0 = {
ips = ["10.100.0.6/24"]; ips = [ "10.100.0.6/24" ];
privateKeyFile = config.sops.secrets."wg_privkey".path; privateKeyFile = config.sops.secrets."wg_privkey".path;
peers = [ peers = [
{ {
publicKey = builtins.readFile ../magpie/wg_pubkey; publicKey = builtins.readFile ../magpie/wg_pubkey;
presharedKeyFile = config.sops.secrets."wg_preshared/nixy".path; presharedKeyFile = config.sops.secrets."wg_preshared/nixy".path;
allowedIPs = ["10.100.0.0/24"]; allowedIPs = [ "10.100.0.0/24" ];
endpoint = "5.75.229.224:51820"; endpoint = "5.75.229.224:51820";
persistentKeepalive = 25; persistentKeepalive = 25;
} }
@ -158,12 +182,12 @@
}; };
neox_wg = { neox_wg = {
ips = ["192.168.51.2/32"]; ips = [ "192.168.51.2/32" ];
privateKeyFile = config.sops.secrets."wg_privkey".path; privateKeyFile = config.sops.secrets."wg_privkey".path;
peers = [ peers = [
{ {
publicKey = builtins.readFile ../nixy/wg_pubkey_nx; publicKey = builtins.readFile ../nixy/wg_pubkey_nx;
allowedIPs = ["192.168.2.0/24"]; allowedIPs = [ "192.168.2.0/24" ];
endpoint = "185.194.64.26:51820"; endpoint = "185.194.64.26:51820";
persistentKeepalive = 25; persistentKeepalive = 25;
} }
@ -175,7 +199,10 @@
time.timeZone = "Europe/Sarajevo"; time.timeZone = "Europe/Sarajevo";
nixpkgs.config.allowUnfree = true; nixpkgs.config.allowUnfree = true;
nixpkgs.overlays = [nix-xilinx.overlay nvim.overlays.${system}.overlay]; nixpkgs.overlays = [
nix-xilinx.overlay
nvim.overlays.${system}.overlay
];
environment = { environment = {
etc = { etc = {
"firejail/qutebrowser.local".text = '' "firejail/qutebrowser.local".text = ''
@ -234,7 +261,7 @@
"netns@" = { "netns@" = {
description = "%I network namespace"; description = "%I network namespace";
before = ["network.target"]; before = [ "network.target" ];
serviceConfig = { serviceConfig = {
Type = "oneshot"; Type = "oneshot";
RemainAfterExit = true; RemainAfterExit = true;
@ -245,11 +272,11 @@
"wg_proton" = { "wg_proton" = {
description = "wg network interface"; description = "wg network interface";
bindsTo = ["netns@wg.service"]; bindsTo = [ "netns@wg.service" ];
requires = ["network-online.target"]; requires = [ "network-online.target" ];
wants = ["dnscrypt-proxy2_proton.service"]; wants = [ "dnscrypt-proxy2_proton.service" ];
after = ["netns@wg.service"]; after = [ "netns@wg.service" ];
before = ["dnscrypt-proxy2_proton.service"]; before = [ "dnscrypt-proxy2_proton.service" ];
serviceConfig = { serviceConfig = {
Type = "oneshot"; Type = "oneshot";
RemainAfterExit = true; RemainAfterExit = true;
@ -260,7 +287,9 @@
${pkgs.iproute2}/bin/ip link set proton_wg netns wg ${pkgs.iproute2}/bin/ip link set proton_wg netns wg
${pkgs.iproute2}/bin/ip -n wg address add 10.2.0.2/32 dev proton_wg ${pkgs.iproute2}/bin/ip -n wg address add 10.2.0.2/32 dev proton_wg
${pkgs.iproute2}/bin/ip netns exec wg \ ${pkgs.iproute2}/bin/ip netns exec wg \
${pkgs.wireguard-tools}/bin/wg set "proton_wg" private-key "${config.sops.secrets."wg_privkey_proton".path}" ${pkgs.wireguard-tools}/bin/wg set "proton_wg" private-key "${
config.sops.secrets."wg_privkey_proton".path
}"
${pkgs.iproute2}/bin/ip netns exec wg \ ${pkgs.iproute2}/bin/ip netns exec wg \
${pkgs.wireguard-tools}/bin/wg set "proton_wg" peer "g6DkXWKI/68RsLjROIwCEcyB/ZhyK5Q7OWcz1TtqER0=" \ ${pkgs.wireguard-tools}/bin/wg set "proton_wg" peer "g6DkXWKI/68RsLjROIwCEcyB/ZhyK5Q7OWcz1TtqER0=" \
endpoint "$ENDPOINT_IP:51820" \ endpoint "$ENDPOINT_IP:51820" \
@ -283,9 +312,9 @@
"network-online.target" "network-online.target"
"nss-lookup.target" "nss-lookup.target"
]; ];
before = ["nss-lookup.target"]; before = [ "nss-lookup.target" ];
after = ["wg_proton.service"]; after = [ "wg_proton.service" ];
partOf = ["wg_proton.service"]; partOf = [ "wg_proton.service" ];
serviceConfig = { serviceConfig = {
AmbientCapabilities = "CAP_NET_BIND_SERVICE"; AmbientCapabilities = "CAP_NET_BIND_SERVICE";
CacheDirectory = "dnscrypt-proxy"; CacheDirectory = "dnscrypt-proxy";
@ -372,7 +401,10 @@
}; };
udev = { udev = {
packages = [pkgs.openhantek6022 pkgs.openocd]; packages = [
pkgs.openhantek6022
pkgs.openocd
];
extraRules = '' extraRules = ''
#Xilinx FTDI #Xilinx FTDI
ACTION=="add", ATTR{idVendor}=="0403", ATTR{manufacturer}=="Xilinx", MODE:="666" ACTION=="add", ATTR{idVendor}=="0403", ATTR{manufacturer}=="Xilinx", MODE:="666"
@ -403,32 +435,38 @@
enable = true; enable = true;
bindings = [ bindings = [
{ {
keys = [113]; keys = [ 113 ];
events = ["key"]; events = [ "key" ];
command = "/run/current-system/sw/bin/runuser -l akill -c 'amixer -q set Master toggle'"; command = "/run/current-system/sw/bin/runuser -l akill -c 'amixer -q set Master toggle'";
} }
{ {
keys = [114]; keys = [ 114 ];
events = ["key" "rep"]; events = [
"key"
"rep"
];
command = "/run/current-system/sw/bin/runuser -l akill -c 'amixer -q set Master 5%- unmute'"; command = "/run/current-system/sw/bin/runuser -l akill -c 'amixer -q set Master 5%- unmute'";
} }
{ {
keys = [115]; keys = [ 115 ];
events = ["key" "rep"]; events = [
"key"
"rep"
];
command = "/run/current-system/sw/bin/runuser -l akill -c 'amixer -q set Master 5%+ unmute'"; command = "/run/current-system/sw/bin/runuser -l akill -c 'amixer -q set Master 5%+ unmute'";
} }
{ {
keys = [224]; keys = [ 224 ];
events = ["key"]; events = [ "key" ];
command = "${pkgs.light}/bin/light -U 5"; command = "${pkgs.light}/bin/light -U 5";
} }
{ {
keys = [225]; keys = [ 225 ];
events = ["key"]; events = [ "key" ];
command = "${pkgs.light}/bin/light -A 5"; command = "${pkgs.light}/bin/light -A 5";
} }
]; ];
@ -454,33 +492,35 @@
}; };
}; };
borgbackup.jobs."borgbase" = let borgbackup.jobs."borgbase" =
user = config.users.users.akill; let
home = user.home; user = config.users.users.akill;
in { home = user.home;
user = user.name; in
paths = [ {
(home + "/pic/priv") user = user.name;
(home + "/pproj") paths = [
(home + "/videos/priv") (home + "/pic/priv")
]; (home + "/pproj")
exclude = [ (home + "/videos/priv")
"**/.ccls_cache" ];
"**/*.d" exclude = [
"**/*.map" "**/.ccls_cache"
"**/*.o" "**/*.d"
"**/zig-cache" "**/*.map"
"**/zig-out" "**/*.o"
]; "**/zig-cache"
repo = "ssh://oda929rv@oda929rv.repo.borgbase.com/./repo"; "**/zig-out"
encryption = { ];
mode = "repokey-blake2"; repo = "ssh://oda929rv@oda929rv.repo.borgbase.com/./repo";
passCommand = "${pkgs.coreutils-full}/bin/cat ${config.sops.secrets."borgbase_enc_key".path}"; encryption = {
mode = "repokey-blake2";
passCommand = "${pkgs.coreutils-full}/bin/cat ${config.sops.secrets."borgbase_enc_key".path}";
};
environment.BORG_RSH = "${pkgs.openssh}/bin/ssh -i ${config.sops.secrets."borgbase_ssh_key".path}";
compression = "auto,zstd";
startAt = "daily";
}; };
environment.BORG_RSH = "${pkgs.openssh}/bin/ssh -i ${config.sops.secrets."borgbase_ssh_key".path}";
compression = "auto,zstd";
startAt = "daily";
};
nix-serve = { nix-serve = {
enable = false; enable = false;
@ -519,7 +559,7 @@
allowBitmaps = true; allowBitmaps = true;
useEmbeddedBitmaps = true; useEmbeddedBitmaps = true;
defaultFonts = { defaultFonts = {
monospace = ["JetBrainsMono"]; monospace = [ "JetBrainsMono" ];
}; };
}; };
@ -548,7 +588,14 @@
}; };
virtualisation = { virtualisation = {
spiceUSBRedirection.enable = true; libvirtd = {
enable = true;
allowedBridges = [
"virbr0"
"br0"
];
};
spiceUSBRedirection.enable = true;
containers.storage.settings = { containers.storage.settings = {
storage = { storage = {
graphroot = "/var/lib/containers/storage"; graphroot = "/var/lib/containers/storage";
@ -574,7 +621,7 @@
graphics = { graphics = {
enable = true; enable = true;
extraPackages = []; extraPackages = [ ];
}; };
rtl-sdr.enable = true; rtl-sdr.enable = true;
}; };
@ -587,6 +634,15 @@
users.users.akill = { users.users.akill = {
isNormalUser = true; isNormalUser = true;
shell = pkgs.zsh; shell = pkgs.zsh;
extraGroups = ["wireshark" "kvm" "tty" "audio" "sound" "adbusers" "dialout" "wheel"]; extraGroups = [
"wireshark"
"kvm"
"tty"
"audio"
"sound"
"adbusers"
"dialout"
"wheel"
];
}; };
} }

View File

@ -1,40 +1,61 @@
# 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, ... }: {
config,
lib,
pkgs,
modulesPath,
...
}:
{ {
imports = imports = [
[ (modulesPath + "/installer/scan/not-detected.nix") (modulesPath + "/installer/scan/not-detected.nix")
]; ];
boot.initrd.luks.devices."crypt_dev".device = "/dev/disk/by-uuid/e10821b9-5426-4f03-b716-1645a64fcd6a"; boot.initrd.luks.devices."crypt_dev".device =
"/dev/disk/by-uuid/e10821b9-5426-4f03-b716-1645a64fcd6a";
boot.initrd.luks.devices."crypt_dev".allowDiscards = true; boot.initrd.luks.devices."crypt_dev".allowDiscards = true;
boot.initrd.availableKernelModules = [ "nvme" "ehci_pci" "xhci_pci" "uas" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ]; boot.initrd.availableKernelModules = [
"nvme"
"ehci_pci"
"xhci_pci"
"uas"
"usb_storage"
"sd_mod"
"rtsx_pci_sdmmc"
];
boot.initrd.kernelModules = [ "dm-snapshot" ]; boot.initrd.kernelModules = [ "dm-snapshot" ];
boot.kernelModules = [ "kvm-amd" "amd-gpu" ]; boot.kernelModules = [
"kvm-amd"
"amd-gpu"
];
boot.extraModulePackages = [ ]; boot.extraModulePackages = [ ];
fileSystems."/" = fileSystems."/" = {
{ device = "/dev/disk/by-uuid/c461c971-54ca-4fb7-91e8-6ac70de53ef2"; device = "/dev/disk/by-uuid/c461c971-54ca-4fb7-91e8-6ac70de53ef2";
fsType = "xfs"; fsType = "xfs";
}; };
fileSystems."/nix" = fileSystems."/nix" = {
{ device = "/dev/disk/by-uuid/eeaa6fab-d67d-400f-b6d4-b1f44c2e0047"; device = "/dev/disk/by-uuid/eeaa6fab-d67d-400f-b6d4-b1f44c2e0047";
fsType = "xfs"; fsType = "xfs";
}; };
fileSystems."/home" = fileSystems."/home" = {
{ device = "/dev/disk/by-uuid/aeaa71ca-a439-4ef3-9ab8-db7ae8f59376"; device = "/dev/disk/by-uuid/aeaa71ca-a439-4ef3-9ab8-db7ae8f59376";
fsType = "xfs"; fsType = "xfs";
}; };
fileSystems."/boot" = fileSystems."/boot" = {
{ device = "/dev/disk/by-uuid/828E-F3C3"; device = "/dev/disk/by-uuid/828E-F3C3";
fsType = "vfat"; fsType = "vfat";
options = [ "fmask=0022" "dmask=0022" ]; options = [
}; "fmask=0022"
"dmask=0022"
];
};
swapDevices = [ ]; swapDevices = [ ];

View File

@ -49,7 +49,7 @@ stdenv.mkDerivation rec {
description = "Unprivileged sandboxing tool"; description = "Unprivileged sandboxing tool";
homepage = "https://github.com/containers/bubblewrap"; homepage = "https://github.com/containers/bubblewrap";
license = licenses.lgpl2Plus; license = licenses.lgpl2Plus;
maintainers = with maintainers; [dotlambda]; maintainers = with maintainers; [ dotlambda ];
platforms = platforms.linux; platforms = platforms.linux;
mainProgram = "bwrap"; mainProgram = "bwrap";
}; };

View File

@ -52,8 +52,8 @@ stdenv.mkDerivation {
hash = "sha256-9WHiI2WlsgEhCPkrQoAunmF6lSb2n5RgQJ2+sdnSShM="; hash = "sha256-9WHiI2WlsgEhCPkrQoAunmF6lSb2n5RgQJ2+sdnSShM=";
}; };
nativeBuildInputs = [makeWrapper]; nativeBuildInputs = [ makeWrapper ];
buildInputs = [dpkg]; buildInputs = [ dpkg ];
dontUnpack = true; dontUnpack = true;
@ -115,55 +115,57 @@ stdenv.mkDerivation {
xorg.libxkbfile xorg.libxkbfile
]; ];
installPhase = let installPhase =
viberWrap = writeShellScriptBin "viberWrap" '' let
${bubblewrap}/bin/bwrap --bind / / \ viberWrap = writeShellScriptBin "viberWrap" ''
--dev /dev \ ${bubblewrap}/bin/bwrap --bind / / \
--tmpfs $HOME \ --dev /dev \
--bind $HOME/.ViberPC/ $HOME/.ViberPC \ --tmpfs $HOME \
--bind $HOME/Downloads/ $HOME/Downloads \ --bind $HOME/.ViberPC/ $HOME/.ViberPC \
$@ --bind $HOME/Downloads/ $HOME/Downloads \
$@
'';
in
''
dpkg-deb -x $src $out
mkdir -p $out/bin
# Soothe nix-build "suspicions"
chmod -R g-w $out
for file in $(find $out -type f \( -perm /0111 -o -name \*.so\* \) ); do
patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" "$file" || true
patchelf --set-rpath $libPath:$out/opt/viber/lib $file || true
done
# qt.conf is not working, so override everything using environment variables
wrapProgram $out/opt/viber/Viber \
--set QT_PLUGIN_PATH "$out/opt/viber/plugins" \
--set QT_XKB_CONFIG_ROOT "${xorg.xkeyboardconfig}/share/X11/xkb" \
--set QTCOMPOSE "${xorg.libX11.out}/share/X11/locale" \
--set QML2_IMPORT_PATH "$out/opt/viber/qml"
echo "#!${bash}/bin/bash" > $out/bin/viber
echo "${viberWrap}/bin/viberWrap $out/opt/viber/Viber" >> $out/bin/viber
chmod +x $out/bin/viber
mv $out/usr/share $out/share
rm -rf $out/usr
# Fix the desktop link
substituteInPlace $out/share/applications/viber.desktop \
--replace /opt/viber/Viber $out/opt/viber/Viber \
--replace /usr/share/ $out/share/
''; '';
in ''
dpkg-deb -x $src $out
mkdir -p $out/bin
# Soothe nix-build "suspicions"
chmod -R g-w $out
for file in $(find $out -type f \( -perm /0111 -o -name \*.so\* \) ); do
patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" "$file" || true
patchelf --set-rpath $libPath:$out/opt/viber/lib $file || true
done
# qt.conf is not working, so override everything using environment variables
wrapProgram $out/opt/viber/Viber \
--set QT_PLUGIN_PATH "$out/opt/viber/plugins" \
--set QT_XKB_CONFIG_ROOT "${xorg.xkeyboardconfig}/share/X11/xkb" \
--set QTCOMPOSE "${xorg.libX11.out}/share/X11/locale" \
--set QML2_IMPORT_PATH "$out/opt/viber/qml"
echo "#!${bash}/bin/bash" > $out/bin/viber
echo "${viberWrap}/bin/viberWrap $out/opt/viber/Viber" >> $out/bin/viber
chmod +x $out/bin/viber
mv $out/usr/share $out/share
rm -rf $out/usr
# Fix the desktop link
substituteInPlace $out/share/applications/viber.desktop \
--replace /opt/viber/Viber $out/opt/viber/Viber \
--replace /usr/share/ $out/share/
'';
dontStrip = true; dontStrip = true;
dontPatchELF = true; dontPatchELF = true;
meta = { meta = {
homepage = "https://www.viber.com"; homepage = "https://www.viber.com";
description = "An instant messaging and Voice over IP (VoIP) app"; description = "An instant messaging and Voice over IP (VoIP) app";
sourceProvenance = with lib.sourceTypes; [binaryNativeCode]; sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
license = lib.licenses.unfree; license = lib.licenses.unfree;
platforms = ["x86_64-linux"]; platforms = [ "x86_64-linux" ];
maintainers = with lib.maintainers; [jagajaga]; maintainers = with lib.maintainers; [ jagajaga ];
}; };
} }