From cb72b4766101431906ffde56c312c245c9beef32 Mon Sep 17 00:00:00 2001 From: atagen Date: Wed, 25 Feb 2026 21:30:31 +1100 Subject: [PATCH] clean up 'scope' decl --- common/binfmts.nix | 2 +- common/editor-theme.nix | 1 - common/editor.nix | 1 - common/nix/nixpkgs.nix | 1 - common/nix/substituters.nix | 1 - common/nix/tools.nix | 14 ++-- common/systemd.nix | 2 +- flake.lock | 111 +++++++++++---------------- graphical/binds.nix | 1 - graphical/boot.nix | 1 - graphical/browser.nix | 144 +++++++++++++---------------------- graphical/desktop/niri.kdl | 10 +++ graphical/desktop/wm.nix | 9 ++- graphical/dev.nix | 1 - graphical/documents.nix | 1 - graphical/fm.nix | 1 - graphical/gfx-env.nix | 2 +- graphical/hw.nix | 2 +- graphical/llm.nix | 6 +- graphical/media.nix | 1 - graphical/quick-services.nix | 1 - graphical/startup.nix | 1 - graphical/sync.nix | 2 +- graphical/terminal.nix | 1 - graphical/webapps.nix | 132 ++++++++++++++++++++++++++++++++ hosts/adrift/boot.nix | 2 +- hosts/quiver/boot.nix | 1 - lib/create.nix | 4 +- 28 files changed, 261 insertions(+), 195 deletions(-) create mode 100644 graphical/webapps.nix diff --git a/common/binfmts.nix b/common/binfmts.nix index 116225e..640b65e 100644 --- a/common/binfmts.nix +++ b/common/binfmts.nix @@ -1 +1 @@ -{ inputs, scope, ... }: scope "imports" <| [ inputs.qstn.nixosModules.default ] +{ inputs, ... }: scope "imports" <| [ inputs.qstn.nixosModules.default ] diff --git a/common/editor-theme.nix b/common/editor-theme.nix index e6f4c8e..8377070 100644 --- a/common/editor-theme.nix +++ b/common/editor-theme.nix @@ -1,6 +1,5 @@ { config, - scope, ... }: with config.rice.palette.hex; diff --git a/common/editor.nix b/common/editor.nix index 14d0ee0..77bcb56 100644 --- a/common/editor.nix +++ b/common/editor.nix @@ -1,5 +1,4 @@ { - scope, ... }: scope "user.programs.helix" { diff --git a/common/nix/nixpkgs.nix b/common/nix/nixpkgs.nix index 4506b9a..6fecf22 100644 --- a/common/nix/nixpkgs.nix +++ b/common/nix/nixpkgs.nix @@ -1,7 +1,6 @@ { inputs, lib, - scope, ... }: scope "nixpkgs" { diff --git a/common/nix/substituters.nix b/common/nix/substituters.nix index 0848249..9ccde0e 100644 --- a/common/nix/substituters.nix +++ b/common/nix/substituters.nix @@ -1,5 +1,4 @@ { - scope, ... }: scope "nix.settings" { diff --git a/common/nix/tools.nix b/common/nix/tools.nix index e9c269c..776148a 100644 --- a/common/nix/tools.nix +++ b/common/nix/tools.nix @@ -1,19 +1,15 @@ { pkgs, inputs, - getPkgs, getFlakePkg, ... }: { - environment.systemPackages = - getPkgs { - inherit (pkgs) - nixfmt - nil - ; - } - ++ [ (getFlakePkg inputs.yoke) ]; + environment.systemPackages = [ + pkgs.nixfmt + (getFlakePkg inputs.yoke) + (getFlakePkg inputs.nil) + ]; imports = [ inputs.nix-index-database.nixosModules.nix-index ]; diff --git a/common/systemd.nix b/common/systemd.nix index eeb770e..67a768a 100644 --- a/common/systemd.nix +++ b/common/systemd.nix @@ -1,4 +1,4 @@ -{ scope, ... }: +{ ... }: scope "systemd" { services."user@".serviceConfig.Delegate = "memory pids cpu cpuset"; user.extraConfig = "LogLevel=debug"; diff --git a/flake.lock b/flake.lock index 468bdec..48a8c07 100644 --- a/flake.lock +++ b/flake.lock @@ -414,11 +414,11 @@ "rev": "588ff16cb8855e02c84fdbe32b577c6421f704d1", "revCount": 2, "type": "git", - "url": "https://git.lobotomise.me/atagen/hudcore-plymouth.git" + "url": "https://git.lobotomise.me/atagen/hudcore-plymouth" }, "original": { "type": "git", - "url": "https://git.lobotomise.me/atagen/hudcore-plymouth.git" + "url": "https://git.lobotomise.me/atagen/hudcore-plymouth" } }, "kitty-themes-src": { @@ -437,21 +437,6 @@ "type": "github" } }, - "madness": { - "locked": { - "lastModified": 1771986427, - "narHash": "sha256-xxNj8NWE/Y89yKGq/mmyAVVx5ru6JVaHUoegJuSP2Y0=", - "owner": "amaanq", - "repo": "madness", - "rev": "469f0babe98e15a19f9d1910ffab68ddc3c6da1b", - "type": "github" - }, - "original": { - "owner": "amaanq", - "repo": "madness", - "type": "github" - } - }, "meat": { "inputs": { "nix-systems": "nix-systems_2", @@ -530,6 +515,26 @@ "type": "github" } }, + "nil": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1772014815, + "narHash": "sha256-er96DK9KxsSU2RE3jCvZNquvby8YzMBEygPuznZvnn8=", + "owner": "atagen", + "repo": "nil", + "rev": "f5dc3f3239f64904d901a537bd88bafe5735aa0a", + "type": "github" + }, + "original": { + "owner": "atagen", + "repo": "nil", + "type": "github" + } + }, "niri": { "inputs": { "niri-stable": "niri-stable", @@ -593,11 +598,11 @@ "systems": "systems_4" }, "locked": { - "lastModified": 1769059921, - "narHash": "sha256-/crneSsO81LVDzRMRDezpxu55a9Wxjl2HUlofB9HzKs=", + "lastModified": 1772007793, + "narHash": "sha256-XqOZiW/xf15xPV/kuA+FK1lNVGqwWITjPkH5t67y2eg=", "ref": "refs/heads/main", - "rev": "30662edfe8bac80b356324e642a188f505429d80", - "revCount": 41, + "rev": "db66162b3f3b59c833dcbc853c65db2d47881795", + "revCount": 43, "type": "git", "url": "https://git.lobotomise.me/atagen/niri-tag" }, @@ -744,13 +749,15 @@ }, "nix-scope-plugin": { "inputs": { - "nixpkgs": "nixpkgs_15" + "nixpkgs": [ + "nixpkgs" + ] }, "locked": { - "lastModified": 1771982298, - "narHash": "sha256-SAkUPZEbxBLggrQLp8B86r2pVhMgP9A4NiQwGJMcG2o=", + "lastModified": 1772011628, + "narHash": "sha256-rhpsfs+/9zVr3HVqniwHyRSr92ga4J4mczFdHr1PN4s=", "ref": "refs/heads/main", - "rev": "866bf279aad012b2b3d02cdc9ec47ff76285371c", + "rev": "0e5218513ec92ee751e7a0dc854082106b77473c", "revCount": 1, "type": "git", "url": "https://git.lobotomise.me/atagen/nix-scope-plugin" @@ -762,7 +769,9 @@ }, "nix-shorturl-plugin": { "inputs": { - "nixpkgs": "nixpkgs_16" + "nixpkgs": [ + "nixpkgs" + ] }, "locked": { "lastModified": 1771986085, @@ -981,38 +990,6 @@ } }, "nixpkgs_15": { - "locked": { - "lastModified": 1771923393, - "narHash": "sha256-Fy0+UXELv9hOE8WjYhJt8fMDLYTU2Dqn3cX4BwoGBos=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "ea7f1f06811ce7fcc81d6c6fd4213150c23edcf2", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixpkgs-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs_16": { - "locked": { - "lastModified": 1771848320, - "narHash": "sha256-0MAd+0mun3K/Ns8JATeHT1sX28faLII5hVLq0L3BdZU=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "2fc6539b481e1d2569f25f8799236694180c0993", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs_17": { "locked": { "lastModified": 1771008912, "narHash": "sha256-gf2AmWVTs8lEq7z/3ZAsgnZDhWIckkb+ZnAo5RzSxJg=", @@ -1028,7 +1005,7 @@ "type": "github" } }, - "nixpkgs_18": { + "nixpkgs_16": { "locked": { "lastModified": 1769018530, "narHash": "sha256-MJ27Cy2NtBEV5tsK+YraYr2g851f3Fl1LpNHDzDX15c=", @@ -1044,7 +1021,7 @@ "type": "github" } }, - "nixpkgs_19": { + "nixpkgs_17": { "locked": { "lastModified": 1761656231, "narHash": "sha256-EiED5k6gXTWoAIS8yQqi5mAX6ojnzpHwAQTS3ykeYMg=", @@ -1220,8 +1197,8 @@ "hjem": "hjem", "hjem-rum": "hjem-rum", "hudcore": "hudcore", - "madness": "madness", "meat": "meat", + "nil": "nil", "niri": "niri", "niri-s76": "niri-s76", "niri-tag": "niri-tag", @@ -1229,7 +1206,7 @@ "nix-rice": "nix-rice", "nix-scope-plugin": "nix-scope-plugin", "nix-shorturl-plugin": "nix-shorturl-plugin", - "nixpkgs": "nixpkgs_17", + "nixpkgs": "nixpkgs_15", "nixpkgs-stable": "nixpkgs-stable_2", "qstn": "qstn", "run0-shim": "run0-shim", @@ -1415,14 +1392,14 @@ "stasis": { "inputs": { "flake-parts": "flake-parts_4", - "nixpkgs": "nixpkgs_18" + "nixpkgs": "nixpkgs_16" }, "locked": { - "lastModified": 1771888610, - "narHash": "sha256-voL/6XnosTSEUMovarrBhRbYXXY+B7nVW29i8rO40L0=", + "lastModified": 1771992007, + "narHash": "sha256-8EmxW16fext1vjZavb5GfeOCIbytRZ4/qc5VzFZfd3w=", "owner": "saltnpepper97", "repo": "stasis", - "rev": "3582124d8d216bff8206bb922eda28e8438e72f3", + "rev": "ebaa70f5f4773ea2dbd2535897447e643777a247", "type": "github" }, "original": { @@ -1653,7 +1630,7 @@ }, "yoke": { "inputs": { - "nixpkgs": "nixpkgs_19", + "nixpkgs": "nixpkgs_17", "systems": "systems_7" }, "locked": { diff --git a/graphical/binds.nix b/graphical/binds.nix index 7db2028..bcf478b 100644 --- a/graphical/binds.nix +++ b/graphical/binds.nix @@ -1,7 +1,6 @@ { lib, config, - scope, ... }: let diff --git a/graphical/boot.nix b/graphical/boot.nix index 0571183..05048c8 100644 --- a/graphical/boot.nix +++ b/graphical/boot.nix @@ -1,6 +1,5 @@ { config, - scope, machineName, mainUser, ... diff --git a/graphical/browser.nix b/graphical/browser.nix index 0f55515..c8d0e7f 100644 --- a/graphical/browser.nix +++ b/graphical/browser.nix @@ -1,98 +1,60 @@ { lib, pkgs, - scope, inputs, getFlakePkg, ... }: -scope "apps.browser" <| getFlakePkg inputs.helium -# let -# officialAddon = name: { -# install_url = lib.strings.concatStrings [ -# "https://addons.mozilla.org/firefox/downloads/latest/" -# name -# "/latest.xpi" -# ]; -# installation_mode = "force_installed"; -# }; -# lock-false = { -# Value = false; -# Status = "locked"; -# }; -# lock-true = { -# Value = true; -# Status = "locked"; -# }; -# in -# scope "programs.firefox" { -# enable = true; - -# policies = { -# DisableTelemetry = true; -# DisableFirefoxStudies = true; -# EnableTrackingProtection = { -# Value = true; -# Locked = true; -# Cryptomining = true; -# Fingerprinting = true; -# }; -# DisablePocket = true; -# DisableFirefoxAccounts = true; -# DisableAccounts = true; -# DisableFirefoxScreenshots = true; -# DisableAppUpdate = true; -# DisablePrivateBrowsing = true; -# DontCheckDefaultBrowser = true; - -# OverrideFirstRunPage = ""; -# OverridePostUpdatePage = ""; -# DisplayBookmarksToolbar = "newtab"; # alternatives: "always" or "newtab" -# DisplayMenuBar = "default-off"; # alternatives: "always", "never" or "default-on" -# SearchBar = "unified"; # alternative: "separate" - -# ExtensionSettings = { -# "*".installation_mode = "blocked"; # blocks all addons except the ones specified below -# "uBlock0@raymondhill.net" = officialAddon "ublock-origin"; -# "addon@darkreader.org" = officialAddon "darkreader"; -# "vimium-c@gdh1995.cn" = officialAddon "vimium-c"; -# "{b86e4813-687a-43e6-ab65-0bde4ab75758}" = officialAddon "localcdn-fork-of-decentraleyes"; -# "jid1-5Fs7iTLscUaZBgwr@jetpack" = officialAddon "happy-bonobo-disable-webrtc"; -# "{446900e4-71c2-419f-a6a7-df9c091e268b}" = officialAddon "bitwarden-password-mananger"; -# }; - -# Preferences = { -# "extensions.pocket.enabled" = lock-false; -# "extensions.screenshots.disabled" = lock-true; -# "browser.topsites.contile.enabled" = lock-false; -# "browser.formfill.enable" = lock-false; -# "browser.search.suggest.enabled" = lock-false; -# "browser.search.suggest.enabled.private" = lock-false; -# "browser.urlbar.suggest.searches" = lock-false; -# "browser.urlbar.showSearchSuggestionsFirst" = lock-false; -# "browser.newtabpage.activity-stream.feeds.section.topstories" = lock-false; -# "browser.newtabpage.activity-stream.feeds.snippets" = lock-false; -# "browser.newtabpage.activity-stream.section.highlights.includePocket" = lock-false; -# "browser.newtabpage.activity-stream.section.highlights.includeBookmarks" = lock-false; -# "browser.newtabpage.activity-stream.section.highlights.includeDownloads" = lock-false; -# "browser.newtabpage.activity-stream.section.highlights.includeVisited" = lock-false; -# "browser.newtabpage.activity-stream.showSponsored" = lock-false; -# "browser.newtabpage.activity-stream.system.showSponsored" = lock-false; -# "browser.newtabpage.activity-stream.showSponsoredTopSites" = lock-false; -# }; -# }; - -# # profiles.default = { -# # id = 0; -# # name = "Default"; -# # settings = { -# # "browser.startup.homepage" = "about:blank"; -# # "browser.shell.didSkipDefaultBrowserCheckOnFirstRun" = true; -# # "browser.policies.applied" = true; -# # "widget.use-xdg-desktop-portal.file-picker" = 1; -# # "widget.use-xdg-desktop-portal.mime-handler" = 1; -# # }; -# # }; -# } -# // (scope "apps.browser" <| pkgs.firefox) -# TODO switch to helium +let + extensions = { + adnauseam = { + id = "dlkmkipjfgcmnfckfdflcemkhlfbeiak"; + updateUrl = "https://gist.githubusercontent.com/amaanq/791db15b547cf00d27c99e784bbe0459/raw/adnauseam-updates.xml"; + }; + bypass-paywalls = { + id = "lkbebcjgcmobigpeffafkodonchffocl"; + updateUrl = "https://gitflic.ru/project/magnolia1234/bpc_updates/blob/raw?file=updates.xml"; + }; + vencord = { + id = "jfcaohdhgnfchhifdffmldmodkmndfjp"; + updateUrl = "https://github.com/amaanq/Vencord/releases/latest/download/updates.xml"; + }; + bitwarden.id = "nngceckbapebfimnlniiiahkandclblb"; + clearurls.id = "lckanjgmijmafbedllaakclkaicjfmnk"; + dark-reader.id = "eimadpbcbfnmbkopoojfekhnkhdbieeh"; + i-still-dont-care-about-cookies.id = "edibdbjcniadpccecjdfdjjppcpchdlm"; + fastforward.id = "icallnadddjmdinamnolclfjanhfoafe"; + refined-github.id = "hlepfoohegkhhmjieoechaddaejaokhf"; + sponsorblock.id = "mnjggcdmjocbbbhaepdhchncahnbgone"; + vimium-c.id = "hfjbmagddngcpeloejdejnfgbamkjaeg"; + web-archives.id = "hkligngkgcpcolhcnkgccglchdafcnao"; + # webrtc-leak-shield.id = "bppamachkoflopbagkdoflbgfjflfnfl"; + }; + extensionStrings = map ( + key: + let + ext = extensions.${key}; + url = ext.updateUrl or "https://services.helium.imput.net/ext"; + in + "${ext.id};${url}" + ) (builtins.attrNames extensions); +in +(scope "apps.browser" <| getFlakePkg inputs.helium) +// scope "programs.chromium" { + enable = true; + extensions = extensionStrings; + extraOpts = { + PrivacySandboxFingerprintingProtectionEnabled = true; + PrivacySandboxIpProtectionEnabled = true; + # Explicitly allow our extensions + ExtensionInstallAllowlist = map (entry: entry.value.id) (lib.attrsToList extensions); + # Allow extensions from Helium proxy and self-hosted sources + ExtensionInstallSources = [ + "https://services.helium.imput.net/*" # Helium proxy + "https://rednoise.org/*" # AdNauseam manifest + "https://github.com/*" # AdNauseam CRX host + "https://*.githubusercontent.com/*" # GitHub release assets + "https://gitflic.ru/*" # Bypass Paywalls + ]; + }; +} diff --git a/graphical/desktop/niri.kdl b/graphical/desktop/niri.kdl index ab1f9f6..5b0de95 100644 --- a/graphical/desktop/niri.kdl +++ b/graphical/desktop/niri.kdl @@ -54,3 +54,13 @@ window-rule { } xwayland-satellite { path "%SATELLITE%"; } spawn-at-startup "systemctl" "--user" "start" "startup-sound.service" +window-rule { + match app-id="Bitwarden" + open-floating true + default-column-width { proportion 0.16667; } +} +window-rule { + match app-id="feishin" + open-floating true + default-column-width { proportion 0.16667; } +} diff --git a/graphical/desktop/wm.nix b/graphical/desktop/wm.nix index 89321e0..9afb65e 100644 --- a/graphical/desktop/wm.nix +++ b/graphical/desktop/wm.nix @@ -78,10 +78,11 @@ in services.niri-tag = { enable = true; - # scratchpads = { - # "${config.apps.streamPlayer}" = 99; - # "${config.apps.passwordManager}" = 101; - # }; + scratchpads = { + # TODO FIXME these could use the getExe ? + "feishin" = 99; + "Bitwarden" = 101; + }; }; services.niri-s76-bridge.enable = true; diff --git a/graphical/dev.nix b/graphical/dev.nix index 0f12b7c..d2e7101 100644 --- a/graphical/dev.nix +++ b/graphical/dev.nix @@ -1,7 +1,6 @@ { inputs, localPkgs, - scope, getFlakePkg', ... }: diff --git a/graphical/documents.nix b/graphical/documents.nix index 31f2f88..3528a5e 100644 --- a/graphical/documents.nix +++ b/graphical/documents.nix @@ -1,6 +1,5 @@ { pkgs, - scope, ... }: with pkgs; diff --git a/graphical/fm.nix b/graphical/fm.nix index f3aa4b7..f53867c 100644 --- a/graphical/fm.nix +++ b/graphical/fm.nix @@ -1,6 +1,5 @@ { pkgs, - scope, ... }: with pkgs.mate; diff --git a/graphical/gfx-env.nix b/graphical/gfx-env.nix index bd278eb..a70e6cf 100644 --- a/graphical/gfx-env.nix +++ b/graphical/gfx-env.nix @@ -1,4 +1,4 @@ -{ scope, ... }: +{ ... }: scope "environment.sessionVariables" { NIXOS_OZONE_WL = "1"; GBM_BACKEND = "nvidia-drm"; diff --git a/graphical/hw.nix b/graphical/hw.nix index 76b5b0f..bff93ca 100644 --- a/graphical/hw.nix +++ b/graphical/hw.nix @@ -1,4 +1,4 @@ -{ scope, ... }: +{ ... }: scope "hardware" { enableRedistributableFirmware = true; enableAllFirmware = true; diff --git a/graphical/llm.nix b/graphical/llm.nix index be95370..70cbd84 100644 --- a/graphical/llm.nix +++ b/graphical/llm.nix @@ -2,7 +2,6 @@ pkgs, lib, inputs, - scope, ... }: let @@ -137,5 +136,8 @@ in (scope "apps.slopcode" <| claude-code) // { # required for loaderslop - programs.nix-ld.enable = true; + programs.nix-ld = { + enable = true; + libraries = [ pkgs.stdenv.cc.cc.lib ]; + }; } diff --git a/graphical/media.nix b/graphical/media.nix index 8fc2d40..ac41b6e 100644 --- a/graphical/media.nix +++ b/graphical/media.nix @@ -1,6 +1,5 @@ { pkgs, - scope, ... }: with pkgs; diff --git a/graphical/quick-services.nix b/graphical/quick-services.nix index 4342095..061a867 100644 --- a/graphical/quick-services.nix +++ b/graphical/quick-services.nix @@ -2,7 +2,6 @@ config, lib, mainUser, - scope, ... }: scope "options.quick" { diff --git a/graphical/startup.nix b/graphical/startup.nix index f53daf3..a42e17e 100644 --- a/graphical/startup.nix +++ b/graphical/startup.nix @@ -1,7 +1,6 @@ { pkgs, lib, - scope, ... }: scope "user.systemd.services.startup-sound" diff --git a/graphical/sync.nix b/graphical/sync.nix index a1e2ece..403e6be 100644 --- a/graphical/sync.nix +++ b/graphical/sync.nix @@ -1 +1 @@ -{ scope, ... }: scope "services.syncthing.enable" <| true +{ ... }: scope "services.syncthing.enable" <| true diff --git a/graphical/terminal.nix b/graphical/terminal.nix index 50bb5d5..dccdd61 100644 --- a/graphical/terminal.nix +++ b/graphical/terminal.nix @@ -1,7 +1,6 @@ { pkgs, config, - scope, ... }: (scope "apps.terminal" <| pkgs.foot) diff --git a/graphical/webapps.nix b/graphical/webapps.nix new file mode 100644 index 0000000..4ea0c1e --- /dev/null +++ b/graphical/webapps.nix @@ -0,0 +1,132 @@ +{ + config, + lib, + pkgs, + ... +}: +let + inherit (lib) mkIf; + browser = lib.getExe config.apps.browser; + webAppLauncher = pkgs.writeShellScript "web-app-launcher" '' + browser="${browser}" + + browser_exec="" + for path in ~/.local ~/.nix-profile /usr; do + if [ -f "$path/share/applications/$browser.desktop" ]; then + browser_exec=$(sed -n 's/^Exec=\([^ ]*\).*/\1/p' "$path/share/applications/$browser.desktop" 2>/dev/null | head -1) + break + fi + done + + if [ -z "$browser_exec" ]; then + browser_exec="${browser}" + fi + + url="$1" + app_name="''${2:-$(basename "$0")}" + shift 2 + + exec setsid "$browser_exec" \ + --app="$url" \ + --user-data-dir="$HOME/.local/share/web-apps/$app_name" \ + --no-first-run \ + --no-default-browser-check \ + --disable-background-timer-throttling \ + --disable-backgrounding-occluded-windows \ + --disable-renderer-backgrounding \ + --enable-quic \ + --quic-version=h3-29 \ + --enable-features=UseOzonePlatform,WaylandWindowDecorations,WaylandPerWindowScaling,WaylandTextInputV3,WebRTCPipeWireCapturer \ + --disable-features=WebRtcAllowInputVolumeAdjustment \ + --ozone-platform=wayland \ + --gtk-version=4 \ + --enable-experimental-web-platform-features \ + "$@" + ''; + + # Create web app package + createWebApp = + { + name, + url, + icon, + description ? "", + categories ? [ + "Network" + "Chat" + "InstantMessaging" + ], + }: + let + pkgName = "${lib.replaceStrings [ " " ] [ "-" ] (lib.toLower name)}-web-app"; + in + { + name = pkgName; + value = pkgs.stdenv.mkDerivation { + pname = pkgName; + version = "1.0"; + dontUnpack = true; + + nativeBuildInputs = [ + pkgs.copyDesktopItems + pkgs.makeWrapper + ]; + + installPhase = '' + runHook preInstall + makeWrapper ${webAppLauncher} $out/bin/${pkgName} \ + --add-flags "${url}" \ + --add-flags "${pkgName}" + runHook postInstall + ''; + + desktopItems = [ + (pkgs.makeDesktopItem { + inherit icon categories; + name = pkgName; + exec = "${pkgName} %U"; + desktopName = name; + comment = description; + startupNotify = true; + startupWMClass = pkgName; + }) + ]; + }; + }; + + apps = builtins.listToAttrs ( + map createWebApp [ + { + name = "Cinny"; + url = "https://chat.lobotomise.me"; + icon = "cinny"; + description = "Cinny, a Matrix client"; + } + { + name = "Discord"; + url = "https://discord.com/app"; + icon = "discord"; + description = "Discord Web"; + } + { + name = "FB Messenger"; + url = "https://m.me"; + icon = "facebook"; + description = "Facebook Messenger"; + } + ] + ); +in +{ + config = { + environment.systemPackages = builtins.attrValues apps; + + xdg.mime.defaultApplications = { + "x-scheme-handler/matrix" = "cinny-web-app.desktop"; + }; + + environment.etc."web-apps-setup".text = '' + mkdir -p /home/*/.local/share/web-apps + ''; + }; +} diff --git a/hosts/adrift/boot.nix b/hosts/adrift/boot.nix index 2e3210d..b6a8412 100644 --- a/hosts/adrift/boot.nix +++ b/hosts/adrift/boot.nix @@ -1,4 +1,4 @@ -{ scope, ... }: +{ ... }: scope "boot" { kernelParams = [ "mitigations=off" diff --git a/hosts/quiver/boot.nix b/hosts/quiver/boot.nix index 9280201..59bcc29 100644 --- a/hosts/quiver/boot.nix +++ b/hosts/quiver/boot.nix @@ -1,5 +1,4 @@ { - scope, ... }: scope "boot" { diff --git a/lib/create.nix b/lib/create.nix index 7f77d3c..73880dc 100644 --- a/lib/create.nix +++ b/lib/create.nix @@ -16,7 +16,7 @@ in inherit (inputs.nixpkgs.legacyPackages.${info.system}) callPackage; directory = ../pkgs; }; - scope = import ./scope.nix { inherit lib; }; + # scope = import ./scope.nix { inherit lib; }; mainUser = info.username; machineName = name; getPkgs = builtins.attrValues; @@ -29,7 +29,7 @@ in inputs.arbys.nixosModules.arbys inputs.hjem.nixosModules.hjem ( - { scope, ... }: + { ... }: scope "hjem" { users.${info.username}.enable = true; extraModules = [