From d9d4e43c35987ae4fdba307ce3357c940936bde5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jana=20D=C3=B6nszelmann?= Date: Sun, 15 Mar 2026 17:57:07 +0100 Subject: [PATCH] finally share with ragdoll --- config.nix | 27 +- defaults/machine-config.nix | 1 - hosts/fili/services/factorio/default.nix | 2 +- modules/program.nix | 28 +- modules/users.nix | 2 +- programs/default.nix | 425 ++++++++++++----------- programs/firefox/default.nix | 6 +- programs/fish/default.nix | 7 +- programs/git/default.nix | 6 +- programs/jj/default.nix | 6 +- programs/kanata/default.nix | 6 +- programs/kitty/default.nix | 6 +- programs/niri/default.nix | 21 +- programs/nvim/default.nix | 6 +- programs/tmux/default.nix | 6 +- {defaults => programs}/xdg.nix | 25 +- programs/zed/default.nix | 6 +- 17 files changed, 310 insertions(+), 276 deletions(-) rename {defaults => programs}/xdg.nix (91%) diff --git a/config.nix b/config.nix index 22f414e..53750c1 100644 --- a/config.nix +++ b/config.nix @@ -33,19 +33,28 @@ rec { requirements: lib.all (req: builtins.elem req capabilities) requirements; program = { + inputs, + name, requirements ? [ ], home-config, - system-config ? { }, + system-config ? (_: { }), }: - # if (matches-capabilities requirements) then - if (true) then - { - inherit home-config system-config; - } + if (matches-capabilities requirements) then + [ (if builtins.isNull home-only then (system-config inputs) else (home-config inputs)) ] + ++ + + ( + if builtins.isNull home-only then + [ + (_: { + custom.program.${name}.defered-config = home-config; + }) + ] + else + [ ] + ) else - { - # home-config = _: { }; - }; + [ ]; specialArgsForHomeSystem = { system, diff --git a/defaults/machine-config.nix b/defaults/machine-config.nix index 5ff6d5f..4bb2850 100644 --- a/defaults/machine-config.nix +++ b/defaults/machine-config.nix @@ -8,7 +8,6 @@ { imports = [ ./machine-or-home-config.nix - ./xdg.nix ]; system.stateVersion = machine.stateVersion; diff --git a/hosts/fili/services/factorio/default.nix b/hosts/fili/services/factorio/default.nix index 7ad9399..80815ba 100644 --- a/hosts/fili/services/factorio/default.nix +++ b/hosts/fili/services/factorio/default.nix @@ -61,7 +61,7 @@ let }; privateUsers = "no"; - config = + imports = { config, pkgs, diff --git a/modules/program.nix b/modules/program.nix index dad5d18..f843d1a 100644 --- a/modules/program.nix +++ b/modules/program.nix @@ -1,4 +1,4 @@ -{ +inputs@{ lib, options, machine, @@ -9,24 +9,16 @@ with lib; options = { custom.program = mkOption { type = types.attrsOf ( - types.submodule ( - { config, ... }: - { - options = { - name = mkOption { - type = types.string; - }; - home-config = mkOption { - type = types.deferredModule; - }; - system-config = mkOption { - type = types.deferredModule; - default = _: { }; - }; + types.submodule (_: { + options = { + name = mkOption { + type = types.string; }; - config = if builtins.isNull machine.home-only then config.system-config else config.home-config; - } - ) + defered-config = mkOption { + type = types.deferredModule; + }; + }; + }) ); }; }; diff --git a/modules/users.nix b/modules/users.nix index aea828d..1590821 100644 --- a/modules/users.nix +++ b/modules/users.nix @@ -106,7 +106,7 @@ in imports = ( [ ] - ++ (map (program: program.home-config) programs) + ++ (map (program: program.defered-config) programs) ); home = { inherit stateVersion; diff --git a/programs/default.nix b/programs/default.nix index 4c94d65..fb72b37 100644 --- a/programs/default.nix +++ b/programs/default.nix @@ -1,230 +1,241 @@ -{ machine, ... }@inputs: +{ machine, lib, ... }@inputs: { - imports = [ - ./nvim - ./fish - ./kanata - ./kitty - ./tmux - ./git - ./jj - ./niri - ./zed - ./firefox - ]; - custom.program.graphcial-packages = machine.program { - requirements = [ "graphical" ]; - home-config = - { pkgs, ... }: - { - home.packages = with pkgs; [ - spotify - obsidian - element-desktop - # chromium - bind.dnsutils - mpv - vlc - libreoffice-qt - hunspell - hunspellDicts.en_US - ]; - }; - }; + imports = lib.concatLists [ + [ + ./xdg.nix + ./nvim + ./fish + ./kanata + ./kitty + ./tmux + ./git + ./jj + ./niri + ./zed + ./firefox + ] - custom.program.discord = machine.program { - requirements = [ "graphical" ]; - home-config = - { - config, - pkgs, - lib, - ... - }: - let - disableFeatures = [ - "WebRtcAllowInputVolumeAdjustment" - "ChromeWideEchoCancellation" - ]; - enableFeatures = [ ]; - commandLineArgs = - lib.optionals (enableFeatures != [ ]) [ - "--enable-features=${lib.concatStringsSep "," enableFeatures}" - ] - ++ lib.optionals (disableFeatures != [ ]) [ - "--disable-features=${lib.concatStringsSep "," disableFeatures}" + (machine.program { + name = "graphcial-packages"; + inherit inputs; + requirements = [ "graphical" ]; + home-config = + { pkgs, ... }: + { + home.packages = with pkgs; [ + spotify + obsidian + element-desktop + # chromium + bind.dnsutils + mpv + vlc + libreoffice-qt + hunspell + hunspellDicts.en_US ]; - joinedArgs = lib.concatStringsSep " " commandLineArgs; - in - { - home.file."${config.xdg.configHome}/discord/settings.json".source = pkgs.writeText "settings.json" ( - lib.strings.toJSON ( - let - endpoint = "https://inject.shelter.uwu.network/shelter+yt_ad_block+yt_embed_fix"; - in - { - SKIP_HOST_UPDATE = true; - MINIMIZE_TO_TRAY = false; - OPEN_ON_STARTUP = false; - DANGEROUS_ENABLE_DEVTOOLS_ONLY_ENABLE_IF_YOU_KNOW_WHAT_YOURE_DOING = true; - enableHardwareAcceleration = true; - UPDATE_ENDPOINT = endpoint; - NEW_UPDATE_ENDPOINT = "${endpoint}/"; - BACKGROUND_COLOR = "#2c2d32"; + }; + }) - openasar = { - setup = true; - # using the performance preset breaks vaapi - cmdPreset = "balanced"; - # quickstart is buggy and breaks discord sometimes. - quickstart = false; - # this css is made for discord compact mode. if you're not using that, stuff won't align!! - css = - # css - '' - /* Hide nitro begging */ - @import url("https://raw.codeberg.page/AllPurposeMat/Disblock-Origin/DisblockOrigin.theme.css"); + (machine.program { + name = "discord"; + inherit inputs; + requirements = [ "graphical" ]; + home-config = + { + config, + pkgs, + lib, + ... + }: + let + disableFeatures = [ + "WebRtcAllowInputVolumeAdjustment" + "ChromeWideEchoCancellation" + ]; + enableFeatures = [ ]; + commandLineArgs = + lib.optionals (enableFeatures != [ ]) [ + "--enable-features=${lib.concatStringsSep "," enableFeatures}" + ] + ++ lib.optionals (disableFeatures != [ ]) [ + "--disable-features=${lib.concatStringsSep "," disableFeatures}" + ]; + joinedArgs = lib.concatStringsSep " " commandLineArgs; + in + { + home.file."${config.xdg.configHome}/discord/settings.json".source = pkgs.writeText "settings.json" ( + lib.strings.toJSON ( + let + endpoint = "https://inject.shelter.uwu.network/shelter+yt_ad_block+yt_embed_fix"; + in + { + SKIP_HOST_UPDATE = true; + MINIMIZE_TO_TRAY = false; + OPEN_ON_STARTUP = false; + DANGEROUS_ENABLE_DEVTOOLS_ONLY_ENABLE_IF_YOU_KNOW_WHAT_YOURE_DOING = true; + enableHardwareAcceleration = true; + UPDATE_ENDPOINT = endpoint; + NEW_UPDATE_ENDPOINT = "${endpoint}/"; + BACKGROUND_COLOR = "#2c2d32"; - /* Hide the Visual Refresh title bar */ - .visual-refresh { - /* Hide the bar itself */ - --custom-app-top-bar-height: 0px !important; + openasar = { + setup = true; + # using the performance preset breaks vaapi + cmdPreset = "balanced"; + # quickstart is buggy and breaks discord sometimes. + quickstart = false; + # this css is made for discord compact mode. if you're not using that, stuff won't align!! + css = + # css + '' + /* Hide nitro begging */ + @import url("https://raw.codeberg.page/AllPurposeMat/Disblock-Origin/DisblockOrigin.theme.css"); - /* Title bar buttons are still visible so hide them too */ - div.base__5e434 > div.bar_c38106 { - display: none; + /* Hide the Visual Refresh title bar */ + .visual-refresh { + /* Hide the bar itself */ + --custom-app-top-bar-height: 0px !important; + + /* Title bar buttons are still visible so hide them too */ + div.base__5e434 > div.bar_c38106 { + display: none; + } + + /* Bring the server list down a few pixels */ + ul[data-list-id="guildsnav"] > div.itemsContainer_ef3116 { + margin-top: 8px; + } } - /* Bring the server list down a few pixels */ - ul[data-list-id="guildsnav"] > div.itemsContainer_ef3116 { - margin-top: 8px; + :root { + /* Disblock settings */ + --display-clan-tags: none; + --display-active-now: none; + --display-hover-reaction-emoji: none; + --bool-show-name-gradients: false; } - } - :root { - /* Disblock settings */ - --display-clan-tags: none; - --display-active-now: none; - --display-hover-reaction-emoji: none; - --bool-show-name-gradients: false; - } + /* Make "Read All" vencord button text smaller */ + button.vc-ranb-button { + font-size: 9.5pt; + font-weight: normal; + } - /* Make "Read All" vencord button text smaller */ - button.vc-ranb-button { - font-size: 9.5pt; - font-weight: normal; - } + /* Hide Discover button */ + div[data-list-item-id="guildsnav___guild-discover-button"] { + display: none !important; + } - /* Hide Discover button */ - div[data-list-item-id="guildsnav___guild-discover-button"] { - display: none !important; - } + /* Hide voice settings menus in user panel */ + div[class^="micButtonParent__"] button[role="switch"] { + border-radius: var(--radius-sm); + & ~ button { display: none; } + } + /* Also reduce the gap between the buttons */ + div.container__37e49 > div.buttons__37e49 { + gap: 1px; + } + ''; + }; + } + ) + ); - /* Hide voice settings menus in user panel */ - div[class^="micButtonParent__"] button[role="switch"] { - border-radius: var(--radius-sm); - & ~ button { display: none; } - } - /* Also reduce the gap between the buttons */ - div.container__37e49 > div.buttons__37e49 { - gap: 1px; - } - ''; - }; - } - ) - ); + home.packages = with pkgs; [ + (discord.override { + # we disable updates in settings.json + disableUpdates = false; + commandLineArgs = joinedArgs; + withTTS = false; + enableAutoscroll = true; + withOpenASAR = true; + }) + ]; + }; + }) - home.packages = with pkgs; [ - (discord.override { - # we disable updates in settings.json - disableUpdates = false; - commandLineArgs = joinedArgs; - withTTS = false; - enableAutoscroll = true; - withOpenASAR = true; - }) - ]; - }; - }; + (machine.program { + name = "fun-packages"; + inherit inputs; + requirements = [ "fun" ]; + home-config = + { pkgs, ... }: + { + home.packages = with pkgs; [ + custom.p1n3appl3.tab + prismlauncher + ]; + }; + }) - custom.program.fun-packages = machine.program { - requirements = [ "fun" ]; - home-config = - { pkgs, ... }: - { - home.packages = with pkgs; [ - custom.p1n3appl3.tab - prismlauncher - ]; - }; - }; + (machine.program { + name = "cli-packages"; + inherit inputs; + requirements = [ "cli" ]; + home-config = + { config, pkgs, ... }: + { + home.packages = with pkgs; [ + # general cli tools + sops + fzf + htop + ncdu + psmisc + ripgrep + rsync + zoxide + tmux + direnv + atuin + rcon + lix + nix-output-monitor + wget + comma + unzip + pciutils + difftastic - custom.program.cli-packages = machine.program { - requirements = [ "cli" ]; - home-config = - { config, pkgs, ... }: - { - home.packages = with pkgs; [ - # general cli tools - sops - fzf - htop - ncdu - psmisc - ripgrep - rsync - zoxide - tmux - direnv - atuin - rcon - lix - nix-output-monitor - wget - comma - unzip - pciutils - difftastic + # dev tools + gdb + clang-tools + rustup + git + python3 + unixtools.xxd + net-tools + sqlite-interactive + tokei + just + uv + llvmPackages.bintools - # dev tools - gdb - clang-tools - rustup - git - python3 - unixtools.xxd - net-tools - sqlite-interactive - tokei - just - uv - llvmPackages.bintools + (writeShellScriptBin "nas" '' + mkdir -p ~/Documents/nas + ${sshfs}/bin/sshfs fili:/storage/storage/data/ ~/Documents/nas + cd ~/Documents/nas + '') + ]; - (writeShellScriptBin "nas" '' - mkdir -p ~/Documents/nas - ${sshfs}/bin/sshfs fili:/storage/storage/data/ ~/Documents/nas - cd ~/Documents/nas - '') - ]; + # Set up direnv + programs.direnv = { + package = pkgs.direnv; + silent = false; + nix-direnv = { + enable = true; + package = pkgs.nix-direnv; + }; + }; - # Set up direnv - programs.direnv = { - package = pkgs.direnv; - silent = false; - nix-direnv = { - enable = true; - package = pkgs.nix-direnv; + home.file = { + "${config.xdg.configHome}/sqlite3/sqliterc".source = pkgs.writeText ".sqliterc" '' + .mode box + ''; }; }; - - home.file = { - "${config.xdg.configHome}/sqlite3/sqliterc".source = pkgs.writeText ".sqliterc" '' - .mode box - ''; - }; - }; - }; - + }) + ]; } diff --git a/programs/firefox/default.nix b/programs/firefox/default.nix index d59a55e..186fc2f 100644 --- a/programs/firefox/default.nix +++ b/programs/firefox/default.nix @@ -1,6 +1,8 @@ -{ machine, ... }: +inputs@{ machine, ... }: { - custom.program.firefox = machine.program { + imports = machine.program { + name = "firefox"; + inherit inputs; requirements = [ "graphical" ]; home-config = { diff --git a/programs/fish/default.nix b/programs/fish/default.nix index b7acb77..9e505d0 100644 --- a/programs/fish/default.nix +++ b/programs/fish/default.nix @@ -1,6 +1,8 @@ -{ machine, ... }: +inputs@{ machine, ... }: { - custom.program.fish = machine.program { + imports = machine.program { + name = "fish"; + inherit inputs; requirements = [ "cli" ]; home-config = { @@ -227,6 +229,7 @@ function fish_greeting ${pkgs.blahaj}/bin/blahaj -s + echo "welcome to $(uname -n), $(whoami)!" end ''; }; diff --git a/programs/git/default.nix b/programs/git/default.nix index 3de79e5..3ef0743 100644 --- a/programs/git/default.nix +++ b/programs/git/default.nix @@ -1,6 +1,8 @@ -{ machine, ... }: +inputs@{ machine, ... }: { - custom.program.git = machine.program { + imports = machine.program { + name = "git"; + inherit inputs; requirements = [ "cli" ]; home-config = _: { programs.git = { diff --git a/programs/jj/default.nix b/programs/jj/default.nix index 0a3aa54..18c1e79 100644 --- a/programs/jj/default.nix +++ b/programs/jj/default.nix @@ -1,6 +1,8 @@ -{ machine, ... }: +inputs@{ machine, ... }: { - custom.program.jujutsu = machine.program { + imports = machine.program { + name = "jujutsu"; + inherit inputs; requirements = [ "cli" ]; home-config = { config, pkgs, ... }: diff --git a/programs/kanata/default.nix b/programs/kanata/default.nix index 0794676..7b9b465 100644 --- a/programs/kanata/default.nix +++ b/programs/kanata/default.nix @@ -1,4 +1,4 @@ -{ machine, pkgs, ... }: +inputs@{ machine, pkgs, ... }: let kanata-config = '' (defcfg @@ -86,7 +86,9 @@ let ''; in { - custom.program.kanata = machine.program { + imports = machine.program { + name = "kanata"; + inherit inputs; requirements = [ "graphical" ]; home-config = { pkgs, ... }: diff --git a/programs/kitty/default.nix b/programs/kitty/default.nix index 78651ba..9f37d8f 100644 --- a/programs/kitty/default.nix +++ b/programs/kitty/default.nix @@ -1,6 +1,8 @@ -{ machine, ... }: +inputs@{ machine, ... }: { - custom.program.kitty = machine.program { + imports = machine.program { + name = "kitty"; + inherit inputs; requirements = [ "graphical" ]; home-config = { pkgs, flakes, ... }: diff --git a/programs/niri/default.nix b/programs/niri/default.nix index d36528e..087f962 100644 --- a/programs/niri/default.nix +++ b/programs/niri/default.nix @@ -1,14 +1,15 @@ -{ machine, ... }: +inputs@{ machine, ... }: { - custom.program.niri = machine.program { + imports = machine.program { + name = "niri"; + inherit inputs; requirements = [ "graphical" ]; home-config = - { - config, - pkgs, - flakes, - lib, - ... + { config + , pkgs + , flakes + , lib + , ... }: let noctalia = @@ -241,7 +242,7 @@ } { - matches = [ { app-id = "firefox"; } ]; + matches = [{ app-id = "firefox"; }]; open-on-workspace = "browser"; } @@ -599,7 +600,7 @@ id = "Volume"; } ] - ++ [ { id = "Battery"; } ] + ++ [{ id = "Battery"; }] ++ [ { id = "KeyboardLayout"; diff --git a/programs/nvim/default.nix b/programs/nvim/default.nix index 8f850b2..915b743 100644 --- a/programs/nvim/default.nix +++ b/programs/nvim/default.nix @@ -1,6 +1,8 @@ -{ machine, ... }: +inputs@{ machine, ... }: { - custom.program.nvim = machine.program { + imports = machine.program { + name = "nvim"; + inherit inputs; requirements = [ "cli" ]; home-config = { diff --git a/programs/tmux/default.nix b/programs/tmux/default.nix index d00d05a..2154216 100644 --- a/programs/tmux/default.nix +++ b/programs/tmux/default.nix @@ -1,6 +1,8 @@ -{ machine, ... }: +inputs@{ machine, ... }: { - custom.program.tmux = machine.program { + imports = machine.program { + name = "tmux"; + inherit inputs; requirements = [ "cli" ]; home-config = { pkgs, ... }: diff --git a/defaults/xdg.nix b/programs/xdg.nix similarity index 91% rename from defaults/xdg.nix rename to programs/xdg.nix index 7339c2a..0fad6fa 100644 --- a/defaults/xdg.nix +++ b/programs/xdg.nix @@ -1,4 +1,4 @@ -{ ... }@inputs: +{ machine, ... }@inputs: let browsers = [ "firefox.desktop" @@ -117,7 +117,10 @@ let }; in { - custom.program.homedirs = { + imports = machine.program { + name = "xdg"; + inherit inputs; + requirements = [ ]; home-config = { config, ... }: { @@ -142,15 +145,15 @@ in }; }; }; - }; - - xdg = { - mime = { - enable = true; - defaultApplications = associations; - addedAssociations = associations; - inherit removedAssociations; + system-config = _: { + xdg = { + mime = { + enable = true; + defaultApplications = associations; + addedAssociations = associations; + inherit removedAssociations; + }; + }; }; }; - } diff --git a/programs/zed/default.nix b/programs/zed/default.nix index d47f4ca..0686ffa 100644 --- a/programs/zed/default.nix +++ b/programs/zed/default.nix @@ -1,6 +1,8 @@ -{ machine, ... }: +inputs@{ machine, ... }: { - custom.program.zed = machine.program { + imports = machine.program { + name = "zed"; + inherit inputs; requirements = [ "work" "graphical"