Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions modules/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,16 @@ in
type = types.bool;
description = "Enable boot.kernelParams default console configuration";
};

ispPkgs = mkOption {
type = types.listOf types.package;
default = [ ];
description = ''
The list of packages that contain isp files. This
will copy any files in the /nvcam directory to the
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
will copy any files in the /nvcam directory to the
will copy any files in the /nvcam directory of each package to the

/var/nvidia/nvcam directory on the device at boot time.
'';
};
};
};

Expand Down Expand Up @@ -420,6 +430,35 @@ in
wantedBy = [ "multi-user.target" ];
};

systemd.services.isp-setup =
let
ispHash = builtins.hashString "sha256" (builtins.concatStringsSep "\x1f" cfg.ispPkgs);
copyCmd = builtins.concatStringsSep "\n" (builtins.map (pkg: "${lib.getExe' pkgs.coreutils "cp"} -r ${pkg}/nvcam/. /var/nvidia/nvcam") cfg.ispPkgs);
copyISPfiles = pkgs.writeShellScriptBin "copy-isp-files" ''
if [[ -f "/var/nvidia/nvcam/.version" ]]; then
curVersion=$(cat /var/nvidia/nvcam/.version)
if [[ $curVersion == ${ispHash} ]]; then
exit 0
fi
rm -rf /var/nvidia/nvcam
fi

${lib.getExe' pkgs.coreutils "mkdir"} -p /var/nvidia/nvcam
echo ${ispHash} > /var/nvidia/nvcam/.version
${copyCmd}
${lib.getExe' pkgs.coreutils "chmod"} -R 644 /var/nvidia/nvcam
'';
in
mkIf (builtins.length cfg.ispPkgs != 0) {
enable = true;
description = "Copy ISP files to /var/nvidia/nvcam";
serviceConfig = {
Type = "oneshot";
ExecStart = lib.getExe copyISPfiles;
};
wantedBy = [ "multi-user.target" ];
};

systemd.services.tee-supplicant =
let
args = lib.escapeShellArgs (
Expand Down