summaryrefslogtreecommitdiff
path: root/archetypes/profiles
diff options
context:
space:
mode:
Diffstat (limited to 'archetypes/profiles')
-rw-r--r--archetypes/profiles/btrfs/default.nix17
-rw-r--r--archetypes/profiles/cuda/default.nix26
-rw-r--r--archetypes/profiles/default.nix11
-rw-r--r--archetypes/profiles/desktop/default.nix144
-rw-r--r--archetypes/profiles/desktop/resources/fontconfig/90-commit-mono-options.conf17
-rw-r--r--archetypes/profiles/desktop/resources/fontconfig/90-tamzen-disable-anti-aliasing.conf14
-rw-r--r--archetypes/profiles/gnome/default.nix13
-rw-r--r--archetypes/profiles/headless/default.nix37
-rw-r--r--archetypes/profiles/pi/default.nix30
-rw-r--r--archetypes/profiles/zfs/default.nix33
10 files changed, 342 insertions, 0 deletions
diff --git a/archetypes/profiles/btrfs/default.nix b/archetypes/profiles/btrfs/default.nix
new file mode 100644
index 0000000..88fad38
--- /dev/null
+++ b/archetypes/profiles/btrfs/default.nix
@@ -0,0 +1,17 @@
+{ lib, pkgs, ... }: let
+ mkBtrfs = lib.mkOverride 820;
+
+ # https://wiki.nixos.org/wiki/Btrfs
+ nixosConfig = {
+ services.btrfs = {
+ autoScrub.enable = mkBtrfs true;
+ };
+
+ # Make docker work with btrfs
+ virtualisation.docker.storageDriver = mkBtrfs "btrfs";
+ };
+
+ homeConfig = {};
+in {
+ imports = [ (lib._mkProfileArchetype "btrfs" nixosConfig homeConfig) ];
+}
diff --git a/archetypes/profiles/cuda/default.nix b/archetypes/profiles/cuda/default.nix
new file mode 100644
index 0000000..b57b854
--- /dev/null
+++ b/archetypes/profiles/cuda/default.nix
@@ -0,0 +1,26 @@
+{ lib, pkgs, ... }: let
+ mkCuda = lib.mkOverride 800;
+
+ nixosConfig = {
+ # Binary cache packages built with cudaSupport
+ nix.settings = {
+ substituters = mkCuda [ "https://cache.nixos-cuda.org" ];
+ trusted-public-keys = mkCuda [ "cache.nixos-cuda.org:74DUi4Ye579gUqzH4ziL9IyiJBlDpMRn9MBN8oNan9M=" ];
+ };
+
+ # Enable cudaSupport
+ nixpkgs.config.cudaSupport = mkCuda true;
+
+ _archetypes.collections = {
+ nvidia.enable = mkCuda true;
+ };
+
+ # Enable nvidia graphics
+ services.xserver.videoDrivers = mkCuda [ "nvidia" ]; # xserver.videoDrivers does not imply X
+ hardware.graphics.enable = mkCuda true;
+ };
+
+ homeConfig = {};
+in {
+ imports = [ (lib._mkProfileArchetype "cuda" nixosConfig homeConfig) ];
+}
diff --git a/archetypes/profiles/default.nix b/archetypes/profiles/default.nix
new file mode 100644
index 0000000..1664484
--- /dev/null
+++ b/archetypes/profiles/default.nix
@@ -0,0 +1,11 @@
+{
+ imports = [
+ ./gnome # 700
+ ./cuda # 800
+ ./zfs # 810
+ ./btrfs # 820
+ ./pi # 900
+ ./headless # 910
+ ./desktop # 920
+ ];
+}
diff --git a/archetypes/profiles/desktop/default.nix b/archetypes/profiles/desktop/default.nix
new file mode 100644
index 0000000..2f71791
--- /dev/null
+++ b/archetypes/profiles/desktop/default.nix
@@ -0,0 +1,144 @@
+{ lib, pkgs, ... }: let
+ mkDesktop = lib.mkOverride 920;
+
+ nixosConfig = {
+ _archetypes.collections = {
+ desktop = {
+ firefox.enable = mkDesktop true;
+ pipewire.enable = mkDesktop true;
+ printing.enable = mkDesktop true;
+ thumbnailers.enable = mkDesktop true;
+ utilities.enable = mkDesktop true;
+ xserver = {
+ enable = mkDesktop true;
+ utilities.enable = mkDesktop true;
+ };
+ };
+ development = {
+ utilities.enable = mkDesktop true;
+ };
+ fonts.enable = mkDesktop true;
+ };
+
+ security = {
+ polkit = {
+ enable = mkDesktop true;
+ _gnome.enable = mkDesktop true;
+ _allowUserPowerControls = mkDesktop true;
+ };
+ };
+
+ programs = {
+ _ddcutil.enable = mkDesktop true;
+ };
+
+ services = {
+ _geoclue2.enable = mkDesktop true;
+ xserver = {
+ windowManager._awesome.enable = mkDesktop true;
+ enableTearFree = mkDesktop true;
+ };
+ logind._safePowerKey.enable = mkDesktop true;
+ openssh = {
+ enable = mkDesktop true;
+ settings.X11Forwarding = mkDesktop true;
+ };
+ tlp.enable = mkDesktop true;
+
+ # Ensure video group can change backlight
+ udev.extraRules = mkDesktop ''
+ SUBSYSTEM=="backlight", ACTION=="add", RUN+="${pkgs.coreutils}/bin/chgrp video /sys/class/backlight/%k/brightness", RUN+="${pkgs.coreutils}/bin/chmod g+w /sys/class/backlight/%k/brightness"
+ '';
+ };
+
+ # Disable ipv6 by default
+ networking.enableIPv6 = mkDesktop false;
+
+ # Install dconf. Home-manager will break without it if gtk theme is changed
+ environment.systemPackages = [ pkgs.dconf ];
+ };
+
+ homeConfig = {
+ gtk = {
+ enable = mkDesktop true;
+ _mintTheme.enable = mkDesktop true;
+ font.name = mkDesktop "sans-serif";
+ cursorTheme.name = mkDesktop "Adwaita";
+ };
+
+ qt._gtkPlatformTheme.enable = mkDesktop true;
+
+ fonts.fontconfig = {
+ enable = mkDesktop true;
+ defaultFonts = {
+ # These fonts are added above in fonts collection
+ sansSerif = mkDesktop [ "Inter" ];
+ monospace = mkDesktop [ "CommitMono" ];
+ };
+ configFile = {
+ tamzen-disable-anti-aliasing = {
+ enable = true;
+ source = ./resources/fontconfig/90-tamzen-disable-anti-aliasing.conf;
+ };
+ commit-mono-options = {
+ enable = true;
+ source = ./resources/fontconfig/90-commit-mono-options.conf;
+ };
+ };
+ };
+
+ programs = {
+ _pcmanfm.openAsRootOption.enable = mkDesktop true;
+ _st = {
+ enable = mkDesktop true;
+ font = {
+ name = mkDesktop "JetBrainsMonoNL Nerd Font Mono";
+ # Default attrs
+ attrs = {
+ size = 12;
+ antialias = true;
+ autohint = true;
+ };
+ };
+ };
+ firefox._configure = mkDesktop true;
+ htop._configure = mkDesktop true;
+ zathura = {
+ enable = mkDesktop true;
+ options = {
+ selection-clipboard = mkDesktop "clipboard"; # Copy highlighted text
+ };
+ };
+ };
+
+ services = {
+ _gammastep.enable = true;
+ #polkit-gnome.enable = mkDesktop true; # Doesn't work on X
+ };
+
+ xdg = {
+ autostart = {
+ enable = mkDesktop true;
+ entries = mkDesktop [
+ "${pkgs.gammastep}/share/applications/gammastep-indicator.desktop"
+ "${pkgs.unclutter-desktop-entry}/share/applications/unclutter.desktop"
+ ];
+ };
+ };
+
+ xdg.mimeApps._defaultCategoryApplications = {
+ enable = true;
+ categoryApplications = {
+ audio = [ "mpv" ];
+ directory = [ "pcmanfm" ];
+ email = [ "thunderbird" ];
+ image = [ "nsxiv" ];
+ pdf = [ "org.pwmt.zathura-pdf-mupdf" ];
+ text = [ "nvim" ];
+ video = [ "mpv" ];
+ };
+ };
+ };
+in {
+ imports = [ (lib._mkProfileArchetype "desktop" nixosConfig homeConfig) ];
+}
diff --git a/archetypes/profiles/desktop/resources/fontconfig/90-commit-mono-options.conf b/archetypes/profiles/desktop/resources/fontconfig/90-commit-mono-options.conf
new file mode 100644
index 0000000..9c7373a
--- /dev/null
+++ b/archetypes/profiles/desktop/resources/fontconfig/90-commit-mono-options.conf
@@ -0,0 +1,17 @@
+<?xml version="1.0"?>
+<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
+
+<fontconfig>
+ <description>Enable opentype features for CommitMono to make it match better with Inter as its monospace counterpart</description>
+ <match target="font">
+ <test name="family" compare="eq" ignore-blanks="true">
+ <string>CommitMono</string>
+ </test>
+ <edit name="fontfeatures" mode="append">
+ <string>ss03 on</string> <!-- smart case -->
+ <string>ss04 on</string> <!-- symbol spacing -->
+ <string>cv02 on</string> <!-- alt g -->
+ <string>cv06 on</string> <!-- alt 6 & 9 -->
+ </edit>
+ </match>
+</fontconfig>
diff --git a/archetypes/profiles/desktop/resources/fontconfig/90-tamzen-disable-anti-aliasing.conf b/archetypes/profiles/desktop/resources/fontconfig/90-tamzen-disable-anti-aliasing.conf
new file mode 100644
index 0000000..5bf94d7
--- /dev/null
+++ b/archetypes/profiles/desktop/resources/fontconfig/90-tamzen-disable-anti-aliasing.conf
@@ -0,0 +1,14 @@
+<?xml version="1.0"?>
+<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
+
+<fontconfig>
+ <description>Disable anti-aliasing for Tamzen since it is a bitmap font</description>
+ <match target="pattern">
+ <test name="family" compare="eq" qual="any">
+ <string>Tamzen</string>
+ </test>
+ <edit name="antialias" mode="assign">
+ <bool>false</bool>
+ </edit>
+ </match>
+</fontconfig>
diff --git a/archetypes/profiles/gnome/default.nix b/archetypes/profiles/gnome/default.nix
new file mode 100644
index 0000000..6b7184b
--- /dev/null
+++ b/archetypes/profiles/gnome/default.nix
@@ -0,0 +1,13 @@
+{ lib, pkgs, ... }: let
+ mkGnome = lib.mkOverride 700;
+
+ nixosConfig = {
+ services.displayManager.gdm.enable = mkGnome true;
+ services.desktopManager.gnome.enable = mkGnome true;
+ services.tlp.enable = mkGnome false; # Conflicts with power-profiles-daemon
+ };
+
+ homeConfig = {};
+in {
+ imports = [ (lib._mkProfileArchetype "gnome" nixosConfig homeConfig) ];
+}
diff --git a/archetypes/profiles/headless/default.nix b/archetypes/profiles/headless/default.nix
new file mode 100644
index 0000000..ac1eb80
--- /dev/null
+++ b/archetypes/profiles/headless/default.nix
@@ -0,0 +1,37 @@
+{ lib, ... }: let
+ mkHeadless = lib.mkOverride 910;
+
+ nixosConfig = {
+ _archetypes.collections = {
+ development = {
+ utilities.enable = mkHeadless true;
+ };
+ };
+
+ programs = {
+ _ddcutil.enable = mkHeadless true;
+ };
+
+ services = {
+ openssh.enable = mkHeadless true;
+ smartd.enable = mkHeadless true;
+ };
+
+ # Disable ipv6 by default
+ networking.enableIPv6 = mkHeadless false;
+ };
+
+ homeConfig = {
+ # Disable fontconfig features explicitly to avoid warnings
+ fonts.fontconfig = {
+ subpixelRendering = mkHeadless "none";
+ hinting = mkHeadless "none";
+ };
+
+ programs = {
+ htop._configure = mkHeadless true;
+ };
+ };
+in {
+ imports = [ (lib._mkProfileArchetype "headless" nixosConfig homeConfig) ];
+}
diff --git a/archetypes/profiles/pi/default.nix b/archetypes/profiles/pi/default.nix
new file mode 100644
index 0000000..639111a
--- /dev/null
+++ b/archetypes/profiles/pi/default.nix
@@ -0,0 +1,30 @@
+{ lib, pkgs, ... }: let
+ mkPi = lib.mkOverride 900;
+
+ nixosConfig = {
+ boot.loader = {
+ # Use the extlinux boot loader. (NixOS wants to enable GRUB by default)
+ grub.enable = false;
+ # Enables the generation of /boot/extlinux/extlinux.conf
+ generic-extlinux-compatible.enable = true;
+ };
+ };
+
+ homeConfig = {
+ # Use raspian logo in fastfetch
+ programs.fastfetch.settings = {
+ logo.source = mkPi "raspbian";
+ # Default options for the rest of this
+ # TODO figure out how to just override logo and keep defaults w/config file
+ modules = [
+ "title" "separator" "os" "host" "kernel" "uptime" "packages"
+ "shell" "display" "de" "wm" "wmtheme" "theme" "icons" "font"
+ "cursor" "terminal" "terminalfont" "cpu" "gpu" "memory" "swap"
+ "disk" "localip" "battery" "poweradapter" "locale" "break"
+ "colors"
+ ];
+ };
+ };
+in {
+ imports = [ (lib._mkProfileArchetype "pi" nixosConfig homeConfig) ];
+}
diff --git a/archetypes/profiles/zfs/default.nix b/archetypes/profiles/zfs/default.nix
new file mode 100644
index 0000000..00f3c0b
--- /dev/null
+++ b/archetypes/profiles/zfs/default.nix
@@ -0,0 +1,33 @@
+{ lib, pkgs, ... }: let
+ mkZfs = lib.mkOverride 810;
+
+ # https://wiki.nixos.org/wiki/ZFS
+ nixosConfig = {
+ boot._loader = {
+ grub.zfsSupport = mkZfs true;
+ mode = mkZfs "efi";
+ };
+
+ boot.supportedFilesystems = [ "zfs" ];
+
+ services.zfs = {
+ trim.enable = mkZfs true;
+ autoSnapshot.enable = mkZfs true;
+ autoScrub.enable = mkZfs true;
+ };
+
+ # Make docker work with zfs
+ virtualisation.docker.storageDriver = mkZfs "zfs";
+
+ # Ensure root pools are safely imported (default after 26.11)
+ # NOTE: If NixOS fails to boot because it cannot import the root pool,
+ # you should boot with the zfs_force=1 option as a kernel parameter
+ # (e.g. by manually editing the kernel params via your bootloader). You
+ # should only need to do this after unclean shutdowns.
+ boot.zfs.forceImportRoot = mkZfs false;
+ };
+
+ homeConfig = {};
+in {
+ imports = [ (lib._mkProfileArchetype "zfs" nixosConfig homeConfig) ];
+}