remove reference to /home/colin from modules/persist
This commit is contained in:
parent
77cc560052
commit
ec22c128e0
|
@ -1,18 +1,8 @@
|
||||||
{ config, lib, sane-lib, ... }:
|
{ config, ... }:
|
||||||
|
|
||||||
let
|
let
|
||||||
path = sane-lib.path;
|
|
||||||
cfg = config.sane.persist;
|
cfg = config.sane.persist;
|
||||||
|
|
||||||
withPrefix = relativeTo: entries: lib.mapAttrs' (fspath: value: {
|
|
||||||
name = path.concat [ relativeTo fspath ];
|
|
||||||
inherit value;
|
|
||||||
}) entries;
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
# merge the `byPath` mappings from both `home` and `sys` into one namespace
|
sane.persist.byPath = cfg.sys.byPath;
|
||||||
sane.persist.byPath = lib.mkMerge [
|
|
||||||
(withPrefix "/home/colin" cfg.home.byPath)
|
|
||||||
(withPrefix "/" cfg.sys.byPath)
|
|
||||||
];
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -179,11 +179,6 @@ in
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
description = "define / fs root to be a tmpfs. make sure to mount some other device to /nix";
|
description = "define / fs root to be a tmpfs. make sure to mount some other device to /nix";
|
||||||
};
|
};
|
||||||
sane.persist.home = mkOption {
|
|
||||||
description = "directories to persist to disk, relative to a user's home ~";
|
|
||||||
default = {};
|
|
||||||
type = dirsSubModule;
|
|
||||||
};
|
|
||||||
sane.persist.sys = mkOption {
|
sane.persist.sys = mkOption {
|
||||||
description = "directories to persist to disk, relative to the fs root /";
|
description = "directories to persist to disk, relative to the fs root /";
|
||||||
default = {};
|
default = {};
|
||||||
|
|
|
@ -19,10 +19,10 @@ let
|
||||||
};
|
};
|
||||||
|
|
||||||
persist = mkOption {
|
persist = mkOption {
|
||||||
type = options.sane.persist.home.type;
|
type = options.sane.persist.sys.type;
|
||||||
default = {};
|
default = {};
|
||||||
description = ''
|
description = ''
|
||||||
entries to pass onto `sane.persist.home`
|
entries to pass onto `sane.persist.sys` after prepending the user's home-dir to the path.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -42,13 +42,19 @@ let
|
||||||
# if we're the default user, inherit whatever settings were routed to the default user
|
# if we're the default user, inherit whatever settings were routed to the default user
|
||||||
config = mkIf config.default sane-user-cfg;
|
config = mkIf config.default sane-user-cfg;
|
||||||
});
|
});
|
||||||
processUser = user: defn: {
|
processUser = user: defn:
|
||||||
sane.fs = mapAttrs' (path: value: {
|
let
|
||||||
|
prefixWithHome = mapAttrs' (path: value: {
|
||||||
# TODO: query the user's home dir!
|
# TODO: query the user's home dir!
|
||||||
name = path-lib.concat [ "/home/${user}" path ];
|
name = path-lib.concat [ "/home/${user}" path ];
|
||||||
inherit value;
|
inherit value;
|
||||||
}) defn.fs;
|
});
|
||||||
sane.persist.home = defn.persist;
|
in
|
||||||
|
{
|
||||||
|
sane.fs = prefixWithHome defn.fs;
|
||||||
|
|
||||||
|
# `byPath` is the actual output here, computed from the other keys.
|
||||||
|
sane.persist.sys.byPath = prefixWithHome defn.persist.byPath;
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
|
@ -78,7 +84,7 @@ in
|
||||||
num-default-users = count (u: u.default) (attrValues cfg);
|
num-default-users = count (u: u.default) (attrValues cfg);
|
||||||
take = f: {
|
take = f: {
|
||||||
sane.fs = f.sane.fs;
|
sane.fs = f.sane.fs;
|
||||||
sane.persist = f.sane.persist;
|
sane.persist.sys.byPath = f.sane.persist.sys.byPath;
|
||||||
};
|
};
|
||||||
in mkMerge [
|
in mkMerge [
|
||||||
(take (sane-lib.mkTypedMerge take configs))
|
(take (sane-lib.mkTypedMerge take configs))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user