Turn nixos-shell vm into an integration test importing a module

This commit is contained in:
Tim Van Baak 2023-06-05 14:52:51 -07:00
parent 66b818dcf7
commit 862e555516
4 changed files with 57 additions and 4 deletions

21
flake.lock generated
View File

@ -16,6 +16,26 @@
"type": "github"
}
},
"nixos-shell": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1683035198,
"narHash": "sha256-5hHkokfSY3Z4VqjNm/j564l9Bgynw5H5McX0hTruGoI=",
"owner": "Mic92",
"repo": "nixos-shell",
"rev": "2cb76875e501eccb012625546864dd0085750843",
"type": "github"
},
"original": {
"owner": "Mic92",
"repo": "nixos-shell",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1669833724,
@ -35,6 +55,7 @@
"root": {
"inputs": {
"flake-compat": "flake-compat",
"nixos-shell": "nixos-shell",
"nixpkgs": "nixpkgs"
}
}

View File

@ -3,14 +3,20 @@
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/22.11";
# Included to support default.nix and shell.nix
flake-compat = {
url = "github:edolstra/flake-compat";
flake = false;
};
# Included to support the integration test in tests/demo.nix
nixos-shell.url = "github:Mic92/nixos-shell";
nixos-shell.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = { self, nixpkgs, flake-compat }:
let system = "x86_64-linux";
outputs = { self, nixpkgs, flake-compat, nixos-shell }:
let
inherit (nixpkgs.lib) makeOverridable nixosSystem;
system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages.${system};
in {
packages.${system} = {
@ -38,5 +44,16 @@
path = builtins.path { path = ./template; name = "source"; };
description = "A basic intake source config";
};
nixosModules.intake = import ./module.nix self;
nixosConfigurations."demo" = makeOverridable nixosSystem {
inherit system;
modules = [
nixos-shell.nixosModules.nixos-shell
self.nixosModules.intake
./tests/demo.nix
];
};
};
}

13
module.nix Normal file
View File

@ -0,0 +1,13 @@
flake: { config, lib, pkgs, ... }:
let
inherit (lib) mkIf mkOption types;
cfg = config.services.intake;
in {
options = {
};
config = {
};
}

View File

@ -1,5 +1,7 @@
{ pkgs, ... }: {
boot.kernelPackages = pkgs.linuxPackages_latest;
{ pkgs, ... }:
{
system.stateVersion = "22.11";
nixos-shell.mounts = {
mountHome = false;