8000 GitHub - iliana/wrench: 🔧 nix flake for quickly defining NixOS configurations and tests · GitHub
[go: up one dir, main page]

Skip to content
This repository was archived by the owner on May 21, 2023. It is now read-only.
ilianaPublic archive

About

🔧 nix flake for quickly defining NixOS configurations and tests

Resources

Stars

0 stars

Watchers

1 watching

Forks

Latest commit

 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🔧 wrench

wrench is a Nix flake for quickly declaring NixOS configurations with custom packages, and tests to test those configurations.

I haven't written reference documentation yet but you can refer to iliana/nixos-configs for more in-depth usage.

Example

flake.nix:

{
  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-22.11";
    wrench.url = "github:iliana/wrench";
    wrench.inputs.nixpkgs.follows = "nixpkgs";
  };

  outputs = {wrench, ...}:
    wrench.lib.generate {
      packages = system: callPackage: {
        hello = callPackage ./hello.nix {};
      };

      nixosConfigurations.x86_64-linux.ghost = {myPkgs, ...}: {
        environment.systemPackages = [myPkgs.hello];
        system.stateVersion = "22.11";
      };

      checks.x86_64-linux.hello = {
        runTest,
        ghost,
        ...
      }:
        runTest {
          nodes = {
            inherit ghost;
          };

          testScript = ''
            stdout = ghost.succeed("hello")
            assert stdout.strip() == 'Hello, world!'
          '';
        };
    };
}
hello.nix (for completeness)
{pkgs, ...}:
pkgs.writeShellApplication {
  name = "hello";
  text = ''
    echo 'Hello, world!'
  '';
}

About

🔧 nix flake for quickly defining NixOS configurations and tests

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages

0