1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-11-26 21:19:45 +01:00

Merge branch 'nix-community:master' into master

This commit is contained in:
Nabeen Tiwaree 2024-10-11 14:19:53 -04:00 committed by GitHub
commit b5a67d9032
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
50 changed files with 702 additions and 267 deletions

View file

@ -11,7 +11,7 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v27
- uses: cachix/install-nix-action@v30
with:
nix_path: nixpkgs=channel:nixos-unstable
- uses: cachix/cachix-action@v15

View file

@ -12,7 +12,7 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v27
- uses: cachix/install-nix-action@v30
with:
nix_path: nixpkgs=channel:nixos-unstable
- run: |

View file

@ -12,7 +12,7 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Nix
uses: cachix/install-nix-action@v27
uses: cachix/install-nix-action@v30
- name: Update flake.lock
uses: DeterminateSystems/update-flake-lock@v24
with:

View file

@ -59,5 +59,7 @@ in stdenv.mkDerivation {
echo "doc manual $dest index.html" >> $out/nix-support/hydra-build-products
'';
passthru = { inherit home-manager-options; };
meta = { maintainers = [ lib.maintainers.considerate ]; };
}

View file

@ -2,11 +2,11 @@
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1726937504,
"narHash": "sha256-bvGoiQBvponpZh8ClUcmJ6QnsNKw0EMrCQJARK3bI1c=",
"lastModified": 1728241625,
"narHash": "sha256-yumd4fBc/hi8a9QgA9IT8vlQuLZ2oqhkJXHPKxH/tRw=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "9357f4f23713673f310988025d9dc261c20e70c6",
"rev": "c31898adf5a8ed202ce5bea9f347b1c6871f32d1",
"type": "github"
},
"original": {

View file

@ -8,8 +8,8 @@ msgstr ""
"Project-Id-Version: Home Manager\n"
"Report-Msgid-Bugs-To: https://github.com/nix-community/home-manager/issues\n"
"POT-Creation-Date: 2024-04-17 23:19+0200\n"
"PO-Revision-Date: 2024-09-13 03:09+0000\n"
"Last-Translator: Jay Thomas <jay@gfax.ch>\n"
"PO-Revision-Date: 2024-10-09 14:31+0000\n"
"Last-Translator: Utkarsh Sharma <utkasharma19@gmail.com>\n"
"Language-Team: Hindi <https://hosted.weblate.org/projects/home-manager/cli/"
"hi/>\n"
"Language: hi\n"
@ -22,11 +22,11 @@ msgstr ""
#. translators: For example: "home-manager: missing argument for --cores"
#: home-manager/home-manager:16
msgid "%s: missing argument for %s"
msgstr ""
msgstr "%s: %s के लिए कोई आर्ग्यूमेंट नहीं दिया"
#: home-manager/home-manager:64
msgid "No configuration file found at %s"
msgstr ""
msgstr "%s में कोई कन्फि़गरेशन फाइल नहीं मिली"
#. translators: The first '%s' specifier will be replaced by either
#. 'home.nix' or 'flake.nix'.

View file

@ -7,6 +7,12 @@
# [1] https://github.com/NixOS/nixpkgs/blob/fca0d6e093c82b31103dc0dacc48da2a9b06e24b/maintainers/maintainer-list.nix#LC1
{
aabccd021 = {
name = "Muhamad Abdurahman";
email = "aabccd021@gmail.com";
github = "aabccd021";
githubId = 33031950;
};
abayomi185 = {
name = "Yomi";
email = "yomi+nix@yomitosh.com";

View file

@ -1748,6 +1748,28 @@ in {
add `-w` to your assignment of `services.swayidle.extraArgs`.
'';
}
{
time = "2024-10-09T06:16:23+00:00";
condition = hostPlatform.isLinux;
message = ''
A new module is available: 'services.snixembed'.
snixembed proxies StatusNotifierItems as XEmbedded systemtray-spec
icons. This is useful for some tools in some environments, e.g., Safe
Eyes in i3, lxde or mate.
'';
}
{
time = "2024-10-11T08:23:19+00:00";
message = ''
A new module is available: 'programs.vifm'.
Vifm is a curses based Vim-like file manager extended with some useful
ideas from mutt.
'';
}
];
};
}

View file

