Merge pull request #102 from blaggacao/da/iso-sd-netboot
host: add deault implementation for system.build.isoImage target (per…
This commit is contained in:
commit
4ae99af29d
6 changed files with 38 additions and 26 deletions
|
@ -170,10 +170,9 @@ nix build ./#homeConfigurations.NixOS.nixos.home.activationPackage
|
||||||
|
|
||||||
## Build an ISO
|
## Build an ISO
|
||||||
|
|
||||||
You can make an ISO and customize it by modifying the [niximg](./hosts/niximg.nix)
|
You can make an ISO out of any config:
|
||||||
file:
|
|
||||||
```sh
|
```sh
|
||||||
flk iso
|
flk iso yourConfig # build an iso for hosts/yourConfig.nix
|
||||||
```
|
```
|
||||||
|
|
||||||
## Hardware Specific Profile for a Single Host
|
## Hardware Specific Profile for a Single Host
|
||||||
|
|
|
@ -60,9 +60,7 @@
|
||||||
|
|
||||||
overlay = import ./pkgs;
|
overlay = import ./pkgs;
|
||||||
|
|
||||||
lib = import ./lib {
|
lib = import ./lib { inherit nixos; };
|
||||||
inherit (nixos) lib;
|
|
||||||
};
|
|
||||||
|
|
||||||
templates.flk.path = ./.;
|
templates.flk.path = ./.;
|
||||||
|
|
||||||
|
|
|
@ -9,14 +9,14 @@
|
||||||
, ...
|
, ...
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
inherit (lib.flk) recImport;
|
inherit (lib.flk) recImport nixosSystemExtended;
|
||||||
inherit (builtins) attrValues removeAttrs;
|
inherit (builtins) attrValues removeAttrs;
|
||||||
|
|
||||||
unstableModules = [ ];
|
unstableModules = [ ];
|
||||||
addToDisabledModules = [ ];
|
addToDisabledModules = [ ];
|
||||||
|
|
||||||
config = hostName:
|
config = hostName:
|
||||||
lib.nixosSystem {
|
nixosSystemExtended {
|
||||||
inherit system;
|
inherit system;
|
||||||
|
|
||||||
specialArgs =
|
specialArgs =
|
||||||
|
|
|
@ -1,13 +0,0 @@
|
||||||
{ unstableModulesPath, ... }: {
|
|
||||||
imports = [
|
|
||||||
# passwd is nixos by default
|
|
||||||
../users/nixos
|
|
||||||
# passwd is empty by default
|
|
||||||
../users/root
|
|
||||||
"${unstableModulesPath}/installer/cd-dvd/iso-image.nix"
|
|
||||||
];
|
|
||||||
|
|
||||||
isoImage.makeEfiBootable = true;
|
|
||||||
isoImage.makeUsbBootable = true;
|
|
||||||
networking.networkmanager.enable = true;
|
|
||||||
}
|
|
|
@ -1,9 +1,9 @@
|
||||||
{ lib, ... }:
|
{ nixos, ... }:
|
||||||
let
|
let
|
||||||
inherit (builtins) attrNames attrValues isAttrs readDir listToAttrs mapAttrs;
|
inherit (builtins) attrNames attrValues isAttrs readDir listToAttrs mapAttrs;
|
||||||
|
|
||||||
inherit (lib) fold filterAttrs hasSuffix mapAttrs' nameValuePair removeSuffix
|
inherit (nixos.lib) fold filterAttrs hasSuffix mapAttrs' nameValuePair removeSuffix
|
||||||
recursiveUpdate genAttrs;
|
recursiveUpdate genAttrs nixosSystem mkForce;
|
||||||
|
|
||||||
# mapFilterAttrs ::
|
# mapFilterAttrs ::
|
||||||
# (name -> value -> bool )
|
# (name -> value -> bool )
|
||||||
|
@ -55,6 +55,34 @@ in
|
||||||
nameValuePair ("") (null))
|
nameValuePair ("") (null))
|
||||||
(readDir dir);
|
(readDir dir);
|
||||||
|
|
||||||
|
nixosSystemExtended = { modules, ... } @ args:
|
||||||
|
nixosSystem (args // {
|
||||||
|
modules =
|
||||||
|
let
|
||||||
|
modpath = "nixos/modules";
|
||||||
|
cd = "installer/cd-dvd/installation-cd-minimal-new-kernel.nix";
|
||||||
|
isoConfig = (nixosSystem
|
||||||
|
(args // {
|
||||||
|
modules = modules ++ [
|
||||||
|
"${nixos}/${modpath}/${cd}"
|
||||||
|
({ config, ... }: {
|
||||||
|
isoImage.isoBaseName = "nixos-" + config.networking.hostName;
|
||||||
|
# confilcts with networking.wireless which might be slightly
|
||||||
|
# more useful on a stick
|
||||||
|
networking.networkmanager.enable = mkForce false;
|
||||||
|
# confilcts with networking.wireless
|
||||||
|
networking.wireless.iwd.enable = mkForce false;
|
||||||
|
})
|
||||||
|
];
|
||||||
|
})).config;
|
||||||
|
in
|
||||||
|
modules ++ [{
|
||||||
|
system.build = {
|
||||||
|
iso = isoConfig.system.build.isoImage;
|
||||||
|
};
|
||||||
|
}];
|
||||||
|
});
|
||||||
|
|
||||||
nixosModules =
|
nixosModules =
|
||||||
let
|
let
|
||||||
# binary cache
|
# binary cache
|
||||||
|
|
|
@ -15,7 +15,7 @@ let
|
||||||
system=${"\${system//\\\"/"}}
|
system=${"\${system//\\\"/"}}
|
||||||
|
|
||||||
if [[ -z "$1" ]]; then
|
if [[ -z "$1" ]]; then
|
||||||
echo "Usage: $(basename "$0") [ iso | up | install {host} | {host} [switch|boot|test] | home {host} {user} [switch] ]"
|
echo "Usage: $(basename "$0") [ up | iso {host} | install {host} | {host} [switch|boot|test] | home {host} {user} [switch] ]"
|
||||||
elif [[ "$1" == "up" ]]; then
|
elif [[ "$1" == "up" ]]; then
|
||||||
mkdir -p $DEVSHELL_ROOT/up
|
mkdir -p $DEVSHELL_ROOT/up
|
||||||
hostname=$(hostname)
|
hostname=$(hostname)
|
||||||
|
@ -27,7 +27,7 @@ let
|
||||||
git add -f $DEVSHELL_ROOT/up/$hostname
|
git add -f $DEVSHELL_ROOT/up/$hostname
|
||||||
git add -f $DEVSHELL_ROOT/hosts/up-$hostname.nix
|
git add -f $DEVSHELL_ROOT/hosts/up-$hostname.nix
|
||||||
elif [[ "$1" == "iso" ]]; then
|
elif [[ "$1" == "iso" ]]; then
|
||||||
nix build $DEVSHELL_ROOT#nixosConfigurations.niximg.${build}.isoImage "${"\${@:2}"}"
|
nix build $DEVSHELL_ROOT#nixosConfigurations.$2.${build}.iso "${"\${@:3}"}"
|
||||||
elif [[ "$1" == "install" ]]; then
|
elif [[ "$1" == "install" ]]; then
|
||||||
sudo nixos-install --flake "$DEVSHELL_ROOT#$2" "${"\${@:3}"}"
|
sudo nixos-install --flake "$DEVSHELL_ROOT#$2" "${"\${@:3}"}"
|
||||||
elif [[ "$1" == "home" ]]; then
|
elif [[ "$1" == "home" ]]; then
|
||||||
|
|
Loading…
Reference in a new issue