diff options
| author | tv <tv@krebsco.de> | 2026-11-14 00:27:45 +0000 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-11-14 01:46:01 +0100 |
| commit | a4540a584d762b000b21cb7e61987c414eb72a1d (patch) | |
| tree | 077bb7dfc4d104e5e133ad96c4485ff99bcd14c5 /lib/types/populate.nix | |
| parent | 8f08426ae3a2e5f0ecc5d010bc6469b41e3d7678 (diff) | |
populate: layer populate below krops
populate is a program of its own, with a Nix library, in pkgs/populate,
which krops uses, and which doesn't use krops:
- default.nix builds the program, with nix-build there or callPackage,
as pkgs.populate-unwrapped.
- lib is populate's Nix library: the types of sources and the POSIX
types they use, evalSource, flakeFollows, hasGeneratedFlake, and
derivesFlake, taking nixpkgs' lib. krops' lib takes them from there,
so it provides them as before, and so does lib/types.
pkgs.populate, the function from populate's arguments to a script
running the program, is krops' own, in pkgs/krops/populate.nix, with
checks.nix next to it. It takes the program as populate-unwrapped,
which callPackage passes from the overlay; the flake, whose nixpkgs
lacks it, passes its own.
Diffstat (limited to 'lib/types/populate.nix')
| -rw-r--r-- | lib/types/populate.nix | 323 |
1 files changed, 0 insertions, 323 deletions
diff --git a/lib/types/populate.nix b/lib/types/populate.nix deleted file mode 100644 index 56b0292..0000000 --- a/lib/types/populate.nix +++ /dev/null @@ -1,323 +0,0 @@ -{ lib }: rec { - - source = lib.types.submodule ({ config, ... }: { - options = { - type = let - known-types = lib.attrNames source-types; - type-candidates = lib.filter (k: config.${k} != null) known-types; - in lib.mkOption { - default = if lib.length type-candidates == 1 - then lib.head type-candidates - else throw "cannot determine type"; - type = lib.types.enum known-types; - }; - derivation = lib.mkOption { - apply = x: - if lib.types.str.check x - then { text = x; } - else x; - default = null; - type = lib.types.nullOr (lib.types.either lib.types.str source-types.derivation); - }; - file = lib.mkOption { - apply = x: - if lib.types.absolute-pathname.check x || lib.types.package.check x - then { path = x; } - else x; - default = null; - type = lib.types.nullOr (lib.types.oneOf [ - lib.types.absolute-pathname - lib.types.package - source-types.file - ]); - }; - flake = lib.mkOption { - apply = x: - if lib.types.str.check x - then { url = x; } - else x; - default = null; - type = lib.types.nullOr (lib.types.either lib.types.str source-types.flake); - }; - flake-input = lib.mkOption { - default = null; - type = lib.types.nullOr source-types.flake-input; - }; - git = lib.mkOption { - default = null; - type = lib.types.nullOr source-types.git; - }; - pass = lib.mkOption { - default = null; - type = lib.types.nullOr source-types.pass; - }; - passage = lib.mkOption { - apply = x: - if lib.types.pathname.check x - then { dir = x; } - else x; - default = null; - type = lib.types.nullOr (lib.types.oneOf [ - lib.types.pathname - source-types.passage - ]); - }; - pipe = lib.mkOption { - apply = x: - if lib.types.absolute-pathname.check x - then { command = x; } - else x; - default = null; - type = lib.types.nullOr (lib.types.either lib.types.absolute-pathname source-types.pipe); - }; - symlink = lib.mkOption { - apply = x: - if lib.types.pathname.check x - then { target = x; } - else x; - default = null; - type = lib.types.nullOr (lib.types.either lib.types.pathname source-types.symlink); - }; - }; - }); - - # Inputs of the flake in a source that get drawn from other sources, in the - # style of flake.nix, e.g. { nixpkgs.follows = "nixpkgs"; }. - flake-inputs = lib.types.attrsOf (lib.types.submodule { - options = { - follows = lib.mkOption { - default = null; - type = lib.types.nullOr lib.types.str; # TODO lib.types.label - }; - inputs = lib.mkOption { - default = {}; - type = flake-inputs; - }; - }; - }); - - filter = lib.types.submodule { - options = { - type = lib.mkOption { - type = lib.types.enum ["include" "exclude"]; - default = "exclude"; - }; - pattern = lib.mkOption { - type = lib.types.str; - }; - }; - }; - - source-types = { - derivation = lib.types.submodule { - options = { - text = lib.mkOption { - type = lib.types.str; - }; - }; - }; - file = lib.types.submodule { - options = { - inputs = lib.mkOption { - default = {}; - type = flake-inputs; - }; - path = lib.mkOption { - type = lib.types.absolute-pathname; - }; - rewriteLock = lib.mkOption { - default = true; - type = lib.types.bool; - }; - useChecksum = lib.mkOption { - default = false; - type = lib.types.bool; - }; - exclude = lib.mkOption { - apply = x: - if x != [] then - lib.warn - "file.*.exclude is deprecated in favor of file.*.filters" - x - else - x; - description = '' - DEPRECATED, use `filters`. - ''; - type = lib.types.listOf lib.types.str; - default = []; - example = [".git"]; - }; - filters = lib.mkOption { - type = lib.types.listOf filter; - default = []; - example = [ - { - type = "include"; - pattern = "*.nix"; - } - { - type = "include"; - pattern = "*/"; - } - { - type = "exclude"; - pattern = "*"; - } - ]; - }; - deleteExcluded = lib.mkOption { - default = true; - type = lib.types.bool; - }; - insecureLinks = lib.mkOption { - default = null; - type = lib.types.nullOr lib.types.bool; - }; - }; - }; - flake = lib.types.submodule { - options = { - fetchOnTarget = lib.mkOption { - default = false; - type = lib.types.bool; - }; - url = lib.mkOption { - type = lib.types.str; # TODO lib.types.flake-ref - }; - inputs = lib.mkOption { - default = {}; - type = flake-inputs; - }; - materialize = lib.mkOption { - default = false; - type = lib.types.bool; - }; - patches = lib.mkOption { - apply = map toString; - default = []; - type = lib.types.listOf lib.types.path; - }; - rewriteLock = lib.mkOption { - default = true; - type = lib.types.bool; - }; - }; - }; - flake-input = lib.types.submodule { - options = { - fetchOnTarget = lib.mkOption { - default = false; - type = lib.types.bool; - }; - url = lib.mkOption { - type = lib.types.str; # TODO lib.types.flake-ref - }; - inputs = lib.mkOption { - default = {}; - type = flake-inputs; - }; - materialize = lib.mkOption { - default = false; - type = lib.types.bool; - }; - patches = lib.mkOption { - apply = map toString; - default = []; - type = lib.types.listOf lib.types.path; - }; - rewriteLock = lib.mkOption { - default = true; - type = lib.types.bool; - }; - name = lib.mkOption { - type = lib.types.str; - }; - requireInputs = lib.mkOption { - default = true; - type = lib.types.bool; - }; - }; - }; - git = lib.types.submodule { - options = { - clean = { - exclude = lib.mkOption { - default = []; - type = lib.types.listOf lib.types.str; - }; - }; - fetchAlways = lib.mkOption { - type = lib.types.bool; - default = false; - }; - inputs = lib.mkOption { - default = {}; - type = flake-inputs; - }; - ref = lib.mkOption { - type = lib.types.str; # TODO lib.types.git.ref - }; - reclone = lib.mkOption { - default = false; - type = lib.types.bool; - }; - rewriteLock = lib.mkOption { - default = true; - type = lib.types.bool; - }; - url = lib.mkOption { - type = lib.types.str; # TODO lib.types.git.url - }; - shallow = lib.mkOption { - default = false; - type = lib.types.bool; - }; - }; - }; - pass = lib.types.submodule { - options = { - dir = lib.mkOption { - type = lib.types.absolute-pathname; - }; - name = lib.mkOption { - type = lib.types.pathname; # TODO relative-pathname - }; - }; - }; - passage = lib.types.submodule { - options = { - age = lib.mkOption { - default = "age"; - type = lib.types.pathname; - }; - dir = lib.mkOption { - type = lib.types.pathname; - }; - identities_file = lib.mkOption { - default = toString ~/.passage/identities; - type = lib.types.pathname; - }; - }; - }; - pipe = lib.types.submodule { - options = { - command = lib.mkOption { - type = lib.types.absolute-pathname; - }; - }; - }; - symlink = lib.types.submodule { - options = { - inputs = lib.mkOption { - default = {}; - type = flake-inputs; - }; - target = lib.mkOption { - type = lib.types.pathname; # TODO relative-pathname - }; - }; - }; - }; - -} |