@ -5,10 +5,12 @@ with lib;
let
cfg = config.xdg.mime;
inherit (lib) getExe getExe';
in {
options = {
xdg.mime.enable = mkOption {
xdg.mime = {
enable = mkOption {
type = types.bool;
default = pkgs.stdenv.hostPlatform.isLinux;
defaultText =
@ -23,15 +25,30 @@ in {
respectively.
'';
};
sharedMimeInfoPackage = mkOption {
type = types.package;
default = pkgs.shared-mime-info;
defaultText = literalExpression "pkgs.shared-mime-info";
description = "The package to use when running update-mime-database.";
};
config = mkIf config.xdg.mime.enable {
desktopFileUtilsPackage = mkOption {
type = types.package;
default = pkgs.desktop-file-utils;
defaultText = literalExpression "pkgs.desktop-file-utils";
description =
"The package to use when running update-desktop-database.";
};
};
};
config = mkIf cfg.enable {
assertions =
[ (hm.assertions.assertPlatform "xdg.mime" pkgs platforms.linux) ];
home.packages = [
# Explicitly install package to provide basic mime types.
pkgs.shared-mime-info
cfg.sharedMimeInfoPackage
# Make sure the target directories will be real directories.
(pkgs.runCommandLocal "dummy-xdg-mime-dirs1" { } ''
@ -46,12 +63,12 @@ in {
if [[ -w $out/share/mime && -w $out/share/mime/packages && -d $out/share/mime/packages ]]; then
XDG_DATA_DIRS=$out/share \
PKGSYSTEM_ENABLE_FSYNC=0 \
${pkgs.buildPackages.shared-mime-info}/bin/update-mime-database \
${getExe cfg.sharedMimeInfoPackage} \
-V $out/share/mime > /dev/null
fi
if [[ -w $out/share/applications ]]; then
${pkgs.buildPackages.desktop-file-utils}/bin/update-desktop-database \
${getExe' cfg.desktopFileUtilsPackage "update-desktop-database"} \
$out/share/applications
fi
'';

View file

@ -30,6 +30,8 @@ in {
apply = toString;
description = ''
Absolute path to directory holding application caches.
Sets `XDG_CACHE_HOME` for the user if `xdg.enable` is set `true`.
'';
};
@ -48,6 +50,8 @@ in {
apply = toString;
description = ''
Absolute path to directory holding application configurations.
Sets `XDG_CONFIG_HOME` for the user if `xdg.enable` is set `true`.
'';
};
@ -67,6 +71,8 @@ in {
apply = toString;
description = ''
Absolute path to directory holding application data.
Sets `XDG_DATA_HOME` for the user if `xdg.enable` is set `true`.
'';
};
@ -86,6 +92,8 @@ in {
apply = toString;
description = ''
Absolute path to directory holding application states.
Sets `XDG_STATE_HOME` for the user if `xdg.enable` is set `true`.
'';
};
};

View file

@ -241,8 +241,9 @@ let
./programs/translate-shell.nix
./programs/urxvt.nix
./programs/vdirsyncer.nix
./programs/vim.nix
./programs/vifm.nix
./programs/vim-vint.nix
./programs/vim.nix
./programs/vscode.nix
./programs/vscode/haskell.nix
./programs/pywal.nix
@ -361,6 +362,7 @@ let
./services/screen-locker.nix
./services/sctd.nix
./services/signaturepdf.nix
./services/snixembed.nix
./services/spotifyd.nix
./services/ssh-agent.nix
./services/stalonetray.nix

View file

@ -8,13 +8,16 @@ msgstr ""
"Project-Id-Version: Home Manager Modules\n"
"Report-Msgid-Bugs-To: https://github.com/nix-community/home-manager/issues\n"
"POT-Creation-Date: 2024-04-17 23:19+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: Automatically generated\n"
"Language-Team: none\n"
"PO-Revision-Date: 2024-10-09 14:31+0000\n"
"Last-Translator: Utkarsh Sharma <utkasharma19@gmail.com>\n"
"Language-Team: Hindi <https://hosted.weblate.org/projects/home-manager/"
"modules/hi/>\n"
"Language: hi\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n > 1;\n"
"X-Generator: Weblate 5.8-dev\n"
#: modules/files.nix:191
msgid "Creating home file links in %s"
@ -22,7 +25,7 @@ msgstr ""
#: modules/files.nix:204
msgid "Cleaning up orphan links from %s"
msgstr ""
msgstr "%s से ऑर्फे़न लिंक्स मिटाई जा रही है"
#: modules/files.nix:220
msgid "Creating profile generation %s"

View file

@ -272,10 +272,7 @@ in {
};
config = mkIf cfg.enable {
assertions = [
(lib.hm.assertions.assertPlatform "programs.borgmatic" pkgs
lib.platforms.linux)
] ++ (mapAttrsToList (backup: opts: {
assertions = (mapAttrsToList (backup: opts: {
assertion = opts.location.sourceDirectories == null
|| opts.location.patterns == null;
message = ''

View file

@ -214,6 +214,41 @@ in {
};
};
maintenance = {
enable = mkEnableOption "" // {
description = ''
Enable the automatic {command}`git maintenance`.
See <https://git-scm.com/docs/git-maintenance>.
'';
};
repositories = mkOption {
type = with types; listOf str;
default = [ ];
description = ''
Repositories on which {command}`git maintenance` should run.
Should be a list of absolute paths.
'';
};
timers = mkOption {
type = types.attrsOf types.str;
default = {
hourly = "*-*-* 1..23:53:00";
daily = "Tue..Sun *-*-* 0:53:00";
weekly = "Mon 0:53:00";
};
description = ''
Systemd timers to create for scheduled {command}`git maintenance`.
Key is passed to `--schedule` argument in {command}`git maintenance run`
and value is passed to `Timer.OnCalendar` in `systemd.user.timers`.
'';
};
};
diff-highlight = {
enable = mkEnableOption "" // {
description = ''
@ -501,6 +536,48 @@ in {
};
})
(mkIf cfg.maintenance.enable {
programs.git.iniContent.maintenance.repo = cfg.maintenance.repositories;
systemd.user.services."git-maintenance@" = {
Unit = {
Description = "Optimize Git repositories data";
Documentation = [ "man:git-maintenance(1)" ];
};
Service = {
Type = "oneshot";
ExecStart = let exe = lib.getExe cfg.package;
in ''
"${exe}" --exec-path="${exe}" for-each-repo --config=maintenance.repo maintenance run --schedule=%i
'';
LockPersonality = "yes";
MemoryDenyWriteExecute = "yes";
NoNewPrivileges = "yes";
RestrictAddressFamilies = "AF_UNIX AF_INET AF_INET6 AF_VSOCK";
RestrictNamespaces = "yes";
RestrictRealtime = "yes";
RestrictSUIDSGID = "yes";
SystemCallArchitectures = "native";
SystemCallFilter = "@system-service";
};
};
systemd.user.timers = let
toSystemdTimer = name: time:
lib.attrsets.nameValuePair "git-maintenance@${name}" {
Unit.Description = "Optimize Git repositories data";
Timer = {
OnCalendar = time;
Persistent = true;
};
Install.WantedBy = [ "timers.target" ];
};
in lib.attrsets.mapAttrs' toSystemdTimer cfg.maintenance.timers;
})
(mkIf cfg.diff-highlight.enable {
programs.git.iniContent = let
dhCommand =

View file

@ -5,7 +5,7 @@ with lib;
let
cfg = config.programs.kitty;
eitherStrBoolInt = with types; either str (either bool int);
settingsValueType = with types; oneOf [ str bool int float ];
optionalPackage = opt:
optional (opt != null && opt.package != null) opt.package;
@ -102,7 +102,7 @@ in {
};
settings = mkOption {
type = types.attrsOf eitherStrBoolInt;
type = types.attrsOf settingsValueType;
default = { };
example = literalExpression ''
{

33
modules/programs/vifm.nix Normal file
View file

@ -0,0 +1,33 @@
{ config, lib, pkgs, ... }:
let
inherit (lib) mkIf mkOption types;
cfg = config.programs.vifm;
in {
meta.maintainers = [ lib.hm.maintainers.aabccd021 ];
options.programs.vifm = {
enable = lib.mkEnableOption "vifm, a Vim-like file manager";
package = lib.mkPackageOption pkgs "vifm" { };
extraConfig = mkOption {
type = types.lines;
default = "";
example = "mark h ~/";
description = ''
Extra lines added to the {file}`$XDG_CONFIG_HOME/vifm/vifmrc` file.
'';
};
};
config = mkIf cfg.enable {
home.packages = [ cfg.package ];
xdg.configFile."vifm/vifmrc" =
mkIf (cfg.extraConfig != "") { text = cfg.extraConfig; };
};
}

View file

@ -31,7 +31,7 @@ in {
options = mkOption {
default = { };
type = with types; attrsOf (either str (either bool int));
type = with types; attrsOf (oneOf [ str bool int float ]);
description = ''
Add {option}`:set` command options to zathura and make
them permanent. See

View file

@ -28,7 +28,7 @@ in {
systemd.user.services.megasync = {
Unit = {
Description = "megasync";
After = [ "graphical-session-pre.target" ];
After = [ "graphical-session.target" ];
PartOf = [ "graphical-session.target" ];
};

View file

@ -58,6 +58,7 @@ in {
optionalString (cfg.storePath != null) "--path ${cfg.storePath}"
}";
BusName = busName;
Environment = [ "GNUPGHOME=${config.programs.gpg.homedir}" ];
};
Install.WantedBy = [ "default.target" ];

View file

@ -0,0 +1,50 @@
{ config, lib, pkgs, ... }:
with lib;
let cfg = config.services.snixembed;
in {
meta.maintainers = [ maintainers.DamienCassou ];
options = {
services.snixembed = {
enable = mkEnableOption
"snixembed: proxy StatusNotifierItems as XEmbedded systemtray-spec icons";
package = mkPackageOption pkgs "snixembed" { };
beforeUnits = mkOption {
type = with types; listOf str;
default = [ ];
example = [ "safeeyes.service" ];
description = ''
List of other units that should be started after snixembed.
'';
};
};
};
config = mkIf cfg.enable {
assertions = [
(hm.assertions.assertPlatform "services.snixembed" pkgs platforms.linux)
];
systemd.user.services.snixembed = {
Install.WantedBy = [ "graphical-session.target" ];
Unit = {
Description = "snixembed";
PartOf = [ "graphical-session.target" ];
StartLimitIntervalSec = 100;
StartLimitBurst = 10;
Before = cfg.beforeUnits;
};
Service = {
ExecStart = getExe pkgs.snixembed;
Restart = "on-failure";
RestartSec = 3;
};
};
};
}

View file

@ -60,6 +60,7 @@ in import nmtSrc {
./modules/programs/bacon
./modules/programs/bash
./modules/programs/bat
./modules/programs/borgmatic
./modules/programs/bottom
./modules/programs/broot
./modules/programs/browserpass
@ -154,6 +155,7 @@ in import nmtSrc {
./modules/programs/tmux
./modules/programs/topgrade
./modules/programs/translate-shell
./modules/programs/vifm
./modules/programs/vim-vint
./modules/programs/vscode
./modules/programs/watson
@ -189,7 +191,6 @@ in import nmtSrc {
./modules/programs/awscli
./modules/programs/beets # One test relies on services.mpd
./modules/programs/bemenu
./modules/programs/borgmatic
./modules/programs/boxxy
./modules/programs/firefox/firefox.nix
./modules/programs/foot
@ -270,6 +271,7 @@ in import nmtSrc {
./modules/services/remmina
./modules/services/screen-locker
./modules/services/signaturepdf
./modules/services/snixembed
./modules/services/swayidle
./modules/services/swaync
./modules/services/swayosd

View file

@ -6,4 +6,7 @@
xdg-default-locations = ./default-locations.nix;
xdg-user-dirs-null = ./user-dirs-null.nix;
xdg-portal = ./portal.nix;
xdg-mime = ./mime.nix;
xdg-mime-disabled = ./mime-disabled.nix;
xdg-mime-package = ./mime-packages.nix;
}

View file

@ -0,0 +1,10 @@
{ ... }: {
config = {
xdg.mime.enable = false;
nmt.script = ''
# assert that neither application is run
assertPathNotExists home-path/share/applications/mimeinfo.cache
assertPathNotExists home-path/share/applications/mime
'';
};
}

View file

@ -0,0 +1,3 @@
[MIME Cache]
text/html=mime-test.desktop;
text/xml=mime-test.desktop;

View file

@ -0,0 +1,38 @@
{ config, ... }:
let inherit (config.lib.test) mkStubPackage;
in {
config = {
xdg.mime.enable = true;
xdg.mime.sharedMimeInfoPackage = mkStubPackage {
name = "update-mime-database";
buildScript = ''
mkdir -p $out/bin
echo '#!/bin/sh' > $out/bin/update-mime-database
echo 'mkdir -p $out/share/mime && touch $out/share/mime/mime.cache' >> $out/bin/update-mime-database
chmod +x $out/bin/update-mime-database
'';
};
xdg.mime.desktopFileUtilsPackage = mkStubPackage {
name = "desktop-file-utils";
buildScript = ''
mkdir -p $out/bin
echo '#!/bin/sh' > $out/bin/update-desktop-database
echo 'mkdir -p $out/share/applications/ && ln -s ${
./mime-expected.cache
} $out/share/applications/mimeinfo.cache' >> $out/bin/update-desktop-database
chmod +x $out/bin/update-desktop-database
'';
};
nmt.script = ''
assertFileExists home-path/share/applications/mimeinfo.cache # Check that update-desktop-database created file
# Check that update-desktop-database file matches expected
assertFileContent \
home-path/share/applications/mimeinfo.cache \
${./mime-expected.cache}
assertDirectoryExists home-path/share/mime # Check that update-mime-database created directory
assertFileExists home-path/share/mime/mime.cache # Check that update-mime-database created file
'';
};
}

View file

@ -0,0 +1,24 @@
{ ... }: {
config = {
xdg.mime.enable = true;
xdg.desktopEntries = {
mime-test = { # mime info test
name = "mime-test";
mimeType = [ "text/html" "text/xml" ];
};
};
nmt.script = ''
assertFileExists home-path/share/applications/mimeinfo.cache # Check that update-desktop-database created file
# Check that update-desktop-database file matches expected
assertFileContent \
home-path/share/applications/mimeinfo.cache \
${./mime-expected.cache}
assertDirectoryExists home-path/share/mime # Check that update-mime-database created directory
assertDirectoryNotEmpty home-path/share/mime # Check that update-mime-database created files
'';
};
}

View file

@ -1,11 +1,16 @@
let name = "firefox";
in builtins.mapAttrs (test: module: import module [ "programs" name ]) {
"${name}-profile-settings" = ./profile-settings.nix;
"${name}-state-version-19_09" = ./state-version-19_09.nix;
"${name}-deprecated-native-messenger" = ./deprecated-native-messenger.nix;
"${name}-duplicate-profile-ids" = ./duplicate-profile-ids.nix;
"${name}-duplicate-container-ids" = ./duplicate-container-ids.nix;
"${name}-container-id-out-of-range" = ./container-id-out-of-range.nix;
"${name}-policies" = ./policies.nix;
"${name}-profiles-bookmarks" = ./profiles/bookmarks;
"${name}-profiles-containers" = ./profiles/containers;
"${name}-profiles-containers-duplicate-ids" =
./profiles/containers/duplicate-ids.nix;
"${name}-profiles-containers-id-out-of-range" =
./profiles/containers/id-out-of-range.nix;
"${name}-profiles-duplicate-ids" = ./profiles/duplicate-ids.nix;
"${name}-profiles-search" = ./profiles/search;
"${name}-profiles-settings" = ./profiles/settings;
"${name}-state-version-19_09" = ./state-version-19_09.nix;
}

View file

@ -1,215 +0,0 @@
modulePath:
{ config, lib, pkgs, ... }:
with lib;
let
cfg = getAttrFromPath modulePath config;
firefoxMockOverlay = import ./setup-firefox-mock-overlay.nix modulePath;
in {
imports = [ firefoxMockOverlay ];
config = mkIf config.test.enableBig (setAttrByPath modulePath {
enable = true;
profiles.basic.isDefault = true;
profiles.test = {
id = 1;
settings = {
"general.smoothScroll" = false;
"browser.newtabpage.pinned" = [{
title = "NixOS";
url = "https://nixos.org";
}];
};
};
profiles.bookmarks = {
id = 2;
settings = { "general.smoothScroll" = false; };
bookmarks = [
{
toolbar = true;
bookmarks = [{
name = "Home Manager";
url = "https://wiki.nixos.org/wiki/Home_Manager";
}];
}
{
name = "wikipedia";
tags = [ "wiki" ];
keyword = "wiki";
url = "https://en.wikipedia.org/wiki/Special:Search?search=%s&go=Go";
}
{
name = "kernel.org";
url = "https://www.kernel.org";
}
{
name = "Nix sites";
bookmarks = [
{
name = "homepage";
url = "https://nixos.org/";
}
{
name = "wiki";
tags = [ "wiki" "nix" ];
url = "https://wiki.nixos.org/";
}
{
name = "Nix sites";
bookmarks = [
{
name = "homepage";
url = "https://nixos.org/";
}
{
name = "wiki";
url = "https://wiki.nixos.org/";
}
];
}
];
}
];
};
profiles.search = {
id = 3;
search = {
force = true;
default = "Google";
privateDefault = "DuckDuckGo";
order = [ "Nix Packages" "NixOS Wiki" ];
engines = {
"Nix Packages" = {
urls = [{
template = "https://search.nixos.org/packages";
params = [
{
name = "type";
value = "packages";
}
{
name = "query";
value = "{searchTerms}";
}
];
}];
icon =
"/run/current-system/sw/share/icons/hicolor/scalable/apps/nix-snowflake.svg";
definedAliases = [ "@np" ];
};
"NixOS Wiki" = {
urls = [{
template =
"https://wiki.nixos.org/index.php?search={searchTerms}";
}];
iconUpdateURL = "https://wiki.nixos.org/favicon.png";
updateInterval = 24 * 60 * 60 * 1000;
definedAliases = [ "@nw" ];
};
"Bing".metaData.hidden = true;
"Google".metaData.alias = "@g";
};
};
};
profiles.searchWithoutDefault = {
id = 4;
search = {
force = true;
order = [ "Google" "Nix Packages" ];
engines = {
"Nix Packages" = {
urls = [{
template = "https://search.nixos.org/packages";
params = [
{
name = "type";
value = "packages";
}
{
name = "query";
value = "{searchTerms}";
}
];
}];
definedAliases = [ "@np" ];
};
};
};
};
profiles.containers = {
id = 5;
containers = {
"shopping" = {
id = 6;
icon = "circle";
color = "yellow";
};
};
};
} // {
nmt.script = ''
assertFileRegex \
home-path/bin/${cfg.wrappedPackageName} \
MOZ_APP_LAUNCHER
assertDirectoryExists home-files/${cfg.configPath}/basic
assertFileContent \
home-files/${cfg.configPath}/test/user.js \
${./profile-settings-expected-user.js}
assertFileContent \
home-files/${cfg.configPath}/containers/containers.json \
${./profile-settings-expected-containers.json}
bookmarksUserJs=$(normalizeStorePaths \
home-files/${cfg.configPath}/bookmarks/user.js)
assertFileContent \
$bookmarksUserJs \
${./profile-settings-expected-bookmarks-user.js}
bookmarksFile="$(sed -n \
'/browser.bookmarks.file/ {s|^.*\(/nix/store[^"]*\).*|\1|;p}' \
$TESTED/home-files/${cfg.configPath}/bookmarks/user.js)"
assertFileContent \
$bookmarksFile \
${./profile-settings-expected-bookmarks.html}
function assertFirefoxSearchContent() {
compressedSearch=$(normalizeStorePaths "$1")
decompressedSearch=$(dirname $compressedSearch)/search.json
${pkgs.mozlz4a}/bin/mozlz4a -d "$compressedSearch" >(${pkgs.jq}/bin/jq . > "$decompressedSearch")
assertFileContent \
$decompressedSearch \
"$2"
}
assertFirefoxSearchContent \
home-files/${cfg.configPath}/search/search.json.mozlz4 \
${./profile-settings-expected-search.json}
assertFirefoxSearchContent \
home-files/${cfg.configPath}/searchWithoutDefault/search.json.mozlz4 \
${./profile-settings-expected-search-without-default.json}
'';
});
}

View file

@ -0,0 +1,84 @@
modulePath:
{ config, lib, pkgs, ... }:
with lib;
let
cfg = getAttrFromPath modulePath config;
firefoxMockOverlay = import ../../setup-firefox-mock-overlay.nix modulePath;
in {
imports = [ firefoxMockOverlay ];
config = mkIf config.test.enableBig (setAttrByPath modulePath {
enable = true;
profiles.bookmarks = {
settings = { "general.smoothScroll" = false; };
bookmarks = [
{
toolbar = true;
bookmarks = [{
name = "Home Manager";
url = "https://wiki.nixos.org/wiki/Home_Manager";
}];
}
{
name = "wikipedia";
tags = [ "wiki" ];
keyword = "wiki";
url = "https://en.wikipedia.org/wiki/Special:Search?search=%s&go=Go";
}
{
name = "kernel.org";
url = "https://www.kernel.org";
}
{
name = "Nix sites";
bookmarks = [
{
name = "homepage";
url = "https://nixos.org/";
}
{
name = "wiki";
tags = [ "wiki" "nix" ];
url = "https://wiki.nixos.org/";
}
{
name = "Nix sites";
bookmarks = [
{
name = "homepage";
url = "https://nixos.org/";
}
{
name = "wiki";
url = "https://wiki.nixos.org/";
}
];
}
];
}
];
};
} // {
nmt.script = ''
bookmarksUserJs=$(normalizeStorePaths \
home-files/${cfg.configPath}/bookmarks/user.js)
assertFileContent \
$bookmarksUserJs \
${./expected-bookmarks-user.js}
bookmarksFile="$(sed -n \
'/browser.bookmarks.file/ {s|^.*\(/nix/store[^"]*\).*|\1|;p}' \
$TESTED/home-files/${cfg.configPath}/bookmarks/user.js)"
assertFileContent \
$bookmarksFile \
${./expected-bookmarks.html}
'';
});
}

View file

@ -0,0 +1,32 @@
modulePath:
{ config, lib, pkgs, ... }:
with lib;
let
cfg = getAttrFromPath modulePath config;
firefoxMockOverlay = import ../../setup-firefox-mock-overlay.nix modulePath;
in {
imports = [ firefoxMockOverlay ];
config = mkIf config.test.enableBig (setAttrByPath modulePath {
enable = true;
profiles.containers = {
containers = {
"shopping" = {
icon = "circle";
color = "yellow";
};
};
};
} // {
nmt.script = ''
assertFileContent \
home-files/${cfg.configPath}/containers/containers.json \
${./expected-containers.json}
'';
});
}

View file

@ -7,7 +7,7 @@ let
cfg = getAttrFromPath modulePath config;
firefoxMockOverlay = import ./setup-firefox-mock-overlay.nix modulePath;
firefoxMockOverlay = import ../../setup-firefox-mock-overlay.nix modulePath;
in {
imports = [ firefoxMockOverlay ];

View file

@ -1 +1 @@
{"identities":[{"color":"yellow","icon":"circle","name":"shopping","public":true,"userContextId":6},{"accessKey":"","color":"","icon":"","name":"userContextIdInternal.thumbnail","public":false,"userContextId":4294967294},{"accessKey":"","color":"","icon":"","name":"userContextIdInternal.webextStorageLocal","public":false,"userContextId":4294967295}],"lastUserContextId":6,"version":4}
{"identities":[{"color":"yellow","icon":"circle","name":"shopping","public":true,"userContextId":0},{"accessKey":"","color":"","icon":"","name":"userContextIdInternal.thumbnail","public":false,"userContextId":4294967294},{"accessKey":"","color":"","icon":"","name":"userContextIdInternal.webextStorageLocal","public":false,"userContextId":4294967295}],"lastUserContextId":0,"version":4}

View file

@ -5,7 +5,7 @@ with lib;
let
firefoxMockOverlay = import ./setup-firefox-mock-overlay.nix modulePath;
firefoxMockOverlay = import ../../setup-firefox-mock-overlay.nix modulePath;
in {
imports = [ firefoxMockOverlay ];

View file

@ -7,7 +7,7 @@ let
cfg = getAttrFromPath modulePath config;
firefoxMockOverlay = import ./setup-firefox-mock-overlay.nix modulePath;
firefoxMockOverlay = import ../setup-firefox-mock-overlay.nix modulePath;
in {
imports = [ firefoxMockOverlay ];

View file

@ -0,0 +1,112 @@
modulePath:
{ config, lib, pkgs, ... }:
with lib;
let
cfg = getAttrFromPath modulePath config;
firefoxMockOverlay = import ../../setup-firefox-mock-overlay.nix modulePath;
in {
imports = [ firefoxMockOverlay ];
config = mkIf config.test.enableBig (setAttrByPath modulePath {
enable = true;
profiles = {
search = {
id = 0;
search = {
force = true;
default = "Google";
privateDefault = "DuckDuckGo";
order = [ "Nix Packages" "NixOS Wiki" ];
engines = {
"Nix Packages" = {
urls = [{
template = "https://search.nixos.org/packages";
params = [
{
name = "type";
value = "packages";
}
{
name = "query";
value = "{searchTerms}";
}
];
}];
icon =
"/run/current-system/sw/share/icons/hicolor/scalable/apps/nix-snowflake.svg";
definedAliases = [ "@np" ];
};
"NixOS Wiki" = {
urls = [{
template =
"https://wiki.nixos.org/index.php?search={searchTerms}";
}];
iconUpdateURL = "https://wiki.nixos.org/favicon.png";
updateInterval = 24 * 60 * 60 * 1000;
definedAliases = [ "@nw" ];
};
"Bing".metaData.hidden = true;
"Google".metaData.alias = "@g";
};
};
};
searchWithoutDefault = {
id = 1;
search = {
force = true;
order = [ "Google" "Nix Packages" ];
engines = {
"Nix Packages" = {
urls = [{
template = "https://search.nixos.org/packages";
params = [
{
name = "type";
value = "packages";
}
{
name = "query";
value = "{searchTerms}";
}
];
}];
definedAliases = [ "@np" ];
};
};
};
};
};
} // {
nmt.script = ''
function assertFirefoxSearchContent() {
compressedSearch=$(normalizeStorePaths "$1")
decompressedSearch=$(dirname $compressedSearch)/search.json
${pkgs.mozlz4a}/bin/mozlz4a -d "$compressedSearch" >(${pkgs.jq}/bin/jq . > "$decompressedSearch")
assertFileContent \
$decompressedSearch \
"$2"
}
assertFirefoxSearchContent \
home-files/${cfg.configPath}/search/search.json.mozlz4 \
${./expected-search.json}
assertFirefoxSearchContent \
home-files/${cfg.configPath}/searchWithoutDefault/search.json.mozlz4 \
${./expected-search-without-default.json}
'';
});
}

View file

@ -0,0 +1,43 @@
modulePath:
{ config, lib, pkgs, ... }:
with lib;
let
cfg = getAttrFromPath modulePath config;
firefoxMockOverlay = import ../../setup-firefox-mock-overlay.nix modulePath;
in {
imports = [ firefoxMockOverlay ];
config = mkIf config.test.enableBig (setAttrByPath modulePath {
enable = true;
profiles = {
basic.isDefault = true;
test = {
id = 1;
settings = {
"general.smoothScroll" = false;
"browser.newtabpage.pinned" = [{
title = "NixOS";
url = "https://nixos.org";
}];
};
};
};
} // {
nmt.script = ''
assertFileRegex \
home-path/bin/${cfg.wrappedPackageName} \
MOZ_APP_LAUNCHER
assertDirectoryExists home-files/${cfg.configPath}/basic
assertFileContent \
home-files/${cfg.configPath}/test/user.js \
${./expected-user.js}
'';
});
}

View file

@ -7,6 +7,7 @@ font_size 8
# Shell integration is sourced and configured manually
shell_integration no-rc
background_opacity 0.500000
enable_audio_bell no
scrollback_lines 10000
update_check_interval 0

View file

@ -17,6 +17,7 @@ with lib;
scrollback_lines = 10000;
enable_audio_bell = false;
update_check_interval = 0;
background_opacity = 0.5;
};
font.name = "DejaVu Sans";

View file

@ -0,0 +1,4 @@
{
vifm-example-settings = ./example-settings.nix;
vifm-empty-settings = ./empty-settings.nix;
}

View file

@ -0,0 +1,11 @@
{ ... }:
{
programs.vifm.enable = true;
test.stubs.vifm = { };
nmt.script = ''
assertPathNotExists home-files/.config/vifm
'';
}

View file

@ -0,0 +1,21 @@
{ config, ... }:
{
programs.vifm = {
enable = true;
package = config.lib.test.mkStubPackage { };
extraConfig = ''
mark h ~/
'';
};
nmt.script = ''
assertFileContent \
home-files/.config/vifm/vifmrc \
${
builtins.toFile "vifm-expected.conf" ''
mark h ~/
''
}
'';
}

View file

@ -0,0 +1,7 @@
[Desktop Entry]
Exec=@xdg-utils@/bin/xdg-open http://localhost:9494
Icon=/snixembed/share/snixembed/public/favicon.ico
Name=Snixembed
Terminal=false
Type=Application
Version=1.4

View file

@ -0,0 +1,16 @@
{ ... }:
{
services.snixembed = {
enable = true;
beforeUnits = [ "safeeyes.service" ];
};
test.stubs = { snixembed = { outPath = "/snixembed"; }; };
nmt.script = ''
assertFileContent \
home-files/.config/systemd/user/snixembed.service \
${./basic-configuration.service}
'';
}

View file

@ -0,0 +1,14 @@
[Install]
WantedBy=graphical-session.target
[Service]
ExecStart=/snixembed/bin/dummy
Restart=on-failure
RestartSec=3
[Unit]
Before=safeeyes.service
Description=snixembed
PartOf=graphical-session.target
StartLimitBurst=10
StartLimitIntervalSec=100

View file

@ -0,0 +1 @@
{ snixembed-basic-configuration = ./basic-configuration.nix; }