2020-06-20 17:54:21 +08:00
|
|
|
{ host }:
|
|
|
|
|
|
|
|
{ config, pkgs, ... }:
|
|
|
|
let
|
2022-05-26 19:30:23 +08:00
|
|
|
artiq = builtins.getFlake git+https://github.com/m-labs/artiq.git;
|
2020-06-20 17:54:21 +08:00
|
|
|
in
|
|
|
|
{
|
|
|
|
deployment.targetHost = host;
|
2021-06-02 08:56:36 +08:00
|
|
|
deployment.hasFastConnection = true;
|
2020-12-12 15:01:38 +08:00
|
|
|
nix.nixPath = [ "nixpkgs=${pkgs.path}" ];
|
2021-03-29 14:01:46 +08:00
|
|
|
programs.command-not-found.dbPath = "${pkgs.path}/programs.sqlite";
|
2020-06-20 17:54:21 +08:00
|
|
|
|
2024-05-29 17:59:37 +08:00
|
|
|
boot.loader.systemd-boot.memtest86.enable = true;
|
|
|
|
boot.loader.grub.memtest86.enable = true;
|
|
|
|
|
2020-06-20 17:54:21 +08:00
|
|
|
imports =
|
|
|
|
[
|
|
|
|
(./. + "/${host}-hardware-configuration.nix")
|
2023-07-21 18:00:01 +08:00
|
|
|
./avscan-module.nix
|
2020-06-20 17:54:21 +08:00
|
|
|
];
|
2020-11-06 14:32:54 +08:00
|
|
|
nixpkgs.config.packageOverrides = super: let self = super.pkgs; in {
|
2023-05-23 17:38:50 +08:00
|
|
|
libp11 = super.libp11.override({ openssl = super.openssl_1_1; });
|
2020-11-06 14:32:54 +08:00
|
|
|
pam_p11 = super.pam_p11.overrideAttrs(oa: {
|
2023-05-23 17:38:50 +08:00
|
|
|
patches = [];
|
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace src/match_openssh.c --replace \
|
|
|
|
'"%s/.ssh/authorized_keys", pw->pw_dir)' \
|
|
|
|
'"/etc/ssh/authorized_keys.d/%s", pw->pw_name)'
|
2020-11-06 14:32:54 +08:00
|
|
|
'';
|
|
|
|
});
|
2023-02-02 17:23:08 +08:00
|
|
|
gnome = super.gnome // {
|
|
|
|
gnome-keyring = super.gnome.gnome-keyring.overrideAttrs(oa: {
|
|
|
|
configureFlags = oa.configureFlags ++ ["--disable-ssh-agent"];
|
|
|
|
});
|
|
|
|
};
|
2020-11-06 14:32:54 +08:00
|
|
|
};
|
2023-05-23 17:38:50 +08:00
|
|
|
nixpkgs.config.permittedInsecurePackages = [
|
2023-11-07 20:39:10 +08:00
|
|
|
"openssl-1.1.1w"
|
2023-05-23 17:38:50 +08:00
|
|
|
];
|
2020-06-20 17:54:21 +08:00
|
|
|
|
2023-12-12 17:26:25 +08:00
|
|
|
boot.binfmt.emulatedSystems = [ "armv7l-linux" ];
|
|
|
|
|
2020-06-20 17:54:21 +08:00
|
|
|
networking.hostName = host;
|
2020-09-03 19:36:37 +08:00
|
|
|
networking.firewall.allowedTCPPorts = [ 1883 ];
|
2021-08-10 10:43:19 +08:00
|
|
|
networking.firewall.allowedUDPPorts = [ 1883 ];
|
2020-06-20 17:54:21 +08:00
|
|
|
|
|
|
|
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; [
|
2021-09-13 10:06:35 +08:00
|
|
|
opensc yubikey-manager yubikey-manager-qt yubico-piv-tool
|
2022-11-29 10:14:26 +08:00
|
|
|
wget vim gitAndTools.gitFull sshfs
|
|
|
|
firefox
|
|
|
|
thunderbird
|
|
|
|
chromium
|
2020-09-10 11:13:32 +08:00
|
|
|
usbutils pciutils uhubctl file lm_sensors audacious acpi
|
2020-06-20 17:54:21 +08:00
|
|
|
gimp imagemagick
|
2022-12-14 23:20:30 +08:00
|
|
|
(python3.withPackages(ps: with ps; [ numpy scipy matplotlib qtconsole regex jinja2 ]))
|
|
|
|
texlive.combined.scheme-full
|
2020-06-20 17:54:21 +08:00
|
|
|
mosh psmisc libreoffice-fresh
|
2022-09-13 08:50:05 +08:00
|
|
|
inkscape
|
2023-04-19 18:15:43 +08:00
|
|
|
xournal
|
2024-01-23 17:34:32 +08:00
|
|
|
xsane
|
2022-05-26 13:18:48 +08:00
|
|
|
gtkwave unzip zip gnupg
|
2024-11-16 18:49:26 +08:00
|
|
|
gnome-tweaks
|
|
|
|
ghex
|
2020-06-20 17:54:21 +08:00
|
|
|
jq sublime3 rink qemu_kvm
|
2023-08-02 11:47:37 +08:00
|
|
|
tmux screen gdb minicom picocom
|
2022-05-26 19:30:23 +08:00
|
|
|
artiq.packages.x86_64-linux.openocd-bscanspi
|
2022-06-17 16:06:16 +08:00
|
|
|
xc3sprog
|
2023-08-02 11:44:05 +08:00
|
|
|
gqrx
|
2020-06-20 17:54:21 +08:00
|
|
|
emacs bat ripgrep
|
2022-05-27 17:49:00 +08:00
|
|
|
guake
|
2023-04-03 17:49:40 +08:00
|
|
|
vscodium
|
2023-05-03 20:53:49 +08:00
|
|
|
waypipe
|
2021-02-28 13:31:13 +08:00
|
|
|
virt-manager spice-gtk
|
2024-01-02 10:39:06 +08:00
|
|
|
kicad
|
2021-12-01 22:09:51 +08:00
|
|
|
any-nix-shell
|
2020-06-20 17:54:21 +08:00
|
|
|
];
|
|
|
|
programs.wireshark.enable = true;
|
2020-07-18 10:21:10 +08:00
|
|
|
programs.wireshark.package = pkgs.wireshark;
|
2021-02-28 13:31:13 +08:00
|
|
|
virtualisation.libvirtd.enable = true;
|
2022-01-03 17:24:34 +08:00
|
|
|
virtualisation.libvirtd.qemu.ovmf.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;
|
|
|
|
};
|
2020-06-20 17:54:21 +08:00
|
|
|
|
2023-07-21 18:00:01 +08:00
|
|
|
services.avscan.enable = true;
|
|
|
|
|
2020-06-20 17:54:21 +08:00
|
|
|
services.openssh.enable = true;
|
2024-06-02 14:04:02 +08:00
|
|
|
services.openssh.authorizedKeysInHomedir = false;
|
2023-05-24 12:48:41 +08:00
|
|
|
services.openssh.settings.PasswordAuthentication = false;
|
2020-07-15 12:32:57 +08:00
|
|
|
services.openssh.extraConfig =
|
|
|
|
''
|
|
|
|
StreamLocalBindUnlink yes
|
|
|
|
'';
|
2020-07-18 10:16:03 +08:00
|
|
|
programs.mosh.enable = true;
|
|
|
|
|
2020-06-20 17:54:21 +08:00
|
|
|
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;
|
|
|
|
|
|
|
|
# Enable CUPS to print documents.
|
|
|
|
services.printing = {
|
|
|
|
enable = true;
|
|
|
|
extraConf =
|
|
|
|
''
|
|
|
|
Browsing Off
|
|
|
|
BrowseLocalProtocols none
|
|
|
|
'';
|
|
|
|
browsedConf =
|
|
|
|
''
|
|
|
|
BrowseRemoteProtocols none
|
|
|
|
BrowseProtocols none
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
services.avahi = {
|
|
|
|
enable = true;
|
2024-05-24 11:09:02 +08:00
|
|
|
nssmdns4 = true;
|
2020-06-20 17:54:21 +08:00
|
|
|
};
|
|
|
|
|
2024-11-16 18:49:26 +08:00
|
|
|
hardware.graphics.enable32Bit = true;
|
2023-11-07 20:39:21 +08:00
|
|
|
|
2024-11-16 18:49:26 +08:00
|
|
|
fonts.packages = [ pkgs.noto-fonts pkgs.noto-fonts-cjk-sans pkgs.noto-fonts-emoji pkgs.noto-fonts-extra pkgs.emacs-all-the-icons-fonts ];
|
2020-06-20 17:54:21 +08:00
|
|
|
|
|
|
|
# Enable the X11 windowing system.
|
|
|
|
services.xserver.enable = true;
|
2024-05-24 11:09:02 +08:00
|
|
|
services.xserver.xkb.layout = "us";
|
|
|
|
services.xserver.xkb.options = "eurosign:e";
|
2020-06-20 17:54:21 +08:00
|
|
|
|
|
|
|
services.xserver.displayManager.gdm.enable = true;
|
2021-06-02 08:57:07 +08:00
|
|
|
services.xserver.desktopManager.gnome.enable = true;
|
2023-02-02 17:23:08 +08:00
|
|
|
environment.gnome.excludePackages = [ pkgs.epiphany ];
|
2020-06-20 17:54:21 +08:00
|
|
|
|
2021-05-25 17:19:04 +08:00
|
|
|
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"
|
|
|
|
];
|
|
|
|
|
2020-06-20 17:54:21 +08:00
|
|
|
hardware.bluetooth.enable = true;
|
|
|
|
|
2023-05-23 19:53:48 +08:00
|
|
|
programs.zsh.enable = true;
|
2020-06-20 17:54:21 +08:00
|
|
|
programs.fish.enable = true;
|
|
|
|
programs.fish.promptInit = ''
|
2021-03-10 18:38:59 +08:00
|
|
|
any-nix-shell fish --info-right | source
|
2020-06-20 17:54:21 +08:00
|
|
|
'';
|
|
|
|
users.mutableUsers = false;
|
|
|
|
users.defaultUserShell = pkgs.fish;
|
|
|
|
users.extraGroups.plugdev = { };
|
|
|
|
users.extraUsers = import ./common-users.nix { inherit pkgs; };
|
|
|
|
security.sudo.wheelNeedsPassword = false;
|
2022-05-26 19:30:23 +08:00
|
|
|
services.udev.packages = [ artiq.packages.x86_64-linux.openocd-bscanspi ];
|
2020-09-11 15:27:01 +08:00
|
|
|
services.udev.extraRules = (import ./extra-udev.nix);
|
2020-06-20 17:54:21 +08:00
|
|
|
|
2022-11-29 10:14:26 +08:00
|
|
|
nix.settings.trusted-public-keys = ["nixbld.m-labs.hk-1:5aSRVA5b320xbNvu30tqxVPXpld73bhtOeH6uAjRyHc="];
|
2023-03-14 11:17:25 +08:00
|
|
|
nix.settings.substituters = ["https://nixbld.m-labs.hk?priority=10"];
|
2022-11-29 10:14:26 +08:00
|
|
|
nix.settings.extra-sandbox-paths = ["/opt"];
|
2020-06-20 17:54:21 +08:00
|
|
|
|
2021-08-16 16:39:11 +08:00
|
|
|
nix.extraOptions = ''
|
2022-05-27 19:02:23 +08:00
|
|
|
experimental-features = nix-command flakes impure-derivations
|
2021-08-16 16:39:11 +08:00
|
|
|
'';
|
2020-06-20 17:54:21 +08:00
|
|
|
}
|