From 7266fff06ebe40ff18c387f6fc7c327fccf73356 Mon Sep 17 00:00:00 2001 From: 514fpv Date: Mon, 13 Jan 2025 11:52:09 +0800 Subject: [PATCH] chore: nix fmt --- flake.nix | 31 +- global/acme/default.nix | 15 +- global/android/default.nix | 15 +- global/asusd/default.nix | 15 +- global/auth/default.nix | 30 +- global/boot/default.nix | 57 +- global/default.nix | 3 +- global/flatpak/default.nix | 20 +- global/fs/bcachefs.nix | 24 +- global/fs/default.nix | 80 ++- global/fs/ext4.nix | 17 +- global/fs/f2fs.nix | 17 +- global/fs/xfs.nix | 17 +- global/fs/zfs/alert.nix | 15 +- global/fs/zfs/default.nix | 61 +- global/fs/zfs/replication.nix | 33 +- global/fs/zfs/split.nix | 24 +- global/gpu/default.nix | 87 ++- global/gpu/greetd.nix | 22 +- global/gpu/plymouth.nix | 15 +- global/id/default.nix | 15 +- global/io/default.nix | 77 ++- global/kernel/default.nix | 31 +- global/libvirt/default.nix | 19 +- global/lowmem/default.nix | 25 +- global/netdata/default.nix | 15 +- global/oci/default.nix | 15 +- global/virtualbox/default.nix | 30 +- home/app/nixos.nix | 29 +- home/auth/home.nix | 26 +- home/auth/nixos.nix | 15 +- home/btop/home.nix | 15 +- home/btop/nixos.nix | 19 +- home/catppuccin/gui.nix | 129 ++-- home/catppuccin/nixos.nix | 60 +- home/chrome/home.nix | 11 +- home/chrome/nixos.nix | 15 +- home/foot/home.nix | 12 +- home/gnome/home.nix | 15 +- home/gnome/impl/dconf.nix | 617 +++++++++++--------- home/gnome/impl/home.nix | 44 +- home/gnome/impl/nixos.nix | 79 ++- home/gnome/nixos.nix | 25 +- home/gui/home.nix | 15 +- home/gui/nixos.nix | 34 +- home/gyroflow/home.nix | 20 +- home/gyroflow/nixos.nix | 23 +- home/headless/home.nix | 33 +- home/headless/nixos.nix | 15 +- home/i3status/home.nix | 21 +- home/imv/home.nix | 12 +- home/jetbrains/home.nix | 25 +- home/jetbrains/nixos.nix | 19 +- home/libreoffice/home.nix | 15 +- home/libreoffice/nixos.nix | 15 +- home/mako/home.nix | 12 +- home/minecraft/home.nix | 29 +- home/minecraft/nixos.nix | 15 +- home/mpv/home.nix | 12 +- home/neovim/home.nix | 7 +- home/plasma/home.nix | 15 +- home/plasma/nixos.nix | 17 +- home/profile.nix | 247 ++++---- home/steam/config.nix | 27 +- home/steam/home.nix | 20 +- home/steam/nixos.nix | 20 +- home/sway/home.nix | 67 ++- home/sway/nixos.nix | 72 ++- home/swayidle/home.nix | 54 +- home/swaylock/home.nix | 12 +- home/swaylock/nixos.nix | 15 +- home/util/home.nix | 82 ++- home/util/nixos.nix | 56 +- home/virt-manager/home.nix | 111 ++-- home/virt-manager/nixos.nix | 15 +- home/vscode/home.nix | 22 +- home/vscode/nixos.nix | 15 +- home/wofi/home.nix | 12 +- home/xdg/home.nix | 39 +- home/xdg/nixos.nix | 5 +- home/zsh/home.nix | 30 +- home/zsh/nixos.nix | 7 +- package/blhelisuite32/default.nix | 87 +-- package/default.nix | 31 +- package/expresslrs-configurator/default.nix | 91 ++- package/photoview/default.nix | 47 +- package/photoview/nixos.nix | 23 +- package/tubesync/default.nix | 200 ++++--- package/tubesync/nixos.nix | 198 ++++--- spec/channel.nix | 19 +- spec/chireiden/default.nix | 18 +- spec/constant.nix | 5 +- spec/default.nix | 71 ++- spec/eientei/acme.nix | 20 +- spec/eientei/coturn.nix | 38 +- spec/eientei/default.nix | 19 +- spec/eientei/forgejo.nix | 12 +- spec/eientei/frigate.nix | 15 +- spec/eientei/hass.nix | 18 +- spec/eientei/jellyfin.nix | 15 +- spec/eientei/matrix.nix | 60 +- spec/eientei/minecraft.nix | 157 ++--- spec/eientei/mosquitto.nix | 22 +- spec/eientei/nextcloud.nix | 24 +- spec/eientei/nginx.nix | 5 +- spec/eientei/photoprism.nix | 8 +- spec/eientei/photoview.nix | 2 +- spec/eientei/postgresql.nix | 9 +- spec/focus/acme.nix | 20 +- spec/focus/default.nix | 16 +- spec/focus/nextcloud.nix | 24 +- spec/focus/nginx.nix | 5 +- spec/focus/postgresql.nix | 9 +- spec/hakugyokurou/default.nix | 56 +- spec/incinerator/default.nix | 29 +- spec/koumakyou/default.nix | 48 +- spec/koumakyou/jovian.nix | 63 +- spec/reimaden/ac71/default.nix | 7 +- spec/reimaden/ac71/package.nix | 16 +- spec/reimaden/default.nix | 8 +- spec/shatter/default.nix | 18 +- spec/shinkirou/default.nix | 57 +- spec/web/default.nix | 7 +- spec/web/google-compute-config.nix | 49 +- spec/web/nginx.nix | 82 +-- spec/web/site/default.nix | 23 +- spec/web/site/gemset.nix | 412 +++++++------ spec/yume/default.nix | 34 +- 128 files changed, 3402 insertions(+), 2013 deletions(-) diff --git a/flake.nix b/flake.nix index c174d805..1b9016cc 100644 --- a/flake.nix +++ b/flake.nix @@ -22,19 +22,24 @@ jovian.url = "github:Jovian-Experiments/Jovian-NixOS"; }; - outputs = inputs@{self, flake-parts, treefmt-nix,...}: - flake-parts.lib.mkFlake - { inherit inputs; } { - systems = [ - "x86_64-linux" - ]; + outputs = + inputs@{ + self, + flake-parts, + treefmt-nix, + ... + }: + flake-parts.lib.mkFlake { inherit inputs; } { + systems = [ + "x86_64-linux" + ]; - perSystem.treefmt = { - programs.nixfmt.enable = true; + perSystem.treefmt = { + programs.nixfmt.enable = true; + }; + imports = [ + ./spec + treefmt-nix.flakeModule + ]; }; - imports = [ - ./spec - treefmt-nix.flakeModule - ]; - }; } diff --git a/global/acme/default.nix b/global/acme/default.nix index dacf367e..7ffbb7a9 100644 --- a/global/acme/default.nix +++ b/global/acme/default.nix @@ -1,9 +1,14 @@ -{ pkgs -, lib -, config -, ... }: with lib; let +{ + pkgs, + lib, + config, + ... +}: +with lib; +let cfg = config.global.acme; -in { +in +{ options.global.acme = { enable = mkEnableOption "ACME SSL certificates"; }; diff --git a/global/android/default.nix b/global/android/default.nix index a7f94c17..cab5c082 100644 --- a/global/android/default.nix +++ b/global/android/default.nix @@ -1,9 +1,14 @@ -{ pkgs -, lib -, config -, ... }: with lib; let +{ + pkgs, + lib, + config, + ... +}: +with lib; +let cfg = config.global.android; -in { +in +{ options.global.android = { enable = mkEnableOption "android tools"; }; diff --git a/global/asusd/default.nix b/global/asusd/default.nix index 00b4af2e..c13f3e03 100644 --- a/global/asusd/default.nix +++ b/global/asusd/default.nix @@ -1,9 +1,14 @@ -{ pkgs -, lib -, config -, ... }: with lib; let +{ + pkgs, + lib, + config, + ... +}: +with lib; +let cfg = config.global.asusd; -in { +in +{ options.global.asusd = { enable = mkEnableOption "ASUS laptop userland support daemon"; }; diff --git a/global/auth/default.nix b/global/auth/default.nix index 1c0572a6..3a5259b7 100644 --- a/global/auth/default.nix +++ b/global/auth/default.nix @@ -1,7 +1,11 @@ -{ pkgs -, lib -, config -, ... }: with lib; let +{ + pkgs, + lib, + config, + ... +}: +with lib; +let cfg = config.global.auth; pub = lib.pipe ./pub [ builtins.readDir @@ -10,9 +14,12 @@ (foldr (payload: keys: (splitString "\n" payload) ++ keys) [ ]) (foldr (candidate: keys: keys ++ (if candidate == "" then [ ] else [ candidate ])) [ ]) ]; -in { +in +{ options.global.auth = { - enable = mkEnableOption "identity authentication in various software" // { default = true; }; + enable = mkEnableOption "identity authentication in various software" // { + default = true; + }; openssh = { enable = mkEnableOption "openssh server"; password = mkEnableOption "password authentication"; @@ -42,10 +49,13 @@ in { settings.PasswordAuthentication = cfg.openssh.password; }; - networking.firewall.allowedTCPPorts = [ 1300 ] ++ # utility port - optional (cfg.openssh.enable && (cfg.openssh.port != null)) cfg.openssh.port; + networking.firewall.allowedTCPPorts = + [ 1300 ] + # utility port + ++ optional (cfg.openssh.enable && (cfg.openssh.port != null)) cfg.openssh.port; - environment.persistence."/nix/persist/fhs".directories = [ ] ++ - optional cfg.openssh.enable "/etc/ssh"; + environment.persistence."/nix/persist/fhs".directories = + [ ] + ++ optional cfg.openssh.enable "/etc/ssh"; }; } diff --git a/global/boot/default.nix b/global/boot/default.nix index fe27a997..da783150 100644 --- a/global/boot/default.nix +++ b/global/boot/default.nix @@ -1,12 +1,21 @@ -{ pkgs -, lib -, config -, ... }: with lib; let +{ + pkgs, + lib, + config, + ... +}: +with lib; +let cfg = config.global.boot; -in { +in +{ options.global.boot = { - enable = mkEnableOption "bootloader installation and maintenance" // { default = true; }; - systemd-boot = mkEnableOption "generation selection via systemd-boot" // { default = !cfg.lanzaboote; }; + enable = mkEnableOption "bootloader installation and maintenance" // { + default = true; + }; + systemd-boot = mkEnableOption "generation selection via systemd-boot" // { + default = !cfg.lanzaboote; + }; lanzaboote = mkEnableOption "secure boot maintenance via lanzaboote"; memtest = mkOption { type = with types; nullOr int; @@ -15,21 +24,23 @@ in { }; }; - config = let - sbPath = "/nix/persist/lanzaboote"; - in mkIf cfg.enable { - boot = { - initrd.systemd.enable = true; - lanzaboote.enable = cfg.lanzaboote; - lanzaboote.pkiBundle = sbPath; - loader.systemd-boot.enable = cfg.systemd-boot; - loader.efi.canTouchEfiVariables = true; - tmp.cleanOnBoot = true; - kernelParams = optional (cfg.memtest != null) "memtest=${toString cfg.memtest}"; - }; + config = + let + sbPath = "/nix/persist/lanzaboote"; + in + mkIf cfg.enable { + boot = { + initrd.systemd.enable = true; + lanzaboote.enable = cfg.lanzaboote; + lanzaboote.pkiBundle = sbPath; + loader.systemd-boot.enable = cfg.systemd-boot; + loader.efi.canTouchEfiVariables = true; + tmp.cleanOnBoot = true; + kernelParams = optional (cfg.memtest != null) "memtest=${toString cfg.memtest}"; + }; - # symlink for sbctl - environment.etc.secureboot.source = sbPath; - environment.systemPackages = [ pkgs.sbctl ]; - }; + # symlink for sbctl + environment.etc.secureboot.source = sbPath; + environment.systemPackages = [ pkgs.sbctl ]; + }; } diff --git a/global/default.nix b/global/default.nix index e031681d..a28d7b75 100644 --- a/global/default.nix +++ b/global/default.nix @@ -1,4 +1,5 @@ -{ lib, ... }: { +{ lib, ... }: +{ imports = lib.pipe ./. [ builtins.readDir (lib.filterAttrs (n: ty: ty == "directory" && builtins.pathExists ./${n}/default.nix)) diff --git a/global/flatpak/default.nix b/global/flatpak/default.nix index a3b77f76..fb875af8 100644 --- a/global/flatpak/default.nix +++ b/global/flatpak/default.nix @@ -1,9 +1,14 @@ -{ pkgs -, lib -, config -, ... }: with lib; let +{ + pkgs, + lib, + config, + ... +}: +with lib; +let cfg = config.global.flatpak; -in { +in +{ options.global.flatpak = { enable = mkEnableOption "flatpak sandbox"; }; @@ -11,7 +16,10 @@ in { config = mkIf cfg.enable { services.flatpak.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" ]; }; } diff --git a/global/fs/bcachefs.nix b/global/fs/bcachefs.nix index a779d7bd..6de418dc 100644 --- a/global/fs/bcachefs.nix +++ b/global/fs/bcachefs.nix @@ -1,20 +1,28 @@ -{ pkgs -, lib -, config -, ... }: with lib; let +{ + pkgs, + lib, + config, + ... +}: +with lib; +let cfg = config.global.fs; -in { +in +{ options.global.fs.bcachefs = { options = mkOption { type = with types; listOf str; - default = [ "noatime" "compression=zstd" ]; + default = [ + "noatime" + "compression=zstd" + ]; description = "bcachefs mount options"; }; }; config = mkIf (cfg.type == "bcachefs") { - fileSystems."/nix" = - { inherit (cfg.bcachefs) options; + fileSystems."/nix" = { + inherit (cfg.bcachefs) options; device = "/dev/disk/by-uuid/${cfg.store}"; fsType = "bcachefs"; }; diff --git a/global/fs/default.nix b/global/fs/default.nix index 0871b015..46d4e216 100644 --- a/global/fs/default.nix +++ b/global/fs/default.nix @@ -1,9 +1,14 @@ -{ pkgs -, lib -, config -, ... }: with lib; let +{ + pkgs, + lib, + config, + ... +}: +with lib; +let cfg = config.global.fs; -in { +in +{ imports = [ ./ext4.nix ./f2fs.nix @@ -14,7 +19,15 @@ in { options.global.fs = { type = mkOption { - type = with types; enum [ "ext4" "f2fs" "xfs" "zfs" "bcachefs" ]; + type = + with types; + enum [ + "ext4" + "f2fs" + "xfs" + "zfs" + "bcachefs" + ]; default = "bcachefs"; description = "filesystem type to use for persistent state storage"; }; @@ -24,7 +37,9 @@ in { description = "UUID/dataset of nix store backing device"; }; esp = { - enable = mkEnableOption "EFI system partition" // { default = true; }; + enable = mkEnableOption "EFI system partition" // { + default = true; + }; uuid = mkOption { type = with types; str; default = "CAFE-BABE"; @@ -53,8 +68,12 @@ in { }; cryptsetup = { enable = mkEnableOption "full disk encryption device early setup"; - allowDiscards = mkEnableOption "allow discards via device-mapper" // { default = true; }; - bypassWorkqueues = mkEnableOption "bypass dm-crypt's internal workqueues" // { default = true; }; + allowDiscards = mkEnableOption "allow discards via device-mapper" // { + default = true; + }; + bypassWorkqueues = mkEnableOption "bypass dm-crypt's internal workqueues" // { + default = true; + }; uuids = mkOption { type = with types; attrsOf str; description = "device-mapper name to encrypted block device UUID mapping"; @@ -63,22 +82,25 @@ in { }; config = { - fileSystems."/" = - { device = "rootfs"; + fileSystems."/" = { + device = "rootfs"; fsType = "tmpfs"; - options = [ "size=2G" "mode=755" ]; + options = [ + "size=2G" + "mode=755" + ]; }; - fileSystems."/boot" = mkIf cfg.esp.enable - { device = "/dev/disk/by-uuid/${cfg.esp.uuid}"; + fileSystems."/boot" = mkIf cfg.esp.enable { + device = "/dev/disk/by-uuid/${cfg.esp.uuid}"; fsType = "vfat"; }; - fileSystems."/nix/persist" = mkIf cfg.external.enable - { inherit (cfg.external) device fsType options; + fileSystems."/nix/persist" = mkIf cfg.external.enable { + inherit (cfg.external) device fsType options; neededForBoot = true; depends = [ "/nix" ]; }; - fileSystems."/tmp" = - { device = "/nix/tmp"; + fileSystems."/tmp" = { + device = "/nix/tmp"; options = [ "bind" ]; depends = [ "/nix/tmp" ]; }; @@ -86,14 +108,20 @@ in { services.fstrim.enable = mkIf ((cfg.type == "ext4") || (cfg.type == "xfs")) true; boot.initrd.luks.devices = mkIf cfg.cryptsetup.enable ( - mapAttrs' (name: uuid: nameValuePair "luks-${name}" { - inherit (cfg.cryptsetup) allowDiscards bypassWorkqueues; - device = "/dev/disk/by-uuid/${uuid}"; - }) cfg.cryptsetup.uuids); + mapAttrs' ( + name: uuid: + nameValuePair "luks-${name}" { + inherit (cfg.cryptsetup) allowDiscards bypassWorkqueues; + device = "/dev/disk/by-uuid/${uuid}"; + } + ) cfg.cryptsetup.uuids + ); - environment.persistence."/nix/persist/fhs".files = [ { - file = "/var/lib/private/mode"; - parentDirectory.mode = "0700"; - } ]; + environment.persistence."/nix/persist/fhs".files = [ + { + file = "/var/lib/private/mode"; + parentDirectory.mode = "0700"; + } + ]; }; } diff --git a/global/fs/ext4.nix b/global/fs/ext4.nix index 109c29cc..56711b16 100644 --- a/global/fs/ext4.nix +++ b/global/fs/ext4.nix @@ -1,10 +1,15 @@ -{ lib -, config -, ... }: with lib; let +{ + lib, + config, + ... +}: +with lib; +let cfg = config.global.fs; -in mkIf (cfg.type == "ext4") { - fileSystems."/nix" = - { device = "/dev/disk/by-uuid/${cfg.store}"; +in +mkIf (cfg.type == "ext4") { + fileSystems."/nix" = { + device = "/dev/disk/by-uuid/${cfg.store}"; fsType = "ext4"; options = [ "noatime" ]; }; diff --git a/global/fs/f2fs.nix b/global/fs/f2fs.nix index f9043a39..9a687002 100644 --- a/global/fs/f2fs.nix +++ b/global/fs/f2fs.nix @@ -1,10 +1,15 @@ -{ lib -, config -, ... }: with lib; let +{ + lib, + config, + ... +}: +with lib; +let cfg = config.global.fs; -in mkIf (cfg.type == "f2fs") { - fileSystems."/nix" = - { device = "/dev/disk/by-uuid/${cfg.store}"; +in +mkIf (cfg.type == "f2fs") { + fileSystems."/nix" = { + device = "/dev/disk/by-uuid/${cfg.store}"; fsType = "f2fs"; }; } diff --git a/global/fs/xfs.nix b/global/fs/xfs.nix index 42c8c7ea..4f3b29f7 100644 --- a/global/fs/xfs.nix +++ b/global/fs/xfs.nix @@ -1,11 +1,16 @@ -{ lib -, config -, ... }: with lib; let +{ + lib, + config, + ... +}: +with lib; +let cfg = config.global.fs; -in mkIf (cfg.type == "xfs") { +in +mkIf (cfg.type == "xfs") { # NOTE: -m reflink=1 - fileSystems."/nix" = - { device = "/dev/disk/by-uuid/${cfg.store}"; + fileSystems."/nix" = { + device = "/dev/disk/by-uuid/${cfg.store}"; fsType = "xfs"; options = [ "noatime" ]; }; diff --git a/global/fs/zfs/alert.nix b/global/fs/zfs/alert.nix index 9af1317d..a774468a 100644 --- a/global/fs/zfs/alert.nix +++ b/global/fs/zfs/alert.nix @@ -1,7 +1,11 @@ -{ pkgs -, lib -, config -, ... }: with lib; let +{ + pkgs, + lib, + config, + ... +}: +with lib; +let cfg = config.global.fs.zfs.alert; backend = { @@ -103,7 +107,8 @@ export ALERT exec ${backend.text} ''; -in mkIf (cfg.secret != null) { +in +mkIf (cfg.secret != null) { services.zfs.zed = mkIf cfg.zed { settings = { ZED_EMAIL_ADDR = [ "root" ]; diff --git a/global/fs/zfs/default.nix b/global/fs/zfs/default.nix index 61976560..94600c03 100644 --- a/global/fs/zfs/default.nix +++ b/global/fs/zfs/default.nix @@ -1,9 +1,14 @@ -{ pkgs -, lib -, config -, ... }: with lib; let +{ + pkgs, + lib, + config, + ... +}: +with lib; +let cfg = config.global.fs; -in { +in +{ imports = [ ./alert.nix ./split.nix @@ -15,8 +20,12 @@ in { # -O compression=on -O mountpoint=none -O xattr=sa -O acltype=posixacl options.global.fs.zfs = { alert = { - zed = mkEnableOption "zfs event alerts" // { default = true; }; - swraid = mkEnableOption "software raid alerts" // { default = true; }; + zed = mkEnableOption "zfs event alerts" // { + default = true; + }; + swraid = mkEnableOption "software raid alerts" // { + default = true; + }; secret = mkOption { type = with types; nullOr str; default = null; @@ -68,7 +77,11 @@ in { }; datasets = mkOption { type = with types; listOf str; - default = [ "persist" "service" "storage" ]; + default = [ + "persist" + "service" + "storage" + ]; description = "list of filesystems to perform replication for"; }; sendOptions = mkOption { @@ -80,19 +93,25 @@ in { }; config = mkIf (cfg.type == "zfs") { - fileSystems = (mapAttrs (path: dataset: { - device = "${cfg.zfs.persist}/${dataset}"; - fsType = "zfs"; - options = [ "zfsutil" ]; - # required by impermanence - neededForBoot = true; - }) cfg.zfs.mountpoints) // { - "/nix" = (if !cfg.zfs.externalStore then - { device = "${cfg.store}/nix"; - fsType = "zfs"; - } else - { inherit (cfg.external) device fsType options; }); - }; + fileSystems = + (mapAttrs (path: dataset: { + device = "${cfg.zfs.persist}/${dataset}"; + fsType = "zfs"; + options = [ "zfsutil" ]; + # required by impermanence + neededForBoot = true; + }) cfg.zfs.mountpoints) + // { + "/nix" = ( + if !cfg.zfs.externalStore then + { + device = "${cfg.store}/nix"; + fsType = "zfs"; + } + else + { inherit (cfg.external) device fsType options; } + ); + }; global.fs.zfs.mountpoints."/nix/persist" = "persist"; services.zfs.trim.enable = true; diff --git a/global/fs/zfs/replication.nix b/global/fs/zfs/replication.nix index 1650c118..90282f6e 100644 --- a/global/fs/zfs/replication.nix +++ b/global/fs/zfs/replication.nix @@ -1,9 +1,14 @@ -{ pkgs -, lib -, config -, ... }: with lib; let +{ + pkgs, + lib, + config, + ... +}: +with lib; +let cfg = config.global.fs.zfs.replication; -in mkIf cfg.enable { +in +mkIf cfg.enable { services.syncoid = { enable = mkDefault true; interval = mkDefault "daily"; @@ -16,12 +21,18 @@ in mkIf cfg.enable { ]; localSourceAllow = mkOptionDefault [ "mount" ]; - commands = (lists.foldr (name: commands: commands // { - "${config.global.fs.store}/${name}" = { - inherit (cfg) sendOptions; - target = "${cfg.remote}/${name}"; - }; - }) { }) cfg.datasets; + commands = + (lists.foldr ( + name: commands: + commands + // { + "${config.global.fs.store}/${name}" = { + inherit (cfg) sendOptions; + target = "${cfg.remote}/${name}"; + }; + } + ) { }) + cfg.datasets; }; users.users.syncoid.uid = 82; diff --git a/global/fs/zfs/split.nix b/global/fs/zfs/split.nix index 22f9231f..a86185a0 100644 --- a/global/fs/zfs/split.nix +++ b/global/fs/zfs/split.nix @@ -1,9 +1,14 @@ -{ pkgs -, lib -, config -, ... }: with lib; let +{ + pkgs, + lib, + config, + ... +}: +with lib; +let cfg = config.global.fs.zfs.split; -in mkIf cfg.enable { +in +mkIf cfg.enable { # unconditionally enable fstrim for xfs and ext4 services.fstrim.enable = mkDefault true; @@ -14,8 +19,8 @@ in mkIf cfg.enable { ''; # secret filesystem backed by swraid - fileSystems."/nix/var/secret" = - { device = "/dev/disk/by-uuid/${cfg.secret}"; + fileSystems."/nix/var/secret" = { + device = "/dev/disk/by-uuid/${cfg.secret}"; fsType = "ext4"; options = [ "noatime" ]; neededForBoot = true; @@ -31,5 +36,8 @@ in mkIf cfg.enable { }; # 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" + ]; } diff --git a/global/gpu/default.nix b/global/gpu/default.nix index 3b950361..e7271c14 100644 --- a/global/gpu/default.nix +++ b/global/gpu/default.nix @@ -1,13 +1,20 @@ -{ pkgs -, lib -, config -, ... }: with lib; let +{ + pkgs, + lib, + config, + ... +}: +with lib; +let cfg = config.global.gpu; - intel = cfg.type == "intel" || (cfg.type == "prime" && config.hardware.nvidia.prime.intelBusId != ""); - amdgpu = cfg.type == "amdgpu" || (cfg.type == "prime" && config.hardware.nvidia.prime.amdgpuBusId != ""); + intel = + 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"; -in { +in +{ imports = [ ./plymouth.nix ./greetd.nix @@ -15,9 +22,18 @@ in { options.global.gpu = { 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 = with types; nullOr (enum [ "intel" "amdgpu" "nvidia" "prime" ]); + type = + with types; + nullOr (enum [ + "intel" + "amdgpu" + "nvidia" + "prime" + ]); default = null; description = "type of graphics acceleration used"; }; @@ -34,21 +50,21 @@ in { enable32Bit = true; # https://nixos.wiki/wiki/Accelerated_Video_Playback - extraPackages = with pkgs; optionals intel [ - intel-media-driver # LIBVA_DRIVER_NAME=iHD - vaapiIntel # LIBVA_DRIVER_NAME=i965 (older but works better for Firefox/Chromium) - vaapiVdpau - libvdpau-va-gl - intel-compute-runtime - ] ++ - optional nvidia nvidia-vaapi-driver ++ - optional (cfg.type == "nvidia") vulkan-validation-layers; + extraPackages = + with pkgs; + optionals intel [ + intel-media-driver # LIBVA_DRIVER_NAME=iHD + vaapiIntel # LIBVA_DRIVER_NAME=i965 (older but works better for Firefox/Chromium) + vaapiVdpau + libvdpau-va-gl + intel-compute-runtime + ] + ++ optional nvidia nvidia-vaapi-driver + ++ optional (cfg.type == "nvidia") vulkan-validation-layers; }; services.xserver = mkIf cfg.session { - videoDrivers = - optional nvidia "nvidia" ++ - optional (cfg.type == "amdgpu") "amdgpu"; + videoDrivers = optional nvidia "nvidia" ++ optional (cfg.type == "amdgpu") "amdgpu"; # inhibits default display manager displayManager.startx.enable = mkDefault true; @@ -79,7 +95,14 @@ in { specialisation.integratedGraphics = mkIf (cfg.type == "prime") { 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" ]; }; }; @@ -92,10 +115,15 @@ in { }; boot.initrd.kernelModules = - optional amdgpu "amdgpu" ++ - optional (intel && cfg.arc == null) "i915" ++ - optionals nvidia [ "nvidia" "nvidia_drm" "nvidia_modeset" "nvidia_uvm" ] ++ - optional (cfg.arc != null) "vfio-pci"; + optional amdgpu "amdgpu" + ++ optional (intel && cfg.arc == null) "i915" + ++ optionals nvidia [ + "nvidia" + "nvidia_drm" + "nvidia_modeset" + "nvidia_uvm" + ] + ++ optional (cfg.arc != null) "vfio-pci"; boot.extraModulePackages = optional nvidia config.boot.kernelPackages.nvidia_x11; @@ -105,7 +133,10 @@ in { ''; boot.kernelParams = - optional intel "i915.fastboot=1" ++ - optionals nvidia [ "nvidia_drm.modeset=1" "nvidia_drm.fbdev=1" ]; + optional intel "i915.fastboot=1" + ++ optionals nvidia [ + "nvidia_drm.modeset=1" + "nvidia_drm.fbdev=1" + ]; }; } diff --git a/global/gpu/greetd.nix b/global/gpu/greetd.nix index d31f6c5c..f42b6f36 100644 --- a/global/gpu/greetd.nix +++ b/global/gpu/greetd.nix @@ -1,13 +1,23 @@ -{ pkgs -, lib -, config -, ... }: with lib; let +{ + pkgs, + lib, + config, + ... +}: +with lib; +let cfg = config.global.gpu; gui = with cfg; enable && session; -in mkIf gui { +in +mkIf gui { programs.regreet = { enable = mkDefault true; - cageArgs = [ "-s" "-d" "-m" "last" ]; + cageArgs = [ + "-s" + "-d" + "-m" + "last" + ]; settings = { background.path = mkDefault ../../share/54345906_p0.jpg; background.fit = "Fill"; diff --git a/global/gpu/plymouth.nix b/global/gpu/plymouth.nix index 0705fd8a..3f9b705d 100644 --- a/global/gpu/plymouth.nix +++ b/global/gpu/plymouth.nix @@ -1,10 +1,15 @@ -{ pkgs -, lib -, config -, ... }: with lib; let +{ + pkgs, + lib, + config, + ... +}: +with lib; +let cfg = config.global.gpu; gui = with cfg; enable && session; -in mkIf gui { +in +mkIf gui { boot = { loader.timeout = mkDefault 0; consoleLogLevel = 0; diff --git a/global/id/default.nix b/global/id/default.nix index c225845e..ff86ae01 100644 --- a/global/id/default.nix +++ b/global/id/default.nix @@ -1,9 +1,14 @@ -{ pkgs -, lib -, config -, ... }: with lib; let +{ + pkgs, + lib, + config, + ... +}: +with lib; +let cfg = config.global.id; -in { +in +{ options.global.id = mkOption { type = with types; str; description = "systemd machine id"; diff --git a/global/io/default.nix b/global/io/default.nix index 407a3de2..3122f444 100644 --- a/global/io/default.nix +++ b/global/io/default.nix @@ -1,26 +1,44 @@ -{ pkgs -, lib -, config -, ... }: with lib; let +{ + pkgs, + lib, + config, + ... +}: +with lib; +let cfg = config.global.io; gui = with config.global.gpu; enable && session; -in { +in +{ options.global.io = { - betaflight = mkEnableOption "betaflight udev rules" // { default = gui; }; - bluetooth = mkEnableOption "bluetooth daemons and state persistence" // { default = gui; }; - audio = mkEnableOption "pulseaudio server configuration" // { default = gui; }; + betaflight = mkEnableOption "betaflight udev rules" // { + 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"; }; config = { - services.udev.extraRules = '' - # ignore zvols - KERNEL=="zd*", ENV{UDISKS_IGNORE}="1" - '' + (if cfg.betaflight then '' - # 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 ""); + services.udev.extraRules = + '' + # ignore zvols + KERNEL=="zd*", ENV{UDISKS_IGNORE}="1" + '' + + ( + if cfg.betaflight then + '' + # 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.hosts = { @@ -43,20 +61,25 @@ in { 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"; - environment.persistence."/nix/persist/fhs".directories = [ - "/var/log" - "/var/lib/nixos" - "/var/lib/systemd/backlight" - ] ++ - optional config.networking.networkmanager.enable "/etc/NetworkManager/system-connections" ++ - optional cfg.bluetooth "/var/lib/bluetooth" ++ - optional cfg.coredump "/var/lib/systemd/coredump"; + environment.persistence."/nix/persist/fhs".directories = + [ + "/var/log" + "/var/lib/nixos" + "/var/lib/systemd/backlight" + ] + ++ optional config.networking.networkmanager.enable "/etc/NetworkManager/system-connections" + ++ optional cfg.bluetooth "/var/lib/bluetooth" + ++ optional cfg.coredump "/var/lib/systemd/coredump"; environment.persistence."/nix/persist/fhs".hideMounts = true; - users.home.persist.directories = [ ] ++ - optional cfg.audio ".local/state/wireplumber"; + users.home.persist.directories = [ ] ++ optional cfg.audio ".local/state/wireplumber"; }; } diff --git a/global/kernel/default.nix b/global/kernel/default.nix index 0fc6c935..1fb86cd0 100644 --- a/global/kernel/default.nix +++ b/global/kernel/default.nix @@ -1,15 +1,26 @@ -{ pkgs -, lib -, config -, ... }: with lib; let +{ + pkgs, + lib, + config, + ... +}: +with lib; +let cfg = config.global.kernel; -in { +in +{ options.global.kernel = { - enable = mkEnableOption "kernel version and configuration" // { default = true; }; + enable = mkEnableOption "kernel version and configuration" // { + default = true; + }; lts = mkEnableOption "longterm kernel releases"; sysctl = { - enable = mkEnableOption "sysctl presets" // { default = true; }; - harden = mkEnableOption "hardening sysctls" // { default = true; }; + enable = mkEnableOption "sysctl presets" // { + default = true; + }; + harden = mkEnableOption "hardening sysctls" // { + default = true; + }; swappiness = mkOption { type = with types; int; default = 0; @@ -23,6 +34,8 @@ in { "kernel.dmesg_restrict" = mkIf cfg.sysctl.harden 1; "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); }; } diff --git a/global/libvirt/default.nix b/global/libvirt/default.nix index b8149719..2613b5b5 100644 --- a/global/libvirt/default.nix +++ b/global/libvirt/default.nix @@ -1,11 +1,18 @@ -{ pkgs -, lib -, config -, ... }: with lib; let +{ + pkgs, + lib, + config, + ... +}: +with lib; +let cfg = config.global.libvirt; -in { +in +{ options.global.libvirt = { - enable = mkEnableOption "libvirt virtualisation daemon" // { default = true; }; + enable = mkEnableOption "libvirt virtualisation daemon" // { + default = true; + }; }; config = mkIf cfg.enable { diff --git a/global/lowmem/default.nix b/global/lowmem/default.nix index 8a3ca395..731b5bd4 100644 --- a/global/lowmem/default.nix +++ b/global/lowmem/default.nix @@ -1,9 +1,14 @@ -{ pkgs -, lib -, config -, ... }: with lib; let +{ + pkgs, + lib, + config, + ... +}: +with lib; +let cfg = config.global.lowmem; -in { +in +{ options.global.lowmem = { enable = mkEnableOption "low memory optimisations"; swapsize = mkOption { @@ -17,9 +22,11 @@ in { # enables remote nixos-rebuild nix.settings.trusted-users = [ "koishi" ]; - swapDevices = [ { - device = "/nix/persist/secret/swap"; - size = cfg.swapsize; - } ]; + swapDevices = [ + { + device = "/nix/persist/secret/swap"; + size = cfg.swapsize; + } + ]; }; } diff --git a/global/netdata/default.nix b/global/netdata/default.nix index fb9bebf6..4d261f2c 100644 --- a/global/netdata/default.nix +++ b/global/netdata/default.nix @@ -1,9 +1,14 @@ -{ pkgs -, lib -, config -, ... }: with lib; let +{ + pkgs, + lib, + config, + ... +}: +with lib; +let cfg = config.global.netdata; -in { +in +{ options.global.netdata = { enable = mkEnableOption "netdata"; host = mkOption { diff --git a/global/oci/default.nix b/global/oci/default.nix index 60e5e4d1..5e0c9ebb 100644 --- a/global/oci/default.nix +++ b/global/oci/default.nix @@ -1,9 +1,14 @@ -{ pkgs -, lib -, config -, ... }: with lib; let +{ + pkgs, + lib, + config, + ... +}: +with lib; +let cfg = config.global.oci; -in { +in +{ options.global.oci = { enable = mkEnableOption "oci container runtime"; }; diff --git a/global/virtualbox/default.nix b/global/virtualbox/default.nix index bf705e14..5a304e3e 100644 --- a/global/virtualbox/default.nix +++ b/global/virtualbox/default.nix @@ -1,9 +1,14 @@ -{ pkgs -, lib -, config -, ... }: with lib; let +{ + pkgs, + lib, + config, + ... +}: +with lib; +let cfg = config.global.virtualbox; -in { +in +{ options.global.virtualbox = { enable = mkEnableOption "virtualbox host (kvm)"; }; @@ -25,10 +30,15 @@ in { ".config/VirtualBox" ]; - users.homeModules = [ { - wayland.windowManager.sway.config.window.commands = [ - { criteria.class = "VirtualBox Manager"; command = "floating enable"; } - ]; - } ]; + users.homeModules = [ + { + wayland.windowManager.sway.config.window.commands = [ + { + criteria.class = "VirtualBox Manager"; + command = "floating enable"; + } + ]; + } + ]; }; } diff --git a/home/app/nixos.nix b/home/app/nixos.nix index 4cfb6191..25a531da 100644 --- a/home/app/nixos.nix +++ b/home/app/nixos.nix @@ -1,16 +1,31 @@ -{ pkgs -, lib -, config -, ... }: with lib; let +{ + pkgs, + lib, + config, + ... +}: +with lib; +let cfg = config.users; -in { +in +{ options.users.home.persistApp = { files = mkOption { - type = with types; listOf (oneOf [ str (attrsOf str) ]); + type = + with types; + listOf (oneOf [ + str + (attrsOf str) + ]); default = [ ]; }; directories = mkOption { - type = with types; listOf (oneOf [ str (attrsOf str) ]); + type = + with types; + listOf (oneOf [ + str + (attrsOf str) + ]); default = [ ]; }; }; diff --git a/home/auth/home.nix b/home/auth/home.nix index 1e86f8e1..9b2dc4d1 100644 --- a/home/auth/home.nix +++ b/home/auth/home.nix @@ -1,7 +1,11 @@ -{ pkgs -, lib -, config -, ...}: with lib; { +{ + pkgs, + lib, + config, + ... +}: +with lib; +{ # git signing configuration programs.git = { signing = { @@ -15,10 +19,11 @@ gpg = { format = "ssh"; # compiled from trusted keys in auth module - ssh.allowedSignersFile = toString (pkgs.writeText - "allowed_signers" (foldr (key: folded: - folded + "koishi@514fpv.one ${key}\n") "" - config.passthrough.publicKeys)); + ssh.allowedSignersFile = toString ( + pkgs.writeText "allowed_signers" ( + foldr (key: folded: folded + "koishi@514fpv.one ${key}\n") "" config.passthrough.publicKeys + ) + ); }; }; }; @@ -32,6 +37,9 @@ }; wayland.windowManager.sway.config.window.commands = mkIf config.passthrough.gui [ - { criteria.title = "Bitwarden"; command = "floating enable"; } + { + criteria.title = "Bitwarden"; + command = "floating enable"; + } ]; } diff --git a/home/auth/nixos.nix b/home/auth/nixos.nix index 55984071..a9e37970 100644 --- a/home/auth/nixos.nix +++ b/home/auth/nixos.nix @@ -1,7 +1,12 @@ -{ config -, ... }: { +{ + config, + ... +}: +{ # this module passes openssh public keys to home-manager - users.homeModules = [ { - passthrough.publicKeys = config.global.auth.openssh.publicKeys; - } ]; + users.homeModules = [ + { + passthrough.publicKeys = config.global.auth.openssh.publicKeys; + } + ]; } diff --git a/home/btop/home.nix b/home/btop/home.nix index f435fee1..a37bfeec 100644 --- a/home/btop/home.nix +++ b/home/btop/home.nix @@ -1,9 +1,14 @@ -{ pkgs -, lib -, config -, ... }: with lib; let +{ + pkgs, + lib, + config, + ... +}: +with lib; +let cfg = config.passthrough.btop; -in mkIf cfg.enable { +in +mkIf cfg.enable { programs.btop = { enable = true; settings = { diff --git a/home/btop/nixos.nix b/home/btop/nixos.nix index 3379a317..2bd67cbc 100644 --- a/home/btop/nixos.nix +++ b/home/btop/nixos.nix @@ -1,11 +1,18 @@ -{ pkgs -, lib -, config -, ... }: with lib; let +{ + pkgs, + lib, + config, + ... +}: +with lib; +let cfg = config.home.btop; -in { +in +{ options.home.btop = { - enable = mkEnableOption "btop" // { default = !config.home.util.minimal; }; + enable = mkEnableOption "btop" // { + default = !config.home.util.minimal; + }; }; config = { diff --git a/home/catppuccin/gui.nix b/home/catppuccin/gui.nix index c52a3b96..f5d40dad 100644 --- a/home/catppuccin/gui.nix +++ b/home/catppuccin/gui.nix @@ -1,10 +1,17 @@ -{ pkgs -, lib -, config -, ... }: with lib; let +{ + pkgs, + lib, + config, + ... +}: +with lib; +let cfg = config.passthrough.catppuccin; - palette = (lib.importJSON "${config.catppuccin.sources.palette}/palette.json").${config.catppuccin.flavor}.colors; -in mkIf cfg.enable { + palette = + (lib.importJSON "${config.catppuccin.sources.palette}/palette.json") + .${config.catppuccin.flavor}.colors; +in +mkIf cfg.enable { gtk.theme = { inherit (cfg.gtk) package name; }; qt.style.name = "kvantum"; qt.platformTheme.name = "kvantum"; @@ -13,38 +20,90 @@ in mkIf cfg.enable { # sway colour palette override wayland.windowManager.sway.config = { colors = { - focused = { border = "$lavender"; background = "$base"; text = "$text"; indicator = "$rosewater"; 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"; + focused = { + border = "$lavender"; + background = "$base"; + text = "$text"; + indicator = "$rosewater"; + 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 [ { - colors = { - background = "$base"; - statusline = "$text"; - focusedStatusline = "$text"; - focusedSeparator = "$base"; - focusedWorkspace = { border = "$base"; background = "$base"; 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"; }; - }; + bars = mkForce [ + { + colors = { + background = "$base"; + statusline = "$text"; + focusedStatusline = "$text"; + focusedSeparator = "$base"; + focusedWorkspace = { + border = "$base"; + background = "$base"; + 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"; - position = "bottom"; - workspaceButtons = true; - workspaceNumbers = true; - statusCommand = "${pkgs.i3status}/bin/i3status"; - fonts = { - names = [ "monospace" ]; - size = 8.0; - }; - trayOutput = "primary"; - } ]; + mode = "dock"; + position = "bottom"; + workspaceButtons = true; + workspaceNumbers = true; + statusCommand = "${pkgs.i3status}/bin/i3status"; + fonts = { + names = [ "monospace" ]; + size = 8.0; + }; + trayOutput = "primary"; + } + ]; output."*".bg = mkForce "${./flake.png} fill"; gaps.inner = 12; diff --git a/home/catppuccin/nixos.nix b/home/catppuccin/nixos.nix index dbdf05cc..1700e0df 100644 --- a/home/catppuccin/nixos.nix +++ b/home/catppuccin/nixos.nix @@ -1,32 +1,41 @@ -{ pkgs -, lib -, config -, ... }: with lib; let +{ + pkgs, + lib, + config, + ... +}: +with lib; +let gui = with config.global.gpu; enable && session; cfg = config.home.catppuccin; -in { +in +{ options.home.catppuccin = { - enable = mkEnableOption "catppuccin colour scheme" // { default = gui; }; + enable = mkEnableOption "catppuccin colour scheme" // { + default = gui; + }; gtk = { package = mkOption { type = with types; package; - default = (pkgs.catppuccin-gtk.overrideAttrs { - src = pkgs.fetchFromGitHub { - owner = "catppuccin"; - repo = "gtk"; - rev = "v1.0.3"; - fetchSubmodules = true; - hash = "sha256-q5/VcFsm3vNEw55zq/vcM11eo456SYE5TQA3g2VQjGc="; - }; + default = + (pkgs.catppuccin-gtk.overrideAttrs { + src = pkgs.fetchFromGitHub { + owner = "catppuccin"; + repo = "gtk"; + rev = "v1.0.3"; + fetchSubmodules = true; + hash = "sha256-q5/VcFsm3vNEw55zq/vcM11eo456SYE5TQA3g2VQjGc="; + }; - postUnpack = ""; - }).override { - accents = [ "pink" ]; - size = "compact"; - #tweaks = [ "rimless" "black" ]; - variant = "mocha"; - }; + postUnpack = ""; + }).override + { + accents = [ "pink" ]; + size = "compact"; + #tweaks = [ "rimless" "black" ]; + variant = "mocha"; + }; description = "catppuccin gtk theme package"; }; name = mkOption { @@ -59,9 +68,12 @@ in { catppuccin.enable = cfg.enable; # gtk and cursor themes - environment.systemPackages = with cfg; mkIf enable [ - gtk.package cursor.package - ]; + environment.systemPackages = + with cfg; + mkIf enable [ + gtk.package + cursor.package + ]; # override greetd theme programs.regreet = mkIf cfg.enable { diff --git a/home/chrome/home.nix b/home/chrome/home.nix index acf11ae3..75c930d8 100644 --- a/home/chrome/home.nix +++ b/home/chrome/home.nix @@ -1,7 +1,10 @@ -{ pkgs -, lib -, config -, ...}: lib.mkIf config.passthrough.gui { +{ + pkgs, + lib, + config, + ... +}: +lib.mkIf config.passthrough.gui { programs.chromium = { enable = true; package = pkgs.google-chrome; diff --git a/home/chrome/nixos.nix b/home/chrome/nixos.nix index 44a2b5c0..77029763 100644 --- a/home/chrome/nixos.nix +++ b/home/chrome/nixos.nix @@ -1,9 +1,14 @@ -{ pkgs -, lib -, config -, ... }: with lib; let +{ + pkgs, + lib, + config, + ... +}: +with lib; +let gui = with config.global.gpu; enable && session; -in { +in +{ users.home.persist.directories = mkIf gui [ ".config/google-chrome" ]; security.chromiumSuidSandbox.enable = mkIf gui true; environment.sessionVariables.NIXOS_OZONE_WL = "1"; diff --git a/home/foot/home.nix b/home/foot/home.nix index af10a83a..f908ad4f 100644 --- a/home/foot/home.nix +++ b/home/foot/home.nix @@ -1,7 +1,11 @@ -{ pkgs -, lib -, config -, ... }: with lib; mkIf config.passthrough.gui { +{ + pkgs, + lib, + config, + ... +}: +with lib; +mkIf config.passthrough.gui { programs.foot = { enable = true; settings.main.term = "xterm-256color"; diff --git a/home/gnome/home.nix b/home/gnome/home.nix index fa7c5948..60816458 100644 --- a/home/gnome/home.nix +++ b/home/gnome/home.nix @@ -1,9 +1,14 @@ -{ pkgs -, lib -, config -, ... }: with lib; let +{ + pkgs, + lib, + config, + ... +}: +with lib; +let cfg = config.passthrough.gnome; -in { +in +{ imports = [ ./impl/home.nix ./impl/dconf.nix diff --git a/home/gnome/impl/dconf.nix b/home/gnome/impl/dconf.nix index b9d88c18..3865804e 100644 --- a/home/gnome/impl/dconf.nix +++ b/home/gnome/impl/dconf.nix @@ -1,286 +1,341 @@ -{ pkgs -, lib -, config -, ... }: with lib; let +{ + pkgs, + lib, + config, + ... +}: +with lib; +let cfg = config.passthrough.gnome; bg = ../../../share/54345906_p0.jpg; -in mkIf cfg.enable { - dconf.settings = let - p = "org/gnome"; - pd = "${p}/desktop"; - ps = "${p}/shell"; - pse = "${ps}/extensions"; - ptl = "${p}/terminal/legacy"; - ptlp = "${ptl}/profiles:"; - in { - "${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; +in +mkIf cfg.enable { + dconf.settings = + let + p = "org/gnome"; + pd = "${p}/desktop"; + ps = "${p}/shell"; + pse = "${ps}/extensions"; + ptl = "${p}/terminal/legacy"; + ptlp = "${ptl}/profiles:"; + in + { + "${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" = { - default-folder-viewer = "icon-view"; - migrated-gtk-settings = true; - search-filter-time-type = "last_modified"; + "${p}/nautilus/preferences" = { + default-folder-viewer = "icon-view"; + migrated-gtk-settings = true; + 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 = [ "r" ]; + close = [ "q" ]; + minimize = [ "BackSpace" ]; + move-to-workspace-1 = [ "1" ]; + move-to-workspace-2 = [ "2" ]; + move-to-workspace-3 = [ "3" ]; + move-to-workspace-4 = [ "4" ]; + move-to-workspace-left = [ "h" ]; + move-to-workspace-right = [ "l" ]; + switch-to-workspace-1 = [ "1" ]; + switch-to-workspace-2 = [ "2" ]; + switch-to-workspace-3 = [ "3" ]; + switch-to-workspace-4 = [ "4" ]; + toggle-maximized = [ "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 = [ "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 = [ "l" ]; + }; + + "${p}/settings-daemon/plugins/media-keys/custom-keybindings/custom0" = { + binding = "Return"; + command = "kgx"; + name = "Launch console"; + }; + + "${p}/settings-daemon/plugins/media-keys/custom-keybindings/custom1" = { + binding = "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 = [ "r" ]; - close = [ "q" ]; - minimize = [ "BackSpace" ]; - move-to-workspace-1 = [ "1" ]; - move-to-workspace-2 = [ "2" ]; - move-to-workspace-3 = [ "3" ]; - move-to-workspace-4 = [ "4" ]; - move-to-workspace-left = [ "h" ]; - move-to-workspace-right = [ "l" ]; - switch-to-workspace-1 = [ "1" ]; - switch-to-workspace-2 = [ "2" ]; - switch-to-workspace-3 = [ "3" ]; - switch-to-workspace-4 = [ "4" ]; - toggle-maximized = [ "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 = [ "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 = [ "l" ]; - }; - - "${p}/settings-daemon/plugins/media-keys/custom-keybindings/custom0" = { - binding = "Return"; - command = "kgx"; - name = "Launch console"; - }; - - "${p}/settings-daemon/plugins/media-keys/custom-keybindings/custom1" = { - binding = "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"; - }; - }; } diff --git a/home/gnome/impl/home.nix b/home/gnome/impl/home.nix index ff5b9eba..12633ea8 100644 --- a/home/gnome/impl/home.nix +++ b/home/gnome/impl/home.nix @@ -1,23 +1,29 @@ -{ pkgs -, lib -, config -, ... }: with lib; let +{ + pkgs, + lib, + config, + ... +}: +with lib; +let cfg = config.passthrough.gnome; -in mkIf cfg.enable { +in +mkIf cfg.enable { home.packages = - with pkgs; - with gnome; - with gnomeExtensions; [ - # gtk3 theme - adw-gtk3 + with pkgs; + with gnome; + with gnomeExtensions; + [ + # gtk3 theme + adw-gtk3 - # gnomeExtensions - caffeine - dash-to-panel - dash-to-dock - appindicator - privacy-settings-menu - ]; + # gnomeExtensions + caffeine + dash-to-panel + dash-to-dock + appindicator + privacy-settings-menu + ]; catppuccin.enable = mkForce false; home.pointerCursor = mkForce null; @@ -26,7 +32,9 @@ in mkIf cfg.enable { home.persistence."/nix/persist/home/${config.home.username}" = { removePrefixDirectory = true; 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" + ) ]; }; } diff --git a/home/gnome/impl/nixos.nix b/home/gnome/impl/nixos.nix index 985b2676..e8caa813 100644 --- a/home/gnome/impl/nixos.nix +++ b/home/gnome/impl/nixos.nix @@ -1,9 +1,14 @@ -{ pkgs -, lib -, config -, ... }: with lib; let +{ + pkgs, + lib, + config, + ... +}: +with lib; +let cfg = config.home.gnome; -in mkIf cfg.enable { +in +mkIf cfg.enable { global.flatpak.enable = mkDefault true; home.catppuccin.enable = mkDefault false; catppuccin.enable = false; @@ -17,33 +22,43 @@ in mkIf cfg.enable { xdg.portal.configPackages = with pkgs; [ gnome-session ]; services.pulseaudio.enable = false; - environment.gnome.excludePackages = (with pkgs; [ - snapshot - gnome-tour - ] ++ optionals config.global.flatpak.enable [ - baobab - simple-scan - evince - file-roller - geary - loupe - seahorse - totem - epiphany - gnome-calculator - gnome-calendar - gnome-connections - gnome-font-viewer - gnome-text-editor - gnome-characters - gnome-clocks - gnome-contacts - gnome-logs - gnome-maps - gnome-music - gnome-weather - ]) ++ (with pkgs.gnome; [ ] ++ optionals config.global.flatpak.enable [ - ]); + environment.gnome.excludePackages = + ( + with pkgs; + [ + snapshot + gnome-tour + ] + ++ optionals config.global.flatpak.enable [ + baobab + simple-scan + evince + file-roller + geary + loupe + seahorse + totem + epiphany + gnome-calculator + gnome-calendar + gnome-connections + gnome-font-viewer + gnome-text-editor + gnome-characters + gnome-clocks + gnome-contacts + gnome-logs + gnome-maps + gnome-music + gnome-weather + ] + ) + ++ ( + with pkgs.gnome; + [ ] + ++ optionals config.global.flatpak.enable [ + ] + ); users.home.persist.directories = [ ".config/dconf" ]; } diff --git a/home/gnome/nixos.nix b/home/gnome/nixos.nix index c7a3bd26..5593343d 100644 --- a/home/gnome/nixos.nix +++ b/home/gnome/nixos.nix @@ -1,9 +1,14 @@ -{ pkgs -, lib -, config -, ... }: with lib; let +{ + pkgs, + lib, + config, + ... +}: +with lib; +let cfg = config.home.gnome; -in { +in +{ imports = [ ./impl/nixos.nix ]; options.home.gnome = { @@ -16,10 +21,12 @@ in { { passthrough.gnome = cfg; } ]; - specialisation.nognome = with cfg; mkIf enable { - configuration = { - home.gnome.enable = mkForce false; + specialisation.nognome = + with cfg; + mkIf enable { + configuration = { + home.gnome.enable = mkForce false; + }; }; - }; }; } diff --git a/home/gui/home.nix b/home/gui/home.nix index f8423161..56baa9fb 100644 --- a/home/gui/home.nix +++ b/home/gui/home.nix @@ -1,9 +1,14 @@ -{ pkgs -, lib -, config -, ... }: with lib; let +{ + pkgs, + lib, + config, + ... +}: +with lib; +let catppuccin = config.passthrough.catppuccin.enable; -in { +in +{ config = mkIf config.passthrough.gui { # cursor theme home.pointerCursor = { diff --git a/home/gui/nixos.nix b/home/gui/nixos.nix index 0e655654..2e6a0e0f 100644 --- a/home/gui/nixos.nix +++ b/home/gui/nixos.nix @@ -1,10 +1,15 @@ -{ pkgs -, lib -, config -, ... }: with lib; let +{ + pkgs, + lib, + config, + ... +}: +with lib; +let gui = with config.global.gpu; enable && session; catppuccin = config.home.catppuccin; -in { +in +{ config = { users.homeModules = [ # this module passes gui configuration to home-manager @@ -13,13 +18,18 @@ in { users.adminGroups = mkIf gui [ "video" ]; # themes and icons - environment.systemPackages = with pkgs; mkIf gui ([ - papirus-icon-theme - ] ++ optionals (!catppuccin.enable) [ - whitesur-gtk-theme - whitesur-icon-theme - bibata-cursors - ]); + environment.systemPackages = + with pkgs; + mkIf gui ( + [ + papirus-icon-theme + ] + ++ optionals (!catppuccin.enable) [ + whitesur-gtk-theme + whitesur-icon-theme + bibata-cursors + ] + ); fonts.enableDefaultPackages = mkIf gui true; diff --git a/home/gyroflow/home.nix b/home/gyroflow/home.nix index abff2f37..8eb56aaa 100644 --- a/home/gyroflow/home.nix +++ b/home/gyroflow/home.nix @@ -1,13 +1,21 @@ -{ pkgs -, lib -, config -, ... }: with lib; let +{ + pkgs, + lib, + config, + ... +}: +with lib; +let cfg = config.passthrough.gyroflow; -in mkIf cfg.enable { +in +mkIf cfg.enable { # temporarily gone until regression is fixed #home.packages = [ cfg.package ]; wayland.windowManager.sway.config.window.commands = [ - { criteria.app_id = "xyz.gyroflow.gyroflow"; command = "floating enable"; } + { + criteria.app_id = "xyz.gyroflow.gyroflow"; + command = "floating enable"; + } ]; } diff --git a/home/gyroflow/nixos.nix b/home/gyroflow/nixos.nix index 02b46551..2d9a6215 100644 --- a/home/gyroflow/nixos.nix +++ b/home/gyroflow/nixos.nix @@ -1,16 +1,23 @@ -{ pkgs -, lib -, config -, ... }: with lib; let +{ + pkgs, + lib, + config, + ... +}: +with lib; +let cfg = config.home.gyroflow; -in { +in +{ options.home.gyroflow = { enable = mkEnableOption "gyroflow stabilisation software"; package = mkOption { type = with types; package; - default = pkgs.gyroflow.overrideAttrs (finalAttrs: previousAttrs: { - buildInputs = previousAttrs.buildInputs ++ [ pkgs.qt6Packages.qtwayland ]; - }); + default = pkgs.gyroflow.overrideAttrs ( + finalAttrs: previousAttrs: { + buildInputs = previousAttrs.buildInputs ++ [ pkgs.qt6Packages.qtwayland ]; + } + ); description = "gyroflow package"; }; }; diff --git a/home/headless/home.nix b/home/headless/home.nix index e30334d8..0c7e6b96 100644 --- a/home/headless/home.nix +++ b/home/headless/home.nix @@ -1,9 +1,14 @@ -{ pkgs -, lib -, config -, ... }: with lib; let +{ + pkgs, + lib, + config, + ... +}: +with lib; +let cfg = config.passthrough.headless; -in mkIf (cfg.enable != null) { +in +mkIf (cfg.enable != null) { wayland.windowManager.sway.config = { output = { ${cfg.enable}.pos = "0 0"; @@ -13,12 +18,14 @@ in mkIf (cfg.enable != null) { startup = [ { command = "swaymsg create_output && swaymsg output HEADLESS-1 disable"; } ]; }; - home.packages = [ (pkgs.writeShellScriptBin "headless" '' - swaymsg output HEADLESS-1 enable - ${pkgs.wayvnc}/bin/wayvnc \ - --output=HEADLESS-1 \ - ${cfg.extraArgs} \ - ${cfg.host} ${toString cfg.port} - swaymsg output HEADLESS-1 disable - '') ]; + home.packages = [ + (pkgs.writeShellScriptBin "headless" '' + swaymsg output HEADLESS-1 enable + ${pkgs.wayvnc}/bin/wayvnc \ + --output=HEADLESS-1 \ + ${cfg.extraArgs} \ + ${cfg.host} ${toString cfg.port} + swaymsg output HEADLESS-1 disable + '') + ]; } diff --git a/home/headless/nixos.nix b/home/headless/nixos.nix index 77521f05..23a2fce3 100644 --- a/home/headless/nixos.nix +++ b/home/headless/nixos.nix @@ -1,9 +1,14 @@ -{ pkgs -, lib -, config -, ... }: with lib; let +{ + pkgs, + lib, + config, + ... +}: +with lib; +let cfg = config.home.headless; -in { +in +{ options.home.headless = { enable = mkOption { type = with types; nullOr str; diff --git a/home/i3status/home.nix b/home/i3status/home.nix index 4ef150ef..3adeff0f 100644 --- a/home/i3status/home.nix +++ b/home/i3status/home.nix @@ -1,7 +1,11 @@ -{ pkgs -, lib -, config -, ... }: with lib; mkIf config.passthrough.gui { +{ + pkgs, + lib, + config, + ... +}: +with lib; +mkIf config.passthrough.gui { programs.i3status = { enable = true; enableDefault = false; @@ -48,8 +52,9 @@ position = 5; settings = { format = "%1min %5min %15min"; - max_threshold = - removeSuffix "\n" (builtins.readFile (pkgs.runCommandLocal "nproc" { } "nproc > $out")); + max_threshold = removeSuffix "\n" ( + builtins.readFile (pkgs.runCommandLocal "nproc" { } "nproc > $out") + ); }; }; @@ -70,7 +75,9 @@ "tztime local" = { position = 127; - settings = { format = "%Y-%m-%d %H:%M:%S"; }; + settings = { + format = "%Y-%m-%d %H:%M:%S"; + }; }; }; }; diff --git a/home/imv/home.nix b/home/imv/home.nix index e50dc321..107155e7 100644 --- a/home/imv/home.nix +++ b/home/imv/home.nix @@ -1,6 +1,10 @@ -{ pkgs -, lib -, config -, ... }: with lib; mkIf config.passthrough.gui { +{ + pkgs, + lib, + config, + ... +}: +with lib; +mkIf config.passthrough.gui { programs.imv.enable = true; } diff --git a/home/jetbrains/home.nix b/home/jetbrains/home.nix index 637dc689..c390e32a 100644 --- a/home/jetbrains/home.nix +++ b/home/jetbrains/home.nix @@ -1,11 +1,18 @@ -{ pkgs -, lib -, config -, ... }: with lib; let +{ + pkgs, + lib, + config, + ... +}: +with lib; +let cfg = config.passthrough.jetbrains; -in mkIf cfg.enable { - home.packages = with pkgs.jetbrains; [ pkgs.go ] ++ - optional cfg.idea idea-community ++ - optional cfg.clion clion ++ - optional cfg.goland goland; +in +mkIf cfg.enable { + home.packages = + with pkgs.jetbrains; + [ pkgs.go ] + ++ optional cfg.idea idea-community + ++ optional cfg.clion clion + ++ optional cfg.goland goland; } diff --git a/home/jetbrains/nixos.nix b/home/jetbrains/nixos.nix index e2d01f60..2fafe6a9 100644 --- a/home/jetbrains/nixos.nix +++ b/home/jetbrains/nixos.nix @@ -1,14 +1,21 @@ -{ pkgs -, lib -, config -, ... }: with lib; let +{ + pkgs, + lib, + config, + ... +}: +with lib; +let cfg = config.home.jetbrains; -in { +in +{ options.home.jetbrains = { enable = mkEnableOption "jetbrains text editor"; idea = mkEnableOption "intellij idea"; clion = mkEnableOption "clion ide"; - goland = mkEnableOption "goland ide" // { default = true; }; + goland = mkEnableOption "goland ide" // { + default = true; + }; }; config = { diff --git a/home/libreoffice/home.nix b/home/libreoffice/home.nix index 628782af..738f53bf 100644 --- a/home/libreoffice/home.nix +++ b/home/libreoffice/home.nix @@ -1,9 +1,14 @@ -{ pkgs -, lib -, config -, ... }: with lib; let +{ + pkgs, + lib, + config, + ... +}: +with lib; +let cfg = config.passthrough.libreoffice; enable = cfg.enable && (cfg.allUsers || (config.home.username == "app")); -in mkIf enable { +in +mkIf enable { home.packages = with pkgs; [ libreoffice ]; } diff --git a/home/libreoffice/nixos.nix b/home/libreoffice/nixos.nix index 9e911164..adf7dae5 100644 --- a/home/libreoffice/nixos.nix +++ b/home/libreoffice/nixos.nix @@ -1,10 +1,15 @@ -{ pkgs -, lib -, config -, ... }: with lib; let +{ + pkgs, + lib, + config, + ... +}: +with lib; +let cfg = config.home.libreoffice; persist = [ ".config/libreoffice" ]; -in { +in +{ options.home.libreoffice = { enable = mkEnableOption "open source office suite"; allUsers = mkEnableOption "set up for all users"; diff --git a/home/mako/home.nix b/home/mako/home.nix index e246517b..915d108c 100644 --- a/home/mako/home.nix +++ b/home/mako/home.nix @@ -1,7 +1,11 @@ -{ pkgs -, lib -, config -, ... }: with lib; mkIf config.passthrough.gui { +{ + pkgs, + lib, + config, + ... +}: +with lib; +mkIf config.passthrough.gui { services.mako = { enable = true; defaultTimeout = 5000; diff --git a/home/minecraft/home.nix b/home/minecraft/home.nix index 410eef4c..d843da4e 100644 --- a/home/minecraft/home.nix +++ b/home/minecraft/home.nix @@ -1,16 +1,27 @@ -{ pkgs -, lib -, config -, ... }: with lib; let +{ + pkgs, + lib, + config, + ... +}: +with lib; +let inherit (config.passthrough) gui; cfg = config.passthrough.minecraft; enable = cfg.enable && config.home.username == cfg.user; -in mkIf enable { - home.packages = with pkgs; [ - jdk8 - ] ++ optional gui prismlauncher; +in +mkIf enable { + home.packages = + with pkgs; + [ + jdk8 + ] + ++ optional gui prismlauncher; 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"; + } ]; } diff --git a/home/minecraft/nixos.nix b/home/minecraft/nixos.nix index ebbdab5d..76c25a44 100644 --- a/home/minecraft/nixos.nix +++ b/home/minecraft/nixos.nix @@ -1,10 +1,15 @@ -{ pkgs -, lib -, config -, ... }: with lib; let +{ + pkgs, + lib, + config, + ... +}: +with lib; +let cfg = config.home.minecraft; gui = with config.global.gpu; enable && session; -in { +in +{ options.home.minecraft = { enable = mkEnableOption "minecraft game launcher and jvm"; user = mkOption { diff --git a/home/mpv/home.nix b/home/mpv/home.nix index b95bb44c..ef27b031 100644 --- a/home/mpv/home.nix +++ b/home/mpv/home.nix @@ -1,7 +1,11 @@ -{ pkgs -, lib -, config -, ... }: with lib; mkIf config.passthrough.gui { +{ + pkgs, + lib, + config, + ... +}: +with lib; +mkIf config.passthrough.gui { programs.mpv = { enable = true; config = { diff --git a/home/neovim/home.nix b/home/neovim/home.nix index f7b4e534..fe8f4e3c 100644 --- a/home/neovim/home.nix +++ b/home/neovim/home.nix @@ -1,5 +1,8 @@ -{ pkgs -, ... }: { +{ + pkgs, + ... +}: +{ programs.neovim = { enable = true; defaultEditor = true; diff --git a/home/plasma/home.nix b/home/plasma/home.nix index 7c329a8b..04e1d4a8 100644 --- a/home/plasma/home.nix +++ b/home/plasma/home.nix @@ -1,10 +1,15 @@ -{ pkgs -, lib -, config -, ... }: with lib; let +{ + pkgs, + lib, + config, + ... +}: +with lib; +let cfg = config.passthrough.plasma; image = ../../share/54345906_p0.jpg; -in mkIf cfg.enable { +in +mkIf cfg.enable { programs.plasma = { # https://github.com/pjones/plasma-manager enable = true; diff --git a/home/plasma/nixos.nix b/home/plasma/nixos.nix index b1a642cc..9d2a5d7e 100644 --- a/home/plasma/nixos.nix +++ b/home/plasma/nixos.nix @@ -1,10 +1,15 @@ -{ pkgs -, lib -, config -, plasma-manager -, ... }: with lib; let +{ + pkgs, + lib, + config, + plasma-manager, + ... +}: +with lib; +let cfg = config.home.plasma; -in { +in +{ options.home.plasma = { enable = mkEnableOption "plasma desktop and configuration"; specialise = mkEnableOption "enable plasma in a specialisation"; diff --git a/home/profile.nix b/home/profile.nix index ee64c439..cf7e6e70 100644 --- a/home/profile.nix +++ b/home/profile.nix @@ -1,41 +1,48 @@ -{ pkgs -, lib -, config -, inputs -, ... }: with lib; let +{ + pkgs, + lib, + config, + inputs, + ... +}: +with lib; +let cfg = config.users; -in { +in +{ options.users = { profiles = mkOption { - type = with types; attrsOf (submodule { - options = { - uid = mkOption { - type = with types; nullOr int; - default = null; - description = "uid passthrough to base user configuration"; + type = + with types; + attrsOf (submodule { + options = { + uid = mkOption { + 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"; }; @@ -57,11 +64,21 @@ in { }; persist = { files = mkOption { - type = with types; listOf (oneOf [ str (attrsOf str) ]); + type = + with types; + listOf (oneOf [ + str + (attrsOf str) + ]); default = [ ]; }; directories = mkOption { - type = with types; listOf (oneOf [ str (attrsOf str) ]); + type = + with types; + listOf (oneOf [ + str + (attrsOf str) + ]); default = [ ]; }; }; @@ -74,8 +91,9 @@ in { inherit (opts) uid; description = with opts; mkIf (description != null) description; extraGroups = [ "dialout" ] ++ optionals opts.admin cfg.adminGroups; - openssh.authorizedKeys.keys = mkIf (opts.sshLogin && config.services.openssh.enable) - config.global.auth.openssh.publicKeys; + openssh.authorizedKeys.keys = mkIf ( + opts.sshLogin && config.services.openssh.enable + ) config.global.auth.openssh.publicKeys; hashedPasswordFile = "/nix/persist/shadow/${name}"; shell = pkgs.zsh; isNormalUser = mkIf (name != "root") true; @@ -85,98 +103,125 @@ in { # base groups adminGroups = [ - "wheel" "kvm" + "wheel" + "kvm" "systemd-journal" "networkmanager" ]; # base home modules in current directory - homeModules = pipe ./. [ - builtins.readDir - (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"; - }; - } ]; + homeModules = + pipe ./. [ + builtins.readDir + (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"; + }; + } + ]; # basic persistence home.persist = { directories = [ "src" - { directory = ".gnupg"; mode = "0700"; } - { directory = ".ssh"; mode = "0700"; } - { directory = ".local/share/keyrings"; mode = "0700"; } + { + directory = ".gnupg"; + mode = "0700"; + } + { + directory = ".ssh"; + mode = "0700"; + } + { + directory = ".local/share/keyrings"; + mode = "0700"; + } ]; }; }; # mount tmpfs on each user's home directory with appropriate ownership - fileSystems = mapAttrs' - (name: opts: nameValuePair - # nixpkgs quirk: accessing user configuration here causes infinite recursion - # this workaround ensures proper home directory path unless overridden elsewhere - (if name != "root" then "/home/${name}" else "/root") { - device = "homefs"; - fsType = "tmpfs"; - options = [ "size=${cfg.home.size}" - "uid=${builtins.toString opts.uid}" - "gid=${builtins.toString cfg.groups.${cfg.users.${name}.group}.gid}" - "mode=700" ]; + fileSystems = mapAttrs' ( + name: opts: + nameValuePair + # nixpkgs quirk: accessing user configuration here causes infinite recursion + # this workaround ensures proper home directory path unless overridden elsewhere + (if name != "root" then "/home/${name}" else "/root") + { + device = "homefs"; + fsType = "tmpfs"; + options = [ + "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 - # this mounts filesystem in initrd therefore working around that bug - neededForBoot = true; - }) cfg.profiles; + # impermanence sets permissions before filesystems are mounted + # this mounts filesystem in initrd therefore working around that bug + neededForBoot = true; + } + ) cfg.profiles; - global.fs.zfs.mountpoints = mapAttrs' - (name: opts: nameValuePair - "/nix/persist/home/${name}" - "home/${name}") - (filterAttrs (n: _: n != "root") config.users.profiles); + global.fs.zfs.mountpoints = mapAttrs' ( + name: opts: nameValuePair "/nix/persist/home/${name}" "home/${name}" + ) (filterAttrs (n: _: n != "root") config.users.profiles); home-manager.users = mapAttrs (name: opts: { - imports = with inputs; cfg.homeModules ++ [ - impermanence.homeManagerModules.impermanence - catppuccin.homeManagerModules.catppuccin - ]; + imports = + with inputs; + cfg.homeModules + ++ [ + impermanence.homeManagerModules.impermanence + catppuccin.homeManagerModules.catppuccin + ]; home.file.".face" = mkIf (opts.picture != null) { source = opts.picture; }; home.stateVersion = "23.11"; }) cfg.profiles; - system.activationScripts = mapAttrs' - (name: opts: nameValuePair - "${name}-profile-icon" - { - deps = [ "users" ]; - text = let - iconDest = "/var/lib/AccountsService/icons/${name}"; - userConf = pkgs.writeText "${name}-config" '' - [User] - Session= - Icon=${iconDest} - SystemAccount=false - ''; - in '' - install -Dm 0444 ${opts.picture} ${iconDest} - install -Dm 0400 ${userConf} /var/lib/AccountsService/users/${name} - ''; - }) - (filterAttrs (n: _: n != "root") config.users.profiles); + system.activationScripts = mapAttrs' ( + name: opts: + nameValuePair "${name}-profile-icon" { + deps = [ "users" ]; + text = + let + iconDest = "/var/lib/AccountsService/icons/${name}"; + userConf = pkgs.writeText "${name}-config" '' + [User] + Session= + Icon=${iconDest} + SystemAccount=false + ''; + in + '' + install -Dm 0444 ${opts.picture} ${iconDest} + install -Dm 0400 ${userConf} /var/lib/AccountsService/users/${name} + ''; + } + ) (filterAttrs (n: _: n != "root") config.users.profiles); # set up standard persistence for users # this is registered internally for each software's configuration environment.persistence."/nix/persist" = { - users = (mapAttrs (name: _: cfg.home.persist // { - # root workaround, ugly but necessary - # cannot get it properly for the same reason - # mentioned above in fileSystems - home = mkIf (name == "root") "/root"; - }) cfg.profiles); + users = ( + mapAttrs ( + name: _: + cfg.home.persist + // { + # 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; }; diff --git a/home/steam/config.nix b/home/steam/config.nix index 0b696a43..4b663cae 100644 --- a/home/steam/config.nix +++ b/home/steam/config.nix @@ -1,14 +1,27 @@ -{ pkgs -, lib -, config -, ... }: with lib; let +{ + pkgs, + lib, + config, + ... +}: +with lib; +let cfg = config.home.steam; -in mkIf cfg.enable { +in +mkIf cfg.enable { hardware.steam-hardware.enable = true; networking.firewall = { - allowedTCPPorts = [ 27015 27036 ]; + allowedTCPPorts = [ + 27015 + 27036 + ]; allowedUDPPorts = [ 27015 ]; - allowedUDPPortRanges = [ { from = 27031; to = 27036; } ]; + allowedUDPPortRanges = [ + { + from = 27031; + to = 27036; + } + ]; }; } diff --git a/home/steam/home.nix b/home/steam/home.nix index 89fa75bb..6029afbb 100644 --- a/home/steam/home.nix +++ b/home/steam/home.nix @@ -1,17 +1,25 @@ -{ pkgs -, lib -, config -, ... }: with lib; let +{ + pkgs, + lib, + config, + ... +}: +with lib; +let cfg = config.passthrough.steam; enable = cfg.enable && (cfg.allUsers || (config.home.username == "app")); package = config.programs.steam.package; -in mkIf enable { +in +mkIf enable { home.packages = with pkgs; [ cfg.package cfg.package.run ]; wayland.windowManager.sway.config.window.commands = [ - { criteria.class = "steam"; command = "floating enable"; } + { + criteria.class = "steam"; + command = "floating enable"; + } ]; } diff --git a/home/steam/nixos.nix b/home/steam/nixos.nix index cccf99b3..e5786e2c 100644 --- a/home/steam/nixos.nix +++ b/home/steam/nixos.nix @@ -1,10 +1,18 @@ -{ pkgs -, lib -, config -, ... }: with lib; let +{ + pkgs, + lib, + config, + ... +}: +with lib; +let cfg = config.home.steam; - persist = [ ".steam" ".local/share/Steam" ]; -in { + persist = [ + ".steam" + ".local/share/Steam" + ]; +in +{ imports = [ ./config.nix ]; options.home.steam = { diff --git a/home/sway/home.nix b/home/sway/home.nix index 0f389fe4..10dc4ef6 100644 --- a/home/sway/home.nix +++ b/home/sway/home.nix @@ -1,7 +1,11 @@ -{ pkgs -, lib -, config -, ... }: with lib; mkIf config.passthrough.gui { +{ + pkgs, + lib, + config, + ... +}: +with lib; +mkIf config.passthrough.gui { wayland.windowManager.sway = { enable = true; @@ -12,33 +16,38 @@ config = { defaultWorkspace = "workspace number 1"; modifier = "Mod4"; - keybindings = let - modifier = config.wayland.windowManager.sway.config.modifier; - in mkOptionDefault { - XF86MonBrightnessUp = "light -A 5"; - XF86MonBrightnessDown = "light -U 5"; + keybindings = + let + modifier = config.wayland.windowManager.sway.config.modifier; + in + mkOptionDefault { + XF86MonBrightnessUp = "light -A 5"; + XF86MonBrightnessDown = "light -U 5"; - "Control+Alt+l" = "exec swaylock -f --grace 0"; - "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}+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; + "Control+Alt+l" = "exec swaylock -f --grace 0"; + "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}+q" = "exec google-chrome-stable"; + "${modifier}+Home" = "exec ${pkgs.pavucontrol}/bin/pavucontrol"; }; - trayOutput = "primary"; - # sets transparency - colors.background = "00000000"; - } ]; + + bars = [ + { + 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."type:touchpad".tap = "enabled"; diff --git a/home/sway/nixos.nix b/home/sway/nixos.nix index 44b3e32c..950f27fb 100644 --- a/home/sway/nixos.nix +++ b/home/sway/nixos.nix @@ -1,36 +1,48 @@ -{ pkgs -, lib -, config -, ... }: with lib; let +{ + pkgs, + lib, + config, + ... +}: +with lib; +let gui = with config.global.gpu; enable && session; nvidia = with config.global.gpu; type == "nvidia" || type == "prime"; -in mkIf gui { +in +mkIf gui { services.displayManager.sessionPackages = [ - (pkgs.writeTextFile { - name = "sway-session"; - destination = "/share/wayland-sessions/sway.desktop"; - text = '' - [Desktop Entry] - Name=Sway - Comment=An i3-compatible Wayland compositor - Exec=${pkgs.writeTextFile { - name = "sway-wrapper"; - executable = true; - text = '' - #!${pkgs.zsh}/bin/zsh - SHLVL=0 - for profile in ''${(z)NIX_PROFILES}; do - fpath+=($profile/share/zsh/site-functions $profile/share/zsh/$ZSH_VERSION/functions $profile/share/zsh/vendor-completions) - done - exec sway${if nvidia then " --unsupported-gpu" else ""} 2>&1 >> $XDG_CACHE_HOME/sway - ''; - checkPhase = '' - ${pkgs.stdenv.shellDryRun} "$target" - ''; - }} - Type=Application - ''; - } // { providedSessions = [ pkgs.sway.meta.mainProgram ]; }) + ( + pkgs.writeTextFile { + name = "sway-session"; + destination = "/share/wayland-sessions/sway.desktop"; + text = '' + [Desktop Entry] + Name=Sway + Comment=An i3-compatible Wayland compositor + Exec=${ + pkgs.writeTextFile { + name = "sway-wrapper"; + executable = true; + text = '' + #!${pkgs.zsh}/bin/zsh + SHLVL=0 + for profile in ''${(z)NIX_PROFILES}; do + fpath+=($profile/share/zsh/site-functions $profile/share/zsh/$ZSH_VERSION/functions $profile/share/zsh/vendor-completions) + done + exec sway${if nvidia then " --unsupported-gpu" else ""} 2>&1 >> $XDG_CACHE_HOME/sway + ''; + checkPhase = '' + ${pkgs.stdenv.shellDryRun} "$target" + ''; + } + } + Type=Application + ''; + } + // { + providedSessions = [ pkgs.sway.meta.mainProgram ]; + } + ) ]; programs.light.enable = true; diff --git a/home/swayidle/home.nix b/home/swayidle/home.nix index c7d0daef..1e1e2e15 100644 --- a/home/swayidle/home.nix +++ b/home/swayidle/home.nix @@ -1,24 +1,40 @@ -{ pkgs -, lib -, config -, ... }: with lib; mkIf config.passthrough.gui { - services.swayidle = let - sway = config.wayland.windowManager.sway.package; - swaymsg = "${sway}/bin/swaymsg"; - swaylock = "${config.programs.swaylock.package}/bin/swaylock"; - in { - 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"; } - ]; - }; +{ + pkgs, + lib, + config, + ... +}: +with lib; +mkIf config.passthrough.gui { + services.swayidle = + let + sway = config.wayland.windowManager.sway.package; + swaymsg = "${sway}/bin/swaymsg"; + swaylock = "${config.programs.swaylock.package}/bin/swaylock"; + in + { + 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 wayland.windowManager.sway.config.window.commands = [ - { criteria.shell = ".*"; command = "inhibit_idle fullscreen"; } + { + criteria.shell = ".*"; + command = "inhibit_idle fullscreen"; + } ]; } diff --git a/home/swaylock/home.nix b/home/swaylock/home.nix index 25a72c88..95e18591 100644 --- a/home/swaylock/home.nix +++ b/home/swaylock/home.nix @@ -1,7 +1,11 @@ -{ pkgs -, lib -, config -, ... }: with lib; mkIf config.passthrough.gui { +{ + pkgs, + lib, + config, + ... +}: +with lib; +mkIf config.passthrough.gui { programs.swaylock = { enable = true; package = pkgs.swaylock-effects; diff --git a/home/swaylock/nixos.nix b/home/swaylock/nixos.nix index 3891904b..53295198 100644 --- a/home/swaylock/nixos.nix +++ b/home/swaylock/nixos.nix @@ -1,8 +1,13 @@ -{ pkgs -, lib -, config -, ... }: with lib; let +{ + pkgs, + lib, + config, + ... +}: +with lib; +let gui = with config.global.gpu; enable && session; -in mkIf gui { +in +mkIf gui { security.pam.services.swaylock = { }; } diff --git a/home/util/home.nix b/home/util/home.nix index 2c377008..678e6349 100644 --- a/home/util/home.nix +++ b/home/util/home.nix @@ -1,33 +1,61 @@ -{ pkgs -, lib -, config -, ... }: with lib; let +{ + pkgs, + lib, + config, + ... +}: +with lib; +let cfg = config.passthrough.util; -in { - home.packages = with pkgs; [ - pv file wget e2fsprogs - ] ++ 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 +in +{ + home.packages = + with pkgs; + [ + pv + file + wget + e2fsprogs + ] + ++ 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 - inav-configurator - inav-blackbox-tools - (blhelisuite32.override { workdir = "${config.home.homeDirectory}/.blhelisuite32"; }) - ] ++ optionals (config.passthrough.gui && !config.passthrough.flatpak.enable) [ - xfce.thunar gimp - jellyfin-media-player - betaflight-configurator - expresslrs-configurator - ]; + mission-planner + inav-configurator + inav-blackbox-tools + (blhelisuite32.override { workdir = "${config.home.homeDirectory}/.blhelisuite32"; }) + ] + ++ optionals (config.passthrough.gui && !config.passthrough.flatpak.enable) [ + xfce.thunar + gimp + jellyfin-media-player + betaflight-configurator + expresslrs-configurator + ]; 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"; + } ]; } diff --git a/home/util/nixos.nix b/home/util/nixos.nix index 990d9e61..25a7816e 100644 --- a/home/util/nixos.nix +++ b/home/util/nixos.nix @@ -1,10 +1,15 @@ -{ pkgs -, lib -, config -, ... }: with lib; let +{ + pkgs, + lib, + config, + ... +}: +with lib; +let cfg = config.home.util; gui = with config.global.gpu; enable && session; -in { +in +{ options.home.util = { minimal = mkEnableOption "minimal system environment with less packages"; }; @@ -20,25 +25,26 @@ in { programs.zsh.enable = true; environment.shells = singleton pkgs.zsh; - users.home.persist.directories = [ ] ++ - optionals (!cfg.minimal) [ - ".cache/nix-index" - ] ++ - optionals gui [ - # mission-planner - ".local/share/Mission Planner" - # inav-configurator - ".config/inav-configurator" - ] ++ - optionals (gui && !config.global.flatpak.enable) [ - # jellyfin-media-player - ".config/jellyfin.org" - ".local/share/jellyfinmediaplayer" - ".local/share/Jellyfin Media Player" - # expresslrs-configurator - ".config/ExpressLRS Configurator" - # betaflight-configurator - ".config/betaflight-configurator" - ]; + users.home.persist.directories = + [ ] + ++ optionals (!cfg.minimal) [ + ".cache/nix-index" + ] + ++ optionals gui [ + # mission-planner + ".local/share/Mission Planner" + # inav-configurator + ".config/inav-configurator" + ] + ++ optionals (gui && !config.global.flatpak.enable) [ + # jellyfin-media-player + ".config/jellyfin.org" + ".local/share/jellyfinmediaplayer" + ".local/share/Jellyfin Media Player" + # expresslrs-configurator + ".config/ExpressLRS Configurator" + # betaflight-configurator + ".config/betaflight-configurator" + ]; }; } diff --git a/home/virt-manager/home.nix b/home/virt-manager/home.nix index b5bf3e67..8e2a038c 100644 --- a/home/virt-manager/home.nix +++ b/home/virt-manager/home.nix @@ -1,58 +1,73 @@ -{ pkgs -, lib -, config -, ... }: with lib; mkIf config.passthrough.gui { - dconf.settings = let - p = "org/virt-manager/virt-manager"; - in { - ${p} = { - xmleditor-enabled = true; - # swaybar tray doesn't really work - system-tray = false; - }; +{ + pkgs, + lib, + config, + ... +}: +with lib; +mkIf config.passthrough.gui { + dconf.settings = + let + 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}/console" = { - scaling = 0; - auto-redirect = false; - resize-guest = 1; - }; - "${p}/stats" = { - enable-memory-poll = true; - enable-disk-poll = true; - enable-net-poll = true; - }; - "${p}/vmlist-fields" = { - host-cpu-usage = true; - memory-usage = true; - disk-usage = true; - network-traffic = true; - }; + "${p}/details".show-toolbar = true; + "${p}/console" = { + scaling = 0; + auto-redirect = false; + resize-guest = 1; + }; + "${p}/stats" = { + enable-memory-poll = true; + enable-disk-poll = true; + enable-net-poll = true; + }; + "${p}/vmlist-fields" = { + host-cpu-usage = true; + memory-usage = true; + disk-usage = true; + network-traffic = true; + }; - "${p}/new-vm" = { - firmware = "uefi"; - graphics-type = "system"; - }; + "${p}/new-vm" = { + firmware = "uefi"; + graphics-type = "system"; + }; - "${p}/confirm" = { - unapplied-dev = true; - removedev = true; - delete-storage = true; - forcepoweroff = false; - }; + "${p}/confirm" = { + unapplied-dev = true; + removedev = true; + delete-storage = true; + forcepoweroff = false; + }; - "${p}/connections" = let - uri = "qemu:///system"; - in { - uris = [ uri ]; - autoconnect = [ uri ]; + "${p}/connections" = + let + uri = "qemu:///system"; + in + { + uris = [ uri ]; + autoconnect = [ uri ]; + }; + "${p}/conns/qemu:system".pretty-name = "KVM"; }; - "${p}/conns/qemu:system".pretty-name = "KVM"; - }; # floating other than main window 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"; + } ]; } diff --git a/home/virt-manager/nixos.nix b/home/virt-manager/nixos.nix index fc865a12..fd0c5ba4 100644 --- a/home/virt-manager/nixos.nix +++ b/home/virt-manager/nixos.nix @@ -1,8 +1,13 @@ -{ pkgs -, lib -, config -, ... }: with lib; let +{ + pkgs, + lib, + config, + ... +}: +with lib; +let gui = with config.global.gpu; enable && session; -in mkIf gui { +in +mkIf gui { programs.virt-manager.enable = true; } diff --git a/home/vscode/home.nix b/home/vscode/home.nix index b6ab9c29..501adb37 100644 --- a/home/vscode/home.nix +++ b/home/vscode/home.nix @@ -1,10 +1,15 @@ -{ pkgs -, lib -, config -, ... }: with lib; let +{ + pkgs, + lib, + config, + ... +}: +with lib; +let cfg = config.passthrough.vscode; theme = config.passthrough.catppuccin.enable; -in mkIf cfg.enable { +in +mkIf cfg.enable { programs.vscode = { enable = true; mutableExtensionsDir = false; @@ -12,8 +17,11 @@ in mkIf cfg.enable { enableExtensionUpdateCheck = false; package = pkgs.vscodium; extensions = with pkgs.vscode-extensions; [ - catppuccin.catppuccin-vsc catppuccin.catppuccin-vsc-icons - bbenoist.nix golang.go rust-lang.rust-analyzer + catppuccin.catppuccin-vsc + catppuccin.catppuccin-vsc-icons + bbenoist.nix + golang.go + rust-lang.rust-analyzer ]; userSettings = { "workbench.colorTheme" = mkIf theme "Catppuccin Mocha"; diff --git a/home/vscode/nixos.nix b/home/vscode/nixos.nix index 7ecffe47..8b2a943f 100644 --- a/home/vscode/nixos.nix +++ b/home/vscode/nixos.nix @@ -1,9 +1,14 @@ -{ pkgs -, lib -, config -, ... }: with lib; let +{ + pkgs, + lib, + config, + ... +}: +with lib; +let cfg = config.home.vscode; -in { +in +{ options.home.vscode = { enable = mkEnableOption "vscode text editor"; }; diff --git a/home/wofi/home.nix b/home/wofi/home.nix index 2d65308c..c2c3ef40 100644 --- a/home/wofi/home.nix +++ b/home/wofi/home.nix @@ -1,7 +1,11 @@ -{ pkgs -, lib -, config -, ... }: with lib; mkIf config.passthrough.gui { +{ + pkgs, + lib, + config, + ... +}: +with lib; +mkIf config.passthrough.gui { programs.wofi = { enable = true; settings.mode = "drun"; diff --git a/home/xdg/home.nix b/home/xdg/home.nix index ff3f93d5..874415f9 100644 --- a/home/xdg/home.nix +++ b/home/xdg/home.nix @@ -1,21 +1,26 @@ -{ config -, ... }: { +{ + config, + ... +}: +{ xdg = { enable = true; - userDirs = let - home = config.home.homeDirectory; - local = "${home}/local"; - in { - enable = true; - createDirectories = true; - download = "${home}/dl"; - desktop = "${local}/desktop"; - documents = "${local}/documents"; - music = "${local}/music"; - pictures = "${local}/pictures"; - publicShare = "${local}/public"; - templates = "${local}/templates"; - videos = "${local}/videos"; - }; + userDirs = + let + home = config.home.homeDirectory; + local = "${home}/local"; + in + { + enable = true; + createDirectories = true; + download = "${home}/dl"; + desktop = "${local}/desktop"; + documents = "${local}/documents"; + music = "${local}/music"; + pictures = "${local}/pictures"; + publicShare = "${local}/public"; + templates = "${local}/templates"; + videos = "${local}/videos"; + }; }; } diff --git a/home/xdg/nixos.nix b/home/xdg/nixos.nix index f6e35f91..21fdf421 100644 --- a/home/xdg/nixos.nix +++ b/home/xdg/nixos.nix @@ -1,3 +1,6 @@ { - users.home.persist.directories = [ "local" "dl" ]; + users.home.persist.directories = [ + "local" + "dl" + ]; } diff --git a/home/zsh/home.nix b/home/zsh/home.nix index 6c33c92f..b3c77aed 100644 --- a/home/zsh/home.nix +++ b/home/zsh/home.nix @@ -1,24 +1,32 @@ -{ config -, ... }: { +{ + config, + ... +}: +{ programs.zsh = { enable = true; autocd = false; defaultKeymap = "emacs"; - localVariables.PROMPT = let - op = { - 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" "%#"} "; + localVariables.PROMPT = + let + op = { + 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" "%#"} "; sessionVariables.LIBVIRT_DEFAULT_URI = "qemu:///system"; history = { extended = true; path = "${config.home.homeDirectory}/.local/state/zsh/history"; ignorePatterns = [ - "rm *" "reboot" - "kill *" "killall *" "pkill *" + "rm *" + "reboot" + "kill *" + "killall *" + "pkill *" ]; }; diff --git a/home/zsh/nixos.nix b/home/zsh/nixos.nix index 9de101b0..0a8b0131 100644 --- a/home/zsh/nixos.nix +++ b/home/zsh/nixos.nix @@ -1,3 +1,8 @@ { - users.home.persist.directories = [ { directory = ".local/state/zsh"; mode = "0700"; } ]; + users.home.persist.directories = [ + { + directory = ".local/state/zsh"; + mode = "0700"; + } + ]; } diff --git a/package/blhelisuite32/default.nix b/package/blhelisuite32/default.nix index 061d537b..75637c7e 100644 --- a/package/blhelisuite32/default.nix +++ b/package/blhelisuite32/default.nix @@ -1,11 +1,14 @@ -{ lib -, libicns -, p7zip -, fetchzip -, stdenvNoCC -, makeDesktopItem -, buildFHSEnv -, workdir ? "/tmp/blhelisuite32" }: let +{ + lib, + libicns, + p7zip, + fetchzip, + stdenvNoCC, + makeDesktopItem, + buildFHSEnv, + workdir ? "/tmp/blhelisuite32", +}: +let name = "BLHeliSuite32"; pname = "blhelisuite32"; version = "32.10"; @@ -35,7 +38,10 @@ hash = "sha256-StRnrVI8p51vNsTMO1LtaZvENbG7XZ1V/mKHe4pO7kU="; }; - nativeBuildInputs = [ libicns p7zip ]; + nativeBuildInputs = [ + libicns + p7zip + ]; configurePhase = '' 7z x *.dmg @@ -53,7 +59,11 @@ linked = stdenvNoCC.mkDerivation { inherit pname version; - phases = [ "unpackPhase" "patchPhase" "installPhase" ]; + phases = [ + "unpackPhase" + "patchPhase" + "installPhase" + ]; src = dist; installPhase = '' @@ -64,29 +74,40 @@ ln -s ${workdir}/music $out/Music ''; }; -in buildFHSEnv { +in +buildFHSEnv { inherit pname version; - targetPkgs = pkgs: (with pkgs; [ - glib libGL curl - libgcc gtk3 - zlib systemdLibs - ]); - extraInstallCommands = let - mkIconScale = scale: - "install -m 444 -D ${icons}/${name}xm_${scale}x${scale}x32.png $out/share/icons/hicolor/${scale}x${scale}/apps/${pname}.png"; - in '' - ${mkIconScale "16"} - ${mkIconScale "32"} - ${mkIconScale "64"} - ${mkIconScale "128"} - ${mkIconScale "256"} - ${mkIconScale "512"} - ${mkIconScale "1024"} - cp -r ${desktopItem}/share/applications $out/share/ - ''; + targetPkgs = + pkgs: + (with pkgs; [ + glib + libGL + curl + libgcc + gtk3 + zlib + systemdLibs + ]); + extraInstallCommands = + let + mkIconScale = + scale: + "install -m 444 -D ${icons}/${name}xm_${scale}x${scale}x32.png $out/share/icons/hicolor/${scale}x${scale}/apps/${pname}.png"; + 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 '" + - "mkdir -p ${workdir}/settings && " + - "mkdir -p ${workdir}/music && " + - "exec ${linked}/${name}xl'"; + runScript = + "sh -c '" + + "mkdir -p ${workdir}/settings && " + + "mkdir -p ${workdir}/music && " + + "exec ${linked}/${name}xl'"; } diff --git a/package/default.nix b/package/default.nix index 3f21f9d6..4c12f253 100644 --- a/package/default.nix +++ b/package/default.nix @@ -1,15 +1,22 @@ -{ lib, ... }: { - nixpkgs.overlays = [ (final: prev: - builtins.listToAttrs (map (pkg: { - name = pkg; - value = let - argsPath = ./${pkg}/args.nix; - in final.callPackage ./${pkg} - (if (builtins.pathExists argsPath) then - (import argsPath final) - else { }); - }) (builtins.attrNames (builtins.readDir ./.))) - ) ]; +{ lib, ... }: +{ + nixpkgs.overlays = [ + ( + final: prev: + builtins.listToAttrs ( + map (pkg: { + name = pkg; + value = + let + argsPath = ./${pkg}/args.nix; + in + final.callPackage ./${pkg} ( + if (builtins.pathExists argsPath) then (import argsPath final) else { } + ); + }) (builtins.attrNames (builtins.readDir ./.)) + ) + ) + ]; imports = lib.pipe ./. [ builtins.readDir diff --git a/package/expresslrs-configurator/default.nix b/package/expresslrs-configurator/default.nix index 4112a4dc..41e3603b 100644 --- a/package/expresslrs-configurator/default.nix +++ b/package/expresslrs-configurator/default.nix @@ -1,8 +1,11 @@ -{ lib -, fetchzip -, makeDesktopItem -, imagemagick -, buildFHSEnv }: let +{ + lib, + fetchzip, + makeDesktopItem, + imagemagick, + buildFHSEnv, +}: +let name = "ExpressLRS-Configurator"; pname = "expresslrs-configurator"; version = "1.7.2"; @@ -22,24 +25,70 @@ desktopName = "ExpressLRS Configurator"; genericName = "radio link configuration & build tool"; }; -in buildFHSEnv { +in +buildFHSEnv { inherit pname version; # copied from chromium deps - targetPkgs = pkgs: (with pkgs; [ - glib fontconfig freetype pango cairo xorg.libX11 xorg.libXi atk nss nspr - 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 - ]); + targetPkgs = + pkgs: + (with pkgs; [ + glib + fontconfig + freetype + pango + cairo + xorg.libX11 + xorg.libXi + atk + nss + nspr + 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 = '' mkdir -p $out/share ${imagemagick}/bin/convert ${dist}/resources/assets/icon.png -resize 128x128 icon-128.png diff --git a/package/photoview/default.nix b/package/photoview/default.nix index be549841..c390d7d8 100644 --- a/package/photoview/default.nix +++ b/package/photoview/default.nix @@ -1,18 +1,21 @@ -{ lib -, pkg-config -, libjpeg_turbo -, libheif -, lapack -, dlib -, blas -, ffmpeg -, exiftool -, darktable -, fetchFromGitHub -, buildGoModule -, buildNpmPackage -, runCommandLocal -, makeWrapper }: buildGoModule rec { +{ + lib, + pkg-config, + libjpeg_turbo, + libheif, + lapack, + dlib, + blas, + ffmpeg, + exiftool, + darktable, + fetchFromGitHub, + buildGoModule, + buildNpmPackage, + runCommandLocal, + makeWrapper, +}: +buildGoModule rec { pname = "photoview"; version = "2.4.0"; @@ -45,7 +48,7 @@ #REACT_APP_API_ENDPOINT = ""; 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"; npmDepsHash = "sha256-wUbfq+7SuJUBxfy9TxHVda8A0g4mmYCbzJT64XBN2mI="; @@ -56,11 +59,13 @@ mv "$out/bin/api" "$out/bin/${pname}" wrapProgram $out/bin/${pname} \ - --prefix PATH ":" "${lib.makeBinPath [ - ffmpeg - exiftool - darktable - ]}" \ + --prefix PATH ":" "${ + lib.makeBinPath [ + ffmpeg + exiftool + darktable + ] + }" \ --set PHOTOVIEW_SERVE_UI 1 \ --set PHOTOVIEW_UI_PATH "$out/lib/${pname}/ui" cp -r \ diff --git a/package/photoview/nixos.nix b/package/photoview/nixos.nix index 08c7d167..dbaa6cfd 100644 --- a/package/photoview/nixos.nix +++ b/package/photoview/nixos.nix @@ -1,9 +1,14 @@ -{ pkgs -, lib -, config -, ... }: with lib; let +{ + pkgs, + lib, + config, + ... +}: +with lib; +let cfg = config.services.photoview; -in { +in +{ options.services.photoview = { enable = mkEnableOption "photoview server"; @@ -39,7 +44,13 @@ in { database = { driver = mkOption { - type = with types; enum [ "sqlite" "mysql" "postgres" ]; + type = + with types; + enum [ + "sqlite" + "mysql" + "postgres" + ]; default = "sqlite"; description = "database driver"; }; diff --git a/package/tubesync/default.nix b/package/tubesync/default.nix index 5318f882..f7eb84a7 100644 --- a/package/tubesync/default.nix +++ b/package/tubesync/default.nix @@ -1,43 +1,68 @@ -{ lib -, stdenvNoCC -, ffmpeg -, rtmpdump -, atomicparsley -, callPackage -, fetchFromGitHub -, fetchPypi -, fetchpatch -, makeWrapper -, python3Packages }: with python3Packages; let - mkPypi = pname: version: src: format: buildPythonPackage { - inherit pname version src format; - doCheck = false; - nativeBuildInputs = [ setuptools ]; - }; +{ + lib, + stdenvNoCC, + ffmpeg, + rtmpdump, + atomicparsley, + callPackage, + fetchFromGitHub, + fetchPypi, + fetchpatch, + makeWrapper, + python3Packages, +}: +with python3Packages; +let + mkPypi = + pname: version: src: format: + buildPythonPackage { + inherit + pname + version + src + format + ; + doCheck = false; + nativeBuildInputs = [ setuptools ]; + }; - mkPypi' = pname: version: hash: format: mkPypi pname version - (fetchPypi { - inherit pname version hash; - }) format; + mkPypi' = + pname: version: hash: format: + mkPypi pname version (fetchPypi { + inherit pname version hash; + }) format; - mkPypi'' = pname: version: hash: mkPypi' pname version hash - "setuptools"; + mkPypi'' = + pname: version: hash: + mkPypi' pname version hash "setuptools"; - django-compat = mkPypi'' "django-compat" "1.0.15" "sha256-OsmjvtxWuTZdnrJBvFFX0MGTdpv5lfmnjcG8JOfCMxs="; - django-appconf = 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-compat = + mkPypi'' "django-compat" "1.0.15" + "sha256-OsmjvtxWuTZdnrJBvFFX0MGTdpv5lfmnjcG8JOfCMxs="; + django-appconf = + 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 - pname = "django-compressor"; - version = "4.4"; - in mkPypi pname version (fetchFromGitHub { - owner = pname; - repo = pname; - rev = "refs/tags/${version}"; - hash = "sha256-c9uS5Z077b23Aj8jV30XNsshbEfrLRX3ozXasitQ6UQ="; - }) "setuptools"; + django-compressor = + let + pname = "django-compressor"; + version = "4.4"; + in + mkPypi pname version (fetchFromGitHub { + owner = pname; + repo = pname; + rev = "refs/tags/${version}"; + hash = "sha256-c9uS5Z077b23Aj8jV30XNsshbEfrLRX3ozXasitQ6UQ="; + }) "setuptools"; app = buildPythonApplication rec { pname = "tubesync"; @@ -59,22 +84,30 @@ ./ensure-fragments.patch ]; - propagatedBuildInputs = [ - yt-dlp requests - httptools pillow - gunicorn whitenoise - psycopg2 mysqlclient - redis hiredis - libsass six - ] ++ [ - django_3 - django-compat - django-appconf - django-compressor - django-basicauth - django-sass-processor - django-background-tasks - ]; + propagatedBuildInputs = + [ + yt-dlp + requests + httptools + pillow + gunicorn + whitenoise + psycopg2 + mysqlclient + redis + hiredis + libsass + six + ] + ++ [ + django_3 + django-compat + django-appconf + django-compressor + django-basicauth + django-sass-processor + django-background-tasks + ]; buildPhase = '' mv "tubesync/tubesync/local_settings.py.container" "tubesync/tubesync/local_settings.py" @@ -97,40 +130,51 @@ ''; }; - ffmpegFix = ffmpeg.overrideAttrs (finalAttrs: previousAttrs: { - patches = previousAttrs.patches ++ [ (fetchpatch { - name = "avformat-webvttdec-skip-style-region.patch"; - url = "https://git.ffmpeg.org/gitweb/ffmpeg.git/patch/51d303e20cbb0874172f50b5172c515a973587d4"; - hash = "sha256-dxCjKZUz2H2QyktsprkzyfNp5aDG6X8deF4ZGdvhvfk="; - }) ]; - }); -in stdenvNoCC.mkDerivation { + ffmpegFix = ffmpeg.overrideAttrs ( + finalAttrs: previousAttrs: { + patches = previousAttrs.patches ++ [ + (fetchpatch { + name = "avformat-webvttdec-skip-style-region.patch"; + url = "https://git.ffmpeg.org/gitweb/ffmpeg.git/patch/51d303e20cbb0874172f50b5172c515a973587d4"; + hash = "sha256-dxCjKZUz2H2QyktsprkzyfNp5aDG6X8deF4ZGdvhvfk="; + }) + ]; + } + ); +in +stdenvNoCC.mkDerivation { pname = "${app.pname}-wrapped"; inherit (app) version; nativeBuildInputs = [ makeWrapper ]; unpackPhase = "true"; - installPhase = let - prefix = ''--prefix PATH : "${lib.makeBinPath [ - ffmpegFix rtmpdump atomicparsley - ]}"''; - in '' - mkdir -p "$out/bin" + installPhase = + let + prefix = ''--prefix PATH : "${ + lib.makeBinPath [ + ffmpegFix + rtmpdump + atomicparsley + ] + }"''; + in + '' + mkdir -p "$out/bin" - makeWrapper "${python}/bin/python3" "$out/bin/tubesync-worker" \ - --chdir ${app}/app --add-flags \ - "${app}/app/manage.py process_tasks" \ - ${prefix} + makeWrapper "${python}/bin/python3" "$out/bin/tubesync-worker" \ + --chdir ${app}/app --add-flags \ + "${app}/app/manage.py process_tasks" \ + ${prefix} - makeWrapper "${gunicorn}/bin/gunicorn" "$out/bin/tubesync-gunicorn" \ - --chdir ${app}/app --add-flags \ - "-c ${app}/app/tubesync/gunicorn.py --capture-output tubesync.wsgi:application" \ - ${prefix} + makeWrapper "${gunicorn}/bin/gunicorn" "$out/bin/tubesync-gunicorn" \ + --chdir ${app}/app --add-flags \ + "-c ${app}/app/tubesync/gunicorn.py --capture-output tubesync.wsgi:application" \ + ${prefix} - makeWrapper "${python}/bin/python3" "$out/bin/tubesync-migrate" \ - --chdir "${app}/app" --add-flags \ - "${app}/app/manage.py migrate" - ''; + makeWrapper "${python}/bin/python3" "$out/bin/tubesync-migrate" \ + --chdir "${app}/app" --add-flags \ + "${app}/app/manage.py migrate" + ''; passthru = { inherit app; diff --git a/package/tubesync/nixos.nix b/package/tubesync/nixos.nix index 383503a9..da32df0f 100644 --- a/package/tubesync/nixos.nix +++ b/package/tubesync/nixos.nix @@ -1,9 +1,14 @@ -{ pkgs -, lib -, config -, ... }: with lib; let +{ + pkgs, + lib, + config, + ... +}: +with lib; +let cfg = config.services.tubesync; -in { +in +{ options.services.tubesync = { enable = mkEnableOption "tubesync stack"; debug = mkEnableOption "debug logging"; @@ -63,100 +68,107 @@ in { }; config = mkIf cfg.enable { - systemd.services = let - env = { - GUNICORN_PID_FILE = "${cfg.stateDir}/run/gunicorn.pid"; - GUNICORN_USER = cfg.user; - GUNICORN_GROUP = cfg.group; - DATABASE_CONNECTION = cfg.database; - CONFIG_BASE_DIR = cfg.stateDir; - DOWNLOADS_BASE_DIR = cfg.dataDir; - TUBESYNC_DEBUG = mkIf cfg.debug "True"; - TUBESYNC_WORKERS = toString cfg.workers; + systemd.services = + let + env = { + GUNICORN_PID_FILE = "${cfg.stateDir}/run/gunicorn.pid"; + GUNICORN_USER = cfg.user; + GUNICORN_GROUP = cfg.group; + DATABASE_CONNECTION = cfg.database; + CONFIG_BASE_DIR = cfg.stateDir; + DOWNLOADS_BASE_DIR = cfg.dataDir; + TUBESYNC_DEBUG = mkIf cfg.debug "True"; + TUBESYNC_WORKERS = toString cfg.workers; - PYTHONPATH = cfg.package.pythonPath; - REDIS_CONNECTION = "redis+socket://" - + "${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"; + PYTHONPATH = cfg.package.pythonPath; + REDIS_CONNECTION = "redis+socket://" + "${cfg.stateDir}/run/redis.sock"; }; - }; - base' = 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" - - mkdir -p "/tmp/tubesync" - 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" - ''; + 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"; + }; }; - }); - tubesync-worker = recursiveUpdate (base' "worker") ({ - serviceConfig.ExecStart = "${cfg.package}/bin/tubesync-worker"; - }); + base' = + 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 - redis-tubesync-celery.serviceConfig.ReadWritePaths = [ "${cfg.stateDir}/run" ]; - }; + mkdir -p "/tmp/tubesync" + 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 = { enable = true; diff --git a/spec/channel.nix b/spec/channel.nix index 33b377f3..59ec76e0 100644 --- a/spec/channel.nix +++ b/spec/channel.nix @@ -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)); channelPath = "/etc/nix/channels"; -in { +in +{ nix = { nixPath = mapInputs (i: "${i}=${channelPath}/${i}"); - registry = listToAttrs - (mapInputs (name: { + registry = listToAttrs ( + mapInputs (name: { inherit name; - value = {flake = inputs.${name};}; - })); + value = { + flake = inputs.${name}; + }; + }) + ); }; systemd.tmpfiles.rules = mapInputs (i: "L+ ${channelPath}/${i} - - - - ${inputs.${i}.outPath}"); diff --git a/spec/chireiden/default.nix b/spec/chireiden/default.nix index f59fbf08..9f4e7eb8 100644 --- a/spec/chireiden/default.nix +++ b/spec/chireiden/default.nix @@ -1,4 +1,5 @@ -{ pkgs, ... }: { +{ pkgs, ... }: +{ global = { id = "5d3c16fe58444e12ad621600039f10af"; fs.esp.uuid = "32A5-6257"; @@ -7,7 +8,10 @@ fs.external.enable = true; fs.external.device = "/dev/disk/by-uuid/af2b8ec5-62d8-4b14-8ba8-083cc4fb33f4"; fs.external.fsType = "btrfs"; - fs.external.options = [ "noatime" "compress=zstd" ]; + fs.external.options = [ + "noatime" + "compress=zstd" + ]; fs.cryptsetup.enable = true; fs.cryptsetup.uuids.nix = "3905f87f-7b11-49ef-8ddf-f4202c555ffd"; fs.cryptsetup.uuids.persist = "b2322f01-1c44-433f-a995-4ddce5845cf9"; @@ -38,9 +42,15 @@ nvidiaBusId = "PCI:5:0:0"; }; - boot.plymouth.catppuccin.enable = false; + catppuccin.plymouth.enable = false; 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.kernelModules = [ "kvm-intel" ]; boot.extraModulePackages = [ ]; diff --git a/spec/constant.nix b/spec/constant.nix index e315b671..e19c10d2 100644 --- a/spec/constant.nix +++ b/spec/constant.nix @@ -2,7 +2,10 @@ i18n.defaultLocale = "en_GB.UTF-8"; time.timeZone = "Asia/Hong_Kong"; 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; system.stateVersion = "23.11"; } diff --git a/spec/default.nix b/spec/default.nix index 021aa4c1..3e8850d8 100644 --- a/spec/default.nix +++ b/spec/default.nix @@ -1,31 +1,44 @@ -{ inputs, ... }: with inputs; with nixpkgs.lib; { - flake.nixosConfigurations = (lists.foldr (name: spec: spec // { - ${name} = nixpkgs.lib.nixosSystem { - system = "x86_64-linux"; - specialArgs = inputs // { inherit inputs; }; - modules = [ - ../global - ../home/profile.nix - ../home/user.nix - ../package - ./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 +{ inputs, ... }: +with inputs; +with nixpkgs.lib; +{ + flake.nixosConfigurations = + (lists.foldr ( + name: spec: + spec + // { + ${name} = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + specialArgs = inputs // { + inherit inputs; + }; + modules = [ + ../global + ../home/profile.nix + ../home/user.nix + ../package + ./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} - { networking.hostName = name; } - ]; - }; - }) { }) (pipe ./. [ - builtins.readDir - (filterAttrs (n: ty: ty == "directory" && builtins.pathExists ./${n}/default.nix)) - (mapAttrsToList (n: _: n)) - ]); + ./${name} + { networking.hostName = name; } + ]; + }; + } + ) { }) + ( + pipe ./. [ + builtins.readDir + (filterAttrs (n: ty: ty == "directory" && builtins.pathExists ./${n}/default.nix)) + (mapAttrsToList (n: _: n)) + ] + ); } diff --git a/spec/eientei/acme.nix b/spec/eientei/acme.nix index 7fec425c..44352332 100644 --- a/spec/eientei/acme.nix +++ b/spec/eientei/acme.nix @@ -1,11 +1,15 @@ { - security.acme.certs = let - cloudflare = { - dnsProvider = "cloudflare"; - credentialsFile = "/nix/persist/secret/cloudflare"; + security.acme.certs = + let + 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"; }; - }; } diff --git a/spec/eientei/coturn.nix b/spec/eientei/coturn.nix index 6f633083..6cb361e3 100644 --- a/spec/eientei/coturn.nix +++ b/spec/eientei/coturn.nix @@ -1,7 +1,11 @@ -{ config -, ... }: let +{ + config, + ... +}: +let host = "514fpv.io"; -in { +in +{ services.coturn = rec { enable = true; no-cli = true; @@ -43,17 +47,27 @@ in { ''; }; - networking.firewall = let - range = with config.services.coturn; [ { - from = min-port; - to = max-port; - } ]; - in { + networking.firewall = + let + range = with config.services.coturn; [ + { + from = min-port; + to = max-port; + } + ]; + in + { allowedUDPPortRanges = range; - allowedUDPPorts = [ 3478 5349 ]; + allowedUDPPorts = [ + 3478 + 5349 + ]; allowedTCPPortRanges = range; - allowedTCPPorts = [ 3478 5349 ]; - }; + allowedTCPPorts = [ + 3478 + 5349 + ]; + }; global.fs.zfs.mountpoints."/nix/persist/service/coturn" = "service/coturn"; } diff --git a/spec/eientei/default.nix b/spec/eientei/default.nix index b5a098e7..a7294dce 100644 --- a/spec/eientei/default.nix +++ b/spec/eientei/default.nix @@ -1,6 +1,9 @@ -{ lib -, pkgs -, ... }: { +{ + lib, + pkgs, + ... +}: +{ global = { id = "ff96c05be13e44f681292205370eed1a"; auth.openssh.enable = true; @@ -37,7 +40,15 @@ ]; 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.kernelModules = [ "kvm-intel" ]; boot.extraModulePackages = [ ]; diff --git a/spec/eientei/forgejo.nix b/spec/eientei/forgejo.nix index f207d7c3..709adc1a 100644 --- a/spec/eientei/forgejo.nix +++ b/spec/eientei/forgejo.nix @@ -1,8 +1,12 @@ -{ pkgs -, config -, ...}: let +{ + pkgs, + config, + ... +}: +let host = "src.514fpv.io"; -in { +in +{ services.forgejo = { enable = true; lfs.enable = true; diff --git a/spec/eientei/frigate.nix b/spec/eientei/frigate.nix index dcdbb2e5..5767621f 100644 --- a/spec/eientei/frigate.nix +++ b/spec/eientei/frigate.nix @@ -1,6 +1,9 @@ -{ pkgs -, config -, ...}: { +{ + pkgs, + config, + ... +}: +{ # container image used for edgetpu support virtualisation.oci-containers.containers.frigate = { 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 ]; global.fs.zfs.mountpoints."/nix/persist/service/frigate" = "service/frigate"; diff --git a/spec/eientei/hass.nix b/spec/eientei/hass.nix index 210d6755..f45b6d92 100644 --- a/spec/eientei/hass.nix +++ b/spec/eientei/hass.nix @@ -1,6 +1,9 @@ -{ pkgs -, config -, ...}: { +{ + pkgs, + config, + ... +}: +{ services.home-assistant = { enable = true; config = null; @@ -14,9 +17,12 @@ "synology_dsm" ]; - extraPackages = python3Packages: with python3Packages; [ - aiogithubapi gtts radios - ]; + extraPackages = + python3Packages: with python3Packages; [ + aiogithubapi + gtts + radios + ]; }; services.nginx.virtualHosts."home.514fpv.io" = { diff --git a/spec/eientei/jellyfin.nix b/spec/eientei/jellyfin.nix index 9f3c3671..4d00b55b 100644 --- a/spec/eientei/jellyfin.nix +++ b/spec/eientei/jellyfin.nix @@ -1,13 +1,20 @@ -{ pkgs -, config -, ...}: { +{ + pkgs, + config, + ... +}: +{ services.jellyfin = { enable = true; openFirewall = true; 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.groups.jellyfin.gid = 282; diff --git a/spec/eientei/matrix.nix b/spec/eientei/matrix.nix index 1af2d400..db9320fc 100644 --- a/spec/eientei/matrix.nix +++ b/spec/eientei/matrix.nix @@ -1,7 +1,11 @@ -{ config -, ... }: let +{ + config, + ... +}: +let host = "514fpv.io"; -in { +in +{ services.matrix-synapse = { enable = true; withJemalloc = true; @@ -12,29 +16,43 @@ in { server_name = host; public_baseurl = "https://${host}:8448/"; - listeners = [ { - bind_addresses = [ "127.0.0.1" ]; - port = 8008; - tls = false; - type = "http"; - x_forwarded = true; - resources = [ - { compress = true; names = [ "client" ]; } - { compress = false; names = [ "federation" ]; } - ]; - } ]; + listeners = [ + { + bind_addresses = [ "127.0.0.1" ]; + port = 8008; + tls = false; + type = "http"; + x_forwarded = true; + resources = [ + { + compress = true; + names = [ "client" ]; + } + { + compress = false; + names = [ "federation" ]; + } + ]; + } + ]; - # turn server configuration - turn_uris = [ - "turn:${config.services.coturn.realm}:3478?transport=udp" - "turn:${config.services.coturn.realm}:3478?transport=tcp" - ]; - turn_user_lifetime = "1h"; + # turn server configuration + turn_uris = [ + "turn:${config.services.coturn.realm}:3478?transport=udp" + "turn:${config.services.coturn.realm}:3478?transport=tcp" + ]; + turn_user_lifetime = "1h"; }; }; services.nginx.virtualHosts.${host} = { - listen = [{ addr = "0.0.0.0"; port = 8448; ssl = true; }]; + listen = [ + { + addr = "0.0.0.0"; + port = 8448; + ssl = true; + } + ]; useACMEHost = host; addSSL = true; locations."/".extraConfig = '' diff --git a/spec/eientei/minecraft.nix b/spec/eientei/minecraft.nix index a18a5e6b..11675fac 100644 --- a/spec/eientei/minecraft.nix +++ b/spec/eientei/minecraft.nix @@ -1,4 +1,10 @@ -{ pkgs, lib, config, ... }: let +{ + pkgs, + lib, + config, + ... +}: +let inherit (lib) mapAttrs' nameValuePair; servers = { @@ -25,81 +31,100 @@ prefix = "minecraft-server-"; data = "/nix/persist/service/minecraft"; -in { +in +{ # https://github.com/NixOS/nixpkgs/blob/nixos-unstable/nixos/modules/services/games/minecraft-server.nix users.users.minecraft = { - description = "Minecraft server service user"; - home = data; - createHome = true; - isSystemUser = true; - uid = 1021; - group = "minecraft"; + description = "Minecraft server service user"; + home = data; + createHome = true; + isSystemUser = true; + uid = 1021; + group = "minecraft"; }; users.groups.minecraft.gid = 1021; - systemd.sockets = mapAttrs' (name: value: with value; (nameValuePair "${prefix}${name}" { - bindsTo = [ "${prefix}${name}.service" ]; - socketConfig = { - ListenFIFO = "/run/minecraft-server/${name}.stdin"; - SocketMode = "0660"; - SocketUser = "minecraft"; - SocketGroup = "minecraft"; - RemoveOnStop = true; - FlushPending = true; - }; - })) servers; + systemd.sockets = mapAttrs' ( + name: value: + with value; + (nameValuePair "${prefix}${name}" { + bindsTo = [ "${prefix}${name}.service" ]; + socketConfig = { + ListenFIFO = "/run/minecraft-server/${name}.stdin"; + SocketMode = "0660"; + SocketUser = "minecraft"; + SocketGroup = "minecraft"; + RemoveOnStop = true; + FlushPending = true; + }; + }) + ) servers; - systemd.services = let - stopScript = { name, stop }: pkgs.writeShellScript "minecraft-server-stop" '' - echo ${stop} > ${config.systemd.sockets."${prefix}${name}".socketConfig.ListenFIFO} + systemd.services = + let + stopScript = + { name, stop }: + pkgs.writeShellScript "minecraft-server-stop" '' + echo ${stop} > ${config.systemd.sockets."${prefix}${name}".socketConfig.ListenFIFO} - # Wait for the PID of the minecraft server to disappear before - # returning, so systemd doesn't attempt to SIGKILL it. - while kill -0 "$1" 2> /dev/null; do - sleep 1s - done - ''; - in mapAttrs' (name: value: with value; (nameValuePair "${prefix}${name}" { - description = "Minecraft Server Service for ${name}"; - wantedBy = [ "multi-user.target" ]; - requires = [ "${prefix}${name}.socket" ]; - after = [ "network.target" "${prefix}${name}.socket" ]; - path = [ pkgs.bash ]; + # Wait for the PID of the minecraft server to disappear before + # returning, so systemd doesn't attempt to SIGKILL it. + while kill -0 "$1" 2> /dev/null; do + sleep 1s + done + ''; + in + mapAttrs' ( + name: value: + with value; + (nameValuePair "${prefix}${name}" { + description = "Minecraft Server Service for ${name}"; + wantedBy = [ "multi-user.target" ]; + requires = [ "${prefix}${name}.socket" ]; + after = [ + "network.target" + "${prefix}${name}.socket" + ]; + path = [ pkgs.bash ]; - serviceConfig = { - ExecStart = cmdline; - ExecStop = "${stopScript { inherit name stop; }} $MAINPID"; - Restart = "always"; - User = "minecraft"; - WorkingDirectory = "${data}/${name}"; + serviceConfig = { + ExecStart = cmdline; + ExecStop = "${stopScript { inherit name stop; }} $MAINPID"; + Restart = "always"; + User = "minecraft"; + WorkingDirectory = "${data}/${name}"; - StandardInput = "socket"; - StandardOutput = "journal"; - StandardError = "journal"; + StandardInput = "socket"; + StandardOutput = "journal"; + StandardError = "journal"; - # Hardening - CapabilityBoundingSet = [ "" ]; - DeviceAllow = [ "" ]; - LockPersonality = true; - PrivateDevices = true; - PrivateTmp = true; - PrivateUsers = true; - ProtectClock = true; - ProtectControlGroups = true; - ProtectHome = true; - ProtectHostname = true; - ProtectKernelLogs = true; - ProtectKernelModules = true; - ProtectKernelTunables = true; - ProtectProc = "invisible"; - RestrictAddressFamilies = [ "AF_INET" "AF_INET6" ]; - RestrictNamespaces = true; - RestrictRealtime = true; - RestrictSUIDSGID = true; - SystemCallArchitectures = "native"; - UMask = "0077"; - }; - })) servers; + # Hardening + CapabilityBoundingSet = [ "" ]; + DeviceAllow = [ "" ]; + LockPersonality = true; + PrivateDevices = true; + PrivateTmp = true; + PrivateUsers = true; + ProtectClock = true; + ProtectControlGroups = true; + ProtectHome = true; + ProtectHostname = true; + ProtectKernelLogs = true; + ProtectKernelModules = true; + ProtectKernelTunables = true; + ProtectProc = "invisible"; + RestrictAddressFamilies = [ + "AF_INET" + "AF_INET6" + ]; + RestrictNamespaces = true; + RestrictRealtime = true; + RestrictSUIDSGID = true; + SystemCallArchitectures = "native"; + UMask = "0077"; + }; + }) + ) servers; global.fs.zfs.mountpoints.${data} = "service/minecraft"; networking.firewall.allowedTCPPorts = [ 25565 ]; diff --git a/spec/eientei/mosquitto.nix b/spec/eientei/mosquitto.nix index 8cbeae02..ee8db177 100644 --- a/spec/eientei/mosquitto.nix +++ b/spec/eientei/mosquitto.nix @@ -1,16 +1,18 @@ { services.mosquitto = { enable = true; - listeners = [ { - users.frigate = { - acl = [ "readwrite #" ]; - hashedPassword = "$7$101$Zt3Me3AkHbrKBbbI$SsLTGeTwtkFGXS2F1/S3Vg6w7TcgMLU037ttedKaw/Ela0wgqbaAVxecK1j5i5TDw9OjZMkNI9mUzz9l0d7vcg=="; - }; - users.root = { - acl = [ "readwrite #" ]; - hashedPassword = "$7$101$FjpEh+NpG27RltQe$u2dmg9wz+BBnp1s4z6E6x95TyGO5B9RM2z51qxetvAqO4QDvye1J3UCdMvjuz52iMqzZ3eKi+T2xDeLR7CeMgQ=="; - }; - } ]; + listeners = [ + { + users.frigate = { + acl = [ "readwrite #" ]; + hashedPassword = "$7$101$Zt3Me3AkHbrKBbbI$SsLTGeTwtkFGXS2F1/S3Vg6w7TcgMLU037ttedKaw/Ela0wgqbaAVxecK1j5i5TDw9OjZMkNI9mUzz9l0d7vcg=="; + }; + users.root = { + acl = [ "readwrite #" ]; + hashedPassword = "$7$101$FjpEh+NpG27RltQe$u2dmg9wz+BBnp1s4z6E6x95TyGO5B9RM2z51qxetvAqO4QDvye1J3UCdMvjuz52iMqzZ3eKi+T2xDeLR7CeMgQ=="; + }; + } + ]; }; networking.firewall.allowedTCPPorts = [ 1883 ]; diff --git a/spec/eientei/nextcloud.nix b/spec/eientei/nextcloud.nix index 23d1e678..17a042dd 100644 --- a/spec/eientei/nextcloud.nix +++ b/spec/eientei/nextcloud.nix @@ -1,15 +1,27 @@ -{ pkgs -, ...}: let +{ + pkgs, + ... +}: +let host = "cloud.514fpv.io"; -in { +in +{ services.nextcloud = { enable = true; package = pkgs.nextcloud30; extraApps = { inherit (pkgs.nextcloud30Packages.apps) - notify_push impersonate spreed - contacts bookmarks deck polls notes forms - twofactor_webauthn; + notify_push + impersonate + spreed + contacts + bookmarks + deck + polls + notes + forms + twofactor_webauthn + ; }; home = "/nix/persist/service/nextcloud"; configureRedis = true; diff --git a/spec/eientei/nginx.nix b/spec/eientei/nginx.nix index a83b542e..6a2b56da 100644 --- a/spec/eientei/nginx.nix +++ b/spec/eientei/nginx.nix @@ -20,5 +20,8 @@ }; }; - networking.firewall.allowedTCPPorts = [ 80 443 ]; + networking.firewall.allowedTCPPorts = [ + 80 + 443 + ]; } diff --git a/spec/eientei/photoprism.nix b/spec/eientei/photoprism.nix index 66a3874e..2deeb528 100644 --- a/spec/eientei/photoprism.nix +++ b/spec/eientei/photoprism.nix @@ -1,5 +1,9 @@ -{ lib -, ... }: with lib; { +{ + lib, + ... +}: +with lib; +{ services.photoprism = { enable = true; originalsPath = "/run/storage/aerial/raw"; diff --git a/spec/eientei/photoview.nix b/spec/eientei/photoview.nix index f7ccb595..1353f023 100644 --- a/spec/eientei/photoview.nix +++ b/spec/eientei/photoview.nix @@ -4,7 +4,7 @@ database.driver = "postgres"; database.string = "postgresql:///photoview?host=/var/run/postgresql"; stateDir = "/nix/persist/service/photoview"; - secrets = "/nix/persist/service/photoview/secrets.env" ; + secrets = "/nix/persist/service/photoview/secrets.env"; }; services.nginx.virtualHosts."dvr.514fpv.io" = { diff --git a/spec/eientei/postgresql.nix b/spec/eientei/postgresql.nix index 22d99ced..f9521344 100644 --- a/spec/eientei/postgresql.nix +++ b/spec/eientei/postgresql.nix @@ -1,6 +1,9 @@ -{ pkgs -, config -, ...}: { +{ + pkgs, + config, + ... +}: +{ services.postgresql = { enable = true; dataDir = "/nix/persist/service/postgresql/${config.services.postgresql.package.psqlSchema}"; diff --git a/spec/focus/acme.nix b/spec/focus/acme.nix index 47a359d3..c6d90e62 100644 --- a/spec/focus/acme.nix +++ b/spec/focus/acme.nix @@ -1,11 +1,15 @@ { - security.acme.certs = let - cloudflare = { - dnsProvider = "cloudflare"; - credentialsFile = "/nix/persist/secret/cloudflare"; + security.acme.certs = + let + cloudflare = { + dnsProvider = "cloudflare"; + credentialsFile = "/nix/persist/secret/cloudflare"; + }; + in + { + "sf.514fpv.io" = cloudflare; + ".sf.514fpv.io" = cloudflare // { + domain = "*.sf.514fpv.io"; + }; }; - in { - "sf.514fpv.io" = cloudflare; - ".sf.514fpv.io" = cloudflare // { domain = "*.sf.514fpv.io"; }; - }; } diff --git a/spec/focus/default.nix b/spec/focus/default.nix index 46b14034..96cf1a0c 100644 --- a/spec/focus/default.nix +++ b/spec/focus/default.nix @@ -1,5 +1,8 @@ -{ lib -, ... }: { +{ + lib, + ... +}: +{ global = { id = "22e9d4e37bd7436ba0cbe6e767fb0912"; auth.openssh.enable = true; @@ -40,7 +43,14 @@ ]; hardware.enableRedistributableFirmware = true; - boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usbhid" "usb_storage" "sd_mod" ]; + boot.initrd.availableKernelModules = [ + "xhci_pci" + "ahci" + "nvme" + "usbhid" + "usb_storage" + "sd_mod" + ]; boot.initrd.kernelModules = [ "i915" ]; boot.kernelModules = [ "kvm-intel" ]; boot.extraModulePackages = [ ]; diff --git a/spec/focus/nextcloud.nix b/spec/focus/nextcloud.nix index eabee803..293c45a2 100644 --- a/spec/focus/nextcloud.nix +++ b/spec/focus/nextcloud.nix @@ -1,15 +1,27 @@ -{ pkgs -, ...}: let +{ + pkgs, + ... +}: +let host = "cloud.sf.514fpv.io"; -in { +in +{ services.nextcloud = { enable = true; package = pkgs.nextcloud30; extraApps = { inherit (pkgs.nextcloud30Packages.apps) - notify_push impersonate spreed - contacts bookmarks deck polls notes forms - twofactor_webauthn; + notify_push + impersonate + spreed + contacts + bookmarks + deck + polls + notes + forms + twofactor_webauthn + ; }; home = "/nix/persist/service/nextcloud"; configureRedis = true; diff --git a/spec/focus/nginx.nix b/spec/focus/nginx.nix index 7c8bb5e7..7ebbd47c 100644 --- a/spec/focus/nginx.nix +++ b/spec/focus/nginx.nix @@ -20,5 +20,8 @@ }; }; - networking.firewall.allowedTCPPorts = [ 80 443 ]; + networking.firewall.allowedTCPPorts = [ + 80 + 443 + ]; } diff --git a/spec/focus/postgresql.nix b/spec/focus/postgresql.nix index 22d99ced..f9521344 100644 --- a/spec/focus/postgresql.nix +++ b/spec/focus/postgresql.nix @@ -1,6 +1,9 @@ -{ pkgs -, config -, ...}: { +{ + pkgs, + config, + ... +}: +{ services.postgresql = { enable = true; dataDir = "/nix/persist/service/postgresql/${config.services.postgresql.package.psqlSchema}"; diff --git a/spec/hakugyokurou/default.nix b/spec/hakugyokurou/default.nix index f1f9f285..dbce6ffa 100644 --- a/spec/hakugyokurou/default.nix +++ b/spec/hakugyokurou/default.nix @@ -1,4 +1,10 @@ -{ pkgs, lib, config, ... }: { +{ + pkgs, + lib, + config, + ... +}: +{ global = { id = "09a2900f15b74f36b023a9ebcd539f6a"; fs.esp.uuid = "AE73-B83E"; @@ -21,19 +27,21 @@ minecraft.user = "app"; }; - users.homeModules = [ { - wayland.windowManager.sway.config = { - input = { - "9610:30:HID_258a:001e_Mouse".natural_scroll = "disabled"; - "1539:61441:NVTK0603:00_0603:F001_UNKNOWN".map_to_output = "eDP-1"; - "1539:61441:NVTK0603:00_0603:F001".map_to_output = "eDP-1"; + users.homeModules = [ + { + wayland.windowManager.sway.config = { + input = { + "9610:30:HID_258a:001e_Mouse".natural_scroll = "disabled"; + "1539:61441:NVTK0603:00_0603:F001_UNKNOWN".map_to_output = "eDP-1"; + "1539:61441:NVTK0603:00_0603:F001".map_to_output = "eDP-1"; + }; + output = { + eDP-1.scale = "2"; + eDP-1.transform = "270"; + }; }; - output = { - eDP-1.scale = "2"; - eDP-1.transform = "270"; - }; - }; - } ]; + } + ]; powerManagement.enable = true; powerManagement.cpuFreqGovernor = "performance"; @@ -44,16 +52,24 @@ DeviceScale=2 ''; - services.greetd.settings.default_session.command = let - cfg = config.programs.regreet; - in lib.mkOverride 999 "${pkgs.dbus}/bin/dbus-run-session ${lib.getExe pkgs.cage} ${lib.escapeShellArgs cfg.cageArgs} -- ${pkgs.writeShellScript "cageResolution" '' - ${lib.getExe pkgs.wlr-randr} --output eDP-1 --scale 2 --transform 90 - ${lib.getExe cfg.package} - ''}"; + services.greetd.settings.default_session.command = + let + cfg = config.programs.regreet; + in + lib.mkOverride 999 "${pkgs.dbus}/bin/dbus-run-session ${lib.getExe pkgs.cage} ${lib.escapeShellArgs cfg.cageArgs} -- ${pkgs.writeShellScript "cageResolution" '' + ${lib.getExe pkgs.wlr-randr} --output eDP-1 --scale 2 --transform 90 + ${lib.getExe cfg.package} + ''}"; hardware.sensor.iio.enable = true; hardware.enableRedistributableFirmware = true; - boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "thunderbolt" "usbhid" "rtsx_pci_sdmmc" ]; + boot.initrd.availableKernelModules = [ + "nvme" + "xhci_pci" + "thunderbolt" + "usbhid" + "rtsx_pci_sdmmc" + ]; boot.initrd.kernelModules = [ ]; boot.kernelModules = [ "kvm-amd" ]; boot.extraModulePackages = [ ]; diff --git a/spec/incinerator/default.nix b/spec/incinerator/default.nix index 124e93a6..3b0ebdbb 100644 --- a/spec/incinerator/default.nix +++ b/spec/incinerator/default.nix @@ -1,6 +1,9 @@ -{ lib -, modulesPath -, ... }: { +{ + lib, + modulesPath, + ... +}: +{ global = { id = "62ea62fde6c04fb6b5c791892b6798c8"; auth.openssh.enable = true; @@ -10,13 +13,21 @@ oci.enable = true; }; - imports = lib.pipe ./. [ - builtins.readDir - (lib.filterAttrs (n: ty: ty == "regular" && n != "default.nix")) - (lib.mapAttrsToList (n: _: ./${n})) - ] ++ [ (modulesPath + "/profiles/qemu-guest.nix") ]; + imports = + lib.pipe ./. [ + builtins.readDir + (lib.filterAttrs (n: ty: ty == "regular" && n != "default.nix")) + (lib.mapAttrsToList (n: _: ./${n})) + ] + ++ [ (modulesPath + "/profiles/qemu-guest.nix") ]; - boot.initrd.availableKernelModules = [ "ahci" "xhci_pci" "virtio_pci" "sr_mod" "virtio_blk" ]; + boot.initrd.availableKernelModules = [ + "ahci" + "xhci_pci" + "virtio_pci" + "sr_mod" + "virtio_blk" + ]; boot.initrd.kernelModules = [ ]; boot.kernelModules = [ "kvm-intel" ]; boot.extraModulePackages = [ ]; diff --git a/spec/koumakyou/default.nix b/spec/koumakyou/default.nix index b1c239d3..0b7d78b2 100644 --- a/spec/koumakyou/default.nix +++ b/spec/koumakyou/default.nix @@ -1,4 +1,11 @@ -{ pkgs, lib, config, jovian, ... }: { +{ + pkgs, + lib, + config, + jovian, + ... +}: +{ global = { id = "0a920a834b5f480bab258040096d4c6e"; fs.esp.uuid = "ACB3-4AFF"; @@ -18,14 +25,16 @@ minecraft.user = "app"; }; - users.homeModules = [ { - wayland.windowManager.sway.config = { - input."1046:911:Goodix_Capacitive_TouchScreen".map_to_output = "eDP-1"; - output = { - eDP-1.scale = "1.75"; + users.homeModules = [ + { + wayland.windowManager.sway.config = { + input."1046:911:Goodix_Capacitive_TouchScreen".map_to_output = "eDP-1"; + output = { + eDP-1.scale = "1.75"; + }; }; - }; - } ]; + } + ]; powerManagement.enable = true; powerManagement.cpuFreqGovernor = "performance"; @@ -43,12 +52,14 @@ specialisation.desktop.configuration = { global.jovian = false; jovian.steamos.useSteamOSConfig = false; - services.greetd.settings.default_session.command = let - cfg = config.programs.regreet; - in "${pkgs.dbus}/bin/dbus-run-session ${lib.getExe pkgs.cage} ${lib.escapeShellArgs cfg.cageArgs} -- ${pkgs.writeShellScript "cageResolution" '' - ${lib.getExe pkgs.wlr-randr} --output eDP-1 --scale 2 - ${lib.getExe cfg.package} - ''}"; + services.greetd.settings.default_session.command = + let + cfg = config.programs.regreet; + in + "${pkgs.dbus}/bin/dbus-run-session ${lib.getExe pkgs.cage} ${lib.escapeShellArgs cfg.cageArgs} -- ${pkgs.writeShellScript "cageResolution" '' + ${lib.getExe pkgs.wlr-randr} --output eDP-1 --scale 2 + ${lib.getExe cfg.package} + ''}"; environment.systemPackages = with pkgs; [ (writeShellScriptBin "sway-logout" '' ${systemd}/bin/systemctl --user unset-environment WAYLAND_DISPLAY SWAYSOCK @@ -58,7 +69,14 @@ }; hardware.enableRedistributableFirmware = true; - boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "thunderbolt" "usbhid" "usb_storage" "sd_mod" ]; + boot.initrd.availableKernelModules = [ + "nvme" + "xhci_pci" + "thunderbolt" + "usbhid" + "usb_storage" + "sd_mod" + ]; boot.initrd.kernelModules = [ ]; boot.kernelModules = [ "kvm-amd" ]; boot.extraModulePackages = [ ]; diff --git a/spec/koumakyou/jovian.nix b/spec/koumakyou/jovian.nix index f06d43f7..96e1ac01 100644 --- a/spec/koumakyou/jovian.nix +++ b/spec/koumakyou/jovian.nix @@ -1,5 +1,14 @@ -{ pkgs, lib, config, ... }: with lib; { - options.global.jovian = mkEnableOption "set up Jovian NixOS" // { default = true; }; +{ + pkgs, + lib, + config, + ... +}: +with lib; +{ + options.global.jovian = mkEnableOption "set up Jovian NixOS" // { + default = true; + }; config = mkIf config.global.jovian { jovian = { @@ -16,12 +25,17 @@ }; users.home.persistApp.directories = [ - ".steam" ".local/share/Steam" - ".config/gamescope" ".config/hhd" + ".steam" + ".local/share/Steam" + ".config/gamescope" + ".config/hhd" ".kodi" ]; - users.users.app.extraGroups = [ "networkmanager" "gamemode" ]; + users.users.app.extraGroups = [ + "networkmanager" + "gamemode" + ]; programs.gamemode.enable = true; programs.regreet.enable = false; home.plasma.enable = true; @@ -34,14 +48,20 @@ home-manager.users.app = { home.packages = with pkgs; [ - (pkgs.kodi-wayland.passthru.withPackages (kodiPkgs: with kodiPkgs; [ - joystick # keymap steam-controller - #controller-topology-project - libretro libretro-2048 - libretro-fuse libretro-genplus libretro-mgba - libretro-nestopia libretro-snes9x - jellycon - ])) + (pkgs.kodi-wayland.passthru.withPackages ( + kodiPkgs: with kodiPkgs; [ + joystick # keymap steam-controller + #controller-topology-project + libretro + libretro-2048 + libretro-fuse + libretro-genplus + libretro-mgba + libretro-nestopia + libretro-snes9x + jellycon + ] + )) ]; home.pointerCursor = { @@ -60,11 +80,20 @@ enable = true; user = "app"; extraPackages = with pkgs; [ - curl unzip util-linux gnugrep procps pciutils kmod ryzenadj - ]; - extraPythonPackages = pythonPackages: with pythonPackages; [ - hid pyyaml + curl + unzip + util-linux + gnugrep + procps + pciutils + kmod + ryzenadj ]; + extraPythonPackages = + pythonPackages: with pythonPackages; [ + hid + pyyaml + ]; stateDir = "/nix/persist/decky"; }; diff --git a/spec/reimaden/ac71/default.nix b/spec/reimaden/ac71/default.nix index 87ccdd59..3d6ae3b4 100644 --- a/spec/reimaden/ac71/default.nix +++ b/spec/reimaden/ac71/default.nix @@ -1,5 +1,8 @@ -{ config -, ... }: { +{ + config, + ... +}: +{ boot.extraModulePackages = [ (config.boot.kernelPackages.callPackage ./package.nix { }) ]; diff --git a/spec/reimaden/ac71/package.nix b/spec/reimaden/ac71/package.nix index 7d7fba1f..23d79f51 100644 --- a/spec/reimaden/ac71/package.nix +++ b/spec/reimaden/ac71/package.nix @@ -1,14 +1,20 @@ -{ stdenv -, lib -, kernel -, kmod }: stdenv.mkDerivation rec { +{ + stdenv, + lib, + kernel, + kmod, +}: +stdenv.mkDerivation rec { name = "ac71-${version}-${kernel.version}"; version = "2024.2.13"; # adapted from https://github.com/pobrn/qc71_laptop src = ./.; - hardeningDisable = [ "pic" "format" ]; + hardeningDisable = [ + "pic" + "format" + ]; nativeBuildInputs = kernel.moduleBuildDependencies; makeFlags = [ diff --git a/spec/reimaden/default.nix b/spec/reimaden/default.nix index 10962ef7..92f5d74b 100644 --- a/spec/reimaden/default.nix +++ b/spec/reimaden/default.nix @@ -32,7 +32,13 @@ boot.loader.timeout = 2; 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.kernelModules = [ "kvm-intel" ]; boot.extraModulePackages = [ ]; diff --git a/spec/shatter/default.nix b/spec/shatter/default.nix index 9602114c..3f96f939 100644 --- a/spec/shatter/default.nix +++ b/spec/shatter/default.nix @@ -1,6 +1,9 @@ -{ lib -, pkgs -, ... }: { +{ + lib, + pkgs, + ... +}: +{ global = { id = "f16d3a87afdd4eb2b1fa4c098d4a9c1a"; auth.openssh.enable = true; @@ -27,7 +30,14 @@ ''; hardware.enableRedistributableFirmware = true; - boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usbhid" "usb_storage" "sd_mod" ]; + boot.initrd.availableKernelModules = [ + "xhci_pci" + "ahci" + "nvme" + "usbhid" + "usb_storage" + "sd_mod" + ]; boot.initrd.kernelModules = [ "i915" ]; boot.kernelModules = [ "kvm-intel" ]; boot.extraModulePackages = [ ]; diff --git a/spec/shinkirou/default.nix b/spec/shinkirou/default.nix index d2594a80..b6f5d64f 100644 --- a/spec/shinkirou/default.nix +++ b/spec/shinkirou/default.nix @@ -1,7 +1,10 @@ -{ lib -, pkgs -, config -, ... }: { +{ + lib, + pkgs, + config, + ... +}: +{ global = { id = "23c46cfc573f4f889af9ba5d4678c2ab"; fs.esp.uuid = "6695-0740"; @@ -22,17 +25,19 @@ steam.enable = true; }; - users.homeModules = [ { - wayland.windowManager.sway.config = { - input."1267:16857:ELAN9009:00_04F3:41D9".map_to_output = "DP-3"; - output = { - eDP-1.scale = "1.5"; - eDP-1.pos = "0 0"; - DP-3.scale = "2.25"; - DP-3.pos = "0 1066"; + users.homeModules = [ + { + wayland.windowManager.sway.config = { + input."1267:16857:ELAN9009:00_04F3:41D9".map_to_output = "DP-3"; + output = { + eDP-1.scale = "1.5"; + eDP-1.pos = "0 0"; + DP-3.scale = "2.25"; + DP-3.pos = "0 1066"; + }; }; - }; - } ]; + } + ]; home.plasma.extraConfig = { configFile = { @@ -46,7 +51,7 @@ powerManagement.enable = true; powerManagement.cpuFreqGovernor = "performance"; boot.kernelParams = [ "zfs.zfs_arc_max=34359738368" ]; - console.packages = [ pkgs.terminus_font ]; + console.packages = [ pkgs.terminus_font ]; console.font = "ter-v32n"; console.earlySetup = true; @@ -55,15 +60,23 @@ nvidiaBusId = "PCI:1:0:0"; }; - services.greetd.settings.default_session.command = let - cfg = config.programs.regreet; - in "${pkgs.dbus}/bin/dbus-run-session ${lib.getExe pkgs.cage} ${lib.escapeShellArgs cfg.cageArgs} -- ${pkgs.writeShellScript "cageResolution" '' - ${lib.getExe pkgs.wlr-randr} --output DP-3 --scale 2.25 - ${lib.getExe cfg.package} - ''}"; + services.greetd.settings.default_session.command = + let + cfg = config.programs.regreet; + in + "${pkgs.dbus}/bin/dbus-run-session ${lib.getExe pkgs.cage} ${lib.escapeShellArgs cfg.cageArgs} -- ${pkgs.writeShellScript "cageResolution" '' + ${lib.getExe pkgs.wlr-randr} --output DP-3 --scale 2.25 + ${lib.getExe cfg.package} + ''}"; hardware.enableRedistributableFirmware = true; - boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "usbhid" "usb_storage" "sd_mod" ]; + boot.initrd.availableKernelModules = [ + "nvme" + "xhci_pci" + "usbhid" + "usb_storage" + "sd_mod" + ]; boot.initrd.kernelModules = [ ]; boot.kernelModules = [ "kvm-amd" ]; boot.extraModulePackages = [ ]; diff --git a/spec/web/default.nix b/spec/web/default.nix index f3d240db..194e2dc9 100644 --- a/spec/web/default.nix +++ b/spec/web/default.nix @@ -1,5 +1,8 @@ -{ lib -, ... }: { +{ + lib, + ... +}: +{ global = { id = "63795fdf54e048dcbefcbc525ec3779d"; auth.openssh.enable = true; diff --git a/spec/web/google-compute-config.nix b/spec/web/google-compute-config.nix index 8b878f31..347c708b 100644 --- a/spec/web/google-compute-config.nix +++ b/spec/web/google-compute-config.nix @@ -1,8 +1,10 @@ -{ pkgs -, lib -, config -, modulesPath -, ... }: +{ + pkgs, + lib, + config, + modulesPath, + ... +}: let inherit (lib) @@ -11,7 +13,7 @@ let mkIf optional readFile - ; + ; in { @@ -20,10 +22,16 @@ in (modulesPath + "/profiles/qemu-guest.nix") ]; - - boot.kernelParams = [ "console=ttyS0,115200n8" "panic=1" "boot.panic_on_fail" ]; + boot.kernelParams = [ + "console=ttyS0,115200n8" + "panic=1" + "boot.panic_on_fail" + ]; boot.initrd.kernelModules = [ "virtio_scsi" ]; - boot.kernelModules = [ "virtio_pci" "virtio_net" ]; + boot.kernelModules = [ + "virtio_pci" + "virtio_net" + ]; # enable OS Login. This also requires setting enable-oslogin=TRUE metadata on # instance or project level @@ -55,18 +63,35 @@ in systemd.services.google-shutdown-scripts.wantedBy = [ "multi-user.target" ]; security.sudo.extraRules = mkIf config.users.mutableUsers [ - { groups = [ "google-sudoers" ]; commands = [ { command = "ALL"; options = [ "NOPASSWD" ]; } ]; } + { + groups = [ "google-sudoers" ]; + commands = [ + { + command = "ALL"; + options = [ "NOPASSWD" ]; + } + ]; + } ]; security.sudo-rs.extraRules = mkIf config.users.mutableUsers [ - { groups = [ "google-sudoers" ]; commands = [ { command = "ALL"; options = [ "NOPASSWD" ]; } ]; } + { + groups = [ "google-sudoers" ]; + commands = [ + { + command = "ALL"; + options = [ "NOPASSWD" ]; + } + ]; + } ]; users.groups.google-sudoers = mkIf config.users.mutableUsers { }; boot.extraModprobeConfig = readFile "${pkgs.google-guest-configs}/etc/modprobe.d/gce-blacklist.conf"; - environment.etc."sysctl.d/60-gce-network-security.conf".source = "${pkgs.google-guest-configs}/etc/sysctl.d/60-gce-network-security.conf"; + environment.etc."sysctl.d/60-gce-network-security.conf".source = + "${pkgs.google-guest-configs}/etc/sysctl.d/60-gce-network-security.conf"; environment.etc."default/instance_configs.cfg".text = '' [Accounts] diff --git a/spec/web/nginx.nix b/spec/web/nginx.nix index fa4cb3da..a077500c 100644 --- a/spec/web/nginx.nix +++ b/spec/web/nginx.nix @@ -1,5 +1,8 @@ -{ pkgs -, ...}: { +{ + pkgs, + ... +}: +{ services.nginx = { enable = true; @@ -9,43 +12,48 @@ recommendedGzipSettings = true; recommendedProxySettings = true; - virtualHosts = let - mkRedirect = host: { - locations."/".return = "307 https://${host}$request_uri"; - forceSSL = true; - enableACME = true; - }; - in { - "_" = { - rejectSSL = true; - extraConfig = "return 444;"; - }; - - "514fpv.one" = { - root = pkgs.callPackage ./site { }; - forceSSL = true; - enableACME = true; - }; - - "www.514fpv.one" = { - globalRedirect = "514fpv.one"; - enableACME = true; - }; - - "uptime.514fpv.one" = { - locations."/" = { - proxyPass = "http://127.0.0.1:4000"; - proxyWebsockets = true; + virtualHosts = + let + mkRedirect = host: { + locations."/".return = "307 https://${host}$request_uri"; + forceSSL = true; + enableACME = true; + }; + in + { + "_" = { + rejectSSL = true; + extraConfig = "return 444;"; }; - forceSSL = true; - enableACME = true; - }; - # redirections to home server - "src.514fpv.one" = mkRedirect "src.514fpv.io:2096"; - "cloud.514fpv.one" = mkRedirect "cloud.514fpv.io:2096"; - }; + "514fpv.one" = { + root = pkgs.callPackage ./site { }; + forceSSL = true; + enableACME = true; + }; + + "www.514fpv.one" = { + globalRedirect = "514fpv.one"; + enableACME = true; + }; + + "uptime.514fpv.one" = { + locations."/" = { + proxyPass = "http://127.0.0.1:4000"; + proxyWebsockets = true; + }; + forceSSL = true; + enableACME = true; + }; + + # redirections to home server + "src.514fpv.one" = mkRedirect "src.514fpv.io:2096"; + "cloud.514fpv.one" = mkRedirect "cloud.514fpv.io:2096"; + }; }; - networking.firewall.allowedTCPPorts = [ 80 443 ]; + networking.firewall.allowedTCPPorts = [ + 80 + 443 + ]; } diff --git a/spec/web/site/default.nix b/spec/web/site/default.nix index 63913a06..0286db2d 100644 --- a/spec/web/site/default.nix +++ b/spec/web/site/default.nix @@ -1,9 +1,12 @@ -{ lib -, stdenvNoCC -, ruby -, bundlerEnv -, writeShellScriptBin -, fetchFromGitHub }: let +{ + lib, + stdenvNoCC, + ruby, + bundlerEnv, + writeShellScriptBin, + fetchFromGitHub, +}: +let name = "website"; version = "20240114"; @@ -22,11 +25,15 @@ lockfile = ./Gemfile.lock; gemset = ./gemset.nix; }; -in stdenvNoCC.mkDerivation { +in +stdenvNoCC.mkDerivation { pname = name; inherit version; src = ./.; - buildInputs = [ gems ruby ]; + buildInputs = [ + gems + ruby + ]; nativeBuildInputs = [ (writeShellScriptBin "git" "true") ]; configurePhase = '' diff --git a/spec/web/site/gemset.nix b/spec/web/site/gemset.nix index b526c889..fa64748e 100644 --- a/spec/web/site/gemset.nix +++ b/spec/web/site/gemset.nix @@ -1,492 +1,576 @@ { addressable = { - dependencies = ["public_suffix"]; - groups = ["default" "test"]; - platforms = []; + dependencies = [ "public_suffix" ]; + groups = [ + "default" + "test" + ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "0irbdwkkjwzajq1ip6ba46q49sxnrl2cw7ddkdhsfhb6aprnm3vr"; type = "gem"; }; version = "2.8.6"; }; colorator = { - groups = ["default"]; - platforms = []; + groups = [ "default" ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "0f7wvpam948cglrciyqd798gdc6z3cfijciavd0dfixgaypmvy72"; type = "gem"; }; version = "1.1.0"; }; concurrent-ruby = { - groups = ["default"]; - platforms = []; + groups = [ "default" ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "1qh1b14jwbbj242klkyz5fc7npd4j0mvndz62gajhvl1l3wd7zc2"; type = "gem"; }; version = "1.2.3"; }; em-websocket = { - dependencies = ["eventmachine" "http_parser.rb"]; - groups = ["default"]; - platforms = []; + dependencies = [ + "eventmachine" + "http_parser.rb" + ]; + groups = [ "default" ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "1a66b0kjk6jx7pai9gc7i27zd0a128gy73nmas98gjz6wjyr4spm"; type = "gem"; }; version = "0.5.3"; }; ethon = { - dependencies = ["ffi"]; - groups = ["default" "test"]; - platforms = []; + dependencies = [ "ffi" ]; + groups = [ + "default" + "test" + ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "17ix0mijpsy3y0c6ywrk5ibarmvqzjsirjyprpsy3hwax8fdm85v"; type = "gem"; }; version = "0.16.0"; }; eventmachine = { - groups = ["default"]; - platforms = []; + groups = [ "default" ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "0wh9aqb0skz80fhfn66lbpr4f86ya2z5rx6gm5xlfhd05bj1ch4r"; type = "gem"; }; version = "1.2.7"; }; ffi = { - groups = ["default" "test"]; - platforms = []; + groups = [ + "default" + "test" + ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "1yvii03hcgqj30maavddqamqy50h7y6xcn2wcyq72wn823zl4ckd"; type = "gem"; }; version = "1.16.3"; }; forwardable-extended = { - groups = ["default"]; - platforms = []; + groups = [ "default" ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "15zcqfxfvsnprwm8agia85x64vjzr2w0xn9vxfnxzgcv8s699v0v"; type = "gem"; }; version = "2.6.0"; }; google-protobuf = { - groups = ["default"]; - platforms = []; + groups = [ "default" ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "1mnxzcq8kmyfb9bkzqnp019d1hx1vprip3yzdkkha6b3qz5rgg9r"; type = "gem"; }; version = "3.25.3"; }; html-proofer = { - dependencies = ["addressable" "mercenary" "nokogiri" "parallel" "rainbow" "typhoeus" "yell" "zeitwerk"]; - groups = ["test"]; - platforms = []; + dependencies = [ + "addressable" + "mercenary" + "nokogiri" + "parallel" + "rainbow" + "typhoeus" + "yell" + "zeitwerk" + ]; + groups = [ "test" ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "00hhwzl5llvsasbj6gpgd1272xrqz8wlxzq7qm0xa4z3mk24013j"; type = "gem"; }; version = "4.4.3"; }; "http_parser.rb" = { - groups = ["default"]; - platforms = []; + groups = [ "default" ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "15nidriy0v5yqfjsgsra51wmknxci2n2grliz78sf9pga3n0l7gi"; type = "gem"; }; version = "0.6.0"; }; i18n = { - dependencies = ["concurrent-ruby"]; - groups = ["default"]; - platforms = []; + dependencies = [ "concurrent-ruby" ]; + groups = [ "default" ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "0qaamqsh5f3szhcakkak8ikxlzxqnv49n2p7504hcz2l0f4nj0wx"; type = "gem"; }; version = "1.14.1"; }; jekyll = { - dependencies = ["addressable" "colorator" "em-websocket" "i18n" "jekyll-sass-converter" "jekyll-watch" "kramdown" "kramdown-parser-gfm" "liquid" "mercenary" "pathutil" "rouge" "safe_yaml" "terminal-table" "webrick"]; - groups = ["default"]; - platforms = []; + dependencies = [ + "addressable" + "colorator" + "em-websocket" + "i18n" + "jekyll-sass-converter" + "jekyll-watch" + "kramdown" + "kramdown-parser-gfm" + "liquid" + "mercenary" + "pathutil" + "rouge" + "safe_yaml" + "terminal-table" + "webrick" + ]; + groups = [ "default" ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "0638cvpmk3py1w2dxpav6l0c854y6l94b6gyc2aa16i7r897z64a"; type = "gem"; }; version = "4.3.3"; }; jekyll-archives = { - dependencies = ["jekyll"]; - groups = ["default"]; - platforms = []; + dependencies = [ "jekyll" ]; + groups = [ "default" ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "0c2rks7xf6ajp18h4f4wmmbqm5ljprv70bqcz2sabi17zncmz9n0"; type = "gem"; }; version = "2.2.1"; }; jekyll-include-cache = { - dependencies = ["jekyll"]; - groups = ["default"]; - platforms = []; + dependencies = [ "jekyll" ]; + groups = [ "default" ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "01d2l6qrmjc42664ns83cv36jbvalcxqbkmj5i22fakka7jvkm67"; type = "gem"; }; version = "0.2.1"; }; jekyll-paginate = { - groups = ["default"]; - platforms = []; + groups = [ "default" ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "0r7bcs8fq98zldih4787zk5i9w24nz5wa26m84ssja95n3sas2l8"; type = "gem"; }; version = "1.1.0"; }; jekyll-redirect-from = { - dependencies = ["jekyll"]; - groups = ["default"]; - platforms = []; + dependencies = [ "jekyll" ]; + groups = [ "default" ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "1nz6kd6qsa160lmjmls4zgx7fwcpp8ac07mpzy80z6zgd7jwldb6"; type = "gem"; }; version = "0.16.0"; }; jekyll-sass-converter = { - dependencies = ["sass-embedded"]; - groups = ["default"]; - platforms = []; + dependencies = [ "sass-embedded" ]; + groups = [ "default" ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "00n9v19h0qgjijygfdkdh2gwpmdlz49nw1mqk6fnp43f317ngrz2"; type = "gem"; }; version = "3.0.0"; }; jekyll-seo-tag = { - dependencies = ["jekyll"]; - groups = ["default"]; - platforms = []; + dependencies = [ "jekyll" ]; + groups = [ "default" ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "0638mqhqynghnlnaz0xi1kvnv53wkggaq94flfzlxwandn8x2biz"; type = "gem"; }; version = "2.8.0"; }; jekyll-sitemap = { - dependencies = ["jekyll"]; - groups = ["default"]; - platforms = []; + dependencies = [ "jekyll" ]; + groups = [ "default" ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "0622rwsn5i0m5xcyzdn86l68wgydqwji03lqixdfm1f1xdfqrq0d"; type = "gem"; }; version = "1.4.0"; }; jekyll-theme-chirpy = { - dependencies = ["jekyll" "jekyll-archives" "jekyll-include-cache" "jekyll-paginate" "jekyll-redirect-from" "jekyll-seo-tag" "jekyll-sitemap"]; - groups = ["default"]; - platforms = []; + dependencies = [ + "jekyll" + "jekyll-archives" + "jekyll-include-cache" + "jekyll-paginate" + "jekyll-redirect-from" + "jekyll-seo-tag" + "jekyll-sitemap" + ]; + groups = [ "default" ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "0xlrwyz68rfr820gm98gidc49vprb80im32s6ydli0q1mv1inmzq"; type = "gem"; }; version = "6.5.0"; }; jekyll-watch = { - dependencies = ["listen"]; - groups = ["default"]; - platforms = []; + dependencies = [ "listen" ]; + groups = [ "default" ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "1qd7hy1kl87fl7l0frw5qbn22x7ayfzlv9a5ca1m59g0ym1ysi5w"; type = "gem"; }; version = "2.2.1"; }; kramdown = { - dependencies = ["rexml"]; - groups = ["default"]; - platforms = []; + dependencies = [ "rexml" ]; + groups = [ "default" ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "1ic14hdcqxn821dvzki99zhmcy130yhv5fqfffkcf87asv5mnbmn"; type = "gem"; }; version = "2.4.0"; }; kramdown-parser-gfm = { - dependencies = ["kramdown"]; - groups = ["default"]; - platforms = []; + dependencies = [ "kramdown" ]; + groups = [ "default" ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "0a8pb3v951f4x7h968rqfsa19c8arz21zw1vaj42jza22rap8fgv"; type = "gem"; }; version = "1.1.0"; }; liquid = { - groups = ["default"]; - platforms = []; + groups = [ "default" ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "1czxv2i1gv3k7hxnrgfjb0z8khz74l4pmfwd70c7kr25l2qypksg"; type = "gem"; }; version = "4.0.4"; }; listen = { - dependencies = ["rb-fsevent" "rb-inotify"]; - groups = ["default"]; - platforms = []; + dependencies = [ + "rb-fsevent" + "rb-inotify" + ]; + groups = [ "default" ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "13rgkfar8pp31z1aamxf5y7cfq88wv6rxxcwy7cmm177qq508ycn"; type = "gem"; }; version = "3.8.0"; }; mercenary = { - groups = ["default" "test"]; - platforms = []; + groups = [ + "default" + "test" + ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "0f2i827w4lmsizrxixsrv2ssa3gk1b7lmqh8brk8ijmdb551wnmj"; type = "gem"; }; version = "0.4.0"; }; mini_portile2 = { - groups = ["default" "test"]; - platforms = []; + groups = [ + "default" + "test" + ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "1kl9c3kdchjabrihdqfmcplk3lq4cw1rr9f378y6q22qwy5dndvs"; type = "gem"; }; version = "2.8.5"; }; nokogiri = { - dependencies = ["mini_portile2" "racc"]; - groups = ["default" "test"]; - platforms = []; + dependencies = [ + "mini_portile2" + "racc" + ]; + groups = [ + "default" + "test" + ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "173zavvxlwyi48lfskk48wcrdbkvjlhjhvy4jpcrfx72rpjjx4k8"; type = "gem"; }; version = "1.16.2"; }; parallel = { - groups = ["default" "test"]; - platforms = []; + groups = [ + "default" + "test" + ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "15wkxrg1sj3n1h2g8jcrn7gcapwcgxr659ypjf75z1ipkgxqxwsv"; type = "gem"; }; version = "1.24.0"; }; pathutil = { - dependencies = ["forwardable-extended"]; - groups = ["default"]; - platforms = []; + dependencies = [ "forwardable-extended" ]; + groups = [ "default" ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "12fm93ljw9fbxmv2krki5k5wkvr7560qy8p4spvb9jiiaqv78fz4"; type = "gem"; }; version = "0.16.2"; }; public_suffix = { - groups = ["default" "test"]; - platforms = []; + groups = [ + "default" + "test" + ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "1bni4qjrsh2q49pnmmd6if4iv3ak36bd2cckrs6npl111n769k9m"; type = "gem"; }; version = "5.0.4"; }; racc = { - groups = ["default" "test"]; - platforms = []; + groups = [ + "default" + "test" + ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "01b9662zd2x9bp4rdjfid07h09zxj7kvn7f5fghbqhzc625ap1dp"; type = "gem"; }; version = "1.7.3"; }; rainbow = { - groups = ["default" "test"]; - platforms = []; + groups = [ + "default" + "test" + ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "0smwg4mii0fm38pyb5fddbmrdpifwv22zv3d3px2xx497am93503"; type = "gem"; }; version = "3.1.1"; }; rake = { - groups = ["default"]; - platforms = []; + groups = [ "default" ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "1ilr853hawi09626axx0mps4rkkmxcs54mapz9jnqvpnlwd3wsmy"; type = "gem"; }; version = "13.1.0"; }; rb-fsevent = { - groups = ["default"]; - platforms = []; + groups = [ "default" ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "1zmf31rnpm8553lqwibvv3kkx0v7majm1f341xbxc0bk5sbhp423"; type = "gem"; }; version = "0.11.2"; }; rb-inotify = { - dependencies = ["ffi"]; - groups = ["default"]; - platforms = []; + dependencies = [ "ffi" ]; + groups = [ "default" ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "1jm76h8f8hji38z3ggf4bzi8vps6p7sagxn3ab57qc0xyga64005"; type = "gem"; }; version = "0.10.1"; }; rexml = { - groups = ["default"]; - platforms = []; + groups = [ "default" ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "05i8518ay14kjbma550mv0jm8a6di8yp5phzrd8rj44z9qnrlrp0"; type = "gem"; }; version = "3.2.6"; }; rouge = { - groups = ["default"]; - platforms = []; + groups = [ "default" ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "1fkfa0iq3r9b0zzrxpxha17avmyzci3kidzmfbf6fd1279mndpb0"; type = "gem"; }; version = "4.2.0"; }; safe_yaml = { - groups = ["default"]; - platforms = []; + groups = [ "default" ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "0j7qv63p0vqcd838i2iy2f76c3dgwzkiz1d1xkg7n0pbnxj2vb56"; type = "gem"; }; version = "1.0.5"; }; sass-embedded = { - dependencies = ["google-protobuf" "rake"]; - groups = ["default"]; - platforms = []; + dependencies = [ + "google-protobuf" + "rake" + ]; + groups = [ "default" ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "1ccqqkmicqs2nbawyknb17qfafwqq0k6jxibcm86vqd1jp185pxa"; type = "gem"; }; version = "1.71.1"; }; terminal-table = { - dependencies = ["unicode-display_width"]; - groups = ["default"]; - platforms = []; + dependencies = [ "unicode-display_width" ]; + groups = [ "default" ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "14dfmfjppmng5hwj7c5ka6qdapawm3h6k9lhn8zj001ybypvclgr"; type = "gem"; }; version = "3.0.2"; }; typhoeus = { - dependencies = ["ethon"]; - groups = ["default" "test"]; - platforms = []; + dependencies = [ "ethon" ]; + groups = [ + "default" + "test" + ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "0z7gamf6s83wy0yqms3bi4srirn3fc0lc7n65lqanidxcj1xn5qw"; type = "gem"; }; version = "1.4.1"; }; unicode-display_width = { - groups = ["default"]; - platforms = []; + groups = [ "default" ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "1d0azx233nags5jx3fqyr23qa2rhgzbhv8pxp46dgbg1mpf82xky"; type = "gem"; }; version = "2.5.0"; }; webrick = { - groups = ["default"]; - platforms = []; + groups = [ "default" ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "13qm7s0gr2pmfcl7dxrmq38asaza4w0i2n9my4yzs499j731wh8r"; type = "gem"; }; version = "1.8.1"; }; yell = { - groups = ["default" "test"]; - platforms = []; + groups = [ + "default" + "test" + ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "1g16kcdhdfvczn7x81jiq6afg3bdxmb73skqjyjlkp5nqcy6y5hx"; type = "gem"; }; version = "2.2.2"; }; zeitwerk = { - groups = ["default" "test"]; - platforms = []; + groups = [ + "default" + "test" + ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "1m67qmsak3x8ixs8rb971azl3l7wapri65pmbf5z886h46q63f1d"; type = "gem"; }; diff --git a/spec/yume/default.nix b/spec/yume/default.nix index 1550ec16..45784806 100644 --- a/spec/yume/default.nix +++ b/spec/yume/default.nix @@ -1,8 +1,11 @@ -{ pkgs -, lib -, config -, modulesPath -, ... }: { +{ + pkgs, + lib, + config, + modulesPath, + ... +}: +{ global = { id = "d40d05288c1544af94e534eab24768fc"; fs.esp.uuid = "6CEB-765A"; @@ -24,13 +27,22 @@ steam.enable = true; }; - imports = lib.pipe ./. [ - builtins.readDir - (lib.filterAttrs (n: ty: ty == "regular" && n != "default.nix")) - (lib.mapAttrsToList (n: _: ./${n})) - ] ++ [ (modulesPath + "/profiles/qemu-guest.nix") ]; + imports = + lib.pipe ./. [ + builtins.readDir + (lib.filterAttrs (n: ty: ty == "regular" && n != "default.nix")) + (lib.mapAttrsToList (n: _: ./${n})) + ] + ++ [ (modulesPath + "/profiles/qemu-guest.nix") ]; - boot.initrd.availableKernelModules = [ "ahci" "xhci_pci" "virtio_pci" "usbhid" "sr_mod" "virtio_blk" ]; + boot.initrd.availableKernelModules = [ + "ahci" + "xhci_pci" + "virtio_pci" + "usbhid" + "sr_mod" + "virtio_blk" + ]; boot.initrd.kernelModules = [ ]; boot.kernelModules = [ "kvm-amd" ]; boot.extraModulePackages = [ ];