Skip to content

Commit

Permalink
support multiple outputs
Browse files Browse the repository at this point in the history
  • Loading branch information
Anillc committed Jul 31, 2022
1 parent dfbd469 commit 4bca407
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 18 deletions.
4 changes: 2 additions & 2 deletions bootstrap/bootstrap.nix
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{ pkgs, callPackage, lib, ... }: let
{ pkgs, callPackage, lib, extraPackages ? [], withFonts ? false, ... }: let
aarch64-pkgs = pkgs.pkgsCross.aarch64-multiplatform;
in

with builtins;
with lib;

let
env = callPackage ./environment {};
env = callPackage ./environment { inherit extraPackages withFonts; };
info = readFile "${pkgs.closureInfo { rootPaths = [ env ]; }}/store-paths";

bootstrap = pkgs.runCommand "bootstrap" {} ''
Expand Down
6 changes: 3 additions & 3 deletions bootstrap/environment/default.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ pkgs, buildEnv, callPackage, lib, inputs }:
{ pkgs, buildEnv, callPackage, lib, inputs, extraPackages ? [], withFonts ? false }:

with builtins;
with lib;
Expand All @@ -16,7 +16,7 @@ in buildEnv {
login env
certs
busybox zip
chromium fonts
nodejs
];
] ++ (optional withFonts fonts)
++ extraPackages;
}
9 changes: 3 additions & 6 deletions bootstrap/environment/fonts.nix
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
{ runCommand, makeFontsConf, noto-fonts, noto-fonts-cjk-sans }: let
{ runCommand, makeFontsConf, source-han-sans }: let
fonts = makeFontsConf {
fontDirectories = [
noto-fonts
noto-fonts-cjk-sans
];
fontDirectories = [ source-han-sans ];
};
in runCommand "etc-fonts" {} ''
mkdir -p $out/etc/fonts
ln -s ${fonts} $out/etc/fonts/fonts.conf
''
''
28 changes: 21 additions & 7 deletions bootstrap/flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,28 @@
})
];
};
aarch64-pkgs = import nixpkgs {
system = "aarch64-linux";
};
in {
packages.bootstrap = pkgs.callPackage ./bootstrap.nix {};
apps.copy = mkApp {
drv = pkgs.writeScriptBin "copy" ''
FOLDER=../app/src/main/assets/bootstrap
mkdir -p $FOLDER
cp -f ${self.packages.${system}.bootstrap}/* $FOLDER
'';
packages = {
bootstrap = pkgs.callPackage ./bootstrap.nix {};
bootstrap-extra = pkgs.callPackage ./bootstrap.nix {
extraPackages = with aarch64-pkgs; [ chromium ];
withFonts = true;
};
};
apps = let
app = bootstrap: mkApp {
drv = pkgs.writeScriptBin "copy" ''
FOLDER=../app/src/main/assets/bootstrap
mkdir -p $FOLDER
cp -f ${bootstrap}/* $FOLDER
'';
};
in {
copy = app self.packages.${system}.bootstrap;
copy-extra = app self.packages.${system}.bootstrap-extra;
};
});
}

0 comments on commit 4bca407

Please sign in to comment.