147 lines
4.5 KiB
Nix
147 lines
4.5 KiB
Nix
{ host }:
|
|
|
|
{ config, pkgs, ... }:
|
|
let
|
|
m-labs = import (fetchTarball https://nixbld.m-labs.hk/channel/custom/artiq/full/artiq-full/nixexprs.tar.xz) { inherit pkgs; };
|
|
in
|
|
{
|
|
deployment.targetHost = host;
|
|
nix.nixPath = [ "nixpkgs=${pkgs.path}" ];
|
|
|
|
imports =
|
|
[
|
|
(./. + "/${host}-hardware-configuration.nix")
|
|
];
|
|
nixpkgs.config.packageOverrides = super: let self = super.pkgs; in {
|
|
pam_p11 = super.pam_p11.overrideAttrs(oa: {
|
|
patchPhase = oa.patchPhase or "" + ''
|
|
substituteInPlace src/match_openssh.c --replace \
|
|
'"%s/.ssh/authorized_keys", pw->pw_dir)' \
|
|
'"/etc/ssh/authorized_keys.d/%s", pw->pw_name)'
|
|
'';
|
|
});
|
|
};
|
|
|
|
networking.hostName = host;
|
|
networking.firewall.allowedTCPPorts = [ 1883 ];
|
|
|
|
time.timeZone = "Asia/Hong_Kong";
|
|
|
|
# List packages installed in system profile. To search, run:
|
|
# $ nix search wget
|
|
nixpkgs.config.allowUnfree = true;
|
|
environment.systemPackages = with pkgs; [
|
|
opensc yubikey-manager yubikey-manager-qt
|
|
wget vim gitAndTools.gitFull sshfs firefox chromium thunderbird hexchat
|
|
usbutils pciutils uhubctl file lm_sensors audacious acpi
|
|
gimp imagemagick
|
|
(python3.withPackages(ps: with ps; [ numpy scipy matplotlib qtconsole regex ]))
|
|
mosh psmisc libreoffice-fresh
|
|
gtkwave telnet unzip zip gnupg
|
|
gnome3.gnome-tweaks
|
|
jq sublime3 rink qemu_kvm
|
|
tmux xc3sprog m-labs.openocd screen gdb minicom picocom tigervnc
|
|
emacs bat ripgrep
|
|
xpra
|
|
rust-analyzer
|
|
(vscode-with-extensions.override {
|
|
vscodeExtensions = [
|
|
vscode-extensions.matklad.rust-analyzer
|
|
];
|
|
})
|
|
(import ./fish-nix-shell)
|
|
];
|
|
programs.wireshark.enable = true;
|
|
programs.wireshark.package = pkgs.wireshark;
|
|
|
|
services.openssh.enable = true;
|
|
services.openssh.forwardX11 = true;
|
|
services.openssh.passwordAuthentication = false;
|
|
services.openssh.extraConfig =
|
|
''
|
|
StreamLocalBindUnlink yes
|
|
'';
|
|
programs.mosh.enable = true;
|
|
|
|
services.pcscd.enable = true;
|
|
programs.ssh.extraConfig =
|
|
''
|
|
PKCS11Provider "${pkgs.opensc}/lib/opensc-pkcs11.so"
|
|
'';
|
|
programs.ssh.startAgent = true;
|
|
services.gnome3.gnome-keyring.enable = pkgs.lib.mkForce false;
|
|
programs.ssh.agentPKCS11Whitelist = "${pkgs.opensc}/lib/opensc-pkcs11.so";
|
|
security.pam.p11.enable = true;
|
|
|
|
# Enable CUPS to print documents.
|
|
services.printing = {
|
|
enable = true;
|
|
extraConf =
|
|
''
|
|
Browsing Off
|
|
BrowseLocalProtocols none
|
|
'';
|
|
browsedConf =
|
|
''
|
|
BrowseRemoteProtocols none
|
|
BrowseProtocols none
|
|
'';
|
|
};
|
|
services.avahi = {
|
|
enable = true;
|
|
nssmdns = true;
|
|
};
|
|
|
|
# Enable sound.
|
|
sound.enable = true;
|
|
hardware.pulseaudio = {
|
|
enable = true;
|
|
extraModules = [ pkgs.pulseaudio-modules-bt ];
|
|
package = pkgs.pulseaudioFull;
|
|
};
|
|
|
|
i18n.inputMethod = {
|
|
enabled = "fcitx";
|
|
fcitx.engines = with pkgs.fcitx-engines; [ table-extra m17n ];
|
|
};
|
|
fonts.fonts = [ pkgs.noto-fonts pkgs.noto-fonts-cjk pkgs.noto-fonts-emoji pkgs.noto-fonts-extra pkgs.emacs-all-the-icons-fonts ];
|
|
|
|
# Enable the X11 windowing system.
|
|
services.xserver.enable = true;
|
|
services.xserver.layout = "us";
|
|
services.xserver.xkbOptions = "eurosign:e";
|
|
|
|
# Enable touchpad support.
|
|
services.xserver.libinput.enable = true;
|
|
|
|
services.xserver.displayManager.gdm.enable = true;
|
|
services.xserver.displayManager.gdm.autoSuspend = false;
|
|
powerManagement.enable = false;
|
|
services.xserver.desktopManager.gnome3.enable = true;
|
|
environment.gnome3.excludePackages = [ pkgs.epiphany pkgs.gnome3.geary ];
|
|
|
|
hardware.bluetooth.enable = true;
|
|
|
|
programs.fish.enable = true;
|
|
programs.fish.promptInit = ''
|
|
fish-nix-shell --info-right | source
|
|
'';
|
|
users.mutableUsers = false;
|
|
users.defaultUserShell = pkgs.fish;
|
|
users.extraGroups.plugdev = { };
|
|
users.extraUsers = import ./common-users.nix { inherit pkgs; };
|
|
security.sudo.wheelNeedsPassword = false;
|
|
services.udev.packages = [ m-labs.openocd ];
|
|
services.udev.extraRules = (import ./extra-udev.nix);
|
|
|
|
nix.binaryCachePublicKeys = ["nixbld.m-labs.hk-1:5aSRVA5b320xbNvu30tqxVPXpld73bhtOeH6uAjRyHc="];
|
|
nix.binaryCaches = ["https://nixbld.m-labs.hk" "https://cache.nixos.org"];
|
|
nix.sandboxPaths = ["/opt"];
|
|
|
|
# This value determines the NixOS release with which your system is to be
|
|
# compatible, in order to avoid breaking some software such as database
|
|
# servers. You should change this only after NixOS release notes say you
|
|
# should.
|
|
system.stateVersion = "19.03"; # Did you read the comment?
|
|
}
|