Refactor: inject the username into the source path

This commit is contained in:
Oliver Davies 2024-08-20 21:01:07 +01:00
parent ce5b4fa0a1
commit 4d4d65d812
4 changed files with 11 additions and 5 deletions

View file

@ -25,7 +25,12 @@ let
;
};
shared-packages = import "${self}/lib/shared/home-manager-packages.nix" {
inherit desktop inputs pkgs;
inherit
desktop
inputs
pkgs
username
;
};
in
{

View file

@ -2,6 +2,7 @@
desktop,
inputs,
pkgs,
username,
...
}:
let
@ -12,7 +13,7 @@ let
_timer = writeShellApplication (import ./scripts/_timer.nix);
export-video-list = writeShellApplication (
import ./scripts/export-video-list.nix { inherit pkgs; }
import ./scripts/export-video-list.nix { inherit pkgs username; }
);
notetaker = writeShellApplication (import ./scripts/notetaker.nix);
run = writeShellApplication (import ./scripts/run.nix { inherit pkgs; });

View file

@ -1,4 +1,4 @@
{ pkgs, ... }:
{ pkgs, username, ... }:
{
name = "export-video-list";
@ -12,7 +12,7 @@
device_name="/dev/sda2"
device_label="UNTITLED"
source_path="/run/media/opdavies/$device_label"
source_path="/run/media/${username}/$device_label"
# If the source path doesn't exist, try mounting the device.
if [[ ! -d "$source_path" ]]; then

View file

@ -18,7 +18,7 @@ let
};
shared-packages = import "${self}/lib/shared/home-manager-packages.nix" {
inherit inputs pkgs;
inherit inputs pkgs username;
desktop = false;
};
in