Signed-off-by: Christoph Schmatzler <christoph@schmatzler.com>
This commit is contained in:
2025-11-02 11:36:27 +00:00
parent fe843e19bf
commit 298bbfae53
57 changed files with 2309 additions and 2248 deletions

1
alejandra.toml Normal file
View File

@@ -0,0 +1 @@
indentation = "Tabs"

View File

@@ -43,7 +43,8 @@
"aarch64-darwin"
];
flake.darwinConfigurations = inputs.nixpkgs.lib.genAttrs darwinHosts (
flake.darwinConfigurations =
inputs.nixpkgs.lib.genAttrs darwinHosts (
hostname:
inputs.darwin.lib.darwinSystem {
system = "aarch64-darwin";
@@ -73,7 +74,8 @@
}
);
flake.nixosConfigurations = inputs.nixpkgs.lib.genAttrs nixosHosts (
flake.nixosConfigurations =
inputs.nixpkgs.lib.genAttrs nixosHosts (
hostname:
inputs.nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
@@ -114,7 +116,8 @@
"rollback"
];
in {
devShells.default = pkgs.mkShell {
devShells.default =
pkgs.mkShell {
nativeBuildInputs = with pkgs; [
bashInteractive
git
@@ -124,7 +127,8 @@
shellHook = ''export EDITOR=nvim'';
};
apps = builtins.listToAttrs (
apps =
builtins.listToAttrs (
map (n: {
name = n;
value = mkApp n;

View File

@@ -1,5 +1,6 @@
{pkgs}: let
wallpaper = pkgs.fetchurl {
wallpaper =
pkgs.fetchurl {
url = "https://misc-assets.raycast.com/wallpapers/bright-rain.png";
sha256 = "sha256-wQT4I2X3gS6QFsEb7MdRsn4oX7FNkflukXPGMFbJZ10=";
};

View File

@@ -10,23 +10,27 @@ with lib; let
in {
options = {
local.dock = {
enable = mkOption {
enable =
mkOption {
description = "Enable dock";
default = stdenv.isDarwin;
example = false;
};
entries = mkOption {
entries =
mkOption {
description = "Entries on the Dock";
type = with types;
listOf (submodule {
options = {
path = lib.mkOption {type = str;};
section = lib.mkOption {
section =
lib.mkOption {
type = str;
default = "apps";
};
options = lib.mkOption {
options =
lib.mkOption {
type = str;
default = "";
};
@@ -35,14 +39,16 @@ in {
readOnly = true;
};
username = mkOption {
username =
mkOption {
description = "Username to apply the dock settings to";
type = types.str;
};
};
};
config = mkIf cfg.enable (
config =
mkIf cfg.enable (
let
normalize = path:
if hasSuffix ".app" path

View File

@@ -12,7 +12,8 @@ in {
home = {
packages = pkgs.callPackage ../packages.nix {};
activation = {
"setWallpaper" = lib.hm.dag.entryAfter ["revealHomeLibraryDirectory"] ''
"setWallpaper" =
lib.hm.dag.entryAfter ["revealHomeLibraryDirectory"] ''
echo "[+] Setting wallpaper"
${setWallpaperScript}/bin/set-wallpaper-script
'';

View File

@@ -19,7 +19,8 @@ with lib; let
devices = mapAttrsToList (_: device: device // {deviceID = device.id;}) cfg.settings.devices;
anyAutoAccept = builtins.any (dev: dev.autoAcceptFolders) devices;
folders = mapAttrsToList (_: folder:
folders =
mapAttrsToList (_: folder:
folder
// {
devices = let
@@ -37,7 +38,8 @@ with lib; let
}) (filterAttrs (_: folder: folder.enable) cfg.settings.folders);
jq = "${pkgs.jq}/bin/jq";
updateConfig = pkgs.writers.writeBash "merge-syncthing-config" (
updateConfig =
pkgs.writers.writeBash "merge-syncthing-config" (
''
set -efu
umask 0077
@@ -76,7 +78,8 @@ with lib; let
lib.pipe s.conf [
(map (
new_cfg: let
jsonPreSecretsFile = pkgs.writeTextFile {
jsonPreSecretsFile =
pkgs.writeTextFile {
name = "${conf_type}-${new_cfg.id}-conf-pre-secrets.json";
text = builtins.toJSON new_cfg;
};
@@ -85,7 +88,8 @@ with lib; let
"devs" = "${jq} .";
"dirs" = let
folder = new_cfg;
devicesWithSecrets = lib.pipe folder.devices [
devicesWithSecrets =
lib.pipe folder.devices [
(lib.filter (device: (builtins.isAttrs device) && device ? encryptionPasswordFile))
(map (device: {
deviceId = device.deviceId;
@@ -151,56 +155,68 @@ in {
services.syncthing = {
enable = mkEnableOption "Syncthing, a self-hosted open-source alternative to Dropbox and Bittorrent Sync";
cert = mkOption {
cert =
mkOption {
type = types.nullOr types.str;
default = null;
description = "Path to the cert.pem file, which will be copied into Syncthing's configDir.";
};
key = mkOption {
key =
mkOption {
type = types.nullOr types.str;
default = null;
description = "Path to the key.pem file, which will be copied into Syncthing's configDir.";
};
overrideDevices = mkOption {
overrideDevices =
mkOption {
type = types.bool;
default = true;
description = "Whether to delete the devices which are not configured via the devices option.";
};
overrideFolders = mkOption {
overrideFolders =
mkOption {
type = types.bool;
default = !anyAutoAccept;
description = "Whether to delete the folders which are not configured via the folders option.";
};
settings = mkOption {
type = types.submodule {
settings =
mkOption {
type =
types.submodule {
freeformType = settingsFormat.type;
options = {
options = mkOption {
options =
mkOption {
default = {};
description = "The options element contains all other global configuration options";
type = types.submodule {
type =
types.submodule {
freeformType = settingsFormat.type;
options = {
localAnnounceEnabled = mkOption {
localAnnounceEnabled =
mkOption {
type = types.nullOr types.bool;
default = null;
description = "Whether to send announcements to the local LAN.";
};
globalAnnounceEnabled = mkOption {
globalAnnounceEnabled =
mkOption {
type = types.nullOr types.bool;
default = null;
description = "Whether to send announcements to the global discovery servers.";
};
relaysEnabled = mkOption {
relaysEnabled =
mkOption {
type = types.nullOr types.bool;
default = null;
description = "When true, relays will be connected to and potentially used for device to device connections.";
};
urAccepted = mkOption {
urAccepted =
mkOption {
type = types.nullOr types.int;
default = null;
description = "Whether the user has accepted to submit anonymous usage data.";
@@ -209,22 +225,27 @@ in {
};
};
devices = mkOption {
devices =
mkOption {
default = {};
description = "Peers/devices which Syncthing should communicate with.";
type = types.attrsOf (types.submodule ({name, ...}: {
type =
types.attrsOf (types.submodule ({name, ...}: {
freeformType = settingsFormat.type;
options = {
name = mkOption {
name =
mkOption {
type = types.str;
default = name;
description = "The name of the device.";
};
id = mkOption {
id =
mkOption {
type = types.str;
description = "The device ID.";
};
autoAcceptFolders = mkOption {
autoAcceptFolders =
mkOption {
type = types.bool;
default = false;
description = "Automatically create or share folders that this device advertises at the default path.";
@@ -233,48 +254,59 @@ in {
}));
};
folders = mkOption {
folders =
mkOption {
default = {};
description = "Folders which should be shared by Syncthing.";
type = types.attrsOf (types.submodule ({name, ...}: {
type =
types.attrsOf (types.submodule ({name, ...}: {
freeformType = settingsFormat.type;
options = {
enable = mkOption {
enable =
mkOption {
type = types.bool;
default = true;
description = "Whether to share this folder.";
};
path = mkOption {
path =
mkOption {
type = types.str;
default = name;
description = "The path to the folder which should be shared.";
};
id = mkOption {
id =
mkOption {
type = types.str;
default = name;
description = "The ID of the folder. Must be the same on all devices.";
};
label = mkOption {
label =
mkOption {
type = types.str;
default = name;
description = "The label of the folder.";
};
type = mkOption {
type =
mkOption {
type = types.enum ["sendreceive" "sendonly" "receiveonly" "receiveencrypted"];
default = "sendreceive";
description = "Controls how the folder is handled by Syncthing.";
};
devices = mkOption {
type = types.listOf (types.oneOf [
devices =
mkOption {
type =
types.listOf (types.oneOf [
types.str
(types.submodule {
freeformType = settingsFormat.type;
options = {
name = mkOption {
name =
mkOption {
type = types.str;
description = "The name of a device defined in the devices option.";
};
encryptionPasswordFile = mkOption {
encryptionPasswordFile =
mkOption {
type = types.nullOr types.path;
default = null;
description = "Path to encryption password file.";
@@ -294,37 +326,43 @@ in {
description = "Extra configuration options for Syncthing.";
};
guiAddress = mkOption {
guiAddress =
mkOption {
type = types.str;
default = "127.0.0.1:8384";
description = "The address to serve the web interface at.";
};
user = mkOption {
user =
mkOption {
type = types.str;
default = "syncthing";
description = "The user to run Syncthing as.";
};
group = mkOption {
group =
mkOption {
type = types.str;
default = "syncthing";
description = "The group to run Syncthing under.";
};
dataDir = mkOption {
dataDir =
mkOption {
type = types.path;
default = "/var/lib/syncthing";
description = "The path where synchronised directories will exist.";
};
configDir = mkOption {
configDir =
mkOption {
type = types.path;
default = cfg.dataDir + "/.config/syncthing";
description = "The path where the settings and keys will exist.";
};
openDefaultPorts = mkOption {
openDefaultPorts =
mkOption {
type = types.bool;
default = false;
description = "Whether to open the default ports in the firewall (not applicable on Darwin).";
@@ -334,7 +372,8 @@ in {
};
};
config = mkIf cfg.enable {
config =
mkIf cfg.enable {
assertions = [
{
assertion = !(cfg.overrideFolders && anyAutoAccept);
@@ -369,7 +408,8 @@ in {
};
};
launchd.user.agents.syncthing-init = mkIf (cleanedConfig != {}) {
launchd.user.agents.syncthing-init =
mkIf (cleanedConfig != {}) {
serviceConfig = {
ProgramArguments = ["${updateConfig}"];
RunAtLoad = true;
@@ -380,7 +420,8 @@ in {
};
};
system.activationScripts.syncthing = mkIf (cfg.cert != null || cfg.key != null) ''
system.activationScripts.syncthing =
mkIf (cfg.cert != null || cfg.key != null) ''
echo "Setting up Syncthing certificates..."
mkdir -p ${cfg.configDir}
${optionalString (cfg.cert != null) ''

View File

@@ -7,7 +7,8 @@
};
themes = {
"Catppuccin Latte" = {
src = pkgs.fetchFromGitHub {
src =
pkgs.fetchFromGitHub {
owner = "catppuccin";
repo = "bat";
rev = "6810349b28055dce54076712fc05fc68da4b8ec0";

View File

@@ -4,7 +4,8 @@
clipboard = "osc52";
};
opts = {
expandtab = true;
expandtab = false;
tabstop = 2;
ignorecase = true;
mouse = "";
relativenumber = true;

View File

@@ -127,7 +127,11 @@
extra = {};
git = {};
icons = {};
indentscope = {};
indentscope = {
settings = {
symbol = "|";
};
};
jump = {};
jump2d = {
settings = {

View File

@@ -1,6 +1,7 @@
{inputs}: let
dir = builtins.readDir ./.;
overlayNames = builtins.sort builtins.lessThan (builtins.filter (
overlayNames =
builtins.sort builtins.lessThan (builtins.filter (
name:
name
!= "default.nix"