chore: nix fmt

This commit is contained in:
514fpv 2025-01-13 11:52:09 +08:00
parent a80bd4ed3b
commit 7266fff06e
Signed by: koishi
SSH key fingerprint: SHA256:axz0uIzzY+5W19i7QOUuiw5LSqhKfCBKPf3L4xFRxLw
128 changed files with 3402 additions and 2013 deletions

View file

@ -22,19 +22,24 @@
jovian.url = "github:Jovian-Experiments/Jovian-NixOS"; jovian.url = "github:Jovian-Experiments/Jovian-NixOS";
}; };
outputs = inputs@{self, flake-parts, treefmt-nix,...}: outputs =
flake-parts.lib.mkFlake inputs@{
{ inherit inputs; } { self,
systems = [ flake-parts,
"x86_64-linux" treefmt-nix,
]; ...
}:
flake-parts.lib.mkFlake { inherit inputs; } {
systems = [
"x86_64-linux"
];
perSystem.treefmt = { perSystem.treefmt = {
programs.nixfmt.enable = true; programs.nixfmt.enable = true;
};
imports = [
./spec
treefmt-nix.flakeModule
];
}; };
imports = [
./spec
treefmt-nix.flakeModule
];
};
} }

View file

@ -1,9 +1,14 @@
{ pkgs {
, lib pkgs,
, config lib,
, ... }: with lib; let config,
...
}:
with lib;
let
cfg = config.global.acme; cfg = config.global.acme;
in { in
{
options.global.acme = { options.global.acme = {
enable = mkEnableOption "ACME SSL certificates"; enable = mkEnableOption "ACME SSL certificates";
}; };

View file

@ -1,9 +1,14 @@
{ pkgs {
, lib pkgs,
, config lib,
, ... }: with lib; let config,
...
}:
with lib;
let
cfg = config.global.android; cfg = config.global.android;
in { in
{
options.global.android = { options.global.android = {
enable = mkEnableOption "android tools"; enable = mkEnableOption "android tools";
}; };

View file

@ -1,9 +1,14 @@
{ pkgs {
, lib pkgs,
, config lib,
, ... }: with lib; let config,
...
}:
with lib;
let
cfg = config.global.asusd; cfg = config.global.asusd;
in { in
{
options.global.asusd = { options.global.asusd = {
enable = mkEnableOption "ASUS laptop userland support daemon"; enable = mkEnableOption "ASUS laptop userland support daemon";
}; };

View file

@ -1,7 +1,11 @@
{ pkgs {
, lib pkgs,
, config lib,
, ... }: with lib; let config,
...
}:
with lib;
let
cfg = config.global.auth; cfg = config.global.auth;
pub = lib.pipe ./pub [ pub = lib.pipe ./pub [
builtins.readDir builtins.readDir
@ -10,9 +14,12 @@
(foldr (payload: keys: (splitString "\n" payload) ++ keys) [ ]) (foldr (payload: keys: (splitString "\n" payload) ++ keys) [ ])
(foldr (candidate: keys: keys ++ (if candidate == "" then [ ] else [ candidate ])) [ ]) (foldr (candidate: keys: keys ++ (if candidate == "" then [ ] else [ candidate ])) [ ])
]; ];
in { in
{
options.global.auth = { options.global.auth = {
enable = mkEnableOption "identity authentication in various software" // { default = true; }; enable = mkEnableOption "identity authentication in various software" // {
default = true;
};
openssh = { openssh = {
enable = mkEnableOption "openssh server"; enable = mkEnableOption "openssh server";
password = mkEnableOption "password authentication"; password = mkEnableOption "password authentication";
@ -42,10 +49,13 @@ in {
settings.PasswordAuthentication = cfg.openssh.password; settings.PasswordAuthentication = cfg.openssh.password;
}; };
networking.firewall.allowedTCPPorts = [ 1300 ] ++ # utility port networking.firewall.allowedTCPPorts =
optional (cfg.openssh.enable && (cfg.openssh.port != null)) cfg.openssh.port; [ 1300 ]
# utility port
++ optional (cfg.openssh.enable && (cfg.openssh.port != null)) cfg.openssh.port;
environment.persistence."/nix/persist/fhs".directories = [ ] ++ environment.persistence."/nix/persist/fhs".directories =
optional cfg.openssh.enable "/etc/ssh"; [ ]
++ optional cfg.openssh.enable "/etc/ssh";
}; };
} }

View file

@ -1,12 +1,21 @@
{ pkgs {
, lib pkgs,
, config lib,
, ... }: with lib; let config,
...
}:
with lib;
let
cfg = config.global.boot; cfg = config.global.boot;
in { in
{
options.global.boot = { options.global.boot = {
enable = mkEnableOption "bootloader installation and maintenance" // { default = true; }; enable = mkEnableOption "bootloader installation and maintenance" // {
systemd-boot = mkEnableOption "generation selection via systemd-boot" // { default = !cfg.lanzaboote; }; default = true;
};
systemd-boot = mkEnableOption "generation selection via systemd-boot" // {
default = !cfg.lanzaboote;
};
lanzaboote = mkEnableOption "secure boot maintenance via lanzaboote"; lanzaboote = mkEnableOption "secure boot maintenance via lanzaboote";
memtest = mkOption { memtest = mkOption {
type = with types; nullOr int; type = with types; nullOr int;
@ -15,21 +24,23 @@ in {
}; };
}; };
config = let config =
sbPath = "/nix/persist/lanzaboote"; let
in mkIf cfg.enable { sbPath = "/nix/persist/lanzaboote";
boot = { in
initrd.systemd.enable = true; mkIf cfg.enable {
lanzaboote.enable = cfg.lanzaboote; boot = {
lanzaboote.pkiBundle = sbPath; initrd.systemd.enable = true;
loader.systemd-boot.enable = cfg.systemd-boot; lanzaboote.enable = cfg.lanzaboote;
loader.efi.canTouchEfiVariables = true; lanzaboote.pkiBundle = sbPath;
tmp.cleanOnBoot = true; loader.systemd-boot.enable = cfg.systemd-boot;
kernelParams = optional (cfg.memtest != null) "memtest=${toString cfg.memtest}"; loader.efi.canTouchEfiVariables = true;
}; tmp.cleanOnBoot = true;
kernelParams = optional (cfg.memtest != null) "memtest=${toString cfg.memtest}";
};
# symlink for sbctl # symlink for sbctl
environment.etc.secureboot.source = sbPath; environment.etc.secureboot.source = sbPath;
environment.systemPackages = [ pkgs.sbctl ]; environment.systemPackages = [ pkgs.sbctl ];
}; };
} }

View file

@ -1,4 +1,5 @@
{ lib, ... }: { { lib, ... }:
{
imports = lib.pipe ./. [ imports = lib.pipe ./. [
builtins.readDir builtins.readDir
(lib.filterAttrs (n: ty: ty == "directory" && builtins.pathExists ./${n}/default.nix)) (lib.filterAttrs (n: ty: ty == "directory" && builtins.pathExists ./${n}/default.nix))

View file

@ -1,9 +1,14 @@
{ pkgs {
, lib pkgs,
, config lib,
, ... }: with lib; let config,
...
}:
with lib;
let
cfg = config.global.flatpak; cfg = config.global.flatpak;
in { in
{
options.global.flatpak = { options.global.flatpak = {
enable = mkEnableOption "flatpak sandbox"; enable = mkEnableOption "flatpak sandbox";
}; };
@ -11,7 +16,10 @@ in {
config = mkIf cfg.enable { config = mkIf cfg.enable {
services.flatpak.enable = true; services.flatpak.enable = true;
xdg.portal.enable = true; xdg.portal.enable = true;
users.home.persist.directories = [ ".local/share/flatpak" ".var" ]; users.home.persist.directories = [
".local/share/flatpak"
".var"
];
environment.persistence."/nix/persist/fhs".directories = [ "/var/lib/flatpak" ]; environment.persistence."/nix/persist/fhs".directories = [ "/var/lib/flatpak" ];
}; };
} }

View file

@ -1,20 +1,28 @@
{ pkgs {
, lib pkgs,
, config lib,
, ... }: with lib; let config,
...
}:
with lib;
let
cfg = config.global.fs; cfg = config.global.fs;
in { in
{
options.global.fs.bcachefs = { options.global.fs.bcachefs = {
options = mkOption { options = mkOption {
type = with types; listOf str; type = with types; listOf str;
default = [ "noatime" "compression=zstd" ]; default = [
"noatime"
"compression=zstd"
];
description = "bcachefs mount options"; description = "bcachefs mount options";
}; };
}; };
config = mkIf (cfg.type == "bcachefs") { config = mkIf (cfg.type == "bcachefs") {
fileSystems."/nix" = fileSystems."/nix" = {
{ inherit (cfg.bcachefs) options; inherit (cfg.bcachefs) options;
device = "/dev/disk/by-uuid/${cfg.store}"; device = "/dev/disk/by-uuid/${cfg.store}";
fsType = "bcachefs"; fsType = "bcachefs";
}; };

View file

@ -1,9 +1,14 @@
{ pkgs {
, lib pkgs,
, config lib,
, ... }: with lib; let config,
...
}:
with lib;
let
cfg = config.global.fs; cfg = config.global.fs;
in { in
{
imports = [ imports = [
./ext4.nix ./ext4.nix
./f2fs.nix ./f2fs.nix
@ -14,7 +19,15 @@ in {
options.global.fs = { options.global.fs = {
type = mkOption { type = mkOption {
type = with types; enum [ "ext4" "f2fs" "xfs" "zfs" "bcachefs" ]; type =
with types;
enum [
"ext4"
"f2fs"
"xfs"
"zfs"
"bcachefs"
];
default = "bcachefs"; default = "bcachefs";
description = "filesystem type to use for persistent state storage"; description = "filesystem type to use for persistent state storage";
}; };
@ -24,7 +37,9 @@ in {
description = "UUID/dataset of nix store backing device"; description = "UUID/dataset of nix store backing device";
}; };
esp = { esp = {
enable = mkEnableOption "EFI system partition" // { default = true; }; enable = mkEnableOption "EFI system partition" // {
default = true;
};
uuid = mkOption { uuid = mkOption {
type = with types; str; type = with types; str;
default = "CAFE-BABE"; default = "CAFE-BABE";
@ -53,8 +68,12 @@ in {
}; };
cryptsetup = { cryptsetup = {
enable = mkEnableOption "full disk encryption device early setup"; enable = mkEnableOption "full disk encryption device early setup";
allowDiscards = mkEnableOption "allow discards via device-mapper" // { default = true; }; allowDiscards = mkEnableOption "allow discards via device-mapper" // {
bypassWorkqueues = mkEnableOption "bypass dm-crypt's internal workqueues" // { default = true; }; default = true;
};
bypassWorkqueues = mkEnableOption "bypass dm-crypt's internal workqueues" // {
default = true;
};
uuids = mkOption { uuids = mkOption {
type = with types; attrsOf str; type = with types; attrsOf str;
description = "device-mapper name to encrypted block device UUID mapping"; description = "device-mapper name to encrypted block device UUID mapping";
@ -63,22 +82,25 @@ in {
}; };
config = { config = {
fileSystems."/" = fileSystems."/" = {
{ device = "rootfs"; device = "rootfs";
fsType = "tmpfs"; fsType = "tmpfs";
options = [ "size=2G" "mode=755" ]; options = [
"size=2G"
"mode=755"
];
}; };
fileSystems."/boot" = mkIf cfg.esp.enable fileSystems."/boot" = mkIf cfg.esp.enable {
{ device = "/dev/disk/by-uuid/${cfg.esp.uuid}"; device = "/dev/disk/by-uuid/${cfg.esp.uuid}";
fsType = "vfat"; fsType = "vfat";
}; };
fileSystems."/nix/persist" = mkIf cfg.external.enable fileSystems."/nix/persist" = mkIf cfg.external.enable {
{ inherit (cfg.external) device fsType options; inherit (cfg.external) device fsType options;
neededForBoot = true; neededForBoot = true;
depends = [ "/nix" ]; depends = [ "/nix" ];
}; };
fileSystems."/tmp" = fileSystems."/tmp" = {
{ device = "/nix/tmp"; device = "/nix/tmp";
options = [ "bind" ]; options = [ "bind" ];
depends = [ "/nix/tmp" ]; depends = [ "/nix/tmp" ];
}; };
@ -86,14 +108,20 @@ in {
services.fstrim.enable = mkIf ((cfg.type == "ext4") || (cfg.type == "xfs")) true; services.fstrim.enable = mkIf ((cfg.type == "ext4") || (cfg.type == "xfs")) true;
boot.initrd.luks.devices = mkIf cfg.cryptsetup.enable ( boot.initrd.luks.devices = mkIf cfg.cryptsetup.enable (
mapAttrs' (name: uuid: nameValuePair "luks-${name}" { mapAttrs' (
inherit (cfg.cryptsetup) allowDiscards bypassWorkqueues; name: uuid:
device = "/dev/disk/by-uuid/${uuid}"; nameValuePair "luks-${name}" {
}) cfg.cryptsetup.uuids); inherit (cfg.cryptsetup) allowDiscards bypassWorkqueues;
device = "/dev/disk/by-uuid/${uuid}";
}
) cfg.cryptsetup.uuids
);
environment.persistence."/nix/persist/fhs".files = [ { environment.persistence."/nix/persist/fhs".files = [
file = "/var/lib/private/mode"; {
parentDirectory.mode = "0700"; file = "/var/lib/private/mode";
} ]; parentDirectory.mode = "0700";
}
];
}; };
} }

View file

@ -1,10 +1,15 @@
{ lib {
, config lib,
, ... }: with lib; let config,
...
}:
with lib;
let
cfg = config.global.fs; cfg = config.global.fs;
in mkIf (cfg.type == "ext4") { in
fileSystems."/nix" = mkIf (cfg.type == "ext4") {
{ device = "/dev/disk/by-uuid/${cfg.store}"; fileSystems."/nix" = {
device = "/dev/disk/by-uuid/${cfg.store}";
fsType = "ext4"; fsType = "ext4";
options = [ "noatime" ]; options = [ "noatime" ];
}; };

View file

@ -1,10 +1,15 @@
{ lib {
, config lib,
, ... }: with lib; let config,
...
}:
with lib;
let
cfg = config.global.fs; cfg = config.global.fs;
in mkIf (cfg.type == "f2fs") { in
fileSystems."/nix" = mkIf (cfg.type == "f2fs") {
{ device = "/dev/disk/by-uuid/${cfg.store}"; fileSystems."/nix" = {
device = "/dev/disk/by-uuid/${cfg.store}";
fsType = "f2fs"; fsType = "f2fs";
}; };
} }

View file

@ -1,11 +1,16 @@
{ lib {
, config lib,
, ... }: with lib; let config,
...
}:
with lib;
let
cfg = config.global.fs; cfg = config.global.fs;
in mkIf (cfg.type == "xfs") { in
mkIf (cfg.type == "xfs") {
# NOTE: -m reflink=1 # NOTE: -m reflink=1
fileSystems."/nix" = fileSystems."/nix" = {
{ device = "/dev/disk/by-uuid/${cfg.store}"; device = "/dev/disk/by-uuid/${cfg.store}";
fsType = "xfs"; fsType = "xfs";
options = [ "noatime" ]; options = [ "noatime" ];
}; };

View file

@ -1,7 +1,11 @@
{ pkgs {
, lib pkgs,
, config lib,
, ... }: with lib; let config,
...
}:
with lib;
let
cfg = config.global.fs.zfs.alert; cfg = config.global.fs.zfs.alert;
backend = { backend = {
@ -103,7 +107,8 @@
export ALERT export ALERT
exec ${backend.text} exec ${backend.text}
''; '';
in mkIf (cfg.secret != null) { in
mkIf (cfg.secret != null) {
services.zfs.zed = mkIf cfg.zed { services.zfs.zed = mkIf cfg.zed {
settings = { settings = {
ZED_EMAIL_ADDR = [ "root" ]; ZED_EMAIL_ADDR = [ "root" ];

View file

@ -1,9 +1,14 @@
{ pkgs {
, lib pkgs,
, config lib,
, ... }: with lib; let config,
...
}:
with lib;
let
cfg = config.global.fs; cfg = config.global.fs;
in { in
{
imports = [ imports = [
./alert.nix ./alert.nix
./split.nix ./split.nix
@ -15,8 +20,12 @@ in {
# -O compression=on -O mountpoint=none -O xattr=sa -O acltype=posixacl # -O compression=on -O mountpoint=none -O xattr=sa -O acltype=posixacl
options.global.fs.zfs = { options.global.fs.zfs = {
alert = { alert = {
zed = mkEnableOption "zfs event alerts" // { default = true; }; zed = mkEnableOption "zfs event alerts" // {
swraid = mkEnableOption "software raid alerts" // { default = true; }; default = true;
};
swraid = mkEnableOption "software raid alerts" // {
default = true;
};
secret = mkOption { secret = mkOption {
type = with types; nullOr str; type = with types; nullOr str;
default = null; default = null;
@ -68,7 +77,11 @@ in {
}; };
datasets = mkOption { datasets = mkOption {
type = with types; listOf str; type = with types; listOf str;
default = [ "persist" "service" "storage" ]; default = [
"persist"
"service"
"storage"
];
description = "list of filesystems to perform replication for"; description = "list of filesystems to perform replication for";
}; };
sendOptions = mkOption { sendOptions = mkOption {
@ -80,19 +93,25 @@ in {
}; };
config = mkIf (cfg.type == "zfs") { config = mkIf (cfg.type == "zfs") {
fileSystems = (mapAttrs (path: dataset: { fileSystems =
device = "${cfg.zfs.persist}/${dataset}"; (mapAttrs (path: dataset: {
fsType = "zfs"; device = "${cfg.zfs.persist}/${dataset}";
options = [ "zfsutil" ]; fsType = "zfs";
# required by impermanence options = [ "zfsutil" ];
neededForBoot = true; # required by impermanence
}) cfg.zfs.mountpoints) // { neededForBoot = true;
"/nix" = (if !cfg.zfs.externalStore then }) cfg.zfs.mountpoints)
{ device = "${cfg.store}/nix"; // {
fsType = "zfs"; "/nix" = (
} else if !cfg.zfs.externalStore then
{ inherit (cfg.external) device fsType options; }); {
}; device = "${cfg.store}/nix";
fsType = "zfs";
}
else
{ inherit (cfg.external) device fsType options; }
);
};
global.fs.zfs.mountpoints."/nix/persist" = "persist"; global.fs.zfs.mountpoints."/nix/persist" = "persist";
services.zfs.trim.enable = true; services.zfs.trim.enable = true;

View file

@ -1,9 +1,14 @@
{ pkgs {
, lib pkgs,
, config lib,
, ... }: with lib; let config,
...
}:
with lib;
let
cfg = config.global.fs.zfs.replication; cfg = config.global.fs.zfs.replication;
in mkIf cfg.enable { in
mkIf cfg.enable {
services.syncoid = { services.syncoid = {
enable = mkDefault true; enable = mkDefault true;
interval = mkDefault "daily"; interval = mkDefault "daily";
@ -16,12 +21,18 @@ in mkIf cfg.enable {
]; ];
localSourceAllow = mkOptionDefault [ "mount" ]; localSourceAllow = mkOptionDefault [ "mount" ];
commands = (lists.foldr (name: commands: commands // { commands =
"${config.global.fs.store}/${name}" = { (lists.foldr (
inherit (cfg) sendOptions; name: commands:
target = "${cfg.remote}/${name}"; commands
}; // {
}) { }) cfg.datasets; "${config.global.fs.store}/${name}" = {
inherit (cfg) sendOptions;
target = "${cfg.remote}/${name}";
};
}
) { })
cfg.datasets;
}; };
users.users.syncoid.uid = 82; users.users.syncoid.uid = 82;

View file

@ -1,9 +1,14 @@
{ pkgs {
, lib pkgs,
, config lib,
, ... }: with lib; let config,
...
}:
with lib;
let
cfg = config.global.fs.zfs.split; cfg = config.global.fs.zfs.split;
in mkIf cfg.enable { in
mkIf cfg.enable {
# unconditionally enable fstrim for xfs and ext4 # unconditionally enable fstrim for xfs and ext4
services.fstrim.enable = mkDefault true; services.fstrim.enable = mkDefault true;
@ -14,8 +19,8 @@ in mkIf cfg.enable {
''; '';
# secret filesystem backed by swraid # secret filesystem backed by swraid
fileSystems."/nix/var/secret" = fileSystems."/nix/var/secret" = {
{ device = "/dev/disk/by-uuid/${cfg.secret}"; device = "/dev/disk/by-uuid/${cfg.secret}";
fsType = "ext4"; fsType = "ext4";
options = [ "noatime" ]; options = [ "noatime" ];
neededForBoot = true; neededForBoot = true;
@ -31,5 +36,8 @@ in mkIf cfg.enable {
}; };
# import system state pool after encrypted filesystems become available for key loading # import system state pool after encrypted filesystems become available for key loading
boot.initrd.systemd.services."zfs-import-${config.global.fs.store}".after = [ "sysroot-nix-var-secret.mount" "cryptsetup.target" ]; boot.initrd.systemd.services."zfs-import-${config.global.fs.store}".after = [
"sysroot-nix-var-secret.mount"
"cryptsetup.target"
];
} }

View file

@ -1,13 +1,20 @@
{ pkgs {
, lib pkgs,
, config lib,
, ... }: with lib; let config,
...
}:
with lib;
let
cfg = config.global.gpu; cfg = config.global.gpu;
intel = cfg.type == "intel" || (cfg.type == "prime" && config.hardware.nvidia.prime.intelBusId != ""); intel =
amdgpu = cfg.type == "amdgpu" || (cfg.type == "prime" && config.hardware.nvidia.prime.amdgpuBusId != ""); cfg.type == "intel" || (cfg.type == "prime" && config.hardware.nvidia.prime.intelBusId != "");
amdgpu =
cfg.type == "amdgpu" || (cfg.type == "prime" && config.hardware.nvidia.prime.amdgpuBusId != "");
nvidia = cfg.type == "nvidia" || cfg.type == "prime"; nvidia = cfg.type == "nvidia" || cfg.type == "prime";
in { in
{
imports = [ imports = [
./plymouth.nix ./plymouth.nix
./greetd.nix ./greetd.nix
@ -15,9 +22,18 @@ in {
options.global.gpu = { options.global.gpu = {
enable = mkEnableOption "various setup required for GUI and support software"; enable = mkEnableOption "various setup required for GUI and support software";
session = mkEnableOption "software required for a graphical session" // { default = true; }; session = mkEnableOption "software required for a graphical session" // {
default = true;
};
type = mkOption { type = mkOption {
type = with types; nullOr (enum [ "intel" "amdgpu" "nvidia" "prime" ]); type =
with types;
nullOr (enum [
"intel"
"amdgpu"
"nvidia"
"prime"
]);
default = null; default = null;
description = "type of graphics acceleration used"; description = "type of graphics acceleration used";
}; };
@ -34,21 +50,21 @@ in {
enable32Bit = true; enable32Bit = true;
# https://nixos.wiki/wiki/Accelerated_Video_Playback # https://nixos.wiki/wiki/Accelerated_Video_Playback
extraPackages = with pkgs; optionals intel [ extraPackages =
intel-media-driver # LIBVA_DRIVER_NAME=iHD with pkgs;
vaapiIntel # LIBVA_DRIVER_NAME=i965 (older but works better for Firefox/Chromium) optionals intel [
vaapiVdpau intel-media-driver # LIBVA_DRIVER_NAME=iHD
libvdpau-va-gl vaapiIntel # LIBVA_DRIVER_NAME=i965 (older but works better for Firefox/Chromium)
intel-compute-runtime vaapiVdpau
] ++ libvdpau-va-gl
optional nvidia nvidia-vaapi-driver ++ intel-compute-runtime
optional (cfg.type == "nvidia") vulkan-validation-layers; ]
++ optional nvidia nvidia-vaapi-driver
++ optional (cfg.type == "nvidia") vulkan-validation-layers;
}; };
services.xserver = mkIf cfg.session { services.xserver = mkIf cfg.session {
videoDrivers = videoDrivers = optional nvidia "nvidia" ++ optional (cfg.type == "amdgpu") "amdgpu";
optional nvidia "nvidia" ++
optional (cfg.type == "amdgpu") "amdgpu";
# inhibits default display manager # inhibits default display manager
displayManager.startx.enable = mkDefault true; displayManager.startx.enable = mkDefault true;
@ -79,7 +95,14 @@ in {
specialisation.integratedGraphics = mkIf (cfg.type == "prime") { specialisation.integratedGraphics = mkIf (cfg.type == "prime") {
configuration = { configuration = {
global.gpu.type = mkForce (if intel then "intel" else if amdgpu then "amdgpu" else "prime"); global.gpu.type = mkForce (
if intel then
"intel"
else if amdgpu then
"amdgpu"
else
"prime"
);
boot.blacklistedKernelModules = [ "nouveau" ]; boot.blacklistedKernelModules = [ "nouveau" ];
}; };
}; };
@ -92,10 +115,15 @@ in {
}; };
boot.initrd.kernelModules = boot.initrd.kernelModules =
optional amdgpu "amdgpu" ++ optional amdgpu "amdgpu"
optional (intel && cfg.arc == null) "i915" ++ ++ optional (intel && cfg.arc == null) "i915"
optionals nvidia [ "nvidia" "nvidia_drm" "nvidia_modeset" "nvidia_uvm" ] ++ ++ optionals nvidia [
optional (cfg.arc != null) "vfio-pci"; "nvidia"
"nvidia_drm"
"nvidia_modeset"
"nvidia_uvm"
]
++ optional (cfg.arc != null) "vfio-pci";
boot.extraModulePackages = optional nvidia config.boot.kernelPackages.nvidia_x11; boot.extraModulePackages = optional nvidia config.boot.kernelPackages.nvidia_x11;
@ -105,7 +133,10 @@ in {
''; '';
boot.kernelParams = boot.kernelParams =
optional intel "i915.fastboot=1" ++ optional intel "i915.fastboot=1"
optionals nvidia [ "nvidia_drm.modeset=1" "nvidia_drm.fbdev=1" ]; ++ optionals nvidia [
"nvidia_drm.modeset=1"
"nvidia_drm.fbdev=1"
];
}; };
} }

View file

@ -1,13 +1,23 @@
{ pkgs {
, lib pkgs,
, config lib,
, ... }: with lib; let config,
...
}:
with lib;
let
cfg = config.global.gpu; cfg = config.global.gpu;
gui = with cfg; enable && session; gui = with cfg; enable && session;
in mkIf gui { in
mkIf gui {
programs.regreet = { programs.regreet = {
enable = mkDefault true; enable = mkDefault true;
cageArgs = [ "-s" "-d" "-m" "last" ]; cageArgs = [
"-s"
"-d"
"-m"
"last"
];
settings = { settings = {
background.path = mkDefault ../../share/54345906_p0.jpg; background.path = mkDefault ../../share/54345906_p0.jpg;
background.fit = "Fill"; background.fit = "Fill";

View file

@ -1,10 +1,15 @@
{ pkgs {
, lib pkgs,
, config lib,
, ... }: with lib; let config,
...
}:
with lib;
let
cfg = config.global.gpu; cfg = config.global.gpu;
gui = with cfg; enable && session; gui = with cfg; enable && session;
in mkIf gui { in
mkIf gui {
boot = { boot = {
loader.timeout = mkDefault 0; loader.timeout = mkDefault 0;
consoleLogLevel = 0; consoleLogLevel = 0;

View file

@ -1,9 +1,14 @@
{ pkgs {
, lib pkgs,
, config lib,
, ... }: with lib; let config,
...
}:
with lib;
let
cfg = config.global.id; cfg = config.global.id;
in { in
{
options.global.id = mkOption { options.global.id = mkOption {
type = with types; str; type = with types; str;
description = "systemd machine id"; description = "systemd machine id";

View file

@ -1,26 +1,44 @@
{ pkgs {
, lib pkgs,
, config lib,
, ... }: with lib; let config,
...
}:
with lib;
let
cfg = config.global.io; cfg = config.global.io;
gui = with config.global.gpu; enable && session; gui = with config.global.gpu; enable && session;
in { in
{
options.global.io = { options.global.io = {
betaflight = mkEnableOption "betaflight udev rules" // { default = gui; }; betaflight = mkEnableOption "betaflight udev rules" // {
bluetooth = mkEnableOption "bluetooth daemons and state persistence" // { default = gui; }; default = gui;
audio = mkEnableOption "pulseaudio server configuration" // { default = gui; }; };
bluetooth = mkEnableOption "bluetooth daemons and state persistence" // {
default = gui;
};
audio = mkEnableOption "pulseaudio server configuration" // {
default = gui;
};
coredump = mkEnableOption "save coredumps handled by systemd"; coredump = mkEnableOption "save coredumps handled by systemd";
}; };
config = { config = {
services.udev.extraRules = '' services.udev.extraRules =
# ignore zvols ''
KERNEL=="zd*", ENV{UDISKS_IGNORE}="1" # ignore zvols
'' + (if cfg.betaflight then '' KERNEL=="zd*", ENV{UDISKS_IGNORE}="1"
# DFU (Internal bootloader for STM32 and AT32 MCUs) ''
SUBSYSTEM=="usb", ATTRS{idVendor}=="2e3c", ATTRS{idProduct}=="df11", MODE="0664", GROUP="dialout" + (
SUBSYSTEM=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="df11", MODE="0664", GROUP="dialout" if cfg.betaflight then
'' else ""); ''
# DFU (Internal bootloader for STM32 and AT32 MCUs)
SUBSYSTEM=="usb", ATTRS{idVendor}=="2e3c", ATTRS{idProduct}=="df11", MODE="0664", GROUP="dialout"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="df11", MODE="0664", GROUP="dialout"
''
else
""
);
networking.networkmanager.enable = mkDefault true; networking.networkmanager.enable = mkDefault true;
networking.hosts = { networking.hosts = {
@ -43,20 +61,25 @@ in {
jack.enable = true; jack.enable = true;
}; };
security.pam.loginLimits = mkIf (!cfg.coredump) (singleton { domain = "*"; item = "core"; type = "hard"; value = "0"; }); security.pam.loginLimits = mkIf (!cfg.coredump) (singleton {
domain = "*";
item = "core";
type = "hard";
value = "0";
});
systemd.coredump.extraConfig = mkIf (!cfg.coredump) "Storage=none"; systemd.coredump.extraConfig = mkIf (!cfg.coredump) "Storage=none";
environment.persistence."/nix/persist/fhs".directories = [ environment.persistence."/nix/persist/fhs".directories =
"/var/log" [
"/var/lib/nixos" "/var/log"
"/var/lib/systemd/backlight" "/var/lib/nixos"
] ++ "/var/lib/systemd/backlight"
optional config.networking.networkmanager.enable "/etc/NetworkManager/system-connections" ++ ]
optional cfg.bluetooth "/var/lib/bluetooth" ++ ++ optional config.networking.networkmanager.enable "/etc/NetworkManager/system-connections"
optional cfg.coredump "/var/lib/systemd/coredump"; ++ optional cfg.bluetooth "/var/lib/bluetooth"
++ optional cfg.coredump "/var/lib/systemd/coredump";
environment.persistence."/nix/persist/fhs".hideMounts = true; environment.persistence."/nix/persist/fhs".hideMounts = true;
users.home.persist.directories = [ ] ++ users.home.persist.directories = [ ] ++ optional cfg.audio ".local/state/wireplumber";
optional cfg.audio ".local/state/wireplumber";
}; };
} }

View file

@ -1,15 +1,26 @@
{ pkgs {
, lib pkgs,
, config lib,
, ... }: with lib; let config,
...
}:
with lib;
let
cfg = config.global.kernel; cfg = config.global.kernel;
in { in
{
options.global.kernel = { options.global.kernel = {
enable = mkEnableOption "kernel version and configuration" // { default = true; }; enable = mkEnableOption "kernel version and configuration" // {
default = true;
};
lts = mkEnableOption "longterm kernel releases"; lts = mkEnableOption "longterm kernel releases";
sysctl = { sysctl = {
enable = mkEnableOption "sysctl presets" // { default = true; }; enable = mkEnableOption "sysctl presets" // {
harden = mkEnableOption "hardening sysctls" // { default = true; }; default = true;
};
harden = mkEnableOption "hardening sysctls" // {
default = true;
};
swappiness = mkOption { swappiness = mkOption {
type = with types; int; type = with types; int;
default = 0; default = 0;
@ -23,6 +34,8 @@ in {
"kernel.dmesg_restrict" = mkIf cfg.sysctl.harden 1; "kernel.dmesg_restrict" = mkIf cfg.sysctl.harden 1;
"vm.swappiness" = cfg.sysctl.swappiness; "vm.swappiness" = cfg.sysctl.swappiness;
}; };
boot.kernelPackages = with pkgs; mkOverride 1001 (if cfg.lts then linuxPackages else linuxPackages_latest); boot.kernelPackages =
with pkgs;
mkOverride 1001 (if cfg.lts then linuxPackages else linuxPackages_latest);
}; };
} }

View file

@ -1,11 +1,18 @@
{ pkgs {
, lib pkgs,
, config lib,
, ... }: with lib; let config,
...
}:
with lib;
let
cfg = config.global.libvirt; cfg = config.global.libvirt;
in { in
{
options.global.libvirt = { options.global.libvirt = {
enable = mkEnableOption "libvirt virtualisation daemon" // { default = true; }; enable = mkEnableOption "libvirt virtualisation daemon" // {
default = true;
};
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {

View file

@ -1,9 +1,14 @@
{ pkgs {
, lib pkgs,
, config lib,
, ... }: with lib; let config,
...
}:
with lib;
let
cfg = config.global.lowmem; cfg = config.global.lowmem;
in { in
{
options.global.lowmem = { options.global.lowmem = {
enable = mkEnableOption "low memory optimisations"; enable = mkEnableOption "low memory optimisations";
swapsize = mkOption { swapsize = mkOption {
@ -17,9 +22,11 @@ in {
# enables remote nixos-rebuild # enables remote nixos-rebuild
nix.settings.trusted-users = [ "koishi" ]; nix.settings.trusted-users = [ "koishi" ];
swapDevices = [ { swapDevices = [
device = "/nix/persist/secret/swap"; {
size = cfg.swapsize; device = "/nix/persist/secret/swap";
} ]; size = cfg.swapsize;
}
];
}; };
} }

View file

@ -1,9 +1,14 @@
{ pkgs {
, lib pkgs,
, config lib,
, ... }: with lib; let config,
...
}:
with lib;
let
cfg = config.global.netdata; cfg = config.global.netdata;
in { in
{
options.global.netdata = { options.global.netdata = {
enable = mkEnableOption "netdata"; enable = mkEnableOption "netdata";
host = mkOption { host = mkOption {

View file

@ -1,9 +1,14 @@
{ pkgs {
, lib pkgs,
, config lib,
, ... }: with lib; let config,
...
}:
with lib;
let
cfg = config.global.oci; cfg = config.global.oci;
in { in
{
options.global.oci = { options.global.oci = {
enable = mkEnableOption "oci container runtime"; enable = mkEnableOption "oci container runtime";
}; };

View file

@ -1,9 +1,14 @@
{ pkgs {
, lib pkgs,
, config lib,
, ... }: with lib; let config,
...
}:
with lib;
let
cfg = config.global.virtualbox; cfg = config.global.virtualbox;
in { in
{
options.global.virtualbox = { options.global.virtualbox = {
enable = mkEnableOption "virtualbox host (kvm)"; enable = mkEnableOption "virtualbox host (kvm)";
}; };
@ -25,10 +30,15 @@ in {
".config/VirtualBox" ".config/VirtualBox"
]; ];
users.homeModules = [ { users.homeModules = [
wayland.windowManager.sway.config.window.commands = [ {
{ criteria.class = "VirtualBox Manager"; command = "floating enable"; } wayland.windowManager.sway.config.window.commands = [
]; {
} ]; criteria.class = "VirtualBox Manager";
command = "floating enable";
}
];
}
];
}; };
} }

View file

@ -1,16 +1,31 @@
{ pkgs {
, lib pkgs,
, config lib,
, ... }: with lib; let config,
...
}:
with lib;
let
cfg = config.users; cfg = config.users;
in { in
{
options.users.home.persistApp = { options.users.home.persistApp = {
files = mkOption { files = mkOption {
type = with types; listOf (oneOf [ str (attrsOf str) ]); type =
with types;
listOf (oneOf [
str
(attrsOf str)
]);
default = [ ]; default = [ ];
}; };
directories = mkOption { directories = mkOption {
type = with types; listOf (oneOf [ str (attrsOf str) ]); type =
with types;
listOf (oneOf [
str
(attrsOf str)
]);
default = [ ]; default = [ ];
}; };
}; };

View file

@ -1,7 +1,11 @@
{ pkgs {
, lib pkgs,
, config lib,
, ...}: with lib; { config,
...
}:
with lib;
{
# git signing configuration # git signing configuration
programs.git = { programs.git = {
signing = { signing = {
@ -15,10 +19,11 @@
gpg = { gpg = {
format = "ssh"; format = "ssh";
# compiled from trusted keys in auth module # compiled from trusted keys in auth module
ssh.allowedSignersFile = toString (pkgs.writeText ssh.allowedSignersFile = toString (
"allowed_signers" (foldr (key: folded: pkgs.writeText "allowed_signers" (
folded + "koishi@514fpv.one ${key}\n") "" foldr (key: folded: folded + "koishi@514fpv.one ${key}\n") "" config.passthrough.publicKeys
config.passthrough.publicKeys)); )
);
}; };
}; };
}; };
@ -32,6 +37,9 @@
}; };
wayland.windowManager.sway.config.window.commands = mkIf config.passthrough.gui [ wayland.windowManager.sway.config.window.commands = mkIf config.passthrough.gui [
{ criteria.title = "Bitwarden"; command = "floating enable"; } {
criteria.title = "Bitwarden";
command = "floating enable";
}
]; ];
} }

View file

@ -1,7 +1,12 @@
{ config {
, ... }: { config,
...
}:
{
# this module passes openssh public keys to home-manager # this module passes openssh public keys to home-manager
users.homeModules = [ { users.homeModules = [
passthrough.publicKeys = config.global.auth.openssh.publicKeys; {
} ]; passthrough.publicKeys = config.global.auth.openssh.publicKeys;
}
];
} }

View file

@ -1,9 +1,14 @@
{ pkgs {
, lib pkgs,
, config lib,
, ... }: with lib; let config,
...
}:
with lib;
let
cfg = config.passthrough.btop; cfg = config.passthrough.btop;
in mkIf cfg.enable { in
mkIf cfg.enable {
programs.btop = { programs.btop = {
enable = true; enable = true;
settings = { settings = {

View file

@ -1,11 +1,18 @@
{ pkgs {
, lib pkgs,
, config lib,
, ... }: with lib; let config,
...
}:
with lib;
let
cfg = config.home.btop; cfg = config.home.btop;
in { in
{
options.home.btop = { options.home.btop = {
enable = mkEnableOption "btop" // { default = !config.home.util.minimal; }; enable = mkEnableOption "btop" // {
default = !config.home.util.minimal;
};
}; };
config = { config = {

View file

@ -1,10 +1,17 @@
{ pkgs {
, lib pkgs,
, config lib,
, ... }: with lib; let config,
...
}:
with lib;
let
cfg = config.passthrough.catppuccin; cfg = config.passthrough.catppuccin;
palette = (lib.importJSON "${config.catppuccin.sources.palette}/palette.json").${config.catppuccin.flavor}.colors; palette =
in mkIf cfg.enable { (lib.importJSON "${config.catppuccin.sources.palette}/palette.json")
.${config.catppuccin.flavor}.colors;
in
mkIf cfg.enable {
gtk.theme = { inherit (cfg.gtk) package name; }; gtk.theme = { inherit (cfg.gtk) package name; };
qt.style.name = "kvantum"; qt.style.name = "kvantum";
qt.platformTheme.name = "kvantum"; qt.platformTheme.name = "kvantum";
@ -13,38 +20,90 @@ in mkIf cfg.enable {
# sway colour palette override # sway colour palette override
wayland.windowManager.sway.config = { wayland.windowManager.sway.config = {
colors = { colors = {
focused = { border = "$lavender"; background = "$base"; text = "$text"; indicator = "$rosewater"; childBorder = "$lavender"; }; focused = {
focusedInactive = { border = "$overlay0"; background = "$base"; text = "$text"; indicator = "$rosewater"; childBorder = "$overlay0"; }; border = "$lavender";
unfocused = { border = "$overlay0"; background = "$base"; text = "$text"; indicator = "$rosewater"; childBorder = "$overlay0"; }; background = "$base";
urgent = { border = "$peach"; background = "$base"; text = "$peach"; indicator = "$overlay0"; childBorder = "$peach"; }; text = "$text";
placeholder = { border = "$overlay0"; background = "$base"; text = "$text"; indicator = "$overlay0"; childBorder = "$overlay0"; }; indicator = "$rosewater";
background = "$base"; childBorder = "$lavender";
};
focusedInactive = {
border = "$overlay0";
background = "$base";
text = "$text";
indicator = "$rosewater";
childBorder = "$overlay0";
};
unfocused = {
border = "$overlay0";
background = "$base";
text = "$text";
indicator = "$rosewater";
childBorder = "$overlay0";
};
urgent = {
border = "$peach";
background = "$base";
text = "$peach";
indicator = "$overlay0";
childBorder = "$peach";
};
placeholder = {
border = "$overlay0";
background = "$base";
text = "$text";
indicator = "$overlay0";
childBorder = "$overlay0";
};
background = "$base";
}; };
bars = mkForce [ { bars = mkForce [
colors = { {
background = "$base"; colors = {
statusline = "$text"; background = "$base";
focusedStatusline = "$text"; statusline = "$text";
focusedSeparator = "$base"; focusedStatusline = "$text";
focusedWorkspace = { border = "$base"; background = "$base"; text = "$green"; }; focusedSeparator = "$base";
activeWorkspace = { border = "$base"; background = "$base"; text = "$blue"; }; focusedWorkspace = {
inactiveWorkspace = { border = "$base"; background = "$base"; text = "$surface1"; }; border = "$base";
urgentWorkspace = { border = "$base"; background = "$base"; text = "$surface1"; }; background = "$base";
bindingMode = { border = "$base"; background = "$base"; text = "$surface1"; }; text = "$green";
}; };
activeWorkspace = {
border = "$base";
background = "$base";
text = "$blue";
};
inactiveWorkspace = {
border = "$base";
background = "$base";
text = "$surface1";
};
urgentWorkspace = {
border = "$base";
background = "$base";
text = "$surface1";
};
bindingMode = {
border = "$base";
background = "$base";
text = "$surface1";
};
};
mode = "dock"; mode = "dock";
position = "bottom"; position = "bottom";
workspaceButtons = true; workspaceButtons = true;
workspaceNumbers = true; workspaceNumbers = true;
statusCommand = "${pkgs.i3status}/bin/i3status"; statusCommand = "${pkgs.i3status}/bin/i3status";
fonts = { fonts = {
names = [ "monospace" ]; names = [ "monospace" ];
size = 8.0; size = 8.0;
}; };
trayOutput = "primary"; trayOutput = "primary";
} ]; }
];
output."*".bg = mkForce "${./flake.png} fill"; output."*".bg = mkForce "${./flake.png} fill";
gaps.inner = 12; gaps.inner = 12;

View file

@ -1,32 +1,41 @@
{ pkgs {
, lib pkgs,
, config lib,
, ... }: with lib; let config,
...
}:
with lib;
let
gui = with config.global.gpu; enable && session; gui = with config.global.gpu; enable && session;
cfg = config.home.catppuccin; cfg = config.home.catppuccin;
in { in
{
options.home.catppuccin = { options.home.catppuccin = {
enable = mkEnableOption "catppuccin colour scheme" // { default = gui; }; enable = mkEnableOption "catppuccin colour scheme" // {
default = gui;
};
gtk = { gtk = {
package = mkOption { package = mkOption {
type = with types; package; type = with types; package;
default = (pkgs.catppuccin-gtk.overrideAttrs { default =
src = pkgs.fetchFromGitHub { (pkgs.catppuccin-gtk.overrideAttrs {
owner = "catppuccin"; src = pkgs.fetchFromGitHub {
repo = "gtk"; owner = "catppuccin";
rev = "v1.0.3"; repo = "gtk";
fetchSubmodules = true; rev = "v1.0.3";
hash = "sha256-q5/VcFsm3vNEw55zq/vcM11eo456SYE5TQA3g2VQjGc="; fetchSubmodules = true;
}; hash = "sha256-q5/VcFsm3vNEw55zq/vcM11eo456SYE5TQA3g2VQjGc=";
};
postUnpack = ""; postUnpack = "";
}).override { }).override
accents = [ "pink" ]; {
size = "compact"; accents = [ "pink" ];
#tweaks = [ "rimless" "black" ]; size = "compact";
variant = "mocha"; #tweaks = [ "rimless" "black" ];
}; variant = "mocha";
};
description = "catppuccin gtk theme package"; description = "catppuccin gtk theme package";
}; };
name = mkOption { name = mkOption {
@ -59,9 +68,12 @@ in {
catppuccin.enable = cfg.enable; catppuccin.enable = cfg.enable;
# gtk and cursor themes # gtk and cursor themes
environment.systemPackages = with cfg; mkIf enable [ environment.systemPackages =
gtk.package cursor.package with cfg;
]; mkIf enable [
gtk.package
cursor.package
];
# override greetd theme # override greetd theme
programs.regreet = mkIf cfg.enable { programs.regreet = mkIf cfg.enable {

View file

@ -1,7 +1,10 @@
{ pkgs {
, lib pkgs,
, config lib,
, ...}: lib.mkIf config.passthrough.gui { config,
...
}:
lib.mkIf config.passthrough.gui {
programs.chromium = { programs.chromium = {
enable = true; enable = true;
package = pkgs.google-chrome; package = pkgs.google-chrome;

View file

@ -1,9 +1,14 @@
{ pkgs {
, lib pkgs,
, config lib,
, ... }: with lib; let config,
...
}:
with lib;
let
gui = with config.global.gpu; enable && session; gui = with config.global.gpu; enable && session;
in { in
{
users.home.persist.directories = mkIf gui [ ".config/google-chrome" ]; users.home.persist.directories = mkIf gui [ ".config/google-chrome" ];
security.chromiumSuidSandbox.enable = mkIf gui true; security.chromiumSuidSandbox.enable = mkIf gui true;
environment.sessionVariables.NIXOS_OZONE_WL = "1"; environment.sessionVariables.NIXOS_OZONE_WL = "1";

View file

@ -1,7 +1,11 @@
{ pkgs {
, lib pkgs,
, config lib,
, ... }: with lib; mkIf config.passthrough.gui { config,
...
}:
with lib;
mkIf config.passthrough.gui {
programs.foot = { programs.foot = {
enable = true; enable = true;
settings.main.term = "xterm-256color"; settings.main.term = "xterm-256color";

View file

@ -1,9 +1,14 @@
{ pkgs {
, lib pkgs,
, config lib,
, ... }: with lib; let config,
...
}:
with lib;
let
cfg = config.passthrough.gnome; cfg = config.passthrough.gnome;
in { in
{
imports = [ imports = [
./impl/home.nix ./impl/home.nix
./impl/dconf.nix ./impl/dconf.nix

View file

@ -1,286 +1,341 @@
{ pkgs {
, lib pkgs,
, config lib,
, ... }: with lib; let config,
...
}:
with lib;
let
cfg = config.passthrough.gnome; cfg = config.passthrough.gnome;
bg = ../../../share/54345906_p0.jpg; bg = ../../../share/54345906_p0.jpg;
in mkIf cfg.enable { in
dconf.settings = let mkIf cfg.enable {
p = "org/gnome"; dconf.settings =
pd = "${p}/desktop"; let
ps = "${p}/shell"; p = "org/gnome";
pse = "${ps}/extensions"; pd = "${p}/desktop";
ptl = "${p}/terminal/legacy"; ps = "${p}/shell";
ptlp = "${ptl}/profiles:"; pse = "${ps}/extensions";
in { ptl = "${p}/terminal/legacy";
"${pd}/peripherals/mouse".natural-scroll = true; ptlp = "${ptl}/profiles:";
"${pd}/peripherals/touchpad".tap-to-click = true; in
"${p}/epiphany".ask-for-default = false; {
"${p}/evolution-data-server".migrated = true; "${pd}/peripherals/mouse".natural-scroll = true;
"${pd}/peripherals/touchpad".tap-to-click = true;
"${p}/epiphany".ask-for-default = false;
"${p}/evolution-data-server".migrated = true;
"${p}/nautilus/preferences" = { "${p}/nautilus/preferences" = {
default-folder-viewer = "icon-view"; default-folder-viewer = "icon-view";
migrated-gtk-settings = true; migrated-gtk-settings = true;
search-filter-time-type = "last_modified"; search-filter-time-type = "last_modified";
};
"${pd}/background" = {
color-shading-type = "solid";
picture-options = "zoom";
picture-uri = "file://${bg}";
picture-uri-dark = "file://${bg}";
primary-color = "#000000000000";
secondary-color = "#000000000000";
};
"${pd}/interface" = {
color-scheme = "prefer-dark";
cursor-theme = "Bibata-Modern-Classic";
font-antialiasing = "grayscale";
font-hinting = "slight";
gtk-theme = "adw-gtk3-dark";
icon-theme = "Papirus-Dark";
};
"${pd}/screensaver" = {
color-shading-type = "solid";
lock-enabled = false;
picture-options = "zoom";
picture-uri = "file://${bg}";
primary-color = "#000000000000";
secondary-color = "#000000000000";
};
"${pd}/wm/preferences" = {
action-double-click-titlebar = "toggle-maximize";
action-middle-click-titlebar = "minimize";
button-layout = "close:appmenu";
resize-with-right-button = true;
};
"${pd}/wm/keybindings" = {
panel-run-dialog = [ ];
begin-resize = [ "<Super>r" ];
close = [ "<Shift><Super>q" ];
minimize = [ "<Super>BackSpace" ];
move-to-workspace-1 = [ "<Shift><Super>1" ];
move-to-workspace-2 = [ "<Shift><Super>2" ];
move-to-workspace-3 = [ "<Shift><Super>3" ];
move-to-workspace-4 = [ "<Shift><Super>4" ];
move-to-workspace-left = [ "<Shift><Super>h" ];
move-to-workspace-right = [ "<Shift><Super>l" ];
switch-to-workspace-1 = [ "<Super>1" ];
switch-to-workspace-2 = [ "<Super>2" ];
switch-to-workspace-3 = [ "<Super>3" ];
switch-to-workspace-4 = [ "<Super>4" ];
toggle-maximized = [ "<Super>f" ];
};
"${ps}/keybindings" = {
switch-to-application-1 = [ ];
switch-to-application-2 = [ ];
switch-to-application-3 = [ ];
switch-to-application-4 = [ ];
switch-to-application-5 = [ ];
switch-to-application-6 = [ ];
switch-to-application-7 = [ ];
switch-to-application-8 = [ ];
switch-to-application-9 = [ ];
toggle-application-view = [ "<Super>d" ];
};
"${p}/settings-daemon/plugins/media-keys" = {
custom-keybindings = [
"/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/"
"/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom1/"
];
logout = [ ];
screensaver = [ "<Control><Alt>l" ];
};
"${p}/settings-daemon/plugins/media-keys/custom-keybindings/custom0" = {
binding = "<Super>Return";
command = "kgx";
name = "Launch console";
};
"${p}/settings-daemon/plugins/media-keys/custom-keybindings/custom1" = {
binding = "<Super>q";
command = "google-chrome-stable";
name = "Launch Google Chrome";
};
"${ptlp}" = {
#default = "95894cfd-82f7-430d-af6e-84d168bc34f5";
list = [
"de8a9081-8352-4ce4-9519-5de655ad9361"
"71a9971e-e829-43a9-9b2f-4565c855d664"
"5083e06b-024e-46be-9cd2-892b814f1fc8"
"95894cfd-82f7-430d-af6e-84d168bc34f5"
];
};
"${ptlp}/:5083e06b-024e-46be-9cd2-892b814f1fc8" = {
background-color = "#24273a";
cursor-background-color = "#f4dbd6";
cursor-colors-set = true;
cursor-foreground-color = "#24273a";
foreground-color = "#cad3f5";
highlight-background-color = "#24273a";
highlight-colors-set = true;
highlight-foreground-color = "#5b6078";
palette = [
"#494d64"
"#ed8796"
"#a6da95"
"#eed49f"
"#8aadf4"
"#f5bde6"
"#8bd5ca"
"#b8c0e0"
"#5b6078"
"#ed8796"
"#a6da95"
"#eed49f"
"#8aadf4"
"#f5bde6"
"#8bd5ca"
"#a5adcb"
];
use-theme-colors = false;
visible-name = "Catppuccin Macchiato";
};
"${ptlp}/:71a9971e-e829-43a9-9b2f-4565c855d664" = {
background-color = "#303446";
cursor-background-color = "#f2d5cf";
cursor-colors-set = true;
cursor-foreground-color = "#303446";
default-size-columns = 150;
default-size-rows = 35;
foreground-color = "#c6d0f5";
highlight-background-color = "#303446";
highlight-colors-set = true;
highlight-foreground-color = "#626880";
palette = [
"#51576d"
"#e78284"
"#a6d189"
"#e5c890"
"#8caaee"
"#f4b8e4"
"#81c8be"
"#b5bfe2"
"#626880"
"#e78284"
"#a6d189"
"#e5c890"
"#8caaee"
"#f4b8e4"
"#81c8be"
"#a5adce"
];
use-theme-colors = false;
visible-name = "Catppuccin Frappe";
};
"${ptlp}/:95894cfd-82f7-430d-af6e-84d168bc34f5" = {
background-color = "#1e1e2e";
cursor-background-color = "#f5e0dc";
cursor-colors-set = true;
cursor-foreground-color = "#1e1e2e";
foreground-color = "#cdd6f4";
highlight-background-color = "#1e1e2e";
highlight-colors-set = true;
highlight-foreground-color = "#585b70";
palette = [
"#45475a"
"#f38ba8"
"#a6e3a1"
"#f9e2af"
"#89b4fa"
"#f5c2e7"
"#94e2d5"
"#bac2de"
"#585b70"
"#f38ba8"
"#a6e3a1"
"#f9e2af"
"#89b4fa"
"#f5c2e7"
"#94e2d5"
"#a6adc8"
];
use-theme-colors = false;
visible-name = "Catppuccin Mocha";
};
"${ptlp}/:de8a9081-8352-4ce4-9519-5de655ad9361" = {
background-color = "#eff1f5";
cursor-background-color = "#dc8a78";
cursor-colors-set = true;
cursor-foreground-color = "#eff1f5";
foreground-color = "#4c4f69";
highlight-background-color = "#eff1f5";
highlight-colors-set = true;
highlight-foreground-color = "#acb0be";
palette = [
"#5c5f77"
"#d20f39"
"#40a02b"
"#df8e1d"
"#1e66f5"
"#ea76cb"
"#179299"
"#acb0be"
"#6c6f85"
"#d20f39"
"#40a02b"
"#df8e1d"
"#1e66f5"
"#ea76cb"
"#179299"
"#bcc0cc"
];
use-theme-colors = false;
visible-name = "Catppuccin Latte";
};
"${ps}" = {
disabled-extensions = [
"light-style@gnome-shell-extensions.gcampax.github.com"
"places-menu@gnome-shell-extensions.gcampax.github.com"
"windowsNavigator@gnome-shell-extensions.gcampax.github.com"
"window-list@gnome-shell-extensions.gcampax.github.com"
"workspace-indicator@gnome-shell-extensions.gcampax.github.com"
"dash-to-dock@micxgx.gmail.com"
];
enabled-extensions = [
"user-theme@gnome-shell-extensions.gcampax.github.com"
"apps-menu@gnome-shell-extensions.gcampax.github.com"
"drive-menu@gnome-shell-extensions.gcampax.github.com"
"appindicatorsupport@rgcjonas.gmail.com"
"dash-to-panel@jderose9.github.com"
"caffeine@patapon.info"
"PrivacyMenu@stuarthayhurst"
];
last-selected-power-profile = "performance";
welcome-dialog-last-shown-version = "45.3";
};
#"${pse}/user-theme".name = "catppuccin-mocha-pink-compact";
"${pse}/caffeine" = {
screen-blank = "never";
};
"${pse}/dash-to-dock" = {
background-opacity = 0.80000000000000004;
dash-max-icon-size = 48;
dock-position = "BOTTOM";
height-fraction = 0.90000000000000002;
multi-monitor = false;
running-indicator-style = "DOTS";
custom-theme-shrink = true;
};
"${pse}/dash-to-panel" = {
animate-appicon-hover = false;
animate-appicon-hover-animation-type = "SIMPLE";
appicon-margin = 0;
appicon-padding = 4;
appicon-style = "NORMAL";
available-monitors = [ 0 ];
dot-position = "BOTTOM";
dot-style-focused = "METRO";
dot-style-unfocused = "DOTS";
group-apps = true;
hide-overview-on-startup = true;
hotkeys-overlay-combo = "TEMPORARILY";
intellihide = true;
intellihide-behaviour = "FOCUSED_WINDOWS";
intellihide-hide-from-windows = true;
isolate-workspaces = false;
leftbox-padding = -1;
overview-click-to-exit = true;
panel-anchors = ''{"0":"MIDDLE"}'';
panel-element-positions = ''{"0":[{"element":"showAppsButton","visible":true,"position":"stackedTL"},{"element":"activitiesButton","visible":true,"position":"stackedTL"},{"element":"leftBox","visible":false,"position":"stackedTL"},{"element":"taskbar","visible":true,"position":"centerMonitor"},{"element":"centerBox","visible":true,"position":"stackedBR"},{"element":"rightBox","visible":true,"position":"stackedBR"},{"element":"dateMenu","visible":true,"position":"stackedBR"},{"element":"systemMenu","visible":true,"position":"stackedBR"},{"element":"desktopButton","visible":false,"position":"stackedBR"}]}'';
panel-lengths = ''{"0":100}'';
panel-positions = ''{"0":"BOTTOM"}'';
panel-sizes = ''{"0":42}'';
primary-monitor = 0;
secondarymenu-contains-showdetails = true;
show-showdesktop-hover = true;
status-icon-padding = -1;
stockgs-force-hotcorner = false;
stockgs-keep-dash = false;
stockgs-keep-top-panel = false;
stockgs-panelbtn-click-only = false;
trans-bg-color = "#2a2a2a";
trans-dynamic-anim-target = 1.0;
trans-dynamic-behavior = "MAXIMIZED_WINDOWS";
trans-gradient-bottom-color = "#000000";
trans-gradient-bottom-opacity = 0.5;
trans-gradient-top-opacity = 0.0;
trans-panel-opacity = 0.0;
trans-use-custom-bg = true;
trans-use-custom-gradient = true;
trans-use-custom-opacity = true;
trans-use-dynamic-opacity = true;
tray-padding = -1;
window-preview-title-position = "TOP";
};
}; };
"${pd}/background" = {
color-shading-type = "solid";
picture-options = "zoom";
picture-uri = "file://${bg}";
picture-uri-dark = "file://${bg}";
primary-color = "#000000000000";
secondary-color = "#000000000000";
};
"${pd}/interface" = {
color-scheme = "prefer-dark";
cursor-theme = "Bibata-Modern-Classic";
font-antialiasing = "grayscale";
font-hinting = "slight";
gtk-theme = "adw-gtk3-dark";
icon-theme = "Papirus-Dark";
};
"${pd}/screensaver" = {
color-shading-type = "solid";
lock-enabled = false;
picture-options = "zoom";
picture-uri = "file://${bg}";
primary-color = "#000000000000";
secondary-color = "#000000000000";
};
"${pd}/wm/preferences" = {
action-double-click-titlebar = "toggle-maximize";
action-middle-click-titlebar = "minimize";
button-layout = "close:appmenu";
resize-with-right-button = true;
};
"${pd}/wm/keybindings" = {
panel-run-dialog = [ ];
begin-resize = [ "<Super>r" ];
close = [ "<Shift><Super>q" ];
minimize = [ "<Super>BackSpace" ];
move-to-workspace-1 = [ "<Shift><Super>1" ];
move-to-workspace-2 = [ "<Shift><Super>2" ];
move-to-workspace-3 = [ "<Shift><Super>3" ];
move-to-workspace-4 = [ "<Shift><Super>4" ];
move-to-workspace-left = [ "<Shift><Super>h" ];
move-to-workspace-right = [ "<Shift><Super>l" ];
switch-to-workspace-1 = [ "<Super>1" ];
switch-to-workspace-2 = [ "<Super>2" ];
switch-to-workspace-3 = [ "<Super>3" ];
switch-to-workspace-4 = [ "<Super>4" ];
toggle-maximized = [ "<Super>f" ];
};
"${ps}/keybindings" = {
switch-to-application-1 = [ ];
switch-to-application-2 = [ ];
switch-to-application-3 = [ ];
switch-to-application-4 = [ ];
switch-to-application-5 = [ ];
switch-to-application-6 = [ ];
switch-to-application-7 = [ ];
switch-to-application-8 = [ ];
switch-to-application-9 = [ ];
toggle-application-view = [ "<Super>d" ];
};
"${p}/settings-daemon/plugins/media-keys" = {
custom-keybindings = [
"/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/"
"/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom1/"
];
logout = [ ];
screensaver = [ "<Control><Alt>l" ];
};
"${p}/settings-daemon/plugins/media-keys/custom-keybindings/custom0" = {
binding = "<Super>Return";
command = "kgx";
name = "Launch console";
};
"${p}/settings-daemon/plugins/media-keys/custom-keybindings/custom1" = {
binding = "<Super>q";
command = "google-chrome-stable";
name = "Launch Google Chrome";
};
"${ptlp}" = {
#default = "95894cfd-82f7-430d-af6e-84d168bc34f5";
list = [
"de8a9081-8352-4ce4-9519-5de655ad9361"
"71a9971e-e829-43a9-9b2f-4565c855d664"
"5083e06b-024e-46be-9cd2-892b814f1fc8"
"95894cfd-82f7-430d-af6e-84d168bc34f5"
];
};
"${ptlp}/:5083e06b-024e-46be-9cd2-892b814f1fc8" = {
background-color = "#24273a";
cursor-background-color = "#f4dbd6";
cursor-colors-set = true;
cursor-foreground-color = "#24273a";
foreground-color = "#cad3f5";
highlight-background-color = "#24273a";
highlight-colors-set = true;
highlight-foreground-color = "#5b6078";
palette = [
"#494d64" "#ed8796" "#a6da95" "#eed49f"
"#8aadf4" "#f5bde6" "#8bd5ca" "#b8c0e0"
"#5b6078" "#ed8796" "#a6da95" "#eed49f"
"#8aadf4" "#f5bde6" "#8bd5ca" "#a5adcb"
];
use-theme-colors = false;
visible-name = "Catppuccin Macchiato";
};
"${ptlp}/:71a9971e-e829-43a9-9b2f-4565c855d664" = {
background-color = "#303446";
cursor-background-color = "#f2d5cf";
cursor-colors-set = true;
cursor-foreground-color = "#303446";
default-size-columns = 150;
default-size-rows = 35;
foreground-color = "#c6d0f5";
highlight-background-color = "#303446";
highlight-colors-set = true;
highlight-foreground-color = "#626880";
palette = [
"#51576d" "#e78284" "#a6d189" "#e5c890"
"#8caaee" "#f4b8e4" "#81c8be" "#b5bfe2"
"#626880" "#e78284" "#a6d189" "#e5c890"
"#8caaee" "#f4b8e4" "#81c8be" "#a5adce"
];
use-theme-colors = false;
visible-name = "Catppuccin Frappe";
};
"${ptlp}/:95894cfd-82f7-430d-af6e-84d168bc34f5" = {
background-color = "#1e1e2e";
cursor-background-color = "#f5e0dc";
cursor-colors-set = true;
cursor-foreground-color = "#1e1e2e";
foreground-color = "#cdd6f4";
highlight-background-color = "#1e1e2e";
highlight-colors-set = true;
highlight-foreground-color = "#585b70";
palette = [
"#45475a" "#f38ba8" "#a6e3a1" "#f9e2af"
"#89b4fa" "#f5c2e7" "#94e2d5" "#bac2de"
"#585b70" "#f38ba8" "#a6e3a1" "#f9e2af"
"#89b4fa" "#f5c2e7" "#94e2d5" "#a6adc8"
];
use-theme-colors = false;
visible-name = "Catppuccin Mocha";
};
"${ptlp}/:de8a9081-8352-4ce4-9519-5de655ad9361" = {
background-color = "#eff1f5";
cursor-background-color = "#dc8a78";
cursor-colors-set = true;
cursor-foreground-color = "#eff1f5";
foreground-color = "#4c4f69";
highlight-background-color = "#eff1f5";
highlight-colors-set = true;
highlight-foreground-color = "#acb0be";
palette = [
"#5c5f77" "#d20f39" "#40a02b" "#df8e1d"
"#1e66f5" "#ea76cb" "#179299" "#acb0be"
"#6c6f85" "#d20f39" "#40a02b" "#df8e1d"
"#1e66f5" "#ea76cb" "#179299" "#bcc0cc"
];
use-theme-colors = false;
visible-name = "Catppuccin Latte";
};
"${ps}" = {
disabled-extensions = [
"light-style@gnome-shell-extensions.gcampax.github.com"
"places-menu@gnome-shell-extensions.gcampax.github.com"
"windowsNavigator@gnome-shell-extensions.gcampax.github.com"
"window-list@gnome-shell-extensions.gcampax.github.com"
"workspace-indicator@gnome-shell-extensions.gcampax.github.com"
"dash-to-dock@micxgx.gmail.com"
];
enabled-extensions = [
"user-theme@gnome-shell-extensions.gcampax.github.com"
"apps-menu@gnome-shell-extensions.gcampax.github.com"
"drive-menu@gnome-shell-extensions.gcampax.github.com"
"appindicatorsupport@rgcjonas.gmail.com"
"dash-to-panel@jderose9.github.com"
"caffeine@patapon.info"
"PrivacyMenu@stuarthayhurst"
];
last-selected-power-profile = "performance";
welcome-dialog-last-shown-version = "45.3";
};
#"${pse}/user-theme".name = "catppuccin-mocha-pink-compact";
"${pse}/caffeine" = {
screen-blank = "never";
};
"${pse}/dash-to-dock" = {
background-opacity = 0.80000000000000004;
dash-max-icon-size = 48;
dock-position = "BOTTOM";
height-fraction = 0.90000000000000002;
multi-monitor = false;
running-indicator-style = "DOTS";
custom-theme-shrink = true;
};
"${pse}/dash-to-panel" = {
animate-appicon-hover = false;
animate-appicon-hover-animation-type = "SIMPLE";
appicon-margin = 0;
appicon-padding = 4;
appicon-style= "NORMAL";
available-monitors = [ 0 ];
dot-position = "BOTTOM";
dot-style-focused = "METRO";
dot-style-unfocused = "DOTS";
group-apps = true;
hide-overview-on-startup = true;
hotkeys-overlay-combo = "TEMPORARILY";
intellihide = true;
intellihide-behaviour = "FOCUSED_WINDOWS";
intellihide-hide-from-windows = true;
isolate-workspaces = false;
leftbox-padding = -1;
overview-click-to-exit = true;
panel-anchors = ''{"0":"MIDDLE"}'';
panel-element-positions = ''{"0":[{"element":"showAppsButton","visible":true,"position":"stackedTL"},{"element":"activitiesButton","visible":true,"position":"stackedTL"},{"element":"leftBox","visible":false,"position":"stackedTL"},{"element":"taskbar","visible":true,"position":"centerMonitor"},{"element":"centerBox","visible":true,"position":"stackedBR"},{"element":"rightBox","visible":true,"position":"stackedBR"},{"element":"dateMenu","visible":true,"position":"stackedBR"},{"element":"systemMenu","visible":true,"position":"stackedBR"},{"element":"desktopButton","visible":false,"position":"stackedBR"}]}'';
panel-lengths = ''{"0":100}'';
panel-positions = ''{"0":"BOTTOM"}'';
panel-sizes = ''{"0":42}'';
primary-monitor = 0;
secondarymenu-contains-showdetails = true;
show-showdesktop-hover = true;
status-icon-padding = -1;
stockgs-force-hotcorner = false;
stockgs-keep-dash = false;
stockgs-keep-top-panel = false;
stockgs-panelbtn-click-only = false;
trans-bg-color = "#2a2a2a";
trans-dynamic-anim-target = 1.0;
trans-dynamic-behavior = "MAXIMIZED_WINDOWS";
trans-gradient-bottom-color = "#000000";
trans-gradient-bottom-opacity = 0.5;
trans-gradient-top-opacity = 0.0;
trans-panel-opacity = 0.0;
trans-use-custom-bg = true;
trans-use-custom-gradient = true;
trans-use-custom-opacity = true;
trans-use-dynamic-opacity = true;
tray-padding = -1;
window-preview-title-position = "TOP";
};
};
} }

View file

@ -1,23 +1,29 @@
{ pkgs {
, lib pkgs,
, config lib,
, ... }: with lib; let config,
...
}:
with lib;
let
cfg = config.passthrough.gnome; cfg = config.passthrough.gnome;
in mkIf cfg.enable { in
mkIf cfg.enable {
home.packages = home.packages =
with pkgs; with pkgs;
with gnome; with gnome;
with gnomeExtensions; [ with gnomeExtensions;
# gtk3 theme [
adw-gtk3 # gtk3 theme
adw-gtk3
# gnomeExtensions # gnomeExtensions
caffeine caffeine
dash-to-panel dash-to-panel
dash-to-dock dash-to-dock
appindicator appindicator
privacy-settings-menu privacy-settings-menu
]; ];
catppuccin.enable = mkForce false; catppuccin.enable = mkForce false;
home.pointerCursor = mkForce null; home.pointerCursor = mkForce null;
@ -26,7 +32,9 @@ in mkIf cfg.enable {
home.persistence."/nix/persist/home/${config.home.username}" = { home.persistence."/nix/persist/home/${config.home.username}" = {
removePrefixDirectory = true; removePrefixDirectory = true;
files = [ files = [
(if config.specialisation != {} then "gnome/.config/monitors.xml" else "extern/.config/monitors.xml") (
if config.specialisation != { } then "gnome/.config/monitors.xml" else "extern/.config/monitors.xml"
)
]; ];
}; };
} }

View file

@ -1,9 +1,14 @@
{ pkgs {
, lib pkgs,
, config lib,
, ... }: with lib; let config,
...
}:
with lib;
let
cfg = config.home.gnome; cfg = config.home.gnome;
in mkIf cfg.enable { in
mkIf cfg.enable {
global.flatpak.enable = mkDefault true; global.flatpak.enable = mkDefault true;
home.catppuccin.enable = mkDefault false; home.catppuccin.enable = mkDefault false;
catppuccin.enable = false; catppuccin.enable = false;
@ -17,33 +22,43 @@ in mkIf cfg.enable {
xdg.portal.configPackages = with pkgs; [ gnome-session ]; xdg.portal.configPackages = with pkgs; [ gnome-session ];
services.pulseaudio.enable = false; services.pulseaudio.enable = false;
environment.gnome.excludePackages = (with pkgs; [ environment.gnome.excludePackages =
snapshot (
gnome-tour with pkgs;
] ++ optionals config.global.flatpak.enable [ [
baobab snapshot
simple-scan gnome-tour
evince ]
file-roller ++ optionals config.global.flatpak.enable [
geary baobab
loupe simple-scan
seahorse evince
totem file-roller
epiphany geary
gnome-calculator loupe
gnome-calendar seahorse
gnome-connections totem
gnome-font-viewer epiphany
gnome-text-editor gnome-calculator
gnome-characters gnome-calendar
gnome-clocks gnome-connections
gnome-contacts gnome-font-viewer
gnome-logs gnome-text-editor
gnome-maps gnome-characters
gnome-music gnome-clocks
gnome-weather gnome-contacts
]) ++ (with pkgs.gnome; [ ] ++ optionals config.global.flatpak.enable [ gnome-logs
]); gnome-maps
gnome-music
gnome-weather
]
)
++ (
with pkgs.gnome;
[ ]
++ optionals config.global.flatpak.enable [
]
);
users.home.persist.directories = [ ".config/dconf" ]; users.home.persist.directories = [ ".config/dconf" ];
} }

View file

@ -1,9 +1,14 @@
{ pkgs {
, lib pkgs,
, config lib,
, ... }: with lib; let config,
...
}:
with lib;
let
cfg = config.home.gnome; cfg = config.home.gnome;
in { in
{
imports = [ ./impl/nixos.nix ]; imports = [ ./impl/nixos.nix ];
options.home.gnome = { options.home.gnome = {
@ -16,10 +21,12 @@ in {
{ passthrough.gnome = cfg; } { passthrough.gnome = cfg; }
]; ];
specialisation.nognome = with cfg; mkIf enable { specialisation.nognome =
configuration = { with cfg;
home.gnome.enable = mkForce false; mkIf enable {
configuration = {
home.gnome.enable = mkForce false;
};
}; };
};
}; };
} }

View file

@ -1,9 +1,14 @@
{ pkgs {
, lib pkgs,
, config lib,
, ... }: with lib; let config,
...
}:
with lib;
let
catppuccin = config.passthrough.catppuccin.enable; catppuccin = config.passthrough.catppuccin.enable;
in { in
{
config = mkIf config.passthrough.gui { config = mkIf config.passthrough.gui {
# cursor theme # cursor theme
home.pointerCursor = { home.pointerCursor = {

View file

@ -1,10 +1,15 @@
{ pkgs {
, lib pkgs,
, config lib,
, ... }: with lib; let config,
...
}:
with lib;
let
gui = with config.global.gpu; enable && session; gui = with config.global.gpu; enable && session;
catppuccin = config.home.catppuccin; catppuccin = config.home.catppuccin;
in { in
{
config = { config = {
users.homeModules = [ users.homeModules = [
# this module passes gui configuration to home-manager # this module passes gui configuration to home-manager
@ -13,13 +18,18 @@ in {
users.adminGroups = mkIf gui [ "video" ]; users.adminGroups = mkIf gui [ "video" ];
# themes and icons # themes and icons
environment.systemPackages = with pkgs; mkIf gui ([ environment.systemPackages =
papirus-icon-theme with pkgs;
] ++ optionals (!catppuccin.enable) [ mkIf gui (
whitesur-gtk-theme [
whitesur-icon-theme papirus-icon-theme
bibata-cursors ]
]); ++ optionals (!catppuccin.enable) [
whitesur-gtk-theme
whitesur-icon-theme
bibata-cursors
]
);
fonts.enableDefaultPackages = mkIf gui true; fonts.enableDefaultPackages = mkIf gui true;

View file

@ -1,13 +1,21 @@
{ pkgs {
, lib pkgs,
, config lib,
, ... }: with lib; let config,
...
}:
with lib;
let
cfg = config.passthrough.gyroflow; cfg = config.passthrough.gyroflow;
in mkIf cfg.enable { in
mkIf cfg.enable {
# temporarily gone until regression is fixed # temporarily gone until regression is fixed
#home.packages = [ cfg.package ]; #home.packages = [ cfg.package ];
wayland.windowManager.sway.config.window.commands = [ wayland.windowManager.sway.config.window.commands = [
{ criteria.app_id = "xyz.gyroflow.gyroflow"; command = "floating enable"; } {
criteria.app_id = "xyz.gyroflow.gyroflow";
command = "floating enable";
}
]; ];
} }

View file

@ -1,16 +1,23 @@
{ pkgs {
, lib pkgs,
, config lib,
, ... }: with lib; let config,
...
}:
with lib;
let
cfg = config.home.gyroflow; cfg = config.home.gyroflow;
in { in
{
options.home.gyroflow = { options.home.gyroflow = {
enable = mkEnableOption "gyroflow stabilisation software"; enable = mkEnableOption "gyroflow stabilisation software";
package = mkOption { package = mkOption {
type = with types; package; type = with types; package;
default = pkgs.gyroflow.overrideAttrs (finalAttrs: previousAttrs: { default = pkgs.gyroflow.overrideAttrs (
buildInputs = previousAttrs.buildInputs ++ [ pkgs.qt6Packages.qtwayland ]; finalAttrs: previousAttrs: {
}); buildInputs = previousAttrs.buildInputs ++ [ pkgs.qt6Packages.qtwayland ];
}
);
description = "gyroflow package"; description = "gyroflow package";
}; };
}; };

View file

@ -1,9 +1,14 @@
{ pkgs {
, lib pkgs,
, config lib,
, ... }: with lib; let config,
...
}:
with lib;
let
cfg = config.passthrough.headless; cfg = config.passthrough.headless;
in mkIf (cfg.enable != null) { in
mkIf (cfg.enable != null) {
wayland.windowManager.sway.config = { wayland.windowManager.sway.config = {
output = { output = {
${cfg.enable}.pos = "0 0"; ${cfg.enable}.pos = "0 0";
@ -13,12 +18,14 @@ in mkIf (cfg.enable != null) {
startup = [ { command = "swaymsg create_output && swaymsg output HEADLESS-1 disable"; } ]; startup = [ { command = "swaymsg create_output && swaymsg output HEADLESS-1 disable"; } ];
}; };
home.packages = [ (pkgs.writeShellScriptBin "headless" '' home.packages = [
swaymsg output HEADLESS-1 enable (pkgs.writeShellScriptBin "headless" ''
${pkgs.wayvnc}/bin/wayvnc \ swaymsg output HEADLESS-1 enable
--output=HEADLESS-1 \ ${pkgs.wayvnc}/bin/wayvnc \
${cfg.extraArgs} \ --output=HEADLESS-1 \
${cfg.host} ${toString cfg.port} ${cfg.extraArgs} \
swaymsg output HEADLESS-1 disable ${cfg.host} ${toString cfg.port}
'') ]; swaymsg output HEADLESS-1 disable
'')
];
} }

View file

@ -1,9 +1,14 @@
{ pkgs {
, lib pkgs,
, config lib,
, ... }: with lib; let config,
...
}:
with lib;
let
cfg = config.home.headless; cfg = config.home.headless;
in { in
{
options.home.headless = { options.home.headless = {
enable = mkOption { enable = mkOption {
type = with types; nullOr str; type = with types; nullOr str;

View file

@ -1,7 +1,11 @@
{ pkgs {
, lib pkgs,
, config lib,
, ... }: with lib; mkIf config.passthrough.gui { config,
...
}:
with lib;
mkIf config.passthrough.gui {
programs.i3status = { programs.i3status = {
enable = true; enable = true;
enableDefault = false; enableDefault = false;
@ -48,8 +52,9 @@
position = 5; position = 5;
settings = { settings = {
format = "%1min %5min %15min"; format = "%1min %5min %15min";
max_threshold = max_threshold = removeSuffix "\n" (
removeSuffix "\n" (builtins.readFile (pkgs.runCommandLocal "nproc" { } "nproc > $out")); builtins.readFile (pkgs.runCommandLocal "nproc" { } "nproc > $out")
);
}; };
}; };
@ -70,7 +75,9 @@
"tztime local" = { "tztime local" = {
position = 127; position = 127;
settings = { format = "%Y-%m-%d %H:%M:%S"; }; settings = {
format = "%Y-%m-%d %H:%M:%S";
};
}; };
}; };
}; };

View file

@ -1,6 +1,10 @@
{ pkgs {
, lib pkgs,
, config lib,
, ... }: with lib; mkIf config.passthrough.gui { config,
...
}:
with lib;
mkIf config.passthrough.gui {
programs.imv.enable = true; programs.imv.enable = true;
} }

View file

@ -1,11 +1,18 @@
{ pkgs {
, lib pkgs,
, config lib,
, ... }: with lib; let config,
...
}:
with lib;
let
cfg = config.passthrough.jetbrains; cfg = config.passthrough.jetbrains;
in mkIf cfg.enable { in
home.packages = with pkgs.jetbrains; [ pkgs.go ] ++ mkIf cfg.enable {
optional cfg.idea idea-community ++ home.packages =
optional cfg.clion clion ++ with pkgs.jetbrains;
optional cfg.goland goland; [ pkgs.go ]
++ optional cfg.idea idea-community
++ optional cfg.clion clion
++ optional cfg.goland goland;
} }

View file

@ -1,14 +1,21 @@
{ pkgs {
, lib pkgs,
, config lib,
, ... }: with lib; let config,
...
}:
with lib;
let
cfg = config.home.jetbrains; cfg = config.home.jetbrains;
in { in
{
options.home.jetbrains = { options.home.jetbrains = {
enable = mkEnableOption "jetbrains text editor"; enable = mkEnableOption "jetbrains text editor";
idea = mkEnableOption "intellij idea"; idea = mkEnableOption "intellij idea";
clion = mkEnableOption "clion ide"; clion = mkEnableOption "clion ide";
goland = mkEnableOption "goland ide" // { default = true; }; goland = mkEnableOption "goland ide" // {
default = true;
};
}; };
config = { config = {

View file

@ -1,9 +1,14 @@
{ pkgs {
, lib pkgs,
, config lib,
, ... }: with lib; let config,
...
}:
with lib;
let
cfg = config.passthrough.libreoffice; cfg = config.passthrough.libreoffice;
enable = cfg.enable && (cfg.allUsers || (config.home.username == "app")); enable = cfg.enable && (cfg.allUsers || (config.home.username == "app"));
in mkIf enable { in
mkIf enable {
home.packages = with pkgs; [ libreoffice ]; home.packages = with pkgs; [ libreoffice ];
} }

View file

@ -1,10 +1,15 @@
{ pkgs {
, lib pkgs,
, config lib,
, ... }: with lib; let config,
...
}:
with lib;
let
cfg = config.home.libreoffice; cfg = config.home.libreoffice;
persist = [ ".config/libreoffice" ]; persist = [ ".config/libreoffice" ];
in { in
{
options.home.libreoffice = { options.home.libreoffice = {
enable = mkEnableOption "open source office suite"; enable = mkEnableOption "open source office suite";
allUsers = mkEnableOption "set up for all users"; allUsers = mkEnableOption "set up for all users";

View file

@ -1,7 +1,11 @@
{ pkgs {
, lib pkgs,
, config lib,
, ... }: with lib; mkIf config.passthrough.gui { config,
...
}:
with lib;
mkIf config.passthrough.gui {
services.mako = { services.mako = {
enable = true; enable = true;
defaultTimeout = 5000; defaultTimeout = 5000;

View file

@ -1,16 +1,27 @@
{ pkgs {
, lib pkgs,
, config lib,
, ... }: with lib; let config,
...
}:
with lib;
let
inherit (config.passthrough) gui; inherit (config.passthrough) gui;
cfg = config.passthrough.minecraft; cfg = config.passthrough.minecraft;
enable = cfg.enable && config.home.username == cfg.user; enable = cfg.enable && config.home.username == cfg.user;
in mkIf enable { in
home.packages = with pkgs; [ mkIf enable {
jdk8 home.packages =
] ++ optional gui prismlauncher; with pkgs;
[
jdk8
]
++ optional gui prismlauncher;
wayland.windowManager.sway.config.window.commands = mkIf gui [ wayland.windowManager.sway.config.window.commands = mkIf gui [
{ criteria.app_id = "org.prismlauncher.PrismLauncher"; command = "floating enable"; } {
criteria.app_id = "org.prismlauncher.PrismLauncher";
command = "floating enable";
}
]; ];
} }

View file

@ -1,10 +1,15 @@
{ pkgs {
, lib pkgs,
, config lib,
, ... }: with lib; let config,
...
}:
with lib;
let
cfg = config.home.minecraft; cfg = config.home.minecraft;
gui = with config.global.gpu; enable && session; gui = with config.global.gpu; enable && session;
in { in
{
options.home.minecraft = { options.home.minecraft = {
enable = mkEnableOption "minecraft game launcher and jvm"; enable = mkEnableOption "minecraft game launcher and jvm";
user = mkOption { user = mkOption {

View file

@ -1,7 +1,11 @@
{ pkgs {
, lib pkgs,
, config lib,
, ... }: with lib; mkIf config.passthrough.gui { config,
...
}:
with lib;
mkIf config.passthrough.gui {
programs.mpv = { programs.mpv = {
enable = true; enable = true;
config = { config = {

View file

@ -1,5 +1,8 @@
{ pkgs {
, ... }: { pkgs,
...
}:
{
programs.neovim = { programs.neovim = {
enable = true; enable = true;
defaultEditor = true; defaultEditor = true;

View file

@ -1,10 +1,15 @@
{ pkgs {
, lib pkgs,
, config lib,
, ... }: with lib; let config,
...
}:
with lib;
let
cfg = config.passthrough.plasma; cfg = config.passthrough.plasma;
image = ../../share/54345906_p0.jpg; image = ../../share/54345906_p0.jpg;
in mkIf cfg.enable { in
mkIf cfg.enable {
programs.plasma = { programs.plasma = {
# https://github.com/pjones/plasma-manager # https://github.com/pjones/plasma-manager
enable = true; enable = true;

View file

@ -1,10 +1,15 @@
{ pkgs {
, lib pkgs,
, config lib,
, plasma-manager config,
, ... }: with lib; let plasma-manager,
...
}:
with lib;
let
cfg = config.home.plasma; cfg = config.home.plasma;
in { in
{
options.home.plasma = { options.home.plasma = {
enable = mkEnableOption "plasma desktop and configuration"; enable = mkEnableOption "plasma desktop and configuration";
specialise = mkEnableOption "enable plasma in a specialisation"; specialise = mkEnableOption "enable plasma in a specialisation";

View file

@ -1,41 +1,48 @@
{ pkgs {
, lib pkgs,
, config lib,
, inputs config,
, ... }: with lib; let inputs,
...
}:
with lib;
let
cfg = config.users; cfg = config.users;
in { in
{
options.users = { options.users = {
profiles = mkOption { profiles = mkOption {
type = with types; attrsOf (submodule { type =
options = { with types;
uid = mkOption { attrsOf (submodule {
type = with types; nullOr int; options = {
default = null; uid = mkOption {
description = "uid passthrough to base user configuration"; type = with types; nullOr int;
default = null;
description = "uid passthrough to base user configuration";
};
description = mkOption {
type = with types; nullOr str;
default = null;
description = "description passthrough to base user configuration";
};
admin = mkOption {
type = with types; bool;
default = false;
description = "add user to privileged groups";
};
sshLogin = mkOption {
type = with types; bool;
default = false;
description = "enable ssh authorized keys for user";
};
picture = mkOption {
type = with types; nullOr path;
default = null;
description = "path to user profile picture";
};
}; };
description = mkOption { });
type = with types; nullOr str;
default = null;
description = "description passthrough to base user configuration";
};
admin = mkOption {
type = with types; bool;
default = false;
description = "add user to privileged groups";
};
sshLogin = mkOption {
type = with types; bool;
default = false;
description = "enable ssh authorized keys for user";
};
picture = mkOption {
type = with types; nullOr path;
default = null;
description = "path to user profile picture";
};
};
});
description = "preconfigured users with profile options"; description = "preconfigured users with profile options";
}; };
@ -57,11 +64,21 @@ in {
}; };
persist = { persist = {
files = mkOption { files = mkOption {
type = with types; listOf (oneOf [ str (attrsOf str) ]); type =
with types;
listOf (oneOf [
str
(attrsOf str)
]);
default = [ ]; default = [ ];
}; };
directories = mkOption { directories = mkOption {
type = with types; listOf (oneOf [ str (attrsOf str) ]); type =
with types;
listOf (oneOf [
str
(attrsOf str)
]);
default = [ ]; default = [ ];
}; };
}; };
@ -74,8 +91,9 @@ in {
inherit (opts) uid; inherit (opts) uid;
description = with opts; mkIf (description != null) description; description = with opts; mkIf (description != null) description;
extraGroups = [ "dialout" ] ++ optionals opts.admin cfg.adminGroups; extraGroups = [ "dialout" ] ++ optionals opts.admin cfg.adminGroups;
openssh.authorizedKeys.keys = mkIf (opts.sshLogin && config.services.openssh.enable) openssh.authorizedKeys.keys = mkIf (
config.global.auth.openssh.publicKeys; opts.sshLogin && config.services.openssh.enable
) config.global.auth.openssh.publicKeys;
hashedPasswordFile = "/nix/persist/shadow/${name}"; hashedPasswordFile = "/nix/persist/shadow/${name}";
shell = pkgs.zsh; shell = pkgs.zsh;
isNormalUser = mkIf (name != "root") true; isNormalUser = mkIf (name != "root") true;
@ -85,98 +103,125 @@ in {
# base groups # base groups
adminGroups = [ adminGroups = [
"wheel" "kvm" "wheel"
"kvm"
"systemd-journal" "systemd-journal"
"networkmanager" "networkmanager"
]; ];
# base home modules in current directory # base home modules in current directory
homeModules = pipe ./. [ homeModules =
builtins.readDir pipe ./. [
(filterAttrs (n: ty: ty == "directory" && builtins.pathExists ./${n}/home.nix)) builtins.readDir
(mapAttrsToList (n: _: ./${n}/home.nix)) (filterAttrs (n: ty: ty == "directory" && builtins.pathExists ./${n}/home.nix))
] ++ [ { (mapAttrsToList (n: _: ./${n}/home.nix))
options.passthrough = mkOption { ]
type = with types; attrsOf anything; ++ [
description = "passthrough values from nixos configuration"; {
}; options.passthrough = mkOption {
} ]; type = with types; attrsOf anything;
description = "passthrough values from nixos configuration";
};
}
];
# basic persistence # basic persistence
home.persist = { home.persist = {
directories = [ directories = [
"src" "src"
{ directory = ".gnupg"; mode = "0700"; } {
{ directory = ".ssh"; mode = "0700"; } directory = ".gnupg";
{ directory = ".local/share/keyrings"; mode = "0700"; } mode = "0700";
}
{
directory = ".ssh";
mode = "0700";
}
{
directory = ".local/share/keyrings";
mode = "0700";
}
]; ];
}; };
}; };
# mount tmpfs on each user's home directory with appropriate ownership # mount tmpfs on each user's home directory with appropriate ownership
fileSystems = mapAttrs' fileSystems = mapAttrs' (
(name: opts: nameValuePair name: opts:
# nixpkgs quirk: accessing user configuration here causes infinite recursion nameValuePair
# this workaround ensures proper home directory path unless overridden elsewhere # nixpkgs quirk: accessing user configuration here causes infinite recursion
(if name != "root" then "/home/${name}" else "/root") { # this workaround ensures proper home directory path unless overridden elsewhere
device = "homefs"; (if name != "root" then "/home/${name}" else "/root")
fsType = "tmpfs"; {
options = [ "size=${cfg.home.size}" device = "homefs";
"uid=${builtins.toString opts.uid}" fsType = "tmpfs";
"gid=${builtins.toString cfg.groups.${cfg.users.${name}.group}.gid}" options = [
"mode=700" ]; "size=${cfg.home.size}"
"uid=${builtins.toString opts.uid}"
"gid=${builtins.toString cfg.groups.${cfg.users.${name}.group}.gid}"
"mode=700"
];
# impermanence sets permissions before filesystems are mounted # impermanence sets permissions before filesystems are mounted
# this mounts filesystem in initrd therefore working around that bug # this mounts filesystem in initrd therefore working around that bug
neededForBoot = true; neededForBoot = true;
}) cfg.profiles; }
) cfg.profiles;
global.fs.zfs.mountpoints = mapAttrs' global.fs.zfs.mountpoints = mapAttrs' (
(name: opts: nameValuePair name: opts: nameValuePair "/nix/persist/home/${name}" "home/${name}"
"/nix/persist/home/${name}" ) (filterAttrs (n: _: n != "root") config.users.profiles);
"home/${name}")
(filterAttrs (n: _: n != "root") config.users.profiles);
home-manager.users = mapAttrs (name: opts: { home-manager.users = mapAttrs (name: opts: {
imports = with inputs; cfg.homeModules ++ [ imports =
impermanence.homeManagerModules.impermanence with inputs;
catppuccin.homeManagerModules.catppuccin cfg.homeModules
]; ++ [
impermanence.homeManagerModules.impermanence
catppuccin.homeManagerModules.catppuccin
];
home.file.".face" = mkIf (opts.picture != null) { home.file.".face" = mkIf (opts.picture != null) {
source = opts.picture; source = opts.picture;
}; };
home.stateVersion = "23.11"; home.stateVersion = "23.11";
}) cfg.profiles; }) cfg.profiles;
system.activationScripts = mapAttrs' system.activationScripts = mapAttrs' (
(name: opts: nameValuePair name: opts:
"${name}-profile-icon" nameValuePair "${name}-profile-icon" {
{ deps = [ "users" ];
deps = [ "users" ]; text =
text = let let
iconDest = "/var/lib/AccountsService/icons/${name}"; iconDest = "/var/lib/AccountsService/icons/${name}";
userConf = pkgs.writeText "${name}-config" '' userConf = pkgs.writeText "${name}-config" ''
[User] [User]
Session= Session=
Icon=${iconDest} Icon=${iconDest}
SystemAccount=false SystemAccount=false
''; '';
in '' in
install -Dm 0444 ${opts.picture} ${iconDest} ''
install -Dm 0400 ${userConf} /var/lib/AccountsService/users/${name} install -Dm 0444 ${opts.picture} ${iconDest}
''; install -Dm 0400 ${userConf} /var/lib/AccountsService/users/${name}
}) '';
(filterAttrs (n: _: n != "root") config.users.profiles); }
) (filterAttrs (n: _: n != "root") config.users.profiles);
# set up standard persistence for users # set up standard persistence for users
# this is registered internally for each software's configuration # this is registered internally for each software's configuration
environment.persistence."/nix/persist" = { environment.persistence."/nix/persist" = {
users = (mapAttrs (name: _: cfg.home.persist // { users = (
# root workaround, ugly but necessary mapAttrs (
# cannot get it properly for the same reason name: _:
# mentioned above in fileSystems cfg.home.persist
home = mkIf (name == "root") "/root"; // {
}) cfg.profiles); # root workaround, ugly but necessary
# cannot get it properly for the same reason
# mentioned above in fileSystems
home = mkIf (name == "root") "/root";
}
) cfg.profiles
);
hideMounts = true; hideMounts = true;
}; };

View file

@ -1,14 +1,27 @@
{ pkgs {
, lib pkgs,
, config lib,
, ... }: with lib; let config,
...
}:
with lib;
let
cfg = config.home.steam; cfg = config.home.steam;
in mkIf cfg.enable { in
mkIf cfg.enable {
hardware.steam-hardware.enable = true; hardware.steam-hardware.enable = true;
networking.firewall = { networking.firewall = {
allowedTCPPorts = [ 27015 27036 ]; allowedTCPPorts = [
27015
27036
];
allowedUDPPorts = [ 27015 ]; allowedUDPPorts = [ 27015 ];
allowedUDPPortRanges = [ { from = 27031; to = 27036; } ]; allowedUDPPortRanges = [
{
from = 27031;
to = 27036;
}
];
}; };
} }

View file

@ -1,17 +1,25 @@
{ pkgs {
, lib pkgs,
, config lib,
, ... }: with lib; let config,
...
}:
with lib;
let
cfg = config.passthrough.steam; cfg = config.passthrough.steam;
enable = cfg.enable && (cfg.allUsers || (config.home.username == "app")); enable = cfg.enable && (cfg.allUsers || (config.home.username == "app"));
package = config.programs.steam.package; package = config.programs.steam.package;
in mkIf enable { in
mkIf enable {
home.packages = with pkgs; [ home.packages = with pkgs; [
cfg.package cfg.package
cfg.package.run cfg.package.run
]; ];
wayland.windowManager.sway.config.window.commands = [ wayland.windowManager.sway.config.window.commands = [
{ criteria.class = "steam"; command = "floating enable"; } {
criteria.class = "steam";
command = "floating enable";
}
]; ];
} }

View file

@ -1,10 +1,18 @@
{ pkgs {
, lib pkgs,
, config lib,
, ... }: with lib; let config,
...
}:
with lib;
let
cfg = config.home.steam; cfg = config.home.steam;
persist = [ ".steam" ".local/share/Steam" ]; persist = [
in { ".steam"
".local/share/Steam"
];
in
{
imports = [ ./config.nix ]; imports = [ ./config.nix ];
options.home.steam = { options.home.steam = {

View file

@ -1,7 +1,11 @@
{ pkgs {
, lib pkgs,
, config lib,
, ... }: with lib; mkIf config.passthrough.gui { config,
...
}:
with lib;
mkIf config.passthrough.gui {
wayland.windowManager.sway = { wayland.windowManager.sway = {
enable = true; enable = true;
@ -12,33 +16,38 @@
config = { config = {
defaultWorkspace = "workspace number 1"; defaultWorkspace = "workspace number 1";
modifier = "Mod4"; modifier = "Mod4";
keybindings = let keybindings =
modifier = config.wayland.windowManager.sway.config.modifier; let
in mkOptionDefault { modifier = config.wayland.windowManager.sway.config.modifier;
XF86MonBrightnessUp = "light -A 5"; in
XF86MonBrightnessDown = "light -U 5"; mkOptionDefault {
XF86MonBrightnessUp = "light -A 5";
XF86MonBrightnessDown = "light -U 5";
"Control+Alt+l" = "exec swaylock -f --grace 0"; "Control+Alt+l" = "exec swaylock -f --grace 0";
"Print" = "exec ${pkgs.grim}/bin/grim - | ${pkgs.wl-clipboard}/bin/wl-copy"; "Print" = "exec ${pkgs.grim}/bin/grim - | ${pkgs.wl-clipboard}/bin/wl-copy";
"${modifier}+Print" = "exec ${pkgs.grim}/bin/grim -g \"$(${pkgs.slurp}/bin/slurp)\" - | ${pkgs.wl-clipboard}/bin/wl-copy"; "${modifier}+Print" =
"${modifier}+q" = "exec google-chrome-stable"; "exec ${pkgs.grim}/bin/grim -g \"$(${pkgs.slurp}/bin/slurp)\" - | ${pkgs.wl-clipboard}/bin/wl-copy";
"${modifier}+Home" = "exec ${pkgs.pavucontrol}/bin/pavucontrol"; "${modifier}+q" = "exec google-chrome-stable";
}; "${modifier}+Home" = "exec ${pkgs.pavucontrol}/bin/pavucontrol";
bars = [ {
mode = "dock";
position = "bottom";
workspaceButtons = true;
workspaceNumbers = true;
statusCommand = "${pkgs.i3status}/bin/i3status";
fonts = {
names = [ "monospace" ];
size = 8.0;
}; };
trayOutput = "primary";
# sets transparency bars = [
colors.background = "00000000"; {
} ]; mode = "dock";
position = "bottom";
workspaceButtons = true;
workspaceNumbers = true;
statusCommand = "${pkgs.i3status}/bin/i3status";
fonts = {
names = [ "monospace" ];
size = 8.0;
};
trayOutput = "primary";
# sets transparency
colors.background = "00000000";
}
];
input."*".natural_scroll = "enabled"; input."*".natural_scroll = "enabled";
input."type:touchpad".tap = "enabled"; input."type:touchpad".tap = "enabled";

View file

@ -1,36 +1,48 @@
{ pkgs {
, lib pkgs,
, config lib,
, ... }: with lib; let config,
...
}:
with lib;
let
gui = with config.global.gpu; enable && session; gui = with config.global.gpu; enable && session;
nvidia = with config.global.gpu; type == "nvidia" || type == "prime"; nvidia = with config.global.gpu; type == "nvidia" || type == "prime";
in mkIf gui { in
mkIf gui {
services.displayManager.sessionPackages = [ services.displayManager.sessionPackages = [
(pkgs.writeTextFile { (
name = "sway-session"; pkgs.writeTextFile {
destination = "/share/wayland-sessions/sway.desktop"; name = "sway-session";
text = '' destination = "/share/wayland-sessions/sway.desktop";
[Desktop Entry] text = ''
Name=Sway [Desktop Entry]
Comment=An i3-compatible Wayland compositor Name=Sway
Exec=${pkgs.writeTextFile { Comment=An i3-compatible Wayland compositor
name = "sway-wrapper"; Exec=${
executable = true; pkgs.writeTextFile {
text = '' name = "sway-wrapper";
#!${pkgs.zsh}/bin/zsh executable = true;
SHLVL=0 text = ''
for profile in ''${(z)NIX_PROFILES}; do #!${pkgs.zsh}/bin/zsh
fpath+=($profile/share/zsh/site-functions $profile/share/zsh/$ZSH_VERSION/functions $profile/share/zsh/vendor-completions) SHLVL=0
done for profile in ''${(z)NIX_PROFILES}; do
exec sway${if nvidia then " --unsupported-gpu" else ""} 2>&1 >> $XDG_CACHE_HOME/sway fpath+=($profile/share/zsh/site-functions $profile/share/zsh/$ZSH_VERSION/functions $profile/share/zsh/vendor-completions)
''; done
checkPhase = '' exec sway${if nvidia then " --unsupported-gpu" else ""} 2>&1 >> $XDG_CACHE_HOME/sway
${pkgs.stdenv.shellDryRun} "$target" '';
''; checkPhase = ''
}} ${pkgs.stdenv.shellDryRun} "$target"
Type=Application '';
''; }
} // { providedSessions = [ pkgs.sway.meta.mainProgram ]; }) }
Type=Application
'';
}
// {
providedSessions = [ pkgs.sway.meta.mainProgram ];
}
)
]; ];
programs.light.enable = true; programs.light.enable = true;

View file

@ -1,24 +1,40 @@
{ pkgs {
, lib pkgs,
, config lib,
, ... }: with lib; mkIf config.passthrough.gui { config,
services.swayidle = let ...
sway = config.wayland.windowManager.sway.package; }:
swaymsg = "${sway}/bin/swaymsg"; with lib;
swaylock = "${config.programs.swaylock.package}/bin/swaylock"; mkIf config.passthrough.gui {
in { services.swayidle =
enable = true; let
systemdTarget = "sway-session.target"; sway = config.wayland.windowManager.sway.package;
timeouts = [ swaymsg = "${sway}/bin/swaymsg";
{ timeout = 600; command = "${swaymsg} 'output * dpms off'"; resumeCommand = "${swaymsg} 'output * dpms on'"; } swaylock = "${config.programs.swaylock.package}/bin/swaylock";
]; in
events = [ {
{ event = "before-sleep"; command = "${swaylock} -f --grace 0"; } enable = true;
]; systemdTarget = "sway-session.target";
}; timeouts = [
{
timeout = 600;
command = "${swaymsg} 'output * dpms off'";
resumeCommand = "${swaymsg} 'output * dpms on'";
}
];
events = [
{
event = "before-sleep";
command = "${swaylock} -f --grace 0";
}
];
};
# fullscreen as simple idle inhibitor shortcut # fullscreen as simple idle inhibitor shortcut
wayland.windowManager.sway.config.window.commands = [ wayland.windowManager.sway.config.window.commands = [
{ criteria.shell = ".*"; command = "inhibit_idle fullscreen"; } {
criteria.shell = ".*";
command = "inhibit_idle fullscreen";
}
]; ];
} }

View file

@ -1,7 +1,11 @@
{ pkgs {
, lib pkgs,
, config lib,
, ... }: with lib; mkIf config.passthrough.gui { config,
...
}:
with lib;
mkIf config.passthrough.gui {
programs.swaylock = { programs.swaylock = {
enable = true; enable = true;
package = pkgs.swaylock-effects; package = pkgs.swaylock-effects;

View file

@ -1,8 +1,13 @@
{ pkgs {
, lib pkgs,
, config lib,
, ... }: with lib; let config,
...
}:
with lib;
let
gui = with config.global.gpu; enable && session; gui = with config.global.gpu; enable && session;
in mkIf gui { in
mkIf gui {
security.pam.services.swaylock = { }; security.pam.services.swaylock = { };
} }

View file

@ -1,33 +1,61 @@
{ pkgs {
, lib pkgs,
, config lib,
, ... }: with lib; let config,
...
}:
with lib;
let
cfg = config.passthrough.util; cfg = config.passthrough.util;
in { in
home.packages = with pkgs; [ {
pv file wget e2fsprogs home.packages =
] ++ optionals (!cfg.minimal) [ with pkgs;
tio mbuffer sedutil [
lsscsi zip unzip pv
nix-index dnsutils whois file
pciutils usbutils nvme-cli wget
] ++ optionals config.passthrough.gui [ e2fsprogs
gtk-engine-murrine ]
gnome-themes-extra ++ optionals (!cfg.minimal) [
tio
mbuffer
sedutil
lsscsi
zip
unzip
nix-index
dnsutils
whois
pciutils
usbutils
nvme-cli
]
++ optionals config.passthrough.gui [
gtk-engine-murrine
gnome-themes-extra
mission-planner mission-planner
inav-configurator inav-configurator
inav-blackbox-tools inav-blackbox-tools
(blhelisuite32.override { workdir = "${config.home.homeDirectory}/.blhelisuite32"; }) (blhelisuite32.override { workdir = "${config.home.homeDirectory}/.blhelisuite32"; })
] ++ optionals (config.passthrough.gui && !config.passthrough.flatpak.enable) [ ]
xfce.thunar gimp ++ optionals (config.passthrough.gui && !config.passthrough.flatpak.enable) [
jellyfin-media-player xfce.thunar
betaflight-configurator gimp
expresslrs-configurator jellyfin-media-player
]; betaflight-configurator
expresslrs-configurator
];
wayland.windowManager.sway.config.window.commands = mkIf config.passthrough.gui [ wayland.windowManager.sway.config.window.commands = mkIf config.passthrough.gui [
{ criteria.class = "BLHeliSuite32xl"; command = "floating enable"; } {
{ criteria.app_id = "thunar"; command = "floating enable"; } criteria.class = "BLHeliSuite32xl";
command = "floating enable";
}
{
criteria.app_id = "thunar";
command = "floating enable";
}
]; ];
} }

View file

@ -1,10 +1,15 @@
{ pkgs {
, lib pkgs,
, config lib,
, ... }: with lib; let config,
...
}:
with lib;
let
cfg = config.home.util; cfg = config.home.util;
gui = with config.global.gpu; enable && session; gui = with config.global.gpu; enable && session;
in { in
{
options.home.util = { options.home.util = {
minimal = mkEnableOption "minimal system environment with less packages"; minimal = mkEnableOption "minimal system environment with less packages";
}; };
@ -20,25 +25,26 @@ in {
programs.zsh.enable = true; programs.zsh.enable = true;
environment.shells = singleton pkgs.zsh; environment.shells = singleton pkgs.zsh;
users.home.persist.directories = [ ] ++ users.home.persist.directories =
optionals (!cfg.minimal) [ [ ]
".cache/nix-index" ++ optionals (!cfg.minimal) [
] ++ ".cache/nix-index"
optionals gui [ ]
# mission-planner ++ optionals gui [
".local/share/Mission Planner" # mission-planner
# inav-configurator ".local/share/Mission Planner"
".config/inav-configurator" # inav-configurator
] ++ ".config/inav-configurator"
optionals (gui && !config.global.flatpak.enable) [ ]
# jellyfin-media-player ++ optionals (gui && !config.global.flatpak.enable) [
".config/jellyfin.org" # jellyfin-media-player
".local/share/jellyfinmediaplayer" ".config/jellyfin.org"
".local/share/Jellyfin Media Player" ".local/share/jellyfinmediaplayer"
# expresslrs-configurator ".local/share/Jellyfin Media Player"
".config/ExpressLRS Configurator" # expresslrs-configurator
# betaflight-configurator ".config/ExpressLRS Configurator"
".config/betaflight-configurator" # betaflight-configurator
]; ".config/betaflight-configurator"
];
}; };
} }

View file

@ -1,58 +1,73 @@
{ pkgs {
, lib pkgs,
, config lib,
, ... }: with lib; mkIf config.passthrough.gui { config,
dconf.settings = let ...
p = "org/virt-manager/virt-manager"; }:
in { with lib;
${p} = { mkIf config.passthrough.gui {
xmleditor-enabled = true; dconf.settings =
# swaybar tray doesn't really work let
system-tray = false; p = "org/virt-manager/virt-manager";
}; in
{
${p} = {
xmleditor-enabled = true;
# swaybar tray doesn't really work
system-tray = false;
};
"${p}/details".show-toolbar = true; "${p}/details".show-toolbar = true;
"${p}/console" = { "${p}/console" = {
scaling = 0; scaling = 0;
auto-redirect = false; auto-redirect = false;
resize-guest = 1; resize-guest = 1;
}; };
"${p}/stats" = { "${p}/stats" = {
enable-memory-poll = true; enable-memory-poll = true;
enable-disk-poll = true; enable-disk-poll = true;
enable-net-poll = true; enable-net-poll = true;
}; };
"${p}/vmlist-fields" = { "${p}/vmlist-fields" = {
host-cpu-usage = true; host-cpu-usage = true;
memory-usage = true; memory-usage = true;
disk-usage = true; disk-usage = true;
network-traffic = true; network-traffic = true;
}; };
"${p}/new-vm" = { "${p}/new-vm" = {
firmware = "uefi"; firmware = "uefi";
graphics-type = "system"; graphics-type = "system";
}; };
"${p}/confirm" = { "${p}/confirm" = {
unapplied-dev = true; unapplied-dev = true;
removedev = true; removedev = true;
delete-storage = true; delete-storage = true;
forcepoweroff = false; forcepoweroff = false;
}; };
"${p}/connections" = let "${p}/connections" =
uri = "qemu:///system"; let
in { uri = "qemu:///system";
uris = [ uri ]; in
autoconnect = [ uri ]; {
uris = [ uri ];
autoconnect = [ uri ];
};
"${p}/conns/qemu:system".pretty-name = "KVM";
}; };
"${p}/conns/qemu:system".pretty-name = "KVM";
};
# floating other than main window # floating other than main window
wayland.windowManager.sway.config.window.commands = [ wayland.windowManager.sway.config.window.commands = [
{ criteria.app_id = "virt-manager"; command = "floating enable"; } {
{ criteria.app_id = "virt-manager"; criteria.title = "Virtual Machine Manager"; command = "floating disable"; } criteria.app_id = "virt-manager";
command = "floating enable";
}
{
criteria.app_id = "virt-manager";
criteria.title = "Virtual Machine Manager";
command = "floating disable";
}
]; ];
} }

View file

@ -1,8 +1,13 @@
{ pkgs {
, lib pkgs,
, config lib,
, ... }: with lib; let config,
...
}:
with lib;
let
gui = with config.global.gpu; enable && session; gui = with config.global.gpu; enable && session;
in mkIf gui { in
mkIf gui {
programs.virt-manager.enable = true; programs.virt-manager.enable = true;
} }

View file

@ -1,10 +1,15 @@
{ pkgs {
, lib pkgs,
, config lib,
, ... }: with lib; let config,
...
}:
with lib;
let
cfg = config.passthrough.vscode; cfg = config.passthrough.vscode;
theme = config.passthrough.catppuccin.enable; theme = config.passthrough.catppuccin.enable;
in mkIf cfg.enable { in
mkIf cfg.enable {
programs.vscode = { programs.vscode = {
enable = true; enable = true;
mutableExtensionsDir = false; mutableExtensionsDir = false;
@ -12,8 +17,11 @@ in mkIf cfg.enable {
enableExtensionUpdateCheck = false; enableExtensionUpdateCheck = false;
package = pkgs.vscodium; package = pkgs.vscodium;
extensions = with pkgs.vscode-extensions; [ extensions = with pkgs.vscode-extensions; [
catppuccin.catppuccin-vsc catppuccin.catppuccin-vsc-icons catppuccin.catppuccin-vsc
bbenoist.nix golang.go rust-lang.rust-analyzer catppuccin.catppuccin-vsc-icons
bbenoist.nix
golang.go
rust-lang.rust-analyzer
]; ];
userSettings = { userSettings = {
"workbench.colorTheme" = mkIf theme "Catppuccin Mocha"; "workbench.colorTheme" = mkIf theme "Catppuccin Mocha";

View file

@ -1,9 +1,14 @@
{ pkgs {
, lib pkgs,
, config lib,
, ... }: with lib; let config,
...
}:
with lib;
let
cfg = config.home.vscode; cfg = config.home.vscode;
in { in
{
options.home.vscode = { options.home.vscode = {
enable = mkEnableOption "vscode text editor"; enable = mkEnableOption "vscode text editor";
}; };

View file

@ -1,7 +1,11 @@
{ pkgs {
, lib pkgs,
, config lib,
, ... }: with lib; mkIf config.passthrough.gui { config,
...
}:
with lib;
mkIf config.passthrough.gui {
programs.wofi = { programs.wofi = {
enable = true; enable = true;
settings.mode = "drun"; settings.mode = "drun";

View file

@ -1,21 +1,26 @@
{ config {
, ... }: { config,
...
}:
{
xdg = { xdg = {
enable = true; enable = true;
userDirs = let userDirs =
home = config.home.homeDirectory; let
local = "${home}/local"; home = config.home.homeDirectory;
in { local = "${home}/local";
enable = true; in
createDirectories = true; {
download = "${home}/dl"; enable = true;
desktop = "${local}/desktop"; createDirectories = true;
documents = "${local}/documents"; download = "${home}/dl";
music = "${local}/music"; desktop = "${local}/desktop";
pictures = "${local}/pictures"; documents = "${local}/documents";
publicShare = "${local}/public"; music = "${local}/music";
templates = "${local}/templates"; pictures = "${local}/pictures";
videos = "${local}/videos"; publicShare = "${local}/public";
}; templates = "${local}/templates";
videos = "${local}/videos";
};
}; };
} }

View file

@ -1,3 +1,6 @@
{ {
users.home.persist.directories = [ "local" "dl" ]; users.home.persist.directories = [
"local"
"dl"
];
} }

View file

@ -1,24 +1,32 @@
{ config {
, ... }: { config,
...
}:
{
programs.zsh = { programs.zsh = {
enable = true; enable = true;
autocd = false; autocd = false;
defaultKeymap = "emacs"; defaultKeymap = "emacs";
localVariables.PROMPT = let localVariables.PROMPT =
op = { let
res = "%{$reset_color%}"; op = {
col = color: "%{$fg[${color}]%}"; res = "%{$reset_color%}";
}; col = color: "%{$fg[${color}]%}";
c = color: text: "${op.col color}${text}${op.res}"; };
in "${c "green" "%n"}${c "cyan" "@"}${c "yellow" "%m"} ${c "magenta" "<3"} %~ ${c "blue" "$PARTICLE"}${c "red" "%#"} "; c = color: text: "${op.col color}${text}${op.res}";
in
"${c "green" "%n"}${c "cyan" "@"}${c "yellow" "%m"} ${c "magenta" "<3"} %~ ${c "blue" "$PARTICLE"}${c "red" "%#"} ";
sessionVariables.LIBVIRT_DEFAULT_URI = "qemu:///system"; sessionVariables.LIBVIRT_DEFAULT_URI = "qemu:///system";
history = { history = {
extended = true; extended = true;
path = "${config.home.homeDirectory}/.local/state/zsh/history"; path = "${config.home.homeDirectory}/.local/state/zsh/history";
ignorePatterns = [ ignorePatterns = [
"rm *" "reboot" "rm *"
"kill *" "killall *" "pkill *" "reboot"
"kill *"
"killall *"
"pkill *"
]; ];
}; };

View file

@ -1,3 +1,8 @@
{ {
users.home.persist.directories = [ { directory = ".local/state/zsh"; mode = "0700"; } ]; users.home.persist.directories = [
{
directory = ".local/state/zsh";
mode = "0700";
}
];
} }

View file

@ -1,11 +1,14 @@
{ lib {
, libicns lib,
, p7zip libicns,
, fetchzip p7zip,
, stdenvNoCC fetchzip,
, makeDesktopItem stdenvNoCC,
, buildFHSEnv makeDesktopItem,
, workdir ? "/tmp/blhelisuite32" }: let buildFHSEnv,
workdir ? "/tmp/blhelisuite32",
}:
let
name = "BLHeliSuite32"; name = "BLHeliSuite32";
pname = "blhelisuite32"; pname = "blhelisuite32";
version = "32.10"; version = "32.10";
@ -35,7 +38,10 @@
hash = "sha256-StRnrVI8p51vNsTMO1LtaZvENbG7XZ1V/mKHe4pO7kU="; hash = "sha256-StRnrVI8p51vNsTMO1LtaZvENbG7XZ1V/mKHe4pO7kU=";
}; };
nativeBuildInputs = [ libicns p7zip ]; nativeBuildInputs = [
libicns
p7zip
];
configurePhase = '' configurePhase = ''
7z x *.dmg 7z x *.dmg
@ -53,7 +59,11 @@
linked = stdenvNoCC.mkDerivation { linked = stdenvNoCC.mkDerivation {
inherit pname version; inherit pname version;
phases = [ "unpackPhase" "patchPhase" "installPhase" ]; phases = [
"unpackPhase"
"patchPhase"
"installPhase"
];
src = dist; src = dist;
installPhase = '' installPhase = ''
@ -64,29 +74,40 @@
ln -s ${workdir}/music $out/Music ln -s ${workdir}/music $out/Music
''; '';
}; };
in buildFHSEnv { in
buildFHSEnv {
inherit pname version; inherit pname version;
targetPkgs = pkgs: (with pkgs; [ targetPkgs =
glib libGL curl pkgs:
libgcc gtk3 (with pkgs; [
zlib systemdLibs glib
]); libGL
extraInstallCommands = let curl
mkIconScale = scale: libgcc
"install -m 444 -D ${icons}/${name}xm_${scale}x${scale}x32.png $out/share/icons/hicolor/${scale}x${scale}/apps/${pname}.png"; gtk3
in '' zlib
${mkIconScale "16"} systemdLibs
${mkIconScale "32"} ]);
${mkIconScale "64"} extraInstallCommands =
${mkIconScale "128"} let
${mkIconScale "256"} mkIconScale =
${mkIconScale "512"} scale:
${mkIconScale "1024"} "install -m 444 -D ${icons}/${name}xm_${scale}x${scale}x32.png $out/share/icons/hicolor/${scale}x${scale}/apps/${pname}.png";
cp -r ${desktopItem}/share/applications $out/share/ in
''; ''
${mkIconScale "16"}
${mkIconScale "32"}
${mkIconScale "64"}
${mkIconScale "128"}
${mkIconScale "256"}
${mkIconScale "512"}
${mkIconScale "1024"}
cp -r ${desktopItem}/share/applications $out/share/
'';
runScript = "sh -c '" + runScript =
"mkdir -p ${workdir}/settings && " + "sh -c '"
"mkdir -p ${workdir}/music && " + + "mkdir -p ${workdir}/settings && "
"exec ${linked}/${name}xl'"; + "mkdir -p ${workdir}/music && "
+ "exec ${linked}/${name}xl'";
} }

View file

@ -1,15 +1,22 @@
{ lib, ... }: { { lib, ... }:
nixpkgs.overlays = [ (final: prev: {
builtins.listToAttrs (map (pkg: { nixpkgs.overlays = [
name = pkg; (
value = let final: prev:
argsPath = ./${pkg}/args.nix; builtins.listToAttrs (
in final.callPackage ./${pkg} map (pkg: {
(if (builtins.pathExists argsPath) then name = pkg;
(import argsPath final) value =
else { }); let
}) (builtins.attrNames (builtins.readDir ./.))) argsPath = ./${pkg}/args.nix;
) ]; in
final.callPackage ./${pkg} (
if (builtins.pathExists argsPath) then (import argsPath final) else { }
);
}) (builtins.attrNames (builtins.readDir ./.))
)
)
];
imports = lib.pipe ./. [ imports = lib.pipe ./. [
builtins.readDir builtins.readDir

View file

@ -1,8 +1,11 @@
{ lib {
, fetchzip lib,
, makeDesktopItem fetchzip,
, imagemagick makeDesktopItem,
, buildFHSEnv }: let imagemagick,
buildFHSEnv,
}:
let
name = "ExpressLRS-Configurator"; name = "ExpressLRS-Configurator";
pname = "expresslrs-configurator"; pname = "expresslrs-configurator";
version = "1.7.2"; version = "1.7.2";
@ -22,24 +25,70 @@
desktopName = "ExpressLRS Configurator"; desktopName = "ExpressLRS Configurator";
genericName = "radio link configuration & build tool"; genericName = "radio link configuration & build tool";
}; };
in buildFHSEnv { in
buildFHSEnv {
inherit pname version; inherit pname version;
# copied from chromium deps # copied from chromium deps
targetPkgs = pkgs: (with pkgs; [ targetPkgs =
glib fontconfig freetype pango cairo xorg.libX11 xorg.libXi atk nss nspr pkgs:
xorg.libXcursor xorg.libXext xorg.libXfixes xorg.libXrender (with pkgs; [
xorg.libXScrnSaver xorg.libXcomposite xorg.libxcb glib
alsa-lib xorg.libXdamage xorg.libXtst xorg.libXrandr xorg.libxshmfence expat cups fontconfig
dbus gdk-pixbuf gcc-unwrapped.lib freetype
systemd pango
libexif pciutils cairo
liberation_ttf curl util-linux wget xorg.libX11
flac harfbuzz icu libpng libopus snappy speechd xorg.libXi
bzip2 libcap at-spi2-atk at-spi2-core atk
libkrb5 libdrm libglvnd mesa coreutils nss
libxkbcommon pipewire wayland nspr
libva gtk3 gtk4 xorg.libXcursor
]); xorg.libXext
xorg.libXfixes
xorg.libXrender
xorg.libXScrnSaver
xorg.libXcomposite
xorg.libxcb
alsa-lib
xorg.libXdamage
xorg.libXtst
xorg.libXrandr
xorg.libxshmfence
expat
cups
dbus
gdk-pixbuf
gcc-unwrapped.lib
systemd
libexif
pciutils
liberation_ttf
curl
util-linux
wget
flac
harfbuzz
icu
libpng
libopus
snappy
speechd
bzip2
libcap
at-spi2-atk
at-spi2-core
libkrb5
libdrm
libglvnd
mesa
coreutils
libxkbcommon
pipewire
wayland
libva
gtk3
gtk4
]);
extraInstallCommands = '' extraInstallCommands = ''
mkdir -p $out/share mkdir -p $out/share
${imagemagick}/bin/convert ${dist}/resources/assets/icon.png -resize 128x128 icon-128.png ${imagemagick}/bin/convert ${dist}/resources/assets/icon.png -resize 128x128 icon-128.png

View file

@ -1,18 +1,21 @@
{ lib {
, pkg-config lib,
, libjpeg_turbo pkg-config,
, libheif libjpeg_turbo,
, lapack libheif,
, dlib lapack,
, blas dlib,
, ffmpeg blas,
, exiftool ffmpeg,
, darktable exiftool,
, fetchFromGitHub darktable,
, buildGoModule fetchFromGitHub,
, buildNpmPackage buildGoModule,
, runCommandLocal buildNpmPackage,
, makeWrapper }: buildGoModule rec { runCommandLocal,
makeWrapper,
}:
buildGoModule rec {
pname = "photoview"; pname = "photoview";
version = "2.4.0"; version = "2.4.0";
@ -45,7 +48,7 @@
#REACT_APP_API_ENDPOINT = ""; #REACT_APP_API_ENDPOINT = "";
REACT_APP_BUILD_VERSION = version; REACT_APP_BUILD_VERSION = version;
REACT_APP_BUILD_DATE = builtins.readFile (runCommandLocal "date" { } "date -uI > $out" ); REACT_APP_BUILD_DATE = builtins.readFile (runCommandLocal "date" { } "date -uI > $out");
REACT_APP_BUILD_COMMIT_SHA = "nix"; REACT_APP_BUILD_COMMIT_SHA = "nix";
npmDepsHash = "sha256-wUbfq+7SuJUBxfy9TxHVda8A0g4mmYCbzJT64XBN2mI="; npmDepsHash = "sha256-wUbfq+7SuJUBxfy9TxHVda8A0g4mmYCbzJT64XBN2mI=";
@ -56,11 +59,13 @@
mv "$out/bin/api" "$out/bin/${pname}" mv "$out/bin/api" "$out/bin/${pname}"
wrapProgram $out/bin/${pname} \ wrapProgram $out/bin/${pname} \
--prefix PATH ":" "${lib.makeBinPath [ --prefix PATH ":" "${
ffmpeg lib.makeBinPath [
exiftool ffmpeg
darktable exiftool
]}" \ darktable
]
}" \
--set PHOTOVIEW_SERVE_UI 1 \ --set PHOTOVIEW_SERVE_UI 1 \
--set PHOTOVIEW_UI_PATH "$out/lib/${pname}/ui" --set PHOTOVIEW_UI_PATH "$out/lib/${pname}/ui"
cp -r \ cp -r \

View file

@ -1,9 +1,14 @@
{ pkgs {
, lib pkgs,
, config lib,
, ... }: with lib; let config,
...
}:
with lib;
let
cfg = config.services.photoview; cfg = config.services.photoview;
in { in
{
options.services.photoview = { options.services.photoview = {
enable = mkEnableOption "photoview server"; enable = mkEnableOption "photoview server";
@ -39,7 +44,13 @@ in {
database = { database = {
driver = mkOption { driver = mkOption {
type = with types; enum [ "sqlite" "mysql" "postgres" ]; type =
with types;
enum [
"sqlite"
"mysql"
"postgres"
];
default = "sqlite"; default = "sqlite";
description = "database driver"; description = "database driver";
}; };

View file

@ -1,43 +1,68 @@
{ lib {
, stdenvNoCC lib,
, ffmpeg stdenvNoCC,
, rtmpdump ffmpeg,
, atomicparsley rtmpdump,
, callPackage atomicparsley,
, fetchFromGitHub callPackage,
, fetchPypi fetchFromGitHub,
, fetchpatch fetchPypi,
, makeWrapper fetchpatch,
, python3Packages }: with python3Packages; let makeWrapper,
mkPypi = pname: version: src: format: buildPythonPackage { python3Packages,
inherit pname version src format; }:
doCheck = false; with python3Packages;
nativeBuildInputs = [ setuptools ]; let
}; mkPypi =
pname: version: src: format:
buildPythonPackage {
inherit
pname
version
src
format
;
doCheck = false;
nativeBuildInputs = [ setuptools ];
};
mkPypi' = pname: version: hash: format: mkPypi pname version mkPypi' =
(fetchPypi { pname: version: hash: format:
inherit pname version hash; mkPypi pname version (fetchPypi {
}) format; inherit pname version hash;
}) format;
mkPypi'' = pname: version: hash: mkPypi' pname version hash mkPypi'' =
"setuptools"; pname: version: hash:
mkPypi' pname version hash "setuptools";
django-compat = mkPypi'' "django-compat" "1.0.15" "sha256-OsmjvtxWuTZdnrJBvFFX0MGTdpv5lfmnjcG8JOfCMxs="; django-compat =
django-appconf = mkPypi'' "django-appconf" "1.0.6" "sha256-z+h+qCfE7gS5pw+rkLhtcEywLymB+J2oQjyw+r+I778="; mkPypi'' "django-compat" "1.0.15"
django-basicauth = mkPypi'' "django-basicauth" "0.5.3" "sha256-FenjZvaY9TxxseeU2v6gYPmQoqxVa65rczDdJTJKCRw="; "sha256-OsmjvtxWuTZdnrJBvFFX0MGTdpv5lfmnjcG8JOfCMxs=";
django-sass-processor = mkPypi'' "django-sass-processor" "1.4" "sha256-sX850H06dRCuxCXBkZN+IwUC3ut8pr9pUKGt+LS3wcM="; django-appconf =
django-background-tasks = mkPypi'' "django-background-tasks" "1.2.5" "sha256-4bGejUlaJ2ydZMWh/4tBEy910vWORb5xt4ZQ2tWa+d4="; mkPypi'' "django-appconf" "1.0.6"
"sha256-z+h+qCfE7gS5pw+rkLhtcEywLymB+J2oQjyw+r+I778=";
django-basicauth =
mkPypi'' "django-basicauth" "0.5.3"
"sha256-FenjZvaY9TxxseeU2v6gYPmQoqxVa65rczDdJTJKCRw=";
django-sass-processor =
mkPypi'' "django-sass-processor" "1.4"
"sha256-sX850H06dRCuxCXBkZN+IwUC3ut8pr9pUKGt+LS3wcM=";
django-background-tasks =
mkPypi'' "django-background-tasks" "1.2.5"
"sha256-4bGejUlaJ2ydZMWh/4tBEy910vWORb5xt4ZQ2tWa+d4=";
django-compressor = let django-compressor =
pname = "django-compressor"; let
version = "4.4"; pname = "django-compressor";
in mkPypi pname version (fetchFromGitHub { version = "4.4";
owner = pname; in
repo = pname; mkPypi pname version (fetchFromGitHub {
rev = "refs/tags/${version}"; owner = pname;
hash = "sha256-c9uS5Z077b23Aj8jV30XNsshbEfrLRX3ozXasitQ6UQ="; repo = pname;
}) "setuptools"; rev = "refs/tags/${version}";
hash = "sha256-c9uS5Z077b23Aj8jV30XNsshbEfrLRX3ozXasitQ6UQ=";
}) "setuptools";
app = buildPythonApplication rec { app = buildPythonApplication rec {
pname = "tubesync"; pname = "tubesync";
@ -59,22 +84,30 @@
./ensure-fragments.patch ./ensure-fragments.patch
]; ];
propagatedBuildInputs = [ propagatedBuildInputs =
yt-dlp requests [
httptools pillow yt-dlp
gunicorn whitenoise requests
psycopg2 mysqlclient httptools
redis hiredis pillow
libsass six gunicorn
] ++ [ whitenoise
django_3 psycopg2
django-compat mysqlclient
django-appconf redis
django-compressor hiredis
django-basicauth libsass
django-sass-processor six
django-background-tasks ]
]; ++ [
django_3
django-compat
django-appconf
django-compressor
django-basicauth
django-sass-processor
django-background-tasks
];
buildPhase = '' buildPhase = ''
mv "tubesync/tubesync/local_settings.py.container" "tubesync/tubesync/local_settings.py" mv "tubesync/tubesync/local_settings.py.container" "tubesync/tubesync/local_settings.py"
@ -97,40 +130,51 @@
''; '';
}; };
ffmpegFix = ffmpeg.overrideAttrs (finalAttrs: previousAttrs: { ffmpegFix = ffmpeg.overrideAttrs (
patches = previousAttrs.patches ++ [ (fetchpatch { finalAttrs: previousAttrs: {
name = "avformat-webvttdec-skip-style-region.patch"; patches = previousAttrs.patches ++ [
url = "https://git.ffmpeg.org/gitweb/ffmpeg.git/patch/51d303e20cbb0874172f50b5172c515a973587d4"; (fetchpatch {
hash = "sha256-dxCjKZUz2H2QyktsprkzyfNp5aDG6X8deF4ZGdvhvfk="; name = "avformat-webvttdec-skip-style-region.patch";
}) ]; url = "https://git.ffmpeg.org/gitweb/ffmpeg.git/patch/51d303e20cbb0874172f50b5172c515a973587d4";
}); hash = "sha256-dxCjKZUz2H2QyktsprkzyfNp5aDG6X8deF4ZGdvhvfk=";
in stdenvNoCC.mkDerivation { })
];
}
);
in
stdenvNoCC.mkDerivation {
pname = "${app.pname}-wrapped"; pname = "${app.pname}-wrapped";
inherit (app) version; inherit (app) version;
nativeBuildInputs = [ makeWrapper ]; nativeBuildInputs = [ makeWrapper ];
unpackPhase = "true"; unpackPhase = "true";
installPhase = let installPhase =
prefix = ''--prefix PATH : "${lib.makeBinPath [ let
ffmpegFix rtmpdump atomicparsley prefix = ''--prefix PATH : "${
]}"''; lib.makeBinPath [
in '' ffmpegFix
mkdir -p "$out/bin" rtmpdump
atomicparsley
]
}"'';
in
''
mkdir -p "$out/bin"
makeWrapper "${python}/bin/python3" "$out/bin/tubesync-worker" \ makeWrapper "${python}/bin/python3" "$out/bin/tubesync-worker" \
--chdir ${app}/app --add-flags \ --chdir ${app}/app --add-flags \
"${app}/app/manage.py process_tasks" \ "${app}/app/manage.py process_tasks" \
${prefix} ${prefix}
makeWrapper "${gunicorn}/bin/gunicorn" "$out/bin/tubesync-gunicorn" \ makeWrapper "${gunicorn}/bin/gunicorn" "$out/bin/tubesync-gunicorn" \
--chdir ${app}/app --add-flags \ --chdir ${app}/app --add-flags \
"-c ${app}/app/tubesync/gunicorn.py --capture-output tubesync.wsgi:application" \ "-c ${app}/app/tubesync/gunicorn.py --capture-output tubesync.wsgi:application" \
${prefix} ${prefix}
makeWrapper "${python}/bin/python3" "$out/bin/tubesync-migrate" \ makeWrapper "${python}/bin/python3" "$out/bin/tubesync-migrate" \
--chdir "${app}/app" --add-flags \ --chdir "${app}/app" --add-flags \
"${app}/app/manage.py migrate" "${app}/app/manage.py migrate"
''; '';
passthru = { passthru = {
inherit app; inherit app;

View file

@ -1,9 +1,14 @@
{ pkgs {
, lib pkgs,
, config lib,
, ... }: with lib; let config,
...
}:
with lib;
let
cfg = config.services.tubesync; cfg = config.services.tubesync;
in { in
{
options.services.tubesync = { options.services.tubesync = {
enable = mkEnableOption "tubesync stack"; enable = mkEnableOption "tubesync stack";
debug = mkEnableOption "debug logging"; debug = mkEnableOption "debug logging";
@ -63,100 +68,107 @@ in {
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
systemd.services = let systemd.services =
env = { let
GUNICORN_PID_FILE = "${cfg.stateDir}/run/gunicorn.pid"; env = {
GUNICORN_USER = cfg.user; GUNICORN_PID_FILE = "${cfg.stateDir}/run/gunicorn.pid";
GUNICORN_GROUP = cfg.group; GUNICORN_USER = cfg.user;
DATABASE_CONNECTION = cfg.database; GUNICORN_GROUP = cfg.group;
CONFIG_BASE_DIR = cfg.stateDir; DATABASE_CONNECTION = cfg.database;
DOWNLOADS_BASE_DIR = cfg.dataDir; CONFIG_BASE_DIR = cfg.stateDir;
TUBESYNC_DEBUG = mkIf cfg.debug "True"; DOWNLOADS_BASE_DIR = cfg.dataDir;
TUBESYNC_WORKERS = toString cfg.workers; TUBESYNC_DEBUG = mkIf cfg.debug "True";
TUBESYNC_WORKERS = toString cfg.workers;
PYTHONPATH = cfg.package.pythonPath; PYTHONPATH = cfg.package.pythonPath;
REDIS_CONNECTION = "redis+socket://" REDIS_CONNECTION = "redis+socket://" + "${cfg.stateDir}/run/redis.sock";
+ "${cfg.stateDir}/run/redis.sock";
};
base = description: {
description = "tubesync: ${description}";
wantedBy = [ "multi-user.target" ];
environment = env;
path = [ cfg.package ];
serviceConfig = {
WorkingDirectory = cfg.stateDir;
User = cfg.user;
Group = cfg.group;
LockPersonality = true;
MemoryDenyWriteExecute = true;
NoNewPrivileges = true;
PrivateTmp = true;
PrivateDevices = true;
PrivateUsers = false;
ProtectClock = true;
ProtectControlGroups = true;
ProtectHome = true;
ProtectHostname = true;
ProtectKernelLogs = true;
ProtectKernelModules = true;
ProtectKernelTunables = true;
ProtectProc = "invisible";
ProcSubset = "all";
ProtectSystem = "strict";
RemoveIPC = true;
ReadWritePaths = with cfg; [ stateDir dataDir ];
RestrictAddressFamilies = [
"AF_INET"
"AF_INET6"
"AF_NETLINK"
"AF_UNIX"
];
SystemCallArchitectures = "native";
SystemCallFilter = [
"@system-service"
"~@privileged"
"@chown"
];
#UMask = "0077";
}; };
};
base' = description: (base description) // { base = description: {
after = [ "tubesync.service" ]; description = "tubesync: ${description}";
partOf = [ "tubesync.service" ]; wantedBy = [ "multi-user.target" ];
}; environment = env;
in { path = [ cfg.package ];
tubesync = recursiveUpdate (base "gunicorn") ({ serviceConfig = {
after = [ "network.target" ]; WorkingDirectory = cfg.stateDir;
serviceConfig = { User = cfg.user;
PIDFile = env.GUNICORN_PID_FILE; Group = cfg.group;
ExecStartPre = pkgs.writeShellScript "tubesync-setup" '' LockPersonality = true;
set -xe MemoryDenyWriteExecute = true;
tubesync-migrate NoNewPrivileges = true;
mkdir -p "${cfg.stateDir}/run" PrivateTmp = true;
PrivateDevices = true;
mkdir -p "/tmp/tubesync" PrivateUsers = false;
cp -r "${cfg.package.app}/static/." "/tmp/tubesync/static" ProtectClock = true;
chmod +w -R "/tmp/tubesync/static" ProtectControlGroups = true;
''; ProtectHome = true;
ExecStart = "${cfg.package}/bin/tubesync-gunicorn"; ProtectHostname = true;
ExecReload = "/usr/bin/env kill -s HUP $MAINPID"; ProtectKernelLogs = true;
ExecStop = "/usr/bin/env kill -s TERM $MAINPID"; ProtectKernelModules = true;
ExecStopPost = pkgs.writeShellScript "tubesync-cleanup" '' ProtectKernelTunables = true;
rm -f "$GUNICORN_PID_FILE" ProtectProc = "invisible";
rm -rf "/tmp/tubesync" ProcSubset = "all";
''; ProtectSystem = "strict";
RemoveIPC = true;
ReadWritePaths = with cfg; [
stateDir
dataDir
];
RestrictAddressFamilies = [
"AF_INET"
"AF_INET6"
"AF_NETLINK"
"AF_UNIX"
];
SystemCallArchitectures = "native";
SystemCallFilter = [
"@system-service"
"~@privileged"
"@chown"
];
#UMask = "0077";
};
}; };
});
tubesync-worker = recursiveUpdate (base' "worker") ({ base' =
serviceConfig.ExecStart = "${cfg.package}/bin/tubesync-worker"; description:
}); (base description)
// {
after = [ "tubesync.service" ];
partOf = [ "tubesync.service" ];
};
in
{
tubesync = recursiveUpdate (base "gunicorn") ({
after = [ "network.target" ];
serviceConfig = {
PIDFile = env.GUNICORN_PID_FILE;
ExecStartPre = pkgs.writeShellScript "tubesync-setup" ''
set -xe
tubesync-migrate
mkdir -p "${cfg.stateDir}/run"
# allow binding to unix socket mkdir -p "/tmp/tubesync"
redis-tubesync-celery.serviceConfig.ReadWritePaths = [ "${cfg.stateDir}/run" ]; cp -r "${cfg.package.app}/static/." "/tmp/tubesync/static"
}; chmod +w -R "/tmp/tubesync/static"
'';
ExecStart = "${cfg.package}/bin/tubesync-gunicorn";
ExecReload = "/usr/bin/env kill -s HUP $MAINPID";
ExecStop = "/usr/bin/env kill -s TERM $MAINPID";
ExecStopPost = pkgs.writeShellScript "tubesync-cleanup" ''
rm -f "$GUNICORN_PID_FILE"
rm -rf "/tmp/tubesync"
'';
};
});
tubesync-worker = recursiveUpdate (base' "worker") ({
serviceConfig.ExecStart = "${cfg.package}/bin/tubesync-worker";
});
# allow binding to unix socket
redis-tubesync-celery.serviceConfig.ReadWritePaths = [ "${cfg.stateDir}/run" ];
};
services.redis.servers.tubesync-celery = { services.redis.servers.tubesync-celery = {
enable = true; enable = true;

View file

@ -1,14 +1,21 @@
{ inputs, ... }: with inputs; with nixpkgs.lib; let { inputs, ... }:
with inputs;
with nixpkgs.lib;
let
mapInputs = fn: map fn (lists.remove "self" (attrNames inputs)); mapInputs = fn: map fn (lists.remove "self" (attrNames inputs));
channelPath = "/etc/nix/channels"; channelPath = "/etc/nix/channels";
in { in
{
nix = { nix = {
nixPath = mapInputs (i: "${i}=${channelPath}/${i}"); nixPath = mapInputs (i: "${i}=${channelPath}/${i}");
registry = listToAttrs registry = listToAttrs (
(mapInputs (name: { mapInputs (name: {
inherit name; inherit name;
value = {flake = inputs.${name};}; value = {
})); flake = inputs.${name};
};
})
);
}; };
systemd.tmpfiles.rules = mapInputs (i: "L+ ${channelPath}/${i} - - - - ${inputs.${i}.outPath}"); systemd.tmpfiles.rules = mapInputs (i: "L+ ${channelPath}/${i} - - - - ${inputs.${i}.outPath}");

View file

@ -1,4 +1,5 @@
{ pkgs, ... }: { { pkgs, ... }:
{
global = { global = {
id = "5d3c16fe58444e12ad621600039f10af"; id = "5d3c16fe58444e12ad621600039f10af";
fs.esp.uuid = "32A5-6257"; fs.esp.uuid = "32A5-6257";
@ -7,7 +8,10 @@
fs.external.enable = true; fs.external.enable = true;
fs.external.device = "/dev/disk/by-uuid/af2b8ec5-62d8-4b14-8ba8-083cc4fb33f4"; fs.external.device = "/dev/disk/by-uuid/af2b8ec5-62d8-4b14-8ba8-083cc4fb33f4";
fs.external.fsType = "btrfs"; fs.external.fsType = "btrfs";
fs.external.options = [ "noatime" "compress=zstd" ]; fs.external.options = [
"noatime"
"compress=zstd"
];
fs.cryptsetup.enable = true; fs.cryptsetup.enable = true;
fs.cryptsetup.uuids.nix = "3905f87f-7b11-49ef-8ddf-f4202c555ffd"; fs.cryptsetup.uuids.nix = "3905f87f-7b11-49ef-8ddf-f4202c555ffd";
fs.cryptsetup.uuids.persist = "b2322f01-1c44-433f-a995-4ddce5845cf9"; fs.cryptsetup.uuids.persist = "b2322f01-1c44-433f-a995-4ddce5845cf9";
@ -38,9 +42,15 @@
nvidiaBusId = "PCI:5:0:0"; nvidiaBusId = "PCI:5:0:0";
}; };
boot.plymouth.catppuccin.enable = false; catppuccin.plymouth.enable = false;
hardware.enableRedistributableFirmware = true; hardware.enableRedistributableFirmware = true;
boot.initrd.availableKernelModules = [ "xhci_pci" "thunderbolt" "nvme" "usb_storage" "sd_mod" ]; boot.initrd.availableKernelModules = [
"xhci_pci"
"thunderbolt"
"nvme"
"usb_storage"
"sd_mod"
];
boot.initrd.kernelModules = [ ]; boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ]; boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ]; boot.extraModulePackages = [ ];

View file

@ -2,7 +2,10 @@
i18n.defaultLocale = "en_GB.UTF-8"; i18n.defaultLocale = "en_GB.UTF-8";
time.timeZone = "Asia/Hong_Kong"; time.timeZone = "Asia/Hong_Kong";
environment.etc.nixos.source = "/nix/persist/config"; environment.etc.nixos.source = "/nix/persist/config";
nix.settings.experimental-features = [ "nix-command" "flakes" ]; nix.settings.experimental-features = [
"nix-command"
"flakes"
];
nixpkgs.config.allowUnfree = true; nixpkgs.config.allowUnfree = true;
system.stateVersion = "23.11"; system.stateVersion = "23.11";
} }

View file

@ -1,31 +1,44 @@
{ inputs, ... }: with inputs; with nixpkgs.lib; { { inputs, ... }:
flake.nixosConfigurations = (lists.foldr (name: spec: spec // { with inputs;
${name} = nixpkgs.lib.nixosSystem { with nixpkgs.lib;
system = "x86_64-linux"; {
specialArgs = inputs // { inherit inputs; }; flake.nixosConfigurations =
modules = [ (lists.foldr (
../global name: spec:
../home/profile.nix spec
../home/user.nix // {
../package ${name} = nixpkgs.lib.nixosSystem {
./constant.nix system = "x86_64-linux";
./channel.nix specialArgs = inputs // {
impermanence.nixosModules.impermanence inherit inputs;
home-manager.nixosModules.home-manager };
catppuccin.nixosModules.catppuccin modules = [
{ ../global
home-manager.useGlobalPkgs = true; ../home/profile.nix
home-manager.useUserPackages = true; ../home/user.nix
} ../package
lanzaboote.nixosModules.lanzaboote ./constant.nix
./channel.nix
impermanence.nixosModules.impermanence
home-manager.nixosModules.home-manager
catppuccin.nixosModules.catppuccin
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
}
lanzaboote.nixosModules.lanzaboote
./${name} ./${name}
{ networking.hostName = name; } { networking.hostName = name; }
]; ];
}; };
}) { }) (pipe ./. [ }
builtins.readDir ) { })
(filterAttrs (n: ty: ty == "directory" && builtins.pathExists ./${n}/default.nix)) (
(mapAttrsToList (n: _: n)) pipe ./. [
]); builtins.readDir
(filterAttrs (n: ty: ty == "directory" && builtins.pathExists ./${n}/default.nix))
(mapAttrsToList (n: _: n))
]
);
} }

View file

@ -1,11 +1,15 @@
{ {
security.acme.certs = let security.acme.certs =
cloudflare = { let
dnsProvider = "cloudflare"; cloudflare = {
credentialsFile = "/nix/persist/secret/cloudflare"; dnsProvider = "cloudflare";
credentialsFile = "/nix/persist/secret/cloudflare";
};
in
{
"514fpv.io" = cloudflare;
".514fpv.io" = cloudflare // {
domain = "*.514fpv.io";
};
}; };
in {
"514fpv.io" = cloudflare;
".514fpv.io" = cloudflare // { domain = "*.514fpv.io"; };
};
} }

View file

@ -1,7 +1,11 @@
{ config {
, ... }: let config,
...
}:
let
host = "514fpv.io"; host = "514fpv.io";
in { in
{
services.coturn = rec { services.coturn = rec {
enable = true; enable = true;
no-cli = true; no-cli = true;
@ -43,17 +47,27 @@ in {
''; '';
}; };
networking.firewall = let networking.firewall =
range = with config.services.coturn; [ { let
from = min-port; range = with config.services.coturn; [
to = max-port; {
} ]; from = min-port;
in { to = max-port;
}
];
in
{
allowedUDPPortRanges = range; allowedUDPPortRanges = range;
allowedUDPPorts = [ 3478 5349 ]; allowedUDPPorts = [
3478
5349
];
allowedTCPPortRanges = range; allowedTCPPortRanges = range;
allowedTCPPorts = [ 3478 5349 ]; allowedTCPPorts = [
}; 3478
5349
];
};
global.fs.zfs.mountpoints."/nix/persist/service/coturn" = "service/coturn"; global.fs.zfs.mountpoints."/nix/persist/service/coturn" = "service/coturn";
} }

View file

@ -1,6 +1,9 @@
{ lib {
, pkgs lib,
, ... }: { pkgs,
...
}:
{
global = { global = {
id = "ff96c05be13e44f681292205370eed1a"; id = "ff96c05be13e44f681292205370eed1a";
auth.openssh.enable = true; auth.openssh.enable = true;
@ -37,7 +40,15 @@
]; ];
hardware.enableRedistributableFirmware = true; hardware.enableRedistributableFirmware = true;
boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "mpt3sas" "nvme" "usbhid" "usb_storage" "sd_mod" ]; boot.initrd.availableKernelModules = [
"xhci_pci"
"ahci"
"mpt3sas"
"nvme"
"usbhid"
"usb_storage"
"sd_mod"
];
boot.initrd.kernelModules = [ "i915" ]; boot.initrd.kernelModules = [ "i915" ];
boot.kernelModules = [ "kvm-intel" ]; boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ]; boot.extraModulePackages = [ ];

View file

@ -1,8 +1,12 @@
{ pkgs {
, config pkgs,
, ...}: let config,
...
}:
let
host = "src.514fpv.io"; host = "src.514fpv.io";
in { in
{
services.forgejo = { services.forgejo = {
enable = true; enable = true;
lfs.enable = true; lfs.enable = true;

View file

@ -1,6 +1,9 @@
{ pkgs {
, config pkgs,
, ...}: { config,
...
}:
{
# container image used for edgetpu support # container image used for edgetpu support
virtualisation.oci-containers.containers.frigate = { virtualisation.oci-containers.containers.frigate = {
extraOptions = [ extraOptions = [
@ -23,7 +26,11 @@
]; ];
}; };
networking.firewall.interfaces.ss0.allowedTCPPorts = [ 5000 8554 8555 ]; networking.firewall.interfaces.ss0.allowedTCPPorts = [
5000
8554
8555
];
networking.firewall.interfaces.ss0.allowedUDPPorts = [ 8555 ]; networking.firewall.interfaces.ss0.allowedUDPPorts = [ 8555 ];
global.fs.zfs.mountpoints."/nix/persist/service/frigate" = "service/frigate"; global.fs.zfs.mountpoints."/nix/persist/service/frigate" = "service/frigate";

View file

@ -1,6 +1,9 @@
{ pkgs {
, config pkgs,
, ...}: { config,
...
}:
{
services.home-assistant = { services.home-assistant = {
enable = true; enable = true;
config = null; config = null;
@ -14,9 +17,12 @@
"synology_dsm" "synology_dsm"
]; ];
extraPackages = python3Packages: with python3Packages; [ extraPackages =
aiogithubapi gtts radios python3Packages: with python3Packages; [
]; aiogithubapi
gtts
radios
];
}; };
services.nginx.virtualHosts."home.514fpv.io" = { services.nginx.virtualHosts."home.514fpv.io" = {

View file

@ -1,13 +1,20 @@
{ pkgs {
, config pkgs,
, ...}: { config,
...
}:
{
services.jellyfin = { services.jellyfin = {
enable = true; enable = true;
openFirewall = true; openFirewall = true;
dataDir = "/nix/persist/service/jellyfin"; dataDir = "/nix/persist/service/jellyfin";
}; };
environment.systemPackages = with pkgs; [ jellyfin jellyfin-web jellyfin-ffmpeg ]; environment.systemPackages = with pkgs; [
jellyfin
jellyfin-web
jellyfin-ffmpeg
];
users.users.jellyfin.uid = 282; users.users.jellyfin.uid = 282;
users.groups.jellyfin.gid = 282; users.groups.jellyfin.gid = 282;

Some files were not shown because too many files have changed in this diff Show more