git.delta.rocks / jrsonnet / refs/commits / d2cec5d37894

difftreelog

refactor move definitions around

Yaroslav Bolyukin2024-08-17parent: #cc4ecd6.patch.diff
in: trunk

32 files changed

modifiedflake.lockdiffbeforeafterboth
66 "url": "https://github.com/NixOS/nixpkgs/archive/5daf0514482af3f97abaefc78a6606365c9108e2.tar.gz"66 "url": "https://github.com/NixOS/nixpkgs/archive/5daf0514482af3f97abaefc78a6606365c9108e2.tar.gz"
67 }67 }
68 },68 },
69 "nixpkgs-stable-for-tests": {
70 "locked": {
71 "lastModified": 1721548954,
72 "narHash": "sha256-7cCC8+Tdq1+3OPyc3+gVo9dzUNkNIQfwSDJ2HSi2u3o=",
73 "owner": "nixos",
74 "repo": "nixpkgs",
75 "rev": "63d37ccd2d178d54e7fb691d7ec76000740ea24a",
76 "type": "github"
77 },
78 "original": {
79 "owner": "nixos",
80 "ref": "nixos-24.05",
81 "repo": "nixpkgs",
82 "type": "github"
83 }
84 },
85 "root": {69 "root": {
86 "inputs": {70 "inputs": {
87 "crane": "crane",71 "crane": "crane",
88 "flake-parts": "flake-parts",72 "flake-parts": "flake-parts",
89 "nixpkgs": "nixpkgs",73 "nixpkgs": "nixpkgs",
90 "nixpkgs-stable-for-tests": "nixpkgs-stable-for-tests",
91 "rust-overlay": "rust-overlay"74 "rust-overlay": "rust-overlay"
92 }75 }
93 },76 },
modifiedflake.nixdiffbeforeafterboth
33
4 inputs = {4 inputs = {
5 nixpkgs.url = "github:nixos/nixpkgs/master";5 nixpkgs.url = "github:nixos/nixpkgs/master";
6 nixpkgs-stable-for-tests.url = "github:nixos/nixpkgs/nixos-24.05";
7 rust-overlay = {6 rust-overlay = {
8 url = "github:oxalica/rust-overlay";7 url = "github:oxalica/rust-overlay";
9 inputs = {8 inputs = {
33 // {32 // {
34 fleetConfiguration = throw "function-based interface is deprecated, use flake-parts syntax instead";33 fleetConfiguration = throw "function-based interface is deprecated, use flake-parts syntax instead";
35 };34 };
36 flakeModules.default = (import ./lib/flakePart.nix {35 flakeModules.default = import ./lib/flakePart.nix {
37 inherit crane;36 inherit crane;
38 });37 };
39 flakeModule = flakeModules.default;38 flakeModule = flakeModules.default;
4039
41 # To be used with https://github.com/NixOS/nix/pull/889240 # To be used with https://github.com/NixOS/nix/pull/8892
92 };91 };
93 # Reference fleet package should be built with nightly rust, specified in rust-toolchain.toml.92 # Reference fleet package should be built with nightly rust, specified in rust-toolchain.toml.
94 packages = lib.mkIf deployerSystem (let93 packages = lib.mkIf deployerSystem (let
95 packages = import ./pkgs {94 packages = pkgs.callPackages ./pkgs {
96 inherit (pkgs) callPackage;
97 inherit craneLib;95 inherit craneLib;
98 };96 };
99 in97 in
121 # fleet-install-secrets will not be built normally, because they are not ran directly by user most of the time.119 # fleet-install-secrets will not be built normally, because they are not ran directly by user most of the time.
122 # checks there build packages for default nixpkgs rustPlatform packages.120 # checks there build packages for default nixpkgs rustPlatform packages.
123 checks = let121 checks = let
124 packages = import ./pkgs {122 packages = pkgs.callPackages ./pkgs {};
125 inherit (pkgs) callPackage;
126 craneLib = crane.mkLib pkgs;
127 };
128 packages-with-nixpkgs-stable = import ./pkgs {
129 inherit (pkgs) callPackage;
130 craneLib = crane.mkLib (import inputs.nixpkgs-stable-for-tests {inherit system;});
131 };
132 prefixAttrs = prefix: attrs:123 prefixAttrs = prefix: attrs:
133 mapAttrs' (name: value: {124 mapAttrs' (name: value: {
134 name = "${prefix}${name}";125 name = "${prefix}${name}";
140 in131 in
141 # `fleet` crate wants nightly rust, also little sense of supporting it on stable nixpkgs.132 # `fleet` crate wants nightly rust, also little sense of supporting it on stable nixpkgs.
142 (prefixAttrs "nixpkgs-" (removeAttrs packages ["fleet"]))133 (prefixAttrs "nixpkgs-" (removeAttrs packages ["fleet"]));
143 // (prefixAttrs "nixpkgs-stable-" (removeAttrs packages-with-nixpkgs-stable ["fleet"]));
144 formatter = pkgs.alejandra;134 formatter = pkgs.alejandra;
145 };135 };
146 };136 };
modifiedlib/default.nixdiffbeforeafterboth
4 inherit (lib.options) mkOption mergeOneOption;4 inherit (lib.options) mkOption mergeOneOption;
5 inherit (lib.modules) mkOverride;5 inherit (lib.modules) mkOverride;
6 inherit (lib.types) listOf submodule attrsOf mkOptionType;6 inherit (lib.types) listOf submodule attrsOf mkOptionType;
7 inherit (lib.strings) optionalString;7 inherit (lib.strings) optionalString hasPrefix removePrefix;
8in rec {8in rec {
9 types = {9 types = {
10 overlay = mkOptionType {10 overlay = mkOptionType {
16 listOfOverlay = listOf types.overlay;16 listOfOverlay = listOf types.overlay;
1717
18 mkHostsType = module: attrsOf (submodule module);18 mkHostsType = module: attrsOf (submodule module);
19 mkDataType = module: submodule module;
19 };20 };
2021
21 options = {22 options = {
22 mkHostsOption = module:23 mkHostsOption = module:
23 mkOption {24 mkOption {
24 type = types.mkHostsType module;25 type = types.mkHostsType module;
25 };26 };
27 mkDataOption = module:
28 mkOption {
29 type = types.mkDataType module;
30 };
26 };31 };
2732
28 inherit (options) mkHostsOption;33 inherit (options) mkHostsOption;
119124
120 inherit (secrets) mkPassword mkEd25519 mkX25519 mkRsa mkBytes mkHexBytes mkBase64Bytes;125 inherit (secrets) mkPassword mkEd25519 mkX25519 mkRsa mkBytes mkHexBytes mkBase64Bytes;
126
127 strings = let
128 plaintextPrefix = "<PLAINTEXT>";
129 plaintextNewlinePrefix = "<PLAINTEXT-NL>";
130 in {
131 decodeRawSecret = raw:
132 if hasPrefix plaintextPrefix raw
133 then removePrefix plaintextPrefix raw
134 else if hasPrefix plaintextNewlinePrefix raw
135 then removePrefix plaintextNewlinePrefix raw
136 else throw "decodeRawSecret only works with plaintext-encoded secret public parts, got ${raw}";
137 };
138
139 inherit (strings) decodeRawSecret;
121}140}
122141
modifiedlib/flakePart.nixdiffbeforeafterboth
7 inherit (lib.options) mkOption;7 inherit (lib.options) mkOption;
8 inherit (lib.attrsets) mapAttrs;8 inherit (lib.attrsets) mapAttrs;
9 inherit (lib.types) lazyAttrsOf deferredModule unspecified;9 inherit (lib.types) lazyAttrsOf deferredModule unspecified;
10 inherit (lib.strings) isPath;
10 inherit (fleetLib.options) mkHostsOption;11 inherit (fleetLib.options) mkHostsOption;
11in {12in {
12 options.fleetModules = mkOption {13 options.fleetModules = mkOption {
36 bootstrapNixpkgs = bootstrapEval.config.nixpkgs.buildUsing;37 bootstrapNixpkgs = bootstrapEval.config.nixpkgs.buildUsing;
37 normalEval = bootstrapNixpkgs.lib.evalModules {38 normalEval = bootstrapNixpkgs.lib.evalModules {
38 modules =39 modules =
39 (import ../modules/fleet/_modules.nix)40 (import ../modules/module-list.nix)
40 ++ [41 ++ [
41 data
42 module42 module
43 {43 {
44 options.hosts = mkHostsOption {44 options.hosts = mkHostsOption {
45 nixos.nixpkgs.overlays = [45 nixos.nixpkgs.overlays = [
46 (final: prev: {46 (final: prev:
47 # FIXME: make this name not conflicting47 import ../pkgs {
48 inherit (prev) callPackage;
48 craneLib = crane.mkLib prev;49 craneLib = crane.mkLib prev;
49 })50 })
50 ];51 ];
51 };52 };
53 config = {
54 data =
55 if isPath data
56 then import data
57 else data;
58 };
52 }59 }
53 ];60 ];
54 specialArgs.fleetLib = import ../lib {61 specialArgs.fleetLib = import ../lib {
addedmodules/assertions.nixdiffbeforeafterboth

no changes

deletedmodules/fleet/_modules.nixdiffbeforeafterboth

no changes

deletedmodules/fleet/assertions.nixdiffbeforeafterboth

no changes

deletedmodules/fleet/fleetLib.nixdiffbeforeafterboth

no changes

deletedmodules/fleet/hosts.nixdiffbeforeafterboth

no changes

deletedmodules/fleet/meta.nixdiffbeforeafterboth

no changes

deletedmodules/fleet/nixos.nixdiffbeforeafterboth

no changes

deletedmodules/fleet/nixpkgs.nixdiffbeforeafterboth

no changes

deletedmodules/fleet/secrets.nixdiffbeforeafterboth

no changes

addedmodules/fleetLib.nixdiffbeforeafterboth

no changes

addedmodules/hosts.nixdiffbeforeafterboth

no changes

addedmodules/meta.nixdiffbeforeafterboth

no changes

addedmodules/module-list.nixdiffbeforeafterboth

no changes

addedmodules/nixos.nixdiffbeforeafterboth

no changes

addedmodules/nixos/meta.nixdiffbeforeafterboth

no changes

addedmodules/nixos/module-list.nixdiffbeforeafterboth

no changes

addedmodules/nixos/nix-sign.nixdiffbeforeafterboth

no changes

addedmodules/nixos/rollback.nixdiffbeforeafterboth

no changes

addedmodules/nixos/secrets.nixdiffbeforeafterboth

no changes

addedmodules/nixpkgs.nixdiffbeforeafterboth

no changes

addedmodules/secrets-data.nixdiffbeforeafterboth

no changes

addedmodules/secrets.nixdiffbeforeafterboth

no changes

deletednixos/assertions.nixdiffbeforeafterboth

no changes

deletednixos/meta.nixdiffbeforeafterboth

no changes

deletednixos/modules/module-list.nixdiffbeforeafterboth

no changes

deletednixos/nix-sign.nixdiffbeforeafterboth

no changes

deletednixos/rollback.nixdiffbeforeafterboth

no changes

deletednixos/secrets.nixdiffbeforeafterboth

no changes