65 lines
1.9 KiB
Nix
65 lines
1.9 KiB
Nix
{ self, pkgs }:
|
|
let
|
|
lib = pkgs.lib;
|
|
fakePackage = pkgs.runCommand "nix-cache-login-fake-package" { } ''
|
|
mkdir -p "$out/bin"
|
|
touch "$out/bin/nix-cache-login"
|
|
chmod +x "$out/bin/nix-cache-login"
|
|
'';
|
|
|
|
hmStubModule =
|
|
{ lib, ... }:
|
|
{
|
|
options = {
|
|
home.packages = lib.mkOption {
|
|
type = lib.types.listOf lib.types.package;
|
|
default = [ ];
|
|
};
|
|
home.homeDirectory = lib.mkOption {
|
|
type = lib.types.str;
|
|
default = "/home/tester";
|
|
};
|
|
xdg.configHome = lib.mkOption {
|
|
type = lib.types.str;
|
|
default = "/home/tester/.config";
|
|
};
|
|
nix.settings = lib.mkOption {
|
|
type = lib.types.attrsOf lib.types.anything;
|
|
default = { };
|
|
};
|
|
systemd.user.services = lib.mkOption {
|
|
type = lib.types.attrsOf lib.types.anything;
|
|
default = { };
|
|
};
|
|
systemd.user.timers = lib.mkOption {
|
|
type = lib.types.attrsOf lib.types.anything;
|
|
default = { };
|
|
};
|
|
launchd.agents = lib.mkOption {
|
|
type = lib.types.attrsOf lib.types.anything;
|
|
default = { };
|
|
};
|
|
};
|
|
};
|
|
|
|
evalHome =
|
|
extraConfig:
|
|
lib.evalModules {
|
|
modules = [
|
|
hmStubModule
|
|
./home-module.nix
|
|
{
|
|
services.nix-cache-login.enable = true;
|
|
services.nix-cache-login.package = fakePackage;
|
|
}
|
|
extraConfig
|
|
];
|
|
};
|
|
|
|
homeDefault = evalHome { };
|
|
in
|
|
pkgs.runCommand "nix-cache-login-module-checks" { } ''
|
|
test ${lib.escapeShellArg (builtins.toJSON (builtins.hasAttr "netrc-file" homeDefault.config.nix.settings))} = ${lib.escapeShellArg "false"}
|
|
test ${lib.escapeShellArg homeDefault.config.systemd.user.services.nix-cache-login.Service.ExecStart} = ${lib.escapeShellArg "${fakePackage}/bin/nix-cache-login refresh"}
|
|
touch "$out"
|
|
''
|