about summary refs log tree commit diff
path: root/modules/user/aszlig/profiles/managed.nix
blob: c20fd9aac0bda1aea502eca6adb66b1604ca05de (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
{ pkgs, unfreeAndNonDistributablePkgs, config, lib, ... }:

let
  inherit (lib) mkIf mkEnableOption mkOption;
  cfg = config.vuizvui.user.aszlig.profiles.managed;
  inherit (cfg) mainUser;

in {
  options.vuizvui.user.aszlig.profiles.managed = {
    enable = mkEnableOption "common profile for aszlig's managed machines";
    mainUser = mkOption {
      example = "foobar";
      description = ''
        Main user account of the managed system.
      '';
    };
  };

  config = mkIf cfg.enable {
    vuizvui.system.kernel.bfq.enable = true;

    environment.systemPackages = [ pkgs.simple-scan ];

    nixpkgs.overlays = lib.singleton (lib.const (super: {
      # https://github.com/NixOS/systemd/pull/12
      systemd = super.systemd.overrideDerivation (drv: {
        patches = (drv.patches or []) ++ lib.singleton (pkgs.fetchpatch {
          url = "https://github.com/NixOS/systemd/commit/"
              + "6554550f35a7976f9110aff94743d3576d5f02dd.patch";
          sha256 = "07l6wx0pb7pvjx8n9j0rwv5n260crbrfg5rh56l5nfan6biv81cl";
        });
      }) // { inherit (super.systemd) udev; };
    }));

    # Printing for the most common printers among the managed machines.
    services.printing.enable = true;
    services.printing.drivers = [
      pkgs.gutenprint
      unfreeAndNonDistributablePkgs.hplipWithPlugin
    ];

    # And also most common scanners are also HP ones.
    hardware.sane.enable = true;
    hardware.sane.extraBackends = [
      unfreeAndNonDistributablePkgs.hplipWithPlugin
    ];

    users.users.${mainUser} = {
      isNormalUser = true;
      uid = 1000;
      extraGroups = [ "networkmanager" "scanner" "video" "wheel" ];
    };
  };
}