summaryrefslogtreecommitdiff
path: root/modules/misc
diff options
context:
space:
mode:
authorMalo Bourgon <mbourgon@gmail.com>2022-08-13 19:18:48 -0700
committerMalo Bourgon <mbourgon@gmail.com>2022-08-16 10:41:51 -0700
commit7e74c1c9fbb19638d95933b8bcac1757a184519e (patch)
treed5e822c0a9aa7f799c594576cc6dd8cfeca90126 /modules/misc
parentf88286eda079b404da179efa86b907b166b878e3 (diff)
Move build user options to `nix` module to improve overlap with NixOS
Also add `config.ids` like in NixOS.
Diffstat (limited to 'modules/misc')
-rw-r--r--modules/misc/ids.nix50
1 files changed, 50 insertions, 0 deletions
diff --git a/modules/misc/ids.nix b/modules/misc/ids.nix
new file mode 100644
index 0000000..07f1240
--- /dev/null
+++ b/modules/misc/ids.nix
@@ -0,0 +1,50 @@
+# Based on: https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/misc/ids.nix
+
+# This module defines the global list of uids and gids. We keep a
+# central list to prevent id collisions.
+
+# IMPORTANT!
+# We only add static uids and gids for services where it is not feasible
+# to change uids/gids on service start, in example a service with a lot of
+# files.
+
+{ lib, ... }:
+
+let
+ inherit (lib) types;
+in
+{
+ options = {
+
+ ids.uids = lib.mkOption {
+ internal = true;
+ description = ''
+ The user IDs used in NixOS.
+ '';
+ type = types.attrsOf types.int;
+ };
+
+ ids.gids = lib.mkOption {
+ internal = true;
+ description = ''
+ The group IDs used in NixOS.
+ '';
+ type = types.attrsOf types.int;
+ };
+
+ };
+
+
+ config = {
+
+ ids.uids = {
+ nixbld = 300;
+ };
+
+ ids.gids = {
+ nixbld = 30000;
+ };
+
+ };
+
+}