1
0
Fork 0
it-infra/nixops/desktop.nix

173 lines
5.4 KiB
Nix
Raw Normal View History

2020-06-20 17:54:21 +08:00
{ host }:
{ config, pkgs, ... }:
let
m-labs = import (fetchTarball https://nixbld.m-labs.hk/channel/custom/artiq/full/artiq-full/nixexprs.tar.xz) { inherit pkgs; };
2021-10-30 15:19:11 +08:00
pkgs-unstable = import (pkgs.fetchFromGitHub {
owner = "nixos";
repo = "nixpkgs";
rev = "2ec0c698eaf3e7a4d13988538f08d65b3d006f40";
sha256 = "137py5fhmjs3p1dgqmd7cxsxzzs67nrqqijxmflb0ck1fnfzrij7";
}) {};
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
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;
networking.firewall.allowedTCPPorts = [ 1883 ];
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
2020-09-17 18:14:55 +08:00
wget vim gitAndTools.gitFull sshfs firefox chromium thunderbird hexchat
usbutils pciutils uhubctl file lm_sensors audacious acpi
2020-06-20 17:54:21 +08:00
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
2020-11-06 14:32:54 +08:00
xpra
rust-analyzer
(vscode-with-extensions.override {
2020-06-20 17:54:21 +08:00
vscodeExtensions = [
2020-11-06 14:32:54 +08:00
vscode-extensions.matklad.rust-analyzer
2020-06-20 17:54:21 +08:00
];
})
2021-10-30 15:19:11 +08:00
pkgs-unstable.joplin-desktop
2021-02-28 13:31:13 +08:00
virt-manager spice-gtk
2021-03-10 18:38:59 +08:00
(callPackage ./any-nix-shell.nix {})
2020-06-20 17:54:21 +08:00
];
programs.wireshark.enable = true;
programs.wireshark.package = pkgs.wireshark;
2021-02-28 13:31:13 +08:00
virtualisation.libvirtd.enable = true;
virtualisation.libvirtd.qemuOvmf = true;
security.wrappers.spice-client-glib-usb-acl-helper.source = "${pkgs.spice-gtk}/bin/spice-client-glib-usb-acl-helper";
2020-06-20 17:54:21 +08:00
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;
2021-06-02 08:57:07 +08:00
services.gnome.gnome-keyring.enable = pkgs.lib.mkForce false;
2020-06-20 17:54:21 +08:00
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";
services.xserver.displayManager.gdm.enable = true;
2021-06-02 08:57:07 +08:00
services.xserver.desktopManager.gnome.enable = true;
environment.gnome.excludePackages = [ pkgs.epiphany pkgs.gnome3.geary ];
2020-06-20 17:54:21 +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;
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;
services.udev.packages = [ m-labs.openocd ];
2020-09-11 15:27: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"];
nix.package = pkgs.nixUnstable;
nix.extraOptions = ''
experimental-features = nix-command flakes
'';
2020-06-20 17:54:21 +08:00
# 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?
}