adoptadopt modular-nixos to stringsWithDeps changes in nixpkgs.
You can boot again. Also simplified some small code pieces svn path=/nixos/branches/modular-nixos/; revision=15668
This commit is contained in:
parent
c2362f1bf1
commit
eb91b27809
@ -229,8 +229,6 @@ in
|
|||||||
let
|
let
|
||||||
inherit (pkgs.stringsWithDeps) noDepEntry fullDepEntry packEntry;
|
inherit (pkgs.stringsWithDeps) noDepEntry fullDepEntry packEntry;
|
||||||
|
|
||||||
activateLib = config.system.activationScripts.lib;
|
|
||||||
|
|
||||||
copyScript = {source, target, mode ? "644", own ? "root.root"}:
|
copyScript = {source, target, mode ? "644", own ? "root.root"}:
|
||||||
assert target != "nixos"; ''
|
assert target != "nixos"; ''
|
||||||
source="${source}"
|
source="${source}"
|
||||||
@ -295,9 +293,9 @@ in
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
'' [
|
'' [
|
||||||
activateLib.systemConfig
|
"systemConfig"
|
||||||
activateLib.defaultPath # path to cp, chmod, chown
|
"defaultPath" # path to cp, chmod, chown
|
||||||
activateLib.stdio
|
"stdio"
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -4,24 +4,15 @@
|
|||||||
let
|
let
|
||||||
inherit (pkgs.stringsWithDeps) textClosureMap noDepEntry;
|
inherit (pkgs.stringsWithDeps) textClosureMap noDepEntry;
|
||||||
inherit (pkgs.lib) mkOption mergeTypedOption mergeAttrs mapRecordFlatten
|
inherit (pkgs.lib) mkOption mergeTypedOption mergeAttrs mapRecordFlatten
|
||||||
mapAttrs addErrorContext fold id;
|
mapAttrs addErrorContext fold id filter;
|
||||||
|
inherit (builtins) attrNames;
|
||||||
|
|
||||||
textClosure = steps:
|
addAttributeName = mapAttrs (a: v: v // {
|
||||||
textClosureMap id steps (
|
|
||||||
[(noDepEntry "#!/bin/sh")]
|
|
||||||
++ (mapRecordFlatten (a: v: v) steps)
|
|
||||||
);
|
|
||||||
|
|
||||||
aggregateScripts = name: steps:
|
|
||||||
pkgs.writeScript name (textClosure steps);
|
|
||||||
|
|
||||||
addAttributeName = mapAttrs (a: v: {
|
|
||||||
text = ''
|
text = ''
|
||||||
#### ${a} begin
|
#### actionScripts snippet ${a} :
|
||||||
|
# ========================================
|
||||||
${v.text}
|
${v.text}
|
||||||
#### ${a} end
|
|
||||||
'';
|
'';
|
||||||
inherit (v) deps;
|
|
||||||
});
|
});
|
||||||
in
|
in
|
||||||
|
|
||||||
@ -47,9 +38,15 @@ in
|
|||||||
'';
|
'';
|
||||||
merge = mergeTypedOption "script" builtins.isAttrs (fold mergeAttrs {});
|
merge = mergeTypedOption "script" builtins.isAttrs (fold mergeAttrs {});
|
||||||
apply = set:
|
apply = set:
|
||||||
let lib = addAttributeName set; in {
|
let withHeadlines = addAttributeName set;
|
||||||
inherit lib; # used to fetch dependencies.
|
activateLib = removeAttrs withHeadlines ["activate"];
|
||||||
script = aggregateScripts "activationScript" lib;
|
activateLibNames = attrNames activateLib;
|
||||||
|
in {
|
||||||
|
script = pkgs.writeScript "activationScript"
|
||||||
|
("#!/bin/sh\n"
|
||||||
|
+ textClosureMap id activateLib activateLibNames + "\n"
|
||||||
|
# make sure that the activate snippet is added last.
|
||||||
|
+ withHeadlines.activate.text);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -76,7 +76,6 @@ let
|
|||||||
inherit (pkgs.stringsWithDeps) noDepEntry fullDepEntry packEntry;
|
inherit (pkgs.stringsWithDeps) noDepEntry fullDepEntry packEntry;
|
||||||
inherit (pkgs.lib) mapRecordFlatten;
|
inherit (pkgs.lib) mapRecordFlatten;
|
||||||
|
|
||||||
activateLib = config.system.activationScripts.lib;
|
|
||||||
in
|
in
|
||||||
|
|
||||||
{
|
{
|
||||||
@ -120,7 +119,7 @@ in
|
|||||||
ln -sfn /proc/self/fd/1 /dev/stdout
|
ln -sfn /proc/self/fd/1 /dev/stdout
|
||||||
ln -sfn /proc/self/fd/2 /dev/stderr
|
ln -sfn /proc/self/fd/2 /dev/stderr
|
||||||
'' [
|
'' [
|
||||||
activateLib.defaultPath # path to ln
|
"defaultPath" # path to ln
|
||||||
];
|
];
|
||||||
|
|
||||||
binsh = fullDepEntry ''
|
binsh = fullDepEntry ''
|
||||||
@ -129,8 +128,8 @@ in
|
|||||||
mkdir -m 0755 -p $mountPoint/bin
|
mkdir -m 0755 -p $mountPoint/bin
|
||||||
ln -sfn ${config.system.build.binsh}/bin/sh $mountPoint/bin/sh
|
ln -sfn ${config.system.build.binsh}/bin/sh $mountPoint/bin/sh
|
||||||
'' [
|
'' [
|
||||||
activateLib.defaultPath # path to ln & mkdir
|
"defaultPath" # path to ln & mkdir
|
||||||
activateLib.stdio # ?
|
"stdio" # ?
|
||||||
];
|
];
|
||||||
|
|
||||||
modprobe = fullDepEntry ''
|
modprobe = fullDepEntry ''
|
||||||
@ -169,7 +168,7 @@ in
|
|||||||
# Empty, read-only home directory of many system accounts.
|
# Empty, read-only home directory of many system accounts.
|
||||||
mkdir -m 0555 -p /var/empty
|
mkdir -m 0555 -p /var/empty
|
||||||
'' [
|
'' [
|
||||||
activateLib.defaultPath # path to mkdir & touch & chmod
|
"defaultPath" # path to mkdir & touch & chmod
|
||||||
];
|
];
|
||||||
|
|
||||||
rootPasswd = fullDepEntry ''
|
rootPasswd = fullDepEntry ''
|
||||||
@ -187,8 +186,8 @@ in
|
|||||||
echo | passwd --stdin root
|
echo | passwd --stdin root
|
||||||
fi
|
fi
|
||||||
'' [
|
'' [
|
||||||
activateLib.defaultPath # path to touch & passwd
|
"defaultPath" # path to touch & passwd
|
||||||
activateLib.etc # for /etc
|
"etc" # for /etc
|
||||||
# ?
|
# ?
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -216,16 +215,14 @@ in
|
|||||||
ln -sf /nix/var/nix/profiles /nix/var/nix/gcroots/
|
ln -sf /nix/var/nix/profiles /nix/var/nix/gcroots/
|
||||||
ln -sf /nix/var/nix/manifests /nix/var/nix/gcroots/
|
ln -sf /nix/var/nix/manifests /nix/var/nix/gcroots/
|
||||||
'' [
|
'' [
|
||||||
activateLib.defaultPath
|
"defaultPath"
|
||||||
activateLib.etc # /etc/nix.conf
|
"etc" # /etc/nix.conf
|
||||||
activateLib.users # nixbld group
|
"users" # nixbld group
|
||||||
];
|
];
|
||||||
|
|
||||||
path = fullDepEntry ''
|
path = fullDepEntry ''
|
||||||
PATH=${config.system.path}/bin:${config.system.path}/sbin:$PATH
|
PATH=${config.system.path}/bin:${config.system.path}/sbin:$PATH
|
||||||
'' [
|
'' [ "defaultPath" ];
|
||||||
activateLib.defaultPath
|
|
||||||
];
|
|
||||||
|
|
||||||
setuid =
|
setuid =
|
||||||
let
|
let
|
||||||
@ -279,10 +276,7 @@ in
|
|||||||
${adjustSetuidOwner}
|
${adjustSetuidOwner}
|
||||||
|
|
||||||
PATH="$save_PATH"
|
PATH="$save_PATH"
|
||||||
'' [
|
'' [ "path" "users" ];
|
||||||
activateLib.path
|
|
||||||
activateLib.users
|
|
||||||
];
|
|
||||||
|
|
||||||
hostname = fullDepEntry ''
|
hostname = fullDepEntry ''
|
||||||
# Set the host name. Don't clear it if it's not configured in the
|
# Set the host name. Don't clear it if it's not configured in the
|
||||||
@ -296,13 +290,11 @@ in
|
|||||||
hostname ""
|
hostname ""
|
||||||
fi
|
fi
|
||||||
''}
|
''}
|
||||||
'' [
|
'' [ "path" ];
|
||||||
activateLib.path
|
|
||||||
];
|
|
||||||
|
|
||||||
# The activation have to be done at the end. Therefore, this entry
|
# The activation has to be done at the end. This is forced at the apply
|
||||||
# depends on all scripts declared in the activation library.
|
# function of activationScripts option
|
||||||
activate = fullDepEntry ''
|
activate = noDepEntry ''
|
||||||
# Make this configuration the current configuration.
|
# Make this configuration the current configuration.
|
||||||
# The readlink is there to ensure that when $systemConfig = /system
|
# The readlink is there to ensure that when $systemConfig = /system
|
||||||
# (which is a symlink to the store), /var/run/current-system is still
|
# (which is a symlink to the store), /var/run/current-system is still
|
||||||
@ -310,11 +302,8 @@ in
|
|||||||
ln -sfn "$(readlink -f "$systemConfig")" /var/run/current-system
|
ln -sfn "$(readlink -f "$systemConfig")" /var/run/current-system
|
||||||
|
|
||||||
# Prevent the current configuration from being garbage-collected.
|
# Prevent the current configuration from being garbage-collected.
|
||||||
ln -sfn /var/run/current-system /nix/var/nix/gcroots/current-system
|
ln -sfn /var/run/current-system /nix/var/nix/gcroots/current-system
|
||||||
'' (mapRecordFlatten (a: v: v)
|
'';
|
||||||
# should be removed if this does not cause an infinite recursion.
|
|
||||||
(activateLib // { activate = { text = ""; deps = []; }; })
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -142,8 +142,6 @@ in
|
|||||||
let
|
let
|
||||||
inherit (pkgs.stringsWithDeps) fullDepEntry;
|
inherit (pkgs.stringsWithDeps) fullDepEntry;
|
||||||
|
|
||||||
activateLib = config.system.activationScripts.lib;
|
|
||||||
|
|
||||||
# keep this extra file so that cat can be used to pass special chars such as "`" which is used in the avahi daemon
|
# keep this extra file so that cat can be used to pass special chars such as "`" which is used in the avahi daemon
|
||||||
usersFile = pkgs.writeText "users" (concatStringsSep "\n" (map serializedUser users));
|
usersFile = pkgs.writeText "users" (concatStringsSep "\n" (map serializedUser users));
|
||||||
in
|
in
|
||||||
@ -202,9 +200,7 @@ in
|
|||||||
--shell "$shell"
|
--shell "$shell"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
'' [
|
'' [ "groups" ];
|
||||||
activateLib.groups
|
|
||||||
];
|
|
||||||
|
|
||||||
groups = fullDepEntry ''
|
groups = fullDepEntry ''
|
||||||
while true; do
|
while true; do
|
||||||
@ -227,12 +223,7 @@ in
|
|||||||
done <<EndOfGroupList
|
done <<EndOfGroupList
|
||||||
${concatStringsSep "\n" (map serializedGroup groups)}
|
${concatStringsSep "\n" (map serializedGroup groups)}
|
||||||
EndOfGroupList
|
EndOfGroupList
|
||||||
'' [
|
'' [ "rootPasswd" "binsh" "etc" "var" ];
|
||||||
activateLib.rootPasswd
|
|
||||||
activateLib.binsh
|
|
||||||
activateLib.etc
|
|
||||||
activateLib.var
|
|
||||||
];
|
|
||||||
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user