forked from DGNum/liminix
rename systemPackages as defaultProfile.packages
it doesn't work the same way as in nixos, so don't name it the same way
This commit is contained in:
parent
4cbe669783
commit
696bbe6521
5 changed files with 21 additions and 19 deletions
|
@ -11,11 +11,7 @@ let
|
||||||
<liminix-config>
|
<liminix-config>
|
||||||
./modules/s6
|
./modules/s6
|
||||||
] nixpkgs.pkgs;
|
] nixpkgs.pkgs;
|
||||||
finalConfig = config // {
|
squashfs = liminix.builders.squashfs config;
|
||||||
packages = config.systemPackages ++
|
|
||||||
(builtins.attrValues config.services);
|
|
||||||
};
|
|
||||||
squashfs = liminix.builders.squashfs finalConfig;
|
|
||||||
kernel = callPackage ./kernel {
|
kernel = callPackage ./kernel {
|
||||||
inherit (config.kernel) config;
|
inherit (config.kernel) config;
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{ lib, pkgs, ...}:
|
{ lib, pkgs, config, ...}:
|
||||||
let
|
let
|
||||||
inherit (lib) mkEnableOption mkOption types isDerivation hasAttr ;
|
inherit (lib) mkEnableOption mkOption types isDerivation hasAttr ;
|
||||||
inherit (pkgs.pseudofile) dir symlink;
|
inherit (pkgs.pseudofile) dir symlink;
|
||||||
|
@ -12,9 +12,13 @@ let
|
||||||
|
|
||||||
in {
|
in {
|
||||||
options = {
|
options = {
|
||||||
systemPackages = mkOption {
|
# analogous to nixos systemPackages, but we don't symlink into
|
||||||
|
# /run/current-system, we just add the paths in /etc/profile
|
||||||
|
defaultProfile = {
|
||||||
|
packages = mkOption {
|
||||||
type = types.listOf types.package;
|
type = types.listOf types.package;
|
||||||
};
|
};
|
||||||
|
};
|
||||||
services = mkOption {
|
services = mkOption {
|
||||||
type = types.attrsOf type_service;
|
type = types.attrsOf type_service;
|
||||||
};
|
};
|
||||||
|
@ -31,6 +35,8 @@ in {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
config = {
|
config = {
|
||||||
|
defaultProfile.packages = with pkgs;
|
||||||
|
[ s6-init-bin busybox execline s6-linux-init s6-rc ];
|
||||||
environment = dir {
|
environment = dir {
|
||||||
bin = dir {
|
bin = dir {
|
||||||
sh = symlink "${busybox}/bin/sh";
|
sh = symlink "${busybox}/bin/sh";
|
||||||
|
@ -48,7 +54,7 @@ in {
|
||||||
etc = dir {
|
etc = dir {
|
||||||
profile = symlink
|
profile = symlink
|
||||||
(pkgs.writeScript ".profile" ''
|
(pkgs.writeScript ".profile" ''
|
||||||
PATH=${lib.makeBinPath (with pkgs; [ s6-init-bin busybox execline s6-linux-init s6-rc])}
|
PATH=${lib.makeBinPath config.defaultProfile.packages}
|
||||||
export PATH
|
export PATH
|
||||||
'');
|
'');
|
||||||
passwd = { file = "root::0:0:root:/:/bin/sh\n"; };
|
passwd = { file = "root::0:0:root:/:/bin/sh\n"; };
|
||||||
|
|
|
@ -8,15 +8,15 @@
|
||||||
, writeText
|
, writeText
|
||||||
} : config :
|
} : config :
|
||||||
let
|
let
|
||||||
config-pseudofiles = pseudofile.write "config.etc"
|
pseudofiles =
|
||||||
(config.environment.contents);
|
pseudofile.write "config.etc" (config.environment.contents);
|
||||||
|
|
||||||
storefs = callPackage <nixpkgs/nixos/lib/make-squashfs.nix> {
|
storefs = callPackage <nixpkgs/nixos/lib/make-squashfs.nix> {
|
||||||
# add pseudofiles as packages to store so that the packages they
|
# 1) Every required package is referenced from somewhere
|
||||||
# depend on are also added
|
# outside /nix/store. 2) Every file outside the store is
|
||||||
storeContents = [
|
# specified by config.environment. 3) Therefore, closing over
|
||||||
config-pseudofiles
|
# the pseudofile will give us all the needed packages
|
||||||
] ++ config.packages ;
|
storeContents = [ pseudofiles ];
|
||||||
};
|
};
|
||||||
in runCommand "frob-squashfs" {
|
in runCommand "frob-squashfs" {
|
||||||
nativeBuildInputs = with buildPackages; [ squashfsTools qprint ];
|
nativeBuildInputs = with buildPackages; [ squashfsTools qprint ];
|
||||||
|
@ -24,6 +24,6 @@ in runCommand "frob-squashfs" {
|
||||||
cp ${storefs} ./store.img
|
cp ${storefs} ./store.img
|
||||||
chmod +w store.img
|
chmod +w store.img
|
||||||
mksquashfs - store.img -no-recovery -quiet -no-progress -root-becomes store -p "/ d 0755 0 0"
|
mksquashfs - store.img -no-recovery -quiet -no-progress -root-becomes store -p "/ d 0755 0 0"
|
||||||
mksquashfs - store.img -no-recovery -quiet -no-progress -root-becomes nix -p "/ d 0755 0 0" -pf ${config-pseudofiles}
|
mksquashfs - store.img -no-recovery -quiet -no-progress -root-becomes nix -p "/ d 0755 0 0" -pf ${pseudofiles}
|
||||||
cp store.img $out
|
cp store.img $out
|
||||||
''
|
''
|
||||||
|
|
|
@ -68,5 +68,5 @@ in rec {
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
systemPackages = [ pkgs.hello ] ;
|
defaultProfile.packages = [ pkgs.hello ] ;
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,5 +63,5 @@ in rec {
|
||||||
contents = with services; [ loopback ntp defaultroute4 ];
|
contents = with services; [ loopback ntp defaultroute4 ];
|
||||||
};
|
};
|
||||||
|
|
||||||
systemPackages = [ pkgs.hello ] ;
|
defaultProfile.packages = [ pkgs.hello ] ;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue