mirror of
https://github.com/oqyude/nixos.git
synced 2026-10-07 20:47:14 +03:00
soft coding
This commit is contained in:
+13
-1
@@ -40,6 +40,8 @@ in
|
||||
hostname,
|
||||
type,
|
||||
username ? "oqyude",
|
||||
uid ? 1000,
|
||||
gid ? 1000,
|
||||
}:
|
||||
let
|
||||
device = mkDevice {
|
||||
@@ -47,6 +49,8 @@ in
|
||||
hostname
|
||||
type
|
||||
username
|
||||
uid
|
||||
gid
|
||||
;
|
||||
};
|
||||
in
|
||||
@@ -56,11 +60,19 @@ in
|
||||
hostname
|
||||
type
|
||||
username
|
||||
uid
|
||||
gid
|
||||
;
|
||||
};
|
||||
isDesktop = device.isDesktop;
|
||||
isHeadless = device.isHeadless;
|
||||
dirs = mkDirs username;
|
||||
inherit helpers;
|
||||
# Bind the host's ids into the mount helpers, so ntfs3/exfat options
|
||||
# carry the same uid/gid the primary user actually has.
|
||||
helpers = import ./helpers.nix {
|
||||
inherit lib;
|
||||
uid = device.uid;
|
||||
gid = device.gid;
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -49,6 +49,12 @@ in
|
||||
hostname,
|
||||
type,
|
||||
username ? "oqyude",
|
||||
# The primary user is pinned to 1000 rather than left to NixOS'
|
||||
# nextfree logic: the mount helpers below write uid=/gid= into
|
||||
# ntfs3/exfat options, and an NTFS/exFAT volume mounted with a
|
||||
# different id shows every file as owned by `nobody`.
|
||||
uid ? 1000,
|
||||
gid ? 1000,
|
||||
}:
|
||||
let
|
||||
capabilities = devices.${type} or (throw "xlib: unknown device type '${type}', expected one of ${lib.concatStringsSep ", " (builtins.attrNames devices)}");
|
||||
@@ -58,6 +64,8 @@ in
|
||||
hostname
|
||||
type
|
||||
username
|
||||
uid
|
||||
gid
|
||||
;
|
||||
isDesktop = capabilities.desktop;
|
||||
isHeadless = capabilities.headless;
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
{
|
||||
lib,
|
||||
# The primary user's ids, bound from xlib.device by mkXlib. ntfs3/exfat
|
||||
# volumes carry POSIX ids, so a mount using anything other than the real
|
||||
# uid/gid shows every file as owned by `nobody`.
|
||||
uid,
|
||||
gid,
|
||||
...
|
||||
}:
|
||||
# Pure helper functions for module definitions.
|
||||
@@ -105,8 +110,8 @@ let
|
||||
fsType = "ntfs3";
|
||||
options = [
|
||||
"defaults"
|
||||
"uid=1000"
|
||||
"gid=1000"
|
||||
"uid=${toString uid}"
|
||||
"gid=${toString gid}"
|
||||
"fmask=${mask}"
|
||||
"dmask=${mask}"
|
||||
"nofail"
|
||||
@@ -128,8 +133,8 @@ let
|
||||
fsType = "exfat";
|
||||
options = [
|
||||
"nofail"
|
||||
"uid=1000"
|
||||
"gid=1000"
|
||||
"uid=${toString uid}"
|
||||
"gid=${toString gid}"
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user