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>
|
||||
./modules/s6
|
||||
] nixpkgs.pkgs;
|
||||
finalConfig = config // {
|
||||
packages = config.systemPackages ++
|
||||
(builtins.attrValues config.services);
|
||||
};
|
||||
squashfs = liminix.builders.squashfs finalConfig;
|
||||
squashfs = liminix.builders.squashfs config;
|
||||
kernel = callPackage ./kernel {
|
||||
inherit (config.kernel) config;
|
||||
};
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{ lib, pkgs, ...}:
|
||||
{ lib, pkgs, config, ...}:
|
||||
let
|
||||
inherit (lib) mkEnableOption mkOption types isDerivation hasAttr ;
|
||||
inherit (pkgs.pseudofile) dir symlink;
|
||||
|
@ -12,9 +12,13 @@ let
|
|||
|
||||
in {
|
||||
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;
|
||||
};
|
||||
};
|
||||
services = mkOption {
|
||||
type = types.attrsOf type_service;
|
||||
};
|
||||
|
@ -31,6 +35,8 @@ in {
|
|||
};
|
||||
};
|
||||
config = {
|
||||
defaultProfile.packages = with pkgs;
|
||||
[ s6-init-bin busybox execline s6-linux-init s6-rc ];
|
||||
environment = dir {
|
||||
bin = dir {
|
||||
sh = symlink "${busybox}/bin/sh";
|
||||
|
@ -48,7 +54,7 @@ in {
|
|||
etc = dir {
|
||||
profile = symlink
|
||||
(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
|
||||
'');
|
||||
passwd = { file = "root::0:0:root:/:/bin/sh\n"; };
|
||||
|
|
|
@ -8,15 +8,15 @@
|
|||
, writeText
|
||||
} : config :
|
||||
let
|
||||
config-pseudofiles = pseudofile.write "config.etc"
|
||||
(config.environment.contents);
|
||||
pseudofiles =
|
||||
pseudofile.write "config.etc" (config.environment.contents);
|
||||
|
||||
storefs = callPackage <nixpkgs/nixos/lib/make-squashfs.nix> {
|
||||
# add pseudofiles as packages to store so that the packages they
|
||||
# depend on are also added
|
||||
storeContents = [
|
||||
config-pseudofiles
|
||||
] ++ config.packages ;
|
||||
# 1) Every required package is referenced from somewhere
|
||||
# outside /nix/store. 2) Every file outside the store is
|
||||
# specified by config.environment. 3) Therefore, closing over
|
||||
# the pseudofile will give us all the needed packages
|
||||
storeContents = [ pseudofiles ];
|
||||
};
|
||||
in runCommand "frob-squashfs" {
|
||||
nativeBuildInputs = with buildPackages; [ squashfsTools qprint ];
|
||||
|
@ -24,6 +24,6 @@ in runCommand "frob-squashfs" {
|
|||
cp ${storefs} ./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 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
|
||||
''
|
||||
|
|
|
@ -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 ];
|
||||
};
|
||||
|
||||
systemPackages = [ pkgs.hello ] ;
|
||||
defaultProfile.packages = [ pkgs.hello ] ;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue