From d17c974a4703dc42f6c1ca95c03b52cc8b8d6631 Mon Sep 17 00:00:00 2001 From: Tyler Starr Date: Mon, 10 Jul 2023 17:52:34 -0700 Subject: [PATCH] more update --- home/dot_bashrc | 2 - home/dot_config/alacritty/alacritty.yml | 2 +- home/dot_config/nvim/after/plugin/color.lua | 2 +- home/dot_config/nvim/lua/tstarr/packer.lua | 2 +- home/dot_config/sway/config.tmpl | 4 +- provision/arch/TODO.md | 7 +- provision/arch/additional-setup.md | 36 +++-- provision/arch/ansible/tasks/desktop/sway.yml | 2 +- .../arch/ansible/tasks/terminal/packages.yml | 1 + provision/nixos/flake.lock | 102 ++++++++++++ provision/nixos/flake.nix | 45 ++++++ .../nixos/hosts/kestrel/configuration.nix | 145 ++++++++++++++++++ provision/nixos/hosts/kestrel/hardware.nix | 64 ++++++++ .../hosts/kestrel/home-configuration.nix | 24 +++ provision/nixos/lib/overlays.nix | 7 + provision/nixos/modules/.placeholder | 0 provision/nixos/modules/default.nix | 4 + provision/nixos/modules/desktop/default.nix | 4 + provision/nixos/modules/desktop/sway.nix | 71 +++++++++ provision/nixos/modules/devel/default.nix | 5 + provision/nixos/modules/devel/engineering.nix | 14 ++ provision/nixos/modules/devel/python.nix | 27 ++++ provision/nixos/modules/devel/tooling.nix | 19 +++ provision/nixos/modules/gaming/default.nix | 4 + provision/nixos/modules/gaming/steam.nix | 23 +++ provision/nixos/modules/services/default.nix | 5 + provision/nixos/modules/services/samba.nix | 32 ++++ provision/nixos/modules/services/vfio.nix | 57 +++++++ provision/nixos/overlays/.placeholder | 0 provision/nixos/overlays/rofi.nix | 5 + provision/nixos/pkgs/.placeholder | 0 31 files changed, 697 insertions(+), 18 deletions(-) create mode 100644 provision/nixos/flake.lock create mode 100644 provision/nixos/flake.nix create mode 100644 provision/nixos/hosts/kestrel/configuration.nix create mode 100644 provision/nixos/hosts/kestrel/hardware.nix create mode 100644 provision/nixos/hosts/kestrel/home-configuration.nix create mode 100644 provision/nixos/lib/overlays.nix create mode 100644 provision/nixos/modules/.placeholder create mode 100644 provision/nixos/modules/default.nix create mode 100644 provision/nixos/modules/desktop/default.nix create mode 100644 provision/nixos/modules/desktop/sway.nix create mode 100644 provision/nixos/modules/devel/default.nix create mode 100644 provision/nixos/modules/devel/engineering.nix create mode 100644 provision/nixos/modules/devel/python.nix create mode 100644 provision/nixos/modules/devel/tooling.nix create mode 100644 provision/nixos/modules/gaming/default.nix create mode 100644 provision/nixos/modules/gaming/steam.nix create mode 100644 provision/nixos/modules/services/default.nix create mode 100644 provision/nixos/modules/services/samba.nix create mode 100644 provision/nixos/modules/services/vfio.nix create mode 100644 provision/nixos/overlays/.placeholder create mode 100644 provision/nixos/overlays/rofi.nix create mode 100644 provision/nixos/pkgs/.placeholder diff --git a/home/dot_bashrc b/home/dot_bashrc index dee20b9f..f2f06200 100644 --- a/home/dot_bashrc +++ b/home/dot_bashrc @@ -32,8 +32,6 @@ export NVM_DIR="$HOME/.nvm" export PATH="$HOME/.nimble/bin:$PATH" -. "$HOME/.cargo/env" - alias spl="tmux_splat" alias n="nnn -d -e -H -r" alias s="startx" diff --git a/home/dot_config/alacritty/alacritty.yml b/home/dot_config/alacritty/alacritty.yml index c9040c14..4ebf5459 100644 --- a/home/dot_config/alacritty/alacritty.yml +++ b/home/dot_config/alacritty/alacritty.yml @@ -50,4 +50,4 @@ font: y: 1 import: - - ~/.config/alacritty/themes/themes/monokai-pro.yml + - ~/.config/alacritty/themes/themes/dracula.yaml diff --git a/home/dot_config/nvim/after/plugin/color.lua b/home/dot_config/nvim/after/plugin/color.lua index bf4fc957..c052830e 100644 --- a/home/dot_config/nvim/after/plugin/color.lua +++ b/home/dot_config/nvim/after/plugin/color.lua @@ -1,2 +1,2 @@ vim.o.termguicolors = true -vim.cmd[[colorscheme monokai-pro]] +vim.cmd[[colorscheme dracula]] diff --git a/home/dot_config/nvim/lua/tstarr/packer.lua b/home/dot_config/nvim/lua/tstarr/packer.lua index 065d4077..aef2d855 100644 --- a/home/dot_config/nvim/lua/tstarr/packer.lua +++ b/home/dot_config/nvim/lua/tstarr/packer.lua @@ -5,7 +5,7 @@ return require('packer').startup(function(use) use 'wbthomason/packer.nvim' -- Colors - --use ('dracula/vim') + use ('dracula/vim') -- IDE use('nvim-lua/plenary.nvim') diff --git a/home/dot_config/sway/config.tmpl b/home/dot_config/sway/config.tmpl index c5731e7d..821fdc2e 100644 --- a/home/dot_config/sway/config.tmpl +++ b/home/dot_config/sway/config.tmpl @@ -39,6 +39,7 @@ set $foreground #F8F8F2 set $focused #bd93f9 set $inactive #44475A set $urgent #FF5555 +set $workspace #50FA7B # class border bground text indicator child_border client.focused $focused $focused $foreground $focused $focused @@ -243,7 +244,7 @@ bar { pango_markup enabled colors { background #000000 - focused_workspace $focused $focused $background + focused_workspace $workspace $workspace $background } } @@ -253,5 +254,6 @@ bar { exec_always --no-startup-id "dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK" exec_always --no-startup-id "configure-gtk" +exec_always --no-startup-id "swaybg -i ~/media/pictures/wallpapers/solar_system_wallpapers/mars.png" exec --no-startup-id "~/.config/sway/scripts/idle.sh" exec --no-startup-id "udiskie" diff --git a/provision/arch/TODO.md b/provision/arch/TODO.md index 882ca175..3ad2c2b3 100644 --- a/provision/arch/TODO.md +++ b/provision/arch/TODO.md @@ -1,3 +1,6 @@ # TODO -- Figure out if LTS kernel helps Dota2 - +- Fix syncthing for Yuzu/retro games +- Use chezmoi to set colors for theme (if possible) +- Document themeing options in additional-setup (to help and figure out automation) +- Make fzf scratch pad for zk notes +- Make scratch pad for taskwarrior/timewarrior? diff --git a/provision/arch/additional-setup.md b/provision/arch/additional-setup.md index 2e7d85eb..218102c8 100644 --- a/provision/arch/additional-setup.md +++ b/provision/arch/additional-setup.md @@ -2,9 +2,13 @@ The following documents some Arch setup that wasn't automated with ansible. -## Wireguard Client +## Wireguard Client [x] Wireguard is nice for a home vpn and [pivpn](https://pivpn.io/) makes it easy. +Currently my scripts for controlling (and visualizing the state of the vpn) +assume the connection name for the vpn is the same as the hostname of the system. +This may need to be modified in the future if I end up needing multiple vpn +connections. 1. Create client on server and copy resulting `.conf` file to local machine 2. Import to networkmanager with: @@ -14,7 +18,7 @@ nmcli connection import type wireguard file 3. Use `nm-connection-editor` to disable automatic connection 4. Connect to vpn with `nmcli connection up -## Mount network drives +## Mount network drives [x] I find fstab messing about more troubule than it is worth. Credentials are stored in ~/.smb. Mount network drives when needed with the following command: @@ -23,7 +27,7 @@ stored in ~/.smb. Mount network drives when needed with the following command: linux-mount- ``` -## Taskopen for taskwarrior +## Taskopen for taskwarrior [x] [taskopen](https://github.com/jschlatow/taskopen) is easier to install manually at this point since it isn't packaged and uses nim. Might get this @@ -61,7 +65,7 @@ Gitconfig files for SSH git push/pull are automaitcally placed. The only additional configuration required is the transfer of SSH keys (see Syncthing section). -## Firefox +## Firefox [x] Transfer the `.mozilla` folder from install-to-install to maintain Firefox settings and configurations. @@ -101,11 +105,13 @@ provides good information on setting up the virtual machine in virt-manager. The `patch.rom` required for my GPU is included in my repo. The virt-manager setup should usually be avoided by transfering the VM between machines: -1. Copy the VM's disks from `/var/lib/libvirt/images` on src host to the same dir on destination host -2. On the source host run `virsh dumpxml VMNAME > domxml.xml` and copy this xml to the destination host +1. Copy the VM's disks from `/var/lib/libvirt/images` on src host to the same + dir on destination host +2. On the source host run `virsh dumpxml VMNAME > domxml.xml` and copy this xml + to the destination host 3. On the destination host run `virsh define domxml.xml` -## AUR Helper +## AUR Helper [x] I install the absolute minimum number of AUR packages (and I don't automate thier installation). Run the following to install: @@ -121,10 +127,22 @@ I usually install the following packages: 1. Google Earth 2. Google Chrome (I like baseball) -## Yuzu +## Yuzu [x] Copy over the `~/.config/yuzu` and `~/.local/share/yuzu` from prior install. -## GTK Theme +## Themeing (is that a word?) + +### Alacritty +TODO + +### ZSH +TODO + +### Sway +TODO + +### GTK Theme [x] Set the GTK theme to `dracula` within the gnome-tweaks application. + diff --git a/provision/arch/ansible/tasks/desktop/sway.yml b/provision/arch/ansible/tasks/desktop/sway.yml index f01f9555..30cc27f0 100644 --- a/provision/arch/ansible/tasks/desktop/sway.yml +++ b/provision/arch/ansible/tasks/desktop/sway.yml @@ -4,10 +4,10 @@ - alacritty - sway - swayidle + - swaybg - grim # screenshot functionality - wl-clipboard # wl-copy and wl-paste for copy/paste from stdin / stdout - mako # notification system developed by swaywm maintainer - - feh - pcmanfm - blueman - flameshot diff --git a/provision/arch/ansible/tasks/terminal/packages.yml b/provision/arch/ansible/tasks/terminal/packages.yml index 52f476f6..1623e16d 100644 --- a/provision/arch/ansible/tasks/terminal/packages.yml +++ b/provision/arch/ansible/tasks/terminal/packages.yml @@ -23,6 +23,7 @@ ansible.builtin.pip: name: - pynvim + - yt-dlp - name: Install terminal cargo packages community.general.cargo: diff --git a/provision/nixos/flake.lock b/provision/nixos/flake.lock new file mode 100644 index 00000000..6e14827a --- /dev/null +++ b/provision/nixos/flake.lock @@ -0,0 +1,102 @@ +{ + "nodes": { + "flake-utils": { + "locked": { + "lastModified": 1642700792, + "narHash": "sha256-XqHrk7hFb+zBvRg6Ghl+AZDq03ov6OshJLiSWOoX5es=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "846b2ae0fc4cc943637d3d1def4454213e203cba", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "home-manager": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1683989410, + "narHash": "sha256-puF/QsIkp4ch0sf6M5mNzbdZtYcq2MJHcKre9wJ3ZYo=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "6702b22b9805bc1879715d4111e3764cd4237aed", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, + "mach-nix": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": [ + "nixpkgs" + ], + "pypi-deps-db": "pypi-deps-db" + }, + "locked": { + "lastModified": 1681814846, + "narHash": "sha256-IMQ1Twf/ozE53CwrunXNlYD3D31xqgz/mZyZG38Ov/Y=", + "owner": "DavHau", + "repo": "mach-nix", + "rev": "8d903072c7b5426d90bc42a008242c76590af916", + "type": "github" + }, + "original": { + "owner": "DavHau", + "repo": "mach-nix", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1683408522, + "narHash": "sha256-9kcPh6Uxo17a3kK3XCHhcWiV1Yu1kYj22RHiymUhMkU=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "897876e4c484f1e8f92009fd11b7d988a121a4e7", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "pypi-deps-db": { + "flake": false, + "locked": { + "lastModified": 1678051695, + "narHash": "sha256-kFFP8TN8pEKARtjK9loGdH+TU23ZbHdVLCUdNcufKPs=", + "owner": "DavHau", + "repo": "pypi-deps-db", + "rev": "e00b22ead9d3534ba1c448e1af3076af6b234acf", + "type": "github" + }, + "original": { + "owner": "DavHau", + "repo": "pypi-deps-db", + "type": "github" + } + }, + "root": { + "inputs": { + "home-manager": "home-manager", + "mach-nix": "mach-nix", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/provision/nixos/flake.nix b/provision/nixos/flake.nix new file mode 100644 index 00000000..72f3dd0a --- /dev/null +++ b/provision/nixos/flake.nix @@ -0,0 +1,45 @@ +{ + description = "A very basic flake"; + + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + home-manager = { + url = github:nix-community/home-manager; + inputs.nixpkgs.follows = "nixpkgs"; + }; + mach-nix= { + url = "github:DavHau/mach-nix"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + }; + + outputs = inputs @ { self, nixpkgs, home-manager, mach-nix, ... }: + let + system = "x86_64-linux"; + pkgs = import nixpkgs { + inherit system; + config.allowUnfree = true; + }; + lib = nixpkgs.lib; + user = "tstarr"; + in { + nixosConfigurations = { + kestrel = lib.nixosSystem { + inherit system; + specialArgs = { inherit user; }; + modules = [ + ./hosts/kestrel/configuration.nix + ./hosts/kestrel/hardware.nix + home-manager.nixosModules.home-manager { + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + home-manager.extraSpecialArgs = { inherit user; }; + home-manager.users.${user} = { + imports = [ ./hosts/kestrel/home-configuration.nix ]; + }; + } + ]; + }; + }; + }; +} diff --git a/provision/nixos/hosts/kestrel/configuration.nix b/provision/nixos/hosts/kestrel/configuration.nix new file mode 100644 index 00000000..64cf97bd --- /dev/null +++ b/provision/nixos/hosts/kestrel/configuration.nix @@ -0,0 +1,145 @@ +{ config, pkgs, user, lib, ... }: +{ + nix = { + package = pkgs.nixFlakes; + extraOptions = "experimental-features = nix-command flakes"; + + settings.auto-optimise-store = true; + gc = { + automatic = true; + dates = "weekly"; + options = "--delete-older-than 7d"; + }; + }; + + # Add non-free packages + nixpkgs.config.allowUnfree = true; + nixpkgs.overlays = import ../../lib/overlays.nix; + + # Use zen kernel + boot.kernelPackages = pkgs.linuxPackages_zen; + + # Hardware options + hardware.bluetooth.enable = true; + hardware.sensor.iio.enable = true; + hardware.opengl.enable = true; + hardware.opengl.driSupport = true; + hardware.opengl.driSupport32Bit = true; + + # Use the systemd-boot EFI boot loader. + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + + # Set networking options + networking.hostName = "kestrel"; + networking.networkmanager.enable = true; + + # Set your time zone. + time.timeZone = "America/Los_Angeles"; + i18n.defaultLocale = "en_US.UTF-8"; + + #services.xserver = { + # enable = true; + # layout = "us"; + + # desktopManager.xterm.enable = false; + + # # Use nvidia drivers + # videoDrivers = [ "amdgpu" ]; + + # displayManager.gdm.enable = true; + # desktopManager.gnome.enable = true; + + # # Use the xmonad wm + # windowManager = { + # xmonad = { + # enable = true; + # enableContribAndExtras = true; + # }; + # }; + #}; + + # Enable sound. + sound.enable = true; + hardware.pulseaudio.enable = true; + hardware.pulseaudio.support32Bit = true; + + # Add fonts + fonts.fonts = with pkgs; [ + nerdfonts + ]; + + virtualisation.docker.enable = true; + virtualisation.docker.storageDriver = "btrfs"; + programs.zsh.enable = true; + # Define a user account. Don't forget to set a password with ‘passwd’. + users.users.${user} = { + isNormalUser = true; + extraGroups = [ "wheel" "docker" ]; # Enable ‘sudo’ for the user. + shell = pkgs.zsh; + }; + + # List packages installed in system profile. To search, run: + # $ nix search wget + environment.systemPackages = with pkgs; [ + vim + git + killall + pciutils + syncthing + #pamixer + vifm + mpv + pinentry-curses + trash-cli + bc + unzip + ]; + + # Enable user services + services = { + gvfs.enable = true; # USB automount + blueman.enable = true; + printing.enable = true; + printing.drivers = [ pkgs.hplip ]; + avahi.enable = true; + avahi.nssmdns = true; + syncthing = { + enable = true; + user = "tstarr"; + dataDir = "/home/tstarr/sync"; + configDir = "/home/tstarr/.config/syncthing"; + }; + }; + + # Enable the OpenSSH daemon. + services.openssh.enable = true; + services.pcscd.enable = true; + programs.gnupg.agent = { + enable = true; + pinentryFlavor = "curses"; + enableSSHSupport = true; + }; + + # Enable modules + imports = [ ../../modules ]; + modules = { + services = { + samba.enable = true; + vfio.enable = false; # Currently broken + }; + devel = { + tooling.enable = true; + python.enable = true; + engineering.enable = true; + }; + gaming = { + steam.enable = true; + }; + desktop = { + sway.enable = true; + }; + }; + + system.stateVersion = "22.11"; # Did you read the comment? +} diff --git a/provision/nixos/hosts/kestrel/hardware.nix b/provision/nixos/hosts/kestrel/hardware.nix new file mode 100644 index 00000000..809f3268 --- /dev/null +++ b/provision/nixos/hosts/kestrel/hardware.nix @@ -0,0 +1,64 @@ +# Do not modify this file! It was generated by ‘nixos-generate-config’ +# and may be overwritten by future invocations. Please make changes +# to /etc/nixos/configuration.nix instead. +{ config, lib, pkgs, modulesPath, ... }: + +{ + imports = + [ (modulesPath + "/installer/scan/not-detected.nix") + ]; + + boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-amd" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/b946d3b5-86ea-4f22-be13-532a60023b98"; + fsType = "btrfs"; + options = [ "subvol=root" ]; + }; + + fileSystems."/home" = + { device = "/dev/disk/by-uuid/b946d3b5-86ea-4f22-be13-532a60023b98"; + fsType = "btrfs"; + options = [ "subvol=home" ]; + }; + + fileSystems."/nix" = + { device = "/dev/disk/by-uuid/b946d3b5-86ea-4f22-be13-532a60023b98"; + fsType = "btrfs"; + options = [ "subvol=nix" ]; + }; + + fileSystems."/persist" = + { device = "/dev/disk/by-uuid/b946d3b5-86ea-4f22-be13-532a60023b98"; + fsType = "btrfs"; + options = [ "subvol=persist" ]; + }; + + fileSystems."/var/log" = + { device = "/dev/disk/by-uuid/b946d3b5-86ea-4f22-be13-532a60023b98"; + fsType = "btrfs"; + options = [ "subvol=log" ]; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/0A89-7181"; + fsType = "vfat"; + }; + + swapDevices = + [ { device = "/dev/disk/by-uuid/b62ff9a9-37ed-494a-9805-9f148aff4b9c"; } + ]; + + # Enables DHCP on each ethernet and wireless interface. In case of scripted networking + # (the default) this is the recommended approach. When using systemd-networkd it's + # still possible to use this option, but it's recommended to use it in conjunction + # with explicit per-interface declarations with `networking.interfaces..useDHCP`. + networking.useDHCP = lib.mkDefault true; + # networking.interfaces.enp3s0.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/provision/nixos/hosts/kestrel/home-configuration.nix b/provision/nixos/hosts/kestrel/home-configuration.nix new file mode 100644 index 00000000..3cde05e3 --- /dev/null +++ b/provision/nixos/hosts/kestrel/home-configuration.nix @@ -0,0 +1,24 @@ +{ config, pkgs, user, ... }: +{ + home.username = "${user}"; + home.homeDirectory = "/home/${user}"; + programs.home-manager.enable = true; + + + home.packages = with pkgs; [ + google-chrome + firefox + alacritty + gamemode + lutris + pcmanfm + discord + inkscape + libreoffice-fresh + chezmoi + rbw + vscodium.fhs + ]; + + home.stateVersion = "22.11"; +} diff --git a/provision/nixos/lib/overlays.nix b/provision/nixos/lib/overlays.nix new file mode 100644 index 00000000..7a31e8be --- /dev/null +++ b/provision/nixos/lib/overlays.nix @@ -0,0 +1,7 @@ +/* This configures nixpkgs.overlays to include our overlays/ directory. + */ +let path = ../overlays; in with builtins; +map (n: import (path + ("/" + n))) + (filter (n: match ".*\\.nix" n != null || + pathExists (path + ("/" + n + "/default.nix"))) + (attrNames (readDir path))) diff --git a/provision/nixos/modules/.placeholder b/provision/nixos/modules/.placeholder new file mode 100644 index 00000000..e69de29b diff --git a/provision/nixos/modules/default.nix b/provision/nixos/modules/default.nix new file mode 100644 index 00000000..efa58c8d --- /dev/null +++ b/provision/nixos/modules/default.nix @@ -0,0 +1,4 @@ +{ ... }: +{ + imports = [ ./desktop ./gaming ./devel ./services ]; +} diff --git a/provision/nixos/modules/desktop/default.nix b/provision/nixos/modules/desktop/default.nix new file mode 100644 index 00000000..82bc7354 --- /dev/null +++ b/provision/nixos/modules/desktop/default.nix @@ -0,0 +1,4 @@ +{ ... }: +{ + imports = [ ./sway.nix ]; +} diff --git a/provision/nixos/modules/desktop/sway.nix b/provision/nixos/modules/desktop/sway.nix new file mode 100644 index 00000000..6353c9f5 --- /dev/null +++ b/provision/nixos/modules/desktop/sway.nix @@ -0,0 +1,71 @@ +{ config, lib, pkgs, user, ... }: + +let + cfg = config.modules.desktop.sway; + + # currently, there is some friction between sway and gtk: + # https://github.com/swaywm/sway/wiki/GTK-3-settings-on-Wayland + # the suggested way to set gtk settings is with gsettings + # for gsettings to work, we need to tell it where the schemas are + # using the XDG_DATA_DIR environment variable + # run at the end of sway config + configure-gtk = pkgs.writeTextFile { + name = "configure-gtk"; + destination = "/bin/configure-gtk"; + executable = true; + text = let + schema = pkgs.gsettings-desktop-schemas; + datadir = "${schema}/share/gsettings-schemas/${schema.name}"; + in '' + export XDG_DATA_DIRS=${datadir}:$XDG_DATA_DIRS + gnome_schema=org.gnome.desktop.interface + gsettings set $gnome_schema gtk-theme 'Dracula' + ''; + }; + +in { + options.modules.desktop.sway.enable = lib.mkEnableOption "sway"; + config = lib.mkIf cfg.enable { + + environment.systemPackages = with pkgs; [ + sway + wayland + xwayland + configure-gtk + xdg-utils # for opening default programs when clicking links + glib # gsettings + dracula-theme # gtk theme + gnome3.adwaita-icon-theme # default gnome cursors + swaylock-effects + swayidle + grim # screenshot functionality + wl-clipboard # wl-copy and wl-paste for copy/paste from stdin / stdout + mako # notification system developed by swaywm maintainer + #dunst + wdisplays # tool to configure displays + rofi + imagemagick + feh + ]; + + # xdg-desktop-portal works by exposing a series of D-Bus interfaces + # known as portals under a well-known name + # (org.freedesktop.portal.Desktop) and object path + # (/org/freedesktop/portal/desktop). + # The portal interfaces include APIs for file access, opening URIs, + # printing and others. + services.dbus.enable = true; + xdg.portal = { + enable = true; + wlr.enable = true; + # gtk portal needed to make gtk apps happy + extraPortals = [ pkgs.xdg-desktop-portal-gtk ]; + }; + + # enable sway window manager + programs.sway = { + enable = true; + wrapperFeatures.gtk = true; + }; + }; +} diff --git a/provision/nixos/modules/devel/default.nix b/provision/nixos/modules/devel/default.nix new file mode 100644 index 00000000..ebe66dbb --- /dev/null +++ b/provision/nixos/modules/devel/default.nix @@ -0,0 +1,5 @@ +{ ... }: + +{ + imports = [ ./tooling.nix ./python.nix ./engineering.nix ]; +} diff --git a/provision/nixos/modules/devel/engineering.nix b/provision/nixos/modules/devel/engineering.nix new file mode 100644 index 00000000..2926450c --- /dev/null +++ b/provision/nixos/modules/devel/engineering.nix @@ -0,0 +1,14 @@ +# CAD and 3d printing and everything nice + +{ config, lib, pkgs, user, ... }: + +let + cfg = config.modules.devel.engineering; +in { + options.modules.devel.engineering.enable = lib.mkEnableOption "engineering"; + config = lib.mkIf cfg.enable { + + # Install packages + environment.systemPackages = with pkgs; [ super-slicer freecad blender ]; + }; +} diff --git a/provision/nixos/modules/devel/python.nix b/provision/nixos/modules/devel/python.nix new file mode 100644 index 00000000..f4e9fc4b --- /dev/null +++ b/provision/nixos/modules/devel/python.nix @@ -0,0 +1,27 @@ +# python with all the venom + +{ config, lib, pkgs, user, ... }: + +let + cfg = config.modules.devel.python; + my-python-packages = ps: with ps; [ + virtualenv + i3ipc + ipython + pip + ]; + +in { + options.modules.devel.python.enable = lib.mkEnableOption "python"; + config = lib.mkIf cfg.enable { + + # Install packages + environment.systemPackages = with pkgs; [ + (python3.withPackages my-python-packages) + beancount + fava + nodePackages_latest.pyright + distrobox + ]; + }; +} diff --git a/provision/nixos/modules/devel/tooling.nix b/provision/nixos/modules/devel/tooling.nix new file mode 100644 index 00000000..2468e886 --- /dev/null +++ b/provision/nixos/modules/devel/tooling.nix @@ -0,0 +1,19 @@ +# coding stuff for all the languages + +{ config, lib, pkgs, user, ... }: + +let + cfg = config.modules.devel.tooling; +in { + options.modules.devel.tooling.enable = lib.mkEnableOption "tooling"; + config = lib.mkIf cfg.enable { + + # Install packages + environment.systemPackages = with pkgs; [ + neovim + ripgrep + tmux + tmuxinator + ]; + }; +} diff --git a/provision/nixos/modules/gaming/default.nix b/provision/nixos/modules/gaming/default.nix new file mode 100644 index 00000000..11482080 --- /dev/null +++ b/provision/nixos/modules/gaming/default.nix @@ -0,0 +1,4 @@ +{ ... }: +{ + imports = [ ./steam.nix ]; +} diff --git a/provision/nixos/modules/gaming/steam.nix b/provision/nixos/modules/gaming/steam.nix new file mode 100644 index 00000000..4cd34062 --- /dev/null +++ b/provision/nixos/modules/gaming/steam.nix @@ -0,0 +1,23 @@ +{ config, lib, pkgs, user, ... }: + +let cfg = config.modules.gaming.steam; +in { + options.modules.gaming.steam.enable = lib.mkEnableOption "steam"; + config = lib.mkIf cfg.enable { + hardware.opengl = { # this fixes the "glXChooseVisual failed" bug, context: https://github.com/NixOS/nixpkgs/issues/47932 + enable = true; + driSupport32Bit = true; + }; + + # optionally enable 32bit pulseaudio support if pulseaudio is enabled + hardware.pulseaudio.support32Bit = config.hardware.pulseaudio.enable; + + hardware.steam-hardware.enable = true; + + environment.systemPackages = [ + pkgs.steam + pkgs.ryujinx + ]; + }; + +} diff --git a/provision/nixos/modules/services/default.nix b/provision/nixos/modules/services/default.nix new file mode 100644 index 00000000..2cd00db1 --- /dev/null +++ b/provision/nixos/modules/services/default.nix @@ -0,0 +1,5 @@ +{ ... }: + +{ + imports = [ ./samba.nix ./vfio.nix ]; +} diff --git a/provision/nixos/modules/services/samba.nix b/provision/nixos/modules/services/samba.nix new file mode 100644 index 00000000..2c5d073f --- /dev/null +++ b/provision/nixos/modules/services/samba.nix @@ -0,0 +1,32 @@ +# Samba for file sharing! + +{ config, lib, pkgs, ... }: + +let cfg = config.modules.services.samba; +in { + options.modules.services.samba.enable = lib.mkEnableOption "samba"; + config = lib.mkIf cfg.enable { + services.samba = { + enable = true; + extraConfig = '' + browseable = yes + smb encrypt = required + ''; + shares = { + homes = { + browseable = "no"; # note: each home will be browseable; the "homes" share will not. + "read only" = "no"; + "guest ok" = "no"; + }; + }; + }; + + # Curiously, `services.samba` does not automatically open + # the needed ports in the firewall. + networking.firewall.allowedTCPPorts = [ 445 139 ]; + networking.firewall.allowedUDPPorts = [ 137 138 ]; + + # To make SMB mounting easier on the command line + environment.systemPackages = with pkgs; [ cifs-utils ]; + }; +} diff --git a/provision/nixos/modules/services/vfio.nix b/provision/nixos/modules/services/vfio.nix new file mode 100644 index 00000000..46853e29 --- /dev/null +++ b/provision/nixos/modules/services/vfio.nix @@ -0,0 +1,57 @@ +# vfio setup for windows gaming with single gpu + +{ config, lib, pkgs, user, ... }: + +let cfg = config.modules.services.vfio; +in { + options.modules.services.vfio.enable = lib.mkEnableOption "samba"; + config = lib.mkIf cfg.enable { + + users.users.${user}.extraGroups = [ "qemu-libvirtd" "libvirtd" "kvm" ]; + + # Boot configuration + boot.kernelParams = [ "amd_iommu=on" "iommu=pt" ]; + boot.kernelModules = [ "kvm-amd" "vfio-pci" ]; + + programs.dconf.enable = true; + + environment.systemPackages = with pkgs; [ virt-manager ]; + + # Enable libvirtd + virtualisation.libvirtd = { + enable = true; + onBoot = "ignore"; + onShutdown = "shutdown"; + qemu.ovmf.enable = true; + qemu.runAsRoot = true; + }; + + # Place helper files where libvirt can get to them + environment.etc = { + "libvirt/hooks/qemu" = { + source = "/home/${user}/.setup/local/gpu-passthrough/qemu"; + mode = "0755"; + }; + "libvirt/hooks/qemu.d/win10/prepare/begin/start.sh" = { + source = "/home/${user}/.setup/local/gpu-passthrough/start.sh"; + mode = "0755"; + }; + "libvirt/hooks/qemu.d/win10/release/end/revert.sh" = { + source = "/home/${user}/.setup/local/gpu-passthrough/revert.sh"; + mode = "0755"; + }; + "libvirt/qemu.conf" = { + source = "/home/${user}/.setup/local/gpu-passthrough/qemu.conf"; + mode = "0755"; + }; + "libvirt/libvirtd.conf" = { + source = "/home/${user}/.setup/local/gpu-passthrough/libvirtd.conf"; + mode = "0755"; + }; + "libvirt/patch.rom" = { + source = "/home/${user}/.setup/local/gpu-passthrough/patch.rom"; + mode = "0755"; + }; + }; + }; +} diff --git a/provision/nixos/overlays/.placeholder b/provision/nixos/overlays/.placeholder new file mode 100644 index 00000000..e69de29b diff --git a/provision/nixos/overlays/rofi.nix b/provision/nixos/overlays/rofi.nix new file mode 100644 index 00000000..610b0969 --- /dev/null +++ b/provision/nixos/overlays/rofi.nix @@ -0,0 +1,5 @@ +self: super: { + rofi = super.rofi.override { plugins = [ self.rofi-emoji ]; }; +} + + diff --git a/provision/nixos/pkgs/.placeholder b/provision/nixos/pkgs/.placeholder new file mode 100644 index 00000000..e69de29b