diff --git a/docs/manual/introduction.md b/docs/manual/introduction.md new file mode 100644 index 00000000..ebdac5bd --- /dev/null +++ b/docs/manual/introduction.md @@ -0,0 +1,32 @@ +# Introduction to Home Manager {#ch-introduction} + +Home Manager is a [Nix](https://nix.dev/)-powered tool for reproducible management of the contents of users' home directories. +This includes programs, configuration files, environment variables and, well… arbitrary files. +The following example snippet of Nix code: + +```nix +programs.git = { + enable = true; + userEmail = "joe@example.org"; + userName = "joe"; +}; +``` + +would make available to a user the `git` executable and man pages and a configuration file `~/.config/git/config`: + +```ini +[user] + email = "joe@example.org" + name = "joe" +``` + +Since Home Manager is implemented in Nix, it provides several benefits: + +- Contents are reproducible — a home will be the exact same every time it is built, unless of course, an intentional change is made. + This also means you can have the exact same home on different hosts. +- Significantly faster and more powerful than various backup strategies. +- Unlike "dotfiles" repositories, Home Manager supports specifying programs, as well as their configurations. +- Supported by , so that you don't have to build from source. +- If you do want to build some programs from source, there is hardly a tool more useful than Nix for that, and the build instructions can be neatly integrated in your Home Manager usage. +- Infinitely composable, so that values in different configuration files and build instructions can share a source of truth. +- Connects you with the [most extensive](https://repology.org/repositories/statistics/total) and [most up-to-date](https://repology.org/repositories/statistics/newest) software package repository on earth, [Nixpkgs](https://github.com/NixOS/nixpkgs). diff --git a/docs/manual/manual.md b/docs/manual/manual.md index a1cfb1a0..0f81642f 100644 --- a/docs/manual/manual.md +++ b/docs/manual/manual.md @@ -8,6 +8,7 @@ preface.md ``` ```{=include=} parts +introduction.md installation.md usage.md nix-flakes.md diff --git a/flake.lock b/flake.lock index 538de1b3..508f73e5 100644 --- a/flake.lock +++ b/flake.lock @@ -2,11 +2,11 @@ "nodes": { "nixpkgs": { "locked": { - "lastModified": 1718530797, - "narHash": "sha256-pup6cYwtgvzDpvpSCFh1TEUjw2zkNpk8iolbKnyFmmU=", + "lastModified": 1719254875, + "narHash": "sha256-ECni+IkwXjusHsm9Sexdtq8weAq/yUyt1TWIemXt3Ko=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "b60ebf54c15553b393d144357375ea956f89e9a9", + "rev": "2893f56de08021cffd9b6b6dfc70fd9ccd51eb60", "type": "github" }, "original": { diff --git a/modules/lib/maintainers.nix b/modules/lib/maintainers.nix index b5175a87..1063f53a 100644 --- a/modules/lib/maintainers.nix +++ b/modules/lib/maintainers.nix @@ -173,6 +173,13 @@ github = "iosmanthus"; githubId = 16307070; }; + jonringer = { + email = "jonringer117@gmail.com"; + matrix = "@jonringer:matrix.org"; + github = "jonringer"; + githubId = 7673602; + name = "Jonathan Ringer"; + }; kalhauge = { name = "Christian Gram Kalhauge"; email = "kalhauge@users.noreply.github.com"; @@ -201,6 +208,12 @@ github = "kubukoz"; githubId = 894884; }; + lheckemann = { + name = "Linus Heckemann"; + email = "git@sphalerite.org"; + github = "lheckemann"; + githubId = 341954; + }; loicreynier = { name = "Loïc Reynier"; email = "loic@loireynier.fr"; diff --git a/modules/misc/news.nix b/modules/misc/news.nix index 997c7815..bef867bb 100644 --- a/modules/misc/news.nix +++ b/modules/misc/news.nix @@ -1679,6 +1679,30 @@ in { https://github.com/rafaelmardojai/blanket for more. ''; } + + { + time = "2024-06-26T07:07:17+00:00"; + condition = with config.programs.yazi; + enable && (enableBashIntegration || enableZshIntegration + || enableFishIntegration || enableNushellIntegration); + message = '' + Yazi's shell integration wrappers have been renamed from 'ya' to 'yy'. + + A new option `programs.yazi.shellWrapperName` is also available that + allows you to override this name. + ''; + } + + { + time = "2024-06-28T14:18:16+00:00"; + condition = hostPlatform.isLinux; + message = '' + A new module is available: 'services.glance'. + + Glance is a self-hosted dashboard that puts all your feeds in + one place. See https://github.com/glanceapp/glance for more. + ''; + } ]; }; } diff --git a/modules/modules.nix b/modules/modules.nix index 5b100d47..dbeebfbf 100644 --- a/modules/modules.nix +++ b/modules/modules.nix @@ -301,6 +301,7 @@ let ./services/fusuma.nix ./services/getmail.nix ./services/git-sync.nix + ./services/glance.nix ./services/gnome-keyring.nix ./services/gpg-agent.nix ./services/grobi.nix diff --git a/modules/programs/direnv.nix b/modules/programs/direnv.nix index add2c8fc..4a763670 100644 --- a/modules/programs/direnv.nix +++ b/modules/programs/direnv.nix @@ -95,6 +95,7 @@ in { package = mkPackageOption pkgs "nix-direnv" { }; }; + silent = mkEnableOption "silent mode, that is, disabling direnv logging"; }; config = mkIf cfg.enable { @@ -163,5 +164,7 @@ in { } ) ''); + + home.sessionVariables = lib.mkIf cfg.silent { DIRENV_LOG_FORMAT = ""; }; }; } diff --git a/modules/programs/rbw.nix b/modules/programs/rbw.nix index 5dd751d0..b7381c67 100644 --- a/modules/programs/rbw.nix +++ b/modules/programs/rbw.nix @@ -19,7 +19,7 @@ let base_url = mkOption { type = with types; nullOr str; default = null; - example = "bitwarden.example.com"; + example = "https://bitwarden.example.com/"; description = "The base-url for a self-hosted bitwarden installation."; }; @@ -27,7 +27,7 @@ let identity_url = mkOption { type = with types; nullOr str; default = null; - example = "identity.example.com"; + example = "https://identity.example.com/"; description = "The identity url for your bitwarden installation."; }; diff --git a/modules/programs/yazi.nix b/modules/programs/yazi.nix index 11f4e75c..105bbec4 100644 --- a/modules/programs/yazi.nix +++ b/modules/programs/yazi.nix @@ -7,7 +7,7 @@ let tomlFormat = pkgs.formats.toml { }; bashIntegration = '' - function ya() { + function ${cfg.shellWrapperName}() { local tmp="$(mktemp -t "yazi-cwd.XXXXX")" yazi "$@" --cwd-file="$tmp" if cwd="$(cat -- "$tmp")" && [ -n "$cwd" ] && [ "$cwd" != "$PWD" ]; then @@ -18,7 +18,7 @@ let ''; fishIntegration = '' - function ya + function ${cfg.shellWrapperName} set tmp (mktemp -t "yazi-cwd.XXXXX") yazi $argv --cwd-file="$tmp" if set cwd (cat -- "$tmp"); and [ -n "$cwd" ]; and [ "$cwd" != "$PWD" ] @@ -29,7 +29,7 @@ let ''; nushellIntegration = '' - def --env ya [...args] { + def --env ${cfg.shellWrapperName} [...args] { let tmp = (mktemp -t "yazi-cwd.XXXXX") yazi ...$args --cwd-file $tmp let cwd = (open $tmp) @@ -40,13 +40,22 @@ let } ''; in { - meta.maintainers = with maintainers; [ xyenon ]; + meta.maintainers = with maintainers; [ xyenon eljamm ]; options.programs.yazi = { enable = mkEnableOption "yazi"; package = mkPackageOption pkgs "yazi" { }; + shellWrapperName = mkOption { + type = types.str; + default = "yy"; + example = "y"; + description = '' + Name of the shell wrapper to be called. + ''; + }; + enableBashIntegration = mkEnableOption "Bash integration"; enableZshIntegration = mkEnableOption "Zsh integration"; @@ -145,8 +154,11 @@ in { default = { }; description = '' Lua plugins. + Values should be a package or path containing an `init.lua` file. + Will be linked to {file}`$XDG_CONFIG_HOME/yazi/plugins/.yazi`. - See https://yazi-rs.github.io/docs/plugins/overview/ for documentation. + See + for documentation. ''; example = literalExpression '' { @@ -161,8 +173,10 @@ in { default = { }; description = '' Pre-made themes. + Values should be a package or path containing the required files. + Will be linked to {file}`$XDG_CONFIG_HOME/yazi/flavors/.yazi`. - See https://yazi-rs.github.io/docs/flavors/overview/ for documentation. + See for documentation. ''; example = literalExpression '' { @@ -171,7 +185,6 @@ in { } ''; }; - }; config = mkIf cfg.enable { @@ -198,10 +211,63 @@ in { source = tomlFormat.generate "yazi-theme" cfg.theme; }; "yazi/init.lua" = mkIf (cfg.initLua != null) { source = cfg.initLua; }; - } // (mapAttrs' - (name: value: nameValuePair "yazi/plugins/${name}" { source = value; }) - cfg.plugins) // (mapAttrs' - (name: value: nameValuePair "yazi/flavors/${name}" { source = value; }) - cfg.flavors); + } // (mapAttrs' (name: value: + nameValuePair "yazi/flavors/${name}.yazi" { source = value; }) + cfg.flavors) // (mapAttrs' (name: value: + nameValuePair "yazi/plugins/${name}.yazi" { source = value; }) + cfg.plugins); + + warnings = filter (s: s != "") (concatLists [ + (mapAttrsToList (name: value: + optionalString (hasSuffix ".yazi" name) '' + Flavors like `programs.yazi.flavors."${name}"` should no longer have the suffix ".yazi" in their attribute name. + The flavor will be linked to `$XDG_CONFIG_HOME/yazi/flavors/${name}.yazi`. + You probably want to rename it to `programs.yazi.flavors."${ + removeSuffix ".yazi" name + }"`. + '') cfg.flavors) + (mapAttrsToList (name: value: + optionalString (hasSuffix ".yazi" name) '' + Plugins like `programs.yazi.plugins."${name}"` should no longer have the suffix ".yazi" in their attribute name. + The plugin will be linked to `$XDG_CONFIG_HOME/yazi/plugins/${name}.yazi`. + You probably want to rename it to `programs.yazi.plugins."${ + removeSuffix ".yazi" name + }"`. + '') cfg.plugins) + ]); + + assertions = let + mkAsserts = opt: requiredFiles: + mapAttrsToList (name: value: + let + isDir = pathIsDirectory "${value}"; + msgNotDir = optionalString (!isDir) + "The path or package should be a directory, not a single file."; + isFileMissing = file: + !(pathExists "${value}/${file}") + || pathIsDirectory "${value}/${file}"; + missingFiles = filter isFileMissing requiredFiles; + msgFilesMissing = optionalString (missingFiles != [ ]) + "The ${singularOpt} is missing these files: ${ + toString missingFiles + }"; + singularOpt = removeSuffix "s" opt; + in { + assertion = isDir && missingFiles == [ ]; + message = '' + Value at `programs.yazi.${opt}.${name}` is not a valid yazi ${singularOpt}. + ${msgNotDir} + ${msgFilesMissing} + Evaluated value: `${value}` + ''; + }) cfg.${opt}; + in (mkAsserts "flavors" [ + "flavor.toml" + "tmtheme.xml" + "README.md" + "preview.png" + "LICENSE" + "LICENSE-tmtheme" + ]) ++ (mkAsserts "plugins" [ "init.lua" ]); }; } diff --git a/modules/services/glance.nix b/modules/services/glance.nix new file mode 100644 index 00000000..fa4f1a8d --- /dev/null +++ b/modules/services/glance.nix @@ -0,0 +1,77 @@ +{ config, lib, pkgs, ... }: + +let + cfg = config.services.glance; + + inherit (lib) mkEnableOption mkPackageOption mkOption mkIf getExe; + + settingsFormat = pkgs.formats.yaml { }; + + settingsFile = settingsFormat.generate "glance.yml" cfg.settings; + + configFilePath = "${config.xdg.configHome}/glance/glance.yml"; +in { + meta.maintainers = [ pkgs.lib.maintainers.gepbird ]; + + options.services.glance = { + enable = mkEnableOption "glance"; + + package = mkPackageOption pkgs "glance" { }; + + settings = mkOption { + type = settingsFormat.type; + default = { + pages = [{ + name = "Calendar"; + columns = [{ + size = "full"; + widgets = [{ type = "calendar"; }]; + }]; + }]; + }; + example = { + server.port = 5678; + pages = [{ + name = "Home"; + columns = [{ + size = "full"; + widgets = [ + { type = "calendar"; } + { + type = "weather"; + location = "London, United Kingdom"; + } + ]; + }]; + }]; + }; + description = '' + Configuration written to a yaml file that is read by glance. See + + for more. + ''; + }; + }; + + config = mkIf cfg.enable { + assertions = [ + (lib.hm.assertions.assertPlatform "services.glance" pkgs + lib.platforms.linux) + ]; + + home.packages = [ cfg.package ]; + + xdg.configFile."glance/glance.yml".source = settingsFile; + + systemd.user.services.glance = { + Unit = { + Description = "Glance feed dashboard server"; + PartOf = [ "graphical-session.target" ]; + }; + + Install.WantedBy = [ "graphical-session.target" ]; + + Service.ExecStart = "${getExe cfg.package} --config ${configFilePath}"; + }; + }; +} diff --git a/modules/services/pulseeffects.nix b/modules/services/pulseeffects.nix index 434adf85..3edc5349 100644 --- a/modules/services/pulseeffects.nix +++ b/modules/services/pulseeffects.nix @@ -9,7 +9,7 @@ let presetOpts = optionalString (cfg.preset != "") "--load-preset ${cfg.preset}"; in { - meta.maintainers = [ maintainers.jonringer ]; + meta.maintainers = [ hm.maintainers.jonringer ]; options.services.pulseeffects = { enable = mkEnableOption '' diff --git a/modules/services/ssh-agent.nix b/modules/services/ssh-agent.nix index 16db3232..88ecf38b 100644 --- a/modules/services/ssh-agent.nix +++ b/modules/services/ssh-agent.nix @@ -5,7 +5,7 @@ let cfg = config.services.ssh-agent; in { - meta.maintainers = [ lib.maintainers.lheckemann ]; + meta.maintainers = [ lib.hm.maintainers.lheckemann ]; options = { services.ssh-agent = { diff --git a/modules/services/stalonetray.nix b/modules/services/stalonetray.nix index 172d6dd9..9d4d7a53 100644 --- a/modules/services/stalonetray.nix +++ b/modules/services/stalonetray.nix @@ -74,7 +74,7 @@ in { } (mkIf (cfg.config != { }) { - home.file.".stalonetrayrc".text = let + xdg.configFile."stalonetrayrc".text = let valueToString = v: if isBool v then (if v then "true" else "false") @@ -88,7 +88,7 @@ in { }) (mkIf (cfg.extraConfig != "") { - home.file.".stalonetrayrc".text = cfg.extraConfig; + xdg.configFile."stalonetrayrc".text = cfg.extraConfig; }) ]); } diff --git a/modules/systemd-activate.sh b/modules/systemd-activate.sh index 235f1a24..ca26fea8 100644 --- a/modules/systemd-activate.sh +++ b/modules/systemd-activate.sh @@ -34,7 +34,7 @@ function systemdPostReload() { touch "$oldServiceFiles" else find "$oldUserServicePath" \ - -maxdepth 1 -name '*.service' -exec basename '{}' ';' \ + -maxdepth 1 -name '*.service' \! -name '*@.service' -exec basename '{}' ';' \ | sort \ > "$oldServiceFiles" fi @@ -43,7 +43,7 @@ function systemdPostReload() { touch "$newServiceFiles" else find "$newUserServicePath" \ - -maxdepth 1 -name '*.service' -exec basename '{}' ';' \ + -maxdepth 1 -name '*.service' \! -name '*@.service' -exec basename '{}' ';' \ | sort \ > "$newServiceFiles" fi diff --git a/modules/systemd.nix b/modules/systemd.nix index f209f65d..1d96ec8d 100644 --- a/modules/systemd.nix +++ b/modules/systemd.nix @@ -336,7 +336,7 @@ in { ${pkgs.sd-switch}/bin/sd-switch \ ''${DRY_RUN:+--dry-run} $VERBOSE_ARG ${timeoutArg} \ ''${oldGenPath:+--old-units $oldGenPath/home-files/.config/systemd/user} \ - --new-units $newGenPath/home-files/.config/systemd/user + --new-units "$newUnitsDir" ''; }; @@ -354,8 +354,15 @@ in { warnEcho "Attempting to reload services anyway..." fi + newUnitsDir="$newGenPath/home-files/.config/systemd/user" + if [[ ! -e $newUnitsDir ]]; then + newUnitsDir=${pkgs.emptyDirectory} + fi + ${ensureRuntimeDir} \ ${getAttr cfg.startServices cmd} + + unset newUnitsDir else echo "User systemd daemon not running. Skipping reload." fi diff --git a/tests/default.nix b/tests/default.nix index a5e7fe9e..28ce4f64 100644 --- a/tests/default.nix +++ b/tests/default.nix @@ -241,6 +241,7 @@ in import nmtSrc { ./modules/services/fnott ./modules/services/fusuma ./modules/services/git-sync + ./modules/services/glance ./modules/services/gpg-agent ./modules/services/gromit-mpx ./modules/services/home-manager-auto-upgrade diff --git a/tests/modules/programs/yazi/bash-integration-enabled.nix b/tests/modules/programs/yazi/bash-integration-enabled.nix index ac2e4979..474a989f 100644 --- a/tests/modules/programs/yazi/bash-integration-enabled.nix +++ b/tests/modules/programs/yazi/bash-integration-enabled.nix @@ -2,7 +2,7 @@ let shellIntegration = '' - function ya() { + function yy() { local tmp="$(mktemp -t "yazi-cwd.XXXXX")" yazi "$@" --cwd-file="$tmp" if cwd="$(cat -- "$tmp")" && [ -n "$cwd" ] && [ "$cwd" != "$PWD" ]; then diff --git a/tests/modules/programs/yazi/empty/.gitkeep b/tests/modules/programs/yazi/empty/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/tests/modules/programs/yazi/fish-integration-enabled.nix b/tests/modules/programs/yazi/fish-integration-enabled.nix index 6d2b9fa3..2231035b 100644 --- a/tests/modules/programs/yazi/fish-integration-enabled.nix +++ b/tests/modules/programs/yazi/fish-integration-enabled.nix @@ -2,7 +2,7 @@ let shellIntegration = '' - function ya + function yy set tmp (mktemp -t "yazi-cwd.XXXXX") yazi $argv --cwd-file="$tmp" if set cwd (cat -- "$tmp"); and [ -n "$cwd" ]; and [ "$cwd" != "$PWD" ] diff --git a/tests/modules/programs/yazi/flavor/LICENSE b/tests/modules/programs/yazi/flavor/LICENSE new file mode 100644 index 00000000..e69de29b diff --git a/tests/modules/programs/yazi/flavor/LICENSE-tmtheme b/tests/modules/programs/yazi/flavor/LICENSE-tmtheme new file mode 100644 index 00000000..e69de29b diff --git a/tests/modules/programs/yazi/flavor/README.md b/tests/modules/programs/yazi/flavor/README.md new file mode 100644 index 00000000..3ba41d0d --- /dev/null +++ b/tests/modules/programs/yazi/flavor/README.md @@ -0,0 +1,50 @@ +
+ Yazi logo +
+ +

