File tree Expand file tree Collapse file tree 3 files changed +41
-7
lines changed
Expand file tree Collapse file tree 3 files changed +41
-7
lines changed Original file line number Diff line number Diff line change 11#! /usr/bin/env nix-shell
2- #! nix-shell -i bash -p git nh nixfmt-rfc-style rsync
2+ #! nix-shell -i bash -p git jq jsonfmt nh nixfmt-rfc-style rsync
33
44ICEDOS_DIR=" /tmp/icedos"
55CONFIG=" $ICEDOS_DIR /configuration-location"
@@ -23,6 +23,10 @@ while [[ $# -gt 0 ]]; do
2323 action=" build"
2424 shift
2525 ;;
26+ --export-full-config)
27+ export_full_config=1
28+ shift
29+ ;;
2630 --update)
2731 update=" 1"
2832 update_repos=" 1"
@@ -100,6 +104,13 @@ nixfmt "$FLAKE"
100104rm $ICEDOS_FLAKE_INPUTS
101105unset ICEDOS_FLAKE_INPUTS
102106
107+ if [ " $export_full_config " == " 1" ]; then
108+ ICEDOS_STAGE=" genflake" nix eval $trace --file " ./lib/genflake.nix" evaluatedConfig | nixfmt | jq -r . > full-config.json
109+ jsonfmt ./full-config.json -w
110+ echo " Full config saved at $PWD /full-config.json"
111+ exit 0
112+ fi
113+
103114[ " $update " == " 1" ] && nix flake update
104115
105116# Make a tmp folder and build from there
Original file line number Diff line number Diff line change 11let
2- inherit ( builtins ) getEnv readFile ;
3- inherit ( ( fromTOML ( readFile ../config.toml ) ) ) icedos ;
2+ inherit ( builtins ) getEnv readFile toJSON ;
3+ config = ( fromTOML ( readFile ../config.toml ) ) ;
4+ inherit ( config ) icedos ;
45
56 system = icedos . system . arch or "x86_64-linux" ;
67 pkgs = import <nixpkgs> { inherit system ; } ;
1011 boolToString
1112 concatMapStrings
1213 concatStringsSep
14+ evalModules
1315 fileContents
16+ foldl'
1417 listToAttrs
1518 map
1619 pathExists
20+ recursiveUpdate
1721 ;
1822
1923 icedosLib = import ../lib {
6064 ) ;
6165
6266 nixosModulesText = modulesFromConfig . nixosModulesText ;
67+
68+ evaluatedConfig =
69+ toJSON
70+ ( evalModules {
71+ modules = [
72+ {
73+ inherit config ;
74+
75+ options =
76+ let
77+ mergedOptions =
78+ foldl' ( acc : cur : recursiveUpdate acc cur . options )
79+ ( import ../modules/options.nix { inherit icedosLib lib ; } ) . options
80+ modulesFromConfig . options ;
81+ in
82+ mergedOptions ;
83+ }
84+ ] ;
85+ } ) . config ;
6386in
6487{
65- inherit flakeInputs ;
88+ inherit flakeInputs evaluatedConfig ;
6689
6790 flakeFinal = ''
6891 {
Original file line number Diff line number Diff line change 1919 options = {
2020 icedos = {
2121 system = {
22- arch = mkStrOption { } ;
22+ arch = mkStrOption { default = "x86_64-linux" ; } ;
2323
2424 channels = mkSubmoduleListOption { default = [ ] ; } {
2525 name = mkStrOption { } ;
3434
3535 repositories = mkSubmoduleListOption { } {
3636 url = mkStrOption { } ;
37- fetchOptionalDependencies = mkBoolOption { } ;
38- modules = mkStrListOption { } ;
37+ fetchOptionalDependencies = mkBoolOption { default = false ; } ;
38+ modules = mkStrListOption { default = [ ] ; } ;
3939 } ;
4040 } ;
4141 } ;
You can’t perform that action at this time.
0 commit comments