Skip to content
This repository has been archived by the owner on Aug 5, 2020. It is now read-only.
/ icebox Public archive

A simple and generic NixOS configuration framework written in pure Nix

License

Notifications You must be signed in to change notification settings

icebox-nix/icebox

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

icebox logo
icebox

A simple and generic NixOS configuration framework written in pure Nix. (currently only on unstable channel)

What it is

  • A plugin toolkit
  • A system configuration setup framework
  • A set of simple Nix expressions

What it is not

  • A plugin/package manager. (It could not handle version and dependencies yet since it is really simple. And I have no intention currently to do it).
  • flake

Installation

Simply use following in your /etc/nixos/configuration.nix:

let
  icebox = builtins.fetchTarball
    "https://github.com/LEXUGE/icebox/archive/master.tar.gz";
in {
  imports = [
    "${icebox}"
    # Other imports
  ];
  # Other settings
}

What are "plugins"

Plugins could be any Nix modules! icebox provides plugins tools to configure per user stuff and abilities of sharing "interface" inter-pluginly, providing functions to other plugins. Also it endows users with uniform experience and ability of doing less. Some typical stuff a plugin could do would be:

  • Provide user a hot fix which could be applied in a multi-user way. Example
  • Provide a configuration pack with overlays for new packages. Example

Writing plugin is easy

Here is an example of a hacky hotfix towards home-manager issue #948. It would be automatically applied to every user defined in icebox.users.users (if it is listed in icebox.users.plugins.

{ config, lib, pkgs, ... }:
let
  iceLib = config.icebox.static.lib;
  cfg = config.icebox.static.users.hm-fix;
in {
  options.icebox.static.users.hm-fix = with lib;
    mkOption {
      type = types.submodule {
        options = {
          enable = mkEnableOption
            "the Desktop Environment falovored by ash"; # If this is off, nothing should be configured at all.

          configs = mkOption {
            type = with types;
              attrsOf (submodule {
                options.enable = mkOption {
                  type = types.bool;
                  default = true;
                  description =
                    "Whether to enable a (hacky) patch plugin for home-manager issue #948.";
                };
              });
            default = { };
          };
        };
      };
      default = { };
    };
  config.systemd.services =
    iceLib.functions.mkUserConfigs (n: c: "home-manager-${n}") (n: c: {
      # Hacky workaround of issue 948 of home-manager
      preStart = ''
        ${pkgs.nix}/bin/nix-env -i -E
      '';
    }) cfg;
}

Security

Plugins are like packages and should go under scrutiny. icebox ensures that if plugin is using functions provided (like iceLib.functions.mkUserConfigs), and it does nothing under enable = false, then this plugin would only take effect if you list it explicitly in the respective plugins option.

Related stuff

  • netkit.nix. Verstile icebox plugins for advanced networking scenarios in NixOS. (I use it heavily, and it works out-of-box!)
  • std. Standard library for icebox.
  • nixos. My personal nixos configuration consisting of icebox plugins only.

About

A simple and generic NixOS configuration framework written in pure Nix

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published