+ Example Flavor for Yazi +

+ +## Cooking up a new flavor + +> [!NOTE] +> Please remove this section from your README before publishing. + +1. [x] Fork this repository and rename it to `your-flavor-name.yazi`. +2. [ ] Copy the **parts you need to customize** from the [default theme.toml](https://github.com/sxyazi/yazi/blob/main/yazi-config/preset/theme.toml) as `./flavor.toml`, and change them to meet your preferences. +3. [ ] Find a `.tmTheme` file on GitHub that matches the color of your flavor, copy it and it's license file as `./tmtheme.xml`, and `LICENSE-tmtheme`. +4. [ ] Modify the content and preview image in the README to fit your flavor. + +## 👀 Preview + + + +## 🎨 Installation + + + +```bash +# Linux/macOS +git clone https://github.com/username/example.yazi.git ~/.config/yazi/flavors/example.yazi + +# Windows +git clone https://github.com/username/example.yazi.git %AppData%\yazi\config\flavors\example.yazi +``` + +## ⚙️ Usage + +Add the these lines to your `theme.toml` configuration file to use it: + + + +```toml +[flavor] +use = "example" +``` + +## 📜 License + +The flavor is MIT-licensed, and the included tmTheme is also MIT-licensed. + +Check the [LICENSE](LICENSE) and [LICENSE-tmtheme](LICENSE-tmtheme) file for more details. diff --git a/tests/modules/programs/yazi/flavor/flavor.toml b/tests/modules/programs/yazi/flavor/flavor.toml new file mode 100644 index 00000000..35e1fe77 --- /dev/null +++ b/tests/modules/programs/yazi/flavor/flavor.toml @@ -0,0 +1,2 @@ +# This is a flavor. + diff --git a/tests/modules/programs/yazi/flavor/init.lua b/tests/modules/programs/yazi/flavor/init.lua deleted file mode 100644 index 8d06fa7a..00000000 --- a/tests/modules/programs/yazi/flavor/init.lua +++ /dev/null @@ -1 +0,0 @@ --- This is a flavor. diff --git a/tests/modules/programs/yazi/flavor/preview.png b/tests/modules/programs/yazi/flavor/preview.png new file mode 100644 index 00000000..e69de29b diff --git a/tests/modules/programs/yazi/flavor/tmtheme.xml b/tests/modules/programs/yazi/flavor/tmtheme.xml new file mode 100644 index 00000000..e69de29b diff --git a/tests/modules/programs/yazi/nushell-integration-enabled.nix b/tests/modules/programs/yazi/nushell-integration-enabled.nix index 9adbaa98..a2de2d8b 100644 --- a/tests/modules/programs/yazi/nushell-integration-enabled.nix +++ b/tests/modules/programs/yazi/nushell-integration-enabled.nix @@ -2,7 +2,7 @@ let shellIntegration = '' - def --env ya [...args] { + def --env yy [...args] { let tmp = (mktemp -t "yazi-cwd.XXXXX") yazi ...$args --cwd-file $tmp let cwd = (open $tmp) diff --git a/tests/modules/programs/yazi/settings.nix b/tests/modules/programs/yazi/settings.nix index 4655ae8b..2694dade 100644 --- a/tests/modules/programs/yazi/settings.nix +++ b/tests/modules/programs/yazi/settings.nix @@ -70,8 +70,22 @@ }; }; initLua = ./init.lua; - plugins = { "test.yazi" = ./plugin; }; - flavors = { "test.yazi" = ./flavor; }; + plugins = { + testplugin = ./plugin; + ## Produces warning + #"plugin-with-suffix.yazi" = ./plugin; + ## Fails assertion + #single-file-plugin = ./plugin/init.lua; + #empty-dir-plugin = ./empty; + }; + flavors = { + testflavor = ./flavor; + ## Produces warning + #"flavor-with-suffix.yazi" = ./flavor; + ## Fails assertion + #single-file-flavor = ./flavor/flavor.toml; + #empty-dir-flavor = ./empty; + }; }; test.stubs.yazi = { }; @@ -85,9 +99,9 @@ ${./theme-expected.toml} assertFileContent home-files/.config/yazi/init.lua \ ${./init.lua} - assertFileContent home-files/.config/yazi/plugins/test.yazi/init.lua \ + assertFileContent home-files/.config/yazi/plugins/testplugin.yazi/init.lua \ ${./plugin/init.lua} - assertFileContent home-files/.config/yazi/flavors/test.yazi/init.lua \ - ${./flavor/init.lua} + assertFileContent home-files/.config/yazi/flavors/testflavor.yazi/flavor.toml \ + ${./flavor/flavor.toml} ''; } diff --git a/tests/modules/programs/yazi/zsh-integration-enabled.nix b/tests/modules/programs/yazi/zsh-integration-enabled.nix index d5090a6a..0c0ec217 100644 --- a/tests/modules/programs/yazi/zsh-integration-enabled.nix +++ b/tests/modules/programs/yazi/zsh-integration-enabled.nix @@ -2,7 +2,7 @@ let shellIntegration = '' - function ya() { + function yy() { local tmp="$(mktemp -t "yazi-cwd.XXXXX")" yazi "$@" --cwd-file="$tmp" if cwd="$(cat -- "$tmp")" && [ -n "$cwd" ] && [ "$cwd" != "$PWD" ]; then diff --git a/tests/modules/services/glance/default-settings.nix b/tests/modules/services/glance/default-settings.nix new file mode 100644 index 00000000..7b35db77 --- /dev/null +++ b/tests/modules/services/glance/default-settings.nix @@ -0,0 +1,15 @@ +{ ... }: + +{ + services.glance.enable = true; + + test.stubs.glance = { }; + + nmt.script = '' + configFile=home-files/.config/glance/glance.yml + serviceFile=home-files/.config/systemd/user/glance.service + + assertFileContent $configFile ${./glance-default-config.yml} + assertFileContent $serviceFile ${./glance.service} + ''; +} diff --git a/tests/modules/services/glance/default.nix b/tests/modules/services/glance/default.nix new file mode 100644 index 00000000..893ba651 --- /dev/null +++ b/tests/modules/services/glance/default.nix @@ -0,0 +1,4 @@ +{ + glance-default-settings = ./default-settings.nix; + glance-example-settings = ./example-settings.nix; +} diff --git a/tests/modules/services/glance/example-settings.nix b/tests/modules/services/glance/example-settings.nix new file mode 100644 index 00000000..9e2101d2 --- /dev/null +++ b/tests/modules/services/glance/example-settings.nix @@ -0,0 +1,33 @@ +{ ... }: + +{ + services.glance = { + enable = true; + settings = { + server.port = 5678; + pages = [{ + name = "Home"; + columns = [{ + size = "full"; + widgets = [ + { type = "calendar"; } + { + type = "weather"; + location = "London, United Kingdom"; + } + ]; + }]; + }]; + }; + }; + + test.stubs.glance = { }; + + nmt.script = '' + configFile=home-files/.config/glance/glance.yml + serviceFile=home-files/.config/systemd/user/glance.service + + assertFileContent $configFile ${./glance-example-config.yml} + assertFileContent $serviceFile ${./glance.service} + ''; +} diff --git a/tests/modules/services/glance/glance-default-config.yml b/tests/modules/services/glance/glance-default-config.yml new file mode 100644 index 00000000..024a8964 --- /dev/null +++ b/tests/modules/services/glance/glance-default-config.yml @@ -0,0 +1,6 @@ +pages: +- columns: + - size: full + widgets: + - type: calendar + name: Calendar diff --git a/tests/modules/services/glance/glance-example-config.yml b/tests/modules/services/glance/glance-example-config.yml new file mode 100644 index 00000000..2775916e --- /dev/null +++ b/tests/modules/services/glance/glance-example-config.yml @@ -0,0 +1,10 @@ +pages: +- columns: + - size: full + widgets: + - type: calendar + - location: London, United Kingdom + type: weather + name: Home +server: + port: 5678 diff --git a/tests/modules/services/glance/glance.service b/tests/modules/services/glance/glance.service new file mode 100644 index 00000000..07b82d1d --- /dev/null +++ b/tests/modules/services/glance/glance.service @@ -0,0 +1,9 @@ +[Install] +WantedBy=graphical-session.target + +[Service] +ExecStart=@glance@/bin/dummy --config /home/hm-user/.config/glance/glance.yml + +[Unit] +Description=Glance feed dashboard server +PartOf=graphical-session.target