Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: NixOS/nixpkgs
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 50957910fc3e
Choose a base ref
...
head repository: NixOS/nixpkgs
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: e6b8587b25a1
Choose a head ref
  • 2 commits
  • 1 file changed
  • 2 contributors

Commits on Oct 26, 2020

  1. Unverified

    This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
    Copy the full SHA
    bc35565 View commit details

Commits on Nov 9, 2020

  1. Merge pull request #101755 from rnhmjoj/activation-type

    nixos/activation-script: make scripts well-typed
    rnhmjoj authored Nov 9, 2020

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    e6b8587 View commit details
Showing with 24 additions and 12 deletions.
  1. +24 −12 nixos/modules/system/activation/activation-script.nix
36 changes: 24 additions & 12 deletions nixos/modules/system/activation/activation-script.nix
Original file line number Diff line number Diff line change
@@ -28,6 +28,20 @@ let
utillinux # needed for mount and mountpoint
];

scriptType = with types;
let scriptOptions =
{ deps = mkOption
{ type = types.listOf types.str;
default = [ ];
description = "List of dependencies. The script will run after these.";
};
text = mkOption
{ type = types.lines;
description = "The content of the script.";
};
};
in either str (submodule { options = scriptOptions; });

in

{
@@ -40,16 +54,14 @@ in
default = {};

example = literalExample ''
{ stdio = {
text = '''
# Needed by some programs.
ln -sfn /proc/self/fd /dev/fd
ln -sfn /proc/self/fd/0 /dev/stdin
ln -sfn /proc/self/fd/1 /dev/stdout
ln -sfn /proc/self/fd/2 /dev/stderr
''';
deps = [];
};
{ stdio.text =
'''
# Needed by some programs.
ln -sfn /proc/self/fd /dev/fd
ln -sfn /proc/self/fd/0 /dev/stdin
ln -sfn /proc/self/fd/1 /dev/stdout
ln -sfn /proc/self/fd/2 /dev/stderr
''';
}
'';

@@ -62,7 +74,7 @@ in
idempotent and fast.
'';

type = types.attrsOf types.unspecified; # FIXME
type = types.attrsOf scriptType;

apply = set: {
script =
@@ -125,7 +137,7 @@ in
idempotent and fast.
'';

type = types.attrsOf types.unspecified;
type = with types; attrsOf scriptType;

apply = set: {
script = ''