about summary refs log tree commit diff stats
path: root/modules/common
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--modules/common/abstract-nord.png (renamed from modules/home.legacy/files/wallpaper/abstract-nord.png)bin140219 -> 140219 bytes
-rw-r--r--modules/common/abstract-nord.png.license9
-rw-r--r--modules/common/default.nix298
-rw-r--r--modules/common/hooks/default.nix17
-rwxr-xr-xmodules/common/hooks/scripts/sync-git-repo.sh23
-rw-r--r--modules/common/nixos_shell_configuration.nix66
-rw-r--r--modules/common/projects.json133
-rw-r--r--modules/common/projects.json.license9
8 files changed, 555 insertions, 0 deletions
diff --git a/modules/home.legacy/files/wallpaper/abstract-nord.png b/modules/common/abstract-nord.png
index 5ef498bf..5ef498bf 100644
--- a/modules/home.legacy/files/wallpaper/abstract-nord.png
+++ b/modules/common/abstract-nord.png
Binary files differdiff --git a/modules/common/abstract-nord.png.license b/modules/common/abstract-nord.png.license
new file mode 100644
index 00000000..eae6a84c
--- /dev/null
+++ b/modules/common/abstract-nord.png.license
@@ -0,0 +1,9 @@
+nixos-config - My current NixOS configuration
+
+Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
+SPDX-License-Identifier: GPL-3.0-or-later
+
+This file is part of my nixos-config.
+
+You should have received a copy of the License along with this program.
+If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
diff --git a/modules/common/default.nix b/modules/common/default.nix
new file mode 100644
index 00000000..aadb22bd
--- /dev/null
+++ b/modules/common/default.nix
@@ -0,0 +1,298 @@
+# nixos-config - My current NixOS configuration
+#
+# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
+# SPDX-License-Identifier: GPL-3.0-or-later
+#
+# This file is part of my nixos-config.
+#
+# You should have received a copy of the License along with this program.
+# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
+# This file contains common configuration applied to every host.
+# It should only `enable` options defined in the `modules/by-name` directory.
+{
+  config,
+  pkgs,
+  lib,
+  # Needed for nixos-shell
+  libraries,
+  modules,
+  openPRsNixpkgs,
+  packageSets,
+  system,
+  self,
+  externalDependencies,
+  externalBinaries,
+  ...
+}: {
+  soispha = {
+    age.enable = true;
+    boot.enable = true;
+    cleanup.enable = true;
+    documentation.enable = true;
+
+    fonts = {
+      enable = true;
+      enableEmoji = true;
+    };
+
+    hardware = {
+      enable = lib.mkDefault true;
+    };
+    home-manager.enable = true;
+    impermanence = {
+      enable = true;
+
+      directories = [
+        "/etc/nixos"
+        "/var/lib/systemd"
+      ];
+    };
+
+    nixos-shell = {
+      enable = lib.mkDefault true;
+      configuration = {
+        specialArgs = {
+          inherit
+            libraries
+            modules
+            ;
+        };
+        value = lib.mkMerge [
+          {
+            _module.args = {
+              inherit
+                # extra package sources
+                openPRsNixpkgs
+                packageSets
+                # extra information
+                system
+                # nix registry
+                self
+                externalDependencies
+                # bins
+                # TODO: Integrate these into `pkgs/by-name` <2024-05-22>
+                externalBinaries
+                ;
+            };
+          }
+
+          {
+            require = [
+              ./nixos_shell_configuration.nix
+
+              ../../modules
+              ../../modules/common
+            ];
+          }
+        ];
+      };
+      mounts = {};
+    };
+
+    polkit.enable = true;
+    power.enable = true;
+    xdg.enable = true;
+
+    services = {
+      adb = {
+        enable = true;
+        user = "soispha";
+      };
+      backup = {
+        storagebox = {
+          enable = lib.mkDefault true;
+          user = "u459143-sub1";
+        };
+        local = {
+          enable = lib.mkDefault true;
+        };
+      };
+      fwupd.enable = true;
+      mako.enable = true;
+      mpd = {
+        enable = true;
+        directories = let
+          data = "${config.home-manager.users.soispha.xdg.dataHome}/mpd";
+        in {
+          inherit data;
+          playlists = "${data}/playlists";
+          runtime = "/run/user/${builtins.toString config.users.users.soispha.uid}/mpd";
+          music = config.home-manager.users.soispha.programs.beets.settings.directory;
+        };
+        mpc = {
+          enable = true;
+          beetsPkg = config.home-manager.users.soispha.programs.beets.package;
+        };
+      };
+      ollama.enable = false;
+      postgresql.enable = false;
+      printing.enable = true;
+      scanning.enable = true;
+      snapper.enable = true;
+      water-reminder.enable = true;
+      systemDiff.enable = true;
+      unison = {
+        enable = lib.mkDefault true;
+
+        foreign.userName = "soispha";
+        dataDir = "${config.home-manager.users.soispha.xdg.dataHome}/unison";
+        userSourceDir = "/srv/home/soispha";
+        pathsToIgnore = let
+          extractTarget = attr: "~/${attr.target}";
+          homeManagerSymlinks =
+            builtins.map extractTarget
+            (builtins.attrValues
+              config.home-manager.users.soispha.home.file);
+        in
+          [
+            # TODO(@bpeetz): Move these to their respective modules <2025-05-09>
+            # Already synchronized by TaskChampion sync server
+            "~/.local/share/task"
+            # Already synchronized by atuin sync server
+            "~/.local/share/atuin"
+            # Already synchronized by mbsync
+            "~/.local/share/maildir"
+
+            # Should not be synchronized
+            "~/.local/share/unison"
+
+            # These are just to big to be synchronized (# TODO: Work around that <2024-08-31> )
+            "~/media/music"
+            "~/.local/share/Steam"
+          ]
+          ++ homeManagerSymlinks;
+
+        pathsToSync = [
+          "~/.local/state/mpv"
+          "~/.local/state/nvim"
+          "~/.local/share"
+          "~/.local/.Trash-1000"
+
+          "~/.mozilla/firefox"
+
+          "~/media"
+          "~/school"
+          "~/repos"
+        ];
+      };
+    };
+
+    programs = {
+      i3bar-river.enable = true;
+      i3status-rust.enable = true;
+
+      nvim = {
+        enable = true;
+        shell = pkgs.zsh;
+      };
+      atuin = {
+        enable = true;
+        enableAge = lib.mkDefault true;
+      };
+      cargo.enable = true;
+      direnv.enable = true;
+      git.enable = true;
+      imv.enable = true;
+      less.enable = true;
+      lf.enable = true;
+      gpg.enable = true;
+      river = {
+        enable = lib.mkDefault true;
+        init = {
+          rules = [
+            {
+              app-id = "float";
+              title = "*";
+              action = "float";
+            }
+            {
+              app-id = "mpv";
+              title = "*";
+              action = "float";
+            }
+            {
+              app-id = "ModernGL";
+              title = "*";
+              action = "float";
+            }
+            {
+              app-id = "*";
+              title = "Manim Slides";
+              action = "float";
+            }
+            {
+              app-id = "*";
+              title = "floating please";
+              action = "float";
+            }
+
+            {
+              app-id = "*";
+              title = "*";
+              action = "ssd";
+            }
+            # This remove the focus border around Firefox (which is useful because the Firefox is nearly always in its own tag.)
+            {
+              app-id = "firefox";
+              title = "*";
+              action = "csd";
+            }
+          ];
+          generalSettings = {
+            # background
+            background-color = "0x002b36";
+            border-color-focused = "0x93a1a1";
+            border-color-unfocused = "0x586e75";
+
+            # keyboard repeat rate
+            set-repeat = ["50" "300"];
+
+            # Cursor
+            focus-follows-cursor = "normal";
+            # hide-cursor = ["timeout" "2000"];
+            hide-cursor = ["when-typing" "enabled"];
+            set-cursor-warp = "on-output-change";
+            xcursor-theme = ["Nordzy-cursors" "24"];
+          };
+          inputs = {
+            pointer-1133-49970-Logitech_Gaming_Mouse_G502 = [["pointer-accel" "0"] ["accel-profile" "none"]];
+            pointer-12951-6505-ZSA_Technology_Labs_Moonlander_Mark_I = [["pointer-accel" "0"] ["accel-profile" "none"]];
+          };
+          backgroundStart = [
+            # TODO(@bpeetz): Move these to systemd units/their own modules <2025-05-18>
+            pkgs.gammastep
+
+            pkgs.mako
+            ["${lib.getExe pkgs.swaybg}" "--image" "${./abstract-nord.png}"]
+            pkgs.swayidle
+            pkgs.alacritty
+          ];
+        };
+      };
+      firefox.enable = true;
+      mpv.enable = true;
+      steam.enable = true;
+      ssh.enable = true;
+      swaylock.enable = true;
+      timewarrior.enable = true;
+      taskwarrior = {
+        enable = true;
+        enableAge = lib.mkDefault true;
+
+        hooks = import ./hooks {inherit pkgs lib config;};
+      };
+      tskm = {
+        enable = true;
+        projects = builtins.fromJSON (builtins.readFile ./projects.json);
+      };
+      nix-index.enable = true;
+      yambar.enable = false;
+      yt.enable = true;
+      zathura.enable = true;
+      zsh.enable = true;
+    };
+
+    sound.enable = true;
+    version.enable = true;
+  };
+}
diff --git a/modules/common/hooks/default.nix b/modules/common/hooks/default.nix
new file mode 100644
index 00000000..5b694039
--- /dev/null
+++ b/modules/common/hooks/default.nix
@@ -0,0 +1,17 @@
+# nixos-config - My current NixOS configuration
+#
+# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
+# SPDX-License-Identifier: GPL-3.0-or-later
+#
+# This file is part of my nixos-config.
+#
+# You should have received a copy of the License along with this program.
+# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
+{
+  pkgs,
+  lib,
+  config,
+}: {
+  sync-git-repos = config.lib.taskwarrior.mkHook "on-add" [pkgs.git] ./scripts/sync-git-repo.sh;
+  sync-git-repos-mod = config.lib.taskwarrior.mkHook "on-modify" [pkgs.git] ./scripts/sync-git-repo.sh;
+}
diff --git a/modules/common/hooks/scripts/sync-git-repo.sh b/modules/common/hooks/scripts/sync-git-repo.sh
new file mode 100755
index 00000000..fe0d0085
--- /dev/null
+++ b/modules/common/hooks/scripts/sync-git-repo.sh
@@ -0,0 +1,23 @@
+#!/usr/bin/env sh
+
+# nixos-config - My current NixOS configuration
+#
+# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
+# SPDX-License-Identifier: GPL-3.0-or-later
+#
+# This file is part of my nixos-config.
+#
+# You should have received a copy of the License along with this program.
+# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
+
+task_data="$(task _get rc.data.location)"
+[ "$task_data" ] || die "Taskwarrior should have a location set"
+
+cd "$task_data" || die "(BUG?): Your data.location path is not accessable"
+
+[ -d ./.git/ ] || git init
+
+git add .
+git commit --message="chore: Update" --no-gpg-sign
+
+# vim: ft=sh
diff --git a/modules/common/nixos_shell_configuration.nix b/modules/common/nixos_shell_configuration.nix
new file mode 100644
index 00000000..1bec0145
--- /dev/null
+++ b/modules/common/nixos_shell_configuration.nix
@@ -0,0 +1,66 @@
+# nixos-config - My current NixOS configuration
+#
+# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
+# SPDX-License-Identifier: GPL-3.0-or-later
+#
+# This file is part of my nixos-config.
+#
+# You should have received a copy of the License along with this program.
+# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
+{...}: {
+  soispha = {
+    networking = {
+      enable = true;
+      hostName = "lahmu";
+      mode = "systemd-networkd";
+    };
+
+    nixos-shell.enable = false;
+
+    nixpkgs = {
+      enable = true;
+      systemName = "x86_64-linux";
+    };
+
+    services = {
+      unison.enable = false;
+      backup = {
+        storagebox.enable = false;
+        local.enable = false;
+      };
+    };
+
+    programs = {
+      river.enable = false;
+
+      # We don't have access to the age secrets.
+      atuin.enableAge = false;
+      taskwarrior.enableAge = false;
+    };
+
+    locale = {
+      enable = true;
+      keyMap = "us";
+    };
+
+    users = {
+      enable = true;
+      enableDeprecatedPlugdev = true;
+
+      # Make logging in impossible.
+      # (This also removes root a obvious access-point from the virtual machine)
+      hashedPassword = "";
+    };
+  };
+
+  soispha = {
+    hardware = {
+      enable = false;
+    };
+
+    disks.enable = false;
+  };
+
+  # We run without state
+  # system.stateVersion = null;
+}
diff --git a/modules/common/projects.json b/modules/common/projects.json
new file mode 100644
index 00000000..36a2ae45
--- /dev/null
+++ b/modules/common/projects.json
@@ -0,0 +1,133 @@
+{
+  "3d-printer": {
+    "prefix": "hardware"
+  },
+  "aoc": {
+    "prefix": "programming/advent_of_code"
+  },
+  "book": {
+    "prefix": "book"
+  },
+  "buy": {
+    "prefix": "buy",
+    "subprojects": {
+      "books": {},
+      "pc": {}
+    }
+  },
+  "camera": {
+    "prefix": "programming/zig"
+  },
+  "hardware": {
+    "prefix": "research"
+  },
+  "input": {
+    "prefix": "research",
+    "subprojects": {
+      "dotfiles": {},
+      "read-things": {}
+    }
+  },
+  "latex": {
+    "prefix": "programming/latex"
+  },
+  "me": {
+    "subprojects": {
+      "bank": {},
+      "google": {},
+      "health": {},
+      "job": {},
+      "sweden": {}
+    }
+  },
+  "possible-projects": {
+    "prefix": "research"
+  },
+  "presentation": {
+    "prefix": "research"
+  },
+  "school": {
+    "prefix": "research",
+    "subprojects": {
+      "biologie": {},
+      "chemie": {
+        "subprojects": {
+          "facharbeit": {}
+        }
+      },
+      "deutsch": {},
+      "english": {},
+      "extern": {
+        "subprojects": {
+          "bwinf": {},
+          "dsa": {}
+        }
+      },
+      "geographie": {},
+      "geschichte": {},
+      "infomatik": {},
+      "klausuren": {},
+      "latein": {},
+      "mathematik": {},
+      "musik": {},
+      "philosophie": {},
+      "physik": {},
+      "sozialkunde": {},
+      "sport": {}
+    }
+  },
+  "server": {
+    "prefix": "config",
+    "subprojects": {
+      "b-peetz": {},
+      "blog": {},
+      "ci": {},
+      "email": {},
+      "nix-sync": {},
+      "sudo-less": {}
+    }
+  },
+  "serverphone": {
+    "prefix": "programming/rust"
+  },
+  "smartphone": {
+    "prefix": "hardware",
+    "subprojects": {
+      "airdrop": {},
+      "airplay": {}
+    }
+  },
+  "system": {
+    "prefix": "config",
+    "subprojects": {
+      "backup": {},
+      "bar": {},
+      "email": {},
+      "firefox": {},
+      "gpg": {},
+      "keyboard": {},
+      "laptop": {},
+      "nvim": {},
+      "rss": {},
+      "shell": {},
+      "task": {},
+      "wm": {},
+      "youtube": {}
+    }
+  },
+  "timesinks": {
+    "subprojects": {
+      "games": {},
+      "music": {},
+      "netflix": {},
+      "youtube": {}
+    }
+  },
+  "trinitrix": {
+    "prefix": "programming/rust",
+    "subprojects": {
+      "documentation": {},
+      "testing": {}
+    }
+  }
+}
diff --git a/modules/common/projects.json.license b/modules/common/projects.json.license
new file mode 100644
index 00000000..eae6a84c
--- /dev/null
+++ b/modules/common/projects.json.license
@@ -0,0 +1,9 @@
+nixos-config - My current NixOS configuration
+
+Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
+SPDX-License-Identifier: GPL-3.0-or-later
+
+This file is part of my nixos-config.
+
+You should have received a copy of the License along with this program.
+If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.