add vm configuration

This commit is contained in:
Sean Buckley 2021-04-05 23:11:17 -04:00
parent ea4049640b
commit 65da48fac0
4 changed files with 93 additions and 1 deletions

57
flake.lock Normal file
View file

@ -0,0 +1,57 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1617673944,
"narHash": "sha256-0GYlbpsmTvt0jUUM47MfCLqBZBBsOqj1lwo4a/anQfY=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "7d10c949fa3cb4d9f44e6a8017b89f55bf58f07d",
"type": "github"
},
"original": {
"id": "nixpkgs",
"type": "indirect"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs",
"stable2009": "stable2009",
"unstable": "unstable"
}
},
"stable2009": {
"locked": {
"lastModified": 1617542311,
"narHash": "sha256-YbYqpUA8EChwUaUSj8wIukv9ieFQdUnSSm5RypghNBA=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "91b77fe6942fe999b1efbe906dc98024d1917c0d",
"type": "github"
},
"original": {
"id": "nixpkgs",
"ref": "nixos-20.09",
"type": "indirect"
}
},
"unstable": {
"locked": {
"lastModified": 1617082367,
"narHash": "sha256-W0cQPGjc4IVzryaGycuoS8KZkXafS1P23w/fcKLoD5Y=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "04a2b269d8921505a2969fc9ec25c1f517f2b307",
"type": "github"
},
"original": {
"id": "nixpkgs",
"ref": "nixos-unstable",
"type": "indirect"
}
}
},
"root": "root",
"version": 7
}

View file

@ -1,8 +1,12 @@
{
outputs = { self, nixpkgs }: {
inputs.unstable.url = "nixpkgs/nixos-unstable";
inputs.stable2009.url = "nixpkgs/nixos-20.09";
outputs = { self, nixpkgs, ... }@inputs: {
nixosModule = { ... }: {
imports = [ ./. ];
config = { sconfig.flakes.enable = true; };
};
nixosConfigurations = import ./hosts { inherit (inputs) unstable stable2009; };
};
}

View file

@ -0,0 +1,7 @@
{ ... }:
{
networking.hostName = "vm";
sconfig.profile = "server";
boot.loader.grub.device = "/dev/vda";
fileSystems."/" = { device = "/dev/vda1"; fsType = "ext4"; };
}

24
hosts/default.nix Normal file
View file

@ -0,0 +1,24 @@
{ unstable, stable2009 }:
let
mkStandardSystem = { name, pkgs }: pkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
pkgs.nixosModules.notDetected
(./. + "/configuration_${name}.nix")
../.
];
};
mkQemuSystem = { name, pkgs }: pkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
({ modulesPath, ... }: { imports = [ "${modulesPath}/profiles/qemu-guest.nix" ]; })
(./. + "/configuration_${name}.nix")
../.
];
};
in
{
vm = mkQemuSystem { name = "vm"; pkgs = unstable; };
}