nix/pkgs/default: init, add export-config

This commit is contained in:
Astro 2021-03-19 22:11:25 +01:00
parent d2a3d8a3c6
commit ce4bda8862
2 changed files with 33 additions and 10 deletions

View File

@ -15,16 +15,9 @@
lib =
import ./nix/lib { inherit nixpkgs; };
packages = forAllSystems (system: {
test_vm = nixpkgs.legacyPackages.${system}.runCommandLocal "test_vm" {
src = nixosConfigurations.test_vm.config.system.build.toplevel;
} ''
set -x
mkdir -p $out/{bin,dev,etc,home,mnt,nix/store,nix/var,proc,root,run,sys,tmp,var,usr}
ln -s $src/init $out/
ln -s $src/etc $out/etc/static
'';
} // (import ./nix/pkgs/device-templates.nix { inherit self nixpkgs system; }));
packages = forAllSystems (system:
import ./nix/pkgs { inherit self nixpkgs system; }
);
nixosModule = { ... }: {
imports = nixpkgs.lib.filesystem.listFilesRecursive ./nix/nixos-modules;

30
nix/pkgs/default.nix Normal file
View File

@ -0,0 +1,30 @@
{ self, nixpkgs, system }:
let
inherit (self.lib) config;
export-config-file = builtins.toFile "config.nix" (
nixpkgs.lib.generators.toPretty {} config
);
# Debug dump aid
export-config = nixpkgs.legacyPackages.${system}.runCommandLocal "config.nix" {} ''
cp ${export-config-file} $out
'';
test_vm = nixpkgs.legacyPackages.${system}.runCommandLocal "test_vm" {
src = self.nixosConfigurations.test_vm.config.system.build.toplevel;
} ''
set -x
mkdir -p $out/{bin,dev,etc,home,mnt,nix/store,nix/var,proc,root,run,sys,tmp,var,usr}
ln -s $src/init $out/
ln -s $src/etc $out/etc/static
'';
device-templates = import ./device-templates.nix {
inherit self nixpkgs system;
};
in
device-templates // {
inherit export-config test_vm;
}