From 793752fd20d29a3e86bf85ed621e9bae2557d818 Mon Sep 17 00:00:00 2001 From: Thorn Avery Date: Tue, 27 Apr 2021 22:47:09 +0000 Subject: [PATCH] initial commit --- .gitignore | 3 + README.md | 13 +++ flake.lock | 186 +++++++++++++++++++++++++++++++++++++ flake.nix | 63 +++++++++++++ hardware/iwakura/default.nix | 44 +++++++++ hardware/iwakura/drives.nix | 81 ++++++++++++++++ hardware/iwakura/keyboard.nix | 27 ++++++ hardware/iwakura/network.nix | 19 ++++ hardware/iwakura/opengl.nix | 13 +++ hardware/iwakura/power.nix | 10 ++ hardware/iwakura/sound.nix | 5 + hardware/iwakura/wireless.nix | 20 ++++ lib/colours.nix | 21 +++++ modules/bspwm/default.nix | 17 ++++ modules/bspwm/home.nix | 16 ++++ modules/bspwm/rofi.nix | 53 +++++++++++ modules/bspwm/wm.nix | 64 +++++++++++++ modules/bspwm/zsh.nix | 39 ++++++++ modules/flakes/default.nix | 10 ++ modules/gc/default.nix | 14 +++ modules/picom/home.nix | 23 +++++ modules/urxvt/home.nix | 10 ++ users/root/default.nix | 10 ++ users/root/home.nix | 24 +++++ users/root/pubkeys/id_ecdsa.pub | 1 + users/root/pubkeys/id_ed25519.pub | 1 + users/root/pubkeys/id_rsa.pub | 1 + users/thorn/default.nix | 19 ++++ users/thorn/fonts/default.nix | 5 + users/thorn/fonts/home.nix | 9 ++ users/thorn/home.nix | 81 ++++++++++++++++ users/thorn/pubkeys/id_ecdsa.pub | 1 + users/thorn/pubkeys/id_ed25519.pub | 1 + users/thorn/pubkeys/id_rsa.pub | 1 + users/thorn/xresources.nix | 27 ++++++ 35 files changed, 932 insertions(+) create mode 100755 .gitignore create mode 100644 README.md create mode 100644 flake.lock create mode 100644 flake.nix create mode 100644 hardware/iwakura/default.nix create mode 100644 hardware/iwakura/drives.nix create mode 100644 hardware/iwakura/keyboard.nix create mode 100644 hardware/iwakura/network.nix create mode 100644 hardware/iwakura/opengl.nix create mode 100644 hardware/iwakura/power.nix create mode 100644 hardware/iwakura/sound.nix create mode 100644 hardware/iwakura/wireless.nix create mode 100644 lib/colours.nix create mode 100644 modules/bspwm/default.nix create mode 100644 modules/bspwm/home.nix create mode 100644 modules/bspwm/rofi.nix create mode 100644 modules/bspwm/wm.nix create mode 100644 modules/bspwm/zsh.nix create mode 100755 modules/flakes/default.nix create mode 100644 modules/gc/default.nix create mode 100644 modules/picom/home.nix create mode 100644 modules/urxvt/home.nix create mode 100644 users/root/default.nix create mode 100755 users/root/home.nix create mode 100644 users/root/pubkeys/id_ecdsa.pub create mode 100644 users/root/pubkeys/id_ed25519.pub create mode 100644 users/root/pubkeys/id_rsa.pub create mode 100644 users/thorn/default.nix create mode 100644 users/thorn/fonts/default.nix create mode 100644 users/thorn/fonts/home.nix create mode 100755 users/thorn/home.nix create mode 100644 users/thorn/pubkeys/id_ecdsa.pub create mode 100644 users/thorn/pubkeys/id_ed25519.pub create mode 100644 users/thorn/pubkeys/id_rsa.pub create mode 100755 users/thorn/xresources.nix diff --git a/.gitignore b/.gitignore new file mode 100755 index 0000000..d4a5425 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +*.swp +old +result diff --git a/README.md b/README.md new file mode 100644 index 0000000..276a4be --- /dev/null +++ b/README.md @@ -0,0 +1,13 @@ +# Thorn Avery's NixOS Flake + +`.i .ui coi .i'au mi'au` + +this repo will serve as the configuration for my laptop `iwakura` (blessed be her name), and hopefully in the future will contain my other systems configurations also. + +i also intend for this to be a wiki of sorts for documenting things i find about NixOS such that others may also use this wonderful system, because the more people use NixOS, the higher the chance someone smarter than me ports it to Plan9. + +## to do list + +the window manager config needs to be seperated out into its modules, at the moment everything is bundled together in a gross way. + +i also need to fix that weird zsh PATH bug, so that i can re-enable it as the default shell diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..1a4c00f --- /dev/null +++ b/flake.lock @@ -0,0 +1,186 @@ +{ + "nodes": { + "flake-utils": { + "locked": { + "lastModified": 1617631617, + "narHash": "sha256-PARRCz55qN3gy07VJZIlFeOX420d0nGF0RzGI/9hVlw=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "b2c27d1a81b0dc266270fa8aeecebbd1807fc610", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "home-manager": { + "inputs": { + "nixpkgs": "nixpkgs" + }, + "locked": { + "lastModified": 1617824794, + "narHash": "sha256-UGkvzx0nIXHhNq/KwJLjXvKAQRE2V33MuX+UirvqrkQ=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "2aa20ae969f2597c4df10a094440a66e9d7f8c86", + "type": "github" + }, + "original": { + "owner": "nix-community", + "ref": "release-20.09", + "repo": "home-manager", + "type": "github" + } + }, + "nixos-hardware": { + "locked": { + "lastModified": 1618976009, + "narHash": "sha256-G5Z2Keob1pWrrdUqH2MYv15NKitklb4/A3ZdSp+3f/M=", + "owner": "NixOS", + "repo": "nixos-hardware", + "rev": "241d8300b2746c1db715eaf8d64748990cd0bb7a", + "type": "github" + }, + "original": { + "owner": "NixOS", + "repo": "nixos-hardware", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1619132512, + "narHash": "sha256-Ag0SPRotWMfekMlCrGqaLIvk92Xl9+WL2PKKYY447jU=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "603620a6308c0c8f00f4edef67a6a0a41a3c6f36", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "type": "indirect" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1619057301, + "narHash": "sha256-1Y1nCnwGSQHM76KGIhz+8tOAGOT3wlP+dKjwoyQXCtg=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "d235056d6d6dcbd2999bd55fd120d831d4df6304", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "rainbow-vim-src": { + "flake": false, + "locked": { + "lastModified": 1590654574, + "narHash": "sha256-PH4UY+/1JFrR5C0DpFrkfTc51wUQet8ynvAPKFxbFZk=", + "owner": "luochen1990", + "repo": "rainbow", + "rev": "4d15633cdaf61602e1d9fd216a77fc02e0881b2d", + "type": "github" + }, + "original": { + "owner": "luochen1990", + "repo": "rainbow", + "type": "github" + } + }, + "root": { + "inputs": { + "home-manager": "home-manager", + "nixos-hardware": "nixos-hardware", + "nixpkgs": "nixpkgs_2", + "swatch": "swatch", + "vim": "vim" + } + }, + "slimv-src": { + "flake": false, + "locked": { + "lastModified": 1617654210, + "narHash": "sha256-ui8feAAKe5+m8WxFZFvMp3dnAN8dA/O/4MXHUo0wr6E=", + "owner": "kovisoft", + "repo": "slimv", + "rev": "de657dd6e124189143589a725ae85113c09eb053", + "type": "github" + }, + "original": { + "owner": "kovisoft", + "repo": "slimv", + "type": "github" + } + }, + "swatch": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1617928465, + "narHash": "sha256-WbvMczpDqgLG+mMutNNIDHgj4h9JaaVihqjatYW1lrI=", + "owner": "techieAgnostic", + "repo": "swatch", + "rev": "c036a19747703c88bd4b446b6d8d474f6af280fd", + "type": "github" + }, + "original": { + "owner": "techieAgnostic", + "repo": "swatch", + "type": "github" + } + }, + "vim": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": [ + "nixpkgs" + ], + "rainbow-vim-src": "rainbow-vim-src", + "slimv-src": "slimv-src", + "vim-racket-src": "vim-racket-src" + }, + "locked": { + "lastModified": 1617934019, + "narHash": "sha256-50QBtpXB4U6IzU1mCj975t530GYaCrDHUcN4H1pxGhk=", + "owner": "techieAgnostic", + "repo": "vim", + "rev": "530f0ec712701b4e7ba88e7104477fdf044f1527", + "type": "github" + }, + "original": { + "owner": "techieAgnostic", + "repo": "vim", + "type": "github" + } + }, + "vim-racket-src": { + "flake": false, + "locked": { + "lastModified": 1595555951, + "narHash": "sha256-XqbR9qMvvaeZ7LHUemocJQQ/CaJSHxEwh7B7Y1o6KhU=", + "owner": "wlangstroth", + "repo": "vim-racket", + "rev": "bca2643c3d8bd0fcd46ab73bee69023a5da1964b", + "type": "github" + }, + "original": { + "owner": "wlangstroth", + "repo": "vim-racket", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..38ceaf6 --- /dev/null +++ b/flake.nix @@ -0,0 +1,63 @@ +{ + description = "Iwakura System Flake"; + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + nixos-hardware.url = "github:NixOS/nixos-hardware"; + home-manager.url = "github:nix-community/home-manager/release-20.09"; + swatch = { + url = "github:techieAgnostic/swatch"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + vim = { + url = "github:techieAgnostic/vim"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + }; + outputs = { self, nixpkgs, home-manager, nixos-hardware, swatch, vim, ...}: { + nixosConfigurations.iwakura = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + modules = [ + + # enable flakes or we'll be sad + (import ./modules/flakes) + + # enable sane garbage collection options + (import ./modules/gc) + + # enabling window-manager + (import ./modules/bspwm) + + # disk partitions and such (plus more that needs to be taken out) + (import ./hardware/iwakura) + + # community settings for this laptop + nixos-hardware.nixosModules.lenovo-thinkpad-t420 + nixos-hardware.nixosModules.common-pc-laptop-ssd + + # import home manager profiles and set to use same nixpkgs + home-manager.nixosModules.home-manager { + home-manager = { + useGlobalPkgs = true; + useUserPackages = true; + users = { + root = import ./users/root/home.nix; + thorn = import ./users/thorn/home.nix; + }; + }; + } + + # import nix config user profiles + misc + ({ pkgs, ... }: { + nixpkgs.overlays = [ + swatch.overlay + vim.overlay + ]; + imports = [ + ./users/root + ./users/thorn + ]; + }) + ]; + }; + }; +} diff --git a/hardware/iwakura/default.nix b/hardware/iwakura/default.nix new file mode 100644 index 0000000..e79d534 --- /dev/null +++ b/hardware/iwakura/default.nix @@ -0,0 +1,44 @@ +{ pkgs, config, ... }: + +{ + + imports = [ + ./drives.nix + ./keyboard.nix + ./network.nix + ./wireless.nix + ./power.nix + ./opengl.nix + ./sound.nix + ]; + + environment.systemPackages = with pkgs; [ + acpi + ]; + + console.keyMap = "dvorak"; + + hardware.bluetooth.enable = false; + + hardware.opengl.driSupport32Bit = true; + + system.stateVersion = "20.09"; + + boot.supportedFilesystems = [ "ntfs" ]; + boot = { + loader = { + systemd-boot.enable = true; + efi.canTouchEfiVariables = true; + }; + initrd = { + availableKernelModules = [ + "ehci_pci" "ata_piix" "usbhid" + "usb_storage" "sd_mod" "sdhci_pci" + ]; + kernelModules = [ "dm-snapshot" "i915" ]; + }; + kernelModules = [ "kvm-intel" "acpi_call" ]; + extraModulePackages = with config.boot.kernelPackages; [ acpi_call ]; + }; + +} diff --git a/hardware/iwakura/drives.nix b/hardware/iwakura/drives.nix new file mode 100644 index 0000000..b43051d --- /dev/null +++ b/hardware/iwakura/drives.nix @@ -0,0 +1,81 @@ +{ config, lib, pkgs, modulesPath, ... }: + +{ + + boot = { + initrd.luks.devices = { + root = { + device = "/dev/disk/by-uuid/33365b82-66af-4694-8f53-ca988035bb38"; + preLVM = true; + }; + data = { + device = "/dev/disk/by-uuid/e24d79c5-c24f-4e07-ab7e-a9c17cb21085"; + preLVM = true; + }; + speed = { + device = "/dev/disk/by-uuid/47106e9a-99fe-4c6d-a61d-8a25e7b53fc5"; + preLVM = true; + }; + }; + }; + + fileSystems = { + "/" = { + device = "/dev/disk/by-uuid/af8ae319-17ec-4631-b7aa-5cf4c9f9330c"; + fsType = "ext4"; + }; + + "/boot" = { + device = "/dev/disk/by-uuid/1918-A8CD"; + fsType = "vfat"; + }; + + "/data/size" = { + device = "/dev/disk/by-uuid/d927d682-57ec-4b9b-b2ce-e77772e37bbc"; + fsType = "ext4"; + }; + + "/data/speed" = { + device = "/dev/disk/by-uuid/eb1827e3-de96-4e79-816f-82ec9d84e45e"; + fsType = "ext4"; + }; + }; + + swapDevices = [ + { device = "/dev/disk/by-uuid/ff5cfba4-7c9d-41af-ba91-97d8022b79f7"; } + ]; +} + +# /dev/sdd1: BLOCK_SIZE="2048" UUID="1980-01-01-00-00-00-00" LABEL="nixos-minimal-20.09-x86_64" TYPE="iso9660" PTUUID="9fb6382f" PTTYPE="dos" PARTUUID="9fb6382f-01" +# /dev/mapper/vg--root-root: LABEL="root" UUID="af8ae319-17ec-4631-b7aa-5cf4c9f9330c" BLOCK_SIZE="4096" TYPE="ext4" +# /dev/mapper/vg--data-size: LABEL="data" UUID="d927d682-57ec-4b9b-b2ce-e77772e37bbc" BLOCK_SIZE="4096" TYPE="ext4" +# /dev/mapper/vg--speed-speed: LABEL="speed" UUID="eb1827e3-de96-4e79-816f-82ec9d84e45e" BLOCK_SIZE="4096" TYPE="ext4" +# /dev/loop0: TYPE="squashfs" +# /dev/sdc1: UUID="1918-A8CD" BLOCK_SIZE="512" TYPE="vfat" PARTLABEL="EFI System" PARTUUID="1a588f78-cfa9-4c7c-812f-34eb5865bec4" +# /dev/sdc2: UUID="33365b82-66af-4694-8f53-ca988035bb38" TYPE="crypto_LUKS" PARTLABEL="Linux filesystem" PARTUUID="3c4b2253-f1d0-4fbb-8ef9-294e5246f295" +# /dev/sda1: UUID="e24d79c5-c24f-4e07-ab7e-a9c17cb21085" TYPE="crypto_LUKS" PARTLABEL="Linux filesystem" PARTUUID="bd4f8053-5606-4018-bf7c-a42fc433be82" +# /dev/sdb1: UUID="47106e9a-99fe-4c6d-a61d-8a25e7b53fc5" TYPE="crypto_LUKS" PARTLABEL="Linux filesystem" PARTUUID="225715cc-ab3d-4ca1-b86d-a8453e8d9c9e" +# /dev/sdd2: SEC_TYPE="msdos" LABEL_FATBOOT="EFIBOOT" LABEL="EFIBOOT" UUID="1234-5678" BLOCK_SIZE="512" TYPE="vfat" PARTUUID="9fb6382f-02" +# /dev/mapper/crypt-root: UUID="Sj9qzV-VZYX-GGwJ-b5Sx-QL1E-399w-YBldee" TYPE="LVM2_member" +# /dev/mapper/crypt-size: UUID="OJkpMy-eN7n-qwJe-ZjKd-MDZd-SUW6-1qeV49" TYPE="LVM2_member" +# /dev/mapper/vg--data-swap: UUID="ff5cfba4-7c9d-41af-ba91-97d8022b79f7" TYPE="swap" +# /dev/mapper/crypt-speed: UUID="1HcMzn-Bbxq-evzi-AEQo-ffzD-5jOG-hOpc42" TYPE="LVM2_member" +# NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT +# loop0 7:0 0 522.2M 1 loop /nix/.ro-store +# sda 8:0 0 931.5G 0 disk +# └─sda1 8:1 0 931.5G 0 part +# └─crypt-size 254:2 0 931.5G 0 crypt +# ├─vg--data-swap 254:3 0 32G 0 lvm [SWAP] +# └─vg--data-size 254:4 0 899.5G 0 lvm /mnt/data/size +# sdb 8:16 0 119.2G 0 disk +# └─sdb1 8:17 0 119.2G 0 part +# └─crypt-speed 254:5 0 119.2G 0 crypt +# └─vg--speed-speed 254:6 0 119.2G 0 lvm /mnt/data/speed +# sdc 8:32 0 465.8G 0 disk +# ├─sdc1 8:33 0 200M 0 part /mnt/boot +# └─sdc2 8:34 0 465.6G 0 part +# └─crypt-root 254:0 0 465.5G 0 crypt +# └─vg--root-root 254:1 0 465.5G 0 lvm /mnt +# sdd 8:48 1 30G 0 disk +# ├─sdd1 8:49 1 571M 0 part /iso +# └─sdd2 8:50 1 23M 0 part diff --git a/hardware/iwakura/keyboard.nix b/hardware/iwakura/keyboard.nix new file mode 100644 index 0000000..cc34ef4 --- /dev/null +++ b/hardware/iwakura/keyboard.nix @@ -0,0 +1,27 @@ +{ pkgs, ... }: + +{ + + # to do: make this parameterised + services.actkbd = { + enable = true; + bindings = [ + { keys = [ 113 ]; + events = [ "key" ]; + command = + "/run/current-system/sw/bin/runuser -l thorn -c '${pkgs.alsaUtils}/bin/amixer -q set Master toggle'"; + } + { keys = [ 114 ]; + events = [ "key" "rep" ]; + command = + "/run/current-system/sw/bin/runuser -l thorn -c '${pkgs.alsaUtils}/bin/amixer -q -c 0 set Master 4- unmute'"; + } + { keys = [ 115 ]; + events = [ "key" "rep" ]; + command = + "/run/current-system/sw/bin/runuser -l thorn -c '${pkgs.alsaUtils}/bin/amixer -q -c 0 set Master 4+ unmute'"; + } + ]; + }; + +} diff --git a/hardware/iwakura/network.nix b/hardware/iwakura/network.nix new file mode 100644 index 0000000..357c774 --- /dev/null +++ b/hardware/iwakura/network.nix @@ -0,0 +1,19 @@ +{ + + networking = { + hostName = "iwakura"; + useDHCP = false; + firewall = { + allowedTCPPorts = [ 8384 6881 6882 6883 6884 6697 ]; + allowedUDPPorts = [ 6881 6882 6883 6884 6697 ]; + allowedTCPPortRanges = [ + { from = 8995; to = 8999; } + ]; + }; + interfaces = { + enp0s25.useDHCP = true; + wlp3s0.useDHCP = true; + }; + }; + +} diff --git a/hardware/iwakura/opengl.nix b/hardware/iwakura/opengl.nix new file mode 100644 index 0000000..e20d158 --- /dev/null +++ b/hardware/iwakura/opengl.nix @@ -0,0 +1,13 @@ +{ + + hardware.opengl = { + enable = true; + driSupport = true; + driSupport32Bit = true; + }; + + services.xserver.deviceSection = '' + Option "TearFree" "true" + ''; + +} diff --git a/hardware/iwakura/power.nix b/hardware/iwakura/power.nix new file mode 100644 index 0000000..078dd58 --- /dev/null +++ b/hardware/iwakura/power.nix @@ -0,0 +1,10 @@ +{ lib, ... }: + +{ + + powerManagement = { + cpuFreqGovernor = lib.mkDefault "powersave"; + powertop.enable = true; + }; + +} diff --git a/hardware/iwakura/sound.nix b/hardware/iwakura/sound.nix new file mode 100644 index 0000000..fc8542a --- /dev/null +++ b/hardware/iwakura/sound.nix @@ -0,0 +1,5 @@ +{ + + sound.enable = true; + +} diff --git a/hardware/iwakura/wireless.nix b/hardware/iwakura/wireless.nix new file mode 100644 index 0000000..3230054 --- /dev/null +++ b/hardware/iwakura/wireless.nix @@ -0,0 +1,20 @@ +{ pkgs, ... }: + +{ + + networking = { + networkmanager.enable = false; + wireless.enable = true; + }; + + environment.systemPackages = with pkgs; [ + wirelesstools + ]; + + hardware.enableRedistributableFirmware = true; + + boot = { + kernelModules = [ "cfg80211" ]; + }; + +} diff --git a/lib/colours.nix b/lib/colours.nix new file mode 100644 index 0000000..eb63e38 --- /dev/null +++ b/lib/colours.nix @@ -0,0 +1,21 @@ +{ + fg = "#d7d0c7"; + bg = "#151515"; + cc = "#d7d0c7"; + black = "#101010"; + blackBold = "#404040"; + red = "#e84f4f"; + redBold = "#d23d3d"; + green = "#b8d68c"; + greenBold = "#a0cf5d"; + yellow = "#e1aa5d"; + yellowBold = "#f39d21"; + blue = "#4e9fb1"; + blueBold = "#1e9fd1"; + magenta = "#9b64fb"; + magentaBold = "#8542ff"; + cyan = "#6d878d"; + cyanBold = "#42717b"; + white = "#dddddd"; + whiteBold = "#dddddd"; +} diff --git a/modules/bspwm/default.nix b/modules/bspwm/default.nix new file mode 100644 index 0000000..337a032 --- /dev/null +++ b/modules/bspwm/default.nix @@ -0,0 +1,17 @@ +{ + services.xserver = { + enable = true; + layout = "dvorak"; + libinput = { + enable = true; + touchpad.disableWhileTyping = true; + }; + displayManager = { + lightdm.enable = true; + defaultSession = "none+bspwm"; + }; + windowManager.bspwm = { + enable = true; + }; + }; +} diff --git a/modules/bspwm/home.nix b/modules/bspwm/home.nix new file mode 100644 index 0000000..c3cc3cc --- /dev/null +++ b/modules/bspwm/home.nix @@ -0,0 +1,16 @@ +{ pkgs, ... }: { + + imports = [ + ./wm.nix + ./rofi.nix + ./zsh.nix + ]; + + home.packages = with pkgs; [ + feh + ]; + + xsession = { + enable = true; + }; +} diff --git a/modules/bspwm/rofi.nix b/modules/bspwm/rofi.nix new file mode 100644 index 0000000..715f45d --- /dev/null +++ b/modules/bspwm/rofi.nix @@ -0,0 +1,53 @@ +{ pkgs, ...}: +let cs = import ../../lib/colours.nix; +in { + programs.rofi = { + enable = true; + cycle = true; + font = "tewi 8"; + lines = 10; + padding = 5; + rowHeight = 1; + scrollbar = false; + separator = "solid"; + terminal = "${pkgs.zsh}/bin/zsh"; + width = 300; + borderWidth = 5; + colors = { + window = { + border = cs.fg; + separator = cs.red; + background = cs.bg; + }; + rows = { + active = { + background = cs.fg; + backgroundAlt = cs.fg; + foreground = cs.bg; + highlight = { + background = cs.red; + foreground = cs.redBold; + }; + }; + urgent = { + background = cs.red; + backgroundAlt = cs.redBold; + foreground = cs.magenta; + highlight = { + background = cs.greenBold; + foreground = cs.yellow; + }; + }; + normal = { + background = cs.bg; + backgroundAlt = cs.bg; + foreground = cs.fg; + highlight = { + background = cs.cyanBold; + foreground = cs.greenBold; + }; + }; + }; + }; + }; +} diff --git a/modules/bspwm/wm.nix b/modules/bspwm/wm.nix new file mode 100644 index 0000000..19ba782 --- /dev/null +++ b/modules/bspwm/wm.nix @@ -0,0 +1,64 @@ +{ pkgs, config, ... }: { + + home.keyboard.layout = "dvorak"; + + # home.file.".xinitrc".text = '' + # xrdb ~/.Xresources + # sxhkd -m -1 -c ~/.config/sxhkd/sxhkdrc & + # exec ${config.xsession.windowManager.command} + # ''; + + xsession = { + enable = true; + windowManager.bspwm = { + enable = true; + monitors = { + "LVDS-1" = [ "I" "II" "III" "IV" "V" "VI" "VII" "VIII" "IX" "X" ]; + }; + rules = { + "xterm" = { + state = "pseudo_tiled"; + }; + }; + settings = { + border_width = 5; + window_gap = 10; + split_ration = 0.5; + }; + startupPrograms = [ + "feh --bg-fill .bg" + ]; + }; + }; + + + services.sxhkd = { + enable = true; + keybindings = { + "super + Return" = "urxvt"; + "super + {_,shift + }d" = "rofi -show {run,window}"; + "super + Escape" = "pkill -USR1 -x sxhkd"; + "super + shift + Escape" = "bspc wm -r"; + "super + m" = "bspc desktop -l next"; + "super + {_,shift + }q" = "bspc node -{c,k}"; + "super + {g, shift+g, c, r}" = "bspc node -t {tiled,pseudo_tiled,floating,fullscreen}"; + "super + ctrl + {g,c,r,l}" = "bspc node -g {marked,locked,sticky,private}"; + "super + y" = "bspc node newest.marked.local -n newest.!automatic.local"; + "super + {_,shift + }{h,t,n,s}" = "bspc node -{f,s} {west,south,north,east}"; + "super + {p,b,comma,period}" = "bspc node -f @{parent,brother,first,second}"; + "super + {_,shift + }u" = "bspc node -f {next,prev}.local.!hidden.window"; + "super + bracket{left,right}" = "bspc desktop -f {prev,next}.local"; + "super + {_,shift + }{1-9,0}" = "bspc {desktop -f,node -d} '^{1-9,0}'"; + "super + ctrl + {h,t,n,s}" = "bspc node -p {west,south,north,east}"; + "super + ctrl + {1-9}" = "bspc node -o 0.{1-9}"; + "super + ctrl + space" = "bspc node -p cancel"; + "super + ctrl + shift + space" = "bspc query -N -d | xargs -I id -n 1 bspc node id -p cancel"; + "super + alt + {h,t,n,s}" = "bspc node -z {left -20 0,bottom 0 20,top 0 -20,right 20 0}"; + "super + alt + shift + {h,t,n,s}" = "bspc node -z {right -20 0,top 0 20,bottom 0 -20,left 20 0}"; + "super + {Left,Down,Up,Right}" = "bspc node -v {-20 0,0 20,0 -20,20 0}"; + "super + {_,shift + }f" = "bspc node any.local -R {90,270}"; + "super + ctrl + {_,shift + }f" = "bspc node -R {90,270}"; + }; + }; + +} diff --git a/modules/bspwm/zsh.nix b/modules/bspwm/zsh.nix new file mode 100644 index 0000000..82ea334 --- /dev/null +++ b/modules/bspwm/zsh.nix @@ -0,0 +1,39 @@ +{ pkgs, config, ... } : +let + wrapPlugin = { name, pkg }: { + inherit name; + src = pkg + "/share/zsh/site-functions"; + }; +in { + + home.packages = [ + pkgs.swatch + ]; + + programs.zsh = { + enable = true; + enableAutosuggestions = true; + enableCompletion = true; + dotDir = ".config/zsh"; + history = { + expireDuplicatesFirst = true; + extended = true; + ignoreDups = true; + share = true; + }; + initExtra = '' + autoload -U colors && colors + export PROMPT="%{$fg[white]%}%B$(swatch)%b %{$fg[blue]%}%2~ %{$fg[green]%}%B>%b "; + ''; + shellAliases = { + nf = "neofetch --gtk2 off --gtk3 off --ascii_bold on"; + ls = "ls --color"; + }; + plugins = (map wrapPlugin [ + { name = "fast-syntax-highlighting"; + pkg = pkgs.zsh-fast-syntax-highlighting; + } + ]); + }; + programs.dircolors.enableZshIntegration = true; +} diff --git a/modules/flakes/default.nix b/modules/flakes/default.nix new file mode 100755 index 0000000..e84abea --- /dev/null +++ b/modules/flakes/default.nix @@ -0,0 +1,10 @@ +{ pkgs, ... }: { + + nix = { + package = pkgs.nixUnstable; + extraOptions = '' + experimental-features = nix-command flakes + ''; + }; + +} diff --git a/modules/gc/default.nix b/modules/gc/default.nix new file mode 100644 index 0000000..8346a85 --- /dev/null +++ b/modules/gc/default.nix @@ -0,0 +1,14 @@ +{ + nix = { + autoOptimiseStore = true; + gc = { + automatic = true; + dates = "weekly"; + options = "--delete-older-than 30d"; + }; + extraOptions = '' + min-free = ${toString (100*1024*1024)} # 100mb + max-free = ${toString (1024*1024*1024)} # free to 1gb free + ''; + }; +} diff --git a/modules/picom/home.nix b/modules/picom/home.nix new file mode 100644 index 0000000..6dc58c4 --- /dev/null +++ b/modules/picom/home.nix @@ -0,0 +1,23 @@ +{ pkgs, ... }: { + services.picom = { + enable = true; + activeOpacity = "1.0"; + inactiveOpacity = "0.85"; + blur = true; + fade = true; + fadeDelta = 5; + shadow = true; + shadowOpacity = "0.8"; + + vSync = true; + backend = "glx"; + + opacityRule = [ + "99:class_i ?= 'rofi'" + ]; + + extraOptions = '' + corner-radius = 5; + ''; + }; +} diff --git a/modules/urxvt/home.nix b/modules/urxvt/home.nix new file mode 100644 index 0000000..0018920 --- /dev/null +++ b/modules/urxvt/home.nix @@ -0,0 +1,10 @@ +{ pkgs, ... }: { + programs.urxvt = { + enable = true; + scroll.bar.enable = false; + }; + + xresources.extraConfig = '' + URxvt.internalBorder: 16 + ''; +} diff --git a/users/root/default.nix b/users/root/default.nix new file mode 100644 index 0000000..caae7fa --- /dev/null +++ b/users/root/default.nix @@ -0,0 +1,10 @@ +{ pkgs, ... }: { + + users.users.root = { + hashedPassword = "$6$fN9J7sDWZCJU$bybWVlYNHod4qXOTWDl9UZZgn7Bkb17ulM6wTr7hAhyQT4wlmW0An7pcXiYu3SqjSVnEmlma5uujfZ6Z.ZUL91"; + + # read all pub keys from ./pubkeys + openssh.authorizedKeys.keys = map builtins.readDir ./pubkeys; + }; + +} diff --git a/users/root/home.nix b/users/root/home.nix new file mode 100755 index 0000000..1ef47ad --- /dev/null +++ b/users/root/home.nix @@ -0,0 +1,24 @@ +{ lib, pkgs, ... }: { + + imports = [ ]; + + home = { + + # keyboard layout, v v important + keyboard.layout = "dvorak"; + + # packages that only root needs + packages = with pkgs; [ + # system stuff + htop gotop + git + zip p7zip + + # essential things + cowsay fortune + + ]; + + }; + +} diff --git a/users/root/pubkeys/id_ecdsa.pub b/users/root/pubkeys/id_ecdsa.pub new file mode 100644 index 0000000..3e56039 --- /dev/null +++ b/users/root/pubkeys/id_ecdsa.pub @@ -0,0 +1 @@ +ecdsa-sha2-nistp521 AAAAE2VjZHNhLXNoYTItbmlzdHA1MjEAAAAIbmlzdHA1MjEAAACFBADYAmgP0rKhGRTw9+9kRLbl5unjDefQ5X8G20L/5+bLHy5Q0vJkO2PBAqTrfIe23zLSUU7MZwxVyJRF0/3FNPOPfAAP4qv+Tv1waJD3aE1ApJl/Qmvj4a+McwJA3iG3rWdvD59qHs3xVFadE0OxxT21QUi0RAfsHDyEcR+4cnV/9civ4g== thorn avery general use diff --git a/users/root/pubkeys/id_ed25519.pub b/users/root/pubkeys/id_ed25519.pub new file mode 100644 index 0000000..846887b --- /dev/null +++ b/users/root/pubkeys/id_ed25519.pub @@ -0,0 +1 @@ +ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIWOEyzcn4ybt6MHXOGP5TSzMXQeoB/pkf9RgQxYtbT2 thorn@iwakura diff --git a/users/root/pubkeys/id_rsa.pub b/users/root/pubkeys/id_rsa.pub new file mode 100644 index 0000000..85d73f3 --- /dev/null +++ b/users/root/pubkeys/id_rsa.pub @@ -0,0 +1 @@ +ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCZbZ09bMf8KYtY50WxW0V96GGQ+JA10qskZ1oVeb2+3S9kVdvOBfqbLZ1CTZJ6+j9XOICNTrBPIKBxhWHwYZnikDy+hufxgSkwz1wyMqEKSZv33AxgEV4dhq+rpZMMnan27vmZyaGwyQURio7nI7hZuRJoCdgl/DYz/MrexkwtSZHGR9peZ7wVrjwiT62Nzyly6s4mlP0HjgFDiT67hoFWsC0D+n6xhzM1cYqeuPD32G1kYF91sFau/eqyFoo7RAXM08kDrszChww/otf0q0UeePJR0V9FTmTNaTdFHAxNyy+VYu009qDop+tNyk9BSLBXYSU9olIJDn12Wgw7z/Yn root@TMLAS-487-W10 diff --git a/users/thorn/default.nix b/users/thorn/default.nix new file mode 100644 index 0000000..67234ab --- /dev/null +++ b/users/thorn/default.nix @@ -0,0 +1,19 @@ +{ pkgs, ... }: { + + imports = [ + ./fonts + ]; + + users.users.thorn = { + hashedPassword = "$6$fN9J7sDWZCJU$bybWVlYNHod4qXOTWDl9UZZgn7Bkb17ulM6wTr7hAhyQT4wlmW0An7pcXiYu3SqjSVnEmlma5uujfZ6Z.ZUL91"; + + # read all pub keys from ./pubkeys + openssh.authorizedKeys.keys = map builtins.readFile (builtins.readDir ./pubkeys); + isNormalUser = true; + home = "/home/thorn"; + description = "Thorn Avery"; + extraGroups = [ "wheel" "networkmanager" "disks" ]; + # shell = pkgs.zsh; + }; + +} diff --git a/users/thorn/fonts/default.nix b/users/thorn/fonts/default.nix new file mode 100644 index 0000000..0ae0bf2 --- /dev/null +++ b/users/thorn/fonts/default.nix @@ -0,0 +1,5 @@ +{ pkgs, ... }: { + fonts.fonts = with pkgs; [ + tewi-font + ]; +} diff --git a/users/thorn/fonts/home.nix b/users/thorn/fonts/home.nix new file mode 100644 index 0000000..1265eda --- /dev/null +++ b/users/thorn/fonts/home.nix @@ -0,0 +1,9 @@ +{ + programs.urxvt.fonts = [ + "xft:tewi:style=Regular:pixelsize=11" + ]; + + xresources.properties = { + "URxvt.boldFont" = "xft:tewi:style=Bold:pixelsize=11"; + }; +} diff --git a/users/thorn/home.nix b/users/thorn/home.nix new file mode 100755 index 0000000..8f54843 --- /dev/null +++ b/users/thorn/home.nix @@ -0,0 +1,81 @@ +{ lib, pkgs, ... }: { + + ################################# + # user level home configuration # + ################################# + + # this file *should* contain: + # * a list of programs i want + # * definitions of any files i need in a certain place + # * user specific program configuration + # + # this file should *not* contain: + # * default program configuration that is not user specific + + imports = [ + ../../modules/bspwm/home.nix + ../../modules/urxvt/home.nix + ../../modules/picom/home.nix + + ./fonts/home.nix + ./xresources.nix + ]; + + home = { + + # keyboard layout, v v important + keyboard.layout = "dvorak"; + + # packages that are needed + packages = with pkgs; [ + # system stuff + htop gotop + neofetch scrot + git + zip p7zip + tmux + + # essential things + cowsay fortune + + # editors + ta.vim + + # web stuff + elinks qutebrowser + deluge + profanity weechat + youtube-dl + + # media + zathura + mpv + ncmpcpp + + # prog + rgbds sameboy + racket + stack ghc + idris idris2 + cargo rustc + + # games + nethack crawl crawlTiles + sgtpuzzles + wesnoth openxcom + manaplus + minetest + rftg + superTux superTuxKart + openttd + freeciv unciv + opentyrian + freedink freedroidrpg + freeorion + openarena + + ]; + + }; + +} diff --git a/users/thorn/pubkeys/id_ecdsa.pub b/users/thorn/pubkeys/id_ecdsa.pub new file mode 100644 index 0000000..3e56039 --- /dev/null +++ b/users/thorn/pubkeys/id_ecdsa.pub @@ -0,0 +1 @@ +ecdsa-sha2-nistp521 AAAAE2VjZHNhLXNoYTItbmlzdHA1MjEAAAAIbmlzdHA1MjEAAACFBADYAmgP0rKhGRTw9+9kRLbl5unjDefQ5X8G20L/5+bLHy5Q0vJkO2PBAqTrfIe23zLSUU7MZwxVyJRF0/3FNPOPfAAP4qv+Tv1waJD3aE1ApJl/Qmvj4a+McwJA3iG3rWdvD59qHs3xVFadE0OxxT21QUi0RAfsHDyEcR+4cnV/9civ4g== thorn avery general use diff --git a/users/thorn/pubkeys/id_ed25519.pub b/users/thorn/pubkeys/id_ed25519.pub new file mode 100644 index 0000000..846887b --- /dev/null +++ b/users/thorn/pubkeys/id_ed25519.pub @@ -0,0 +1 @@ +ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIWOEyzcn4ybt6MHXOGP5TSzMXQeoB/pkf9RgQxYtbT2 thorn@iwakura diff --git a/users/thorn/pubkeys/id_rsa.pub b/users/thorn/pubkeys/id_rsa.pub new file mode 100644 index 0000000..85d73f3 --- /dev/null +++ b/users/thorn/pubkeys/id_rsa.pub @@ -0,0 +1 @@ +ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCZbZ09bMf8KYtY50WxW0V96GGQ+JA10qskZ1oVeb2+3S9kVdvOBfqbLZ1CTZJ6+j9XOICNTrBPIKBxhWHwYZnikDy+hufxgSkwz1wyMqEKSZv33AxgEV4dhq+rpZMMnan27vmZyaGwyQURio7nI7hZuRJoCdgl/DYz/MrexkwtSZHGR9peZ7wVrjwiT62Nzyly6s4mlP0HjgFDiT67hoFWsC0D+n6xhzM1cYqeuPD32G1kYF91sFau/eqyFoo7RAXM08kDrszChww/otf0q0UeePJR0V9FTmTNaTdFHAxNyy+VYu009qDop+tNyk9BSLBXYSU9olIJDn12Wgw7z/Yn root@TMLAS-487-W10 diff --git a/users/thorn/xresources.nix b/users/thorn/xresources.nix new file mode 100755 index 0000000..afdc099 --- /dev/null +++ b/users/thorn/xresources.nix @@ -0,0 +1,27 @@ +let + cs = import ../../lib/colours.nix; +in { + + xresources.properties = { + # "*.font" = "-*-tewi-medium-*-*-*-11-*-*-*-*-*-*-*" + "*.foreground" = cs.fg; + "*.background" = cs.bg; + "*.cursorColor" = cs.cc; + "*.color0" = cs.black; + "*.color8" = cs.blackBold; + "*.color1" = cs.red; + "*.color9" = cs.redBold; + "*.color2" = cs.green; + "*.color10" = cs.greenBold; + "*.color3" = cs.yellow; + "*.color11" = cs.yellowBold; + "*.color4" = cs.blue; + "*.color12" = cs.blueBold; + "*.color5" = cs.magenta; + "*.color13" = cs.magentaBold; + "*.color6" = cs.cyan; + "*.color14" = cs.cyanBold; + "*.color7" = cs.white; + "*.color15" = cs.whiteBold; + }; +}