diff --git a/configuration.nix b/configuration.nix index a7cb407..e3f4598 100644 --- a/configuration.nix +++ b/configuration.nix @@ -1,8 +1,4 @@ -{ - config, - pkgs, - ... -}: +{ config, pkgs, ... }: { @@ -10,13 +6,13 @@ ]; # Use nixpkgs from niv - nixpkgs.pkgs = let - sources = import ./nix/sources.nix; - in import sources.nixpkgs { - config = config.nixpkgs.config // { - allowUnfree = true; - }; - }; + #nixpkgs.pkgs = let + # sources = import ./nix/sources.nix; + #in import sources.nixpkgs { + # config = config.nixpkgs.config // { + # allowUnfree = true; + # }; + #}; imports = [ ./hardware-configuration.nix @@ -24,101 +20,163 @@ ]; # Support ARM builds - boot.binfmt.emulatedSystems = [ "aarch64-linux" ]; + boot = { + binfmt.emulatedSystems = [ "aarch64-linux" ]; - boot.kernelPackages = pkgs.linuxPackages_latest; + kernelPackages = config.boot.zfs.package.latestCompatibleLinuxPackages; - boot.loader.systemd-boot.enable = true; - boot.loader.efi.canTouchEfiVariables = true; + loader = { + systemd-boot.enable = true; + efi.canTouchEfiVariables = true; + }; - boot.supportedFilesystems = [ "zfs" ]; - boot.zfs.devNodes = "/dev/disk/by-partuuid"; - networking.hostId = "f86b2fa7"; + supportedFilesystems = [ "zfs" ]; + zfs.devNodes = "/dev/disk/by-partuuid"; + }; time.timeZone = "Asia/Kolkata"; - networking.hostName = "desktop"; # Define your hostname. - networking.useDHCP = false; - #networking.interfaces.enp6s18.useDHCP = true; - networking.interfaces.enp6s18.useDHCP = true; - - + networking = { + hostId = "f86b2fa7"; + + hostName = "desktop"; + useDHCP = false; + interfaces = { + enp6s18.useDHCP = true; + enp11s0.useDHCP = true; + }; + #hosts = { + #}; + }; security.sudo.wheelNeedsPassword = false; users.users = { illustris = { isNormalUser = true; - extraGroups = [ "wheel" "docker" "tty" "adb" ]; + extraGroups = [ "wheel" "docker" "tty" "adb" "libvirtd" ]; openssh.authorizedKeys.keyFiles = [ ./secrets/ssh_pubkeys ]; }; root.openssh.authorizedKeys.keyFiles = [ ./secrets/ssh_pubkeys ]; }; - programs.adb.enable = true; - - environment.systemPackages = with pkgs; [ - git - tmux - htop - nfs-utils - bmon - sysstat - (pass.withExtensions (exts: [ exts.pass-otp ])) - nnn - mosh - ncdu - (writeScriptBin "vpnpass" (builtins.readFile ./scripts/vpnpass)) - wget - expect - openvpn - tcpdump - killall - file - tree - ntfs3g - p7zip - ranger - cscope - python - bind # for nslookup - ethtool - unzip - pciutils - sshfs - jq - nixpkgs-review - (pkgs.callPackage /home/illustris/src/percol/percol {}) - niv - ( - rofi.override { plugins = [ - rofi-calc - rofi-pass - rofi-systemd - ]; } - ) - nmap - fping - ]; - - programs.gnupg.agent = { - enable = true; + environment = { + systemPackages = with pkgs; [ + asciinema + bind + binutils-unwrapped + bmon + cmatrix # More useful than you might think + #ec2_api_tools + ethtool + expect + fatrace + file + gdb + git + gnumake + #graphviz + htop + #imagemagick + iotop + iperf + jq + killall + latencytop + linuxPackages.perf + lsof + mosh + ncdu + neofetch + networkmanager + nfs-utils + nix-du + nix-prefetch-git + nix-tree + nnn + openvpn + p7zip + pciutils + powertop + pv + python3 + pythonPackages.percol + ranger + screen + sshfs + surf + sysstat + tmate + tmux + tree + unzip + usbutils + valgrind + virt-manager + wget + youtube-dl + (cscope.override{emacsSupport = false;}) + #(emacs.override{withGTK3 = false; withX = false;}) + (pass.withExtensions (exts: [ exts.pass-otp ])) + ((pkgs.callPackage ./packages/passcol) { }) + (writeScriptBin "vpnpass" (builtins.readFile ./scripts/vpnpass)) + ]; + etc = { + openvpn.source = "${pkgs.update-resolv-conf}/libexec/openvpn"; + nixpkgs.source = let sources = import ./nix/sources.nix; in sources.nixpkgs; + }; }; - programs.bash = { - interactiveShellInit = '' - export HISTSIZE=-1 HISTFILESIZE=-1 HISTCONTROL=ignoreboth:erasedups; - ''; - shellAliases = { - genpass = "cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 20 | head -n 2"; + #programs.bash = { + # interactiveShellInit = '' + # export HISTSIZE=-1 HISTFILESIZE=-1 HISTCONTROL=ignoreboth:erasedups; + # ''; + # shellAliases = { + # genpass = "cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 20 | head -n 2"; + # }; + # promptInit = '' + # if [ "$TERM" != "dumb" -o -n "$INSIDE_EMACS" ]; then + # PROMPT_COLOR="1;31m" + # let $UID && PROMPT_COLOR="1;36m" + # PS1="\[\033[$PROMPT_COLOR\][\[\e]0;\u@\h: \w\a\]\u@\h:\w]\\$\[\033[0m\] " + # fi + # ''; + #}; + + + programs = { + adb.enable = true; + bash = { + interactiveShellInit = '' + export HISTSIZE=-1 HISTFILESIZE=-1 HISTCONTROL=ignoreboth:erasedups + shopt -s histappend + export PROMPT_COMMAND="history -a;$PROMPT_COMMAND" + ''; + shellAliases = { + genpass = "cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 20 | head -n 2"; + nt = "sudo nix-shell /etc/nixos/shell.nix --run \"nixos-rebuild test\""; + ns = "sudo nix-shell /etc/nixos/shell.nix --run \"nixos-rebuild switch\""; + grep = "grep --color"; + }; + promptInit = '' + if [ "$TERM" != "dumb" -o -n "$INSIDE_EMACS" ]; then + PROMPT_COLOR="1;31m" + let $UID && PROMPT_COLOR="1;36m" + PS1="\[\033[$PROMPT_COLOR\][\[\e]0;\u@\h: \w\a\]\u@\h:\w]\\$\[\033[0m\] " + fi + ''; }; - promptInit = '' - if [ "$TERM" != "dumb" -o -n "$INSIDE_EMACS" ]; then - PROMPT_COLOR="1;31m" - let $UID && PROMPT_COLOR="1;36m" - PS1="\[\033[$PROMPT_COLOR\][\[\e]0;\u@\h: \w\a\]\u@\h:\w]\\$\[\033[0m\] " - fi - ''; + + # for virt-manager + dconf.enable = true; + + gnupg.agent = { + enable = true; + pinentryFlavor = "curses"; + }; + mosh.enable = true; + mtr.enable = true; + ssh.startAgent = true; }; services = { @@ -137,10 +195,14 @@ enable = true; joinNetworks = [ "93afae5963c6858e" ]; }; + flatpak.enable = true; + gnome3.gnome-keyring.enable = true; }; - environment.etc.openvpn.source = "${pkgs.update-resolv-conf}/libexec/openvpn"; - virtualisation.docker.enable = true; + virtualisation = { + docker.enable = true; + libvirtd.enable = true; + }; # Temporary fix for qemu-ga till #112886 gets merged systemd.services.qemu-guest-agent = { @@ -151,14 +213,19 @@ RestartSec = 0; }; }; - networking.hosts = { - "192.168.1.8" = ["git.illustris.tech"]; - "192.168.1.10" = ["kube-master"]; - }; networking.firewall.enable = false; - nix.trustedUsers = [ "root" "illustris" ]; + nix = { + autoOptimiseStore = true; + nixPath = [ + "nixpkgs=${pkgs.path}" + "nixos-config=/etc/nixos/configuration.nix" + ]; + trustedUsers = [ "root" "illustris" ]; + }; + + xdg.portal.enable = true; # In case of emergency, bash glass #systemd.tmpfiles.rules = [ @@ -171,7 +238,7 @@ # this value at the release version of the first install of this system. # Before changing this value read the documentation for this option # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). - system.stateVersion = "21.03"; # Did you read the comment? + system.stateVersion = "21.05"; # Did you read the comment? } diff --git a/desktop-configuration.nix b/desktop-configuration.nix index 82e50f3..e21bfbd 100644 --- a/desktop-configuration.nix +++ b/desktop-configuration.nix @@ -27,16 +27,65 @@ #backend = "xr_glx_hybrid"; backend = "glx"; }; + pipewire = { + enable = true; + alsa = { + enable = true; + support32Bit = true; + }; + pulse.enable = true; + jack.enable = true; + socketActivation = true; + config.pipewire = { + #"context.properties" = { + # "link.max-buffers" = 16; + # "log.level" = 2; + # "default.clock.rate" = 48000; + # "default.clock.quantum" = 32; + # "default.clock.min-quantum" = 32; + # "default.clock.max-quantum" = 32; + # "core.daemon" = true; + # "core.name" = "pipewire-0"; + #}; + #"context.modules" = [ + # { + # name = "libpipewire-module-rtkit"; + # args = { + # "nice.level" = -15; + # "rt.prio" = 88; + # "rt.time.soft" = 200000; + # "rt.time.hard" = 200000; + # }; + # flags = [ "ifexists" "nofail" ]; + # } + # { name = "libpipewire-module-protocol-native"; } + # { name = "libpipewire-module-profiler"; } + # { name = "libpipewire-module-metadata"; } + # { name = "libpipewire-module-spa-device-factory"; } + # { name = "libpipewire-module-spa-node-factory"; } + # { name = "libpipewire-module-client-node"; } + # { name = "libpipewire-module-client-device"; } + # { + # name = "libpipewire-module-portal"; + # flags = [ "ifexists" "nofail" ]; + # } + # { + # name = "libpipewire-module-access"; + # args = {}; + # } + # { name = "libpipewire-module-adapter"; } + # { name = "libpipewire-module-link-factory"; } + # { name = "libpipewire-module-session-manager"; } + #]; + }; + + }; }; nixpkgs.config.allowUnfree = true; programs.steam.enable = true; programs.chromium = { enable = true; - extraOpts = { - "PasswordManagerEnabled" = false; - "ClearSiteDataOnExit" = false; - }; extensions = [ "gcbommkclmclpchllfjekcdonpmejbdp" # https everywhere "cjpalhdlnbpafiamejdnhcphjbkeiagm" # ublock origin @@ -45,10 +94,17 @@ "gppongmhjkpfnbhagpmjfkannfbllamg" # wappalyzer "lcbjdhceifofjlpecfpeimnnphbcjgnc" # xBrowserSync "chlffgpmiacpedhhbkiomidkjlcfhogd" # pushbullet + "aghfnjkcakhmadgdomlmlhhaocbkloab" # just black + "fmkadmapgofadopljbjfkapdkoienihi" # React Developer Tools ]; - homepageLocation = "https://duckduckgo.com/"; - defaultSearchProviderSuggestURL = "https://duckduckgo.com/?q={searchTerms}&kp=-1&kac=1"; - defaultSearchProviderSearchURL = "https://duckduckgo.com/?q=search&kp=-1"; + homepageLocation = "https://sx.illustris.tech/"; + defaultSearchProviderSuggestURL = "https://sx.illustris.tech/autocompleter?q={searchTerms}"; + defaultSearchProviderSearchURL = "https://sx.illustris.tech/search?q={searchTerms}"; + extraOpts = { + DefaultSearchProviderEnabled = true; + DefaultSearchProviderName = "Sx"; + DefaultCookiesSetting = 1; + }; }; environment.systemPackages = with pkgs; [ st @@ -58,8 +114,8 @@ sublime3 perlPackages.AppClusterSSH x11vnc - kcachegrind - remmina + #kcachegrind + #remmina insomnia vlc openhmd @@ -69,8 +125,8 @@ signal-desktop sxiv scrot - (libsForQt5.callPackage (import ./packages/rescuetime/default.nix) {}) - surf + #(libsForQt5.callPackage (import ./packages/rescuetime/default.nix) {}) + #surf gnome3.gnome-screenshot blender wireshark @@ -80,10 +136,13 @@ libnotify ungoogled-chromium zoom-us + guake ]; + security.rtkit.enable = true; + hardware.pulseaudio = { - enable = true; + enable = false; daemon.config.default-sample-channels = 6; package = pkgs.pulseaudioFull; #extraConfig = '' diff --git a/hardware-configuration.nix b/hardware-configuration.nix index b36ee50..4063168 100644 --- a/hardware-configuration.nix +++ b/hardware-configuration.nix @@ -11,7 +11,7 @@ boot.initrd.availableKernelModules = [ "uhci_hcd" "ehci_pci" "ahci" "virtio_pci" "sr_mod" "virtio_blk" ]; boot.initrd.kernelModules = [ ]; boot.kernelModules = [ "v4l2loopback" ]; - boot.extraModulePackages = [ pkgs.linuxPackages_latest.v4l2loopback ]; + boot.extraModulePackages = [ config.boot.kernelPackages.v4l2loopback ]; fileSystems = { "/" = { diff --git a/nix/sources.json b/nix/sources.json index c241826..f997277 100644 --- a/nix/sources.json +++ b/nix/sources.json @@ -5,10 +5,10 @@ "homepage": "https://github.com/nmattia/niv", "owner": "nmattia", "repo": "niv", - "rev": "af958e8057f345ee1aca714c1247ef3ba1c15f5e", - "sha256": "1qjavxabbrsh73yck5dcq8jggvh3r2jkbr6b5nlz5d9yrqm9255n", + "rev": "9cb7ef336bb71fd1ca84fc7f2dff15ef4b033f2a", + "sha256": "1ajyqr8zka1zlb25jx1v4xys3zqmdy3prbm1vxlid6ah27a8qnzh", "type": "tarball", - "url": "https://github.com/nmattia/niv/archive/af958e8057f345ee1aca714c1247ef3ba1c15f5e.tar.gz", + "url": "https://github.com/nmattia/niv/archive/9cb7ef336bb71fd1ca84fc7f2dff15ef4b033f2a.tar.gz", "url_template": "https://github.com///archive/.tar.gz" }, "nixpkgs": { @@ -17,10 +17,10 @@ "homepage": "", "owner": "NixOS", "repo": "nixpkgs", - "rev": "a73020b2a150322c9832b50baeb0296ba3b13dd7", - "sha256": "1s0ckc2qscrflr7bssd0s32zddp48dg5jk22w1dip2q2q7ks6cj0", + "rev": "48d63e924a2666baf37f4f14a18f19347fbd54a2", + "sha256": "0dcxc4yc2y5z08pmkmjws4ir0r2cbc5mha2a48bn0bk7nxc6wx8g", "type": "tarball", - "url": "https://github.com/NixOS/nixpkgs/archive/a73020b2a150322c9832b50baeb0296ba3b13dd7.tar.gz", + "url": "https://github.com/NixOS/nixpkgs/archive/48d63e924a2666baf37f4f14a18f19347fbd54a2.tar.gz", "url_template": "https://github.com///archive/.tar.gz" } } diff --git a/packages/passcol/default.nix b/packages/passcol/default.nix new file mode 100644 index 0000000..5f40e4d --- /dev/null +++ b/packages/passcol/default.nix @@ -0,0 +1,21 @@ +{ stdenv, python3Packages, pass, xdotool, fetchFromGitHub }: + +stdenv.mkDerivation rec { + version = "1.0.0"; + pname = "passcol"; + src = fetchFromGitHub { + owner = "illustris"; + repo = "passcol"; + rev = "6bca0a85a6394e1fabab6790e9191f64d4bad281"; + sha256 = "1hj5ks382i5cafl6kz7576v59iqc73k90wr6567qcbl6xzgx9iq2"; + }; + + buildInputs = [ + pass python3Packages.percol xdotool + ]; + + installPhase = '' + mkdir -p $out/bin + cp passcol.sh $out/bin/passcol + ''; +} diff --git a/shell.nix b/shell.nix new file mode 100644 index 0000000..25636ee --- /dev/null +++ b/shell.nix @@ -0,0 +1,14 @@ +{ + sources ? import ./nix/sources.nix, + pkgs ? import sources.nixpkgs {} +}: + +pkgs.mkShell { + buildInputs = with pkgs; [ + niv + ]; + shellHook = '' + export nixpkgs=${pkgs.path} + export NIX_PATH=nixpkgs=${pkgs.path}:nixos-config=/etc/nixos/configuration.nix + ''; +}