├── .gitignore ├── README.md ├── darwin ├── Arrakis │ ├── default.nix │ └── system ├── default.nix └── rekkbook │ ├── default.nix │ ├── homebrew.nix │ ├── networking.nix │ └── system ├── flake.lock ├── flake.nix ├── nixos ├── README.md ├── default.nix ├── godot │ ├── default.nix │ ├── hardware-configuration.nix │ └── system ├── iso-image │ ├── default.nix │ └── system ├── normandy │ ├── default.nix │ ├── hardware-configuration.nix │ └── system ├── orville │ ├── default.nix │ ├── hardware-configuration.nix │ └── system └── rocinante │ ├── boot.nix │ ├── default.nix │ ├── gold.nix │ ├── hardware-configuration.nix │ ├── home-assistant │ └── default.nix │ ├── netdata.nix │ ├── plex.nix │ ├── system │ ├── transmission.nix │ └── windows │ ├── default.nix │ ├── postStop.sh │ ├── preStart.sh │ └── script.sh ├── overlays ├── OVMF.nix ├── README.md ├── discord.nix ├── git.nix ├── nix-monitored.nix ├── nvim-base16.nix ├── pkgs │ ├── README.md │ ├── assign-cgroups │ │ ├── assign-cgroups │ │ └── default.nix │ ├── darwin-rebuild.nix │ ├── darwin-update │ │ ├── darwin-update.sh │ │ └── default.nix │ ├── default.nix │ ├── nixos-update │ │ ├── default.nix │ │ └── nixos-update.sh │ ├── nixos-wizard │ │ ├── default.nix │ │ └── nixos-wizard.sh │ ├── screenlock │ │ ├── default.nix │ │ └── screenlock │ └── shell-utils │ │ ├── default.nix │ │ └── utils.sh ├── system.nix ├── unstable │ ├── default.nix │ ├── direnv.nix │ └── neovim.nix ├── vscode-insiders.nix └── wine.nix ├── profiles ├── README.md ├── boot.nix ├── btrfs.nix ├── dvorak.nix ├── fonts.nix ├── fprintd.nix ├── geoclue.nix ├── gnome.nix ├── lib │ ├── attrsets.nix │ ├── dconf.nix │ ├── default.nix │ ├── filesystem.nix │ ├── licenses.nix │ ├── lists.nix │ ├── modules.nix │ ├── source-types.nix │ ├── strings.nix │ ├── trivial.nix │ ├── types.nix │ └── xdg.nix ├── network.nix ├── nix.nix ├── pipewire.nix ├── plymouth.nix ├── ssh.nix ├── users │ ├── common │ │ ├── apps.nix │ │ ├── dconf.nix │ │ ├── default.nix │ │ ├── direnv.nix │ │ ├── firefox.nix │ │ ├── git.nix │ │ ├── graphical.nix │ │ ├── home.nix │ │ ├── neovim │ │ │ ├── default.nix │ │ │ ├── ftplugin │ │ │ │ ├── cabal.lua │ │ │ │ ├── haskell.lua │ │ │ │ └── nix.lua │ │ │ ├── ginit.vim │ │ │ ├── init.vim │ │ │ └── plugin │ │ │ │ ├── autoreload.lua │ │ │ │ ├── cmp.lua │ │ │ │ ├── config.lua │ │ │ │ ├── debugger.lua │ │ │ │ ├── fidget.lua │ │ │ │ ├── gitsigns.lua │ │ │ │ ├── hlslens.lua │ │ │ │ ├── lsp-autoformat.lua │ │ │ │ ├── lsp-c.lua │ │ │ │ ├── lsp-clojure.lua │ │ │ │ ├── lsp-haskell.lua │ │ │ │ ├── lsp-highlight.lua │ │ │ │ ├── lsp-inlayhints.lua │ │ │ │ ├── lsp-lines.lua │ │ │ │ ├── lsp-lua.lua │ │ │ │ ├── lsp-nix.lua │ │ │ │ ├── lsp-rust.lua │ │ │ │ ├── lsp-signature.lua │ │ │ │ ├── lsp-ts.lua │ │ │ │ ├── neo-tree.lua │ │ │ │ ├── on-attach.lua │ │ │ │ ├── scrollbar.lua │ │ │ │ ├── theme.lua │ │ │ │ ├── treesitter.lua │ │ │ │ ├── trivial-setup.lua │ │ │ │ └── trouble.lua │ │ ├── starship.nix │ │ ├── tmux.nix │ │ ├── xdg │ │ │ ├── cabal │ │ │ │ └── config │ │ │ ├── default.nix │ │ │ └── libvirt │ │ │ │ └── qemu.conf │ │ └── zsh │ │ │ ├── default.nix │ │ │ └── init.sh │ ├── dragoncat │ │ └── default.nix │ ├── ners │ │ ├── apps.nix │ │ ├── calibre.nix │ │ ├── dconf.nix │ │ ├── default.nix │ │ ├── fonts.nix │ │ ├── home.nix │ │ ├── images │ │ │ ├── ners.jpg │ │ │ ├── nix-wallpaper-nineish-dark-gray.png │ │ │ └── nix-wallpaper-nineish.png │ │ ├── sway │ │ │ ├── albert.nix │ │ │ ├── applets.nix │ │ │ ├── cgroups.nix │ │ │ ├── default.nix │ │ │ ├── foot.nix │ │ │ ├── gnome.nix │ │ │ ├── grim.nix │ │ │ ├── kanshi.nix │ │ │ ├── mako.nix │ │ │ ├── rofi.nix │ │ │ ├── swayidle.nix │ │ │ ├── waybar │ │ │ │ ├── default.nix │ │ │ │ └── waybar.css │ │ │ ├── wlr.nix │ │ │ ├── xf86.nix │ │ │ └── yambar.nix │ │ └── vscode.nix │ └── rekk │ │ ├── default.nix │ │ ├── fonts.nix │ │ ├── git │ │ └── default.nix │ │ ├── home.nix │ │ ├── neovim │ │ ├── default.nix │ │ ├── init.vim │ │ ├── lua │ │ │ ├── autoformat.lua │ │ │ ├── colour.lua │ │ │ ├── config.lua │ │ │ ├── diagnostics.lua │ │ │ └── on-attach.lua │ │ └── plugin │ │ │ ├── bqf.lua │ │ │ ├── fzf-lua.lua │ │ │ ├── impatient.lua │ │ │ ├── lsp-clojure.lua │ │ │ ├── lsp-graphql.lua │ │ │ ├── lsp-haskell.lua │ │ │ ├── lsp-lua.lua │ │ │ ├── lsp-nix.lua │ │ │ ├── lsp-swift.lua │ │ │ ├── lsp-tsserver.lua │ │ │ ├── neoscroll.lua │ │ │ ├── nvim-cmp.lua │ │ │ ├── nvim-tree.lua │ │ │ └── treesitter.lua │ │ ├── skhd │ │ └── default.nix │ │ ├── system │ │ └── default.nix │ │ ├── yabai │ │ └── default.nix │ │ └── zsh │ │ ├── default.nix │ │ └── init.sh ├── virtualisation.nix ├── zram.nix └── zsh.nix └── roles ├── README.md ├── base.nix ├── darwin.nix ├── desktop.nix ├── laptop.nix ├── nixos.nix └── server.nix /.gitignore: -------------------------------------------------------------------------------- 1 | .direnv 2 | .envrc 3 | .DS_Store 4 | result* 5 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # A Somewhat Attractive NixOS Configuration 2 | 3 | Nix logo 4 | 5 | > This is my Nix flake. There are many like it, but this one is mine. 6 | > 7 | > My Nix flake is my best friend. It is my life. I must master it as I must master my life. 8 | > 9 | > Without me, my Nix flake is useless. Without my Nix flake, I am useless. I must configure my Nix flake true. I must build more reproducibly than my computer who is trying to deceive me. I must configure it before it deceives me. I will ... 10 | > 11 | > My Nix flake and I know that what counts in IT is not the amount of words we type, the noise of our keyboard, nor the outputs we make. We know that it is the derivations that count. We will derive ... 12 | > 13 | > My Nix flake is human, even as I am human, because it is my life. Thus, I will learn it as a brother. I will learn its weaknesses, its strength, its code, its tooling, its inputs and outputs. I will keep my Nix flake clean and ready, even as I am clean and ready. We will become part of each other. We will ... 14 | > 15 | > Before God, I swear this creed. My Nix flake and I are the defenders of reliability. We are the masters of reproducibility. We are the saviors of my life. 16 | > 17 | > So be it, until victory is reproducible and there is no uncertainty, but peace! 18 | > 19 | > — NixOS User's Creed 20 | 21 | ## Overview 22 | 23 | This repository contains configuration files that can be used to build a [NixOS][nixos] image, or to configure [Nix on other Linux distributions][nix-on-linux] (including [WSL][nix-on-wsl]) by using [home-manager][home-manager]. 24 | 25 | ## Who is this for? 26 | 27 | The primary purpose of this repository is to [Just Work™][just-work] as a configuration for [my][ners] [devices][configurations]. 28 | 29 | However, the repository is also intended as a model of a fully-featured NixOS configuration. 30 | As such it can be used as a reference or starting point for others interested in Nix and NixOS. 31 | 32 | ## Design goals 33 | 34 | The following goals are the driving force of this repository: 35 | 36 | ### Easy to study and extend 37 | 38 | The configurations provided by this repository are opinionated, and are indeed only guaranteed to work for me. 39 | However, they should provide a good starting point for those seeking to strengthen their Nix-fu, as well as a base on top of which one can easily create derivative configurations, even with little Nix knowledge. 40 | If nothing else, I rely on this feature when creating new configurations for myself. 41 | - Separation of concerns makes it easy to enable features, either shared across configurations, or specific to a configuration. 42 | - There should be as few sources of truth as possible; e.g. the [latest NixOS version], while referenced in multiple places, is only specified [once][nixos-version-defined]. 43 | - Care has gone into organising and documenting the repository. Eventually all non-trivial decisions should be documented and justified. 44 | 45 | ### Good desktop experience 46 | 47 | The Linux Desktop has in many ways surpassed other desktop offerings in both form and function. 48 | A good distribution should delight its users from first boot. 49 | 50 | This largely comes down to choosing sensible defaults: 51 | - The GNOME desktop environment has rightfully become the de facto standard of modern Linux Desktop. It is mature, feature-complete, and polished to a shine even out of the box. 52 | - Wayland and Pipewire are modern standards for video and audio respectively. 53 | - The keyboard layout of choice should be set up in both console and graphical environments. 54 | - The shell/terminal setup should be delightful rather than boring and plain, and should not break POSIX compatilibity. 55 | - Reasonably useful utilities such as virtualisation managers, e-mail clients, and office applications, should come out of the box; the ease of doing so is the largest victory of modern Linux desktop. 56 | - When running as a virtualised guest, it should be easy to configure guest tools and agents for improved integration with the host; e.g. the [ISO image][iso-image] is one such configuration. 57 | 58 | ### Easy server setup 59 | 60 | In addition to desktop configurations, this repository should also make it easy to specify server configurations. 61 | Many of these goals also benefit the desktop experience: 62 | - Full-disk encryption should be an easy default. 63 | - Modern filesystems (e.g. [btrfs][btrfs]) add features such as subvolumes, snapshotting, transparent compression, and many more. These should be used to their full potential. 64 | - systemd and NetworkManager should be leveraged to their full extent. 65 | 66 | ### Easy to install and maintain 67 | 68 | After test-driving the live environment, installing it to persistent storage should be as painless as possible. 69 | 70 | NixOS has no canonical guided installation yet, so this repository provides [an opinionated one][installation-wizard]. 71 | 72 | There is also [a utility][update-wizard] for updating the system. 73 | 74 | ## Getting started 75 | 76 | WIP 77 | 78 | [btrfs]: https://btrfs.wiki.kernel.org 79 | [configurations]: /configurations 80 | [home-manager]: https://github.com/nix-community/home-manager 81 | [installation-wizard]: /overlays/pkgs/nixos-wizard/wizard.sh 82 | [iso-image]: /configurations/iso-image/default.nix 83 | [just-work]: https://youtu.be/CZFKWt3S2Ys 84 | [ners]: https://github.com/ners 85 | [nix-on-linux]: https://nixos.org/download.html#nix-install-linux 86 | [nix-on-wsl]: https://nixos.wiki/wiki/Nix_Installation_Guide#Windows_Subsystem_for_Linux_.28WSL.29 87 | [nixos-version-defined]: /flake.nix#L3 88 | [nixos]: https://nixos.org 89 | [update-wizard]: /overlays/pkgs/nixos-update/nixos-update.sh 90 | -------------------------------------------------------------------------------- /darwin/Arrakis/default.nix: -------------------------------------------------------------------------------- 1 | { inputs, pkgs, ... }: 2 | 3 | { 4 | imports = with inputs; [ 5 | self.roles.base 6 | self.profiles.users.dragoncat 7 | ]; 8 | } 9 | -------------------------------------------------------------------------------- /darwin/Arrakis/system: -------------------------------------------------------------------------------- 1 | x86_64-darwin 2 | -------------------------------------------------------------------------------- /darwin/default.nix: -------------------------------------------------------------------------------- 1 | { lib, inputs, overlays, ... }: 2 | 3 | with builtins; 4 | 5 | lib.pipe ./. [ 6 | lib.findModules 7 | (mapAttrs (name: path: 8 | let 9 | system = with lib; pipe (path + "/system") [ readFile lines head ]; 10 | pkgs = import inputs.nixpkgs-stable { inherit system overlays; }; 11 | in 12 | inputs.nix-darwin.lib.darwinSystem { 13 | inherit system; 14 | modules = [ 15 | inputs.home-manager.darwinModules.default 16 | inputs.nix-monitored.darwinModules.${system}.default 17 | path 18 | ]; 19 | specialArgs = { 20 | inherit pkgs lib; 21 | inputs = inputs // { 22 | nixpkgs = inputs.nixpkgs-unstable; 23 | darwin = inputs.nix-darwin; 24 | }; 25 | }; 26 | } 27 | )) 28 | ] 29 | -------------------------------------------------------------------------------- /darwin/rekkbook/default.nix: -------------------------------------------------------------------------------- 1 | { inputs, pkgs, ... }: 2 | 3 | { 4 | imports = with inputs; [ 5 | self.roles.darwin 6 | self.profiles.users.rekk 7 | ./homebrew.nix 8 | ./networking.nix 9 | ]; 10 | } 11 | -------------------------------------------------------------------------------- /darwin/rekkbook/homebrew.nix: -------------------------------------------------------------------------------- 1 | { ... }: 2 | 3 | { 4 | homebrew = { 5 | enable = true; 6 | onActivation = { 7 | autoUpdate = false; 8 | cleanup = "uninstall"; 9 | }; 10 | brews = [ 11 | "mailcatcher" 12 | { 13 | name = "yabai"; 14 | start_service = true; 15 | restart_service = true; 16 | } 17 | { 18 | name = "skhd"; 19 | start_service = true; 20 | restart_service = true; 21 | } 22 | ]; 23 | casks = [ 24 | "1password" 25 | "blender" 26 | "calibre" 27 | "darktable" 28 | "discord" 29 | "displaylink" 30 | "displaylink-login-extension" 31 | "fastrawviewer" 32 | "firefox-developer-edition" 33 | "google-chrome" 34 | "iina" 35 | "iterm2" 36 | "lycheeslicer" 37 | "neovide" 38 | "obsidian" 39 | "plexamp" 40 | "preform" 41 | "prusaslicer" 42 | "slack" 43 | "teamviewer" 44 | "telegram-desktop" 45 | "tunnelblick" 46 | "ultimaker-cura" 47 | "uvtools" 48 | "vimr" 49 | "virtualbox-beta" 50 | "vnc-viewer" 51 | "wine-stable" 52 | "zoom" 53 | ]; 54 | taps = [ 55 | "homebrew/cask-drivers" 56 | "homebrew/cask-versions" 57 | "koekeishiya/formulae" 58 | ]; 59 | }; 60 | } 61 | -------------------------------------------------------------------------------- /darwin/rekkbook/networking.nix: -------------------------------------------------------------------------------- 1 | { ... }: 2 | 3 | { 4 | networking = { 5 | hostName = "rekkbook"; 6 | }; 7 | } 8 | -------------------------------------------------------------------------------- /darwin/rekkbook/system: -------------------------------------------------------------------------------- 1 | aarch64-darwin 2 | -------------------------------------------------------------------------------- /flake.lock: -------------------------------------------------------------------------------- 1 | { 2 | "nodes": { 3 | "base16-schemes": { 4 | "flake": false, 5 | "locked": { 6 | "lastModified": 1680729003, 7 | "narHash": "sha256-M9LHTL24/W4oqgbYRkz0B2qpNrkefTs98pfj3MxIXnU=", 8 | "owner": "tinted-theming", 9 | "repo": "base16-schemes", 10 | "rev": "dc048afa066287a719ddbab62b3e19e4b5110cf0", 11 | "type": "github" 12 | }, 13 | "original": { 14 | "owner": "tinted-theming", 15 | "repo": "base16-schemes", 16 | "type": "github" 17 | } 18 | }, 19 | "flake-compat": { 20 | "flake": false, 21 | "locked": { 22 | "lastModified": 1673956053, 23 | "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", 24 | "owner": "edolstra", 25 | "repo": "flake-compat", 26 | "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", 27 | "type": "github" 28 | }, 29 | "original": { 30 | "owner": "edolstra", 31 | "repo": "flake-compat", 32 | "type": "github" 33 | } 34 | }, 35 | "flake-utils": { 36 | "inputs": { 37 | "systems": "systems" 38 | }, 39 | "locked": { 40 | "lastModified": 1681202837, 41 | "narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=", 42 | "owner": "numtide", 43 | "repo": "flake-utils", 44 | "rev": "cfacdce06f30d2b68473a46042957675eebb3401", 45 | "type": "github" 46 | }, 47 | "original": { 48 | "owner": "numtide", 49 | "repo": "flake-utils", 50 | "type": "github" 51 | } 52 | }, 53 | "gitignore": { 54 | "inputs": { 55 | "nixpkgs": [ 56 | "pre-commit-hooks", 57 | "nixpkgs" 58 | ] 59 | }, 60 | "locked": { 61 | "lastModified": 1660459072, 62 | "narHash": "sha256-8DFJjXG8zqoONA1vXtgeKXy68KdJL5UaXR8NtVMUbx8=", 63 | "owner": "hercules-ci", 64 | "repo": "gitignore.nix", 65 | "rev": "a20de23b925fd8264fd7fad6454652e142fd7f73", 66 | "type": "github" 67 | }, 68 | "original": { 69 | "owner": "hercules-ci", 70 | "repo": "gitignore.nix", 71 | "type": "github" 72 | } 73 | }, 74 | "home-manager": { 75 | "inputs": { 76 | "nixpkgs": [ 77 | "nixpkgs-unstable" 78 | ] 79 | }, 80 | "locked": { 81 | "lastModified": 1684596126, 82 | "narHash": "sha256-4RZZmygeEXpuBqEXGs38ZAcWjWKGwu13Iqbxub6wuJk=", 83 | "owner": "nix-community", 84 | "repo": "home-manager", 85 | "rev": "27ef11f0218d9018ebb2948d40133df2b1de622d", 86 | "type": "github" 87 | }, 88 | "original": { 89 | "owner": "nix-community", 90 | "repo": "home-manager", 91 | "type": "github" 92 | } 93 | }, 94 | "nix-colors": { 95 | "inputs": { 96 | "base16-schemes": "base16-schemes", 97 | "nixpkgs-lib": "nixpkgs-lib" 98 | }, 99 | "locked": { 100 | "lastModified": 1682108218, 101 | "narHash": "sha256-tMr7BbxualFQlN+XopS8rMMgf2XR9ZfRuwIZtjsWmfI=", 102 | "owner": "misterio77", 103 | "repo": "nix-colors", 104 | "rev": "b92df8f5eb1fa20d8e09810c03c9dc0d94ef2820", 105 | "type": "github" 106 | }, 107 | "original": { 108 | "owner": "misterio77", 109 | "repo": "nix-colors", 110 | "type": "github" 111 | } 112 | }, 113 | "nix-darwin": { 114 | "inputs": { 115 | "nixpkgs": [ 116 | "nixpkgs-unstable" 117 | ] 118 | }, 119 | "locked": { 120 | "lastModified": 1684343812, 121 | "narHash": "sha256-ZTEjiC8PDKeP8JRchuwcFXUNlMcyQ4U+DpyVZ3pB6Q4=", 122 | "owner": "lnl7", 123 | "repo": "nix-darwin", 124 | "rev": "dfbdabbb3e797334172094d4f6c0ffca8c791281", 125 | "type": "github" 126 | }, 127 | "original": { 128 | "owner": "lnl7", 129 | "ref": "master", 130 | "repo": "nix-darwin", 131 | "type": "github" 132 | } 133 | }, 134 | "nix-filter": { 135 | "locked": { 136 | "lastModified": 1681154353, 137 | "narHash": "sha256-MCJ5FHOlbfQRFwN0brqPbCunLEVw05D/3sRVoNVt2tI=", 138 | "owner": "numtide", 139 | "repo": "nix-filter", 140 | "rev": "f529f42792ade8e32c4be274af6b6d60857fbee7", 141 | "type": "github" 142 | }, 143 | "original": { 144 | "owner": "numtide", 145 | "repo": "nix-filter", 146 | "type": "github" 147 | } 148 | }, 149 | "nix-monitored": { 150 | "inputs": { 151 | "flake-compat": [ 152 | "flake-compat" 153 | ], 154 | "flake-utils": [ 155 | "flake-utils" 156 | ], 157 | "nix-filter": "nix-filter", 158 | "nixpkgs": [ 159 | "nixpkgs-unstable" 160 | ], 161 | "pre-commit-hooks": [ 162 | "pre-commit-hooks" 163 | ] 164 | }, 165 | "locked": { 166 | "lastModified": 1682599166, 167 | "narHash": "sha256-jSzrerpCRmCgbNHZHT6eefj3fHrGYmHFWDN+jakyVtU=", 168 | "owner": "ners", 169 | "repo": "nix-monitored", 170 | "rev": "09db6850e9c68bc69906984c0fae3e1bfca31bd3", 171 | "type": "github" 172 | }, 173 | "original": { 174 | "owner": "ners", 175 | "repo": "nix-monitored", 176 | "type": "github" 177 | } 178 | }, 179 | "nixos-hardware": { 180 | "locked": { 181 | "lastModified": 1684169666, 182 | "narHash": "sha256-N5jrykeSxLVgvm3Dd3hZ38/XwM/jU+dltqlXgrGlYxk=", 183 | "owner": "nixos", 184 | "repo": "nixos-hardware", 185 | "rev": "71ce85372a614d418d5e303dd5702a79d1545c04", 186 | "type": "github" 187 | }, 188 | "original": { 189 | "owner": "nixos", 190 | "repo": "nixos-hardware", 191 | "type": "github" 192 | } 193 | }, 194 | "nixpkgs-lib": { 195 | "locked": { 196 | "lastModified": 1680397293, 197 | "narHash": "sha256-wBpJ73+tJ8fZSWb4tzNbAVahC4HSo2QG3nICDy4ExBQ=", 198 | "owner": "nix-community", 199 | "repo": "nixpkgs.lib", 200 | "rev": "b18d328214ca3c627d3cc3f51fd9d1397fdbcd7a", 201 | "type": "github" 202 | }, 203 | "original": { 204 | "owner": "nix-community", 205 | "repo": "nixpkgs.lib", 206 | "type": "github" 207 | } 208 | }, 209 | "nixpkgs-master": { 210 | "locked": { 211 | "lastModified": 1684702352, 212 | "narHash": "sha256-reBUMtn0vxhwlk0rdFMiQkegTnE7lPYKLPR+7APZvOs=", 213 | "owner": "nixos", 214 | "repo": "nixpkgs", 215 | "rev": "76f1d557cdb508b81e196238a29d3788a1c3074a", 216 | "type": "github" 217 | }, 218 | "original": { 219 | "owner": "nixos", 220 | "repo": "nixpkgs", 221 | "type": "github" 222 | } 223 | }, 224 | "nixpkgs-stable": { 225 | "locked": { 226 | "lastModified": 1684580438, 227 | "narHash": "sha256-LUPswmDn6fXP3lEBJFA2Id8PkcYDgzUilevWackYVvQ=", 228 | "owner": "nixos", 229 | "repo": "nixpkgs", 230 | "rev": "7dc71aef32e8faf065cb171700792cf8a65c152d", 231 | "type": "github" 232 | }, 233 | "original": { 234 | "owner": "nixos", 235 | "ref": "nixos-22.11", 236 | "repo": "nixpkgs", 237 | "type": "github" 238 | } 239 | }, 240 | "nixpkgs-unstable": { 241 | "locked": { 242 | "lastModified": 1684570954, 243 | "narHash": "sha256-FX5y4Sm87RWwfu9PI71XFvuRpZLowh00FQpIJ1WfXqE=", 244 | "owner": "nixos", 245 | "repo": "nixpkgs", 246 | "rev": "3005f20ce0aaa58169cdee57c8aa12e5f1b6e1b3", 247 | "type": "github" 248 | }, 249 | "original": { 250 | "owner": "nixos", 251 | "ref": "nixos-unstable", 252 | "repo": "nixpkgs", 253 | "type": "github" 254 | } 255 | }, 256 | "pre-commit-hooks": { 257 | "inputs": { 258 | "flake-compat": [ 259 | "flake-compat" 260 | ], 261 | "flake-utils": [ 262 | "flake-utils" 263 | ], 264 | "gitignore": "gitignore", 265 | "nixpkgs": [ 266 | "nixpkgs-unstable" 267 | ], 268 | "nixpkgs-stable": [ 269 | "nixpkgs-stable" 270 | ] 271 | }, 272 | "locked": { 273 | "lastModified": 1684195081, 274 | "narHash": "sha256-IKnQUSBhQTChFERxW2AzuauVpY1HRgeVzAjNMAA4B6I=", 275 | "owner": "cachix", 276 | "repo": "pre-commit-hooks.nix", 277 | "rev": "96eabec58248ed8f4b0ad59e7ce9398018684fdc", 278 | "type": "github" 279 | }, 280 | "original": { 281 | "owner": "cachix", 282 | "repo": "pre-commit-hooks.nix", 283 | "type": "github" 284 | } 285 | }, 286 | "root": { 287 | "inputs": { 288 | "flake-compat": "flake-compat", 289 | "flake-utils": "flake-utils", 290 | "home-manager": "home-manager", 291 | "nix-colors": "nix-colors", 292 | "nix-darwin": "nix-darwin", 293 | "nix-monitored": "nix-monitored", 294 | "nixos-hardware": "nixos-hardware", 295 | "nixpkgs-master": "nixpkgs-master", 296 | "nixpkgs-stable": "nixpkgs-stable", 297 | "nixpkgs-unstable": "nixpkgs-unstable", 298 | "pre-commit-hooks": "pre-commit-hooks", 299 | "vscodeInsiders": "vscodeInsiders" 300 | } 301 | }, 302 | "systems": { 303 | "locked": { 304 | "lastModified": 1681028828, 305 | "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", 306 | "owner": "nix-systems", 307 | "repo": "default", 308 | "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", 309 | "type": "github" 310 | }, 311 | "original": { 312 | "owner": "nix-systems", 313 | "repo": "default", 314 | "type": "github" 315 | } 316 | }, 317 | "vscodeInsiders": { 318 | "flake": false, 319 | "locked": { 320 | "narHash": "sha256-e0fA2RY2bwxLFB9ijUFgNP7f2e8BVvaD2CQhwYmzdds=", 321 | "type": "tarball", 322 | "url": "https://code.visualstudio.com/sha/download?build=insider&os=linux-x64" 323 | }, 324 | "original": { 325 | "type": "tarball", 326 | "url": "https://code.visualstudio.com/sha/download?build=insider&os=linux-x64" 327 | } 328 | } 329 | }, 330 | "root": "root", 331 | "version": 7 332 | } 333 | -------------------------------------------------------------------------------- /flake.nix: -------------------------------------------------------------------------------- 1 | { 2 | inputs = { 3 | nixpkgs-stable.url = "github:nixos/nixpkgs/nixos-22.11"; 4 | nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable"; 5 | nixpkgs-master.url = "github:nixos/nixpkgs"; 6 | flake-utils.url = "github:numtide/flake-utils"; 7 | nixos-hardware.url = "github:nixos/nixos-hardware"; 8 | nix-colors.url = "github:misterio77/nix-colors"; 9 | nix-monitored = { 10 | url = "github:ners/nix-monitored"; 11 | inputs.nixpkgs.follows = "nixpkgs-unstable"; 12 | inputs.flake-utils.follows = "flake-utils"; 13 | inputs.flake-compat.follows = "flake-compat"; 14 | inputs.pre-commit-hooks.follows = "pre-commit-hooks"; 15 | }; 16 | home-manager = { 17 | url = "github:nix-community/home-manager"; 18 | inputs.nixpkgs.follows = "nixpkgs-unstable"; 19 | }; 20 | nix-darwin = { 21 | url = "github:lnl7/nix-darwin/master"; 22 | inputs.nixpkgs.follows = "nixpkgs-unstable"; 23 | }; 24 | vscodeInsiders = { 25 | url = 26 | "tarball+https://code.visualstudio.com/sha/download?build=insider&os=linux-x64"; 27 | flake = false; 28 | }; 29 | flake-compat = { 30 | url = "github:edolstra/flake-compat"; 31 | flake = false; 32 | }; 33 | pre-commit-hooks = { 34 | url = "github:cachix/pre-commit-hooks.nix"; 35 | inputs.nixpkgs.follows = "nixpkgs-unstable"; 36 | inputs.nixpkgs-stable.follows = "nixpkgs-stable"; 37 | inputs.flake-utils.follows = "flake-utils"; 38 | inputs.flake-compat.follows = "flake-compat"; 39 | }; 40 | }; 41 | 42 | outputs = inputs: 43 | let 44 | lib = import ./profiles/lib { inherit inputs; }; 45 | overlayModules = lib.findModules ./overlays; 46 | overlaySrcs = [ overlayModules.pkgs ] 47 | ++ (with builtins; attrValues (removeAttrs overlayModules [ "pkgs" ])); 48 | mkOverlay = o: 49 | import o { 50 | inherit lib inputs; 51 | overlays = overlaySrcs; 52 | }; 53 | overlays = map mkOverlay overlaySrcs; 54 | in 55 | { 56 | version = inputs.nixpkgs-stable.lib.trivial.release; 57 | profiles = lib.findModules ./profiles; 58 | roles = lib.findModules ./roles; 59 | nixosConfigurations = import ./nixos { inherit inputs lib overlays; }; 60 | darwinConfigurations = import ./darwin { inherit inputs lib overlays; }; 61 | } // inputs.flake-utils.lib.eachDefaultSystem (system: 62 | let pkgs = import inputs.nixpkgs-stable { inherit system overlays; }; 63 | in { 64 | devShells.default = pkgs.mkShell { 65 | nativeBuildInputs = with pkgs.unstable; [ 66 | nixpkgs-fmt 67 | ]; 68 | }; 69 | packages = pkgs // { 70 | iso-image = 71 | inputs.self.nixosConfigurations.iso-image.config.system.build.isoImage; 72 | }; 73 | formatter = pkgs.unstable.nixpkgs-fmt; 74 | }); 75 | } 76 | -------------------------------------------------------------------------------- /nixos/README.md: -------------------------------------------------------------------------------- 1 | ## System configurations 2 | 3 | This directory contains definitions for NixOS systems that can be built from this repository. 4 | 5 | Each system is described with a directory that contains, at minimum: 6 | - a `default.nix` file that contains the configuration for the system, and 7 | - a system definition file that contains the name of the [platform](https://github.com/NixOS/nixpkgs/blob/master/lib/systems/supported.nix) this system is expected to run on. 8 | 9 | The name of the directory is treated as the name of the configuration, as well as its default hostname. 10 | 11 | ### Adding a new configuration 12 | 13 | The most common use-case for creating a new configuration is when installing NixOS to a new computer from the live environment. 14 | This repository offers an [installation wizard](../overlays/pkgs/nixos-wizard/) which simplifies installation, as well as adding new configurations. 15 | Simply run `wizard` and follow the steps. 16 | 17 | To manually add a new configuration, create a new directory in this one, named after the configuration you wish to add. 18 | Create the system definition file, containing the name of the system the configuration targets; e.g. "x86_64-linux". 19 | 20 | Also add a `default.nix` file that describes the configuration. 21 | 22 | If the configuration describes a computer, then also add the `hardware-configuration.nix`, as generated by `nixos-generate-config`. 23 | 24 | Finally, the new configuration can be built from the root of the flake: 25 | ```sh 26 | # Change this 27 | configuration=normandy 28 | 29 | # Build or switch 30 | nixos-rebuild build --flake .#${configuration} --impure 31 | nixos-rebuild switch --flake .#${configuration} --impure 32 | 33 | # Install from live media 34 | nixos-install --flake .#${configuration} --impure 35 | ``` 36 | -------------------------------------------------------------------------------- /nixos/default.nix: -------------------------------------------------------------------------------- 1 | { lib, inputs, overlays, ... }: 2 | 3 | with inputs; 4 | with builtins; 5 | 6 | lib.pipe ./. [ 7 | lib.findModules 8 | (mapAttrs (name: path: 9 | let 10 | system = with lib; pipe (path + "/system") [ readFile lines head ]; 11 | pkgs = import nixpkgs-unstable { inherit system overlays; }; 12 | in 13 | lib.nixosSystem { 14 | inherit system; 15 | modules = [ 16 | { 17 | system.stateVersion = inputs.self.version; 18 | networking.hostName = lib.mkDefault name; 19 | nixpkgs = { inherit pkgs; }; 20 | } 21 | inputs.home-manager.nixosModules.default 22 | inputs.nix-monitored.nixosModules.${system}.default 23 | path 24 | ]; 25 | specialArgs = { 26 | inherit inputs pkgs lib; 27 | }; 28 | } 29 | )) 30 | ] 31 | -------------------------------------------------------------------------------- /nixos/godot/default.nix: -------------------------------------------------------------------------------- 1 | { inputs, pkgs, ... }: 2 | 3 | { 4 | imports = with inputs; [ 5 | ./hardware-configuration.nix 6 | nixos-hardware.nixosModules.lenovo-thinkpad-x1-9th-gen 7 | self.profiles.users.ners 8 | self.roles.desktop 9 | self.roles.laptop 10 | ]; 11 | 12 | systemd.network.wait-online.extraArgs = [ 13 | "--interface=wlp0s20f3" 14 | ]; 15 | } 16 | -------------------------------------------------------------------------------- /nixos/godot/hardware-configuration.nix: -------------------------------------------------------------------------------- 1 | # Do not modify this file! It was generated by ‘nixos-generate-config’ 2 | # and may be overwritten by future invocations. Please make changes 3 | # to /etc/nixos/configuration.nix instead. 4 | { config, lib, pkgs, modulesPath, ... }: 5 | 6 | { 7 | imports = [ (modulesPath + "/installer/scan/not-detected.nix") ]; 8 | 9 | boot.initrd.availableKernelModules = [ "xhci_pci" "thunderbolt" "nvme" ]; 10 | boot.initrd.kernelModules = [ ]; 11 | boot.kernelModules = [ "kvm-intel" ]; 12 | boot.extraModulePackages = [ ]; 13 | 14 | fileSystems."/" = { 15 | device = "/dev/disk/by-uuid/d0803e00-563c-4ad6-9fb1-0b9fb28c6312"; 16 | fsType = "btrfs"; 17 | options = [ "subvol=root" ]; 18 | }; 19 | 20 | boot.initrd.luks.devices."cryptroot".device = 21 | "/dev/disk/by-uuid/be4b2cab-115a-4a5b-a36d-82f5c4868e54"; 22 | 23 | fileSystems."/boot" = { 24 | device = "/dev/disk/by-uuid/87E9-3FEA"; 25 | fsType = "vfat"; 26 | }; 27 | 28 | fileSystems."/nix" = { 29 | device = "/dev/disk/by-uuid/d0803e00-563c-4ad6-9fb1-0b9fb28c6312"; 30 | fsType = "btrfs"; 31 | options = [ "subvol=nix" ]; 32 | }; 33 | 34 | fileSystems."/home" = { 35 | device = "/dev/disk/by-uuid/d0803e00-563c-4ad6-9fb1-0b9fb28c6312"; 36 | fsType = "btrfs"; 37 | options = [ "subvol=home" ]; 38 | }; 39 | 40 | swapDevices = [ ]; 41 | 42 | powerManagement.cpuFreqGovernor = lib.mkDefault "powersave"; 43 | # high-resolution display 44 | hardware.video.hidpi.enable = lib.mkDefault true; 45 | } 46 | -------------------------------------------------------------------------------- /nixos/godot/system: -------------------------------------------------------------------------------- 1 | x86_64-linux 2 | -------------------------------------------------------------------------------- /nixos/iso-image/default.nix: -------------------------------------------------------------------------------- 1 | { modulesPath 2 | , inputs 3 | , pkgs 4 | , ... 5 | }@args: 6 | 7 | { 8 | imports = with inputs; [ 9 | "${modulesPath}/installer/cd-dvd/installation-cd-graphical-base.nix" 10 | self.roles.desktop 11 | (import self.profiles.users.common (args // { 12 | username = "nixos"; 13 | initialHashedPassword = ""; 14 | sshKeys = [ 15 | "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINBlAx5Hi5TsLsy5e+4OdBmM4oHtdUnqX5gtNbfc60rq ners" 16 | ]; 17 | })) 18 | ]; 19 | 20 | boot.initrd = { 21 | luks.devices = { }; 22 | systemd.enable = false; 23 | }; 24 | 25 | environment.systemPackages = with pkgs; [ 26 | nixos-wizard 27 | ]; 28 | 29 | isoImage.edition = "gnome"; 30 | services.xserver.displayManager = { 31 | gdm.autoSuspend = false; 32 | autoLogin = { 33 | enable = true; 34 | user = "nixos"; 35 | }; 36 | }; 37 | } 38 | -------------------------------------------------------------------------------- /nixos/iso-image/system: -------------------------------------------------------------------------------- 1 | x86_64-linux 2 | -------------------------------------------------------------------------------- /nixos/normandy/default.nix: -------------------------------------------------------------------------------- 1 | { inputs, pkgs, ... }: 2 | 3 | let lan = "eno2"; in 4 | { 5 | imports = with inputs; [ 6 | ./hardware-configuration.nix 7 | nixos-hardware.nixosModules.common-cpu-intel 8 | nixos-hardware.nixosModules.common-gpu-amd 9 | nixos-hardware.nixosModules.common-pc 10 | nixos-hardware.nixosModules.common-pc-ssd 11 | self.roles.desktop 12 | self.profiles.users.ners 13 | self.profiles.users.rekk 14 | ]; 15 | 16 | systemd.network = { 17 | wait-online.extraArgs = [ 18 | "--interface=${lan}" 19 | ]; 20 | links."40-wake-on-lan" = { 21 | matchConfig.OriginalName = lan; 22 | linkConfig = { 23 | NamePolicy = "keep kernel database onboard slot path"; 24 | AlternativeNamesPolicy = "database onboard slot path"; 25 | MACAddressPolicy = "persistent"; 26 | WakeOnLan = "magic"; 27 | }; 28 | }; 29 | }; 30 | 31 | networking.interfaces.${lan}.wakeOnLan.enable = true; 32 | 33 | hardware.keyboard.zsa.enable = true; 34 | 35 | environment.systemPackages = with pkgs; [ 36 | wally-cli 37 | ]; 38 | 39 | services.printing.drivers = with pkgs.unstable; [ brlaser ]; 40 | } 41 | -------------------------------------------------------------------------------- /nixos/normandy/hardware-configuration.nix: -------------------------------------------------------------------------------- 1 | # Do not modify this file! It was generated by ‘nixos-generate-config’ 2 | # and may be overwritten by future invocations. Please make changes 3 | # to /etc/nixos/configuration.nix instead. 4 | { config, lib, pkgs, modulesPath, ... }: 5 | 6 | { 7 | imports = 8 | [ 9 | (modulesPath + "/installer/scan/not-detected.nix") 10 | ]; 11 | 12 | boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usbhid" "uas" "sd_mod" ]; 13 | boot.initrd.kernelModules = [ ]; 14 | boot.kernelModules = [ "kvm-intel" ]; 15 | boot.extraModulePackages = [ ]; 16 | 17 | fileSystems."/" = 18 | { 19 | device = "/dev/disk/by-uuid/c393bb6d-f50f-4622-a994-385cfc829ca7"; 20 | fsType = "btrfs"; 21 | options = [ "subvol=root" ]; 22 | }; 23 | 24 | boot.initrd.luks.devices."cryptroot".device = "/dev/disk/by-uuid/1b98c7b1-cf90-4daa-8941-f9735903aba5"; 25 | 26 | fileSystems."/boot" = 27 | { 28 | device = "/dev/disk/by-uuid/9E20-E12E"; 29 | fsType = "vfat"; 30 | }; 31 | 32 | fileSystems."/home" = 33 | { 34 | device = "/dev/disk/by-uuid/c393bb6d-f50f-4622-a994-385cfc829ca7"; 35 | fsType = "btrfs"; 36 | options = [ "subvol=home" ]; 37 | }; 38 | 39 | fileSystems."/nix" = 40 | { 41 | device = "/dev/disk/by-uuid/c393bb6d-f50f-4622-a994-385cfc829ca7"; 42 | fsType = "btrfs"; 43 | options = [ "subvol=nix" ]; 44 | }; 45 | 46 | swapDevices = [ ]; 47 | 48 | # Enables DHCP on each ethernet and wireless interface. In case of scripted networking 49 | # (the default) this is the recommended approach. When using systemd-networkd it's 50 | # still possible to use this option, but it's recommended to use it in conjunction 51 | # with explicit per-interface declarations with `networking.interfaces..useDHCP`. 52 | networking.useDHCP = lib.mkDefault true; 53 | # networking.interfaces.eno2.useDHCP = lib.mkDefault true; 54 | # networking.interfaces.wlo1.useDHCP = lib.mkDefault true; 55 | 56 | nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; 57 | powerManagement.cpuFreqGovernor = lib.mkDefault "powersave"; 58 | hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; 59 | } 60 | -------------------------------------------------------------------------------- /nixos/normandy/system: -------------------------------------------------------------------------------- 1 | x86_64-linux 2 | -------------------------------------------------------------------------------- /nixos/orville/default.nix: -------------------------------------------------------------------------------- 1 | { inputs, pkgs, ... }: 2 | 3 | { 4 | imports = with inputs; [ 5 | ./hardware-configuration.nix 6 | self.profiles.users.dragoncat 7 | self.roles.server 8 | ]; 9 | 10 | systemd.network.wait-online.extraArgs = [ 11 | "--interface=enp0s3" 12 | ]; 13 | } 14 | -------------------------------------------------------------------------------- /nixos/orville/hardware-configuration.nix: -------------------------------------------------------------------------------- 1 | # Do not modify this file! It was generated by ‘nixos-generate-config’ 2 | # and may be overwritten by future invocations. Please make changes 3 | # to /etc/nixos/configuration.nix instead. 4 | { config, lib, pkgs, modulesPath, ... }: 5 | 6 | { 7 | imports = 8 | [ 9 | (modulesPath + "/profiles/qemu-guest.nix") 10 | ]; 11 | 12 | boot.initrd.availableKernelModules = [ "xhci_pci" "virtio_pci" "usbhid" ]; 13 | boot.initrd.kernelModules = [ ]; 14 | boot.kernelModules = [ ]; 15 | boot.extraModulePackages = [ ]; 16 | 17 | fileSystems."/" = 18 | { 19 | device = "/dev/disk/by-uuid/cd16201e-eaa9-45b4-8bbf-b2861c326407"; 20 | fsType = "btrfs"; 21 | options = [ "subvol=root" ]; 22 | }; 23 | 24 | fileSystems."/home" = 25 | { 26 | device = "/dev/disk/by-uuid/cd16201e-eaa9-45b4-8bbf-b2861c326407"; 27 | fsType = "btrfs"; 28 | options = [ "subvol=home" ]; 29 | }; 30 | 31 | fileSystems."/nix" = 32 | { 33 | device = "/dev/disk/by-uuid/cd16201e-eaa9-45b4-8bbf-b2861c326407"; 34 | fsType = "btrfs"; 35 | options = [ "subvol=nix" ]; 36 | }; 37 | 38 | fileSystems."/boot" = 39 | { 40 | device = "/dev/disk/by-uuid/A30A-87C2"; 41 | fsType = "vfat"; 42 | }; 43 | 44 | swapDevices = [ ]; 45 | 46 | # Enables DHCP on each ethernet and wireless interface. In case of scripted networking 47 | # (the default) this is the recommended approach. When using systemd-networkd it's 48 | # still possible to use this option, but it's recommended to use it in conjunction 49 | # with explicit per-interface declarations with `networking.interfaces..useDHCP`. 50 | networking.useDHCP = lib.mkDefault true; 51 | # networking.interfaces.eth0.useDHCP = lib.mkDefault true; 52 | 53 | nixpkgs.hostPlatform = lib.mkDefault "aarch64-linux"; 54 | } 55 | -------------------------------------------------------------------------------- /nixos/orville/system: -------------------------------------------------------------------------------- 1 | aarch64-linux 2 | -------------------------------------------------------------------------------- /nixos/rocinante/boot.nix: -------------------------------------------------------------------------------- 1 | { lib, ... }: 2 | 3 | with lib; 4 | 5 | { 6 | boot = { 7 | loader = { 8 | systemd-boot.enable = mkForce false; 9 | grub = { 10 | enable = mkForce true; 11 | efiSupport = true; 12 | }; 13 | }; 14 | }; 15 | hardware.video.hidpi.enable = true; 16 | } 17 | -------------------------------------------------------------------------------- /nixos/rocinante/default.nix: -------------------------------------------------------------------------------- 1 | { inputs, ... }: 2 | 3 | { 4 | imports = with inputs; [ 5 | ./boot.nix 6 | ./gold.nix 7 | ./hardware-configuration.nix 8 | ./home-assistant 9 | ./netdata.nix 10 | ./plex.nix 11 | ./transmission.nix 12 | ./windows 13 | nixos-hardware.nixosModules.common-cpu-amd 14 | nixos-hardware.nixosModules.common-pc 15 | nixos-hardware.nixosModules.common-pc-ssd 16 | self.profiles.users.dragoncat 17 | self.roles.server 18 | ]; 19 | 20 | services.nfs.server.enable = true; 21 | } 22 | -------------------------------------------------------------------------------- /nixos/rocinante/gold.nix: -------------------------------------------------------------------------------- 1 | { config, lib, ... }: 2 | 3 | with builtins; 4 | with lib; 5 | 6 | let 7 | mountPoint = "/mnt/Gold"; 8 | uid = config.users.users.dragoncat.uid; 9 | gid = 999; 10 | in 11 | { 12 | users.groups.gold.gid = gid; 13 | fileSystems.${mountPoint} = { 14 | device = mkDefault "/dev/disk/by-label/Gold"; 15 | fsType = "btrfs"; 16 | options = [ "compress=zstd" ]; 17 | }; 18 | 19 | services.nfs.server.exports = '' 20 | ${mountPoint} *(rw,sync,no_root_squash,all_squash,insecure,anonuid=${toString uid},anongid=${toString gid}) 21 | ''; 22 | 23 | services.beesd.filesystems = { 24 | gold = { 25 | spec = "LABEL=Gold"; 26 | hashTableSizeMB = 2048; 27 | verbosity = "crit"; 28 | extraOptions = [ "--loadavg-target" "5.0" ]; 29 | }; 30 | }; 31 | } 32 | -------------------------------------------------------------------------------- /nixos/rocinante/hardware-configuration.nix: -------------------------------------------------------------------------------- 1 | # Do not modify this file! It was generated by ‘nixos-generate-config’ 2 | # and may be overwritten by future invocations. Please make changes 3 | # to /etc/nixos/configuration.nix instead. 4 | { config, lib, pkgs, modulesPath, ... }: 5 | 6 | { 7 | imports = 8 | [ 9 | (modulesPath + "/installer/scan/not-detected.nix") 10 | ]; 11 | 12 | boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "ahci" "usb_storage" "usbhid" "uas" "sd_mod" ]; 13 | boot.initrd.kernelModules = [ ]; 14 | boot.kernelModules = [ "kvm-amd" ]; 15 | boot.extraModulePackages = [ ]; 16 | 17 | fileSystems."/" = 18 | { 19 | device = "/dev/disk/by-uuid/05016c6b-71b1-4b3f-b711-35eb02cca0a9"; 20 | fsType = "btrfs"; 21 | options = [ "subvol=root" ]; 22 | }; 23 | 24 | fileSystems."/home" = 25 | { 26 | device = "/dev/disk/by-uuid/05016c6b-71b1-4b3f-b711-35eb02cca0a9"; 27 | fsType = "btrfs"; 28 | options = [ "subvol=home" ]; 29 | }; 30 | 31 | fileSystems."/nix" = 32 | { 33 | device = "/dev/disk/by-uuid/05016c6b-71b1-4b3f-b711-35eb02cca0a9"; 34 | fsType = "btrfs"; 35 | options = [ "subvol=nix" ]; 36 | }; 37 | 38 | fileSystems."/boot" = 39 | { 40 | device = "/dev/disk/by-uuid/7AA7-DA7E"; 41 | fsType = "vfat"; 42 | }; 43 | 44 | swapDevices = [ ]; 45 | 46 | # Enables DHCP on each ethernet and wireless interface. In case of scripted networking 47 | # (the default) this is the recommended approach. When using systemd-networkd it's 48 | # still possible to use this option, but it's recommended to use it in conjunction 49 | # with explicit per-interface declarations with `networking.interfaces..useDHCP`. 50 | networking.useDHCP = lib.mkDefault true; 51 | # networking.interfaces.enp3s0f0u2u3.useDHCP = lib.mkDefault true; 52 | # networking.interfaces.wlp38s0.useDHCP = lib.mkDefault true; 53 | 54 | nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; 55 | hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; 56 | # high-resolution display 57 | hardware.video.hidpi.enable = lib.mkDefault true; 58 | } 59 | -------------------------------------------------------------------------------- /nixos/rocinante/home-assistant/default.nix: -------------------------------------------------------------------------------- 1 | { config, inputs, pkgs, lib, ... }: 2 | 3 | let 4 | name = "Nest"; 5 | port = 8123; 6 | skipTests = p: p.overrideAttrs (_: { 7 | pytestCheckPhase = '' 8 | echo skipped pytestCheckPhase 9 | ''; 10 | }); 11 | in 12 | with builtins; 13 | { 14 | disabledModules = [ "services/home-automation/home-assistant.nix" ]; 15 | imports = [ (inputs.nixpkgs-unstable + "/nixos/modules/services/home-automation/home-assistant.nix") ]; 16 | services.home-assistant = { 17 | enable = true; 18 | package = skipTests (pkgs.unstable.home-assistant.override { 19 | extraPackages = ps: with ps; [ 20 | accuweather 21 | (skipTests aiogithubapi) 22 | aioharmony 23 | aiohomekit 24 | aiohue 25 | denonavr 26 | fnvhash 27 | ha-ffmpeg 28 | hap-python 29 | librouteros 30 | plexapi 31 | pyatv 32 | pyheos 33 | pykodi 34 | pylitterbot 35 | pyprusalink 36 | pyqrcode 37 | speedtest-cli 38 | spotipy 39 | transmissionrpc 40 | ]; 41 | }); 42 | config = { 43 | homeassistant = { 44 | inherit name; 45 | latitude = 47.3769; 46 | longitude = 8.5417; 47 | unit_system = "metric"; 48 | time_zone = config.time.timeZone; 49 | currency = "CHF"; 50 | internal_url = "http://rocinante.nest:${toString port}"; 51 | }; 52 | http = { 53 | server_host = [ "0.0.0.0" "::" ]; 54 | server_port = port; 55 | }; 56 | frontend = { }; 57 | python_script = { }; 58 | logger.default = "info"; 59 | automation = "!include automations.yaml"; 60 | sensor = [ 61 | { 62 | platform = "systemmonitor"; 63 | resources = [ 64 | { 65 | type = "load_1m"; 66 | } 67 | { 68 | type = "processor_use"; 69 | } 70 | { 71 | type = "processor_temperature"; 72 | } 73 | { 74 | type = "memory_use_percent"; 75 | } 76 | { 77 | type = "disk_use_percent"; 78 | arg = "/"; 79 | } 80 | { 81 | type = "disk_use_percent"; 82 | arg = "/mnt/Gold"; 83 | } 84 | ]; 85 | } 86 | ]; 87 | }; 88 | configWritable = true; 89 | lovelaceConfigWritable = true; 90 | }; 91 | } 92 | 93 | -------------------------------------------------------------------------------- /nixos/rocinante/netdata.nix: -------------------------------------------------------------------------------- 1 | { pkgs, ... }: 2 | 3 | { 4 | services.netdata = { 5 | enable = true; 6 | package = pkgs.unstable.netdata; 7 | 8 | config = { 9 | global = { 10 | # reduce memory to 32 MB 11 | #"page cache size" = 32; 12 | 13 | # update interval 14 | "update every" = 15; 15 | }; 16 | ml = { 17 | # enable machine learning 18 | enabled = "yes"; 19 | }; 20 | }; 21 | }; 22 | } 23 | -------------------------------------------------------------------------------- /nixos/rocinante/plex.nix: -------------------------------------------------------------------------------- 1 | { pkgs, ... }: 2 | 3 | { 4 | services.plex = { 5 | enable = true; 6 | package = pkgs.unstable.plex; 7 | }; 8 | users.users.plex.extraGroups = [ "plex" "gold" ]; 9 | } 10 | -------------------------------------------------------------------------------- /nixos/rocinante/system: -------------------------------------------------------------------------------- 1 | x86_64-linux 2 | -------------------------------------------------------------------------------- /nixos/rocinante/transmission.nix: -------------------------------------------------------------------------------- 1 | { ... }: 2 | 3 | { 4 | services.transmission = { 5 | enable = true; 6 | settings = { 7 | performanceNetParameters = true; 8 | rpc-bind-address = "0.0.0.0"; 9 | rpc-whitelist-enabled = false; 10 | rpc-host-whitelist-enabled = false; 11 | rpc-authentication-required = true; 12 | rpc-username = "dragoncat"; 13 | rpc-password = "{2cd1009e62a1466d5ad0bae354e178ebeace43dfuT0iEYsu"; 14 | peer-limit-per-torrent = 100; 15 | peer-limit-global = 100000; 16 | download-queue-size = 50; 17 | message-level = 2; 18 | dht-enabled = false; 19 | pex-enabled = false; 20 | lpd-enabled = false; 21 | incomplete-dir-enabled = false; 22 | cache-size-mb = 12; 23 | }; 24 | }; 25 | 26 | systemd.services.transmission.serviceConfig.BindPaths = 27 | [ "/mnt/Gold/Trackers" ]; 28 | 29 | users.groups.transmission = { }; 30 | users.users.transmission.extraGroups = [ "transmission" "gold" ]; 31 | } 32 | -------------------------------------------------------------------------------- /nixos/rocinante/windows/default.nix: -------------------------------------------------------------------------------- 1 | { pkgs, lib, ... }: 2 | 3 | let 4 | radeon = "0000:29:00.0"; 5 | radeon-audio = "0000:29:00.1"; 6 | usb-controller = "0000:2a:00.3"; # Zeppelin USB 3.0 Host controller 7 | nvme-controller = "0000:01:00.0"; 8 | world-interface = "enp3s0f0u2u3"; 9 | bridge-interface = "winbr"; 10 | in 11 | { 12 | boot.kernelParams = [ 13 | "amd_iommu=on" 14 | "pcie_aspm=off" 15 | "video=efifb:off" 16 | "default_hugepagesz=1GB" 17 | "hugepagesz=1GB" 18 | "hugepages=16" 19 | ]; 20 | boot.kernelModules = [ "kvm-amd" "vfio" "vfio_pci" ]; 21 | 22 | systemd.services.swtpm = { 23 | path = [ pkgs.swtpm ]; 24 | script = '' 25 | mkdir -p /tmp/emulated_tpm 26 | swtpm socket \ 27 | --tpmstate dir=/tmp/emulated_tpm \ 28 | --ctrl type=unixio,path=/tmp/emulated_tpm/swtpm-sock \ 29 | --log level=20 \ 30 | --tpm2 31 | ''; 32 | wantedBy = [ "windows.service" ]; 33 | }; 34 | 35 | networking.bridges.${bridge-interface}.interfaces = [ world-interface ]; 36 | networking.interfaces.${bridge-interface}.useDHCP = true; 37 | virtualisation.libvirtd.allowedBridges = [ bridge-interface ]; 38 | 39 | systemd.services.windows = { 40 | path = with pkgs; [ 41 | bridge-utils 42 | kmod 43 | qemu 44 | tunctl 45 | ]; 46 | serviceConfig = { Restart = "on-failure"; }; 47 | environment = { 48 | NAME = "win11"; 49 | SPICE_PORT = "5924"; 50 | BRIDGE_INTERFACE = bridge-interface; 51 | OVMF_FD = "${pkgs.OVMF.fd}/FV/OVMF.fd"; 52 | DEVICES = "${radeon} ${radeon-audio} ${usb-controller} ${nvme-controller}"; 53 | }; 54 | preStart = builtins.readFile ./preStart.sh; 55 | script = builtins.readFile ./script.sh; 56 | postStop = builtins.readFile ./postStop.sh; 57 | after = [ "swtpm.target" ]; 58 | bindsTo = [ "swtpm.service" ]; 59 | wantedBy = lib.mkForce [ ]; 60 | }; 61 | } 62 | -------------------------------------------------------------------------------- /nixos/rocinante/windows/postStop.sh: -------------------------------------------------------------------------------- 1 | for dev in $DEVICES; do 2 | if ! [ -L /tmp/defaultDrivers/$dev ]; then continue; fi 3 | if [ -L /sys/bus/pci/devices/$dev/driver ]; then 4 | echo Unbinding $dev from $(readlink --canonicalize /sys/bus/pci/devices/$dev/driver) 5 | echo $dev > /sys/bus/pci/devices/$dev/driver/unbind 6 | fi 7 | if [ -L /tmp/defaultDrivers/$dev/bind ]; then 8 | echo Binding $dev to $(readlink --canonicalize /tmp/defaultDrivers/$dev) 9 | echo $dev > /tmp/defaultDrivers/$dev/bind 10 | fi 11 | done 12 | 13 | # brctl delif $BRIDGE_INTERFACE $TAP_INTERFACE 14 | # tunctl -d $TAP_INTERFACE 15 | -------------------------------------------------------------------------------- /nixos/rocinante/windows/preStart.sh: -------------------------------------------------------------------------------- 1 | modprobe -i vfio_pci 2 | mkdir -p /tmp/defaultDrivers 3 | for dev in $DEVICES; do 4 | if [ -L /sys/bus/pci/drivers/vfio-pci/$dev ]; then 5 | echo $dev already bound to vfio-pci 6 | continue 7 | fi 8 | if [ -L /sys/bus/pci/devices/$dev/driver ]; then 9 | if ! [ -L /tmp/defaultDrivers/$dev ]; then 10 | ln -s $(readlink --canonicalize /sys/bus/pci/devices/$dev/driver) /tmp/defaultDrivers/$dev 11 | fi 12 | echo Unbinding $dev from $(readlink --canonicalize /sys/bus/pci/devices/$dev/driver) 13 | echo $dev > /sys/bus/pci/devices/$dev/driver/unbind 14 | fi 15 | echo Binding $dev to vfio-pci 16 | echo vfio-pci > /sys/bus/pci/devices/$dev/driver_override 17 | echo $dev > /sys/bus/pci/drivers/vfio-pci/bind 18 | done 19 | 20 | # tunctl -t $TAP_INTERFACE -u $(whoami) 21 | # brctl addif $BRIDGE_INTERFACE $TAP_INTERFACE 22 | # ip link set up dev $TAP_INTERFACE 23 | -------------------------------------------------------------------------------- /nixos/rocinante/windows/script.sh: -------------------------------------------------------------------------------- 1 | qemu-system-x86_64 \ 2 | -name $NAME \ 3 | -nodefaults \ 4 | -enable-kvm \ 5 | -machine q35,type=pc,accel=kvm,vmport=off,kernel_irqchip=on \ 6 | -cpu host,hv_relaxed,hv_spinlocks=0x1fff,hv_vapic,hv_time,kvm=off,hv_vendor_id=1234567890ab \ 7 | -smp cores=6 \ 8 | -m 16G \ 9 | -mem-path /dev/hugepages \ 10 | -device virtio-net-pci,netdev=winbr \ 11 | -netdev bridge,id=winbr,br=$BRIDGE_INTERFACE \ 12 | -spice port=$SPICE_PORT,disable-ticketing=on \ 13 | -chardev spiceport,id=spagent,name=org.spice-space.webdav.0,debug=0 \ 14 | -chardev spicevmc,id=vdagent,name=vdagent,debug=0 \ 15 | -device vfio-pci,host=29:00.0,x-vga=on,multifunction=on \ 16 | -device vfio-pci,host=29:00.1 \ 17 | -device vfio-pci,host=2a:00.3 \ 18 | -device vfio-pci,host=01:00.0 \ 19 | -device virtio-serial,id=virtio-serial0,max_ports=16 \ 20 | -device virtserialport,chardev=spagent,name=org.spice-space.webdav.0 \ 21 | -device virtserialport,chardev=vdagent,name=com.redhat.spice.0 \ 22 | -chardev socket,id=chrtpm,path=/tmp/emulated_tpm/swtpm-sock \ 23 | -tpmdev emulator,id=tpm0,chardev=chrtpm \ 24 | -device tpm-tis,tpmdev=tpm0 \ 25 | -boot order=cd \ 26 | -bios $OVMF_FD \ 27 | -drive file=/var/Windows11.iso,format=raw,media=cdrom \ 28 | -drive file=/var/virtio-win.iso,format=raw,media=cdrom \ 29 | -nographic \ 30 | -vga none 31 | -------------------------------------------------------------------------------- /overlays/OVMF.nix: -------------------------------------------------------------------------------- 1 | { ... }: 2 | 3 | # OVMF is a port of Intel's tianocore firmware to the qemu virtual machine, allowing us to virtualise UEFI VMs. 4 | # This overlay ensures that it is built with secure boot and TPM support enabled, to support virtualising Windows 11 5 | self: super: { 6 | OVMF = super.OVMF.override { 7 | secureBoot = true; 8 | tpmSupport = true; 9 | }; 10 | } 11 | -------------------------------------------------------------------------------- /overlays/README.md: -------------------------------------------------------------------------------- 1 | ## Overlays 2 | 3 | This directory contains modules representing overlays that are applied over stable nixpkgs to build configurations. 4 | This allows us to easily provide [new packages](./pkgs), or [replace existing ones](./OVMF.nix) in the standard repository. 5 | 6 | Each overlay module accepts the flake inputs and system definition, and emits the [overlay lambda](https://nixos.wiki/wiki/Overlays) that extends nixpkgs stable. 7 | 8 | The filenames of the modules are ignored, but for readability purposes it is a good idea to match them with the packages they expose. 9 | -------------------------------------------------------------------------------- /overlays/discord.nix: -------------------------------------------------------------------------------- 1 | { ... }: 2 | 3 | self: super: { 4 | discord = super.discord.override { 5 | withOpenASAR = false; 6 | }; 7 | } 8 | -------------------------------------------------------------------------------- /overlays/git.nix: -------------------------------------------------------------------------------- 1 | { ... }: 2 | 3 | # Make Git support libsecret 4 | self: super: { 5 | gitAndTools = super.gitAndTools // { 6 | gitFull = super.gitAndTools.gitFull.override { 7 | withLibsecret = true; 8 | }; 9 | }; 10 | } 11 | -------------------------------------------------------------------------------- /overlays/nix-monitored.nix: -------------------------------------------------------------------------------- 1 | { inputs, ... }: 2 | 3 | self: super: rec { 4 | nix-monitored = inputs.nix-monitored.packages.${self.system}.default.override self; 5 | 6 | nix-direnv = super.nix-direnv.override { 7 | nix = nix-monitored; 8 | }; 9 | 10 | nixos-rebuild = super.nixos-rebuild.override { 11 | nix = nix-monitored; 12 | }; 13 | } 14 | -------------------------------------------------------------------------------- /overlays/nvim-base16.nix: -------------------------------------------------------------------------------- 1 | { ... }: 2 | 3 | self: super: { 4 | vimPlugins = super.vimPlugins // { 5 | nvim-base16 = super.vimPlugins.nvim-base16.overrideAttrs (attrs: { 6 | patchPhase = (attrs.patchPhase or "") + '' 7 | sed -i "s/hi.VertSplit = { guifg = M.colors.base05, guibg = M.colors.base00, gui = 'none', guisp = nil }/hi.VertSplit = { guifg = M.colors.base02, guibg = M.colors.base02, gui = 'none', guisp = nil }/" lua/base16-colorscheme.lua 8 | ''; 9 | }); 10 | }; 11 | } 12 | -------------------------------------------------------------------------------- /overlays/pkgs/README.md: -------------------------------------------------------------------------------- 1 | ## Pkg overlays 2 | 3 | This directory contains definitions for new packages in modules that contain derivations. 4 | 5 | For example, the [nixos-wizard](./nixos-wizard/) package is defined here, and used in [the ISO image configuration](../../configurations/iso-image/default.nix#L19). 6 | 7 | ### Adding a new package 8 | 9 | To add a new package, either create a Nix file in this directory, or a new directory with a `default.nix` file inside it. 10 | The name of the Nix file (without the `.nix` extension), or the name of the directory, becomes the package name that is added to the `pkgs` attrset. 11 | -------------------------------------------------------------------------------- /overlays/pkgs/assign-cgroups/default.nix: -------------------------------------------------------------------------------- 1 | { python3Packages 2 | , grim 3 | , ... 4 | }: 5 | 6 | python3Packages.buildPythonApplication { 7 | name = "assign-cgroups"; 8 | format = "other"; 9 | 10 | src = ./.; 11 | 12 | installPhase = '' 13 | runHook preInstall 14 | install -Dm 0755 assign-cgroups $out/bin/assign-cgroups 15 | runHook postInstall 16 | ''; 17 | 18 | propagatedBuildInputs = with python3Packages; [ dbus-fast i3ipc psutil tenacity xlib ]; 19 | } 20 | -------------------------------------------------------------------------------- /overlays/pkgs/darwin-rebuild.nix: -------------------------------------------------------------------------------- 1 | { inputs 2 | , lib 3 | , substituteAll 4 | , runtimeShell 5 | }: 6 | 7 | let 8 | writeProgram = name: env: src: 9 | substituteAll ({ 10 | inherit name src; 11 | dir = "bin"; 12 | isExecutable = true; 13 | } // env); 14 | in 15 | substituteAll { 16 | name = "darwin-rebuild"; 17 | src = "${inputs.nix-darwin}/pkgs/nix-tools/darwin-rebuild.sh"; 18 | dir = "bin"; 19 | isExecutable = true; 20 | shell = runtimeShell; 21 | profile = ""; 22 | } 23 | -------------------------------------------------------------------------------- /overlays/pkgs/darwin-update/darwin-update.sh: -------------------------------------------------------------------------------- 1 | set -e 2 | ensure_tmux nixos-update "$@" 3 | peval cd ~/Projects/NixOS 4 | peval nix flake update 5 | peval darwin-rebuild build --flake . 6 | peval nvd diff /run/current-system result 7 | if ask "Perform switch? (sudo)" y; then 8 | peval result/sw/bin/darwin-rebuild switch --flake . 9 | fi 10 | -------------------------------------------------------------------------------- /overlays/pkgs/darwin-update/default.nix: -------------------------------------------------------------------------------- 1 | { inputs 2 | , writeShellApplication 3 | , shell-utils 4 | , darwin-rebuild 5 | , nvd 6 | , tmux 7 | , systemd 8 | , ... 9 | }: 10 | 11 | writeShellApplication { 12 | name = "darwin-update"; 13 | text = 14 | inputs.lib.concatFiles [ 15 | shell-utils 16 | ./darwin-update.sh 17 | ]; 18 | runtimeInputs = [ 19 | darwin-rebuild 20 | nvd 21 | tmux 22 | ]; 23 | } 24 | -------------------------------------------------------------------------------- /overlays/pkgs/default.nix: -------------------------------------------------------------------------------- 1 | { inputs, lib, ... }: 2 | 3 | self: super: 4 | with lib; pipe ./. [ 5 | findModules 6 | (mapAttrs (name: package: 7 | super.callPackage package { inputs = inputs // { inherit lib; }; } 8 | )) 9 | ] 10 | -------------------------------------------------------------------------------- /overlays/pkgs/nixos-update/default.nix: -------------------------------------------------------------------------------- 1 | { inputs 2 | , writeShellApplication 3 | , shell-utils 4 | , nixos-rebuild 5 | , nvd 6 | , tmux 7 | , systemd 8 | , dbus 9 | , ... 10 | }: 11 | 12 | writeShellApplication { 13 | name = "nixos-update"; 14 | text = 15 | inputs.lib.concatFiles [ 16 | shell-utils 17 | ./nixos-update.sh 18 | ]; 19 | runtimeInputs = [ 20 | nixos-rebuild 21 | nvd 22 | tmux 23 | systemd 24 | dbus 25 | ]; 26 | } 27 | -------------------------------------------------------------------------------- /overlays/pkgs/nixos-update/nixos-update.sh: -------------------------------------------------------------------------------- 1 | ensure_tmux nixos-update "$@" 2 | peval cd /etc/nixos 3 | peval nix flake update 4 | peval nixos-rebuild build --impure --flake "$PWD" "$@" 5 | peval nvd diff /run/current-system result 6 | if ask "Perform switch? (sudo)" y; then 7 | if systemctl is-active --quiet plymouth-start.service; then 8 | peval sudo systemctl stop plymouth-start.service 9 | fi 10 | peval sudo result/bin/switch-to-configuration switch 11 | fi 12 | -------------------------------------------------------------------------------- /overlays/pkgs/nixos-wizard/default.nix: -------------------------------------------------------------------------------- 1 | { inputs 2 | , writeShellApplication 3 | , shell-utils 4 | , gptfdisk 5 | , git 6 | , jq 7 | , ... 8 | }: 9 | 10 | writeShellApplication { 11 | name = "nixos-wizard"; 12 | text = 13 | inputs.lib.concatFiles [ 14 | shell-utils 15 | ./nixos-wizard.sh 16 | ]; 17 | runtimeInputs = [ gptfdisk git jq ]; 18 | } 19 | -------------------------------------------------------------------------------- /overlays/pkgs/nixos-wizard/nixos-wizard.sh: -------------------------------------------------------------------------------- 1 | efi="" 2 | luks="" 3 | disk="" 4 | format="" 5 | swap="" 6 | configuration="" 7 | username="" 8 | role="" 9 | install="" 10 | 11 | #Define the help function 12 | function help() 13 | { 14 | echo "Options:" 15 | echo "--efi Use EFI boot" 16 | echo "--bios Use BIOS boot" 17 | echo "--luks Encrypt root partition" 18 | echo "--no-luks Do not encrypt root partition" 19 | echo "--disk Disk device to use" 20 | echo "--format Format the disk" 21 | echo "--no-format Do not format the disk" 22 | echo "--swap Use swap" 23 | echo "--no-swap Do not use swap" 24 | echo "--configuration Name of configuration to use" 25 | echo "--username Admin username" 26 | echo "--role Configuration role" 27 | echo "--install Perform the installation" 28 | echo "--help Show this help list" 29 | } 30 | 31 | #Define the getopts variables 32 | options=":--efi:--bios:--luks:--no-luks:--disk:--format:--no-format:--swap:--no-swap:--configuration:--username:--role:--install:--help" 33 | 34 | #Start the getopts code 35 | while getopts "$options" opt; do 36 | case $opt in 37 | --efi) efi=true ;; 38 | --bios) efi=false ;; 39 | --luks) luks=true ;; 40 | --no-luks) luks=false ;; 41 | --disk) disk=$OPTARG ;; 42 | --format) format=true;; 43 | --no-format) format=false ;; 44 | --swap) swap=true ;; 45 | --no-swap) swap=false ;; 46 | --configuration) configuration=$OPTARG ;; 47 | --username) username=$OPTARG ;; 48 | --role) role=$OPTARG ;; 49 | --install) install=true ;; 50 | --help) 51 | help 52 | exit 53 | ;; 54 | \?) 55 | error "Invalid option" 56 | help 57 | exit 1 58 | ;; 59 | esac 60 | done 61 | 62 | #This tells getopts to move on to the next argument. 63 | shift $((OPTIND-1)) 64 | #End getopts code 65 | 66 | ensure_root "$@" 67 | ensure_tmux nixos-wizard "$@" 68 | 69 | shopt -s lastpipe 70 | 71 | function ensure_flakes() 72 | { 73 | if nix flake metadata nixpkgs &>/dev/null; then 74 | return 75 | fi 76 | mkdir -p ~/.config/nix 77 | if ! grep -q flakes ~/.config/nix/nix.conf; then 78 | echo 'experimental-features = nix-command flakes' >> ~/.config/nix/nix.conf 79 | fi 80 | } 81 | 82 | ensure_flakes 83 | 84 | EFI_LABEL=EFI 85 | LUKS_LABEL=LUKS 86 | NIXOS_LABEL=NixOS 87 | LUKS_DEVICE=/dev/disk/by-partlabel/$LUKS_LABEL 88 | LUKS_NAME=cryptroot 89 | LUKS_OPEN_DEVICE=/dev/mapper/$LUKS_NAME 90 | NIXOS_DEVICE=/dev/disk/by-label/$NIXOS_LABEL 91 | EFI_DEVICE=/dev/disk/by-partlabel/$EFI_LABEL 92 | ROOT_MOUNT=/mnt 93 | ROOT_VOL=$ROOT_MOUNT/root 94 | BOOT_VOL=$ROOT_MOUNT/boot 95 | HOME_VOL=$ROOT_MOUNT/home 96 | NIX_VOL=$ROOT_MOUNT/nix 97 | SWAP_VOL=$ROOT_MOUNT/swap 98 | SWAP_FILE=$SWAP_VOL/swapfile 99 | NIXOS_DIR=$ROOT_MOUNT/etc/nixos 100 | 101 | function luks_open() 102 | { 103 | if [ -b $LUKS_DEVICE ] && ! [ -b $LUKS_OPEN_DEVICE ]; then 104 | peval cryptsetup luksOpen $LUKS_DEVICE $LUKS_NAME 105 | fi 106 | } 107 | 108 | function luks_close() 109 | { 110 | if [ -b $LUKS_OPEN_DEVICE ]; then 111 | peval cryptsetup close $LUKS_NAME 112 | fi 113 | } 114 | 115 | function is_swapped() 116 | { 117 | grep -q $SWAP_VOL /proc/swaps 118 | } 119 | 120 | function unmount_all() 121 | { 122 | if is_swapped; then peval swapoff $SWAP_FILE; fi 123 | maybe_unmount $BOOT_VOL 124 | maybe_unmount $HOME_VOL 125 | maybe_unmount $NIX_VOL 126 | maybe_unmount $SWAP_VOL 127 | maybe_unmount $ROOT_MOUNT 128 | luks_close 129 | } 130 | 131 | function mount_all() 132 | { 133 | if "$luks"; then 134 | luks_open 135 | fi 136 | maybe_mount -o subvol=root,compress=zstd $NIXOS_DEVICE $ROOT_MOUNT 137 | if "$efi"; then 138 | maybe_mount $EFI_DEVICE $BOOT_VOL 139 | else 140 | maybe_mount -o subvol=boot $NIXOS_DEVICE $BOOT_VOL 141 | fi 142 | maybe_mount -o subvol=home,compress=zstd $NIXOS_DEVICE $HOME_VOL 143 | maybe_mount -o subvol=nix,compress=zstd $NIXOS_DEVICE $NIX_VOL 144 | maybe_mount -o subvol=swap $NIXOS_DEVICE $SWAP_VOL 145 | if [ -f $SWAP_FILE ] && ! is_swapped; then 146 | peval swapon $SWAP_FILE 147 | fi 148 | } 149 | 150 | function is_efi() 151 | { 152 | [ -d /sys/firmware/efi ] 153 | } 154 | 155 | answer=n 156 | if ! [ -b $NIXOS_DEVICE ]; then 157 | answer=y 158 | fi 159 | if ask "Create fresh partitions?" "$answer" "$format"; then 160 | unmount_all 161 | if [ -z "$disk" ]; then 162 | disks=() 163 | lsblk --noheadings --list --paths | grep disk | awk '{print $1,$4,$6,$7}' | while read -r line; do 164 | disks+=("$line") 165 | done 166 | if [ ${#disks[@]} -lt 1 ]; then 167 | fatal "error: no disks found!" 168 | elif [ ${#disks[@]} -eq 1 ]; then 169 | disk=${disks[0]} 170 | warn 'Only one disk found, using it by default' 171 | else 172 | select disk in "${disks[@]}"; do 173 | if [ -n "$disk" ]; then break; fi 174 | done 175 | fi 176 | disk=$(echo "$disk" | awk '{print $1}') 177 | fi 178 | if ! [ -b "$disk" ]; then 179 | fatal "error: cannot find disk: $disk" 180 | fi 181 | info "Selected disk: $disk" 182 | if [ -z "$efi" ]; then 183 | if is_efi; then 184 | select mode in "UEFI BIOS"; do break; done 185 | if [ "$mode" = UEFI ]; then 186 | efi=true 187 | else 188 | efi=false 189 | fi 190 | else 191 | efi=false 192 | warn 'System does not support UEFI boot, defaulting to BIOS' 193 | fi 194 | fi 195 | if "$efi" && ! is_efi; then 196 | fatal 'System does not support UEFI boot' 197 | fi 198 | if ask "Encrypt data partition?" n "$luks"; then 199 | luks=true 200 | rootLabel=$LUKS_LABEL 201 | else 202 | luks=false 203 | rootLabel=$NIXOS_LABEL 204 | fi 205 | p=0 206 | peval sgdisk --zap-all -o "$disk" 207 | if "$efi"; then 208 | peval sgdisk -n "$p:0:+1G" -t "$p:EF00" -c 1:$EFI_LABEL "$disk" 209 | p=$((p + 1)) 210 | fi 211 | peval sgdisk -n "$p:0:0" -t "$p:8300" -c "1:$rootLabel" "$disk" 212 | p=$((p + 1)) 213 | peval partprobe 214 | if "$luks"; then 215 | peval cryptsetup luksFormat $LUKS_DEVICE 216 | luks_open 217 | peval mkfs.btrfs -f -L $NIXOS_LABEL /dev/mapper/$LUKS_NAME 218 | else 219 | peval mkfs.btrfs -f -L $NIXOS_LABEL /dev/disk/by-partlabel/$NIXOS_LABEL 220 | fi 221 | if "$efi"; then 222 | peval mkfs.fat -F32 -n $EFI_LABEL $EFI_DEVICE 223 | fi 224 | peval partprobe 225 | peval mount $NIXOS_DEVICE $ROOT_MOUNT 226 | peval btrfs subvolume create $ROOT_VOL 227 | peval btrfs subvolume create $HOME_VOL 228 | peval btrfs subvolume create $NIX_VOL 229 | peval btrfs subvolume create $SWAP_VOL 230 | if ! "$efi"; then 231 | peval btrfs subvolume create $BOOT_VOL 232 | fi 233 | peval umount $ROOT_MOUNT 234 | mount_all 235 | if ask "Create swap file?" y "$swap"; then 236 | peval touch $SWAP_FILE 237 | peval chmod 600 $SWAP_FILE 238 | peval chattr +C $SWAP_FILE 239 | peval fallocate $SWAP_FILE -l4g 240 | peval mkswap $SWAP_FILE 241 | peval swapon $SWAP_FILE 242 | fi 243 | fi 244 | 245 | if ! is_mounted $ROOT_MOUNT && ask "Mount partitions?" y "$install"; then mount_all; fi 246 | 247 | function validate_configuration_name() 248 | { 249 | [[ "$configuration" =~ ^[A-Za-z][A-Za-z0-9-]*$ ]] 250 | } 251 | 252 | function validate_username() 253 | { 254 | [[ "$username" =~ ^[A-Za-z][A-Za-z0-9]*$ ]] 255 | } 256 | 257 | function create_new_configuration() 258 | { 259 | if [ -z "$configuration" ]; then 260 | while : ; do 261 | echo -n "Enter new configuration name: " 262 | read -r configuration 263 | if validate_configuration_name; then 264 | break 265 | fi 266 | error Invalid configuration name 267 | done 268 | elif ! validate_configuration_name; then 269 | fatal 'Invalid configuration name' 270 | fi 271 | configurationDir=$NIXOS_DIR/configurations/$configuration 272 | if [ -d "$configurationDir" ]; then return; fi 273 | if [ -z "$username" ]; then 274 | while : ; do 275 | echo -n "Enter admin user name (ners): " 276 | read -r username 277 | if [ -z "$username" ]; then 278 | username=ners 279 | fi 280 | if validate_username; then 281 | break 282 | fi 283 | error Invalid username 284 | done 285 | elif ! validate_username; then 286 | fatal 'Invalid admin username' 287 | fi 288 | if [ "$username" = ners ]; then 289 | userProfile=self.profiles.users.ners 290 | else 291 | userProfile="(import self.profiles.users.common (args // { username = \"$username\"; }))" 292 | fi 293 | roles=() 294 | basename --suffix=.nix $NIXOS_DIR/roles/*.nix | while read -r line; do 295 | roles+=("$line") 296 | done 297 | if [ -z "$role" ]; then 298 | echo Select configuration role: 299 | select role in "${roles[@]}"; do 300 | break 301 | done 302 | fi 303 | script=$( 304 | cat <<-EOS 305 | mkdir -p $configurationDir 306 | nix eval --raw --impure --expr builtins.currentSystem > $configurationDir/system 307 | nixos-generate-config --root $ROOT_MOUNT --show-hardware-config > $configurationDir/hardware-configuration.nix 308 | cat <<-EOF >$configurationDir/default.nix 309 | { inputs, ... }@args: 310 | 311 | { 312 | imports = with inputs; [ 313 | ./hardware-configuration.nix 314 | self.roles.$role 315 | $userProfile 316 | ]; 317 | } 318 | EOF 319 | EOS 320 | ) 321 | peval "$script" 322 | } 323 | 324 | if is_mounted $ROOT_MOUNT && ask "Perform installation?" n "$install"; then 325 | if ! [ -f $NIXOS_DIR/flake.nix ] && ask "No valid configuration found. Generate new configuration?" n; then 326 | peval rm -rf $NIXOS_DIR 327 | peval mkdir -p $NIXOS_DIR 328 | peval git clone https://github.com/ners/NixOS $NIXOS_DIR 329 | peval chown 1000:1000 -R $NIXOS_DIR 330 | fi 331 | if ! [ -f $NIXOS_DIR/flake.nix ]; then 332 | fatal "Cannot install: no configuration found!" 333 | fi 334 | configurations=( 'Create New' ) 335 | nix flake show path:$NIXOS_DIR --json | jq --raw-output '.nixosConfigurations|keys[]' | while read -r line; do 336 | configurations+=("$line") 337 | done 338 | if [ -z "$configuration" ]; then 339 | echo Select existing configuration, or create a new one: 340 | select c in "${configurations[@]}"; do 341 | configuration="" 342 | case $c in 343 | 'Create New' ) create_new_configuration ;; 344 | * ) configuration=$c ;; 345 | esac 346 | break 347 | done 348 | fi 349 | configurationDir=$NIXOS_DIR/configurations/$configuration 350 | peval "nixos-generate-config --root $ROOT_MOUNT --show-hardware-config > $configurationDir/hardware-configuration.nix" 351 | peval git -C "$configurationDir" add . 352 | peval nixos-install --flake "$NIXOS_DIR#$configuration" --impure --no-root-password 353 | fi 354 | -------------------------------------------------------------------------------- /overlays/pkgs/screenlock/default.nix: -------------------------------------------------------------------------------- 1 | { python3Packages 2 | , grim 3 | , ... 4 | }: 5 | 6 | python3Packages.buildPythonApplication { 7 | name = "screenlock"; 8 | format = "other"; 9 | 10 | src = ./.; 11 | 12 | installPhase = '' 13 | runHook preInstall 14 | install -Dm 0755 screenlock $out/bin/screenlock 15 | runHook postInstall 16 | ''; 17 | 18 | propagatedBuildInputs = with python3Packages; [ i3ipc pillow grim ]; 19 | } 20 | -------------------------------------------------------------------------------- /overlays/pkgs/screenlock/screenlock: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | import subprocess 4 | from i3ipc import Connection 5 | from PIL import Image 6 | from time import sleep 7 | import io 8 | import os 9 | 10 | sway = Connection() 11 | tree = sway.get_tree().ipc_data 12 | 13 | directory = '/tmp/screenlock' 14 | 15 | def rect_to_area(rect, scale): 16 | x = rect['x'] * scale 17 | y = rect['y'] * scale 18 | width = rect['width'] * scale 19 | height = rect['height'] * scale 20 | return (round(x), round(y), round(x + width), round(y + height)) 21 | 22 | def fetch_windows(): 23 | outputs = {} 24 | windows = [] 25 | for output in tree['nodes']: 26 | output_name = output['name'] 27 | output_rect = output['rect'] 28 | scale = output.get('scale', 1.0) 29 | print('Output:', output_name, 'rect:', output_rect, 'scale:', scale) 30 | outputs[output_name] = rect_to_area(output_rect, scale) 31 | bar = None 32 | for workspace in output.get('nodes', []): 33 | workspace_active = False 34 | workspace_rect = workspace['rect'] 35 | if not 'num' in workspace: 36 | continue 37 | print(' Workspace', workspace['num'], workspace_rect) 38 | queue = workspace.get('nodes', []) + workspace.get('floating_nodes', []) 39 | bar_height = output_rect['height'] - workspace_rect['height'] 40 | bar = { 41 | 'width': output_rect['width'], 42 | 'height': bar_height, 43 | 'x': workspace_rect['x'], 44 | 'y': output_rect['height'] - bar_height + workspace_rect['y'], 45 | } 46 | while len(queue) > 0: 47 | node = queue.pop(0) 48 | queue.extend(node.get('nodes', [])) 49 | queue.extend(node.get('floating_nodes', [])) 50 | if node.get('visible', False): 51 | rect = node['rect'] 52 | area = rect_to_area(rect, scale) 53 | print(' Window:', rect) 54 | windows.append(area) 55 | workspace_active = True 56 | if workspace_active and 'deco_rect' in node: 57 | rect = node['deco_rect'] 58 | print(' Deco:', rect) 59 | area = rect_to_area(rect, scale) 60 | windows.append(area) 61 | if bar: 62 | print(' Bar:', bar) 63 | windows.append(rect_to_area(bar, scale)) 64 | return outputs, windows 65 | 66 | def screenshot(): 67 | content = subprocess.run(['grim', '-t', 'ppm', '-'], stdout=subprocess.PIPE).stdout 68 | return Image.open(io.BytesIO(content)) 69 | 70 | def obscure_image(image): 71 | size = image.size 72 | pixel_size = 8 73 | 74 | if size[0] < pixel_size or size[1] < pixel_size: 75 | return image 76 | 77 | image = image.resize( 78 | (int(size[0] / pixel_size), int(size[1] / pixel_size)), 79 | Image.Resampling.NEAREST) 80 | 81 | image = image.resize( 82 | (int(size[0]), int(size[1])), 83 | Image.Resampling.NEAREST) 84 | return image 85 | 86 | def obscure(image, areas): 87 | for area in areas: 88 | subimage = image.crop(area) 89 | obscured_subimage = obscure_image(subimage) 90 | image.paste(obscured_subimage, area) 91 | return image 92 | 93 | def save_files(image, outputs): 94 | os.makedirs(directory, exist_ok=True) 95 | files = {} 96 | for output_name, output_area in outputs.items(): 97 | subimage = image.crop(output_area) 98 | filename = f'{directory}/{output_name}.jpg' 99 | subimage.save(filename) 100 | files[output_name] = filename 101 | return files 102 | 103 | def lock_screen(files): 104 | command = [ 105 | 'swaylock', 106 | '--indicator-radius', '30', 107 | '--ring-color', 'FFFFFF', 108 | '--key-hl-color', '333333'] 109 | for output_name, filename in files.items(): 110 | command.extend(['--image', f'{output_name}:{filename}']) 111 | print(command) 112 | subprocess.Popen(command, close_fds=True) 113 | sleep(1) 114 | 115 | def remove_files(files): 116 | for output_name, filename in files.items(): 117 | os.remove(filename) 118 | os.rmdir(directory) 119 | 120 | if __name__ == '__main__': 121 | # 1: Get the visible windows. 122 | outputs, windows = fetch_windows() 123 | 124 | # 2: Take a screenshot. 125 | scr = screenshot() 126 | 127 | # 3: Process and save the screenshot. 128 | scr = obscure(scr, windows) 129 | files = save_files(scr, outputs) 130 | 131 | # 4: Lock the screen 132 | lock_screen(files) 133 | 134 | # 5: Remove the file 135 | remove_files(files) 136 | -------------------------------------------------------------------------------- /overlays/pkgs/shell-utils/default.nix: -------------------------------------------------------------------------------- 1 | { lib 2 | , writeShellApplication 3 | , writeText 4 | , tmux 5 | , ... 6 | }: 7 | 8 | let 9 | app = writeShellApplication { 10 | name = "shell-utils"; 11 | text = builtins.readFile ./utils.sh; 12 | runtimeInputs = [ tmux ]; 13 | }; 14 | in 15 | writeText "shell-utils" '' 16 | # shellcheck disable=SC1091 17 | source ${app}/bin/${app.name} 18 | '' 19 | -------------------------------------------------------------------------------- /overlays/pkgs/shell-utils/utils.sh: -------------------------------------------------------------------------------- 1 | function is_interactive() 2 | { 3 | [ -t 0 ] 4 | } 5 | 6 | function ask() 7 | { 8 | local default 9 | local answer 10 | if [[ "${2:-y}" =~ ^[yY] ]] 11 | then default=0 12 | else default=1 13 | fi 14 | while : ; do 15 | echo -n "$1" 16 | if [ "$default" -eq 0 ] 17 | then echo -n " [Y/n] " 18 | else echo -n " [y/N] " 19 | fi 20 | tput dim || true 21 | read -r answer 22 | is_interactive || echo "$answer" 23 | tput sgr 0 24 | case $answer in 25 | "") return $default ;; 26 | [yY]*) return 0 ;; 27 | [nN]*) return 1 ;; 28 | esac 29 | done 30 | } 31 | 32 | function error() 33 | { 34 | tput setaf 1 >&2 35 | echo "${@}" >&2 36 | tput sgr 0 >&2 37 | } 38 | 39 | function warn() 40 | { 41 | tput setaf 3 >&2 42 | echo "${@}" >&2 43 | tput sgr 0 >&2 44 | } 45 | 46 | function info() 47 | { 48 | tput dim || true 49 | echo "${@}" 50 | tput sgr 0 51 | } 52 | 53 | function debug() 54 | { 55 | tput setaf 3 56 | echo "${@}" 57 | tput sgr 0 58 | } 59 | 60 | function fatal() 61 | { 62 | error "$@" 63 | exit 1 64 | } 65 | 66 | function peval() 67 | { 68 | info "$@" 69 | # shellcheck disable=SC2294 70 | eval "$@" 71 | } 72 | 73 | function is_root() 74 | { 75 | [ "$EUID" -eq 0 ] 76 | } 77 | 78 | function is_tmux() 79 | { 80 | [ -n "${TMUX+1}" ] 81 | } 82 | 83 | function ensure_root() 84 | { 85 | if is_root; then 86 | return 87 | fi 88 | error This script should be run as root user! 89 | if ask "Rerun as root? (sudo)" y; then 90 | exec sudo "$0" "$@" 91 | else 92 | exit 1 93 | fi 94 | } 95 | 96 | function ensure_tmux() 97 | { 98 | if is_tmux; then 99 | return 100 | fi 101 | local session 102 | session="$1" 103 | shift 104 | local window 105 | window="$session:0" 106 | tmux start-server 107 | if ! tmux has-session -t "$session" 2>/dev/null; then 108 | tmux new-session -d -t "$session" 109 | fi 110 | local command 111 | command="$0" 112 | local shortCommand 113 | shortCommand="$(basename "$command")" 114 | if command -v "$shortCommand" >/dev/null; then 115 | command="$shortCommand" 116 | fi 117 | tmux send-keys -t "$window" "$command $*" C-m 118 | exec tmux attach-session -t "$session" 119 | } 120 | 121 | function is_mounted() 122 | { 123 | mount | awk "{if (\$3 == \"$1\") {exit 0}} ENDFILE{exit -1}" 124 | } 125 | 126 | function maybe_unmount() 127 | { 128 | if is_mounted "$1"; then 129 | peval umount "$*" 130 | fi 131 | } 132 | 133 | function ensure_dir() 134 | { 135 | if ! [ -d "$1" ]; then 136 | peval mkdir "$1" 137 | fi 138 | } 139 | 140 | function maybe_mount() 141 | { 142 | mount_point="${*: -1}" 143 | ensure_dir "$mount_point" 144 | is_mounted "$mount_point" || peval mount "$@" 145 | } 146 | -------------------------------------------------------------------------------- /overlays/system.nix: -------------------------------------------------------------------------------- 1 | { lib, ... }: 2 | 3 | self: super: 4 | let 5 | parsedSystem = lib.systems.parse.mkSystemFromString self.system; 6 | isLinux = parsedSystem.kernel.name == "linux"; 7 | isDarwin = parsedSystem.kernel.name == "darwin"; 8 | in 9 | { 10 | parsedSystem = parsedSystem // { 11 | inherit isLinux isDarwin; 12 | }; 13 | } 14 | -------------------------------------------------------------------------------- /overlays/unstable/default.nix: -------------------------------------------------------------------------------- 1 | { lib 2 | , inputs 3 | , overlays 4 | , ... 5 | }@args: 6 | 7 | self: super: 8 | let 9 | mkOverlay = o: import o args; 10 | importPkgs = pkgs: import pkgs { 11 | inherit (super) system; 12 | config.allowUnfree = true; 13 | overlays = with builtins; lib.pipe overlays [ 14 | (filter (o: o != ./.)) 15 | (map mkOverlay) 16 | ]; 17 | }; 18 | unstable = importPkgs inputs.nixpkgs-unstable; 19 | master = importPkgs inputs.nixpkgs-master; 20 | local = 21 | if builtins.pathExists /etc/nixpkgs 22 | then importPkgs /etc/nixpkgs 23 | else { }; 24 | in 25 | with builtins; with lib; pipe ./. [ 26 | findModules 27 | attrValues 28 | (map (o: import o { inherit lib unstable master; } self super)) 29 | (foldr recursiveUpdate { inherit unstable master local; }) 30 | ] 31 | -------------------------------------------------------------------------------- /overlays/unstable/direnv.nix: -------------------------------------------------------------------------------- 1 | { unstable, ... }: 2 | 3 | self: super: { 4 | inherit (unstable) direnv nix-direnv; 5 | } 6 | -------------------------------------------------------------------------------- /overlays/unstable/neovim.nix: -------------------------------------------------------------------------------- 1 | { lib, unstable, ... }: 2 | 3 | self: super: { 4 | inherit (unstable) 5 | neovim 6 | neovim-unwrapped 7 | neovimUtils 8 | wrapNeovimUnstable 9 | ; 10 | } 11 | -------------------------------------------------------------------------------- /overlays/vscode-insiders.nix: -------------------------------------------------------------------------------- 1 | { inputs, ... }: 2 | 3 | let 4 | packageJson = builtins.fromJSON (builtins.readFile "${inputs.vscodeInsiders}/resources/app/package.json"); 5 | in 6 | self: super: { 7 | vscode-insiders = (super.vscode.override { isInsiders = true; }).overrideAttrs (attrs: { 8 | src = inputs.vscodeInsiders; 9 | version = packageJson.version; 10 | }); 11 | vscode-insiders-with-extensions = super.vscode-with-extensions.override { 12 | vscode = self.vscode-insiders; 13 | }; 14 | vscode-insiders-extensions = super.vscode-extensions; 15 | } 16 | -------------------------------------------------------------------------------- /overlays/wine.nix: -------------------------------------------------------------------------------- 1 | { ... }: 2 | 3 | # Make Wine support both 32-bit and 64-bit executables 4 | self: super: { 5 | wine = super.wine.override { 6 | wineBuild = "wineWow"; 7 | wineRelease = "unstable"; 8 | }; 9 | } 10 | -------------------------------------------------------------------------------- /profiles/README.md: -------------------------------------------------------------------------------- 1 | ## Profiles 2 | 3 | Profiles are modules that enable and configure an individual unit of functionality with sensible defaults. 4 | 5 | A profile should be small and unassuming enough to be shared between multiple configurations; for example, the [Gnome profile](./gnome.nix) is used by all [graphical configurations](../roles/desktop.nix), such as the [ISO image](../configurations/iso-image) or [Normandy](../configurations/normandy). 6 | 7 | At the same time, a profile should be self-contained such that no extra work should be duplicated by any configuration that uses it; for example, the [Pipewire profile](./pipewire.nix) also [disables Pulseaudio](./pipewire.nix#L13). 8 | -------------------------------------------------------------------------------- /profiles/boot.nix: -------------------------------------------------------------------------------- 1 | { config, lib, pkgs, ... }: 2 | 3 | let 4 | inherit (lib) mkDefault mkForce; 5 | hasEfi = (config.fileSystems."/boot".fsType or "") == "vfat"; 6 | in 7 | { 8 | boot = { 9 | # Use the latest kernel! 10 | kernelPackages = mkForce pkgs.linuxPackages_latest; 11 | 12 | # Remove undesired filesystems such as ZFS that causes kernel breakages. 13 | supportedFilesystems = mkForce [ "vfat" "btrfs" "ext4" ]; 14 | 15 | loader = { 16 | # The number of seconds for user intervention before the default boot option is selected. 17 | timeout = mkDefault 3; 18 | efi.canTouchEfiVariables = hasEfi; 19 | grub = { 20 | enable = mkDefault (!hasEfi); 21 | efiSupport = mkDefault false; 22 | device = "nodev"; 23 | fsIdentifier = "label"; 24 | }; 25 | systemd-boot = { 26 | enable = mkDefault hasEfi; 27 | # The resolution of the console. A higher resolution displays more entries. 28 | consoleMode = "max"; 29 | }; 30 | }; 31 | 32 | initrd = { 33 | # Use systemd for PID 1. 34 | systemd.enable = mkDefault true; 35 | }; 36 | }; 37 | } 38 | -------------------------------------------------------------------------------- /profiles/btrfs.nix: -------------------------------------------------------------------------------- 1 | { pkgs, ... }: 2 | 3 | { 4 | fileSystems."/".options = [ 5 | "compress=zstd" 6 | "noatime" 7 | "nodiratime" 8 | "discard" 9 | ]; 10 | 11 | fileSystems."/home".options = [ 12 | "compress=zstd" 13 | "discard" 14 | ]; 15 | 16 | fileSystems."/nix".options = [ 17 | "compress=zstd" 18 | "noatime" 19 | "nodiratime" 20 | "discard" 21 | ]; 22 | 23 | boot.initrd.supportedFilesystems = [ "btrfs" ]; 24 | environment.systemPackages = with pkgs; [ btrfs-progs compsize ]; 25 | 26 | services.beesd.filesystems = { 27 | root = { 28 | spec = "LABEL=NixOS"; 29 | hashTableSizeMB = 256; 30 | verbosity = "crit"; 31 | extraOptions = [ "--loadavg-target" "5.0" ]; 32 | }; 33 | }; 34 | } 35 | -------------------------------------------------------------------------------- /profiles/dvorak.nix: -------------------------------------------------------------------------------- 1 | { ... }: 2 | 3 | { 4 | console.useXkbConfig = true; 5 | services.xserver.layout = "us"; 6 | services.xserver.xkbVariant = "dvorak"; 7 | } 8 | -------------------------------------------------------------------------------- /profiles/fonts.nix: -------------------------------------------------------------------------------- 1 | { pkgs, lib, ... }: 2 | 3 | lib.mkMerge [ 4 | { 5 | fonts = { 6 | fontDir.enable = true; 7 | fonts = with pkgs; [ 8 | (nerdfonts.override { 9 | fonts = [ 10 | "Cousine" 11 | "FiraCode" 12 | "Iosevka" 13 | "RobotoMono" 14 | "SourceCodePro" 15 | ]; 16 | }) 17 | ]; 18 | }; 19 | } 20 | (lib.optionalAttrs pkgs.parsedSystem.isLinux { 21 | fonts = { 22 | fontconfig.enable = true; 23 | enableGhostscriptFonts = true; 24 | fonts = with pkgs; [ 25 | carlito 26 | dejavu_fonts 27 | fira 28 | fira-code 29 | fira-mono 30 | inconsolata 31 | inter 32 | inter-ui 33 | libertine 34 | noto-fonts 35 | noto-fonts-emoji 36 | noto-fonts-extra 37 | roboto 38 | roboto-mono 39 | source-code-pro 40 | source-sans-pro 41 | source-serif-pro 42 | twitter-color-emoji 43 | unstable.corefonts 44 | ]; 45 | 46 | fontconfig.defaultFonts = { 47 | sansSerif = [ "Source Sans Pro" ]; 48 | serif = [ "Source Serif Pro" ]; 49 | monospace = [ "Fira Code Nerd Font" ]; 50 | emoji = [ "Noto Color Emoji" ]; 51 | }; 52 | 53 | fontconfig.localConf = '' 54 | 55 | 56 | 57 | 58 | monospace 59 | 60 | emoji 61 | 62 | 63 | 64 | sans-serif 65 | 66 | emoji 67 | 68 | 69 | 70 | serif 71 | 72 | emoji 73 | 74 | 75 | 76 | ''; 77 | }; 78 | }) 79 | ] 80 | -------------------------------------------------------------------------------- /profiles/fprintd.nix: -------------------------------------------------------------------------------- 1 | { ... }: 2 | 3 | { 4 | services.fprintd.enable = true; 5 | security.pam.services = { 6 | login.fprintAuth = true; 7 | xscreensaver.fprintAuth = true; 8 | }; 9 | } 10 | -------------------------------------------------------------------------------- /profiles/geoclue.nix: -------------------------------------------------------------------------------- 1 | { ... }: 2 | 3 | { 4 | services.geoclue2.enable = true; 5 | location.provider = "geoclue2"; 6 | } 7 | -------------------------------------------------------------------------------- /profiles/gnome.nix: -------------------------------------------------------------------------------- 1 | { pkgs, ... }: 2 | 3 | { 4 | services = { 5 | xserver = { 6 | displayManager = { 7 | gdm = { 8 | enable = true; 9 | wayland = true; 10 | }; 11 | }; 12 | desktopManager.gnome.enable = true; 13 | }; 14 | gnome = { 15 | core-os-services.enable = true; 16 | core-shell.enable = true; 17 | evolution-data-server.enable = true; 18 | gnome-browser-connector.enable = true; 19 | gnome-keyring.enable = true; 20 | gnome-online-accounts.enable = true; 21 | sushi.enable = true; 22 | }; 23 | dbus.enable = true; 24 | gvfs.enable = true; 25 | }; 26 | 27 | programs = { 28 | dconf.enable = true; 29 | gnupg.agent = { 30 | enable = true; 31 | enableSSHSupport = true; 32 | }; 33 | }; 34 | 35 | security.pam.services.login.enableGnomeKeyring = true; 36 | 37 | services.udev.packages = with pkgs; [ gnome.gnome-settings-daemon ]; 38 | 39 | environment.gnome.excludePackages = (with pkgs; [ 40 | gnome-photos 41 | gnome-tour 42 | ]) ++ (with pkgs.gnome; [ 43 | cheese # webcam tool 44 | gnome-music 45 | gedit # text editor 46 | epiphany # web browser 47 | geary # email reader 48 | gnome-characters 49 | tali # poker game 50 | iagno # go game 51 | hitori # sudoku game 52 | atomix # puzzle game 53 | yelp # Help view 54 | gnome-contacts 55 | gnome-initial-setup 56 | ]); 57 | 58 | environment.systemPackages = with pkgs; with gnome; with gnomeExtensions; [ 59 | adwaita-icon-theme 60 | appindicator 61 | eog 62 | evince 63 | evolution 64 | file-roller 65 | geary 66 | gnome-connections 67 | gnome-tweaks 68 | gnome-usage 69 | nautilus 70 | nufraw-thumbnailer 71 | ]; 72 | } 73 | -------------------------------------------------------------------------------- /profiles/lib/attrsets.nix: -------------------------------------------------------------------------------- 1 | { lib, ... }: 2 | 3 | with builtins; 4 | with lib; 5 | { 6 | # Utility function that converts an attrset to a list of {name, value} pairs. 7 | # Inverse of builtins.listToAttrs: listToAttrs (atrsToList attrs) == attrs 8 | attrsToList = mapAttrsToList nameValuePair; 9 | 10 | # Convert a single {name, value} pair to a corresponding attrset 11 | nameValuePairToAttrs = pipef [ singleton listToAttrs ]; 12 | 13 | # Modify the name field of an attrset by mapping it through a function. 14 | mapName = f: attrs: 15 | assert assertMsg (isFunction f) f; 16 | assert assertMsg (isAttrs attrs) attrs; 17 | attrs // { name = f attrs.name; }; 18 | 19 | # Flatten an attrset by bringing all the leaves to the top level. 20 | # As there is no singular name flattening strategy, the result is a list of 21 | # NameValuePairs, where the name is a list of parts. 22 | # 23 | # Example: 24 | # flattenAttrs { a = { b = 3; c = true; }; d = "paramecium"; } 25 | # => [ { name = ["a" "b"]; value = 3; } { name = ["a" "c"]; value = true; } { name = ["d"]; value = "paramecium"; } ] 26 | flattenAttrs = flattenAttrsCond (const true); 27 | 28 | # Like `flattenAttrs', but takes an additional predicate function that tells 29 | # it whether to recurse into an attribute set. 30 | flattenAttrsCond = cond: pipef [ 31 | (mapAttrsToList (name: value: nameValuePair (singleton name) value)) 32 | (foldr 33 | (p@{ name, value }: acc: 34 | if isAttrs value && cond value then 35 | acc ++ pipe value [ 36 | flattenAttrs 37 | (map (mapName (n: name ++ n))) 38 | ] 39 | else append p acc 40 | ) 41 | [ ]) 42 | ]; 43 | 44 | # Applies the merge function to the output of flattenAttrs, producing an attrset. 45 | # The merge function converts each {name, value} pair to one in which the name is 46 | # merged into a single string, and may change the value as well. 47 | flattenAttrsWith = merge: pipef [ 48 | flattenAttrs 49 | (map (pipef [ merge nameValuePairToAttrs ])) 50 | (foldr recursiveUpdate { }) 51 | ]; 52 | } 53 | -------------------------------------------------------------------------------- /profiles/lib/dconf.nix: -------------------------------------------------------------------------------- 1 | { lib, ... }: 2 | 3 | with builtins; 4 | with lib; 5 | { 6 | dconfFlatten = 7 | let 8 | merge = { name, value }: 9 | assert assertMsg 10 | (length name > 1) 11 | "Dconf configuration requires at least two-level names!"; 12 | nameValuePair (concatStringsSep "/" (init name)) { ${last name} = value; }; 13 | in 14 | flattenAttrsWith merge; 15 | } 16 | -------------------------------------------------------------------------------- /profiles/lib/default.nix: -------------------------------------------------------------------------------- 1 | { inputs 2 | , lib ? inputs.nixpkgs-unstable.lib 3 | , flake-utils-lib ? inputs.flake-utils.lib 4 | , ... 5 | }: 6 | 7 | lib.makeExtensible (self: 8 | with builtins; 9 | with lib; 10 | lib // flake-utils-lib // pipe ./. [ 11 | filesystem.listFilesRecursive 12 | (filter (file: hasSuffix ".nix" file && file != ./default.nix)) 13 | (map (file: import file { inherit inputs; lib = self; })) 14 | (foldr recursiveUpdate { }) 15 | ] 16 | ) 17 | -------------------------------------------------------------------------------- /profiles/lib/filesystem.nix: -------------------------------------------------------------------------------- 1 | { lib, ... }: 2 | 3 | with builtins; 4 | with lib; 5 | { 6 | filesInDir = pipef [ 7 | readDir 8 | attrNames 9 | ]; 10 | 11 | concatDirFilesSep = separator: dir: pipe dir [ 12 | filesInDir 13 | (map (name: readFile "${dir}/${name}")) 14 | (concatStringsSep separator) 15 | ]; 16 | 17 | concatDirFiles = concatDirFilesSep "\n"; 18 | } 19 | -------------------------------------------------------------------------------- /profiles/lib/licenses.nix: -------------------------------------------------------------------------------- 1 | { inputs, ... }: 2 | 3 | { 4 | inherit (inputs.nixpkgs-master.lib) licenses; 5 | } 6 | -------------------------------------------------------------------------------- /profiles/lib/lists.nix: -------------------------------------------------------------------------------- 1 | { lib, ... }: 2 | 3 | with builtins; 4 | with lib; 5 | { 6 | # Prepend a value to a list 7 | prepend = x: xs: [ x ] ++ xs; 8 | 9 | # Append a value to a list 10 | append = x: xs: xs ++ [ x ]; 11 | 12 | # Return true if function `pred` returns false for all elements of `xs`. 13 | none = pred: xs: !(any pred xs); 14 | } 15 | -------------------------------------------------------------------------------- /profiles/lib/modules.nix: -------------------------------------------------------------------------------- 1 | { lib, ... }: 2 | 3 | with builtins; 4 | with lib; 5 | { 6 | # Recurse into a directory tree to find modules and build a nested attrset, with names corresponding to directory 7 | # structure and values the full path to the module which can be imported. 8 | # A module is either a nix file not named default.nix, or a directory containing a default.nix. 9 | # Recursion stops when a module is found, e.g. a file lib.nix in a directory containing default.nix will not be found. 10 | findModules = dir: pipe dir [ 11 | readDir 12 | attrsToList 13 | (foldr 14 | ({ name, value }: acc: 15 | let 16 | fullPath = dir + "/${name}"; 17 | isNixModule = value == "regular" && hasSuffix ".nix" name && name != "default.nix"; 18 | isDir = value == "directory"; 19 | isDirModule = isDir && readDir fullPath ? "default.nix"; 20 | module = nameValuePair (removeSuffix ".nix" name) ( 21 | if isNixModule || isDirModule then fullPath 22 | else if isDir then findModules fullPath 23 | else { } 24 | ); 25 | in 26 | if module.value == { } then acc 27 | else append module acc 28 | ) [ ]) 29 | listToAttrs 30 | ]; 31 | } 32 | -------------------------------------------------------------------------------- /profiles/lib/source-types.nix: -------------------------------------------------------------------------------- 1 | { inputs, ... }: 2 | 3 | { 4 | inherit (inputs.nixpkgs-unstable.lib) sourceTypes; 5 | } 6 | -------------------------------------------------------------------------------- /profiles/lib/strings.nix: -------------------------------------------------------------------------------- 1 | { lib, ... }: 2 | 3 | with builtins; 4 | with lib; 5 | { 6 | # Splits the string by newlines into a list of strings 7 | lines = splitString "\n"; 8 | 9 | # Merges a list of string by newline into a single multiline string 10 | unlines = concatStringsSep "\n"; 11 | 12 | # Splits the string by spaces into a list of strings 13 | words = splitString " "; 14 | 15 | # Merges a list of string by space into a single string 16 | unwords = concatStringsSep " "; 17 | 18 | # Read the list of files and concatenate their contents by the given separator 19 | concatFilesSep = sep: pipef [ 20 | (map readFile) 21 | (concatStringsSep sep) 22 | ]; 23 | 24 | # Read the list of files and concatenate their contents by newline 25 | concatFiles = concatFilesSep "\n"; 26 | 27 | # Prepend one string to another 28 | addPrefix = prefix: str: prefix + str; 29 | 30 | # Append one string to another 31 | addSuffix = suffix: str: str + suffix; 32 | } 33 | -------------------------------------------------------------------------------- /profiles/lib/trivial.nix: -------------------------------------------------------------------------------- 1 | { lib, ... }: 2 | 3 | with lib; 4 | { 5 | # Pipes a value through a list of functions. 6 | # Produces a lambda that accepts a starting value when called with just a list of functions. 7 | pipef = flip pipe; 8 | 9 | # The unary function equivalent of ! operator 10 | not = x: !x; 11 | 12 | # A convenient attribute to debug which version of lib we are using. 13 | zzz = "zzz"; 14 | } 15 | -------------------------------------------------------------------------------- /profiles/lib/types.nix: -------------------------------------------------------------------------------- 1 | { inputs, ... }: 2 | 3 | { 4 | inherit (inputs.nixpkgs-unstable.lib) types; 5 | } 6 | -------------------------------------------------------------------------------- /profiles/lib/xdg.nix: -------------------------------------------------------------------------------- 1 | { lib, ... }: 2 | 3 | with builtins; 4 | with lib; 5 | { 6 | # Given a package, find all the desktop files it contains 7 | desktopFiles = with lib; pipef [ 8 | (pkg: filesystem.listFilesRecursive "${pkg}/share/applications") 9 | (filter (hasSuffix ".desktop")) 10 | ]; 11 | 12 | # Given a desktop file, generate a list of mimetype it supports 13 | mimeTypes = with lib; pipef [ 14 | readFile 15 | lines 16 | (filter (hasPrefix "MimeType=")) 17 | (map (removePrefix "MimeType=")) 18 | (map (splitString ";")) 19 | concatLists 20 | (filter (str: stringLength str > 0)) 21 | (map unsafeDiscardStringContext) 22 | ]; 23 | 24 | # Given a desktop file, pair it with a list of mimetypes it supports 25 | application = file: { 26 | desktop = baseNameOf file; 27 | mimeTypes = mimeTypes file; 28 | }; 29 | 30 | # Given a package, find all its application desktop files and generate applications from them 31 | applications = with lib; pipef [ desktopFiles (map application) ]; 32 | 33 | # Reverse the given application -> mimetypes pair to an attrset of the form mimetype -> application 34 | mimeApp = with lib; pipef [ 35 | (app: map (mimeType: { name = mimeType; value = app.desktop; }) app.mimeTypes) 36 | listToAttrs 37 | ]; 38 | 39 | # Given a package, generate mimetype -> application pairs for each application in it 40 | mimePkg = with lib; pipef [ 41 | applications 42 | (map mimeApp) 43 | zipAttrs 44 | ]; 45 | 46 | # Given a list of packages, generate mimeApps for each, then combine them into a single attrset 47 | mimePkgs = with lib; pipef [ 48 | (map mimePkg) 49 | (zipAttrsWith (_: concatLists)) 50 | ]; 51 | } 52 | -------------------------------------------------------------------------------- /profiles/network.nix: -------------------------------------------------------------------------------- 1 | { ... }: 2 | 3 | { 4 | networking = { 5 | networkmanager.enable = true; 6 | useNetworkd = true; 7 | firewall.enable = false; 8 | dhcpcd.wait = "background"; 9 | dhcpcd.extraConfig = "noarp"; 10 | }; 11 | 12 | systemd.network.enable = true; 13 | systemd.services = { 14 | NetworkManager-wait-online.enable = false; 15 | systemd-udev-settle.enable = false; 16 | }; 17 | } 18 | -------------------------------------------------------------------------------- /profiles/nix.nix: -------------------------------------------------------------------------------- 1 | { inputs, pkgs, lib, ... }: 2 | 3 | lib.mkMerge [ 4 | { 5 | nix = { 6 | settings = { 7 | auto-optimise-store = true; 8 | preallocate-contents = false; 9 | experimental-features = [ "nix-command" "flakes" "ca-derivations" ]; 10 | trusted-users = [ "root" "@wheel" "@admin" ]; 11 | }; 12 | gc = { 13 | automatic = true; 14 | options = "--delete-older-than 30d"; 15 | }; 16 | monitored = { 17 | enable = true; 18 | package = pkgs.unstable.nix-monitored; 19 | }; 20 | registry.nixpkgs.flake = inputs.nixpkgs-unstable; 21 | nixPath = [ "nixpkgs=/etc/channels/nixpkgs" ]; 22 | }; 23 | environment.etc."channels/nixpkgs".source = inputs.nixpkgs-unstable.outPath; 24 | } 25 | (lib.optionalAttrs pkgs.parsedSystem.isLinux { 26 | nix.gc.dates = "monthly"; 27 | }) 28 | (lib.optionalAttrs pkgs.parsedSystem.isDarwin { 29 | nix.gc.interval.Day = 1; 30 | services.nix-daemon.enable = true; 31 | }) 32 | ] 33 | -------------------------------------------------------------------------------- /profiles/pipewire.nix: -------------------------------------------------------------------------------- 1 | { lib, ... }: 2 | 3 | { 4 | services.pipewire = { 5 | alsa.enable = true; 6 | alsa.support32Bit = true; 7 | enable = true; 8 | jack.enable = true; 9 | pulse.enable = true; 10 | wireplumber.enable = true; 11 | }; 12 | sound.enable = true; 13 | hardware.pulseaudio.enable = lib.mkForce false; 14 | } 15 | -------------------------------------------------------------------------------- /profiles/plymouth.nix: -------------------------------------------------------------------------------- 1 | { ... }: 2 | 3 | { 4 | # Plymouth presents a graphic animation (also known as a bootsplash) while the system boots. 5 | # It provides eye-candy and a more professional presentation for scenarios where the default 6 | # high-information text output might be undesirable. 7 | # It also handles boot prompts, such as entering disk encryption passwords. 8 | boot.plymouth = { 9 | enable = true; 10 | theme = "breeze"; 11 | }; 12 | } 13 | -------------------------------------------------------------------------------- /profiles/ssh.nix: -------------------------------------------------------------------------------- 1 | { lib, ... }: 2 | 3 | { 4 | services.openssh = { 5 | enable = true; 6 | settings = { 7 | PasswordAuthentication = false; 8 | PermitRootLogin = lib.mkForce "no"; 9 | }; 10 | }; 11 | } 12 | -------------------------------------------------------------------------------- /profiles/users/common/apps.nix: -------------------------------------------------------------------------------- 1 | { nixosConfig, pkgs, lib, ... }: 2 | 3 | 4 | # This file is responsible for defining default applications by mimetype. 5 | let 6 | enable = nixosConfig.services.xserver.enable or false; 7 | debugEnable = with builtins; 8 | trace 9 | "xdg: ${if enable then "enable" else "disable"}" 10 | enable; 11 | in 12 | { 13 | xdg = { 14 | inherit enable; 15 | mimeApps = 16 | if debugEnable 17 | then { 18 | enable = true; 19 | defaultApplications = lib.mimePkgs (with pkgs; [ 20 | evince 21 | firefox-wayland 22 | gnome-connections 23 | gnome.eog 24 | gnome.file-roller 25 | gnome.nautilus 26 | gparted 27 | mpv 28 | rhythmbox 29 | thunderbird 30 | transmission-gtk 31 | neovide 32 | virt-manager 33 | virt-viewer 34 | ]); 35 | } else { }; 36 | }; 37 | } 38 | -------------------------------------------------------------------------------- /profiles/users/common/dconf.nix: -------------------------------------------------------------------------------- 1 | { nixosConfig 2 | , lib 3 | , ... 4 | }: 5 | 6 | let 7 | enable = nixosConfig.services.dbus.enable or false; 8 | debugEnable = with builtins; 9 | trace 10 | "dconf: ${if enable then "enable" else "disable"}" 11 | enable; 12 | in 13 | { 14 | dconf = { 15 | inherit enable; 16 | settings = 17 | if debugEnable then 18 | lib.dconfFlatten 19 | { 20 | org.gnome = { 21 | Console.theme = "auto"; 22 | desktop = { 23 | interface = { 24 | font-antialiasing = "grayscale"; 25 | font-hinting = "full"; 26 | gtk-im-module = "gtk-im-context-simple"; 27 | gtk-theme = "Adwaita-dark"; 28 | color-scheme = "prefer-dark"; 29 | monospace-font-name = "Iosevka Nerd Font Mono Regular 12"; 30 | }; 31 | peripherals = { 32 | touchpad = { 33 | speed = 0.5; 34 | tap-to-click = true; 35 | two-finger-scrolling-enabled = true; 36 | }; 37 | mouse.speed = 0.5; 38 | keyboard = { 39 | repeat = true; 40 | delay = 200; 41 | repeat-interval = 10; 42 | }; 43 | }; 44 | }; 45 | shell.favorite-apps = [ 46 | "firefox.desktop" 47 | "org.gnome.Console.desktop" 48 | "org.gnome.Nautilus.desktop" 49 | ]; 50 | nautilus = { 51 | preferences = { 52 | default-folder-viewer = "list-view"; 53 | executable-text-activation = "display"; 54 | search-filter-time-type = "last_modified"; 55 | search-view = "list-view"; 56 | show-image-thumbnails = "always"; 57 | thumbnail-limit = 10; 58 | }; 59 | list-view.use-tree-view = true; 60 | }; 61 | gnome-system-monitor = { 62 | cpu-smooth-graph = true; 63 | cpu-stacked-area-chart = true; 64 | }; 65 | settings-daemon.plugins.color.night-light.enabled = true; 66 | }; 67 | org.gtk.gtk4.settings.file-chooser.sort-directories-first = true; 68 | 69 | org.virt-manager = { 70 | connections = rec { 71 | uris = [ "qemu:///system" "qemu:///session" ]; 72 | autoconnect = uris; 73 | }; 74 | virt-manager.xmleditor-enabled = true; 75 | console.resize-guest = 1; 76 | }; 77 | } else { }; 78 | }; 79 | } 80 | -------------------------------------------------------------------------------- /profiles/users/common/default.nix: -------------------------------------------------------------------------------- 1 | { inputs 2 | , pkgs 3 | , lib 4 | , config 5 | , uid ? 1000 6 | , gid ? uid 7 | , username 8 | , group ? username 9 | , homeDirectory ? if pkgs.parsedSystem.isLinux then 10 | "/home/${username}" 11 | else if pkgs.parsedSystem.isDarwin then 12 | "/Users/${username}" 13 | else 14 | abort "Cannot infer homeDirectory" 15 | , initialHashedPassword ? "" 16 | , extraGroups ? [ 17 | "audio" 18 | "dialout" 19 | "docker" 20 | "libvirtd" 21 | "networkmanager" 22 | "plugdev" 23 | "users" 24 | "video" 25 | "wheel" 26 | ] 27 | , sshKeys ? [ ] 28 | , ... 29 | }: 30 | 31 | { 32 | config = lib.mkMerge [ 33 | { 34 | users.users.${username} = { 35 | name = username; 36 | home = homeDirectory; 37 | }; 38 | home-manager = { 39 | useGlobalPkgs = true; 40 | # useUserPackages = true; 41 | extraSpecialArgs = { 42 | inherit inputs username homeDirectory; 43 | lib = lib // inputs.home-manager.lib; 44 | nixosConfig = config; 45 | }; 46 | users.${username} = import ./home.nix { inherit inputs pkgs lib username homeDirectory; }; 47 | }; 48 | } 49 | (lib.mkIf pkgs.parsedSystem.isLinux { 50 | users.users.${username} = { 51 | inherit uid group initialHashedPassword extraGroups; 52 | isNormalUser = true; 53 | isSystemUser = false; 54 | createHome = true; 55 | openssh.authorizedKeys.keys = sshKeys; 56 | }; 57 | users.groups.${group} = { inherit gid; }; 58 | }) 59 | ]; 60 | } 61 | -------------------------------------------------------------------------------- /profiles/users/common/direnv.nix: -------------------------------------------------------------------------------- 1 | { ... }: 2 | 3 | { 4 | programs.direnv = { 5 | enable = true; 6 | nix-direnv.enable = true; 7 | enableZshIntegration = true; 8 | }; 9 | } 10 | -------------------------------------------------------------------------------- /profiles/users/common/firefox.nix: -------------------------------------------------------------------------------- 1 | { pkgs, lib, ... }: 2 | 3 | (lib.mkIf pkgs.parsedSystem.isLinux { 4 | programs.firefox = { 5 | enable = true; 6 | package = pkgs.unstable.firefox-devedition-bin; 7 | }; 8 | }) 9 | -------------------------------------------------------------------------------- /profiles/users/common/git.nix: -------------------------------------------------------------------------------- 1 | { pkgs, ... }: 2 | 3 | { 4 | home.packages = [ pkgs.git-lfs ]; 5 | 6 | programs.git = { 7 | enable = true; 8 | difftastic.enable = true; 9 | ignores = [ ".*" "!.envrc" "!.gitignore" "!.gitkeep" ]; 10 | aliases = { 11 | commend = "commit --amend --no-edit"; 12 | grog = "log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(auto)%d%C(reset)'"; 13 | please = "push --force-with-lease"; 14 | root = "rev-parse --show-toplevel"; 15 | touch = "commit --amend --no-edit --date=now"; 16 | }; 17 | extraConfig = { 18 | core.sshCommand = "ssh -F $HOME/.ssh/config"; 19 | init.defaultBranch = "master"; 20 | merge.conflictStyle = "diff3"; 21 | diff.colorMoved = "default"; 22 | pull.rebase = true; 23 | push.default = "current"; 24 | push.autoSetupRemote = true; 25 | credential.helper = "libsecret"; 26 | "filter \"lfs\"" = { 27 | required = true; 28 | clean = "git-lfs clean -- %f"; 29 | process = "git-lfs filter-process"; 30 | smudge = "git-lfs smudge -- %f"; 31 | }; 32 | }; 33 | }; 34 | 35 | # GitHub CLI 36 | # https://rycee.gitlab.io/home-manager/options.html#opt-programs.gh.enable 37 | # Aliases config imported in flake. 38 | programs.gh = { 39 | enable = true; 40 | settings.git_protocol = "ssh"; 41 | }; 42 | } 43 | -------------------------------------------------------------------------------- /profiles/users/common/graphical.nix: -------------------------------------------------------------------------------- 1 | { pkgs, lib, ... }: 2 | 3 | lib.mkIf pkgs.parsedSystem.isLinux { 4 | home.pointerCursor = { 5 | name = "Vanilla-DMZ"; 6 | package = pkgs.vanilla-dmz; 7 | size = 16; 8 | gtk.enable = true; 9 | x11.enable = true; 10 | }; 11 | 12 | gtk.enable = true; 13 | gtk.theme.name = "Adwaita-dark"; 14 | gtk.iconTheme.name = "Adwaita"; 15 | 16 | qt.enable = true; 17 | qt.platformTheme = "gtk"; 18 | } 19 | -------------------------------------------------------------------------------- /profiles/users/common/home.nix: -------------------------------------------------------------------------------- 1 | { inputs 2 | , pkgs 3 | , lib 4 | , username 5 | , homeDirectory 6 | , ... 7 | }: 8 | 9 | { 10 | # Let Home Manager install and manage itself. 11 | programs.home-manager.enable = false; 12 | 13 | home = { 14 | # Home Manager needs a bit of information about you and the 15 | # paths it should manage. 16 | inherit username homeDirectory; 17 | 18 | # This value determines the Home Manager release that your 19 | # configuration is compatible with. This helps avoid breakage 20 | # when a new Home Manager release introduces backwards 21 | # incompatible changes. 22 | # 23 | # You can update Home Manager without changing this value. See 24 | # the Home Manager release notes for a list of state version 25 | # changes in each release. 26 | stateVersion = inputs.self.version; 27 | }; 28 | 29 | # Home-manager's generation is currently broken 30 | # as it does not call modules with specialArgs. 31 | manual.manpages.enable = lib.mkForce false; 32 | 33 | imports = [ 34 | ./apps.nix 35 | ./dconf.nix 36 | ./direnv.nix 37 | ./firefox.nix 38 | ./git.nix 39 | ./graphical.nix 40 | ./neovim 41 | ./starship.nix 42 | ./tmux.nix 43 | ./xdg 44 | ./zsh 45 | inputs.nix-colors.homeManagerModule 46 | ]; 47 | 48 | colorScheme = inputs.nix-colors.colorSchemes.classic-dark; 49 | 50 | services.udiskie.enable = pkgs.parsedSystem.isLinux; 51 | } 52 | -------------------------------------------------------------------------------- /profiles/users/common/neovim/default.nix: -------------------------------------------------------------------------------- 1 | { config, pkgs, lib, ... }: 2 | 3 | let 4 | vimPlugins = { 5 | stable = pkgs.vimPlugins; 6 | unstable = pkgs.unstable.vimPlugins; 7 | master = pkgs.master.vimPlugins; 8 | local = pkgs.local.vimPlugins; 9 | }; 10 | loadPlugin = p: '' 11 | set rtp^=${p.plugin or p} 12 | set rtp+=${p.plugin or p}/after 13 | ''; 14 | loadPlugins = lib.pipef [ (builtins.map loadPlugin) lib.unlines ]; 15 | plugins = with vimPlugins.unstable; [ 16 | (nvim-treesitter.withPlugins (_: pkgs.unstable.tree-sitter.allGrammars)) 17 | bufferline-nvim 18 | cmp-buffer 19 | cmp-cmdline 20 | cmp-nvim-lsp 21 | cmp-omni 22 | cmp-path 23 | cmp-treesitter 24 | cmp_luasnip 25 | direnv-vim 26 | fidget-nvim 27 | fzf-lsp-nvim 28 | fzf-vim 29 | fzfWrapper 30 | gitsigns-nvim 31 | { 32 | plugin = impatient-nvim; 33 | type = "lua"; 34 | config = '' 35 | require('impatient') 36 | ''; 37 | } 38 | incsearch-vim 39 | indent-blankline-nvim 40 | litee-calltree-nvim 41 | litee-filetree-nvim 42 | litee-nvim 43 | litee-symboltree-nvim 44 | lsp_extensions-nvim 45 | lsp_signature-nvim 46 | lspkind-nvim 47 | lsp_lines-nvim 48 | lsp-inlayhints-nvim 49 | lualine-nvim 50 | luasnip 51 | mkdir-nvim 52 | neoscroll-nvim 53 | nvim-autopairs 54 | { 55 | plugin = nvim-base16; 56 | type = "lua"; 57 | config = with config.colorScheme.colors; '' 58 | require('base16-colorscheme').setup({ 59 | base00 = '#${base00}', base01 = '#${base01}', base02 = '#${base02}', base03 = '#${base03}', 60 | base04 = '#${base04}', base05 = '#${base05}', base06 = '#${base06}', base07 = '#${base07}', 61 | base08 = '#${base08}', base09 = '#${base09}', base0A = '#${base0A}', base0B = '#${base0B}', 62 | base0C = '#${base0C}', base0D = '#${base0D}', base0E = '#${base0E}', base0F = '#${base0F}', 63 | }) 64 | ''; 65 | } 66 | nvim-cmp 67 | nvim-dap 68 | nvim-dap-ui 69 | nvim-hlslens 70 | nvim-lspconfig 71 | nvim-scrollbar 72 | neo-tree-nvim 73 | nvim-web-devicons 74 | plenary-nvim 75 | popup-nvim 76 | rust-tools-nvim 77 | tagbar 78 | telescope-fzf-native-nvim 79 | telescope-nvim 80 | telescope-ui-select-nvim 81 | trouble-nvim 82 | vimtex 83 | which-key-nvim 84 | ]; 85 | in 86 | { 87 | home.packages = with pkgs.unstable; [ 88 | nixpkgs-fmt 89 | nil 90 | lua-language-server 91 | ]; 92 | 93 | programs.neovim = { 94 | enable = true; 95 | viAlias = true; 96 | vimAlias = true; 97 | vimdiffAlias = true; 98 | withNodeJs = true; 99 | withPython3 = true; 100 | inherit plugins; 101 | extraConfig = '' 102 | filetype off | syn off 103 | ${loadPlugins plugins} 104 | filetype indent plugin on | syn on 105 | ${builtins.readFile ./init.vim} 106 | ''; 107 | }; 108 | xdg.configFile = { 109 | "nvim/plugin".source = ./plugin; 110 | "nvim/ftplugin".source = ./ftplugin; 111 | "nvim/ginit.vim".source = ./ginit.vim; 112 | }; 113 | } 114 | -------------------------------------------------------------------------------- /profiles/users/common/neovim/ftplugin/cabal.lua: -------------------------------------------------------------------------------- 1 | vim.bo.expandtab = true 2 | vim.bo.shiftwidth = 4 3 | vim.bo.softtabstop = 4 4 | vim.bo.tabstop = 4 5 | -------------------------------------------------------------------------------- /profiles/users/common/neovim/ftplugin/haskell.lua: -------------------------------------------------------------------------------- 1 | vim.bo.expandtab = true 2 | vim.bo.shiftwidth = 4 3 | vim.bo.softtabstop = 4 4 | vim.bo.tabstop = 4 5 | -------------------------------------------------------------------------------- /profiles/users/common/neovim/ftplugin/nix.lua: -------------------------------------------------------------------------------- 1 | vim.bo.expandtab = true 2 | vim.bo.shiftwidth = 2 3 | vim.bo.softtabstop = 2 4 | vim.bo.tabstop = 2 5 | -------------------------------------------------------------------------------- /profiles/users/common/neovim/ginit.vim: -------------------------------------------------------------------------------- 1 | highlight LineNr guibg=NONE 2 | highlight NonText guifg=bg 3 | highlight SignColumn guibg=NONE 4 | highlight Whitespace ctermfg=grey guifg=grey70 5 | "highlight GitSignsAdd guibg=NONE guifg=green gui=bold 6 | "highlight GitSignsChange guibg=NONE guifg=gray gui=bold 7 | "highlight GitSignsDelete guibg=NONE guifg=red gui=bold 8 | " set cursorline 9 | -------------------------------------------------------------------------------- /profiles/users/common/neovim/init.vim: -------------------------------------------------------------------------------- 1 | syntax on 2 | filetype on 3 | filetype plugin on 4 | filetype indent on 5 | command W w 6 | -------------------------------------------------------------------------------- /profiles/users/common/neovim/plugin/autoreload.lua: -------------------------------------------------------------------------------- 1 | -- Reload file when it has changed 2 | vim.opt.autoread = true 3 | vim.api.nvim_create_autocmd({ 'VimEnter', 'FocusGained', 'BufEnter' }, { 4 | group = vim.api.nvim_create_augroup('ReloadFileOnChange', {}), 5 | command = 'checktime', 6 | }) 7 | -------------------------------------------------------------------------------- /profiles/users/common/neovim/plugin/cmp.lua: -------------------------------------------------------------------------------- 1 | -- Setup Completion 2 | -- See https://github.com/hrsh7th/nvim-cmp#basic-configuration 3 | local cmp = require 'cmp' 4 | local cmp_window = require 'cmp.utils.window' 5 | local lspkind = require 'lspkind' 6 | 7 | local function border(hl_name) 8 | return { 9 | { "╭", hl_name }, 10 | { "─", hl_name }, 11 | { "╮", hl_name }, 12 | { "│", hl_name }, 13 | { "╯", hl_name }, 14 | { "─", hl_name }, 15 | { "╰", hl_name }, 16 | { "│", hl_name }, 17 | } 18 | end 19 | 20 | cmp_window.info_ = cmp_window.info 21 | cmp_window.info = function(self) 22 | local info = self:info_() 23 | info.scrollable = false 24 | return info 25 | end 26 | 27 | cmp.setup { 28 | window = { 29 | completion = { 30 | border = border "CmpBorder", 31 | winhighlight = "Normal:CmpPmenu,CursorLine:PmenuSel,Search:None", 32 | }, 33 | documentation = { 34 | border = border "CmpDocBorder", 35 | }, 36 | }, 37 | snippet = { 38 | expand = function(args) 39 | require("luasnip").lsp_expand(args.body) 40 | end, 41 | }, 42 | formatting = { 43 | format = lspkind.cmp_format { 44 | mode = 'symbol_text', 45 | maxwidth = 50, 46 | } 47 | }, 48 | mapping = { 49 | [""] = cmp.mapping.select_prev_item(), 50 | [""] = cmp.mapping.select_next_item(), 51 | [""] = cmp.mapping.scroll_docs(-4), 52 | [""] = cmp.mapping.scroll_docs(4), 53 | [""] = cmp.mapping.complete(), 54 | [""] = cmp.mapping.close(), 55 | [""] = cmp.mapping.confirm { 56 | behavior = cmp.ConfirmBehavior.Replace, 57 | select = false, 58 | }, 59 | [""] = cmp.mapping(function(fallback) 60 | if cmp.visible() then 61 | cmp.select_next_item() 62 | elseif require("luasnip").expand_or_jumpable() then 63 | vim.fn.feedkeys(vim.api.nvim_replace_termcodes("luasnip-expand-or-jump", true, true, true), "") 64 | else 65 | fallback() 66 | end 67 | end, { 68 | "i", 69 | "s", 70 | }), 71 | [""] = cmp.mapping(function(fallback) 72 | if cmp.visible() then 73 | cmp.select_prev_item() 74 | elseif require("luasnip").jumpable(-1) then 75 | vim.fn.feedkeys(vim.api.nvim_replace_termcodes("luasnip-jump-prev", true, true, true), "") 76 | else 77 | fallback() 78 | end 79 | end, { 80 | "i", 81 | "s", 82 | }), 83 | }, 84 | sources = { 85 | { name = "luasnip" }, 86 | { name = "nvim_lsp" }, 87 | { name = "nvim_lua" }, 88 | { name = "path" }, 89 | { name = "treesitter" }, 90 | { name = "buffer" }, 91 | }, 92 | } 93 | 94 | cmp.setup.cmdline(':', { 95 | sources = { 96 | { name = 'cmdline' } 97 | } 98 | }) 99 | 100 | cmp.setup.cmdline('/', { 101 | sources = { 102 | { name = 'buffer' } 103 | } 104 | }) 105 | -------------------------------------------------------------------------------- /profiles/users/common/neovim/plugin/config.lua: -------------------------------------------------------------------------------- 1 | local opt = vim.opt 2 | local g = vim.g 3 | local fn = vim.fn 4 | 5 | -- Use space as leader key 6 | g.mapleader = ' ' 7 | 8 | -- Set mouse mode to all modes 9 | opt.mouse = 'a' 10 | 11 | opt.encoding = "utf-8" 12 | 13 | opt.updatetime = 100 14 | 15 | -- Backspace works on every char in insert mode 16 | vim.opt.backspace = "indent,eol,start" 17 | 18 | -- Enable background buffer 19 | vim.o.hidden = true 20 | 21 | -- Show line numbers 22 | vim.opt.number = true 23 | 24 | -- Share the sign column with the number column to prevent text flicker 25 | --vim.opt.signcolumn = 'number' 26 | vim.opt.signcolumn = 'yes' 27 | 28 | -- Display command in bottom bar 29 | vim.opt.showcmd = true 30 | 31 | -- Tab control 32 | opt.smarttab = true -- tab respects 'tabstop', 'shiftwidth', and 'softtabstop' 33 | opt.tabstop = 4 -- the visible width of tabs 34 | opt.softtabstop = 4 -- edit as if the tabs are 4 characters wide 35 | opt.shiftwidth = 4 -- number of spaces to use for indent and unindent 36 | opt.shiftround = true -- round indent to a multiple of 'shiftwidth' 37 | 38 | -- Use hard tabs, soft tabs can be enabled on filetype basis 39 | vim.opt.expandtab = false 40 | 41 | -- Autoindent 42 | vim.opt.autoindent = true 43 | vim.opt.smartindent = true 44 | 45 | -- Search 46 | opt.ignorecase = true -- case insensitive searching 47 | opt.smartcase = true -- case-sensitive if expresson contains a capital letter 48 | opt.hlsearch = true -- highlight search results 49 | opt.incsearch = true -- set incremental search, like modern browsers 50 | opt.lazyredraw = false -- don't redraw while executing macros 51 | opt.magic = true -- set magic on, for regular expressions 52 | 53 | -- Don't redraw while executing macros 54 | opt.ttyfast = true 55 | opt.lazyredraw = true 56 | 57 | -- If ripgrep installed, use that as a grepper 58 | if fn.executable("rg") then 59 | opt.grepprg = "rg --vimgrep --no-heading" 60 | opt.grepformat = "%f:%l:%c:%m,%f:%l:%m" 61 | end 62 | 63 | -- Show matching brackets 64 | vim.o.showmatch = true 65 | 66 | -- Split direction 67 | vim.opt.splitright = true 68 | vim.opt.splitbelow = true 69 | 70 | -- Set completeopt to have a better completion experience 71 | -- :help completeopt 72 | -- menuone: popup even when there's only one match 73 | -- noinsert: Do not insert text until a selection is made 74 | -- noselect: Do not select, force user to select one from the menu 75 | vim.opt.completeopt = { 'menuone', 'noselect', 'noinsert' } 76 | 77 | -- Prevent strange file save behaviour. 78 | -- https://github.com/srid/emanote/issues/180 79 | vim.opt.backupcopy = 'yes' 80 | -------------------------------------------------------------------------------- /profiles/users/common/neovim/plugin/debugger.lua: -------------------------------------------------------------------------------- 1 | require 'dapui'.setup { 2 | icons = { expanded = '▾', collapsed = '▸' }, 3 | } 4 | -------------------------------------------------------------------------------- /profiles/users/common/neovim/plugin/fidget.lua: -------------------------------------------------------------------------------- 1 | require'fidget'.setup { 2 | text = { 3 | spinner = "dots", 4 | }, 5 | } 6 | -------------------------------------------------------------------------------- /profiles/users/common/neovim/plugin/gitsigns.lua: -------------------------------------------------------------------------------- 1 | require 'gitsigns'.setup { 2 | } 3 | -------------------------------------------------------------------------------- /profiles/users/common/neovim/plugin/hlslens.lua: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ners/NixOS/e6338c857de433cd9f474b3bc77df62deea4dfdb/profiles/users/common/neovim/plugin/hlslens.lua -------------------------------------------------------------------------------- /profiles/users/common/neovim/plugin/lsp-autoformat.lua: -------------------------------------------------------------------------------- 1 | vim.api.nvim_create_autocmd("LspAttach", { 2 | group = vim.api.nvim_create_augroup("LspAttach_autoformat", {}), 3 | callback = function(args) 4 | if not (args.data and args.data.client_id) then 5 | return 6 | end 7 | 8 | local buffer = args.buf 9 | local client = vim.lsp.get_client_by_id(args.data.client_id) 10 | 11 | if client.server_capabilities.documentFormattingProvider then 12 | -- Format the file before it is written 13 | vim.api.nvim_create_autocmd('BufWritePre', { 14 | group = vim.api.nvim_create_augroup('FormatOnWrite', {}), 15 | callback = function() vim.lsp.buf.format(nil, 1000) end, 16 | buffer = buffer, 17 | }) 18 | end 19 | end, 20 | }) 21 | -------------------------------------------------------------------------------- /profiles/users/common/neovim/plugin/lsp-c.lua: -------------------------------------------------------------------------------- 1 | require 'lspconfig'.clangd.setup { 2 | cmd = { 3 | 'clangd', 4 | '--background-index', 5 | '--inlay-hints', 6 | '--clang-tidy', 7 | '--compile-commands-dir=build', 8 | }, 9 | } 10 | -------------------------------------------------------------------------------- /profiles/users/common/neovim/plugin/lsp-clojure.lua: -------------------------------------------------------------------------------- 1 | require 'lspconfig'.clojure_lsp.setup {} 2 | -------------------------------------------------------------------------------- /profiles/users/common/neovim/plugin/lsp-haskell.lua: -------------------------------------------------------------------------------- 1 | require 'lspconfig'.hls.setup { 2 | --filetypes = { 'haskell', 'lhaskell', 'cabal' }, 3 | settings = { 4 | haskell = { 5 | --cabalFormattingProvider = "cabal-fmt", 6 | formattingProvider = 'fourmolu' 7 | }, 8 | }, 9 | } 10 | -------------------------------------------------------------------------------- /profiles/users/common/neovim/plugin/lsp-highlight.lua: -------------------------------------------------------------------------------- 1 | vim.api.nvim_create_autocmd("LspAttach", { 2 | group = vim.api.nvim_create_augroup("LspAttach_highlight", {}), 3 | callback = function(args) 4 | if not (args.data and args.data.client_id) then 5 | return 6 | end 7 | 8 | local buffer = args.buf 9 | local client = vim.lsp.get_client_by_id(args.data.client_id) 10 | 11 | if client.server_capabilities.documentHighlightProvider then 12 | local group = vim.api.nvim_create_augroup('CursorHighlight', {}) 13 | -- Highlight occurrences under the cursor 14 | vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, { 15 | group = group, 16 | callback = vim.lsp.buf.document_highlight, 17 | buffer = buffer, 18 | }) 19 | -- Clear occurrences when the cursor moves 20 | vim.api.nvim_create_autocmd('CursorMoved', { 21 | group = group, 22 | callback = vim.lsp.buf.clear_references, 23 | buffer = buffer, 24 | }) 25 | end 26 | end, 27 | }) 28 | -------------------------------------------------------------------------------- /profiles/users/common/neovim/plugin/lsp-inlayhints.lua: -------------------------------------------------------------------------------- 1 | vim.api.nvim_create_autocmd("LspAttach", { 2 | group = vim.api.nvim_create_augroup("LspAttach_inlayhints", {}), 3 | callback = function(args) 4 | if not (args.data and args.data.client_id) then 5 | return 6 | end 7 | 8 | local buffer = args.buf 9 | local client = vim.lsp.get_client_by_id(args.data.client_id) 10 | require("lsp-inlayhints").on_attach(client, buffer) 11 | end, 12 | }) 13 | -------------------------------------------------------------------------------- /profiles/users/common/neovim/plugin/lsp-lines.lua: -------------------------------------------------------------------------------- 1 | require("lsp_lines").setup() 2 | 3 | -- Disable virtual_text since it's redundant due to lsp_lines. 4 | vim.diagnostic.config({ 5 | virtual_text = false, 6 | }) 7 | -------------------------------------------------------------------------------- /profiles/users/common/neovim/plugin/lsp-lua.lua: -------------------------------------------------------------------------------- 1 | require 'lspconfig'.lua_ls.setup { 2 | cmd = { 'lua-language-server' }, 3 | settings = { 4 | Lua = { 5 | diagnostics = { 6 | globals = { 'vim' }, 7 | } 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /profiles/users/common/neovim/plugin/lsp-nix.lua: -------------------------------------------------------------------------------- 1 | require('lspconfig').nil_ls.setup({}) 2 | -------------------------------------------------------------------------------- /profiles/users/common/neovim/plugin/lsp-rust.lua: -------------------------------------------------------------------------------- 1 | -- Configure LSP through rust-tools.nvim plugin. 2 | -- rust-tools will configure and enable certain LSP features for us. 3 | -- See https://github.com/simrat39/rust-tools.nvim#configuration 4 | 5 | require 'rust-tools'.setup { 6 | tools = { 7 | autoSetHints = true, 8 | -- DEPRECATED: hover_with_actions = true, 9 | runnables = { 10 | use_telescope = true, 11 | }, 12 | debuggables = { 13 | use_telescope = true, 14 | }, 15 | inlay_hints = { 16 | show_parameter_hints = true, 17 | parameter_hints_prefix = "", 18 | other_hints_prefix = "", 19 | }, 20 | }, 21 | -- all the opts to send to nvim-lspconfig 22 | -- these override the defaults set by rust-tools.nvim 23 | -- see https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#rust_analyzer 24 | server = { 25 | capabilities = require 'cmp_nvim_lsp'.default_capabilities(), 26 | settings = { 27 | -- to enable rust-analyzer settings visit: 28 | -- https://github.com/rust-analyzer/rust-analyzer/blob/master/docs/user/generated_config.adoc 29 | ["rust-analyzer"] = { 30 | assist = { 31 | importEnforceGranularity = true, 32 | importPrefix = "by_crate", 33 | }, 34 | cargo = { 35 | allFeatures = true, 36 | runBuildScripts = true, 37 | }, 38 | checkOnSave = { 39 | -- default: `cargo check` 40 | command = "clippy" 41 | }, 42 | inlayHints = { 43 | lifetimeElisionHints = { 44 | enable = true, 45 | useParameterNames = true 46 | }, 47 | }, 48 | procMacro = { 49 | enable = true 50 | } 51 | } 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /profiles/users/common/neovim/plugin/lsp-signature.lua: -------------------------------------------------------------------------------- 1 | vim.api.nvim_create_autocmd("LspAttach", { 2 | group = vim.api.nvim_create_augroup("LspAttach_signature", {}), 3 | callback = function(args) 4 | require 'lsp_signature'.on_attach({}, args.buf) 5 | end, 6 | }) 7 | -------------------------------------------------------------------------------- /profiles/users/common/neovim/plugin/lsp-ts.lua: -------------------------------------------------------------------------------- 1 | require 'lspconfig'.tsserver.setup {} 2 | -------------------------------------------------------------------------------- /profiles/users/common/neovim/plugin/neo-tree.lua: -------------------------------------------------------------------------------- 1 | require("neo-tree").setup({ 2 | close_if_last_window = true, -- Close Neo-tree if it is the last window left in the tab 3 | filtered_items = { 4 | hide_dotfiles = false, 5 | }, 6 | }) 7 | 8 | vim.api.nvim_create_autocmd("UiEnter", { 9 | desc = "Open Neotree automatically", 10 | group = vim.api.nvim_create_augroup("neotree", {}), 11 | callback = function() 12 | vim.cmd "Neotree show" 13 | end, 14 | }) 15 | 16 | vim.cmd [[ 17 | highlight NeoTreeGitConflict gui=NONE 18 | highlight NeoTreeGitUntracked gui=NONE 19 | highlight NeoTreeRootName gui=NONE 20 | ]] 21 | -------------------------------------------------------------------------------- /profiles/users/common/neovim/plugin/on-attach.lua: -------------------------------------------------------------------------------- 1 | local opts = { noremap = true, silent = true } 2 | 3 | vim.api.nvim_create_autocmd("LspAttach", { 4 | group = vim.api.nvim_create_augroup("LspAttach", {}), 5 | callback = function(args) 6 | local buffer = args.buf 7 | 8 | vim.api.nvim_set_keymap('n', 'e', 'lua vim.diagnostic.open_float()', opts) 9 | vim.api.nvim_set_keymap('n', '[d', 'lua vim.diagnostic.goto_prev()', opts) 10 | vim.api.nvim_set_keymap('n', ']d', 'lua vim.diagnostic.goto_next()', opts) 11 | vim.api.nvim_set_keymap('n', 'q', 'lua vim.diagnostic.setloclist()', opts) 12 | 13 | vim.api.nvim_buf_set_keymap(buffer, 'n', 'gD', 'lua vim.lsp.buf.declaration()', opts) 14 | vim.api.nvim_buf_set_keymap(buffer, 'n', 'gd', 'lua vim.lsp.buf.definition()', opts) 15 | vim.api.nvim_buf_set_keymap(buffer, 'n', 'K', 'lua vim.lsp.buf.hover()', opts) 16 | vim.api.nvim_buf_set_keymap(buffer, 'n', 'gi', 'lua vim.lsp.buf.implementation()', opts) 17 | vim.api.nvim_buf_set_keymap(buffer, 'n', '', 'lua vim.lsp.buf.signature_help()', opts) 18 | vim.api.nvim_buf_set_keymap(buffer, 'n', 'wa', 'lua vim.lsp.buf.add_workspace_folder()', opts) 19 | vim.api.nvim_buf_set_keymap(buffer, 'n', 'wr', 'lua vim.lsp.buf.remove_workspace_folder()', opts) 20 | vim.api.nvim_buf_set_keymap(buffer, 'n', 'wl', 21 | 'lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))', opts) 22 | vim.api.nvim_buf_set_keymap(buffer, 'n', 'D', 'lua vim.lsp.buf.type_definition()', opts) 23 | vim.api.nvim_buf_set_keymap(buffer, 'n', 'rn', 'lua vim.lsp.buf.rename()', opts) 24 | vim.api.nvim_buf_set_keymap(buffer, 'n', 'ca', 'lua vim.lsp.buf.code_action()', opts) 25 | vim.api.nvim_buf_set_keymap(buffer, 'n', 'gr', 'lua vim.lsp.buf.references()', opts) 26 | end, 27 | }) 28 | 29 | vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, { 30 | border = "single", 31 | }) 32 | -------------------------------------------------------------------------------- /profiles/users/common/neovim/plugin/scrollbar.lua: -------------------------------------------------------------------------------- 1 | require("scrollbar").setup() 2 | 3 | require("hlslens").setup() 4 | require("scrollbar.handlers.search").setup() 5 | -------------------------------------------------------------------------------- /profiles/users/common/neovim/plugin/theme.lua: -------------------------------------------------------------------------------- 1 | require 'lualine'.setup { 2 | options = { 3 | theme = 'base16', 4 | icons_enabled = true, 5 | component_separators = { left = '', right = '' }, 6 | section_separators = { left = '', right = '' }, 7 | disabled_filetypes = {}, 8 | always_divide_middle = true, 9 | } 10 | } 11 | 12 | vim.opt.guifont = { "Iosevka Nerd Font", "Emoji", ":h12" } 13 | 14 | -- Show invisible characters 15 | vim.opt.list = true 16 | vim.opt.listchars = { tab = '› ', trail = '~', extends = '»', precedes = '«', nbsp = '_', } 17 | 18 | local signs = { 19 | { name = 'DiagnosticSignError', text = '🔥' }, 20 | { name = 'DiagnosticSignWarn', text = '⚠️' }, 21 | { name = 'DiagnosticSignHint', text = '💡' }, 22 | { name = 'DiagnosticSignInfo', text = '🔸' }, 23 | } 24 | 25 | for _, sign in ipairs(signs) do 26 | vim.fn.sign_define(sign.name, { texthl = sign.name, text = sign.text, numhl = '' }) 27 | end 28 | 29 | vim.diagnostic.config { 30 | -- show signs 31 | signs = { 32 | active = signs, 33 | }, 34 | update_in_insert = true, 35 | underline = true, 36 | severity_sort = true, 37 | float = { 38 | focusable = false, 39 | style = 'minimal', 40 | border = 'rounded', 41 | source = 'always', 42 | header = '', 43 | prefix = '', 44 | }, 45 | } 46 | 47 | --vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, { 48 | -- border = "rounded", 49 | --}) 50 | -- 51 | --vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, { 52 | -- border = "rounded", 53 | --}) 54 | -------------------------------------------------------------------------------- /profiles/users/common/neovim/plugin/treesitter.lua: -------------------------------------------------------------------------------- 1 | require'nvim-treesitter.configs'.setup{ 2 | highlight = { 3 | enable = true, 4 | additional_vim_regex_highlighting = false, 5 | }, 6 | indent = { 7 | enable = true, 8 | }, 9 | } 10 | -------------------------------------------------------------------------------- /profiles/users/common/neovim/plugin/trivial-setup.lua: -------------------------------------------------------------------------------- 1 | require 'indent_blankline'.setup {} 2 | require 'litee.calltree'.setup {} 3 | require 'litee.filetree'.setup {} 4 | require 'litee.lib'.setup {} 5 | require 'litee.symboltree'.setup {} 6 | require 'neoscroll'.setup {} 7 | require 'nvim-autopairs'.setup {} 8 | require 'which-key'.setup {} 9 | -------------------------------------------------------------------------------- /profiles/users/common/neovim/plugin/trouble.lua: -------------------------------------------------------------------------------- 1 | require 'trouble'.setup {} 2 | 3 | local opts = { noremap = true, silent = true } 4 | 5 | vim.keymap.set('n', 'xx', 'TroubleToggle', opts) 6 | vim.keymap.set('n', 'xw', 'TroubleToggle workspace_diagnostics', opts) 7 | vim.keymap.set('n', 'xd', 'TroubleToggle document_diagnostics', opts) 8 | vim.keymap.set('n', 'xl', 'TroubleToggle loclist', opts) 9 | vim.keymap.set('n', 'xq', 'TroubleToggle quickfix', opts) 10 | vim.keymap.set('n', 'gR', 'TroubleToggle lsp_references', opts) 11 | -------------------------------------------------------------------------------- /profiles/users/common/starship.nix: -------------------------------------------------------------------------------- 1 | { pkgs, lib, ... }: 2 | 3 | { 4 | programs.starship = { 5 | enable = true; 6 | enableZshIntegration = true; 7 | settings = { 8 | format = builtins.concatStringsSep "" [ 9 | "$username" 10 | "$hostname" 11 | "$shlvl" 12 | "$directory" 13 | "$git_branch" 14 | "$git_state" 15 | "$git_status" 16 | "$cmd_duration" 17 | "$line_break" 18 | "$character" 19 | ]; 20 | directory.style = "blue"; 21 | character = { 22 | success_symbol = "[»](purple)"; 23 | error_symbol = "[»](red)"; 24 | vicmd_symbol = "[«](green)"; 25 | }; 26 | git_branch = { 27 | format = "[$branch]($style)"; 28 | style = "bright-black"; 29 | }; 30 | git_status = { 31 | format = "[[(*$conflicted$untracked$modified$staged$renamed$deleted)](218) ($ahead_behind$stashed)]($style)"; 32 | style = "cyan"; 33 | }; 34 | git_state = { 35 | #format = ''\([$state( $progress_current/$progress_total)]($style)\) ''; 36 | style = "bright-black"; 37 | }; 38 | cmd_duration = { 39 | format = "[$duration]($style) "; 40 | style = "yellow"; 41 | }; 42 | }; 43 | }; 44 | } 45 | -------------------------------------------------------------------------------- /profiles/users/common/tmux.nix: -------------------------------------------------------------------------------- 1 | { config, ... }: 2 | 3 | { 4 | programs.tmux = { 5 | enable = true; 6 | extraConfig = with config.colorScheme.colors; '' 7 | # COLOUR (base16) 8 | 9 | # default statusbar colors 10 | set-option -g status-style "fg=#${base04},bg=#${base01}" 11 | 12 | # default window title colors 13 | set-window-option -g window-status-style "fg=#${base04},bg=default" 14 | 15 | # active window title colors 16 | set-window-option -g window-status-current-style "fg=#${base0A},bg=default" 17 | 18 | # pane border 19 | set-option -g pane-border-style "fg=#${base01}" 20 | set-option -g pane-active-border-style "fg=#${base02}" 21 | 22 | # message text 23 | set-option -g message-style "fg=#${base05},bg=#${base01}" 24 | 25 | # pane number display 26 | set-option -g display-panes-active-colour "#${base0B}" 27 | set-option -g display-panes-colour "#${base0A}" 28 | 29 | # clock 30 | set-window-option -g clock-mode-colour "#${base0B}" 31 | 32 | # copy mode highligh 33 | set-window-option -g mode-style "fg=#${base04},bg=#${base02}" 34 | 35 | # bell 36 | set-window-option -g window-status-bell-style "fg=#${base01},bg=#${base08}" 37 | 38 | # scrolling with mouse 39 | set-option -g mouse on 40 | ''; 41 | }; 42 | } 43 | -------------------------------------------------------------------------------- /profiles/users/common/xdg/cabal/config: -------------------------------------------------------------------------------- 1 | jobs: $ncpus 2 | -------------------------------------------------------------------------------- /profiles/users/common/xdg/default.nix: -------------------------------------------------------------------------------- 1 | { config, pkgs, lib, ... }: 2 | 3 | { 4 | xdg.configFile = with builtins; with lib; pipe ./. [ 5 | filesystem.listFilesRecursive 6 | (filter (file: ! hasSuffix ".nix" file)) 7 | (map (file: { 8 | name = removePrefix "${toString ./.}/" (toString file); 9 | value = { source = file; }; 10 | })) 11 | listToAttrs 12 | ]; 13 | } 14 | -------------------------------------------------------------------------------- /profiles/users/common/xdg/libvirt/qemu.conf: -------------------------------------------------------------------------------- 1 | nvram = [ "/run/libvirt/nix-ovmf/OVMF_CODE.fd:/run/libvirt/nix-ovmf/OVMF_VARS.fd" ] 2 | -------------------------------------------------------------------------------- /profiles/users/common/zsh/default.nix: -------------------------------------------------------------------------------- 1 | { pkgs, lib, ... }: 2 | 3 | { 4 | home.packages = with pkgs; [ fzf zsh-completions ]; 5 | 6 | programs.zsh = { 7 | enable = true; 8 | initExtra = '' 9 | source "${pkgs.zsh-syntax-highlighting}/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" 10 | source "${pkgs.zsh-history-substring-search}/share/zsh-history-substring-search/zsh-history-substring-search.zsh" 11 | source "${pkgs.zsh-autosuggestions}/share/zsh-autosuggestions/zsh-autosuggestions.zsh" 12 | source "${pkgs.nix-zsh-completions}/share/zsh/plugins/nix/nix-zsh-completions.plugin.zsh" 13 | source "${pkgs.fzf}/share/fzf/completion.zsh" 14 | source "${pkgs.fzf}/share/fzf/key-bindings.zsh" 15 | source "${pkgs.zsh-fzf-tab}/share/fzf-tab/fzf-tab.plugin.zsh" 16 | source "${pkgs.zsh-fzf-tab}/share/fzf-tab/lib/zsh-ls-colors/ls-colors.zsh" 17 | ${builtins.readFile ./init.sh} 18 | ''; 19 | 20 | shellAliases = { 21 | open = ''open() { xdg-open "$@" & disown }; open''; 22 | exa = "exa --tree --icons"; 23 | gvim = "neovide"; 24 | make = "make -j$(nproc)"; 25 | makevars = "make -pn | grep -A1 '^# makefile' | grep -v '^#\\|^--' | sort | uniq"; 26 | scp = "scp -F $HOME/.ssh/config"; 27 | ssh = "ssh -F $HOME/.ssh/config"; 28 | sshfs = "sshfs -F $HOME/.ssh/config"; 29 | ls = "ls --color=auto"; 30 | }; 31 | }; 32 | } 33 | -------------------------------------------------------------------------------- /profiles/users/common/zsh/init.sh: -------------------------------------------------------------------------------- 1 | fpath+=($HOME/.nix-profile/share/zsh/site-functions) 2 | # Reload the zsh-completions 3 | autoload -U compinit && compinit 4 | 5 | # Pretty colours in less command 6 | export LESS_TERMCAP_mb=$'\E[01;31m' 7 | export LESS_TERMCAP_md=$'\E[01;38;5;74m' 8 | export LESS_TERMCAP_me=$'\E[0m' 9 | export LESS_TERMCAP_se=$'\E[0m' 10 | export LESS_TERMCAP_so=$'\E[38;5;246m' 11 | export LESS_TERMCAP_ue=$'\E[0m' 12 | export LESS_TERMCAP_us=$'\E[04;38;5;146m' 13 | 14 | # Functional Home-/End-/Delete-/Insert-keys 15 | bindkey '\e[1~' beginning-of-line # Linux console 16 | bindkey '\e[H' beginning-of-line # xterm 17 | bindkey '\e[2~' overwrite-mode # Linux console, xterm, gnome-terminal 18 | bindkey '\e[3~' delete-char # Linux console, xterm, gnome-terminal 19 | bindkey '\e[4~' end-of-line # Linux console 20 | bindkey '\e[F' end-of-line # xterm 21 | bindkey "^[[1;5C" forward-word 22 | bindkey "^[[1;5D" backward-word 23 | 24 | bindkey "^[[A" history-substring-search-up 25 | bindkey "^[[B" history-substring-search-down 26 | 27 | # set list-colors to enable filename colorizing 28 | zstyle ':completion:*' list-colors "''${(s.:.)LS_COLORS}" 29 | 30 | # preview directory's content with exa when completing cd 31 | zstyle ':fzf-tab:complete:*:*' fzf-preview 'exa -1 --color=always $realpath' 32 | 33 | # switch group using `,` and `.` 34 | zstyle ':fzf-tab:*' switch-group ',' '.' 35 | 36 | # give a preview of commandline arguments when completing `kill` 37 | zstyle ':completion:*:*:*:*:processes' command "ps -u $USER -o pid,user,comm -w -w" 38 | zstyle ':fzf-tab:complete:(kill|ps):argument-rest' fzf-preview \ 39 | '[[ $group == "[process ID]" ]] && ps --pid=$word -o cmd --no-headers -w -w' 40 | zstyle ':fzf-tab:complete:(kill|ps):argument-rest' fzf-flags --preview-window=down:3:wrap 41 | -------------------------------------------------------------------------------- /profiles/users/dragoncat/default.nix: -------------------------------------------------------------------------------- 1 | { inputs, pkgs, ... }@args: 2 | 3 | { 4 | imports = with inputs; [ 5 | (import self.profiles.users.common (args // { 6 | username = "dragoncat"; 7 | initialHashedPassword = "$6$P8pZJbrdjFXP7Bkf$CSxDmrTTO6o5pWUVXW0hy/c.Zdf7WtzNOPk1KiEDrDtyDf8x6V.ZvSzhh8kJWx0DKpObq4077SH1BRZZ0wgU/0"; 8 | extraGroups = [ 9 | "audio" 10 | "dialout" 11 | "gold" 12 | "libvirtd" 13 | "networkmanager" 14 | "plex" 15 | "qemu-libvirtd" 16 | "transmission" 17 | "users" 18 | "video" 19 | "wheel" 20 | ]; 21 | sshKeys = [ 22 | "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINBlAx5Hi5TsLsy5e+4OdBmM4oHtdUnqX5gtNbfc60rq ners" 23 | "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMxceZEJ4aQXkvHWWDh5TXNk9XdpIZFQKGhQGAZIeLxr rekk" 24 | ]; 25 | })) 26 | ]; 27 | } 28 | -------------------------------------------------------------------------------- /profiles/users/ners/apps.nix: -------------------------------------------------------------------------------- 1 | { pkgs, lib, ... }: 2 | 3 | 4 | # This file is responsible for defining default applications by mimetype. 5 | { 6 | xdg.mimeApps = { 7 | enable = true; 8 | defaultApplications = lib.mimePkgs (with pkgs.unstable; [ 9 | chromium 10 | darktable 11 | discord 12 | drawio 13 | element-desktop 14 | firefox-devedition-bin 15 | foliate 16 | plexamp 17 | signal-desktop 18 | slack 19 | sweethome3d.application 20 | tdesktop 21 | zoom-us 22 | ]); 23 | }; 24 | } 25 | -------------------------------------------------------------------------------- /profiles/users/ners/calibre.nix: -------------------------------------------------------------------------------- 1 | { pkgs, ... }: 2 | 3 | { 4 | home.packages = with pkgs; [ calibre wine ]; 5 | } 6 | -------------------------------------------------------------------------------- /profiles/users/ners/dconf.nix: -------------------------------------------------------------------------------- 1 | { lib, ... }: 2 | 3 | { 4 | dconf.settings = lib.dconfFlatten { 5 | com.github.johnfactotum.Foliate.view = { 6 | autohide-cursor = false; 7 | font = "Serif 16"; 8 | }; 9 | }; 10 | } 11 | -------------------------------------------------------------------------------- /profiles/users/ners/default.nix: -------------------------------------------------------------------------------- 1 | { inputs 2 | , pkgs 3 | , lib 4 | , ... 5 | }@args: 6 | 7 | { 8 | imports = [ 9 | (import inputs.self.profiles.users.common (args // { 10 | username = "ners"; 11 | initialHashedPassword = "$6$P8pZJbrdjFXP7Bkf$CSxDmrTTO6o5pWUVXW0hy/c.Zdf7WtzNOPk1KiEDrDtyDf8x6V.ZvSzhh8kJWx0DKpObq4077SH1BRZZ0wgU/0"; 12 | sshKeys = [ 13 | "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINBlAx5Hi5TsLsy5e+4OdBmM4oHtdUnqX5gtNbfc60rq ners" 14 | ]; 15 | })) 16 | ]; 17 | 18 | home-manager.users.ners = import ./home.nix; 19 | } 20 | -------------------------------------------------------------------------------- /profiles/users/ners/fonts.nix: -------------------------------------------------------------------------------- 1 | { pkgs, lib, ... }: 2 | 3 | let 4 | mkFont = 5 | { name 6 | , url 7 | , hash 8 | , sourceRoot ? "." 9 | }: pkgs.stdenv.mkDerivation rec { 10 | inherit name; 11 | nativeBuildInputs = [ pkgs.unzip ]; 12 | src = pkgs.fetchurl { 13 | inherit url hash; 14 | name = "${name}.zip"; 15 | }; 16 | setSourceRoot = "sourceRoot=`pwd`"; 17 | installPhase = '' 18 | find ${sourceRoot} -type f -name '*.ttf' | while read f; do 19 | d="$out/share/fonts/truetype/${name}/$(basename "$f")" 20 | echo "installing $f to $d" 21 | install -Dm644 -D "$f" "$d" 22 | done 23 | find ${sourceRoot} -type f -name '*.otf' | while read f; do 24 | d="$out/share/fonts/opentype/${name}/$(basename "$f")" 25 | echo "installing $f to $d" 26 | install -Dm644 -D "$f" "$d" 27 | done 28 | ''; 29 | }; 30 | nerdify = { font, file ? "", mono ? false }: 31 | pkgs.stdenvNoCC.mkDerivation rec { 32 | name = "${font.name}-nerd"; 33 | src = pkgs.fetchFromGitHub { 34 | owner = "ryanoasis"; 35 | repo = "nerd-fonts"; 36 | rev = "v2.3.3"; 37 | hash = "sha256-42gG0jV7TunD/MoTxSSkXniLW5/X1pHwQwzK05TCMBE="; 38 | }; 39 | buildInputs = with pkgs; [ 40 | argparse 41 | fontforge 42 | (python3.withPackages (ps: with ps; [ setuptools fontforge ])) 43 | ]; 44 | buildPhase = '' 45 | find ${font}/${file} -type f -name '*.ttf' -or -name '*.otf' | while read f; do 46 | echo "nerdifying $f" 47 | python3 "$src/font-patcher" --complete ${if mono then "--mono" else ""} "$f" 48 | done 49 | ''; 50 | installPhase = '' 51 | for f in *.ttf; do 52 | d="$out/share/fonts/truetype/${name}/$f" 53 | echo "installing $f to $d" 54 | install -Dm644 -D "$f" "$d" 55 | done 56 | for f in *.otf; do 57 | d="$out/share/fonts/opentype/${name}/$f" 58 | echo "installing $f to $d" 59 | install -Dm644 -D "$f" "$d" 60 | done 61 | ''; 62 | }; 63 | oswald = mkFont { 64 | name = "oswald"; 65 | url = "https://github.com/googlefonts/OswaldFont/archive/refs/heads/main.zip"; 66 | hash = "sha256-zd7eW7+ni6swa3qhh3R4ADPapxH+9sLAJOKnyviSZEM="; 67 | sourceRoot = "OswaldFont-main/fonts"; 68 | }; 69 | radley = mkFont { 70 | name = "radley"; 71 | url = "https://github.com/googlefonts/RadleyFont/archive/refs/heads/main.zip"; 72 | hash = "sha256-HLxKHfpwPU9WH0ir/Hm3eURZTBB9nn/MfDSwvqYwRDY="; 73 | sourceRoot = "RadleyFont-main/fonts"; 74 | }; 75 | gula = mkFont { 76 | name = "gula"; 77 | url = "https://www.fontriver.com/f/gula.zip"; 78 | hash = "sha256-kMop+cS9gKawaiyHmsD12WGPQkOJysUCQWYwtIlNE14="; 79 | }; 80 | bluetea = mkFont { 81 | name = "bluetea"; 82 | url = "https://www.fontriver.com/f/bluetea.zip"; 83 | hash = "sha256-jl5JKfJrUyYxGLEgyQccd2xB0wSVy15aMGZVXkwMClc="; 84 | }; 85 | playfair = mkFont { 86 | name = "playfair"; 87 | url = "https://github.com/clauseggers/Playfair/archive/refs/heads/master.zip"; 88 | hash = "sha256-9jSTYo76g/15gYQhPWJRWHDlZ3Abp/WjESEPFYileMA="; 89 | sourceRoot = "Playfair-master/fonts/VF-TTF"; 90 | }; 91 | along-sans = mkFont { 92 | name = "along-sans"; 93 | url = "https://dl.dafont.com/dl/?f=along_sans"; 94 | hash = "sha256-3rixZaoWlQaNBIjDUEdGMkrx8Z1rln7ueno60hA1mYw="; 95 | }; 96 | new-heterodox-mono = mkFont { 97 | name = "new-heterodox-mono"; 98 | url = "https://github.com/hckiang/font-new-heterodox-mono/archive/refs/heads/master.zip"; 99 | hash = "sha256-oXEGF77bEBkmsz0tzMvTk+V9RHw1hVhL9zHqh8BPdhE="; 100 | }; 101 | iosevka-term = pkgs.iosevka.override { 102 | set = "term"; 103 | privateBuildPlan = { 104 | family = "Iosevka Term"; 105 | design = [ 106 | "term" 107 | "v-l-italic" 108 | "v-i-italic" 109 | "v-g-singlestorey" 110 | ]; 111 | }; 112 | }; 113 | in 114 | { 115 | fonts.fontconfig.enable = lib.mkForce true; 116 | home.packages = with pkgs; [ 117 | (nerdify { font = inter; file = "share/fonts/opentype/Inter-Regular.otf"; }) 118 | (nerdify { font = iosevka-term; file = "share/fonts/truetype/iosevka-term-extendedlight.ttf"; mono = true; }) 119 | (nerdify { font = new-heterodox-mono; file = "share/fonts/opentype/new-heterodox-mono/NewHeterodoxMono-Book.otf"; mono = true; }) 120 | agave 121 | along-sans 122 | bluetea 123 | charis-sil 124 | crimson 125 | eb-garamond 126 | gula 127 | hasklig 128 | material-design-icons 129 | monoid 130 | new-heterodox-mono 131 | oswald 132 | paratype-pt-mono 133 | paratype-pt-sans 134 | paratype-pt-serif 135 | playfair 136 | radley 137 | ]; 138 | } 139 | -------------------------------------------------------------------------------- /profiles/users/ners/home.nix: -------------------------------------------------------------------------------- 1 | { pkgs, ... }: 2 | 3 | { 4 | imports = [ 5 | ./calibre.nix 6 | ./fonts.nix 7 | ./sway 8 | ./vscode.nix 9 | ]; 10 | 11 | home.packages = (with pkgs; [ 12 | libreoffice-fresh 13 | libguestfs-with-appliance 14 | ]) ++ (with pkgs.unstable; [ 15 | discord 16 | element-desktop 17 | ffmpeg 18 | foliate 19 | gimp 20 | gitg 21 | inkscape 22 | plexamp 23 | prusa-slicer 24 | signal-desktop 25 | slack 26 | sweethome3d.application 27 | tdesktop 28 | tmate 29 | transmission-remote-gtk 30 | v4l-utils 31 | winbox 32 | zoom-us 33 | ]); 34 | 35 | programs.git = { 36 | package = pkgs.gitAndTools.gitFull; 37 | userName = "ners"; 38 | userEmail = "ners@gmx.ch"; 39 | }; 40 | 41 | home.sessionVariables = { 42 | BROWSER = "firefox"; 43 | CABAL_CONFIG = "$HOME/.config/cabal/config"; 44 | EDITOR = "nvim"; 45 | FZF_ALT_C_COMMAND = "fd -t d . /home"; 46 | FZF_CTRL_T_COMMAND = "fd . /home"; 47 | FZF_DEFAULT_COMMAND = "fd . /home"; 48 | GIT_SSH_COMMAND = "ssh -F \\$HOME/.ssh/config"; 49 | MOZ_ENABLE_WAYLAND = "1"; 50 | NIXOS_OZONE_WL = "1"; 51 | QT_QPA_PLATFORM = "wayland"; 52 | QT_WAYLAND_DISABLE_WINDOWDECORATION = "1"; 53 | SDL_VIDEODRIVER = "wayland"; 54 | VISUAL = "neovide"; 55 | _JAVA_AWT_WM_NONREPARENTING = "1"; 56 | }; 57 | 58 | services.udiskie.enable = true; 59 | 60 | home.file.".face".source = ./images/ners.jpg; 61 | home.file.".background".source = ./images/nix-wallpaper-nineish-dark-gray.png; 62 | dconf.settings = { 63 | "org/gnome/desktop/background" = { picture-uri = ".background"; }; 64 | "org/gnome/desktop/screensaver" = { picture-uri = ".background"; }; 65 | }; 66 | } 67 | -------------------------------------------------------------------------------- /profiles/users/ners/images/ners.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ners/NixOS/e6338c857de433cd9f474b3bc77df62deea4dfdb/profiles/users/ners/images/ners.jpg -------------------------------------------------------------------------------- /profiles/users/ners/images/nix-wallpaper-nineish-dark-gray.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ners/NixOS/e6338c857de433cd9f474b3bc77df62deea4dfdb/profiles/users/ners/images/nix-wallpaper-nineish-dark-gray.png -------------------------------------------------------------------------------- /profiles/users/ners/images/nix-wallpaper-nineish.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ners/NixOS/e6338c857de433cd9f474b3bc77df62deea4dfdb/profiles/users/ners/images/nix-wallpaper-nineish.png -------------------------------------------------------------------------------- /profiles/users/ners/sway/albert.nix: -------------------------------------------------------------------------------- 1 | { config, pkgs, lib, ... }: 2 | 3 | let 4 | modifier = config.wayland.windowManager.sway.config.modifier; 5 | session = "sway-session.target"; 6 | in 7 | { 8 | systemd.user.services.albert = { 9 | Service = { 10 | Restart = "on-failure"; 11 | ExecStart = "${pkgs.albert}/bin/albert"; 12 | }; 13 | Install.WantedBy = [ session ]; 14 | Unit = { 15 | PartOf = session; 16 | Requires = session; 17 | After = session; 18 | }; 19 | }; 20 | 21 | home.packages = with pkgs; [ 22 | albert 23 | (imagemagick.overrideAttrs (_: { buildInputs = [ pango ]; })) 24 | ]; 25 | 26 | wayland.windowManager.sway.config = { 27 | keybindings = { 28 | "${modifier}+space" = "exec albert show"; 29 | }; 30 | }; 31 | 32 | xdg.configFile."albert/albert.conf".text = lib.generators.toINI { } { 33 | General = { 34 | showTray = true; 35 | terminal = "foot"; 36 | }; 37 | "org.albert.extension.applications" = { 38 | enabled = true; 39 | fuzzy = false; 40 | use_generic_name = true; 41 | use_keywords = true; 42 | }; 43 | "org.albert.extension.python" = { 44 | enabled = true; 45 | enabled_modules = 46 | "datetime, google_translate, pomodoro, vpn, wikipedia, youtube, unicode_emoji"; 47 | }; 48 | "org.albert.frontend.widgetboxmodel" = { 49 | alwaysOnTop = true; 50 | clearOnHide = false; 51 | displayIcons = true; 52 | displayScrollbar = false; 53 | displayShadow = true; 54 | hideOnClose = false; 55 | hideOnFocusLoss = true; 56 | itemCount = 5; 57 | showCentered = true; 58 | theme = "Numix Rounded"; 59 | }; 60 | "org.albert.extension.calculator".enabled = true; 61 | "org.albert.extension.ssh".enabled = true; 62 | }; 63 | 64 | } 65 | -------------------------------------------------------------------------------- /profiles/users/ners/sway/applets.nix: -------------------------------------------------------------------------------- 1 | { pkgs, ... }: 2 | 3 | let 4 | session = "sway-session.target"; 5 | in 6 | { 7 | # For some reason, nm-applet doesn't show the right icon if it's not installed globally. 8 | home.packages = with pkgs; [ 9 | networkmanagerapplet 10 | ]; 11 | 12 | systemd.user.services.blueman-applet = { 13 | Service = { 14 | Restart = "always"; 15 | ExecStart = "${pkgs.blueman}/bin/blueman-applet"; 16 | }; 17 | Install.WantedBy = [ session ]; 18 | Unit = { 19 | PartOf = session; 20 | Requires = session; 21 | After = session; 22 | }; 23 | }; 24 | 25 | systemd.user.services.nm-applet = { 26 | Service = { 27 | Restart = "always"; 28 | ExecStart = "${pkgs.networkmanagerapplet}/bin/nm-applet --indicator"; 29 | }; 30 | Install.WantedBy = [ session ]; 31 | Unit = { 32 | PartOf = session; 33 | Requires = session; 34 | After = session; 35 | }; 36 | }; 37 | } 38 | -------------------------------------------------------------------------------- /profiles/users/ners/sway/cgroups.nix: -------------------------------------------------------------------------------- 1 | { pkgs, ... }: 2 | 3 | let 4 | session = "sway-session.target"; 5 | in 6 | { 7 | systemd.user.services.assign-cgroups = { 8 | Service = { 9 | Restart = "always"; 10 | ExecStart = "${pkgs.unstable.assign-cgroups}/bin/assign-cgroups"; 11 | }; 12 | Install.WantedBy = [ session ]; 13 | Unit = { 14 | PartOf = session; 15 | Requires = session; 16 | After = session; 17 | }; 18 | }; 19 | } 20 | -------------------------------------------------------------------------------- /profiles/users/ners/sway/default.nix: -------------------------------------------------------------------------------- 1 | { config, pkgs, lib, ... }: 2 | 3 | { 4 | imports = [ 5 | #./albert.nix 6 | ./applets.nix 7 | ./cgroups.nix 8 | ./foot.nix 9 | ./gnome.nix 10 | ./grim.nix 11 | ./kanshi.nix 12 | ./mako.nix 13 | ./rofi.nix 14 | ./swayidle.nix 15 | ./waybar 16 | ./wlr.nix 17 | ./xf86.nix 18 | ]; 19 | 20 | home.packages = with pkgs.unstable; [ 21 | pavucontrol 22 | vanilla-dmz 23 | wdisplays 24 | wl-clipboard 25 | ]; 26 | 27 | services.wlsunset = { 28 | enable = true; 29 | latitude = "47.3769"; 30 | longitude = "8.5417"; 31 | }; 32 | services.redshift = { 33 | enable = true; 34 | provider = "geoclue2"; 35 | }; 36 | services.gnome-keyring.enable = true; 37 | 38 | wayland.windowManager.sway = { 39 | enable = true; 40 | systemdIntegration = true; 41 | wrapperFeatures.gtk = true; 42 | config = rec { 43 | fonts = { 44 | names = [ "Inter Nerd Font" ]; 45 | size = 10.0; 46 | }; 47 | modifier = "Mod4"; 48 | input = { 49 | "type:keyboard" = { 50 | xkb_layout = "us"; 51 | xkb_variant = "dvorak"; 52 | repeat_rate = "50"; 53 | repeat_delay = "150"; 54 | xkb_options = "caps:escape,compose:ralt"; 55 | }; 56 | "type:mouse" = { 57 | accel_profile = "flat"; 58 | pointer_accel = "1"; 59 | }; 60 | "type:touchpad" = { 61 | tap = "enabled"; 62 | pointer_accel = "0.75"; 63 | }; 64 | }; 65 | output = { "*" = { bg = "~/.background fill"; }; }; 66 | gaps = { 67 | smartGaps = true; 68 | outer = 0; 69 | inner = 10; 70 | bottom = 0; 71 | }; 72 | window = { 73 | border = 1; 74 | hideEdgeBorders = "smart"; 75 | }; 76 | startup = [ 77 | { 78 | command = "blueman-applet"; 79 | always = true; 80 | } 81 | { 82 | command = "nm-applet --indicator"; 83 | always = true; 84 | } 85 | ]; 86 | keybindings = { 87 | "${modifier}+Shift+r" = "reload"; 88 | "${modifier}+Shift+apostrophe" = "kill"; 89 | "${modifier}+l" = "exec screenlock"; 90 | "${modifier}+Shift+f" = "fullscreen"; 91 | "${modifier}+s" = "layout stacking"; 92 | "${modifier}+w" = "layout tabbed"; 93 | "${modifier}+e" = "layout toggle split"; 94 | "${modifier}+Shift+space" = "floating toggle"; 95 | "${modifier}+Shift+Escape" = 96 | "exec swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -b 'Yes, exit sway' 'swaymsg exit'"; 97 | "${modifier}+1" = "workspace number 1"; 98 | "${modifier}+2" = "workspace number 2"; 99 | "${modifier}+3" = "workspace number 3"; 100 | "${modifier}+4" = "workspace number 4"; 101 | "${modifier}+5" = "workspace number 5"; 102 | "${modifier}+6" = "workspace number 6"; 103 | "${modifier}+7" = "workspace number 7"; 104 | "${modifier}+8" = "workspace number 8"; 105 | "${modifier}+9" = "workspace number 9"; 106 | "${modifier}+0" = "workspace number 10"; 107 | "${modifier}+Shift+1" = "move container to workspace number 1"; 108 | "${modifier}+Shift+2" = "move container to workspace number 2"; 109 | "${modifier}+Shift+3" = "move container to workspace number 3"; 110 | "${modifier}+Shift+4" = "move container to workspace number 4"; 111 | "${modifier}+Shift+5" = "move container to workspace number 5"; 112 | "${modifier}+Shift+6" = "move container to workspace number 6"; 113 | "${modifier}+Shift+7" = "move container to workspace number 7"; 114 | "${modifier}+Shift+8" = "move container to workspace number 8"; 115 | "${modifier}+Shift+9" = "move container to workspace number 9"; 116 | "${modifier}+Shift+0" = "move container to workspace number 10"; 117 | "${modifier}+Left" = "focus left"; 118 | "${modifier}+Down" = "focus down"; 119 | "${modifier}+Up" = "focus up"; 120 | "${modifier}+Right" = "focus right"; 121 | "${modifier}+Shift+Left" = "move left"; 122 | "${modifier}+Shift+Down" = "move down"; 123 | "${modifier}+Shift+Up" = "move up"; 124 | "${modifier}+Shift+Right" = "move right"; 125 | "${modifier}+h" = "splith"; 126 | "${modifier}+v" = "splitv"; 127 | "${modifier}+r" = "mode resize"; 128 | }; 129 | }; 130 | }; 131 | } 132 | -------------------------------------------------------------------------------- /profiles/users/ners/sway/foot.nix: -------------------------------------------------------------------------------- 1 | { config, ... }: 2 | 3 | let modifier = config.wayland.windowManager.sway.config.modifier; 4 | in 5 | { 6 | wayland.windowManager.sway.config.keybindings = { 7 | "${modifier}+Return" = "exec foot"; 8 | }; 9 | 10 | programs.foot = { 11 | enable = true; 12 | settings = { 13 | main = { 14 | term = "xterm-256color"; 15 | font = "Iosevka Nerd Font:size=11"; 16 | dpi-aware = "auto"; 17 | pad = "10x5 center"; 18 | }; 19 | mouse = { hide-when-typing = "yes"; }; 20 | colors = with config.colorScheme.colors; { 21 | alpha = 0.85; 22 | background = base00; 23 | foreground = base05; 24 | regular0 = base00; # black 25 | regular1 = base08; # red 26 | regular2 = base0B; # green 27 | regular3 = base0A; # yellow 28 | regular4 = base0D; # blue 29 | regular5 = base0E; # magenta 30 | regular6 = base0C; # cyan 31 | regular7 = base05; # white 32 | bright0 = base03; # bright black 33 | bright1 = base08; # bright red 34 | bright2 = base0B; # bright green 35 | bright3 = base0A; # bright yellow 36 | bright4 = base0D; # bright blue 37 | bright5 = base0E; # bright magenta 38 | bright6 = base0C; # bright cyan 39 | bright7 = base07; # bright white 40 | }; 41 | }; 42 | }; 43 | } 44 | -------------------------------------------------------------------------------- /profiles/users/ners/sway/gnome.nix: -------------------------------------------------------------------------------- 1 | { pkgs, ... }: 2 | 3 | let 4 | session = "sway-session.target"; 5 | in 6 | { 7 | wayland.windowManager.sway.config.startup = [ 8 | { 9 | command = 10 | "export $(${pkgs.gnome.gnome-keyring}/bin/gnome-keyring-daemon --start --components=pkcs11,secrets,ssh)"; 11 | always = true; 12 | } 13 | ]; 14 | 15 | systemd.user.services.polkit = { 16 | Service = { 17 | Restart = "always"; 18 | ExecStart = "${pkgs.polkit_gnome}/libexec/polkit-gnome-authentication-agent-1"; 19 | }; 20 | Install.WantedBy = [ session ]; 21 | Unit = { 22 | PartOf = session; 23 | Requires = session; 24 | After = session; 25 | }; 26 | }; 27 | } 28 | -------------------------------------------------------------------------------- /profiles/users/ners/sway/grim.nix: -------------------------------------------------------------------------------- 1 | { config, pkgs, ... }: 2 | 3 | let modifier = config.wayland.windowManager.sway.config.modifier; 4 | in 5 | { 6 | home.packages = with pkgs; [ 7 | grim 8 | sway-contrib.grimshot 9 | ]; 10 | 11 | wayland.windowManager.sway.config.keybindings = { 12 | "Control+Print" = "exec grimshot save area"; 13 | "Control+Shift+Print" = "exec grimshot copy area"; 14 | "Alt+Print" = "exec grimshot save window"; 15 | "Alt+Shift+Print" = "exec grimshot copy window"; 16 | }; 17 | } 18 | -------------------------------------------------------------------------------- /profiles/users/ners/sway/kanshi.nix: -------------------------------------------------------------------------------- 1 | { pkgs, ... }: 2 | 3 | let 4 | swaymsg = command: ''${pkgs.sway}/bin/swaymsg "${command}"''; 5 | in 6 | { 7 | #systemd.user.services.kanshi.Install.After = [ "graphical-session.target" ]; 8 | 9 | services.kanshi = { 10 | enable = true; 11 | profiles = { 12 | godot_standalone = { 13 | outputs = [ 14 | { 15 | criteria = "eDP-1"; 16 | mode = "3840x2400"; 17 | position = "0,0"; 18 | } 19 | ]; 20 | exec = [ 21 | (swaymsg "workspace 1, move workspace to eDP-1") 22 | ]; 23 | }; 24 | normandy_home = 25 | let 26 | left = "Dell Inc. DELL UP3017 Y7NWN6BU103L"; 27 | right = "Dell Inc. DELL UP3017 Y7NWN6BU117L"; 28 | in 29 | { 30 | outputs = [ 31 | { 32 | criteria = left; 33 | mode = "2560x1600"; 34 | position = "0,0"; 35 | } 36 | { 37 | criteria = right; 38 | mode = "2560x1600"; 39 | position = "2560,0"; 40 | } 41 | ]; 42 | exec = [ 43 | (swaymsg "workspace 1, move workspace to '${left}'") 44 | (swaymsg "workspace 2, move workspace to '${right}'") 45 | ]; 46 | }; 47 | }; 48 | }; 49 | } 50 | 51 | 52 | -------------------------------------------------------------------------------- /profiles/users/ners/sway/mako.nix: -------------------------------------------------------------------------------- 1 | { config, pkgs, ... }: 2 | 3 | let 4 | session = "sway-session.target"; 5 | in 6 | { 7 | systemd.user.services.mako = { 8 | Service = { 9 | Restart = "always"; 10 | ExecStart = "${pkgs.mako}/bin/mako"; 11 | }; 12 | Install.WantedBy = [ session ]; 13 | Unit = { 14 | PartOf = session; 15 | Requires = session; 16 | After = session; 17 | }; 18 | }; 19 | 20 | services.mako = with config.colorScheme.colors; { 21 | enable = true; 22 | defaultTimeout = 3000; 23 | font = "Inter Nerd Font 11"; 24 | 25 | backgroundColor = "#${base00}"; 26 | textColor = "#${base05}"; 27 | borderColor = "#${base0D}"; 28 | 29 | extraConfig = '' 30 | [urgency=low] 31 | background-color=#${base00} 32 | text-color=#${base0A} 33 | border-color=#${base0D} 34 | 35 | [urgency=high] 36 | background-color=#${base00} 37 | text-color=#${base08} 38 | border-color=#${base0D} 39 | ''; 40 | }; 41 | } 42 | -------------------------------------------------------------------------------- /profiles/users/ners/sway/rofi.nix: -------------------------------------------------------------------------------- 1 | { config, pkgs, lib, ... }: 2 | 3 | let modifier = config.wayland.windowManager.sway.config.modifier; 4 | in 5 | { 6 | programs.rofi = { 7 | enable = true; 8 | package = with pkgs.unstable; rofi-wayland.override { 9 | plugins = [ rofi-calc rofi-emoji ]; 10 | }; 11 | extraConfig = { 12 | modi = "drun,run,calc,emoji"; 13 | }; 14 | theme = 15 | with config.lib.formats.rasi; 16 | with config.colorScheme.colors; 17 | { 18 | "*" = { 19 | border = mkLiteral "0"; 20 | margin = mkLiteral "0"; 21 | padding = mkLiteral "0"; 22 | spacing = mkLiteral "0"; 23 | 24 | bg = mkLiteral "#151515"; 25 | bg-alt = mkLiteral "#232323"; 26 | fg = mkLiteral "#FFFFFF"; 27 | fg-alt = mkLiteral "#424242"; 28 | 29 | background-color = mkLiteral "@bg"; 30 | text-color = mkLiteral "@fg"; 31 | }; 32 | 33 | window = { 34 | transparency = "real"; 35 | }; 36 | 37 | mainbox = { 38 | children = mkLiteral "[inputbar, listview]"; 39 | }; 40 | 41 | inputbar = { 42 | background-color = mkLiteral "@bg-alt"; 43 | children = mkLiteral "[prompt, entry]"; 44 | }; 45 | 46 | entry = { 47 | background-color = mkLiteral "inherit"; 48 | padding = mkLiteral "12px 3px"; 49 | }; 50 | 51 | prompt = { 52 | background-color = mkLiteral "inherit"; 53 | padding = mkLiteral "12px"; 54 | }; 55 | 56 | listview = { 57 | lines = mkLiteral "8"; 58 | }; 59 | 60 | element = { 61 | children = mkLiteral "[element-icon, element-text]"; 62 | }; 63 | 64 | element-icon = { 65 | padding = mkLiteral "10px 10px"; 66 | }; 67 | 68 | element-text = { 69 | padding = mkLiteral "10px 0"; 70 | text-color = mkLiteral "@fg-alt"; 71 | }; 72 | 73 | "element-text selected" = { 74 | text-color = mkLiteral "@fg"; 75 | }; 76 | }; 77 | }; 78 | 79 | wayland.windowManager.sway.config = { 80 | keybindings = { 81 | "${modifier}+space" = "exec rofi -show drun"; 82 | }; 83 | }; 84 | } 85 | -------------------------------------------------------------------------------- /profiles/users/ners/sway/swayidle.nix: -------------------------------------------------------------------------------- 1 | { pkgs, ... }: 2 | 3 | let 4 | session = "sway-session.target"; 5 | in 6 | { 7 | home.packages = with pkgs; [ 8 | screenlock 9 | swayidle 10 | swaylock 11 | ]; 12 | 13 | systemd.user.services.swayidle = { 14 | Service = { 15 | Restart = "always"; 16 | ExecStart = '' 17 | ${pkgs.swayidle}/bin/swayidle -w \ 18 | timeout 300 ${pkgs.screenlock}/bin/screenlock \ 19 | timeout 1800 'systemctl suspend' 20 | ''; 21 | }; 22 | Install.WantedBy = [ session ]; 23 | Unit = { 24 | PartOf = session; 25 | Requires = session; 26 | After = session; 27 | }; 28 | }; 29 | } 30 | -------------------------------------------------------------------------------- /profiles/users/ners/sway/waybar/default.nix: -------------------------------------------------------------------------------- 1 | { config, ... }: 2 | 3 | { 4 | wayland.windowManager.sway.config.bars = [ 5 | { command = "waybar"; } 6 | ]; 7 | 8 | programs.waybar = { 9 | enable = true; 10 | systemd.enable = false; 11 | style = with config.colorScheme.colors; '' 12 | ${builtins.readFile ./waybar.css} 13 | window#waybar { color: #${base05}; } 14 | #workspaces button { color: #${base05}; } 15 | ''; 16 | settings = [{ 17 | layer = "top"; 18 | position = "bottom"; 19 | height = 30; 20 | modules-left = [ 21 | "sway/workspaces" 22 | "sway/mode" 23 | #"wlr/taskbar" 24 | ]; 25 | modules-right = [ "network" "pulseaudio" "cpu" "battery" "tray" "clock" ]; 26 | battery = rec { 27 | interval = 1; 28 | states = { 29 | warning = 30; 30 | critical = 15; 31 | }; 32 | format = "{icon}"; 33 | format-plugged = "" + format; 34 | format-charging = format-plugged; 35 | format-icons = [ "" "" "" "" "" "" "" "" "" "" ]; 36 | }; 37 | 38 | clock = { 39 | interval = 1; 40 | format = "{:%a %e %b %y %H:%M} "; 41 | tooltip = false; 42 | }; 43 | 44 | cpu = { 45 | interval = 5; 46 | format = " {load}"; # Icon: microchip; 47 | states = { 48 | warning = 70; 49 | critical = 90; 50 | }; 51 | }; 52 | 53 | network = { 54 | interval = 5; 55 | format-wifi = "直 {essid} "; # Icon: wifi; 56 | format-ethernet = " {ifname}: {ipaddr}/{cidr}"; # Icon: ethernet; 57 | format-disconnected = "睊 Disconnected"; 58 | tooltip-format = "{ifname}: {ipaddr}/{cidr} {signalStrength}%"; 59 | }; 60 | 61 | "sway/mode" = { 62 | format = 63 | '' {}''; # Icon: expand-arrows-alt; 64 | tooltip = false; 65 | }; 66 | 67 | "sway/workspaces" = { 68 | all-outputs = false; 69 | disable-scroll = false; 70 | enable-bar-scroll = true; 71 | disable-scroll-wraparonud = true; 72 | smooth-scrolling-threshold = 1; 73 | format = "{name}"; 74 | format-icons = { 75 | urgent = ""; 76 | focused = ""; 77 | default = ""; 78 | }; 79 | }; 80 | 81 | pulseaudio = { 82 | #scroll-step = 1; 83 | format = "{icon} {volume}%"; 84 | format-bluetooth = " {icon} {volume}% "; 85 | format-muted = "ﱝ"; 86 | format-icons = rec { 87 | headphones = ""; 88 | handsfree = headphones; 89 | headset = headphones; 90 | phone = ""; 91 | portable = ""; 92 | car = ""; 93 | default = [ "奄" "奔" "墳" ]; 94 | }; 95 | on-click = "pavucontrol"; 96 | }; 97 | 98 | tray = { 99 | icon-size = 21; 100 | spacing = 10; 101 | }; 102 | }]; 103 | }; 104 | } 105 | -------------------------------------------------------------------------------- /profiles/users/ners/sway/waybar/waybar.css: -------------------------------------------------------------------------------- 1 | * { 2 | border: none; 3 | border-radius: 0; 4 | font-family: Inter Nerd Font; 5 | font-size: 14px; 6 | min-height: 0; 7 | } 8 | 9 | window#waybar { 10 | background: transparent; 11 | } 12 | 13 | #window { 14 | font-weight: bold; 15 | } 16 | 17 | #workspaces button { 18 | padding: 0 5px; 19 | background: transparent; 20 | font-weight: 400; 21 | } 22 | 23 | #workspaces button.focused { 24 | color: #c9545d; 25 | font-weight: 500; 26 | } 27 | 28 | #workspaces button.urgent { 29 | color: #c9c900; 30 | font-weight: 500; 31 | } 32 | 33 | #mode { 34 | background: #64727D; 35 | } 36 | 37 | #clock, #battery, #cpu, #memory, #network, #pulseaudio, #custom-spotify, #tray, #mode { 38 | padding: 0 8px; 39 | margin: 0 2px; 40 | } 41 | 42 | #clock { 43 | font-weight: 500; 44 | } 45 | 46 | #battery { 47 | } 48 | 49 | #battery icon { 50 | color: red; 51 | } 52 | 53 | #battery.charging { 54 | } 55 | 56 | @keyframes blink { 57 | to { 58 | background-color: white; 59 | color: black; 60 | } 61 | } 62 | 63 | #battery.warning:not(.charging) { 64 | color: white; 65 | animation-name: blink; 66 | animation-duration: 0.5s; 67 | animation-timing-function: linear; 68 | animation-iteration-count: infinite; 69 | animation-direction: alternate; 70 | } 71 | 72 | #cpu { 73 | } 74 | 75 | #memory { 76 | } 77 | 78 | #network { 79 | } 80 | 81 | #network.disconnected { 82 | background: #f53c3c; 83 | } 84 | 85 | #pulseaudio { 86 | } 87 | 88 | #pulseaudio.muted { 89 | } 90 | 91 | #custom-spotify { 92 | color: rgb(102, 220, 105); 93 | } 94 | 95 | #tray { 96 | } 97 | 98 | -------------------------------------------------------------------------------- /profiles/users/ners/sway/wlr.nix: -------------------------------------------------------------------------------- 1 | { pkgs, lib, ... }: 2 | 3 | { 4 | home.packages = with pkgs; [ 5 | slurp 6 | ]; 7 | 8 | xdg.configFile."xdg-desktop-portal-wlr/config".text = 9 | lib.generators.toINI { } { 10 | screencast = { 11 | output_name = ""; 12 | max_fps = "30"; 13 | chooser_cmd = "slurp -f %o -or"; 14 | chooser_type = "simple"; 15 | }; 16 | }; 17 | } 18 | -------------------------------------------------------------------------------- /profiles/users/ners/sway/xf86.nix: -------------------------------------------------------------------------------- 1 | { config, pkgs, ... }: 2 | 3 | let modifier = config.wayland.windowManager.sway.config.modifier; 4 | in 5 | { 6 | home.packages = with pkgs; [ 7 | brightnessctl 8 | pamixer 9 | playerctl 10 | ]; 11 | 12 | wayland.windowManager.sway.config.keybindings = { 13 | "XF86AudioRaiseVolume" = "exec pamixer --increase 5"; 14 | "XF86AudioLowerVolume" = "exec pamixer --decrease 5"; 15 | "XF86AudioMute" = "exec pamixer --toggle-mute"; 16 | "XF86AudioMicMute" = "exec pamixer --default-source --toggle-mute"; 17 | "XF86MonBrightnessUp" = "exec brightnessctl s +10%"; 18 | "XF86MonBrightnessDown" = "exec brightnessctl s 10%-"; 19 | "XF86AudioPlay" = "exec playerctl play-pause"; 20 | "XF86AudioNext" = "exec playerctl next"; 21 | "XF86AudioPrev" = "exec playerctl previous"; 22 | }; 23 | } 24 | -------------------------------------------------------------------------------- /profiles/users/ners/sway/yambar.nix: -------------------------------------------------------------------------------- 1 | { pkgs, lib, ... }: 2 | 3 | let 4 | toYAML = args: pkgs.stdenv.mkDerivation { 5 | name = "toYAML"; 6 | buildInputs = [ pkgs.haskellPackages.json2yaml ]; 7 | src = pkgs.writeText "out.yaml" (builtins.toJSON args); 8 | buildCommand = '' 9 | json2yaml $src > $out 10 | ''; 11 | }; 12 | in 13 | { 14 | home.packages = [ pkgs.yambar ]; 15 | 16 | wayland.windowManager.sway.config.bars = [ 17 | { command = "yambar"; } 18 | ]; 19 | 20 | #xdg.configFile."yambar/config.yml".text = (toYAML { 21 | # bar = { 22 | # height = 30; 23 | # location = "bottom"; 24 | # background = "000000ff"; 25 | # }; 26 | #}).out; 27 | xdg.configFile."yambar/config.yml".text = '' 28 | bar: 29 | height: 26 30 | location: top 31 | background: 000000ff 32 | 33 | right: 34 | - clock: 35 | content: 36 | - string: {text: , font: "Font Awesome 5 Free:style=solid:size=12"} 37 | - string: {text: "{date}", right-margin: 5} 38 | - string: {text: , font: "Font Awesome 5 Free:style=solid:size=12"} 39 | - string: {text: "{time}"} 40 | ''; 41 | } 42 | -------------------------------------------------------------------------------- /profiles/users/ners/vscode.nix: -------------------------------------------------------------------------------- 1 | { pkgs, ... }: 2 | 3 | { 4 | home.packages = [ 5 | (pkgs.master.vscode-insiders-with-extensions.override { 6 | vscodeExtensions = with pkgs.master.vscode-insiders-extensions; [ 7 | #arrterian.nix-env-selector 8 | mkhl.direnv 9 | bierner.markdown-mermaid 10 | haskell.haskell 11 | jnoortheen.nix-ide 12 | justusadam.language-haskell 13 | ms-azuretools.vscode-docker 14 | ms-vscode.cpptools 15 | ms-vsliveshare.vsliveshare 16 | zxh404.vscode-proto3 17 | ms-vscode.makefile-tools 18 | ms-vscode.cmake-tools 19 | asvetliakov.vscode-neovim 20 | ] ++ pkgs.vscode-utils.extensionsFromVscodeMarketplace [ 21 | ]; 22 | }) 23 | ]; 24 | } 25 | -------------------------------------------------------------------------------- /profiles/users/rekk/default.nix: -------------------------------------------------------------------------------- 1 | { inputs, ... }@args: 2 | 3 | { 4 | imports = with inputs; [ 5 | (import self.profiles.users.common (args // { 6 | uid = 1001; 7 | username = "rekk"; 8 | })) 9 | ./system 10 | ]; 11 | home-manager.users.rekk = import ./home.nix; 12 | } 13 | -------------------------------------------------------------------------------- /profiles/users/rekk/fonts.nix: -------------------------------------------------------------------------------- 1 | { pkgs, lib, ... }: 2 | 3 | let 4 | mkFont = 5 | { name 6 | , url 7 | , sha256 8 | , sourceRoot ? "." 9 | }: pkgs.stdenv.mkDerivation rec { 10 | inherit name; 11 | nativeBuildInputs = [ pkgs.unzip ]; 12 | src = pkgs.fetchurl { 13 | inherit url sha256; 14 | name = "${name}.zip"; 15 | }; 16 | setSourceRoot = "sourceRoot=`pwd`"; 17 | installPhase = '' 18 | find ${sourceRoot} -type f -name '*.ttf' | while read f; do 19 | echo installing "$f" to "/share/fonts/truetype/${name}/$(basename "$f")" 20 | install -Dm644 -D "$f" "$out/share/fonts/truetype/${name}/$(basename "$f")" 21 | done 22 | find ${sourceRoot} -type f -name '*.otf' | while read f; do 23 | echo installing "$f" to "/share/fonts/opentype/${name}/$(basename "$f")" 24 | install -Dm644 -D "$f" "$out/share/fonts/opentype/${name}/$(basename "$f")" 25 | done 26 | ''; 27 | }; 28 | oswald = mkFont { 29 | name = "oswald"; 30 | url = "https://github.com/googlefonts/OswaldFont/archive/refs/heads/main.zip"; 31 | sha256 = "sha256-zd7eW7+ni6swa3qhh3R4ADPapxH+9sLAJOKnyviSZEM="; 32 | sourceRoot = "OswaldFont-main/fonts"; 33 | }; 34 | radley = mkFont { 35 | name = "radley"; 36 | url = "https://github.com/googlefonts/RadleyFont/archive/refs/heads/main.zip"; 37 | sha256 = "sha256-HLxKHfpwPU9WH0ir/Hm3eURZTBB9nn/MfDSwvqYwRDY="; 38 | sourceRoot = "RadleyFont-main/fonts"; 39 | }; 40 | gula = mkFont { 41 | name = "gula"; 42 | url = "https://www.fontriver.com/f/gula.zip"; 43 | sha256 = "sha256-kMop+cS9gKawaiyHmsD12WGPQkOJysUCQWYwtIlNE14="; 44 | }; 45 | bluetea = mkFont { 46 | name = "bluetea"; 47 | url = "https://www.fontriver.com/f/bluetea.zip"; 48 | sha256 = "sha256-jl5JKfJrUyYxGLEgyQccd2xB0wSVy15aMGZVXkwMClc="; 49 | }; 50 | playfair = mkFont { 51 | name = "playfair"; 52 | url = "https://github.com/clauseggers/Playfair/archive/refs/heads/master.zip"; 53 | sha256 = "sha256-9jSTYo76g/15gYQhPWJRWHDlZ3Abp/WjESEPFYileMA"; 54 | sourceRoot = "Playfair-master/fonts/VF-TTF"; 55 | }; 56 | along-sans = mkFont { 57 | name = "along-sans"; 58 | url = "https://dl.dafont.com/dl/?f=along_sans"; 59 | sha256 = "sha256-3rixZaoWlQaNBIjDUEdGMkrx8Z1rln7ueno60hA1mYw="; 60 | }; 61 | new-heterodox-mono = mkFont { 62 | name = "new-heterodox-mono"; 63 | url = "https://github.com/hckiang/font-new-heterodox-mono/archive/refs/heads/master.zip"; 64 | sha256 = "sha256-oXEGF77bEBkmsz0tzMvTk+V9RHw1hVhL9zHqh8BPdhE="; 65 | }; 66 | vegur = mkFont { 67 | name = "vegur"; 68 | url = "https://web.archive.org/web/20120828195558/http://www.dotcolon.net/DL/font/vegur.zip"; 69 | sha256 = "sha256-cvBdg26K8GGVvMcSaa9dLWVtMVhifAt90Rjn8q8yJgo="; 70 | }; 71 | 72 | in 73 | { 74 | fonts.fontconfig.enable = lib.mkForce true; 75 | home.packages = with pkgs; [ 76 | agave 77 | along-sans 78 | bluetea 79 | charis-sil 80 | crimson 81 | eb-garamond 82 | gula 83 | hasklig 84 | material-design-icons 85 | monoid 86 | new-heterodox-mono 87 | oswald 88 | paratype-pt-mono 89 | paratype-pt-sans 90 | paratype-pt-serif 91 | playfair 92 | radley 93 | source-sans-pro 94 | vegur 95 | ]; 96 | } 97 | -------------------------------------------------------------------------------- /profiles/users/rekk/git/default.nix: -------------------------------------------------------------------------------- 1 | { ... }: 2 | 3 | { 4 | programs.git = { 5 | enable = true; 6 | userName = "rekk"; 7 | userEmail = "rekk@gmx.de"; 8 | ignores = [ "*.swp" ".DS_STORE" ".projections.json" ".direnv" ]; 9 | extraConfig = { 10 | init.defaultBranch = "master"; 11 | push = { 12 | default = "current"; 13 | autoSetupRemote = true; 14 | }; 15 | alias = { 16 | co = "checkout"; 17 | ci = "commit"; 18 | lg = 19 | "log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative -n 10"; 20 | nb = "checkout -b"; 21 | st = "status"; 22 | sw = "switch -"; 23 | }; 24 | }; 25 | }; 26 | } 27 | -------------------------------------------------------------------------------- /profiles/users/rekk/home.nix: -------------------------------------------------------------------------------- 1 | { pkgs, lib, ... }: 2 | 3 | { 4 | home.packages = with pkgs; [ 5 | cmake 6 | comma 7 | dotnet-runtime 8 | ffmpeg 9 | ncdu 10 | tailscale 11 | mpv 12 | ]; 13 | 14 | imports = [ 15 | ./fonts.nix 16 | ./git 17 | ./neovim 18 | ./skhd 19 | ./yabai 20 | ./zsh 21 | ]; 22 | } 23 | -------------------------------------------------------------------------------- /profiles/users/rekk/neovim/default.nix: -------------------------------------------------------------------------------- 1 | { config, pkgs, lib, ... }: 2 | 3 | let 4 | loadPlugin = plugin: '' 5 | set rtp^=${plugin} 6 | set rtp+=${plugin}/after 7 | ''; 8 | plugins = with pkgs.vimPlugins; [ 9 | # colorizer # Preview hex colours. Extremely slow performance on large files 10 | # completion-nvim # Completion engine similar to cmp 11 | # haskell-vim # Haskell highlighting? 12 | # neoscroll-nvim # Smooth scrolling 13 | # null-ls-nvim # Allow non-LSP sources to hook into LSP client 14 | # psc-ide-vim # Purescript 15 | # sonokai # Theme 16 | # vim-commentary # Language-agnostic comment toggling 17 | # vim-devicons # Add file type icons to file browser 18 | # vim-ormolu # Automatically run ormolu 19 | # vim-terraform # Terraform syntax highlighting 20 | # which-key-nvim 21 | # yats-vim # Typescript syntax highlighting 22 | 23 | barbar-nvim # Improved tabs 24 | cmp-buffer # Current buffer words 25 | cmp-cmdline # Commands 26 | cmp-nvim-lsp # LSP 27 | coc-eslint # CoC should be replaced by LSP - but tsserver still works better 28 | coc-nvim 29 | coc-prettier 30 | coc-tsserver 31 | conflict-marker-vim # Git merge conflicts utils and visualisation 32 | conjure # Clojure evaluation 33 | copilot-vim # Github Copilot integration 34 | edge # Theme 35 | fzf-checkout-vim # Manage Git branches with fzf 36 | # fzf-vim # integrate fzf 37 | # fzfWrapper # integrate fzf 38 | fzf-lua # fzf integration rewritten in lua 39 | impatient-nvim # Speed up startup time 40 | lexima-vim # Auto close brackets, tags, etc. 41 | lsp_signature-nvim # Open floating window with function signature when calling functions 42 | luasnip # Snippet engine used by cmp 43 | nvim-base16 # Theme 44 | nvim-bqf # Better quickfix window 45 | nvim-cmp # Completion engine 46 | nvim-code-action-menu # Better code action menu 47 | nvim-lspconfig # All sorts of language-specific LSP configs 48 | nvim-tree-lua # File browser 49 | nvim-treesitter # Enable AST-aware highlighting and actions 50 | nvim-treesitter-refactor # Enable renaming symbols (AST-aware) 51 | nvim-ts-rainbow # Coloured parentheses 52 | sort-nvim # Better sorting with :Sort 53 | vim-abolish # Preserve case when substituting 54 | vim-airline # New bottom status line 55 | vim-airline-themes # Themes for bottom status line 56 | # vim-easymotion # Jump anywhere on screen by searching for characters 57 | vim-fugitive # Git integration (staging, committing, reverting...) 58 | vim-gitgutter # Highlight unstaged Git changes 59 | vim-graphql # GraphQL syntax highlighting 60 | vim-nix # Nix syntax highlighting 61 | vim-projectionist # Jump between files with the same prefix 62 | vim-startify # Startup splash screen 63 | vim-surround # Add shortcuts to surround text with characters (parens, quotes...) 64 | vim-swap # Add shortcuts to swap delimited items (function args...) 65 | ]; 66 | in 67 | { 68 | home.packages = with pkgs; [ 69 | (nerdfonts.override { fonts = [ "Cousine" "RobotoMono" "FiraCode" ]; }) 70 | clojure-lsp 71 | lua 72 | nodePackages.typescript-language-server 73 | nodejs 74 | python3 75 | rnix-lsp 76 | yarn 77 | ]; 78 | 79 | programs.neovim = { 80 | enable = true; 81 | viAlias = true; 82 | vimAlias = true; 83 | vimdiffAlias = true; 84 | withNodeJs = true; 85 | 86 | withPython3 = true; 87 | extraPython3Packages = (ps: with ps; [ 88 | pynvim 89 | ]); 90 | 91 | extraConfig = lib.mkForce '' 92 | " Workaround for broken handling of packpath by vim8/neovim for ftplugins -- see https://github.com/NixOS/nixpkgs/issues/39364#issuecomment-425536054 for more info 93 | filetype off | syn off 94 | ${builtins.concatStringsSep "\n" (map loadPlugin plugins)} 95 | filetype indent plugin on | syn on 96 | ${builtins.readFile ./init.vim} 97 | ''; 98 | }; 99 | 100 | xdg.configFile = { 101 | "nvim/lua".source = lib.mkForce ./lua; 102 | "nvim/plugin".source = lib.mkForce ./plugin; 103 | 104 | # TS/CoC config 105 | "nvim/coc-settings.json".text = builtins.toJSON { 106 | coc.preferences.formatOnSaveFiletypes = [ "typescript" "typescriptreact" ]; 107 | coc.preferences.jumpCommand = "tabe"; 108 | coc.preferences.snippets.enable = false; 109 | diagnostics.enable = false; 110 | eslint.packageManager = "yarn"; 111 | eslint.probe = [ "typescript" "typescriptreact" ]; 112 | eslint.run = "onType"; 113 | eslint.workingDirectories = [{ mode = "auto"; }]; 114 | signature.enable = false; 115 | typescript.autoClosingTags = true; 116 | typescript.format.enabled = true; 117 | typescript.format.insertSpaceAfterOpeningAndBeforeClosingEmptyBraces = true; 118 | typescript.preferences.importModuleSpecifier = "non-relative"; 119 | typescript.preferences.quoteStyle = "double"; 120 | typescript.suggest.autoImports = true; 121 | typescript.suggest.completeFunctionCalls = true; 122 | typescript.suggest.includeAutomaticOptionalChainCompletions = true; 123 | typescript.suggest.includeCompletionsForImportStatements = true; 124 | }; 125 | }; 126 | } 127 | -------------------------------------------------------------------------------- /profiles/users/rekk/neovim/lua/autoformat.lua: -------------------------------------------------------------------------------- 1 | -- Format the file before it is written 2 | vim.api.nvim_create_autocmd('BufWritePre', { 3 | group = vim.api.nvim_create_augroup('AutoformatOnWrite', {}), 4 | callback = function() vim.lsp.buf.formatting_sync(nil, 1000) end 5 | }) 6 | -------------------------------------------------------------------------------- /profiles/users/rekk/neovim/lua/colour.lua: -------------------------------------------------------------------------------- 1 | require('base16-colorscheme').setup({ 2 | base00 = '#${base00}', base01 = '#${base01}', base02 = '#${base02}', base03 = '#${base03}', 3 | base04 = '#${base04}', base05 = '#${base05}', base06 = '#${base06}', base07 = '#${base07}', 4 | base08 = '#${base08}', base09 = '#${base09}', base0A = '#${base0A}', base0B = '#${base0B}', 5 | base0C = '#${base0C}', base0D = '#${base0D}', base0E = '#${base0E}', base0F = '#${base0F}', 6 | }) 7 | -------------------------------------------------------------------------------- /profiles/users/rekk/neovim/lua/config.lua: -------------------------------------------------------------------------------- 1 | -- local lspconfig = require("lspconfig") 2 | -- local null_ls = require("null-ls")local buf_map = function(bufnr, mode, lhs, rhs, opts) 3 | -- vim.api.nvim_buf_set_keymap(bufnr, mode, lhs, rhs, opts or { 4 | -- silent = true, 5 | -- }) 6 | -- end 7 | -- 8 | -- local on_attach = function(client, bufnr) 9 | -- vim.cmd("command! LspDef lua vim.lsp.buf.definition()") 10 | -- vim.cmd("command! LspFormatting lua vim.lsp.buf.formatting()") 11 | -- vim.cmd("command! LspCodeAction lua vim.lsp.buf.code_action()") 12 | -- vim.cmd("command! LspHover lua vim.lsp.buf.hover()") 13 | -- vim.cmd("command! LspRename lua vim.lsp.buf.rename()") 14 | -- vim.cmd("command! LspRefs lua vim.lsp.buf.references()") 15 | -- vim.cmd("command! LspTypeDef lua vim.lsp.buf.type_definition()") 16 | -- vim.cmd("command! LspImplementation lua vim.lsp.buf.implementation()") 17 | -- vim.cmd("command! LspDiagPrev lua vim.diagnostic.goto_prev()") 18 | -- vim.cmd("command! LspDiagNext lua vim.diagnostic.goto_next()") 19 | -- vim.cmd("command! LspDiagLine lua vim.diagnostic.open_float()") 20 | -- vim.cmd("command! LspSignatureHelp lua vim.lsp.buf.signature_help()") buf_map(bufnr, "n", "gd", ":LspDef") 21 | -- buf_map(bufnr, "n", "gr", ":LspRename") 22 | -- buf_map(bufnr, "n", "gy", ":LspTypeDef") 23 | -- buf_map(bufnr, "n", "K", ":LspHover") 24 | -- buf_map(bufnr, "n", "[a", ":LspDiagPrev") 25 | -- buf_map(bufnr, "n", "]a", ":LspDiagNext") 26 | -- buf_map(bufnr, "n", "ga", ":LspCodeAction") 27 | -- buf_map(bufnr, "n", "a", ":LspDiagLine") 28 | -- buf_map(bufnr, "i", "", " LspSignatureHelp") if client.resolved_capabilities.document_formatting then 29 | -- vim.cmd("autocmd BufWritePre lua vim.lsp.buf.formatting_sync()") 30 | -- end 31 | -- end 32 | -- 33 | -- lspconfig.tsserver.setup({ 34 | -- on_attach = function(client, bufnr) 35 | -- client.resolved_capabilities.document_formatting = false 36 | -- client.resolved_capabilities.document_range_formatting = false local ts_utils = require("nvim-lsp-ts-utils") 37 | -- ts_utils.setup({}) 38 | -- ts_utils.setup_client(client) buf_map(bufnr, "n", "gs", ":TSLspOrganize") 39 | -- buf_map(bufnr, "n", "gi", ":TSLspRenameFile") 40 | -- buf_map(bufnr, "n", "go", ":TSLspImportAll") on_attach(client, bufnr) 41 | -- end, 42 | -- }) 43 | -- 44 | -- null_ls.setup({ 45 | -- sources = { 46 | -- null_ls.builtins.diagnostics.eslint, 47 | -- null_ls.builtins.code_actions.eslint, 48 | -- null_ls.builtins.formatting.prettier, 49 | -- }, 50 | -- on_attach = on_attach, 51 | -- }) 52 | -------------------------------------------------------------------------------- /profiles/users/rekk/neovim/lua/diagnostics.lua: -------------------------------------------------------------------------------- 1 | -- local sign = function(opts) 2 | -- vim.fn.sign_define(opts.name, { 3 | -- texthl = opts.name, 4 | -- text = opts.text, 5 | -- numhl = '' 6 | -- }) 7 | -- end 8 | -- 9 | -- sign({name = 'DiagnosticSignError', text = '✘'}) 10 | -- sign({name = 'DiagnosticSignWarn', text = '▲'}) 11 | -- sign({name = 'DiagnosticSignHint', text = '⚑'}) 12 | -- sign({name = 'DiagnosticSignInfo', text = ''}) 13 | -- 14 | -- local border = { 15 | -- {"╭", "FloatBorder"}, 16 | -- {"─", "FloatBorder"}, 17 | -- {"╮", "FloatBorder"}, 18 | -- {"│", "FloatBorder"}, 19 | -- {"╯", "FloatBorder"}, 20 | -- {"─", "FloatBorder"}, 21 | -- {"╰", "FloatBorder"}, 22 | -- {"│", "FloatBorder"}, 23 | -- } 24 | -- vim.diagnostic.config({ 25 | -- virtual_text = false, 26 | -- severity_sort = true, 27 | -- float = { 28 | -- border = 'rounded', 29 | -- source = 'always', 30 | -- header = '', 31 | -- prefix = '', 32 | -- }, 33 | -- }) 34 | -- 35 | -- vim.lsp.handlers['textDocument/hover'] = vim.lsp.with( 36 | -- vim.lsp.handlers.hover, 37 | -- {border = 'rounded'} 38 | -- ) 39 | -- 40 | -- vim.lsp.handlers['textDocument/signatureHelp'] = vim.lsp.with( 41 | -- vim.lsp.handlers.signature_help, 42 | -- {border = 'rounded'} 43 | -- ) 44 | -------------------------------------------------------------------------------- /profiles/users/rekk/neovim/lua/on-attach.lua: -------------------------------------------------------------------------------- 1 | local keymapOpts = { noremap = true, silent = true } 2 | local sign = function(opts) 3 | vim.fn.sign_define(opts.name, { 4 | texthl = opts.name, 5 | text = opts.text, 6 | numhl = '' 7 | }) 8 | end 9 | local function on_attach(client, buffer) 10 | require 'lsp_signature'.on_attach { 11 | hint_prefix = '' 12 | } 13 | vim.api.nvim_set_keymap('n', 'e', 'lua vim.diagnostic.open_float()', keymapOpts) 14 | vim.api.nvim_set_keymap('n', '[d', 'lua vim.diagnostic.goto_prev()', keymapOpts) 15 | vim.api.nvim_set_keymap('n', ']d', 'lua vim.diagnostic.goto_next()', keymapOpts) 16 | -- vim.api.nvim_set_keymap('n', 'q', 'lua vim.diagnostic.setloclist()', keymapOpts) 17 | 18 | vim.api.nvim_buf_set_keymap(buffer, 'n', 'gd', 'lua require\'fzf-lua\'.lsp_definitions()', keymapOpts) 19 | vim.api.nvim_buf_set_keymap(buffer, 'n', 'gr', 'lua require\'fzf-lua\'.lsp_references()', keymapOpts) 20 | -- vim.api.nvim_buf_set_keymap(buffer, 'n', ',', 'lua require\'fzf-lua\'.lsp_code_actions()', keymapOpts) 21 | -- vim.api.nvim_buf_set_keymap(buffer, 'n', 'gD', 'lua vim.lsp.buf.declaration()', keymapOpts) 22 | -- vim.api.nvim_buf_set_keymap(buffer, 'n', 'gi', 'lua vim.lsp.buf.implementation()', keymapOpts) 23 | 24 | vim.api.nvim_buf_set_keymap(buffer, 'n', '`', 'lua vim.lsp.buf.hover()', keymapOpts) 25 | vim.api.nvim_buf_set_keymap(buffer, 'n', 'rr', 'lua vim.lsp.buf.rename()', keymapOpts) 26 | vim.api.nvim_buf_set_keymap(buffer, 'n', 'f', 'lua vim.lsp.buf.format({async=true})', keymapOpts) 27 | -- -- 28 | -- vim.api.nvim_buf_set_keymap(buffer, 'n', ',', 'lua vim.lsp.buf.code_action()', opts) 29 | -- vim.api.nvim_buf_set_keymap(buffer, 'n', '', 'lua vim.lsp.buf.signature_help()', opts) 30 | -- vim.api.nvim_buf_set_keymap(buffer, 'n', 'wa', 'lua vim.lsp.buf.add_workspace_folder()', opts) 31 | -- vim.api.nvim_buf_set_keymap(buffer, 'n', 'wr', 'lua vim.lsp.buf.remove_workspace_folder()', opts) 32 | -- vim.api.nvim_buf_set_keymap(buffer, 'n', 'wl', 'lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))', opts) 33 | -- vim.api.nvim_buf_set_keymap(buffer, 'n', 'D', 'lua vim.lsp.buf.type_definition()', opts) 34 | 35 | if client.server_capabilities.document_highlight then 36 | vim.api.nvim_exec([[ 37 | augroup lsp_document_highlight 38 | autocmd CursorHold lua vim.lsp.buf.document_highlight() 39 | autocmd CursorHoldI lua vim.lsp.buf.document_highlight() 40 | autocmd CursorMoved lua vim.lsp.buf.clear_references() 41 | augroup END 42 | ]], false) 43 | end 44 | end 45 | 46 | vim.lsp.handlers['textDocument/signatureHelp'] = vim.lsp.with( 47 | vim.lsp.handlers.signature_help, 48 | { border = 'rounded' } 49 | ) 50 | 51 | vim.lsp.handlers['textDocument/hover'] = vim.lsp.with( 52 | vim.lsp.handlers.hover, 53 | { border = 'double' } 54 | ) 55 | 56 | sign({ name = 'DiagnosticSignError', text = '✘' }) 57 | sign({ name = 'DiagnosticSignWarn', text = '▲' }) 58 | sign({ name = 'DiagnosticSignHint', text = '⚑' }) 59 | sign({ name = 'DiagnosticSignInfo', text = '' }) 60 | 61 | vim.diagnostic.config({ 62 | virtual_text = true, 63 | severity_sort = true, 64 | float = { 65 | border = 'rounded', 66 | source = 'always', 67 | header = '', 68 | prefix = '' 69 | } 70 | }) 71 | 72 | return on_attach 73 | -------------------------------------------------------------------------------- /profiles/users/rekk/neovim/plugin/bqf.lua: -------------------------------------------------------------------------------- 1 | require('bqf').setup({ 2 | auto_enable = true, 3 | auto_resize_height = true, -- highly recommended enable 4 | func_map = { 5 | openc = '', 6 | }, 7 | }) 8 | -------------------------------------------------------------------------------- /profiles/users/rekk/neovim/plugin/fzf-lua.lua: -------------------------------------------------------------------------------- 1 | require('fzf-lua').setup{} 2 | -------------------------------------------------------------------------------- /profiles/users/rekk/neovim/plugin/impatient.lua: -------------------------------------------------------------------------------- 1 | require('impatient') 2 | -------------------------------------------------------------------------------- /profiles/users/rekk/neovim/plugin/lsp-clojure.lua: -------------------------------------------------------------------------------- 1 | require'lspconfig'.clojure_lsp.setup{ 2 | on_attach = require'on-attach', 3 | } 4 | -------------------------------------------------------------------------------- /profiles/users/rekk/neovim/plugin/lsp-graphql.lua: -------------------------------------------------------------------------------- 1 | require'lspconfig'.graphql.setup{ 2 | on_attach = require'on-attach', 3 | } 4 | -------------------------------------------------------------------------------- /profiles/users/rekk/neovim/plugin/lsp-haskell.lua: -------------------------------------------------------------------------------- 1 | require'lspconfig'.hls.setup{ 2 | on_attach = require'on-attach', 3 | settings = { 4 | haskell = { 5 | formattingProvider = 'fourmolu' 6 | } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /profiles/users/rekk/neovim/plugin/lsp-lua.lua: -------------------------------------------------------------------------------- 1 | require'lspconfig'.sumneko_lua.setup{ 2 | on_attach = require'on-attach', 3 | cmd = { 'lua-language-server' }, 4 | settings = { 5 | Lua = { 6 | diagnostics = { 7 | globals = {'vim'}, 8 | } 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /profiles/users/rekk/neovim/plugin/lsp-nix.lua: -------------------------------------------------------------------------------- 1 | require'lspconfig'.rnix.setup{ 2 | on_attach = require'on-attach', 3 | } 4 | -------------------------------------------------------------------------------- /profiles/users/rekk/neovim/plugin/lsp-swift.lua: -------------------------------------------------------------------------------- 1 | require'lspconfig'.sourcekit.setup{} 2 | -------------------------------------------------------------------------------- /profiles/users/rekk/neovim/plugin/lsp-tsserver.lua: -------------------------------------------------------------------------------- 1 | require'lspconfig'.tsserver.setup{ 2 | on_attach = require'on-attach', 3 | init_options = { 4 | preferences = { 5 | importModuleSpecifierPreference = 'non-relative' 6 | } 7 | } 8 | } 9 | -- CoC is still a better fit for tsserver 10 | -------------------------------------------------------------------------------- /profiles/users/rekk/neovim/plugin/neoscroll.lua: -------------------------------------------------------------------------------- 1 | -- Smooth scrolling (neoscroll) 2 | -- require('neoscroll').setup({ happings = {'', ''}, easing_function = 'cubic', hide_cursor = 'false' }) 3 | -- require('neoscroll.config').set_mappings({ [''] = {'scroll', {'-vim.wo.scroll', 'true', '125'}}, [''] = {'scroll', {'vim.wo.scroll', 'true', '125'}} }) 4 | -------------------------------------------------------------------------------- /profiles/users/rekk/neovim/plugin/nvim-cmp.lua: -------------------------------------------------------------------------------- 1 | local cmp = require 'cmp' 2 | local luasnip = require 'luasnip' 3 | 4 | cmp.setup({ 5 | -- Enable LSP snippets 6 | snippet = { 7 | expand = function(args) 8 | luasnip.lsp_expand(args.body) 9 | end, 10 | }, 11 | mapping = { 12 | [''] = cmp.mapping.select_prev_item(), 13 | [''] = cmp.mapping.select_next_item(), 14 | -- Manually trigger completion 15 | [''] = cmp.mapping.complete(), 16 | -- Enter to apply completion 17 | [''] = cmp.mapping.confirm({ 18 | behavior = cmp.ConfirmBehavior.Insert, 19 | select = true, 20 | }), 21 | -- Tab support 22 | [''] = cmp.mapping(function (fallback) 23 | if luasnip.expandable() then 24 | luasnip.expand() 25 | elseif cmp.visible() then 26 | cmp.select_next_item() 27 | elseif luasnip.jumpable(1) then 28 | luasnip.jump(1) 29 | else 30 | fallback() 31 | end 32 | end, {'i', 's'}), 33 | [''] = cmp.mapping(function (fallback) 34 | local copilot_keys = vim.fn["copilot#Accept"]() 35 | if copilot_keys ~= "" then 36 | vim.api.nvim_feedkeys(copilot_keys, "i", true) 37 | else 38 | fallback() 39 | end 40 | end, {'i', 's'}), 41 | }, 42 | 43 | sources = { 44 | { name = 'nvim_lsp' }, 45 | { name = 'omni' }, 46 | { name = 'luasnip' }, 47 | { name = 'path' }, 48 | { name = 'buffer' }, 49 | { name = 'treesitter' }, 50 | }, 51 | }) 52 | 53 | -- cmp-cmdline 54 | require'cmp'.setup.cmdline(':', { 55 | sources = { 56 | { name = 'cmdline' }, 57 | }, 58 | mapping = cmp.mapping.preset.cmdline({ 59 | [''] = cmp.mapping(cmp.mapping.select_next_item()), 60 | [''] = cmp.mapping(cmp.mapping.select_prev_item()), 61 | }) 62 | }) 63 | 64 | require'cmp'.setup.cmdline('/', { 65 | sources = { 66 | { name = 'buffer' }, 67 | }, 68 | mapping = cmp.mapping.preset.cmdline({ 69 | [''] = cmp.mapping(cmp.mapping.select_next_item()), 70 | [''] = cmp.mapping(cmp.mapping.select_prev_item()), 71 | }) 72 | }) 73 | 74 | -- local capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities()) 75 | -- require('lspconfig')['hls'].setup { 76 | -- capabilities = capabilities 77 | -- } 78 | -------------------------------------------------------------------------------- /profiles/users/rekk/neovim/plugin/nvim-tree.lua: -------------------------------------------------------------------------------- 1 | require("nvim-tree").setup({ 2 | view = { 3 | adaptive_size = true, 4 | mappings = { 5 | list = { 6 | { key = "u", action = "dir_up" }, 7 | }, 8 | }, 9 | }, 10 | renderer = { 11 | group_empty = true, 12 | }, 13 | filters = { 14 | dotfiles = true, 15 | }, 16 | }) 17 | -------------------------------------------------------------------------------- /profiles/users/rekk/neovim/plugin/treesitter.lua: -------------------------------------------------------------------------------- 1 | require'nvim-treesitter.configs'.setup { 2 | highlight = { 3 | enable = true, 4 | additional_vim_regex_highlighting = false, 5 | }, 6 | indentation = { 7 | enable = true, 8 | }, 9 | refactor = { 10 | highlight_definitions = { 11 | enable = true, 12 | clear_on_cursor_move = true, 13 | }, 14 | highlight_current_scope = { enable = true }, 15 | smart_rename = { 16 | enable = true, 17 | keymaps = { 18 | smart_rename = "R", 19 | }, 20 | }, 21 | navigation = { 22 | enable = true, 23 | keymaps = { 24 | goto_definition_lsp_fallback = "gd", 25 | list_definitions = "gD", 26 | list_definitions_toc = "gO", 27 | goto_next_usage = "n", 28 | goto_previous_usage = "n", 29 | }, 30 | }, 31 | }, 32 | } 33 | -------------------------------------------------------------------------------- /profiles/users/rekk/skhd/default.nix: -------------------------------------------------------------------------------- 1 | { pkgs, lib, ... }: 2 | 3 | let 4 | yabai = "${pkgs.yabai}/bin/yabai"; 5 | in 6 | lib.mkIf pkgs.parsedSystem.isDarwin { 7 | xdg.configFile."../.skhdrc".text = '' 8 | # focus window 9 | cmd - left : ${yabai} -m window --focus west || ${yabai} -m display --focus west 10 | cmd - right : ${yabai} -m window --focus east || ${yabai} -m display --focus east 11 | cmd - down : ${yabai} -m window --focus south || ${yabai} -m display --focus south 12 | cmd - up : ${yabai} -m window --focus north || ${yabai} -m display --focus north 13 | 14 | # move managed window 15 | shift + cmd - left : ${yabai} -m window --warp west || $(${yabai} -m window --display west; ${yabai} -m display --focus west) 16 | shift + cmd - right : ${yabai} -m window --warp east || $(${yabai} -m window --display east; ${yabai} -m display --focus east) 17 | shift + cmd - down : ${yabai} -m window --warp south || $(${yabai} -m window --display south; ${yabai} -m display --focus south) 18 | shift + cmd - up : ${yabai} -m window --warp north || $(${yabai} -m window --display north; ${yabai} -m display --focus north) 19 | 20 | # resize window 21 | ctrl + alt - left : ${yabai} -m window --resize right:-100:0 || ${yabai} -m window --resize left:-100:0 22 | ctrl + alt - right : ${yabai} -m window --resize right:100:0 || ${yabai} -m window --resize left:100:0 23 | ctrl + alt - up : ${yabai} -m window --resize bottom:0:-100 || ${yabai} -m window --resize top:0:-100 24 | ctrl + alt - down : ${yabai} -m window --resize bottom:0:100 || ${yabai} -m window --resize top:0:100 25 | 26 | # flip split orientation 27 | shift + cmd - space : ${yabai} -m window --toggle split 28 | 29 | # toggle float 30 | alt - t : ${yabai} -m window --toggle float;\ 31 | ${yabai} -m window --grid 4:4:1:1:2:2 32 | ''; 33 | 34 | # TODO: migrate homebrew skhd instance to skhd service 35 | # services.skhd = { 36 | # enable = true; 37 | # skhdConfig = '' 38 | # # focus window 39 | # cmd - left : yabai -m window --focus west || yabai -m display --focus west 40 | # cmd - right : yabai -m window --focus east || yabai -m display --focus east 41 | # cmd - down : yabai -m window --focus south || yabai -m display --focus south 42 | # cmd - up : yabai -m window --focus north || yabai -m display --focus north 43 | # 44 | # # move managed window 45 | # shift + cmd - left : yabai -m window --warp west || $(yabai -m window --display west; yabai -m display --focus west) 46 | # shift + cmd - right : yabai -m window --warp east || $(yabai -m window --display east; yabai -m display --focus east) 47 | # shift + cmd - down : yabai -m window --warp south || $(yabai -m window --display south; yabai -m display --focus south) 48 | # shift + cmd - up : yabai -m window --warp north || $(yabai -m window --display north; yabai -m display --focus north) 49 | # 50 | # # resize window 51 | # ctrl + alt - left : yabai -m window --resize right:-100:0 || yabai -m window --resize left:-100:0 52 | # ctrl + alt - right : yabai -m window --resize right:100:0 || yabai -m window --resize left:100:0 53 | # ctrl + alt - up : yabai -m window --resize bottom:0:-100 || yabai -m window --resize top:0:-100 54 | # ctrl + alt - down : yabai -m window --resize bottom:0:100 || yabai -m window --resize top:0:100 55 | # 56 | # # flip split orientation 57 | # shift + cmd - space : yabai -m window --toggle split 58 | # 59 | # # toggle float 60 | # alt - t : yabai -m window --toggle float;\ 61 | # yabai -m window --grid 4:4:1:1:2:2 62 | # ''; 63 | # }; 64 | # 65 | # launchd.user.agents.skhd.serviceConfig = { 66 | # StandardOutPath = "/tmp/skhd.out.log"; 67 | # StandardErrorPath = "/tmp/skhd.err.log"; 68 | # }; 69 | } 70 | -------------------------------------------------------------------------------- /profiles/users/rekk/system/default.nix: -------------------------------------------------------------------------------- 1 | { pkgs, lib, ... }: 2 | 3 | { 4 | config = lib.optionalAttrs pkgs.parsedSystem.isDarwin { 5 | system.defaults.NSGlobalDomain.InitialKeyRepeat = 15; 6 | system.defaults.NSGlobalDomain.KeyRepeat = 1; 7 | 8 | system.defaults.".GlobalPreferences"."com.apple.mouse.scaling" = "1"; 9 | 10 | system.defaults.dock.autohide = true; 11 | 12 | system.defaults.trackpad.Clicking = true; 13 | 14 | system.keyboard.enableKeyMapping = true; 15 | system.keyboard.remapCapsLockToEscape = true; 16 | }; 17 | } 18 | -------------------------------------------------------------------------------- /profiles/users/rekk/yabai/default.nix: -------------------------------------------------------------------------------- 1 | { pkgs, lib, ... }: 2 | 3 | lib.mkIf pkgs.parsedSystem.isDarwin { 4 | xdg.configFile."../.yabairc".text = '' 5 | #!/usr/bin/env sh 6 | 7 | # global settings 8 | yabai -m config mouse_follows_focus on 9 | yabai -m config focus_follows_mouse autofocus 10 | yabai -m config window_placement second_child 11 | yabai -m config window_topmost off 12 | yabai -m config window_shadow off 13 | yabai -m config window_opacity off 14 | yabai -m config window_border on 15 | yabai -m config window_border_width 3 16 | yabai -m config window_border_radius 9 17 | yabai -m config active_window_border_color 0xff4c78cc 18 | yabai -m config normal_window_border_color 0x00000000 19 | yabai -m config insert_feedback_color 0xffd75f5f 20 | yabai -m config split_ratio 0.50 21 | yabai -m config auto_balance off 22 | yabai -m config mouse_modifier fn 23 | yabai -m config mouse_action1 move 24 | yabai -m config mouse_action2 resize 25 | yabai -m config mouse_drop_action swap 26 | 27 | # general space settings 28 | yabai -m config layout bsp 29 | yabai -m config top_padding 0 30 | yabai -m config bottom_padding 0 31 | yabai -m config left_padding 0 32 | yabai -m config right_padding 0 33 | yabai -m config window_gap 2 34 | 35 | # Exclude some apps 36 | yabai -m rule --add label="Finder" app="^Finder$" title="(Co(py|nnect)|Move|Info|Pref)" manage=off 37 | 38 | echo "yabai configuration loaded.." 39 | ''; 40 | 41 | # TODO: migrate homebrew yabai instance to yabai service 42 | # services.yabai = { 43 | # enable = true; 44 | # config = { 45 | # mouse_follows_focus = "on"; 46 | # focus_follows_mouse = "autofocus"; 47 | # window_placement = "second_child"; 48 | # window_topmost = "off"; 49 | # window_shadow = "off"; 50 | # window_opacity = "off"; 51 | # window_opacity_duration = 0.2; 52 | # active_window_opacity = 1.0; 53 | # normal_window_opacity = 1.00; 54 | # window_border = "on"; 55 | # window_border_width = 4; 56 | # window_border_radius = 2; 57 | # active_window_border_color = "0xff4c7899"; 58 | # insert_feedback_color = "0xffd75f5f"; 59 | # split_ratio = 0.50; 60 | # auto_balance = "off"; 61 | # mouse_modifier = "fn"; 62 | # mouse_action1 = "move"; 63 | # mouse_action2 = "resize"; 64 | # mouse_drop_action = "swap"; 65 | # layout = "bsp"; 66 | # top_padding = 0; 67 | # bottom_padding = 0; 68 | # left_padding = 0; 69 | # right_padding = 0; 70 | # window_gap = 2; 71 | # }; 72 | # 73 | # extraConfig = '' 74 | # # Exclude some apps 75 | # yabai -m rule --add label="Finder" app="^Finder$" title="(Co(py|nnect)|Move|Info|Pref)" manage=off 76 | # 77 | # echo "yabai configuration loaded.." 78 | # ''; 79 | # }; 80 | # 81 | # launchd.user.agents.yabai.serviceConfig = { 82 | # StandardOutPath = "/tmp/yabai.out.log"; 83 | # StandardErrorPath = "/tmp/yabai.err.log"; 84 | # }; 85 | } 86 | -------------------------------------------------------------------------------- /profiles/users/rekk/zsh/default.nix: -------------------------------------------------------------------------------- 1 | { config, pkgs, lib, ... }: 2 | 3 | { 4 | programs.starship = { 5 | enable = true; 6 | enableZshIntegration = true; 7 | settings = lib.mkForce { 8 | format = 9 | let 10 | items = [ 11 | "username" 12 | "hostname" 13 | "directory" 14 | "git_branch" 15 | "git_commit" 16 | "git_state" 17 | "git_metrics" 18 | "git_status" 19 | "env_var" 20 | "custom" 21 | "sudo" 22 | "cmd_duration" 23 | "line_break" 24 | "jobs" 25 | "battery" 26 | "time" 27 | "status" 28 | "shell" 29 | "character" 30 | ]; 31 | in 32 | lib.strings.concatMapStrings (item: "$" + item) items; 33 | }; 34 | }; 35 | 36 | programs.zsh = { 37 | enable = true; 38 | enableAutosuggestions = true; 39 | enableSyntaxHighlighting = true; 40 | enableCompletion = true; 41 | 42 | history = { 43 | size = 10000; 44 | path = "${config.xdg.dataHome}/zsh/history"; 45 | ignoreSpace = true; 46 | }; 47 | 48 | sessionVariables = { 49 | BAT_THEME = "OneHalfDark"; 50 | }; 51 | 52 | # plugins = [ 53 | # { 54 | # name = "just-zsh"; 55 | # file = "completions/just.zsh"; 56 | # src = pkgs.fetchFromGitHub { 57 | # owner = "casey"; 58 | # repo = "just"; 59 | # rev = "1.11.0"; 60 | # sha256 = "01cfs17i5jqq660dib2gg15dqwa2xgy5dz94pw14bb55p1i3d32d"; 61 | # }; 62 | # } 63 | # ]; 64 | 65 | initExtra = ( 66 | let 67 | scripts = [ 68 | "source ${pkgs.fzf}/share/fzf/completion.zsh" 69 | "source ${pkgs.fzf}/share/fzf/key-bindings.zsh" 70 | "source ${pkgs.nix-zsh-completions}/share/zsh/plugins/nix/nix-zsh-completions.plugin.zsh" 71 | "source ${pkgs.zsh-autosuggestions}/share/zsh-autosuggestions/zsh-autosuggestions.zsh" 72 | "source ${pkgs.zsh-fzf-tab}/share/fzf-tab/fzf-tab.plugin.zsh" 73 | "source ${pkgs.zsh-fzf-tab}/share/fzf-tab/lib/zsh-ls-colors/ls-colors.zsh" 74 | "source ${pkgs.zsh-history-substring-search}/share/zsh-history-substring-search/zsh-history-substring-search.zsh" 75 | # "source ${pkgs.zsh-syntax-highlighting}/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" 76 | "source ${pkgs.zsh-z}/share/zsh-z/zsh-z.plugin.zsh" 77 | ]; 78 | in 79 | (builtins.concatStringsSep "\n" scripts) + "\n" 80 | + builtins.readFile ./init.sh 81 | ); 82 | }; 83 | } 84 | -------------------------------------------------------------------------------- /profiles/users/rekk/zsh/init.sh: -------------------------------------------------------------------------------- 1 | # PR-like view 2 | odiff () { 3 | git diff origin/master...origin/$1 4 | } 5 | 6 | makeshell() { 7 | basicshell=" 8 | { pkgs ? import {} }: 9 | 10 | pkgs.mkShell { 11 | packages = [ 12 | texlive.combined.scheme-basic 13 | ]; 14 | } 15 | " 16 | touch shell.nix 17 | echo $basicshell >> shell.nix 18 | } 19 | 20 | makeflake() { 21 | basicflake=" 22 | { 23 | inputs = { 24 | nixpkgs.url = "github:NixOS/nixpkgs/nixos-22.05"; 25 | flake-utils.url = "github:numtide/flake-utils"; 26 | }; 27 | 28 | outputs = inputs: 29 | with inputs; 30 | flake-utils.lib.eachDefaultSystem (system: 31 | let pkgs = import nixpkgs { inherit system; }; 32 | in { devShell = pkgs.mkShell { nativeBuildInputs = []; }; }); 33 | } 34 | " 35 | 36 | touch flake.nix 37 | touch .envrc 38 | echo $basicflake >> flake.nix 39 | echo "use flake" >> .envrc 40 | } 41 | 42 | # file system shortcuts 43 | hash -d pr=$HOME/projects 44 | hash -d me=$HOME/projects/meatico 45 | hash -d fe=$HOME/projects/meatico/js/backoffice 46 | hash -d be=$HOME/projects/meatico/backend 47 | hash -d bd=$HOME/projects/meatico/base_data 48 | hash -d nix=$HOME/projects/macos/nixpkgs 49 | 50 | # aliases 51 | alias vimr="/Applications/VimR.app/Contents/MacOS/VimR --cur-env . &" 52 | alias remove_gql_codegen='find -X . -name "*.generated.ts" | xargs rm' 53 | alias darwin_rebuild="pushd ~/Projects/NixOS && darwin-rebuild build --flake . && result/sw/bin/darwin-rebuild switch --flake . && popd" 54 | alias git_list_assume_unchanged="git ls-files -v | grep '^[[:lower:]]'" 55 | alias kill_docker="docker rm -f $(docker ps -a -q) > /dev/null 2>/dev/null" 56 | alias ports_listening="sudo lsof -i -P | grep LISTEN" 57 | alias neovide="/Applications/Neovide.app/Contents/MacOS/neovide --frame none" 58 | alias mpv_gui="mpv --player-operation-mode=pseudo-gui" 59 | 60 | # export PATH="$PATH:/opt/homebrew/opt/llvm/bin" 61 | # export PATH="$PATH:/Users/rekk/.local/bin" 62 | # 63 | bindkey "^I" fzf-tab-complete 64 | -------------------------------------------------------------------------------- /profiles/virtualisation.nix: -------------------------------------------------------------------------------- 1 | { pkgs, ... }: 2 | 3 | { 4 | virtualisation = { 5 | podman.enable = true; 6 | libvirtd = { 7 | enable = true; 8 | onBoot = "ignore"; 9 | onShutdown = "shutdown"; 10 | qemu = { 11 | ovmf.enable = true; 12 | runAsRoot = false; 13 | }; 14 | }; 15 | spiceUSBRedirection.enable = true; 16 | }; 17 | 18 | environment.systemPackages = with pkgs; [ 19 | libguestfs 20 | spice-vdagent 21 | swtpm 22 | unstable.podman-compose 23 | ]; 24 | 25 | boot.kernelModules = [ "kvm-amd" "kvm-intel" ]; 26 | } 27 | -------------------------------------------------------------------------------- /profiles/zram.nix: -------------------------------------------------------------------------------- 1 | { ... }: 2 | 3 | { 4 | zramSwap = { 5 | enable = true; 6 | }; 7 | } 8 | -------------------------------------------------------------------------------- /profiles/zsh.nix: -------------------------------------------------------------------------------- 1 | { pkgs, lib, ... }: 2 | 3 | lib.mkMerge [ 4 | { 5 | programs.zsh.enable = true; 6 | } 7 | (lib.optionalAttrs pkgs.parsedSystem.isLinux { 8 | environment.shells = [ pkgs.zsh ]; 9 | users.defaultUserShell = pkgs.zsh; 10 | }) 11 | ] 12 | -------------------------------------------------------------------------------- /roles/README.md: -------------------------------------------------------------------------------- 1 | ## Roles 2 | 3 | Roles represent logical groups of [profiles](../profiles) that are commonly used together to fit a configuration's intended use. 4 | A role may additionally configure things that do not naturally fit into a profile, e.g. additional packages. 5 | 6 | As with profiles, a role should be minimal and self-contained, as duplicated work should be minimised across configurations. 7 | -------------------------------------------------------------------------------- /roles/base.nix: -------------------------------------------------------------------------------- 1 | { inputs, pkgs, lib, ... }: 2 | 3 | { 4 | imports = with inputs; [ 5 | self.profiles.nix 6 | self.profiles.zsh 7 | ]; 8 | 9 | environment = { 10 | systemPackages = with pkgs; [ 11 | aria2 12 | bat 13 | boxes 14 | btop 15 | entr 16 | exa 17 | exfat 18 | expect 19 | fd 20 | file 21 | fx 22 | jq 23 | killall 24 | libfaketime 25 | moreutils 26 | nano 27 | neofetch 28 | neovim 29 | nix-diff 30 | nix-index 31 | nix-top 32 | nix-tree 33 | unstable.nix-output-monitor 34 | nvd 35 | perl534Packages.FileMimeInfo 36 | pv 37 | ripgrep 38 | smartmontools 39 | sshfs-fuse 40 | tio 41 | tmux 42 | tree 43 | unzip 44 | wget 45 | xh 46 | zip 47 | ]; 48 | variables = { EDITOR = "nvim"; }; 49 | }; 50 | } 51 | -------------------------------------------------------------------------------- /roles/darwin.nix: -------------------------------------------------------------------------------- 1 | { inputs, pkgs, ... }: 2 | 3 | { 4 | imports = with inputs; [ 5 | self.roles.base 6 | self.profiles.fonts 7 | ]; 8 | 9 | environment.systemPackages = with pkgs; [ 10 | darwin-update 11 | iterm2 12 | ]; 13 | } 14 | -------------------------------------------------------------------------------- /roles/desktop.nix: -------------------------------------------------------------------------------- 1 | { inputs, pkgs, options, ... }: 2 | 3 | { 4 | imports = with inputs.self; [ 5 | profiles.fonts 6 | profiles.fprintd 7 | profiles.geoclue 8 | profiles.gnome 9 | profiles.pipewire 10 | profiles.plymouth 11 | profiles.virtualisation 12 | roles.nixos 13 | ]; 14 | 15 | environment.systemPackages = with pkgs; [ 16 | firefox-wayland 17 | gparted 18 | libappindicator 19 | libimobiledevice 20 | libnotify 21 | mpv 22 | neovide 23 | speedtest-cli 24 | spice-gtk 25 | thunderbird 26 | transmission-gtk 27 | virt-manager 28 | virt-viewer 29 | ]; 30 | 31 | services = { 32 | xserver = { 33 | enable = true; 34 | xkbOptions = "caps:escape"; 35 | libinput.enable = true; 36 | }; 37 | blueman.enable = true; 38 | flatpak.enable = true; 39 | fwupd.enable = true; 40 | localtimed.enable = true; 41 | printing.enable = true; 42 | redshift.enable = true; 43 | usbmuxd.enable = true; 44 | }; 45 | 46 | programs = { 47 | mtr.enable = true; 48 | nm-applet.enable = true; 49 | sway = { 50 | enable = true; 51 | wrapperFeatures.gtk = true; 52 | #extraPackages = [ ]; 53 | }; 54 | }; 55 | 56 | xdg.portal = { 57 | enable = true; 58 | wlr.enable = true; 59 | }; 60 | 61 | security.rtkit.enable = true; 62 | 63 | hardware.opengl = { 64 | enable = true; 65 | driSupport = true; 66 | driSupport32Bit = true; 67 | extraPackages = [ pkgs.amdvlk ]; 68 | extraPackages32 = [ pkgs.pkgsi686Linux.libva ]; 69 | setLdLibraryPath = true; 70 | }; 71 | 72 | console = { 73 | # Enable setting virtual console options as early as possible (in initrd). 74 | earlySetup = true; 75 | # Provide a hi-dpi console font. 76 | packages = options.console.packages.default ++ [ pkgs.terminus_font ]; 77 | }; 78 | } 79 | -------------------------------------------------------------------------------- /roles/laptop.nix: -------------------------------------------------------------------------------- 1 | { inputs, pkgs, options, ... }: 2 | 3 | { 4 | imports = with inputs.self; [ 5 | roles.nixos 6 | ]; 7 | 8 | environment.systemPackages = with pkgs; [ 9 | acpi 10 | ]; 11 | } 12 | -------------------------------------------------------------------------------- /roles/nixos.nix: -------------------------------------------------------------------------------- 1 | { inputs, pkgs, lib, ... }: 2 | 3 | { 4 | imports = with inputs; [ 5 | self.roles.base 6 | self.profiles.boot 7 | self.profiles.btrfs 8 | self.profiles.dvorak 9 | self.profiles.network 10 | self.profiles.ssh 11 | self.profiles.zram 12 | ]; 13 | 14 | i18n.defaultLocale = "en_GB.UTF-8"; 15 | 16 | time.timeZone = "Europe/Zurich"; 17 | 18 | users.users.root.initialHashedPassword = ""; 19 | 20 | environment = { 21 | systemPackages = with pkgs; [ 22 | bridge-utils 23 | dconf 24 | fwupd 25 | fwupd-efi 26 | iproute 27 | lshw 28 | ncdu 29 | nixos-option 30 | nixos-update 31 | parted 32 | pciutils 33 | tunctl 34 | unzip 35 | usbutils 36 | ]; 37 | variables = { EDITOR = "nvim"; }; 38 | }; 39 | } 40 | -------------------------------------------------------------------------------- /roles/server.nix: -------------------------------------------------------------------------------- 1 | { inputs, lib, ... }: 2 | 3 | { 4 | imports = with inputs.self; [ 5 | roles.nixos 6 | ]; 7 | 8 | services.xserver.enable = lib.mkForce false; 9 | 10 | # Needed for NetworkManager 11 | services.dbus.enable = true; 12 | } 13 | --------------------------------------------------------------------------------