mirror of
https://github.com/nix-community/disko.git
synced 2024-11-04 05:44:29 +03:00
add test for standalone nixos config
This commit is contained in:
parent
65bd5a97f8
commit
68f950bf20
@ -2,7 +2,7 @@
|
|||||||
, pkgs ? import <nixpkgs> {}
|
, pkgs ? import <nixpkgs> {}
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
types = import ./types.nix { inherit pkgs; };
|
types = import ./types.nix { inherit lib pkgs; };
|
||||||
eval = cfg: lib.evalModules {
|
eval = cfg: lib.evalModules {
|
||||||
modules = lib.singleton {
|
modules = lib.singleton {
|
||||||
# _file = toString input;
|
# _file = toString input;
|
||||||
|
@ -1,39 +1,58 @@
|
|||||||
{ pkgs, lib, ... }:
|
{
|
||||||
let
|
pkgs,
|
||||||
disko = import (builtins.fetchGit {
|
lib,
|
||||||
url = "https://github.com/nix-community/disko";
|
...
|
||||||
ref = "master";
|
}: let
|
||||||
}) {
|
# We just import from the repository for testing here:
|
||||||
|
diskoNixos = import ../../. {
|
||||||
inherit lib;
|
inherit lib;
|
||||||
};
|
};
|
||||||
|
disko = import ../../. {
|
||||||
|
inherit lib;
|
||||||
|
inherit pkgs;
|
||||||
|
};
|
||||||
|
# In your own system use something like this:
|
||||||
|
#import (builtins.fetchGit {
|
||||||
|
# url = "https://github.com/nix-community/disko";
|
||||||
|
# ref = "master";
|
||||||
|
#}) {
|
||||||
|
# inherit lib;
|
||||||
|
#};
|
||||||
cfg = {
|
cfg = {
|
||||||
type = "devices";
|
disk = {
|
||||||
content = {
|
|
||||||
sda = {
|
sda = {
|
||||||
type = "table";
|
device = "/dev/sda";
|
||||||
format = "msdos";
|
type = "device";
|
||||||
partitions = [{
|
content = {
|
||||||
type = "partition";
|
type = "table";
|
||||||
part-type = "primary";
|
format = "msdos";
|
||||||
start = "1M";
|
partitions = [
|
||||||
end = "100%";
|
{
|
||||||
bootable = true;
|
name = "root";
|
||||||
content = {
|
type = "partition";
|
||||||
type = "filesystem";
|
part-type = "primary";
|
||||||
format = "ext4";
|
start = "1M";
|
||||||
mountpoint = "/";
|
end = "100%";
|
||||||
};
|
bootable = true;
|
||||||
}];
|
content = {
|
||||||
|
type = "filesystem";
|
||||||
|
format = "ext4";
|
||||||
|
mountpoint = "/";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
in {
|
in {
|
||||||
imports = [
|
imports = [
|
||||||
(disko.config cfg)
|
(diskoNixos.config cfg)
|
||||||
];
|
];
|
||||||
environment.systemPackages = with pkgs;[
|
boot.loader.grub.devices = [ "/dev/sda" ];
|
||||||
|
system.stateVersion = "22.05";
|
||||||
|
environment.systemPackages = with pkgs; [
|
||||||
(pkgs.writeScriptBin "tsp-create" (disko.create cfg))
|
(pkgs.writeScriptBin "tsp-create" (disko.create cfg))
|
||||||
(pkgs.writeScriptBin "tsp-mount" (disko.mount cfg))
|
(pkgs.writeScriptBin "tsp-mount" (disko.mount cfg))
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,6 +20,8 @@ let
|
|||||||
);
|
);
|
||||||
|
|
||||||
allTests = lib.genAttrs (allTestFilenames) (test: import (./. + "/${test}.nix") { inherit makeDiskoTest; }) //
|
allTests = lib.genAttrs (allTestFilenames) (test: import (./. + "/${test}.nix") { inherit makeDiskoTest; }) //
|
||||||
evalTest "lvm-luks-example" ../example/config.nix;
|
evalTest "lvm-luks-example" ../example/config.nix // {
|
||||||
|
standalone = (pkgs.nixos [ ../example/stand-alone/configuration.nix ]).config.system.build.toplevel;
|
||||||
|
};
|
||||||
in
|
in
|
||||||
allTests
|
allTests
|
||||||
|
Loading…
Reference in New Issue
Block a user