it-infra/nixops/light.nix

141 lines
3.9 KiB
Nix
Raw Normal View History

2020-06-20 17:54:21 +08:00
{ host }:
{ config, pkgs, ... }:
2021-03-23 16:28:01 +08:00
let
2022-05-26 19:30:23 +08:00
artiq = builtins.getFlake git+https://github.com/m-labs/artiq.git;
2021-03-23 16:28:01 +08:00
in
2020-06-20 17:54:21 +08:00
{
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
imports =
[
(./. + "/${host}-hardware-configuration.nix")
];
2020-11-06 14:32:54 +08:00
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)'
'';
});
};
2020-06-20 17:54:21 +08:00
networking.hostName = host;
time.timeZone = "Asia/Hong_Kong";
# List packages installed in system profile. To search, run:
# $ nix search wget
documentation.enable = false;
nixpkgs.config.allowUnfree = true;
environment.systemPackages = with pkgs; [
2022-05-26 19:30:23 +08:00
opensc yubikey-manager yubikey-manager-qt yubico-piv-tool
2020-06-20 17:54:21 +08:00
wget vim git firefox usbutils pciutils file lm_sensors acpi
gimp imagemagick
2021-04-12 21:14:41 +08:00
evince
2020-06-20 17:54:21 +08:00
(python3.withPackages(ps: with ps; [ numpy scipy ]))
psmisc
2022-05-26 13:18:48 +08:00
unzip zip gnupg
2020-06-20 17:54:21 +08:00
sublime3 rink
tmux screen tigervnc
2022-05-26 19:30:23 +08:00
artiq.packages.x86_64-linux.openocd-bscanspi
2021-12-01 22:09:51 +08:00
any-nix-shell
2020-06-20 17:54:21 +08:00
];
programs.wireshark.enable = true;
services.openssh.enable = true;
services.openssh.forwardX11 = true;
services.openssh.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;
nssmdns = true;
};
# Enable sound.
sound.enable = true;
hardware.pulseaudio = {
enable = true;
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 ];
# Enable the X11 windowing system.
services.xserver.enable = true;
services.xserver.layout = "us";
services.xserver.xkbOptions = "eurosign:e";
services.xserver.displayManager.lightdm.enable = true;
services.xserver.desktopManager.xfce.enable = true;
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
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 ];
2021-03-23 16:28:01 +08:00
services.udev.extraRules = (import ./extra-udev.nix);
2020-06-20 17:54:21 +08:00
nix.binaryCachePublicKeys = ["nixbld.m-labs.hk-1:5aSRVA5b320xbNvu30tqxVPXpld73bhtOeH6uAjRyHc="];
nix.binaryCaches = ["https://nixbld.m-labs.hk" "https://cache.nixos.org"];
nix.sandboxPaths = ["/opt"];
2021-12-01 22:09:51 +08:00
nix.extraOptions = ''
2022-05-26 13:18:48 +08:00
experimental-features = nix-command flakes ca-derivations impure-derivations
2021-12-01 22:09:51 +08:00
'';
2020-06-20 17:54:21 +08:00
}