File tree Expand file tree Collapse file tree 3 files changed +32
-35
lines changed
Expand file tree Collapse file tree 3 files changed +32
-35
lines changed Original file line number Diff line number Diff line change 3232 then l . head meta . tags
3333 else null ,
3434 setup ? [ ] ,
35+ extraSetupLinks ? "" ,
3536 layers ? [ ] ,
3637 runtimeInputs ? [ ] ,
3738 uid ? "65534" ,
4546 setupLinks = cell . ops . mkSetup "links" [ ] ''
4647 mkdir -p $out/bin
4748 ln -s ${ l . getExe entrypoint } $out/bin/entrypoint
49+ ${ extraSetupLinks }
4850 '' ;
4951
52+ root = nixpkgs . buildEnv {
53+ name = "root" ;
54+ paths =
55+ setup
56+ ++ [
57+ # trick `buildEnv` and prevent the $out`/bin` to be a symlink
58+ ( nixpkgs . runCommand "setupDirs" { } "mkdir -p $out/bin" )
59+ setupLinks
60+ ] ;
61+ } ;
62+
5063 image =
5164 l . throwIf ( args ? tag && meta ? tags )
5265 "mkOCI/mkStandardOCI/mkDevOCI: use of `tag` and `meta.tags` arguments are not supported together. Remove the former."
7386 ++ layers ;
7487
7588 maxLayers = 25 ;
76- copyToRoot =
77- [
78- ( nixpkgs . buildEnv {
79- name = "root" ;
80- paths =
81- setup
82- ++ [
83- # trick `buildEnv` and prevent the $out`/bin` to be a symlink
84- ( nixpkgs . runCommand "setupDirs" { }
85- ''
86- mkdir -p $out/bin
87- '' )
88- setupLinks
89- ] ;
90- } )
91- ]
92- ++ options . copyToRoot or [ ] ;
89+ copyToRoot = [ root ] ++ options . copyToRoot or [ ] ;
9390
9491 config = l . recursiveUpdate config {
9592 User = uid ;
9996 } ;
10097
10198 # Setup tasks can include permissions via the passthru.perms attribute
102- perms = l . flatten ( ( l . map ( s : l . optionalAttrs ( s ? passthru && s . passthru ? perms ) s . passthru . perms ) ) setup ) ++ perms ;
99+ perms =
100+ l . flatten ( ( l . map (
101+ s :
102+ l . optionals ( s ? passthru && s . passthru ? perms )
103+ ( l . map ( p : p // { path = root ; } ) s . passthru . perms )
104+ ) )
105+ setup )
106+ ++ perms ;
103107 }
104108 ) ;
105109 in let
Original file line number Diff line number Diff line change 1515 */
1616 name : perms : contents : let
1717 setup = nixpkgs . runCommand "oci-setup-${ name } " { } contents ;
18- perms' = l . map ( p : p // { path = setup ; } ) perms ;
1918 in
2019 setup
21- // l . optionalAttrs ( perms != [ ] ) { passthru . perms = perms' ; }
20+ // l . optionalAttrs ( perms != [ ] ) { passthru = { inherit perms ; } ; }
Original file line number Diff line number Diff line change 7373 else operable ;
7474
7575 inherit ( nixpkgs . dockerTools ) caCertificates ;
76- setupLinks =
77- cell . ops . mkSetup "links" [
78- {
79- regex = "/bin" ;
80- mode = "0555" ;
81- }
82- ] ''
83- mkdir -p $out/bin
84- ${ runtimeEntryLink }
85- ${ debugEntryLink }
86- ${ livenessLink }
87- ${ readinessLink }
88- '' ;
76+ extraSetupLinks = ''
77+ ${ runtimeEntryLink }
78+ ${ debugEntryLink }
79+ ${ livenessLink }
80+ ${ readinessLink }
81+ '' ;
8982
9083 users = cell . ops . mkUser {
9184 inherit uid gid ;
128121 ++ ( l . optionals hasReadinessProbe [ ( nix2container . buildLayer { deps = [ readinessProbe ] ; } ) ] ) ;
129122 } )
130123 ] ;
131- setup = prepend [ setupLinks users nss ] ;
132- options . copyToRoot = append [ tmp caCertificates ] ;
124+ setup = prepend [ users nss caCertificates ] ;
125+ inherit extraSetupLinks ;
126+ options . copyToRoot = append [ tmp ] ;
133127 perms = prepend [
134128 {
135129 path = tmp ;
You can’t perform that action at this time.
0 commit comments