174 lines
4.9 KiB
Nix
174 lines
4.9 KiB
Nix
{ host }:
|
|
|
|
{ config, pkgs, ... }:
|
|
let
|
|
artiq = builtins.getFlake git+https://github.com/m-labs/artiq.git;
|
|
in
|
|
{
|
|
deployment.targetHost = host;
|
|
deployment.hasFastConnection = true;
|
|
nix.nixPath = [ "nixpkgs=${pkgs.path}" ];
|
|
programs.command-not-found.dbPath = "${pkgs.path}/programs.sqlite";
|
|
|
|
boot.loader.systemd-boot.memtest86.enable = true;
|
|
boot.loader.grub.memtest86.enable = true;
|
|
boot.kernel.sysctl."kernel.dmesg_restrict" = false;
|
|
|
|
imports =
|
|
[
|
|
(./. + "/${host}-hardware-configuration.nix")
|
|
];
|
|
nixpkgs.config.packageOverrides = super: {
|
|
libp11 = super.libp11.override({ openssl = super.openssl_1_1; });
|
|
pam_p11 = super.pam_p11.overrideAttrs(oa: {
|
|
patches = [];
|
|
postPatch = ''
|
|
substituteInPlace src/match_openssh.c --replace \
|
|
'"%s/.ssh/authorized_keys", pw->pw_dir)' \
|
|
'"/etc/ssh/authorized_keys.d/%s", pw->pw_name)'
|
|
'';
|
|
});
|
|
};
|
|
nixpkgs.config.permittedInsecurePackages = [
|
|
"openssl-1.1.1w"
|
|
];
|
|
|
|
boot.binfmt.emulatedSystems = [ "armv7l-linux" ];
|
|
|
|
networking.hostName = host;
|
|
networking.firewall.enable = false;
|
|
|
|
time.timeZone = "Asia/Hong_Kong";
|
|
|
|
# List packages installed in system profile. To search, run:
|
|
# $ nix search wget
|
|
environment.systemPackages = with pkgs; [
|
|
opensc
|
|
wget vim gitFull sshfs
|
|
thunderbird
|
|
chromium
|
|
librewolf
|
|
usbutils pciutils uhubctl file lm_sensors audacious acpi
|
|
gimp imagemagick
|
|
(python3.withPackages(ps: with ps; [ numpy scipy matplotlib qtconsole regex jinja2 ]))
|
|
texlive.combined.scheme-full
|
|
mosh psmisc libreoffice-fresh
|
|
inkscape
|
|
xournalpp
|
|
gtkwave unzip zip gnupg
|
|
gnome-tweaks
|
|
ghex
|
|
jq rink qemu_kvm
|
|
tmux screen gdb minicom picocom
|
|
artiq.packages.x86_64-linux.openocd-bscanspi
|
|
xc3sprog
|
|
gqrx
|
|
emacs bat ripgrep
|
|
guake
|
|
vscodium
|
|
gnome-builder
|
|
waypipe
|
|
virt-manager spice-gtk
|
|
kicad
|
|
any-nix-shell
|
|
];
|
|
programs.firefox.enable = true;
|
|
programs.firefox.autoConfig =
|
|
''
|
|
lockPref("browser.ml.enable", false);
|
|
lockPref("browser.ml.chat.enabled", false);
|
|
'';
|
|
programs.wireshark.enable = true;
|
|
programs.wireshark.package = pkgs.wireshark;
|
|
virtualisation.libvirtd.enable = true;
|
|
security.wrappers.spice-client-glib-usb-acl-helper = {
|
|
source = "${pkgs.spice-gtk}/bin/spice-client-glib-usb-acl-helper";
|
|
owner = "root";
|
|
group = "root";
|
|
setuid = true;
|
|
};
|
|
|
|
services.openssh.enable = true;
|
|
services.openssh.authorizedKeysInHomedir = false;
|
|
services.openssh.settings.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;
|
|
programs.ssh.agentPKCS11Whitelist = "${pkgs.opensc}/lib/opensc-pkcs11.so";
|
|
security.pam.p11.enable = true;
|
|
services.gnome.gcr-ssh-agent.enable = pkgs.lib.mkForce false;
|
|
|
|
services.printing.enable = true;
|
|
hardware.printers = {
|
|
ensurePrinters = [
|
|
{
|
|
name = "sprint";
|
|
deviceUri = "socket://192.168.1.1";
|
|
model = "raw";
|
|
}
|
|
];
|
|
ensureDefaultPrinter = "sprint";
|
|
};
|
|
|
|
hardware.graphics.enable32Bit = true;
|
|
|
|
fonts.packages = [ pkgs.noto-fonts pkgs.noto-fonts-cjk-sans pkgs.noto-fonts-color-emoji pkgs.emacs-all-the-icons-fonts ];
|
|
|
|
# Enable the X11 windowing system.
|
|
services.xserver.enable = true;
|
|
services.xserver.xkb.layout = "us";
|
|
services.xserver.xkb.options = "eurosign:e";
|
|
|
|
services.displayManager.gdm.enable = true;
|
|
services.desktopManager.gnome.enable = true;
|
|
|
|
# https://github.com/NixOS/nixpkgs/issues/149812
|
|
environment.extraInit = ''
|
|
export XDG_DATA_DIRS="$XDG_DATA_DIRS:${pkgs.gtk3}/share/gsettings-schemas/${pkgs.gtk3.name}"
|
|
'';
|
|
|
|
systemd.suppressedSystemUnits = [
|
|
"hibernate.target"
|
|
"suspend.target"
|
|
"suspend-then-hibernate.target"
|
|
"sleep.target"
|
|
"hybrid-sleep.target"
|
|
"systemd-hibernate.service"
|
|
"systemd-hybrid-sleep.service"
|
|
"systemd-suspend.service"
|
|
"systemd-suspend-then-hibernate.service"
|
|
];
|
|
|
|
hardware.bluetooth.enable = true;
|
|
|
|
programs.zsh.enable = true;
|
|
programs.fish.enable = true;
|
|
programs.fish.promptInit = ''
|
|
any-nix-shell fish --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 = [ artiq.packages.x86_64-linux.openocd-bscanspi ];
|
|
services.udev.extraRules = (import ./extra-udev.nix);
|
|
|
|
nix.settings.trusted-public-keys = ["nixbld.m-labs.hk-1:5aSRVA5b320xbNvu30tqxVPXpld73bhtOeH6uAjRyHc="];
|
|
nix.settings.substituters = ["https://nixbld.m-labs.hk?priority=10"];
|
|
nix.settings.extra-sandbox-paths = ["/opt"];
|
|
|
|
nix.extraOptions = ''
|
|
experimental-features = nix-command flakes impure-derivations
|
|
'';
|
|
}
|