Coder Social home page Coder Social logo

udev-nix's Introduction

udev-nix

CI

A small utility library to create udev rules with Nix!

For now this is a pet project to improve my Nix knowledge, the API might change in the future.

Don't hesitate to submit changes that will help me to improve the code ๐Ÿค—.

DO NOT USE IN PRODUCTION

ToDo

  • Make test derivations to compare output files
  • Assertions on rule keys according to the implementation
  • Improve API through composition
    • Explain API functions
  • Find a way to test rules on devices (in a VM)
  • Create and expose a NixOS Module
  • Inspire from Disko & notnft
  • Publish library on Links category of NixOS Discourse

Usage

Flakes

Import the flake:

{
  inputs = {
    udev-nix.url = "github:gaelreyrol/udev-nix";
  };
}

Create an udev file:

{
  outputs = inputs@{ nixpkgs, udev-nix, ... }:
  let
    udevLib = udev-nix.lib."x86_64-linux";
  in
  {
    packages.x86_64-linux.myUdevFile = udevLib.mkUdevFile "20-test.rules" {
      rules = with udevLib; {
        "Description on my udev file" = {
          Subsystems = operators.match "usb";
          Tag = operators.add "uaccess";
        };
      };
    };
  };
}

It will produce this result:

$ cat /nix/store/pn8abdgzvafkywdpwzcn09hi0vw8np27-20-test.rules
# Description on my udev file
TAG+="uaccess", SUBSYSTEMS=="usb"

udev-nix's People

Contributors

dependabot[bot] avatar gaelreyrol avatar github-actions[bot] avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.