├── .github └── workflows │ ├── checks.yaml │ └── update.yaml ├── .gitignore ├── .vscode └── settings.json ├── .zed └── settings.json ├── README.md ├── common ├── default.nix ├── impure.nix └── profile.nix ├── flake-modules ├── args.nix ├── checks.nix ├── darwin.nix ├── default.nix ├── home.nix ├── installers.nix ├── linux.nix ├── modules.nix ├── nixvim.nix └── treefmt.nix ├── flake.lock ├── flake.nix ├── home ├── mlenz │ ├── common │ │ ├── channels │ │ │ ├── default.nix │ │ │ ├── stable.nix │ │ │ └── unstable.nix │ │ ├── default.nix │ │ ├── nix.nix │ │ ├── packages │ │ │ ├── commands.nix │ │ │ ├── default.nix │ │ │ └── workstation.nix │ │ └── programs │ │ │ ├── amethyst.nix │ │ │ ├── atuin.nix │ │ │ ├── bat.nix │ │ │ ├── bottom.nix │ │ │ ├── claude.nix │ │ │ ├── codex.nix │ │ │ ├── default.nix │ │ │ ├── direnv.nix │ │ │ ├── eza.nix │ │ │ ├── ghostty.nix │ │ │ ├── git.nix │ │ │ ├── macchina.nix │ │ │ ├── micro.nix │ │ │ ├── neovim.nix │ │ │ ├── nix-init.nix │ │ │ ├── plantuml.nix │ │ │ ├── poetry.nix │ │ │ ├── ruff.nix │ │ │ ├── shells.nix │ │ │ ├── ssh.nix │ │ │ ├── starship.nix │ │ │ ├── tex-fmt.nix │ │ │ ├── texlive.nix │ │ │ ├── tmux.nix │ │ │ ├── uv.nix │ │ │ ├── vscode.nix │ │ │ ├── wezterm.nix │ │ │ ├── zed.nix │ │ │ └── zellij.nix │ ├── darwin │ │ ├── default.nix │ │ └── infat.nix │ ├── dictionary.txt │ ├── linux │ │ ├── default.nix │ │ └── xserver.nix │ └── mlenz.jpg └── options │ ├── claude.nix │ ├── codex.nix │ ├── default.nix │ ├── infat.nix │ ├── macchina.nix │ ├── mackup.nix │ ├── neovim.nix │ └── texlive.nix ├── hosts ├── macbook-11-3 │ ├── default.nix │ └── hardware.nix ├── macbook-9-1 │ ├── default.nix │ └── hardware.nix ├── macpro │ ├── default.nix │ ├── hardware.nix │ └── timemachine.nix ├── orbstack │ ├── configuration.nix │ ├── default.nix │ └── hardware.nix └── raspi │ ├── default.nix │ └── hardware.nix ├── lib └── default.nix ├── overlays ├── by-name.nix ├── channels.nix ├── default.nix ├── functions │ ├── link-exe.nix │ ├── make-app.nix │ ├── make-builder.nix │ └── make-docker.nix ├── imports.nix ├── overrides.nix ├── packages │ ├── bibtex2cff.nix │ ├── bibtexbrowser.nix │ ├── bibtexbrowser2cff.nix │ ├── caddy-docker.nix │ ├── caddy.nix │ ├── claude-code │ │ ├── package-lock.json │ │ ├── package.json │ │ └── package.nix │ ├── config-builder │ │ ├── package.nix │ │ └── script.py │ ├── copilot-language-server.nix │ ├── dummy.nix │ ├── gibo.nix │ ├── github-theme-contrib.nix │ ├── goneovim-bin.nix │ ├── hkknx-bin.nix │ ├── hkknx-docker.nix │ ├── infat-bin.nix │ ├── janice.nix │ ├── protobuf-ls.nix │ ├── restic-browser-bin.nix │ ├── sioyek-bin.nix │ ├── ty-bin.nix │ ├── uv-migrator.nix │ ├── vimr-bin.nix │ ├── wol.nix │ └── zigstar-multitool-bin.nix └── vim-plugins │ ├── copilot-lua.nix │ ├── copilot-vim.nix │ ├── multicursor-nvim.nix │ └── multiple-cursors.nix ├── renovate.json ├── system ├── common │ ├── default.nix │ ├── nix.nix │ ├── options │ │ ├── default.nix │ │ └── secrets.nix │ ├── shell.nix │ ├── ssh.nix │ └── users.nix ├── darwin │ ├── builders │ │ ├── default.nix │ │ ├── nixbuild.nix │ │ └── orbstack.nix │ ├── channels │ │ ├── default.nix │ │ ├── stable.nix │ │ └── unstable.nix │ ├── default.nix │ ├── homebrew.nix │ ├── nix.nix │ ├── options │ │ └── default.nix │ ├── security.nix │ ├── settings.nix │ └── users.nix ├── installer.nix └── linux │ ├── channels │ ├── default.nix │ ├── stable.nix │ └── unstable.nix │ ├── default.nix │ ├── desktop.nix │ ├── network.nix │ ├── nix.nix │ ├── options │ ├── default.nix │ ├── docker.nix │ ├── podman.nix │ ├── quadlet │ │ ├── _container.nix │ │ ├── _vhost.nix │ │ ├── default.nix │ │ ├── proxy.nix │ │ └── wrapper.nix │ └── visiturl.nix │ ├── server.nix │ ├── ssh.nix │ └── xserver.nix └── vim ├── autocmd.nix ├── colorschemes.nix ├── default.nix ├── files ├── default.nix ├── python.nix └── tex.nix ├── keymaps.nix ├── lsp ├── default.nix ├── keymaps.nix ├── nixd.nix ├── pyright.nix └── texlab.nix ├── options ├── default.nix ├── multicursor.nix └── multiple-cursors.nix ├── performance.nix ├── plugins ├── blink.nix ├── copilot.nix ├── dap.nix ├── default.nix ├── lightbulb.nix ├── lualine.nix ├── multicursor.nix ├── multiple-cursors.nix ├── oil.nix ├── snacks │ ├── dashboard.nix │ ├── default.nix │ ├── keymaps.nix │ └── styles.nix ├── treesitter.nix ├── trouble.nix ├── which-key.nix ├── wrapping.nix └── yazi.nix ├── settings.nix └── spell.nix /.github/workflows/checks.yaml: -------------------------------------------------------------------------------- 1 | on: 2 | push: 3 | branches: 4 | - main 5 | pull_request: 6 | concurrency: 7 | group: ${{ github.workflow }}-${{ github.ref }} 8 | cancel-in-progress: true 9 | jobs: 10 | matrix: 11 | permissions: 12 | contents: read 13 | runs-on: ubuntu-latest 14 | outputs: 15 | matrix: ${{ steps.generate.outputs.matrix }} 16 | steps: 17 | - uses: actions/checkout@v4 18 | - uses: DeterminateSystems/nix-installer-action@v17 19 | with: 20 | extra-conf: | 21 | accept-flake-config = true 22 | - id: generate 23 | name: generate Matrix 24 | run: | 25 | set -Eeu 26 | echo "matrix=$(nix eval --json '.#githubActions.matrix')" >> "$GITHUB_OUTPUT" 27 | 28 | check-eval: 29 | permissions: 30 | contents: read 31 | runs-on: ubuntu-latest 32 | steps: 33 | - uses: actions/checkout@v4 34 | - uses: DeterminateSystems/nix-installer-action@v17 35 | with: 36 | extra-conf: | 37 | accept-flake-config = true 38 | - name: nix flake check 39 | run: | 40 | nix flake check \ 41 | --impure \ 42 | --print-build-logs \ 43 | --show-trace 44 | 45 | check-build-matrix: 46 | name: ${{ matrix.name }}.${{ matrix.system }} 47 | needs: matrix 48 | runs-on: ${{ matrix.os }} 49 | strategy: 50 | fail-fast: false 51 | matrix: ${{fromJSON(needs.matrix.outputs.matrix)}} 52 | steps: 53 | - uses: actions/checkout@v4 54 | - uses: DeterminateSystems/nix-installer-action@v17 55 | with: 56 | extra-conf: | 57 | accept-flake-config = true 58 | - uses: cachix/cachix-action@v16 59 | with: 60 | name: mirkolenz 61 | authToken: ${{ secrets.CACHIX_TOKEN }} 62 | - name: nix build 63 | run: | 64 | nix build \ 65 | --print-build-logs \ 66 | --show-trace \ 67 | --no-link \ 68 | '.#${{ matrix.attr }}' 69 | 70 | check-build: 71 | needs: check-build-matrix 72 | runs-on: ubuntu-latest 73 | if: always() 74 | steps: 75 | - run: | 76 | result="${{ needs.check-build-matrix.result }}" 77 | if [[ $result == "success" ]]; then 78 | exit 0 79 | else 80 | exit 1 81 | fi 82 | -------------------------------------------------------------------------------- /.github/workflows/update.yaml: -------------------------------------------------------------------------------- 1 | on: 2 | workflow_dispatch: 3 | schedule: 4 | - cron: "0 1 * * *" # every day at 1am UTC(!) 5 | concurrency: 6 | group: ${{ github.workflow }}-${{ github.ref }} 7 | cancel-in-progress: true 8 | jobs: 9 | update: 10 | runs-on: ubuntu-latest 11 | permissions: 12 | contents: write 13 | pull-requests: write 14 | steps: 15 | - uses: actions/create-github-app-token@v2 16 | id: generate-token 17 | with: 18 | app-id: ${{ secrets.APP_ID }} 19 | private-key: ${{ secrets.APP_KEY }} 20 | - uses: actions/checkout@v4 21 | - uses: DeterminateSystems/nix-installer-action@v17 22 | with: 23 | extra-conf: | 24 | accept-flake-config = true 25 | - uses: DeterminateSystems/update-flake-lock@v25 26 | id: update 27 | with: 28 | commit-msg: "chore(deps): update flake.lock" 29 | pr-title: "chore(deps): update flake.lock" 30 | token: ${{ steps.generate-token.outputs.token }} 31 | - name: automerge 32 | run: gh pr merge --auto --rebase ${{ steps.update.outputs.pull-request-number }} 33 | if: steps.update.outputs.pull-request-number != '' 34 | env: 35 | # if using a personal access token, workflows are run twice 36 | # first in the pr and then after merging 37 | GITHUB_TOKEN: ${{ github.token }} 38 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .env 2 | result 3 | result-* 4 | 5 | .vscode/* 6 | !.vscode/settings.json 7 | 8 | .zed/* 9 | !.zed/settings.json 10 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "nix.serverSettings": { 3 | "nixd": { 4 | "formatting": { 5 | "command": ["nixfmt"] 6 | }, 7 | "nixpkgs": { 8 | "expr": "import (builtins.getFlake (\"git:\" + builtins.toString ./.)).inputs.nixpkgs { }" 9 | }, 10 | "options": { 11 | "nixos": { 12 | "expr": "(builtins.getFlake (\"git:\" + builtins.toString ./.)).nixosConfigurations.orbstack.options" 13 | }, 14 | "home-manager": { 15 | "expr": "(builtins.getFlake (\"git:\" + builtins.toString ./.)).homeConfigurations.\"lenz@gpu.wi2.uni-trier.de\".options" 16 | }, 17 | "nix-darwin": { 18 | "expr": "(builtins.getFlake (\"git:\" + builtins.toString ./.)).darwinConfigurations.mirkos-macbook.options" 19 | }, 20 | "nixvim": { 21 | "expr": "(builtins.getFlake (\"git:\" + builtins.toString ./.)).nixvimConfigurations.${builtins.currentSystem}.unstable.options" 22 | }, 23 | "flake-parts": { 24 | "expr": "(builtins.getFlake (\"git:\" + builtins.toString ./.)).debug.options" 25 | }, 26 | "flake-parts-system": { 27 | "expr": "(builtins.getFlake (\"git:\" + builtins.toString ./.)).currentSystem.options" 28 | } 29 | } 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /.zed/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "lsp": { 3 | "nixd": { 4 | "settings": { 5 | "formatting": { 6 | "command": ["nixfmt"] 7 | }, 8 | "nixpkgs": { 9 | "expr": "import (builtins.getFlake (\"git:\" + builtins.toString ./.)).inputs.nixpkgs { }" 10 | }, 11 | "options": { 12 | "nixos": { 13 | "expr": "(builtins.getFlake (\"git:\" + builtins.toString ./.)).nixosConfigurations.orbstack.options" 14 | }, 15 | "home-manager": { 16 | "expr": "(builtins.getFlake (\"git:\" + builtins.toString ./.)).homeConfigurations.\"lenz@gpu.wi2.uni-trier.de\".options" 17 | }, 18 | "nix-darwin": { 19 | "expr": "(builtins.getFlake (\"git:\" + builtins.toString ./.)).darwinConfigurations.mirkos-macbook.options" 20 | }, 21 | "nixvim": { 22 | "expr": "(builtins.getFlake (\"git:\" + builtins.toString ./.)).nixvimConfigurations.${builtins.currentSystem}.unstable.options" 23 | }, 24 | "flake-parts": { 25 | "expr": "(builtins.getFlake (\"git:\" + builtins.toString ./.)).debug.options" 26 | }, 27 | "flake-parts-system": { 28 | "expr": "(builtins.getFlake (\"git:\" + builtins.toString ./.)).currentSystem.options" 29 | } 30 | } 31 | } 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /common/default.nix: -------------------------------------------------------------------------------- 1 | { lib', ... }: 2 | { 3 | imports = lib'.flocken.getModules ./.; 4 | } 5 | -------------------------------------------------------------------------------- /common/impure.nix: -------------------------------------------------------------------------------- 1 | args@{ 2 | lib, 3 | ... 4 | }: 5 | let 6 | osConfig = args.osConfig or { }; 7 | in 8 | { 9 | options.custom.impureRebuild = lib.mkEnableOption "impure rebuild"; 10 | config.custom.impureRebuild = lib.mkIf (osConfig != { }) ( 11 | lib.mkDefault osConfig.custom.impureRebuild 12 | ); 13 | } 14 | -------------------------------------------------------------------------------- /common/profile.nix: -------------------------------------------------------------------------------- 1 | args@{ 2 | lib, 3 | config, 4 | ... 5 | }: 6 | let 7 | cfg = config.custom.profile; 8 | osConfig = args.osConfig or { }; 9 | in 10 | { 11 | options.custom.profile = { 12 | isDesktop = lib.mkEnableOption "desktop"; 13 | isServer = lib.mkEnableOption "server"; 14 | isWorkstation = lib.mkEnableOption "workstation" // { 15 | default = cfg.isDesktop; 16 | }; 17 | isHeadless = lib.mkOption { 18 | type = lib.types.bool; 19 | readOnly = true; 20 | }; 21 | }; 22 | config.custom.profile = { 23 | isHeadless = !cfg.isDesktop || cfg.isServer; 24 | } // (osConfig.custom.profile or { }); 25 | } 26 | -------------------------------------------------------------------------------- /flake-modules/args.nix: -------------------------------------------------------------------------------- 1 | { 2 | self, 3 | inputs, 4 | lib', 5 | ... 6 | }: 7 | { 8 | _module.args = rec { 9 | nixpkgsArgs = { 10 | config = { 11 | allowUnfree = true; 12 | nvidia.acceptLicense = true; 13 | }; 14 | overlays = import ../overlays { 15 | inherit 16 | self 17 | inputs 18 | lib' 19 | ; 20 | inherit (nixpkgsArgs) config; 21 | }; 22 | }; 23 | 24 | # available during import 25 | specialModuleArgs = { 26 | inherit self inputs lib'; 27 | }; 28 | 29 | # can be overriden in module 30 | moduleArgs = { 31 | stateVersions = { 32 | linux = "25.05"; 33 | darwin = 6; 34 | home = "25.05"; 35 | }; 36 | user = { 37 | name = "Mirko Lenz"; 38 | mail = "mirko@mirkolenz.com"; 39 | login = "mlenz"; 40 | # https://github.com/mirkolenz.keys 41 | sshKeys = [ 42 | "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFT0P6ZLB5QOtEdpPHCF0frL3WJEQQGEpMf2r010gYH3" 43 | "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIq4FI/+G9JoUDXlUoKEdMtVnhapUScSqGg34r+jLgax" 44 | "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINQkHnDEuSYvI8WY7Mx73yS/WSLjRZs2tv8TtPREVOtg" 45 | "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHTD8HTidTJM3RLmU+WW7tBlDz6L2x8zoHJhqzA6m3+B" 46 | ]; 47 | }; 48 | }; 49 | }; 50 | } 51 | -------------------------------------------------------------------------------- /flake-modules/checks.nix: -------------------------------------------------------------------------------- 1 | { 2 | lib, 3 | self, 4 | inputs, 5 | ... 6 | }: 7 | let 8 | systems = [ 9 | "x86_64-linux" 10 | ]; 11 | extraPackages = pkgs: { 12 | inherit (pkgs) nixvim-unstable; 13 | }; 14 | filterPackages = 15 | name: value: 16 | !lib.elem name [ 17 | "bibtexbrowser2cff" 18 | ] 19 | && !lib.hasSuffix "-docker" name; 20 | in 21 | { 22 | flake.githubActions = inputs.nix-github-actions.lib.mkGithubMatrix { 23 | checks = lib.getAttrs systems ( 24 | lib.mapAttrs ( 25 | system: pkgs: (lib.filterAttrs filterPackages pkgs.exported-packages) // (extraPackages pkgs) 26 | ) self.legacyPackages 27 | ); 28 | }; 29 | } 30 | -------------------------------------------------------------------------------- /flake-modules/darwin.nix: -------------------------------------------------------------------------------- 1 | { 2 | inputs, 3 | specialModuleArgs, 4 | self, 5 | lib', 6 | lib, 7 | ... 8 | }: 9 | let 10 | mkDarwinSystem = 11 | hostName: 12 | { 13 | channel, 14 | system, 15 | computerName, 16 | extraModule ? { }, 17 | }: 18 | let 19 | os = "darwin"; 20 | nixDarwin = lib'.self.systemInput { 21 | inherit inputs channel os; 22 | name = "nix"; 23 | }; 24 | in 25 | nixDarwin.lib.darwinSystem { 26 | inherit system; 27 | specialArgs = specialModuleArgs // { 28 | inherit channel os; 29 | }; 30 | modules = [ 31 | extraModule 32 | self.darwinModules.default 33 | { 34 | networking = { 35 | inherit hostName computerName; 36 | }; 37 | } 38 | ] ++ lib'.flocken.optionalPath ../hosts/${hostName}; 39 | }; 40 | in 41 | { 42 | flake = { 43 | darwinConfigurations = lib.mapAttrs mkDarwinSystem { 44 | mirkos-macbook = { 45 | channel = "unstable"; 46 | system = "x86_64-darwin"; 47 | computerName = "Mirkos MacBook"; 48 | extraModule = { 49 | custom.profile.isDesktop = true; 50 | }; 51 | }; 52 | mirkos-macbook-arm = { 53 | channel = "unstable"; 54 | system = "x86_64-darwin"; 55 | computerName = "Mirkos MacBook Apple Silicon"; 56 | extraModule = { 57 | custom.profile.isDesktop = true; 58 | }; 59 | }; 60 | }; 61 | }; 62 | perSystem = 63 | { ... }: 64 | { 65 | packages = lib.mapAttrs' (name: module: { 66 | name = "darwin-config-${name}"; 67 | value = module.config.system.build.toplevel; 68 | }) self.darwinConfigurations; 69 | }; 70 | } 71 | -------------------------------------------------------------------------------- /flake-modules/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | lib', 3 | inputs, 4 | nixpkgsArgs, 5 | self, 6 | ... 7 | }: 8 | { 9 | imports = lib'.flocken.getModules ./.; 10 | perSystem = 11 | { 12 | pkgs, 13 | system, 14 | ... 15 | }: 16 | { 17 | _module.args.pkgs = import inputs.nixpkgs { 18 | inherit system; 19 | inherit (nixpkgsArgs) config overlays; 20 | }; 21 | legacyPackages = pkgs; 22 | packages = pkgs.exported-packages // { 23 | default = pkgs.mkBuilder { flake = self; }; 24 | }; 25 | }; 26 | flake = { 27 | lib = lib'.self; 28 | }; 29 | } 30 | -------------------------------------------------------------------------------- /flake-modules/home.nix: -------------------------------------------------------------------------------- 1 | { 2 | inputs, 3 | moduleArgs, 4 | specialModuleArgs, 5 | self, 6 | lib, 7 | lib', 8 | ... 9 | }: 10 | let 11 | mkHomeConfig = 12 | name: 13 | { 14 | channel, 15 | system, 16 | extraModule ? { }, 17 | }: 18 | let 19 | login = lib.head (lib.splitString "@" name); 20 | os = lib'.self.systemOs system; 21 | homeManager = lib'.self.systemInput { 22 | inherit inputs channel os; 23 | name = "home-manager"; 24 | }; 25 | in 26 | homeManager.lib.homeManagerConfiguration { 27 | pkgs = import homeManager.inputs.nixpkgs { inherit system; }; 28 | extraSpecialArgs = specialModuleArgs // { 29 | inherit channel os; 30 | osConfig = { }; 31 | }; 32 | modules = [ 33 | extraModule 34 | self.homeModules."${os}-standalone" 35 | { _module.args.user = lib.mkForce (moduleArgs.user // { inherit login; }); } 36 | ]; 37 | }; 38 | in 39 | { 40 | flake.homeConfigurations = lib.mapAttrs mkHomeConfig { 41 | "lenz@gpu.wi2.uni-trier.de" = { 42 | channel = "unstable"; 43 | system = "x86_64-linux"; 44 | }; 45 | }; 46 | perSystem = 47 | { ... }: 48 | { 49 | packages = lib.mapAttrs' (name: module: { 50 | name = "home-config-${name}"; 51 | value = module.activationPackage; 52 | }) self.homeConfigurations; 53 | }; 54 | } 55 | -------------------------------------------------------------------------------- /flake-modules/installers.nix: -------------------------------------------------------------------------------- 1 | { 2 | inputs, 3 | specialModuleArgs, 4 | moduleArgs, 5 | lib', 6 | lib, 7 | self, 8 | ... 9 | }: 10 | let 11 | mkInstaller = 12 | { 13 | system, 14 | channel, 15 | extraModule ? { }, 16 | }: 17 | let 18 | os = "linux"; 19 | nixpkgs = lib'.self.systemInput { 20 | inherit inputs channel os; 21 | name = "nixpkgs"; 22 | }; 23 | in 24 | nixpkgs.lib.nixosSystem { 25 | inherit system; 26 | specialArgs = specialModuleArgs // { 27 | inherit channel os; 28 | }; 29 | modules = [ 30 | extraModule 31 | self.nixosModules.installer 32 | { _module.args = moduleArgs; } 33 | ]; 34 | }; 35 | 36 | installer-raspi = mkInstaller { 37 | system = "aarch64-linux"; 38 | channel = "unstable"; # todo: change to "stable" for nixos 25.05 39 | extraModule = { 40 | imports = [ 41 | "${inputs.nixos-hardware}/raspberry-pi/4" 42 | ]; 43 | boot.tmp = { 44 | useTmpfs = true; 45 | tmpfsSize = "16G"; 46 | }; 47 | }; 48 | }; 49 | in 50 | { 51 | flake.legacyPackages = { 52 | aarch64-linux.installers.raspi = installer-raspi.config.system.build.images.sd-card; 53 | }; 54 | perSystem = 55 | { system, ... }: 56 | lib.optionalAttrs (lib.hasSuffix "-linux" system) { 57 | # TODO: add stable variant for nixos 25.05 58 | legacyPackages.installers = lib.genAttrs [ "unstable" ] ( 59 | channel: 60 | (mkInstaller { 61 | inherit system channel; 62 | }).config.system.build.images 63 | ); 64 | }; 65 | } 66 | -------------------------------------------------------------------------------- /flake-modules/linux.nix: -------------------------------------------------------------------------------- 1 | { 2 | inputs, 3 | specialModuleArgs, 4 | self, 5 | lib', 6 | lib, 7 | ... 8 | }: 9 | let 10 | mkLinuxSystem = 11 | hostName: 12 | { 13 | channel, 14 | system, 15 | extraModule ? { }, 16 | }: 17 | let 18 | os = "linux"; 19 | nixpkgs = lib'.self.systemInput { 20 | inherit inputs channel os; 21 | name = "nixpkgs"; 22 | }; 23 | in 24 | nixpkgs.lib.nixosSystem { 25 | inherit system; 26 | specialArgs = specialModuleArgs // { 27 | inherit channel os; 28 | }; 29 | modules = [ 30 | extraModule 31 | self.nixosModules.default 32 | { networking.hostName = hostName; } 33 | ] ++ lib'.flocken.optionalPath ../hosts/${hostName}; 34 | }; 35 | in 36 | { 37 | flake.nixosConfigurations = lib.mapAttrs mkLinuxSystem { 38 | orbstack = { 39 | channel = "unstable"; 40 | system = "x86_64-linux"; 41 | }; 42 | macpro = { 43 | channel = "stable"; 44 | system = "x86_64-linux"; 45 | }; 46 | raspi = { 47 | channel = "stable"; 48 | system = "aarch64-linux"; 49 | }; 50 | macbook-9-1 = { 51 | channel = "unstable"; 52 | system = "x86_64-linux"; 53 | }; 54 | macbook-11-3 = { 55 | channel = "unstable"; 56 | system = "x86_64-linux"; 57 | }; 58 | }; 59 | } 60 | -------------------------------------------------------------------------------- /flake-modules/modules.nix: -------------------------------------------------------------------------------- 1 | { 2 | specialModuleArgs, 3 | moduleArgs, 4 | nixpkgsArgs, 5 | inputs, 6 | self, 7 | lib', 8 | ... 9 | }: 10 | { 11 | flake = { 12 | systemModules.default = 13 | { channel, os, ... }: 14 | { 15 | imports = [ 16 | ../common 17 | ../system/common 18 | ]; 19 | nixpkgs = nixpkgsArgs; 20 | _module.args = moduleArgs; 21 | home-manager = { 22 | backupFileExtension = "backup"; 23 | useGlobalPkgs = true; 24 | useUserPackages = true; 25 | extraSpecialArgs = specialModuleArgs // { 26 | inherit channel os; 27 | }; 28 | }; 29 | }; 30 | homeModules.default = { 31 | imports = [ 32 | inputs.nix-index-database.hmModules.nix-index 33 | ../home/mlenz/common 34 | ../home/options 35 | ../common 36 | ]; 37 | _module.args = moduleArgs; 38 | }; 39 | homeModules.linux = { 40 | imports = [ 41 | ../home/mlenz/linux 42 | self.homeModules.default 43 | inputs.vscode-server.homeModules.default 44 | inputs.cosmic-manager.homeManagerModules.default 45 | ]; 46 | }; 47 | homeModules.darwin = { 48 | imports = [ 49 | ../home/mlenz/darwin 50 | self.homeModules.default 51 | ]; 52 | }; 53 | homeModules.linux-standalone = 54 | { pkgs, ... }: 55 | { 56 | nixpkgs = nixpkgsArgs; 57 | imports = [ self.homeModules.linux ]; 58 | targets.genericLinux.enable = pkgs.stdenv.isLinux; 59 | }; 60 | homeModules.darwin-standalone = { 61 | nixpkgs = nixpkgsArgs; 62 | imports = [ self.homeModules.darwin ]; 63 | }; 64 | nixosModules.default = 65 | { channel, os, ... }: 66 | let 67 | homeManager = lib'.self.systemInput { 68 | inherit inputs channel os; 69 | name = "home-manager"; 70 | }; 71 | in 72 | { 73 | imports = [ 74 | self.systemModules.default 75 | homeManager.nixosModules.default 76 | inputs.quadlet-nix.nixosModules.default 77 | ../system/linux 78 | { 79 | home-manager.users.mlenz = self.homeModules.linux; 80 | } 81 | ]; 82 | }; 83 | nixosModules.installer = ../system/installer.nix; 84 | darwinModules.default = 85 | { channel, os, ... }: 86 | let 87 | homeManager = lib'.self.systemInput { 88 | inherit inputs channel os; 89 | name = "home-manager"; 90 | }; 91 | in 92 | { 93 | imports = [ 94 | self.systemModules.default 95 | homeManager.darwinModules.default 96 | ../system/darwin 97 | { 98 | home-manager.users.mlenz = self.homeModules.darwin; 99 | } 100 | ]; 101 | }; 102 | }; 103 | } 104 | -------------------------------------------------------------------------------- /flake-modules/nixvim.nix: -------------------------------------------------------------------------------- 1 | { 2 | inputs, 3 | specialModuleArgs, 4 | moduleArgs, 5 | nixpkgsArgs, 6 | lib', 7 | self, 8 | lib, 9 | ... 10 | }: 11 | let 12 | mkNixvim = 13 | { channel, system }: 14 | let 15 | os = lib'.self.systemOs system; 16 | in 17 | inputs.nixvim.lib.evalNixvim { 18 | extraSpecialArgs = specialModuleArgs // { 19 | inherit channel os; 20 | }; 21 | modules = [ 22 | self.nixvimModules.default 23 | { 24 | _module.args = moduleArgs; 25 | nixpkgs = { 26 | hostPlatform = system; 27 | inherit (nixpkgsArgs) config overlays; 28 | source = lib'.self.systemInput { 29 | inherit inputs channel os; 30 | name = "nixpkgs"; 31 | }; 32 | }; 33 | } 34 | ]; 35 | }; 36 | in 37 | { 38 | imports = [ inputs.nixvim.flakeModules.default ]; 39 | nixvim = { 40 | packages = { 41 | enable = true; 42 | nameFunction = name: "nixvim-${name}"; 43 | }; 44 | checks = { 45 | enable = false; # they are manually added to the github actions matrix 46 | nameFunction = name: "nixvim-${name}"; 47 | }; 48 | }; 49 | flake.nixvimModules.default = ../vim; 50 | perSystem = 51 | { system, pkgs, ... }: 52 | { 53 | packages = { 54 | nvim = pkgs.nixvim; 55 | neovide = pkgs.writeShellApplication { 56 | name = "neovide"; 57 | text = '' 58 | ${lib.getExe pkgs.neovide} --neovim-bin ${lib.getExe pkgs.nixvim} "$@" 59 | ''; 60 | }; 61 | }; 62 | nixvimConfigurations = lib.genAttrs [ "unstable" ] (channel: mkNixvim { inherit channel system; }); 63 | }; 64 | } 65 | -------------------------------------------------------------------------------- /flake-modules/treefmt.nix: -------------------------------------------------------------------------------- 1 | { inputs, ... }: 2 | { 3 | imports = [ inputs.treefmt-nix.flakeModule ]; 4 | perSystem = 5 | { config, ... }: 6 | { 7 | treefmt = { 8 | projectRootFile = "flake.nix"; 9 | programs = { 10 | nixfmt.enable = true; 11 | prettier.enable = true; 12 | ruff-check.enable = true; 13 | ruff-format.enable = true; 14 | texfmt.enable = true; 15 | }; 16 | }; 17 | packages.treefmt-nix = config.treefmt.build.wrapper; 18 | }; 19 | } 20 | -------------------------------------------------------------------------------- /flake.nix: -------------------------------------------------------------------------------- 1 | { 2 | description = "NixOS / Home Manager / nix-darwin configuration files (@mirkolenz)"; 3 | 4 | # state dir: ~/.local/share/nix/trusted-settings.json 5 | nixConfig = { 6 | extra-substituters = [ 7 | "https://nix-community.cachix.org" 8 | "https://mirkolenz.cachix.org" 9 | ]; 10 | extra-trusted-public-keys = [ 11 | "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" 12 | "mirkolenz.cachix.org-1:R0dgCJ93t33K/gncNbKgUdJzwgsYVXeExRsZNz5jpho=" 13 | ]; 14 | }; 15 | 16 | inputs = { 17 | # Nixpkgs 18 | nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; 19 | nixpkgs-linux-unstable.url = "github:nixos/nixpkgs/nixos-unstable"; 20 | nixpkgs-linux-stable.url = "github:nixos/nixpkgs/nixos-25.05"; 21 | nixpkgs-darwin-unstable.follows = "nixpkgs"; 22 | nixpkgs-darwin-stable.url = "github:nixos/nixpkgs/nixpkgs-25.05-darwin"; 23 | nixpkgs-unstable-small.url = "github:nixos/nixpkgs/nixos-unstable-small"; 24 | nixpkgs-stable-small.url = "github:nixos/nixpkgs/nixos-25.05-small"; 25 | 26 | # Small helpers 27 | flake-parts = { 28 | url = "github:hercules-ci/flake-parts"; 29 | inputs.nixpkgs-lib.follows = "nixpkgs"; 30 | }; 31 | systems.url = "github:nix-systems/default"; 32 | nixos-hardware.url = "github:nixos/nixos-hardware"; 33 | treefmt-nix = { 34 | url = "github:numtide/treefmt-nix"; 35 | inputs.nixpkgs.follows = "nixpkgs"; 36 | }; 37 | 38 | # Nix Darwin 39 | nix-darwin-unstable = { 40 | url = "github:nix-darwin/nix-darwin"; 41 | inputs.nixpkgs.follows = "nixpkgs-darwin-unstable"; 42 | }; 43 | nix-darwin-stable = { 44 | url = "github:nix-darwin/nix-darwin/nix-darwin-25.05"; 45 | inputs.nixpkgs.follows = "nixpkgs-darwin-stable"; 46 | }; 47 | 48 | # Home Manager 49 | home-manager-linux-unstable = { 50 | url = "github:nix-community/home-manager"; 51 | inputs.nixpkgs.follows = "nixpkgs-linux-unstable"; 52 | }; 53 | home-manager-linux-stable = { 54 | url = "github:nix-community/home-manager/release-25.05"; 55 | inputs.nixpkgs.follows = "nixpkgs-linux-stable"; 56 | }; 57 | home-manager-darwin-unstable = { 58 | url = "github:nix-community/home-manager"; 59 | inputs.nixpkgs.follows = "nixpkgs-darwin-unstable"; 60 | }; 61 | home-manager-darwin-stable = { 62 | url = "github:nix-community/home-manager/release-25.05"; 63 | inputs.nixpkgs.follows = "nixpkgs-darwin-stable"; 64 | }; 65 | 66 | # NixVim 67 | nixvim = { 68 | url = "github:nix-community/nixvim"; 69 | inputs = { 70 | nixpkgs.follows = "nixpkgs"; 71 | flake-parts.follows = "flake-parts"; 72 | }; 73 | }; 74 | 75 | # My own 76 | flocken = { 77 | url = "github:mirkolenz/flocken/v2"; 78 | inputs = { 79 | nixpkgs.follows = "nixpkgs"; 80 | flake-parts.follows = "flake-parts"; 81 | systems.follows = "systems"; 82 | }; 83 | }; 84 | quadlet-nix = { 85 | url = "github:mirkolenz/quadlet-nix/v1"; 86 | inputs = { 87 | nixpkgs.follows = "nixpkgs"; 88 | flake-parts.follows = "flake-parts"; 89 | }; 90 | }; 91 | arguebuf = { 92 | url = "github:recap-utr/arguebuf-python/v2"; 93 | inputs = { 94 | nixpkgs.follows = "nixpkgs"; 95 | flake-parts.follows = "flake-parts"; 96 | flocken.follows = "flocken"; 97 | pyproject-nix.follows = "pyproject-nix"; 98 | uv2nix.follows = "uv2nix"; 99 | pyproject-build-systems.follows = "pyproject-build-systems"; 100 | treefmt-nix.follows = "treefmt-nix"; 101 | systems.follows = "systems"; 102 | }; 103 | }; 104 | 105 | # Python/uv 106 | pyproject-nix = { 107 | url = "github:pyproject-nix/pyproject.nix"; 108 | inputs.nixpkgs.follows = "nixpkgs"; 109 | }; 110 | uv2nix = { 111 | url = "github:pyproject-nix/uv2nix"; 112 | inputs = { 113 | pyproject-nix.follows = "pyproject-nix"; 114 | nixpkgs.follows = "nixpkgs"; 115 | }; 116 | }; 117 | pyproject-build-systems = { 118 | url = "github:pyproject-nix/build-system-pkgs"; 119 | inputs = { 120 | pyproject-nix.follows = "pyproject-nix"; 121 | uv2nix.follows = "uv2nix"; 122 | nixpkgs.follows = "nixpkgs"; 123 | }; 124 | }; 125 | 126 | # Utils 127 | vscode-server = { 128 | url = "github:nix-community/nixos-vscode-server"; 129 | inputs.nixpkgs.follows = "nixpkgs"; 130 | }; 131 | nix-index-database = { 132 | url = "github:mic92/nix-index-database"; 133 | inputs.nixpkgs.follows = "nixpkgs"; 134 | }; 135 | nix-github-actions = { 136 | url = "github:nix-community/nix-github-actions"; 137 | inputs.nixpkgs.follows = "nixpkgs"; 138 | }; 139 | nix-converter = { 140 | url = "github:theobori/nix-converter"; 141 | inputs.nixpkgs.follows = "nixpkgs"; 142 | }; 143 | codex = { 144 | url = "github:openai/codex"; 145 | inputs.nixpkgs.follows = "nixpkgs"; 146 | }; 147 | angrr = { 148 | url = "github:linyinfeng/angrr"; 149 | inputs = { 150 | nixpkgs.follows = "nixpkgs"; 151 | flake-parts.follows = "flake-parts"; 152 | treefmt-nix.follows = "treefmt-nix"; 153 | }; 154 | }; 155 | cosmic-manager = { 156 | url = "github:heitoraugustoln/cosmic-manager"; 157 | inputs = { 158 | nixpkgs.follows = "nixpkgs-linux-unstable"; 159 | home-manager.follows = "home-manager-linux-unstable"; 160 | flake-parts.follows = "flake-parts"; 161 | }; 162 | }; 163 | }; 164 | 165 | outputs = 166 | inputs@{ flake-parts, systems, ... }: 167 | flake-parts.lib.mkFlake 168 | { 169 | inherit inputs; 170 | specialArgs = { 171 | lib' = { 172 | self = import ./lib inputs.nixpkgs.lib; 173 | flocken = inputs.flocken.lib; 174 | }; 175 | }; 176 | } 177 | { 178 | debug = true; 179 | systems = import systems; 180 | imports = [ ./flake-modules ]; 181 | }; 182 | } 183 | -------------------------------------------------------------------------------- /home/mlenz/common/channels/default.nix: -------------------------------------------------------------------------------- 1 | { channel, ... }: 2 | { 3 | imports = [ ./${channel}.nix ]; 4 | } 5 | -------------------------------------------------------------------------------- /home/mlenz/common/channels/stable.nix: -------------------------------------------------------------------------------- 1 | { ... }: { } 2 | -------------------------------------------------------------------------------- /home/mlenz/common/channels/unstable.nix: -------------------------------------------------------------------------------- 1 | { ... }: { } 2 | -------------------------------------------------------------------------------- /home/mlenz/common/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | pkgs, 3 | lib', 4 | user, 5 | stateVersions, 6 | lib, 7 | config, 8 | ... 9 | }: 10 | { 11 | imports = lib'.flocken.getModules ./.; 12 | 13 | home = { 14 | stateVersion = stateVersions.home; 15 | username = user.login; 16 | homeDirectory = if pkgs.stdenv.isDarwin then "/Users/${user.login}" else "/home/${user.login}"; 17 | sessionVariables = { 18 | NIXPKGS_ALLOW_UNFREE = "1"; 19 | }; 20 | }; 21 | } 22 | -------------------------------------------------------------------------------- /home/mlenz/common/nix.nix: -------------------------------------------------------------------------------- 1 | { 2 | pkgs, 3 | lib, 4 | osConfig, 5 | os, 6 | channel, 7 | inputs, 8 | lib', 9 | ... 10 | }: 11 | { 12 | nix = lib.mkIf (osConfig == { }) { 13 | package = pkgs.nix; 14 | registry = lib'.self.mkRegistry { inherit inputs os channel; }; 15 | nixPath = [ "nixpkgs=flake:pkgs" ]; 16 | keepOldNixPath = false; 17 | settings = { 18 | experimental-features = [ 19 | "flakes" 20 | "impure-derivations" 21 | "nix-command" 22 | "no-url-literals" 23 | "pipe-operators" 24 | ]; 25 | accept-flake-config = true; 26 | bash-prompt-prefix = "(nix:$name)\\040"; 27 | log-lines = 1000; 28 | warn-dirty = false; 29 | }; 30 | gc = { 31 | automatic = true; 32 | options = "--delete-older-than 7d"; 33 | }; 34 | }; 35 | } 36 | -------------------------------------------------------------------------------- /home/mlenz/common/packages/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | pkgs, 3 | lib, 4 | lib', 5 | osConfig, 6 | config, 7 | ... 8 | }: 9 | { 10 | imports = lib'.flocken.getModules ./.; 11 | 12 | home.packages = with pkgs; [ 13 | zsh 14 | fish 15 | moreutils 16 | gnupg 17 | gnumake 18 | inetutils 19 | gcc 20 | zip 21 | unzip 22 | lsd 23 | fd 24 | procs 25 | sd 26 | tealdeer 27 | bandwhich 28 | delta 29 | fzf 30 | rsync 31 | wget 32 | ookla-speedtest 33 | restic 34 | autorestic 35 | sqlite 36 | icloudpd 37 | nixpkgs-review 38 | nix-output-monitor 39 | rlwrap 40 | wol 41 | # json parsing 42 | jaq 43 | jql 44 | yq 45 | dasel 46 | # bulk renaming 47 | massren 48 | mmv-go 49 | pipe-rename 50 | edir 51 | # required packages: https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/config/system-path.nix 52 | # acl # not available on darwin 53 | # attr # not available on darwin 54 | bashInteractive # bash with ncurses support 55 | bzip2 56 | coreutils-full 57 | cpio 58 | curl 59 | diffutils 60 | findutils 61 | gawk 62 | stdenv.cc.libc 63 | getent 64 | getconf 65 | gnugrep 66 | gnused 67 | gzip 68 | xz 69 | less 70 | # libcap # not available on darwin 71 | ncurses 72 | netcat 73 | mkpasswd 74 | procps 75 | # su # not available on darwin 76 | time 77 | util-linux 78 | which 79 | zstd 80 | ]; 81 | home.shellAliases = { 82 | cat = lib.getExe config.programs.bat.package; 83 | lg = lib.getExe config.programs.lazygit.package; 84 | l = "ll"; 85 | dc = "docker compose"; 86 | py = "${lib.getExe' config.programs.uv.package "uv"} run"; 87 | sudo = 88 | let 89 | customPaths = [ 90 | "${config.home.homeDirectory}/.nix-profile/bin" 91 | "/nix/var/nix/profiles/default/bin" 92 | "/nix/var/nix/profiles/default/sbin" 93 | ]; 94 | in 95 | lib.mkIf (osConfig == { }) 96 | ''/usr/bin/sudo env "PATH=${lib.concatStringsSep ":" customPaths}:$(/usr/bin/sudo printenv PATH)"''; 97 | }; 98 | } 99 | -------------------------------------------------------------------------------- /home/mlenz/common/packages/workstation.nix: -------------------------------------------------------------------------------- 1 | { 2 | pkgs, 3 | lib, 4 | config, 5 | ... 6 | }: 7 | let 8 | pythonWithPackages = pkgs.python3.withPackages (ps: with ps; [ typer ]); 9 | in 10 | lib.mkIf config.custom.profile.isWorkstation { 11 | home.sessionVariables = { 12 | RUST_SRC_PATH = pkgs.rustPlatform.rustLibSrc; 13 | EDITOR = "zed -w"; 14 | }; 15 | home.packages = with pkgs; [ 16 | exiftool 17 | fontforge 18 | unpaper 19 | buf 20 | gomplate 21 | grpcui 22 | mqttui 23 | plantuml 24 | pre-commit 25 | mu-repo 26 | yt-dlp 27 | cc2538-bsl 28 | imagemagick 29 | pngquant 30 | poppler_utils 31 | ffmpeg 32 | ffmpeg-normalize 33 | qpdf 34 | comrak 35 | mdbook 36 | treefmt-nix 37 | uv-migrator 38 | llm 39 | ghostscript 40 | janice 41 | harper 42 | protobuf-ls 43 | # typst 44 | typst 45 | typstyle 46 | tinymist 47 | # nix 48 | nixd 49 | nixfmt 50 | alejandra 51 | nix-update 52 | nvfetcher 53 | devenv 54 | nurl 55 | hydra-check 56 | nixos-render-docs 57 | nix-converter 58 | # go 59 | go 60 | gopls 61 | delve 62 | go-outline 63 | goreleaser 64 | # python 65 | pythonWithPackages 66 | pylyzer 67 | basedpyright 68 | ty-bin 69 | # nodejs 70 | nodejs 71 | nodePackages.prettier 72 | nodePackages.dotenv-vault 73 | npm-check-updates 74 | biome 75 | # java 76 | jdk 77 | # rust 78 | rustc 79 | cargo 80 | rustfmt 81 | clippy 82 | rust-analyzer 83 | # language servers 84 | taplo 85 | # my own packages 86 | makejinja 87 | arguebuf 88 | ]; 89 | } 90 | -------------------------------------------------------------------------------- /home/mlenz/common/programs/amethyst.nix: -------------------------------------------------------------------------------- 1 | { pkgs, lib, ... }: 2 | let 3 | yamlFormat = pkgs.formats.yaml { }; 4 | in 5 | lib.mkIf pkgs.stdenv.isDarwin { 6 | # https://github.com/ianyh/Amethyst/blob/development/.amethyst.sample.yml 7 | # https://github.com/ianyh/Amethyst/blob/development/Amethyst/default.amethyst 8 | home.file.".amethyst.yml".source = yamlFormat.generate "amethyst-config" { 9 | layout = [ 10 | "tall" 11 | "fullscreen" 12 | "wide" 13 | "column" 14 | ]; 15 | }; 16 | } 17 | -------------------------------------------------------------------------------- /home/mlenz/common/programs/atuin.nix: -------------------------------------------------------------------------------- 1 | { ... }: 2 | { 3 | programs.atuin = { 4 | enable = false; 5 | flags = [ 6 | "--disable-up-arrow" 7 | # "--disable-ctrl-r" 8 | ]; 9 | # https://docs.atuin.sh/configuration/config/ 10 | settings = { 11 | auto_sync = true; 12 | sync_frequency = "1h"; 13 | update_check = false; 14 | search_mode = "fuzzy"; 15 | enter_accept = true; 16 | keymap_mode = "vim-insert"; 17 | sync.records = true; 18 | dotfiles.enabled = false; 19 | }; 20 | }; 21 | } 22 | -------------------------------------------------------------------------------- /home/mlenz/common/programs/bat.nix: -------------------------------------------------------------------------------- 1 | { ... }: 2 | { 3 | programs.bat = { 4 | enable = true; 5 | }; 6 | } 7 | -------------------------------------------------------------------------------- /home/mlenz/common/programs/bottom.nix: -------------------------------------------------------------------------------- 1 | { ... }: 2 | { 3 | programs.bottom = { 4 | enable = true; 5 | settings = { 6 | # https://github.com/ClementTsang/bottom/blob/master/sample_configs/default_config.toml 7 | flags = { 8 | # Whether to hide the average cpu entry. 9 | #hide_avg_cpu = false 10 | # Whether to use dot markers rather than braille. 11 | #dot_marker = false 12 | # The update rate of the application. 13 | rate = 1000; 14 | # Whether to put the CPU legend to the left. 15 | #left_legend = false 16 | # Whether to set CPU% on a process to be based on the total CPU or just current usage. 17 | #current_usage = false 18 | # Whether to set CPU% on a process to be based on the total CPU or per-core CPU% (not divided by the number of cpus). 19 | #unnormalized_cpu = false 20 | # Whether to group processes with the same name together by default. 21 | #group_processes = false 22 | # Whether to make process searching case sensitive by default. 23 | #case_sensitive = false 24 | # Whether to make process searching look for matching the entire word by default. 25 | #whole_word = false 26 | # Whether to make process searching use regex by default. 27 | #regex = false 28 | # Defaults to Celsius. Temperature is one of: 29 | #temperature_type = "k" 30 | #temperature_type = "f" 31 | temperature_type = "c"; 32 | #temperature_type = "kelvin" 33 | #temperature_type = "fahrenheit" 34 | #temperature_type = "celsius" 35 | # The default time interval (in milliseconds). 36 | #default_time_value = 60000 37 | # The time delta on each zoom in/out action (in milliseconds). 38 | #time_delta = 15000 39 | # Hides the time scale. 40 | #hide_time = false 41 | # Override layout default widget 42 | #default_widget_type = "proc" 43 | #default_widget_count = 1 44 | # Expand selected widget upon starting the app 45 | #expanded_on_startup = true 46 | # Use basic mode 47 | #basic = false 48 | # Use the old network legend style 49 | #use_old_network_legend = false 50 | # Remove space in tables 51 | #hide_table_gap = false 52 | # Show the battery widgets 53 | #battery = false 54 | # Disable mouse clicks 55 | #disable_click = false 56 | # Built-in themes. Valid values are "default", "default-light", "gruvbox", "gruvbox-light", "nord", "nord-light" 57 | #color = "default" 58 | # Show memory values in the processes widget as values by default 59 | #mem_as_value = false 60 | # Show tree mode by default in the processes widget. 61 | #tree = false 62 | # Shows an indicator in table widgets tracking where in the list you are. 63 | #show_table_scroll_position = false 64 | # Show processes as their commands by default in the process widget. 65 | #process_command = false 66 | # Displays the network widget with binary prefixes. 67 | #network_use_binary_prefix = false 68 | # Displays the network widget using bytes. 69 | #network_use_bytes = false 70 | # Displays the network widget with a log scale. 71 | #network_use_log = false 72 | # Hides advanced options to stop a process on Unix-like systems. 73 | #disable_advanced_kill = false 74 | # Shows GPU(s) memory 75 | enable_gpu_memory = true; 76 | # Shows cache and buffer memory 77 | #enable_cache_memory = false 78 | # How much data is stored at once in terms of time. 79 | # retention = "10m" 80 | }; 81 | 82 | processes = { 83 | columns = [ 84 | "pid" 85 | "name" 86 | "cpu%" 87 | "mem%" 88 | "read" 89 | "write" 90 | "user" 91 | ]; 92 | }; 93 | }; 94 | }; 95 | } 96 | -------------------------------------------------------------------------------- /home/mlenz/common/programs/claude.nix: -------------------------------------------------------------------------------- 1 | { config, ... }: 2 | { 3 | programs.claude = { 4 | enable = config.custom.profile.isWorkstation; 5 | settings = { 6 | model = "opus"; 7 | }; 8 | }; 9 | } 10 | -------------------------------------------------------------------------------- /home/mlenz/common/programs/codex.nix: -------------------------------------------------------------------------------- 1 | { config, ... }: 2 | { 3 | programs.codex = { 4 | enable = config.custom.profile.isWorkstation; 5 | settings = { 6 | model = "codex-mini-latest"; 7 | }; 8 | }; 9 | } 10 | -------------------------------------------------------------------------------- /home/mlenz/common/programs/default.nix: -------------------------------------------------------------------------------- 1 | { lib', ... }: 2 | { 3 | imports = lib'.flocken.getModules ./.; 4 | 5 | programs = { 6 | btop.enable = true; 7 | carapace.enable = false; 8 | fastfetch.enable = true; 9 | gradle.enable = true; 10 | home-manager.enable = true; 11 | htop.enable = true; 12 | jq.enable = true; 13 | jqp.enable = true; 14 | nix-index.enable = true; 15 | pandoc.enable = true; 16 | pay-respects.enable = true; 17 | ripgrep.enable = true; 18 | yazi.enable = true; 19 | zoxide.enable = true; 20 | }; 21 | } 22 | -------------------------------------------------------------------------------- /home/mlenz/common/programs/direnv.nix: -------------------------------------------------------------------------------- 1 | { ... }: 2 | { 3 | programs.direnv = { 4 | enable = true; 5 | nix-direnv.enable = true; 6 | config = { 7 | global = { 8 | disable_stdin = true; 9 | hide_env_diff = true; 10 | load_dotenv = false; 11 | strict_env = true; 12 | warn_timeout = "0s"; 13 | # to silence the output 14 | # log_format = "-"; 15 | # log_filter = "^$"; 16 | }; 17 | }; 18 | }; 19 | } 20 | -------------------------------------------------------------------------------- /home/mlenz/common/programs/eza.nix: -------------------------------------------------------------------------------- 1 | { ... }: 2 | { 3 | programs.eza = { 4 | enable = true; 5 | extraOptions = [ 6 | "--long" 7 | "--group-directories-first" 8 | "--color=auto" 9 | "--time-style=long-iso" 10 | ]; 11 | git = true; 12 | icons = "auto"; 13 | }; 14 | } 15 | -------------------------------------------------------------------------------- /home/mlenz/common/programs/ghostty.nix: -------------------------------------------------------------------------------- 1 | { 2 | pkgs, 3 | lib, 4 | config, 5 | ... 6 | }: 7 | let 8 | mkSettings = lib.mapAttrs ( 9 | _: value: 10 | if lib.isList value then 11 | lib.concatStringsSep "," value 12 | else if lib.isAttrs value then 13 | lib.concatMapAttrsStringSep "," (k: v: "${k}:${v}") value 14 | else 15 | value 16 | ); 17 | in 18 | { 19 | programs.ghostty = { 20 | enable = config.custom.profile.isDesktop; 21 | package = if pkgs.stdenv.isDarwin then null else pkgs.ghostty; 22 | settings = mkSettings { 23 | cursor-click-to-move = true; 24 | font-family = "JetBrainsMono Nerd Font"; 25 | font-size = if pkgs.stdenv.isDarwin then 13 else 11; 26 | font-thicken = true; 27 | shell-integration = "none"; 28 | shell-integration-features = [ 29 | "no-cursor" 30 | "sudo" 31 | "title" 32 | ]; 33 | theme = { 34 | light = "GitHub-Light-Default"; 35 | dark = "GitHub-Dark-Default"; 36 | }; 37 | window-height = 30; 38 | window-padding-x = 8; 39 | window-padding-y = 8; 40 | window-width = 120; 41 | }; 42 | }; 43 | } 44 | -------------------------------------------------------------------------------- /home/mlenz/common/programs/git.nix: -------------------------------------------------------------------------------- 1 | { 2 | lib, 3 | pkgs, 4 | user, 5 | config, 6 | ... 7 | }: 8 | { 9 | home.packages = with pkgs; [ 10 | git-annex 11 | gibo 12 | git-ignore 13 | ]; 14 | programs.gh = { 15 | enable = true; 16 | settings = { 17 | git_protocol = "ssh"; 18 | }; 19 | }; 20 | programs.git = { 21 | enable = true; 22 | userName = user.name; 23 | userEmail = user.mail; 24 | lfs = { 25 | enable = true; 26 | }; 27 | difftastic = { 28 | enable = true; 29 | background = "dark"; 30 | color = "always"; 31 | display = "side-by-side"; # "side-by-side", "side-by-side-show-both", "inline" 32 | }; 33 | ignores = [ 34 | # nix 35 | ".devenv" 36 | ".direnv" 37 | ".env" 38 | ".envrc" 39 | "result" 40 | "result-*" 41 | # editors 42 | ".idea/*" 43 | ".vscode/*" 44 | ".zed/*" 45 | # https://github.com/github/gitignore/blob/main/Global/macOS.gitignore 46 | ".DS_Store" 47 | ".AppleDouble" 48 | ".LSOverride" 49 | "Icon[]" 50 | "._*" 51 | ".DocumentRevisions-V100" 52 | ".fseventsd" 53 | ".Spotlight-V100" 54 | ".TemporaryItems" 55 | ".Trashes" 56 | ".VolumeIcon.icns" 57 | ".com.apple.timemachine.donotpresent" 58 | ".AppleDB" 59 | ".AppleDesktop" 60 | "Network Trash Folder" 61 | "Temporary Items" 62 | ".apdisk" 63 | # linux 64 | "*~" 65 | ".fuse_hidden*" 66 | ".directory" 67 | ".Trash-*" 68 | ".nfs*" 69 | "nohup.out" 70 | # https://github.com/github/gitignore/blob/main/Global/Windows.gitignore 71 | "Thumbs.db" 72 | "Thumbs.db:encryptable" 73 | "ehthumbs.db" 74 | "ehthumbs_vista.db" 75 | "*.stackdump" 76 | "[Dd]esktop.ini" 77 | "$RECYCLE.BIN/" 78 | "*.cab" 79 | "*.msi" 80 | "*.msix" 81 | "*.msm" 82 | "*.msp" 83 | "*.lnk" 84 | ]; 85 | extraConfig = { 86 | core = { 87 | autocrlf = "input"; 88 | editor = config.home.sessionVariables.EDITOR; 89 | eol = "lf"; 90 | # not supported on linux 91 | # breaks nix flake operations with path references 92 | # https://github.com/NixOS/nix/issues/11567 93 | fsmonitor = lib.mkIf pkgs.stdenv.isDarwin false; 94 | }; 95 | feature = { 96 | manyFiles = true; 97 | }; 98 | column = { 99 | ui = "auto"; 100 | }; 101 | branch = { 102 | sort = "-committerdate"; 103 | }; 104 | tag = { 105 | sort = "version:refname"; 106 | }; 107 | help = { 108 | autocorrect = "prompt"; 109 | }; 110 | commit = { 111 | verbose = true; 112 | }; 113 | rerere = { 114 | enabled = true; 115 | autoupdate = true; 116 | }; 117 | fetch = { 118 | all = true; 119 | prune = true; 120 | pruneTags = true; 121 | writeCommitGraph = true; 122 | }; 123 | pull = { 124 | rebase = true; 125 | }; 126 | rebase = { 127 | autoStash = true; 128 | autoSquash = true; 129 | updateRefs = true; 130 | }; 131 | init = { 132 | defaultBranch = "main"; 133 | }; 134 | push = { 135 | followTags = true; 136 | autoSetupRemote = true; 137 | }; 138 | difftool = { 139 | prompt = false; 140 | vscode.cmd = "code -dnw --diff --new-window --wait $LOCAL $REMOTE"; 141 | kaleidoscope.cmd = "ksdiff --partial-changeset --relative-path $MERGED -- $LOCAL $REMOTE"; 142 | nvim.cmd = "nvim -c \"DiffviewOpen\""; 143 | }; 144 | diff = { 145 | algorithm = "histogram"; 146 | colorMoved = "plain"; 147 | mnemonicPrefix = true; 148 | renames = true; 149 | tool = lib.mkIf config.custom.profile.isDesktop "vscode"; 150 | }; 151 | mergetool = { 152 | prompt = false; 153 | vscode.cmd = "code --merge --new-window --wait $REMOTE $LOCAL $BASE $MERGED"; 154 | kaleidoscope.cmd = "ksdiff --merge --output $MERGED --base $BASE -- $LOCAL --snapshot $REMOTE --snapshot"; 155 | nvim.cmd = "nvim -c \"DiffviewOpen\""; 156 | }; 157 | merge = { 158 | tool = lib.mkIf config.custom.profile.isDesktop "vscode"; 159 | trustExitCode = true; 160 | conflictstyle = "zdiff3"; 161 | }; 162 | }; 163 | }; 164 | programs.jujutsu = { 165 | enable = true; 166 | settings = { 167 | user = { 168 | name = user.name; 169 | email = user.mail; 170 | }; 171 | }; 172 | }; 173 | programs.gitui = { 174 | enable = true; 175 | }; 176 | programs.lazygit = { 177 | enable = true; 178 | # https://github.com/jesseduffield/lazygit/blob/master/docs/Config.md 179 | settings = { 180 | gui = { 181 | border = "single"; 182 | nerdFontsVersion = "3"; 183 | showCommandLog = false; 184 | showFileTree = true; 185 | showNumstatInFilesView = true; 186 | showRandomTip = false; 187 | skipDiscardChangeWarning = false; 188 | skipNoStagedFilesWarning = true; 189 | skipRewordInEditorWarning = false; 190 | skipStashWarning = false; 191 | splitDiff = "always"; 192 | }; 193 | git = { 194 | commit.autoWrapCommitMessage = false; 195 | parseEmoji = true; 196 | }; 197 | os.editPreset = "zed"; 198 | update.method = "never"; 199 | disableStartupPopups = true; 200 | }; 201 | }; 202 | } 203 | -------------------------------------------------------------------------------- /home/mlenz/common/programs/macchina.nix: -------------------------------------------------------------------------------- 1 | { config, ... }: 2 | { 3 | programs.macchina = { 4 | enable = true; 5 | # https://github.com/Macchina-CLI/macchina/blob/main/macchina.toml 6 | settings = { 7 | long_uptime = false; 8 | long_shell = false; 9 | long_kernel = false; 10 | current_shell = true; 11 | physical_cores = true; 12 | theme = "Lithium"; 13 | }; 14 | themes = { 15 | Lithium = "${config.programs.macchina.package.src}/contrib/themes/Lithium.toml"; 16 | }; 17 | }; 18 | } 19 | -------------------------------------------------------------------------------- /home/mlenz/common/programs/micro.nix: -------------------------------------------------------------------------------- 1 | { ... }: 2 | { 3 | programs.micro = { 4 | enable = true; 5 | settings = { 6 | autoclose = true; 7 | autoindent = true; 8 | autosave = 0; 9 | backup = true; 10 | basename = false; 11 | colorcolumn = 0; 12 | comment = true; 13 | cursorline = true; 14 | diff = true; 15 | diffgutter = false; 16 | encoding = "utf-8"; 17 | eofnewline = true; 18 | fastdirty = true; 19 | fileformat = "unix"; 20 | filetype = "unknown"; 21 | ftoptions = true; 22 | hidehelp = false; 23 | ignorecase = false; 24 | indentchar = " "; 25 | infobar = true; 26 | keepautoindent = false; 27 | keymenu = false; 28 | linter = true; 29 | literate = true; 30 | matchbrace = false; 31 | matchbraceleft = false; 32 | mkparents = false; 33 | mouse = true; 34 | paste = false; 35 | pluginchannels = [ 36 | "https://raw.githubusercontent.com/micro-editor/plugin-channel/master/channel.json" 37 | ]; 38 | pluginrepos = [ ]; 39 | readonly = false; 40 | rmtrailingws = false; 41 | ruler = true; 42 | savecursor = false; 43 | savehistory = true; 44 | saveundo = false; 45 | scrollbar = false; 46 | scrollmargin = 3; 47 | scrollspeed = 2; 48 | smartpaste = true; 49 | softwrap = false; 50 | splitbottom = true; 51 | splitright = true; 52 | status = true; 53 | statusformatl = "$(filename) $(modified)($(line),$(col)) $(status.paste)| ft:$(opt:filetype) | $(opt:fileformat) | $(opt:encoding)"; 54 | statusformatr = "$(bind:ToggleKeyMenu): bindings, $(bind:ToggleHelp): help"; 55 | statusline = true; 56 | sucmd = "sudo"; 57 | syntax = true; 58 | tabmovement = false; 59 | tabsize = 4; 60 | tabstospaces = false; 61 | termtitle = false; 62 | useprimary = true; 63 | }; 64 | }; 65 | } 66 | -------------------------------------------------------------------------------- /home/mlenz/common/programs/neovim.nix: -------------------------------------------------------------------------------- 1 | { 2 | pkgs, 3 | config, 4 | lib, 5 | ... 6 | }: 7 | { 8 | custom.neovim = { 9 | enable = true; 10 | package = pkgs.nixvim; 11 | }; 12 | programs.neovide = { 13 | enable = config.custom.profile.isDesktop; 14 | settings = { 15 | fork = true; 16 | neovim-bin = lib.getExe config.custom.neovim.package; 17 | no-multigrid = true; 18 | }; 19 | }; 20 | } 21 | -------------------------------------------------------------------------------- /home/mlenz/common/programs/nix-init.nix: -------------------------------------------------------------------------------- 1 | { ... }: 2 | { 3 | programs.nix-init = { 4 | enable = true; 5 | settings = { 6 | maintainers = [ "mirkolenz" ]; 7 | nixpkgs = "builtins.getFlake \"nixpkgs\""; 8 | commit = false; 9 | }; 10 | }; 11 | } 12 | -------------------------------------------------------------------------------- /home/mlenz/common/programs/plantuml.nix: -------------------------------------------------------------------------------- 1 | { ... }: 2 | { 3 | home.file.".plantuml/init.puml".text = '' 4 | skinparam Monochrome true 5 | skinparam Shadowing false 6 | skinparam ComponentStyle uml2 7 | 8 | skinparam DefaultFontName Palatino 9 | ' skinparam DefaultFontName Fira Mono 10 | skinparam TitleFontName Fira Sans 11 | skinparam TitleFontStyle Bold 12 | ''; 13 | } 14 | -------------------------------------------------------------------------------- /home/mlenz/common/programs/poetry.nix: -------------------------------------------------------------------------------- 1 | { pkgs, ... }: 2 | { 3 | programs.poetry = { 4 | enable = true; 5 | package = pkgs.poetry.withPlugins ( 6 | ps: with ps; [ 7 | poetry-plugin-up 8 | poetry-plugin-export 9 | ] 10 | ); 11 | settings = { 12 | virtualenvs = { 13 | in-project = true; 14 | prefer-active-python = true; 15 | options = { 16 | no-pip = true; 17 | no-setuptools = true; 18 | }; 19 | }; 20 | }; 21 | }; 22 | } 23 | -------------------------------------------------------------------------------- /home/mlenz/common/programs/ruff.nix: -------------------------------------------------------------------------------- 1 | { ... }: 2 | { 3 | programs.ruff = { 4 | enable = true; 5 | settings = { }; 6 | }; 7 | } 8 | -------------------------------------------------------------------------------- /home/mlenz/common/programs/shells.nix: -------------------------------------------------------------------------------- 1 | { 2 | pkgs, 3 | lib, 4 | config, 5 | ... 6 | }: 7 | { 8 | home.shell.enableShellIntegration = true; 9 | programs.fish = { 10 | enable = true; 11 | # depends on programs.man.generateCaches 12 | generateCompletions = false; 13 | loginShellInit = '' 14 | fish_add_path "${config.home.homeDirectory}/bin" 15 | ''; 16 | interactiveShellInit = '' 17 | source ${pkgs.github-theme-contrib}/themes/fish/github_dark_default.fish 18 | ''; 19 | functions = { 20 | fish_greeting = { 21 | body = 22 | if pkgs.stdenv.isLinux then 23 | '' 24 | if set -q SSH_TTY; and status is-login 25 | ${lib.getExe config.programs.macchina.package} 26 | end 27 | '' 28 | else 29 | ""; 30 | description = "Override the default greeting"; 31 | }; 32 | # https://github.com/fish-shell/fish-shell/blob/master/share/functions/_validate_int.fish 33 | _validate_string = { 34 | noScopeShadowing = true; 35 | body = '' 36 | if not set -q _flag_value; or not test -n $_flag_value 37 | echo "Option $_flag_name is empty" >&2 38 | return 1 39 | end 40 | ''; 41 | }; 42 | divider = { 43 | body = '' 44 | set length (tput cols) 45 | set char = 46 | tput bold 47 | 48 | echo 49 | printf "%*s\n" $length "" | tr " " $char 50 | echo 51 | 52 | tput sgr0 53 | ''; 54 | description = "Print a bold horizontal line"; 55 | }; 56 | }; 57 | }; 58 | programs.zsh = { 59 | enable = true; 60 | autosuggestion.enable = true; 61 | enableCompletion = true; 62 | syntaxHighlighting.enable = true; 63 | }; 64 | programs.bash = { 65 | enable = true; 66 | enableCompletion = true; 67 | }; 68 | # this is slow 69 | programs.man.generateCaches = false; 70 | } 71 | -------------------------------------------------------------------------------- /home/mlenz/common/programs/ssh.nix: -------------------------------------------------------------------------------- 1 | { 2 | pkgs, 3 | lib, 4 | config, 5 | osConfig, 6 | ... 7 | }: 8 | let 9 | tomlFormat = pkgs.formats.toml { }; 10 | in 11 | { 12 | home.packages = lib.mkIf (pkgs.stdenv.isLinux && (osConfig.services.openssh.enable or true)) [ 13 | pkgs.shpool 14 | ]; 15 | programs.ssh = { 16 | enable = config.custom.profile.isDesktop; 17 | addKeysToAgent = if pkgs.stdenv.isDarwin then "yes" else "no"; 18 | includes = lib.mkIf pkgs.stdenv.isDarwin [ 19 | "${config.home.homeDirectory}/.orbstack/ssh/config" 20 | ]; 21 | matchBlocks = { 22 | "*" = { 23 | extraOptions = lib.mkMerge [ 24 | (lib.mkIf pkgs.stdenv.isDarwin { 25 | UseKeychain = "yes"; 26 | }) 27 | (lib.mkIf pkgs.stdenv.isLinux { 28 | IdentityAgent = "${config.home.homeDirectory}/.1password/agent.sock"; 29 | }) 30 | ]; 31 | identityFile = lib.mkIf pkgs.stdenv.isDarwin [ "id_ed25519" ]; 32 | }; 33 | "wi2gpu" = { 34 | hostname = "gpu.wi2.uni-trier.de"; 35 | forwardAgent = true; 36 | user = "lenz"; 37 | }; 38 | "macpro homeserver" = { 39 | hostname = "macpro.lenz.casa"; 40 | forwardAgent = true; 41 | user = "mlenz"; 42 | }; 43 | "raspi" = { 44 | hostname = "raspi.lenz.casa"; 45 | forwardAgent = true; 46 | user = "mlenz"; 47 | }; 48 | }; 49 | }; 50 | # https://developer.1password.com/docs/ssh/agent/config 51 | xdg.configFile."1Password/ssh/agent.toml" = 52 | lib.mkIf (osConfig.programs._1password-gui.enable or false) 53 | { 54 | source = tomlFormat.generate "1password-ssh-agent" { 55 | ssh-keys = [ 56 | { 57 | vault = "Mirko"; 58 | item = "mlenz@1password"; 59 | } 60 | ]; 61 | }; 62 | }; 63 | } 64 | -------------------------------------------------------------------------------- /home/mlenz/common/programs/starship.nix: -------------------------------------------------------------------------------- 1 | { lib, pkgs, ... }: 2 | { 3 | programs.starship = { 4 | enable = true; 5 | enableTransience = false; 6 | settings = lib.mkMerge [ 7 | (lib.importTOML "${pkgs.starship.src}/docs/public/presets/toml/nerd-font-symbols.toml") 8 | { 9 | add_newline = true; 10 | character = { 11 | success_symbol = "[](bold green)"; 12 | error_symbol = "[](bold red)"; 13 | }; 14 | container.format = "[$symbol]($style) "; 15 | direnv = { 16 | format = "[$symbol$loaded]($style) "; 17 | symbol = " "; 18 | loaded_msg = "loaded"; 19 | unloaded_msg = "unloaded"; 20 | disabled = false; 21 | }; 22 | nix_shell = { 23 | format = "via [$symbol$state]($style) "; 24 | impure_msg = "nix-shell"; 25 | pure_msg = "nix-shell"; 26 | unknown_msg = "nix-shell"; 27 | }; 28 | } 29 | ]; 30 | }; 31 | } 32 | -------------------------------------------------------------------------------- /home/mlenz/common/programs/tex-fmt.nix: -------------------------------------------------------------------------------- 1 | { ... }: 2 | { 3 | programs.tex-fmt = { 4 | enable = true; 5 | settings = { 6 | wrap = false; 7 | tabsize = 2; 8 | tabchar = "space"; 9 | lists = [ 10 | "enumerate*" 11 | "itemize*" 12 | "description*" 13 | ]; 14 | }; 15 | }; 16 | } 17 | -------------------------------------------------------------------------------- /home/mlenz/common/programs/texlive.nix: -------------------------------------------------------------------------------- 1 | { 2 | pkgs, 3 | config, 4 | lib, 5 | ... 6 | }: 7 | lib.mkIf pkgs.stdenv.isDarwin { 8 | custom.texlive = { 9 | enable = true; 10 | # package = pkgs.texliveFull.__overrideTeXConfig { withDocs = true; }; 11 | bibDir = "${config.home.homeDirectory}/Developer/mirkolenz/bibliography"; 12 | latexmkrc = '' 13 | # 1: pdflatex 14 | # 4: lualatex 15 | # 5: xelatex 16 | $pdf_mode = 1; 17 | 18 | # Regular 19 | $pdflatex = "pdflatex %O %S"; 20 | $xelatex = "xelatex %O %S"; 21 | $lualatex = "lualatex %O %S"; 22 | 23 | # Shell escape 24 | # $pdflatex = "pdflatex -shell-escape %O %S"; 25 | # $xelatex = "xelatex -shell-escape %O %S"; 26 | # $lualatex = "lualatex -shell-escape %O %S"; 27 | 28 | # Texmf path 29 | # $ENV{"TEXINPUTS"} = "./texmf//:" . $ENV{"TEXINPUTS"}; 30 | # $ENV{"BSTINPUTS"} = "./texmf//:" . $ENV{"BSTINPUTS"}; 31 | # $ENV{"BIBINPUTS"} = "./texmf//:" . $ENV{"BIBINPUTS"}; 32 | 33 | $postscript_mode = $dvi_mode = 0; 34 | $clean_ext = ""; 35 | $ENV{"TZ"} = "Europe/Berlin"; 36 | ''; 37 | }; 38 | home.packages = with pkgs; [ 39 | arxiv-latex-cleaner 40 | bibtex-tidy 41 | bibtex2cff 42 | bibtexbrowser2cff 43 | ltex-ls-plus 44 | sioyek-bin 45 | tectonic 46 | texlab 47 | zathura 48 | ]; 49 | } 50 | -------------------------------------------------------------------------------- /home/mlenz/common/programs/tmux.nix: -------------------------------------------------------------------------------- 1 | { 2 | osConfig, 3 | pkgs, 4 | lib, 5 | ... 6 | }: 7 | { 8 | programs.tmux = { 9 | enable = pkgs.stdenv.isLinux && (osConfig.services.openssh.enable or true); 10 | clock24 = true; 11 | keyMode = "vi"; 12 | mouse = true; 13 | newSession = true; 14 | shell = lib.getExe pkgs.fish; 15 | shortcut = "a"; 16 | terminal = "xterm-256color"; 17 | }; 18 | } 19 | -------------------------------------------------------------------------------- /home/mlenz/common/programs/uv.nix: -------------------------------------------------------------------------------- 1 | { pkgs, ... }: 2 | { 3 | programs.uv = { 4 | enable = true; 5 | package = pkgs.uv-bin; 6 | # https://docs.astral.sh/uv/reference/settings/ 7 | settings = { 8 | python-downloads = "manual"; 9 | python-preference = "system"; 10 | }; 11 | }; 12 | } 13 | -------------------------------------------------------------------------------- /home/mlenz/common/programs/vscode.nix: -------------------------------------------------------------------------------- 1 | { 2 | pkgs, 3 | config, 4 | ... 5 | }: 6 | { 7 | programs.vscode = { 8 | enable = pkgs.stdenv.isLinux && config.custom.profile.isDesktop; 9 | package = pkgs.vscode; 10 | }; 11 | } 12 | -------------------------------------------------------------------------------- /home/mlenz/common/programs/wezterm.nix: -------------------------------------------------------------------------------- 1 | { config, ... }: 2 | { 3 | programs.wezterm = { 4 | enable = config.custom.profile.isDesktop; 5 | extraConfig = '' 6 | return { 7 | color_scheme = "Github Dark (Gogh)", 8 | font = wezterm.font("JetBrainsMono Nerd Font"), 9 | font_size = 13.0, 10 | hide_tab_bar_if_only_one_tab = true, 11 | } 12 | ''; 13 | }; 14 | } 15 | -------------------------------------------------------------------------------- /home/mlenz/common/programs/zed.nix: -------------------------------------------------------------------------------- 1 | { 2 | pkgs, 3 | config, 4 | ... 5 | }: 6 | { 7 | programs.zed-editor = { 8 | enable = pkgs.stdenv.isLinux && config.custom.profile.isDesktop; 9 | }; 10 | } 11 | -------------------------------------------------------------------------------- /home/mlenz/common/programs/zellij.nix: -------------------------------------------------------------------------------- 1 | { pkgs, osConfig, ... }: 2 | { 3 | 4 | programs.zellij = { 5 | enable = pkgs.stdenv.isLinux && (osConfig.services.openssh.enable or true); 6 | enableBashIntegration = true; 7 | enableFishIntegration = true; 8 | enableZshIntegration = true; 9 | attachExistingSession = true; # requires shell integration 10 | exitShellOnExit = true; # requires shell integration 11 | settings = { 12 | auto_layout = true; 13 | default_layout = "default"; 14 | default_mode = "normal"; 15 | on_force_close = "detach"; 16 | show_release_notes = false; 17 | show_startup_tips = false; 18 | theme = "default"; 19 | }; 20 | }; 21 | } 22 | -------------------------------------------------------------------------------- /home/mlenz/darwin/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | pkgs, 3 | lib, 4 | config, 5 | lib', 6 | ... 7 | }: 8 | let 9 | mkLinkFarm = 10 | { 11 | name, 12 | paths, 13 | transform ? x: x, 14 | }: 15 | pkgs.linkFarm name ( 16 | lib.mapAttrsToList (name: value: { 17 | inherit name; 18 | path = transform value; 19 | }) paths 20 | ); 21 | in 22 | { 23 | imports = lib'.flocken.getModules ./.; 24 | 25 | home.packages = with pkgs; [ 26 | mas 27 | goneovim-bin 28 | restic-browser-bin 29 | undmg 30 | rcodesign 31 | vimr-bin 32 | infat-bin 33 | (writeShellApplication { 34 | name = "scansnap-reset"; 35 | text = '' 36 | pkill -f ScanSnap 37 | open --hide /Applications/ScanSnapHomeMain.app 38 | ''; 39 | }) 40 | ]; 41 | home.file = { 42 | "bin".source = mkLinkFarm { 43 | name = "home-bin"; 44 | paths = { 45 | git = config.programs.git.package; 46 | nvim = config.custom.neovim.package; 47 | restic = pkgs.restic; 48 | }; 49 | transform = lib.getExe; 50 | }; 51 | "Library/Group Containers/group.com.apple.AppleSpell/Library/Spelling/LocalDictionary" = { 52 | source = ../dictionary.txt; 53 | }; 54 | }; 55 | home.shellAliases = { 56 | copy = ''${lib.getExe' pkgs.coreutils "tr"} -d '\n' | pbcopy''; 57 | zed = "zed-preview"; 58 | }; 59 | } 60 | -------------------------------------------------------------------------------- /home/mlenz/darwin/infat.nix: -------------------------------------------------------------------------------- 1 | { ... }: 2 | { 3 | programs.infat = { 4 | enable = true; 5 | settings = { 6 | extensions = { 7 | md = "Zed Preview"; 8 | pdf = "PDF Expert"; 9 | }; 10 | schemes = { 11 | mailto = "Mail"; 12 | }; 13 | types = { 14 | plain-text = "Zed Preview"; 15 | }; 16 | }; 17 | }; 18 | } 19 | -------------------------------------------------------------------------------- /home/mlenz/dictionary.txt: -------------------------------------------------------------------------------- 1 | mirkolenz 2 | Argumentgraph 3 | -------------------------------------------------------------------------------- /home/mlenz/linux/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | pkgs, 3 | lib, 4 | lib', 5 | ... 6 | }: 7 | { 8 | imports = lib'.flocken.getModules ./.; 9 | 10 | home.packages = with pkgs; [ 11 | angrr 12 | cfspeedtest 13 | # https://unix.stackexchange.com/a/617686 14 | (writeShellApplication { 15 | name = "getusers"; 16 | text = '' 17 | ${lib.getExe' procps "ps"} -eo user,uid | ${lib.getExe gawk} 'NR>1 && $2 >= 1000 && ++seen[$2]==1{print $1}' 18 | ''; 19 | }) 20 | ]; 21 | } 22 | -------------------------------------------------------------------------------- /home/mlenz/linux/xserver.nix: -------------------------------------------------------------------------------- 1 | { 2 | lib, 3 | pkgs, 4 | config, 5 | ... 6 | }: 7 | lib.mkIf config.custom.profile.isDesktop { 8 | home.packages = with pkgs; [ 9 | inter 10 | jetbrains-mono 11 | nerd-fonts.jetbrains-mono 12 | ]; 13 | home.file.".face".source = ../mlenz.jpg; 14 | wayland.desktopManager.cosmic = { 15 | enable = true; 16 | appearance.theme.mode = "dark"; 17 | applets.app-list.settings = { 18 | enable_drag_source = true; 19 | favorites = [ 20 | "com.system76.CosmicFiles" 21 | "google-chrome" 22 | "1password" 23 | "obsidian" 24 | "code" 25 | "com.system76.CosmicEdit" 26 | "com.mitchellh.ghostty" 27 | "zotero" 28 | "Zoom" 29 | "com.system76.CosmicSettings" 30 | ]; 31 | filter_top_levels = null; 32 | }; 33 | }; 34 | programs = { 35 | cosmic-applibrary = { 36 | enable = true; 37 | settings.groups = [ ]; 38 | }; 39 | cosmic-edit = { 40 | enable = true; 41 | }; 42 | cosmic-files = { 43 | enable = true; 44 | }; 45 | cosmic-player = { 46 | enable = true; 47 | }; 48 | cosmic-store = { 49 | enable = false; 50 | }; 51 | cosmic-term = { 52 | enable = false; 53 | }; 54 | forecast = { 55 | enable = false; 56 | }; 57 | tasks = { 58 | enable = false; 59 | }; 60 | }; 61 | } 62 | -------------------------------------------------------------------------------- /home/mlenz/mlenz.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mirkolenz/nixos/f0ad76a73156c1803cff99df7945ff8824eaf2ce/home/mlenz/mlenz.jpg -------------------------------------------------------------------------------- /home/options/claude.nix: -------------------------------------------------------------------------------- 1 | { 2 | pkgs, 3 | config, 4 | lib, 5 | ... 6 | }: 7 | let 8 | inherit (lib) 9 | mkEnableOption 10 | mkPackageOption 11 | mkOption 12 | ; 13 | 14 | configFormat = pkgs.formats.json { }; 15 | cfg = config.programs.claude; 16 | in 17 | { 18 | meta.maintainers = with lib.maintainers; [ mirkolenz ]; 19 | 20 | options.programs.claude = { 21 | enable = mkEnableOption "claude-code"; 22 | 23 | package = mkPackageOption pkgs "claude-code" { nullable = true; }; 24 | 25 | settings = mkOption { 26 | type = configFormat.type; 27 | default = { }; 28 | description = '' 29 | Configuration written to 30 | {file}`$HOME/.claude/settings.json`. 31 | See 32 | for more information. 33 | ''; 34 | }; 35 | }; 36 | 37 | config = lib.mkIf cfg.enable { 38 | home.packages = lib.mkIf (cfg.package != null) [ cfg.package ]; 39 | 40 | home.file.".claude/settings.json" = lib.mkIf (cfg.settings != { }) { 41 | source = configFormat.generate "claude-settings" cfg.settings; 42 | }; 43 | }; 44 | } 45 | -------------------------------------------------------------------------------- /home/options/codex.nix: -------------------------------------------------------------------------------- 1 | { 2 | pkgs, 3 | config, 4 | lib, 5 | ... 6 | }: 7 | let 8 | inherit (lib) 9 | mkEnableOption 10 | mkPackageOption 11 | mkOption 12 | ; 13 | 14 | configFormat = pkgs.formats.toml { }; 15 | cfg = config.programs.codex; 16 | in 17 | { 18 | meta.maintainers = with lib.maintainers; [ mirkolenz ]; 19 | 20 | options.programs.codex = { 21 | enable = mkEnableOption "codex"; 22 | 23 | package = mkPackageOption pkgs "codex" { nullable = true; }; 24 | 25 | settings = mkOption { 26 | type = configFormat.type; 27 | default = { }; 28 | description = '' 29 | Configuration written to 30 | {file}`$HOME/.codex/config.toml`. 31 | See 32 | for more information. 33 | ''; 34 | }; 35 | }; 36 | 37 | config = lib.mkIf cfg.enable { 38 | home.packages = lib.mkIf (cfg.package != null) [ cfg.package ]; 39 | 40 | home.file.".codex/config.toml" = lib.mkIf (cfg.settings != { }) { 41 | source = configFormat.generate "codex-config" cfg.settings; 42 | }; 43 | }; 44 | } 45 | -------------------------------------------------------------------------------- /home/options/default.nix: -------------------------------------------------------------------------------- 1 | { lib', ... }: 2 | { 3 | imports = lib'.flocken.getModules ./.; 4 | } 5 | -------------------------------------------------------------------------------- /home/options/infat.nix: -------------------------------------------------------------------------------- 1 | { 2 | lib, 3 | config, 4 | pkgs, 5 | ... 6 | }: 7 | let 8 | cfg = config.programs.infat; 9 | tomlFormat = pkgs.formats.toml { }; 10 | infatSettings = tomlFormat.generate "infat-settings" cfg.settings; 11 | in 12 | { 13 | meta.maintainers = with lib.maintainers; [ mirkolenz ]; 14 | 15 | options = { 16 | programs.infat = { 17 | enable = lib.mkEnableOption "infat"; 18 | package = lib.mkPackageOption pkgs "infat-bin" { nullable = true; }; 19 | settings = lib.mkOption { 20 | type = tomlFormat.type; 21 | default = { }; 22 | example = lib.literalExpression '' 23 | { 24 | extensions = { 25 | md = "TextEdit"; 26 | html = "Safari"; 27 | pdf = "Preview"; 28 | }; 29 | schemes = { 30 | mailto = "Mail"; 31 | web = "Safari"; 32 | }; 33 | types = { 34 | plain-text = "VSCode"; 35 | }; 36 | } 37 | ''; 38 | description = '' 39 | Configuration written to 40 | {file}`$XDG_CONFIG_HOME/infat/config.toml`. 41 | ''; 42 | }; 43 | autoActivate = lib.mkEnableOption "auto-activate infat" // { 44 | default = true; 45 | example = false; 46 | description = '' 47 | Automatically activate infat on startup. 48 | This is useful if you want to use infat as a 49 | default application handler for certain file types. 50 | If you don't want this, set this to false. 51 | This option is only effective if `settings` is set. 52 | ''; 53 | }; 54 | }; 55 | }; 56 | config = lib.mkIf cfg.enable { 57 | assertions = [ 58 | (lib.hm.assertions.assertPlatform "programs.infat" pkgs lib.platforms.darwin) 59 | ]; 60 | home.packages = lib.mkIf (cfg.package != null) [ cfg.package ]; 61 | xdg.configFile."infat/config.toml" = lib.mkIf (cfg.settings != { }) { 62 | source = infatSettings; 63 | }; 64 | home.activation = lib.mkIf (cfg.settings != { } && cfg.package != null && cfg.autoActivate) { 65 | infat = lib.hm.dag.entryAfter [ "writeBoundary" ] '' 66 | run ${lib.getExe cfg.package} --quiet --config ${infatSettings} $VERBOSE_ARG 67 | ''; 68 | }; 69 | }; 70 | } 71 | -------------------------------------------------------------------------------- /home/options/macchina.nix: -------------------------------------------------------------------------------- 1 | { 2 | pkgs, 3 | config, 4 | lib, 5 | ... 6 | }: 7 | let 8 | inherit (lib) 9 | mkEnableOption 10 | mkPackageOption 11 | mkOption 12 | literalExpression 13 | types 14 | ; 15 | 16 | tomlFormat = pkgs.formats.toml { }; 17 | cfg = config.programs.macchina; 18 | in 19 | { 20 | meta.maintainers = with lib.maintainers; [ mirkolenz ]; 21 | 22 | options.programs.macchina = { 23 | enable = mkEnableOption "macchina"; 24 | 25 | package = mkPackageOption pkgs "macchina" { nullable = true; }; 26 | 27 | settings = mkOption { 28 | type = tomlFormat.type; 29 | default = { }; 30 | example = literalExpression '' 31 | { 32 | interface = "wlan0"; 33 | long_uptime = true; 34 | long_shell = false; 35 | long_kernel = false; 36 | current_shell = true; 37 | physical_cores = true; 38 | } 39 | ''; 40 | description = '' 41 | Configuration written to 42 | {file}`$XDG_CONFIG_HOME/macchina/macchina.toml`. 43 | See 44 | for more information. 45 | ''; 46 | }; 47 | 48 | themes = mkOption { 49 | type = types.attrsOf ( 50 | types.oneOf [ 51 | tomlFormat.type 52 | types.path 53 | types.str 54 | ] 55 | ); 56 | default = { }; 57 | example = literalExpression '' 58 | { 59 | Lithium = "''${config.programs.macchina.package.src}/contrib/themes/Lithium.toml"; 60 | } 61 | ''; 62 | description = '' 63 | Configuration written to 64 | {file}`$XDG_CONFIG_HOME/macchina/themes/*.toml`. 65 | ''; 66 | }; 67 | }; 68 | 69 | config = lib.mkIf cfg.enable { 70 | home.packages = lib.mkIf (cfg.package != null) [ cfg.package ]; 71 | 72 | xdg.configFile = lib.mkMerge [ 73 | { 74 | "macchina/macchina.toml" = lib.mkIf (cfg.settings != { }) { 75 | source = tomlFormat.generate "macchina-config" cfg.settings; 76 | }; 77 | # "macchina/themes" = lib.mkIf (cfg.themes != { }) { 78 | # source = pkgs.linkFarm "macchina-themes" ( 79 | # lib.mapAttrsToList (name: value: { 80 | # name = "${name}.toml"; 81 | # path = if lib.isAttrs value then tomlFormat.generate "macchina-theme-${name}" value else value; 82 | # }) cfg.themes 83 | # ); 84 | # }; 85 | } 86 | (lib.mkIf (cfg.themes != { }) ( 87 | lib.mapAttrs' (name: value: { 88 | name = "macchina/themes/${name}.toml"; 89 | value.source = 90 | if lib.isAttrs value then tomlFormat.generate "macchina-theme-${name}" value else value; 91 | }) cfg.themes 92 | )) 93 | ]; 94 | }; 95 | } 96 | -------------------------------------------------------------------------------- /home/options/mackup.nix: -------------------------------------------------------------------------------- 1 | { 2 | pkgs, 3 | lib, 4 | config, 5 | ... 6 | }: 7 | let 8 | cfg = config.custom.mackup; 9 | kvDefault = lib.generators.mkKeyValueDefault { } "="; 10 | iniFormat = pkgs.formats.ini { 11 | mkKeyValue = (k: v: if v == null then k else kvDefault k v); 12 | }; 13 | mkList = v: lib.genAttrs v (_: null); 14 | allAppNames = cfg.builtinApps ++ (lib.attrNames cfg.customApps); 15 | in 16 | { 17 | options.custom.mackup = { 18 | enable = lib.mkEnableOption "Mackup"; 19 | package = lib.mkPackageOption pkgs "mackup" { nullable = true; }; 20 | settings = lib.mkOption { 21 | type = with lib.types; attrsOf anything; 22 | description = "Settings for Mackup."; 23 | default = { }; 24 | example = { 25 | storage.engine = "icloud"; 26 | }; 27 | }; 28 | builtinApps = lib.mkOption { 29 | type = with lib.types; listOf str; 30 | description = "Built-in applications to sync."; 31 | default = [ ]; 32 | }; 33 | customApps = lib.mkOption { 34 | type = with lib.types; attrsOf anything; 35 | description = "Custom applications to sync."; 36 | default = { }; 37 | }; 38 | }; 39 | config = lib.mkIf cfg.enable { 40 | home.file = 41 | { 42 | ".mackup.cfg".source = iniFormat.generate "mackup-config" ( 43 | cfg.settings // { applications_to_sync = mkList allAppNames; } 44 | ); 45 | } 46 | // (lib.mapAttrs' (name: value: { 47 | name = ".mackup/${name}.cfg"; 48 | value = { 49 | source = iniFormat.generate "mackup-config-${name}" value; 50 | }; 51 | }) cfg.customApps); 52 | home.packages = lib.mkIf (cfg.package != null) [ cfg.package ]; 53 | }; 54 | } 55 | -------------------------------------------------------------------------------- /home/options/neovim.nix: -------------------------------------------------------------------------------- 1 | { 2 | lib, 3 | config, 4 | pkgs, 5 | ... 6 | }: 7 | let 8 | cfg = config.custom.neovim; 9 | in 10 | { 11 | options = { 12 | custom.neovim = { 13 | enable = lib.mkEnableOption "neovim"; 14 | package = lib.mkPackageOption pkgs "nvim" { nullable = true; }; 15 | defaultEditor = (lib.mkEnableOption "set vim as default editor") // { 16 | default = true; 17 | }; 18 | }; 19 | }; 20 | config = lib.mkIf cfg.enable { 21 | home = { 22 | packages = lib.mkIf (cfg.package != null) [ cfg.package ]; 23 | sessionVariables = { 24 | EDITOR = lib.mkIf cfg.defaultEditor (lib.mkDefault "nvim"); 25 | }; 26 | }; 27 | }; 28 | } 29 | -------------------------------------------------------------------------------- /home/options/texlive.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | lib, 4 | pkgs, 5 | ... 6 | }: 7 | let 8 | cfg = config.custom.texlive; 9 | 10 | acronymPresetToList = lib.mapAttrsToList (name: value: "${name}=${value}"); 11 | acronymReplacements = lib.mapAttrsToList ( 12 | name: preset: "sd -F 'preset=${name}' '${lib.concatStringsSep ", " (acronymPresetToList preset)}'" 13 | ) cfg.acronymPresets; 14 | 15 | cmdTexts = { 16 | texmfup = '' 17 | rm -rf ./texmf 18 | mkdir ./texmf 19 | ${lib.getExe pkgs.curl} --location https://github.com/mirkolenz/texmf/archive/refs/heads/main.tar.gz \ 20 | | ${lib.getExe pkgs.gnutar} xz --strip-components=1 --directory="./texmf" 21 | ''; 22 | latexmkrc = '' 23 | exec cp -f ${config.home.file.".latexmkrc".source} "''${1:-.latexmkrc}" 24 | ''; 25 | bibtidy = '' 26 | ${lib.getExe pkgs.bibtex-tidy} --v2 \ 27 | --no-align --no-wrap --blank-lines --no-escape \ 28 | --omit="${lib.concatStringsSep "," cfg.bibtidyOmit}" \ 29 | --max-authors="${toString cfg.bibtidyMaxAuthors}" \ 30 | "$@" 31 | ''; 32 | bibcat = '' 33 | format="''${1:-bibtex}" 34 | sourceDir="''${2:-${cfg.bibDir}}" 35 | ${lib.getExe cmds.bibtidy} "$sourceDir/$format.bib" 36 | ''; 37 | bibcopy = '' 38 | format="''${1:-bibtex}" 39 | sourceDir="''${2:-${cfg.bibDir}}" 40 | targetDir="''${3:-.}" 41 | ${lib.getExe cmds.bibtidy} --output="$targetDir/references.bib" "$sourceDir/$format.bib" 42 | ${lib.getExe cmds.acrocat} "$sourceDir" > "$targetDir/acronyms.tex" 43 | ''; 44 | bibcopy-full = '' 45 | format="''${1:-bibtex}" 46 | sourceDir="''${2:-${cfg.bibDir}}" 47 | targetDir="''${3:-.}" 48 | ${lib.getExe pkgs.bibtex-tidy} --v2 \ 49 | --no-align --no-wrap --blank-lines --no-escape \ 50 | --omit="abstract" \ 51 | --output="$targetDir/references.bib" \ 52 | "$sourceDir/$format.bib" 53 | ${lib.getExe cmds.acrocat} "$sourceDir" > "$targetDir/acronyms.tex" 54 | ''; 55 | acrocat = '' 56 | sourceDir="''${1:-${cfg.bibDir}}" 57 | # shellcheck disable=SC2002 # the sd commands are generated via nix, so cat is more elegant than piping 58 | cat "$sourceDir/acronyms.tex" | ${lib.concatStringsSep " | " acronymReplacements} 59 | ''; 60 | }; 61 | 62 | cmds = lib.mapAttrs (name: text: pkgs.writeShellApplication { inherit name text; }) cmdTexts; 63 | in 64 | { 65 | options = { 66 | # https://github.com/NixOS/nixpkgs/blob/master/doc/languages-frameworks/texlive.section.md 67 | custom.texlive = { 68 | enable = lib.mkEnableOption "TeX Live"; 69 | 70 | package = lib.mkPackageOption pkgs "TeX Live Scheme" { 71 | default = [ "texliveFull" ]; 72 | example = "pkgs.texliveSmall"; 73 | }; 74 | 75 | bibDir = lib.mkOption { 76 | type = lib.types.str; 77 | default = ""; 78 | description = "Location of the bibliography files."; 79 | }; 80 | 81 | latexmkrc = lib.mkOption { 82 | type = lib.types.lines; 83 | description = "Content of the .latexmkrc file."; 84 | }; 85 | 86 | acronymPresets = lib.mkOption { 87 | type = with lib.types; attrsOf anything; 88 | description = "Acronym presets to use."; 89 | default = { 90 | short = { 91 | first-style = "short"; 92 | long = "{}"; 93 | }; 94 | }; 95 | }; 96 | 97 | bibtidyMaxAuthors = lib.mkOption { 98 | type = lib.types.int; 99 | description = "Maximum number of authors to display."; 100 | default = 10; 101 | }; 102 | 103 | bibtidyOmit = lib.mkOption { 104 | type = with lib.types; listOf str; 105 | description = "Fields to omit from the bibliography."; 106 | default = [ 107 | "abstract" 108 | "address" 109 | "annotation" 110 | "archiveprefix" 111 | "chapter" 112 | "copyright" 113 | "doi" 114 | "edition" 115 | "editor" 116 | "eprint" 117 | "googlebooks" 118 | "isbn" 119 | "issn" 120 | "langid" 121 | "language" 122 | "lccn" 123 | "month" 124 | "number" 125 | "pmcid" 126 | "pmid" 127 | "primaryclass" 128 | "series" 129 | "url" 130 | "urldate" 131 | "volume" 132 | # "eprinttype" 133 | # "pages" 134 | # "publisher" 135 | ]; 136 | }; 137 | }; 138 | }; 139 | 140 | config = lib.mkIf cfg.enable { 141 | home = { 142 | packages = [ cfg.package ] ++ (lib.optionals (cfg.bibDir != "") (lib.attrValues cmds)); 143 | file = { 144 | ".latexmkrc".source = pkgs.writeText "latexmkrc" cfg.latexmkrc; 145 | }; 146 | }; 147 | }; 148 | } 149 | -------------------------------------------------------------------------------- /hosts/macbook-11-3/default.nix: -------------------------------------------------------------------------------- 1 | { config, inputs, ... }: 2 | { 3 | imports = [ 4 | "${inputs.nixos-hardware}/apple" 5 | "${inputs.nixos-hardware}/common/cpu/intel/haswell" 6 | "${inputs.nixos-hardware}/common/gpu/nvidia/kepler" 7 | "${inputs.nixos-hardware}/common/pc/ssd" 8 | ./hardware.nix 9 | ]; 10 | custom.profile.isDesktop = true; 11 | 12 | boot.binfmt.emulatedSystems = [ "aarch64-linux" ]; 13 | boot.loader = { 14 | systemd-boot.enable = true; 15 | efi = { 16 | canTouchEfiVariables = true; 17 | efiSysMountPoint = "/boot/efi"; 18 | }; 19 | }; 20 | 21 | services.xserver.videoDrivers = [ "nvidiaLegacy470" ]; 22 | hardware.nvidia = { 23 | package = config.boot.kernelPackages.nvidiaPackages.legacy_470; 24 | prime = { 25 | nvidiaBusId = "PCI:1:0:0"; 26 | intelBusId = "PCI:0:2:0"; 27 | }; 28 | }; 29 | 30 | hardware.facetimehd = { 31 | enable = true; 32 | withCalibration = true; 33 | }; 34 | 35 | # Enable the iGPU by default if present 36 | boot.extraModprobeConfig = '' 37 | options apple-gmux force_igd=y 38 | ''; 39 | 40 | # https://gist.github.com/wmealing/2dd2b543c4d3cff6cab7 41 | # https://askubuntu.com/a/1242574 42 | # https://www.reddit.com/r/mac/comments/9pyort/apple_macbook_pro_sudden_crash_fix_for_models/ 43 | # https://www.thomas-krenn.com/en/wiki/Processor_P-states_and_C-states 44 | boot.kernelParams = [ 45 | # disable intel_idle 46 | "intel_idle.max_cstate=0" 47 | # allow acpi_idle states C0-C3 (sleep) 48 | # "processor.max_cstate=3" 49 | ]; 50 | } 51 | -------------------------------------------------------------------------------- /hosts/macbook-11-3/hardware.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | lib, 4 | modulesPath, 5 | ... 6 | }: 7 | { 8 | imports = [ (modulesPath + "/installer/scan/not-detected.nix") ]; 9 | boot.initrd.availableKernelModules = [ 10 | "xhci_pci" 11 | "ahci" 12 | "usbhid" 13 | "usb_storage" 14 | "sd_mod" 15 | ]; 16 | boot.initrd.kernelModules = [ ]; 17 | boot.kernelModules = [ 18 | "kvm-intel" 19 | "wl" 20 | ]; 21 | boot.extraModulePackages = [ config.boot.kernelPackages.broadcom_sta ]; 22 | fileSystems."/" = { 23 | device = "/dev/disk/by-label/root"; 24 | fsType = "ext4"; 25 | }; 26 | fileSystems."/boot/efi" = { 27 | device = "/dev/disk/by-label/boot"; 28 | fsType = "vfat"; 29 | }; 30 | swapDevices = [ { device = "/dev/disk/by-label/swap"; } ]; 31 | 32 | nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; 33 | hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; 34 | } 35 | -------------------------------------------------------------------------------- /hosts/macbook-9-1/default.nix: -------------------------------------------------------------------------------- 1 | { config, inputs, ... }: 2 | { 3 | imports = [ 4 | "${inputs.nixos-hardware}/apple" 5 | "${inputs.nixos-hardware}/common/cpu/intel/sandy-bridge" 6 | "${inputs.nixos-hardware}/common/gpu/nvidia/kepler" 7 | "${inputs.nixos-hardware}/common/pc/ssd" 8 | ./hardware.nix 9 | ]; 10 | custom.profile.isDesktop = true; 11 | 12 | boot.binfmt.emulatedSystems = [ "aarch64-linux" ]; 13 | boot.loader = { 14 | systemd-boot.enable = true; 15 | efi = { 16 | canTouchEfiVariables = true; 17 | efiSysMountPoint = "/boot"; 18 | }; 19 | }; 20 | 21 | services.xserver.videoDrivers = [ "nvidiaLegacy470" ]; 22 | hardware.nvidia = { 23 | package = config.boot.kernelPackages.nvidiaPackages.legacy_470; 24 | prime = { 25 | nvidiaBusId = "PCI:1:0:0"; 26 | intelBusId = "PCI:0:2:0"; 27 | }; 28 | }; 29 | 30 | hardware.facetimehd = { 31 | enable = true; 32 | withCalibration = true; 33 | }; 34 | } 35 | -------------------------------------------------------------------------------- /hosts/macbook-9-1/hardware.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | lib, 4 | modulesPath, 5 | ... 6 | }: 7 | { 8 | imports = [ (modulesPath + "/installer/scan/not-detected.nix") ]; 9 | boot.initrd.availableKernelModules = [ 10 | "xhci_pci" 11 | "ehci_pci" 12 | "ahci" 13 | "firewire_ohci" 14 | "usbhid" 15 | "usb_storage" 16 | "sd_mod" 17 | "sr_mod" 18 | "sdhci_pci" 19 | ]; 20 | boot.initrd.kernelModules = [ ]; 21 | boot.kernelModules = [ 22 | "kvm-intel" 23 | "wl" 24 | ]; 25 | boot.extraModulePackages = [ config.boot.kernelPackages.broadcom_sta ]; 26 | fileSystems."/" = { 27 | device = "/dev/disk/by-label/root"; 28 | fsType = "ext4"; 29 | }; 30 | fileSystems."/boot" = { 31 | device = "/dev/disk/by-label/boot"; 32 | fsType = "vfat"; 33 | }; 34 | swapDevices = [ { device = "/dev/disk/by-label/swap"; } ]; 35 | 36 | nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; 37 | hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; 38 | } 39 | -------------------------------------------------------------------------------- /hosts/macpro/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | pkgs, 3 | lib, 4 | lib', 5 | inputs, 6 | ... 7 | }: 8 | { 9 | imports = [ 10 | "${inputs.nixos-hardware}/apple" 11 | "${inputs.nixos-hardware}/common/cpu/intel/cpu-only.nix" 12 | "${inputs.nixos-hardware}/common/gpu/amd" 13 | "${inputs.nixos-hardware}/common/pc/ssd" 14 | ./hardware.nix 15 | ./timemachine.nix 16 | ] ++ lib'.flocken.optionalPath "/etc/nixos/default.nix"; 17 | 18 | custom.profile.isServer = true; 19 | custom.impureRebuild = true; 20 | 21 | boot.binfmt.emulatedSystems = [ "aarch64-linux" ]; 22 | 23 | boot.loader = { 24 | systemd-boot.enable = true; 25 | efi = { 26 | canTouchEfiVariables = true; 27 | efiSysMountPoint = "/boot"; 28 | }; 29 | }; 30 | 31 | # https://nixos.wiki/wiki/Hardware/Apple 32 | # https://superuser.com/a/1051137 33 | systemd.services.autorestart-powerloss = { 34 | script = "${lib.getExe' pkgs.pciutils "setpci"} -s 00:1f.0 0xa4.b=0"; 35 | wantedBy = [ "multi-user.target" ]; 36 | after = [ "multi-user.target" ]; 37 | }; 38 | 39 | # systemd.network.links."20-ethernet0" = { 40 | # # matchConfig.OriginalName = "enp9s0"; 41 | # matchConfig.PermanentMACAddress = "40:6c:8f:b8:58:95"; 42 | # linkConfig.Name = "ethernet0"; 43 | # }; 44 | # systemd.network.links."20-ethernet1" = { 45 | # # matchConfig.OriginalName = "enp10s0"; 46 | # matchConfig.PermanentMACAddress = "40:6c:8f:b8:78:b3"; 47 | # linkConfig.Name = "ethernet1"; 48 | # }; 49 | systemd.network.networks."20-failover" = { 50 | matchConfig.Name = "enp10s0"; 51 | linkConfig.RequiredForOnline = false; 52 | DHCP = "yes"; 53 | }; 54 | 55 | services.tailscale = { 56 | extraSetFlags = [ 57 | "--advertise-exit-node" 58 | ]; 59 | useRoutingFeatures = "server"; 60 | }; 61 | 62 | powerManagement.cpuFreqGovernor = "powersave"; 63 | } 64 | -------------------------------------------------------------------------------- /hosts/macpro/hardware.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 | { 5 | config, 6 | lib, 7 | modulesPath, 8 | ... 9 | }: 10 | { 11 | imports = [ (modulesPath + "/installer/scan/not-detected.nix") ]; 12 | 13 | boot.initrd.availableKernelModules = [ 14 | "uhci_hcd" 15 | "ehci_pci" 16 | "ahci" 17 | "firewire_ohci" 18 | "usb_storage" 19 | "usbhid" 20 | "sd_mod" 21 | "sr_mod" 22 | ]; 23 | boot.initrd.kernelModules = [ ]; 24 | boot.kernelModules = [ 25 | "kvm-intel" 26 | "wl" 27 | ]; 28 | boot.extraModulePackages = [ config.boot.kernelPackages.broadcom_sta ]; 29 | 30 | fileSystems."/" = { 31 | device = "/dev/disk/by-label/root"; 32 | fsType = "ext4"; 33 | }; 34 | 35 | fileSystems."/boot" = { 36 | device = "/dev/disk/by-label/boot"; 37 | fsType = "vfat"; 38 | }; 39 | 40 | fileSystems."/mnt/backup" = { 41 | device = "/dev/disk/by-label/backup"; 42 | fsType = "ext4"; 43 | }; 44 | 45 | swapDevices = [ { device = "/dev/disk/by-label/swap"; } ]; 46 | 47 | nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; 48 | hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; 49 | } 50 | -------------------------------------------------------------------------------- /hosts/macpro/timemachine.nix: -------------------------------------------------------------------------------- 1 | { pkgs, ... }: 2 | { 3 | # Samba user management is independent of the system users 4 | # https://www.samba.org/samba/docs/current/man-html/pdbedit.8.html 5 | # Add user: sudo pdbedit -a -u USER 6 | # Change password: sudo pdbedit -u USER 7 | # Delete user: sudo pdbedit -x USER 8 | # List users: sudo pdbedit -L 9 | users = { 10 | users.timemachine = { 11 | isSystemUser = true; 12 | uid = 510; 13 | group = "timemachine"; 14 | }; 15 | groups.timemachine.gid = 510; 16 | }; 17 | services.samba = { 18 | enable = true; 19 | package = pkgs.samba4Full; 20 | openFirewall = true; 21 | settings = { 22 | global = { 23 | "server smb encrypt" = "required"; 24 | "server string" = "homeserver"; 25 | "hosts allow" = "10.16.0.1/16 127.0.0.1 localhost"; 26 | "hosts deny" = "0.0.0.0/0"; 27 | "guest account" = "nobody"; 28 | "map to guest" = "bad user"; 29 | "fruit:aapl" = "yes"; 30 | "fruit:model" = "MacPro"; 31 | "fruit:advertise_fullsync" = "true"; 32 | }; 33 | timemachine = { 34 | path = "/mnt/backup/timemachine"; 35 | "valid users" = "timemachine"; 36 | "force user" = "timemachine"; 37 | "force group" = "timemachine"; 38 | public = "no"; 39 | writeable = "yes"; 40 | "fruit:time machine" = "yes"; 41 | browseable = "yes"; 42 | "vfs objects" = "catia fruit streams_xattr"; 43 | }; 44 | }; 45 | }; 46 | # for windows network discovery 47 | services.samba-wsdd = { 48 | enable = true; 49 | openFirewall = true; 50 | }; 51 | # for mac network discovery 52 | services.avahi = { 53 | enable = true; 54 | openFirewall = true; 55 | publish.enable = true; 56 | publish.userServices = true; 57 | }; 58 | } 59 | -------------------------------------------------------------------------------- /hosts/orbstack/configuration.nix: -------------------------------------------------------------------------------- 1 | # /etc/nixos/configuration.nix 2 | { lib, lib', ... }: 3 | { 4 | security.sudo.wheelNeedsPassword = false; 5 | 6 | # This being `true` leads to a few nasty bugs, change at your own risk! 7 | users.mutableUsers = lib.mkForce false; 8 | 9 | networking = { 10 | dhcpcd.enable = false; 11 | useDHCP = false; 12 | useHostResolvConf = false; 13 | }; 14 | 15 | systemd.network = { 16 | enable = true; 17 | networks."50-eth0" = { 18 | matchConfig.Name = "eth0"; 19 | networkConfig = { 20 | DHCP = "ipv4"; 21 | IPv6AcceptRA = true; 22 | }; 23 | linkConfig.RequiredForOnline = "routable"; 24 | }; 25 | }; 26 | 27 | users.groups.orbstack.gid = 67278; 28 | 29 | users.users.mlenz = { 30 | uid = 501; 31 | extraGroups = [ 32 | "wheel" 33 | "orbstack" 34 | ]; 35 | 36 | # simulate isNormalUser, but UID < 1000 37 | isNormalUser = lib.mkForce false; 38 | isSystemUser = true; 39 | group = lib.mkForce "users"; 40 | createHome = true; 41 | home = "/home/mlenz"; 42 | homeMode = "700"; 43 | useDefaultShell = true; 44 | }; 45 | 46 | # Extra certificates from OrbStack. 47 | security.pki.certificateFiles = lib'.flocken.optionalPath /opt/orbstack-guest/run/extra-certs.crt; 48 | } 49 | -------------------------------------------------------------------------------- /hosts/orbstack/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | modulesPath, 3 | user, 4 | lib, 5 | ... 6 | }: 7 | let 8 | zedSettings = /Users/${user.login}/.config/zed/settings.json; 9 | in 10 | { 11 | # https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/virtualisation/lxc-instance-common.nix 12 | 13 | imports = [ 14 | ./hardware.nix 15 | ./configuration.nix 16 | "${modulesPath}/virtualisation/lxc-container.nix" 17 | ]; 18 | 19 | custom.impureRebuild = true; 20 | 21 | boot.binfmt.emulatedSystems = [ "aarch64-linux" ]; 22 | nix.settings.trusted-users = [ user.login ]; 23 | 24 | home-manager.users.${user.login} = { 25 | services.vscode-server.enable = true; 26 | xdg.configFile."zed/settings.json" = lib.mkIf (lib.pathExists zedSettings) { 27 | source = zedSettings; 28 | }; 29 | }; 30 | } 31 | -------------------------------------------------------------------------------- /hosts/orbstack/hardware.nix: -------------------------------------------------------------------------------- 1 | # /etc/nixos/orbstack.nix 2 | { lib, config, ... }: 3 | { 4 | # Add OrbStack CLI tools to PATH 5 | environment.shellInit = '' 6 | . /opt/orbstack-guest/etc/profile-early 7 | 8 | # add your customizations here 9 | 10 | . /opt/orbstack-guest/etc/profile-late 11 | ''; 12 | 13 | # Disable systemd-resolved 14 | services.resolved.enable = false; 15 | environment.etc."resolv.conf".source = "/opt/orbstack-guest/etc/resolv.conf"; 16 | 17 | # Faster DHCP - OrbStack uses SLAAC exclusively 18 | networking.dhcpcd.extraConfig = '' 19 | noarp 20 | noipv6 21 | ''; 22 | 23 | # Disable sshd 24 | services.openssh.enable = false; 25 | 26 | # systemd 27 | systemd.services."systemd-oomd".serviceConfig.WatchdogSec = 0; 28 | systemd.services."systemd-userdbd".serviceConfig.WatchdogSec = 0; 29 | systemd.services."systemd-udevd".serviceConfig.WatchdogSec = 0; 30 | systemd.services."systemd-timesyncd".serviceConfig.WatchdogSec = 0; 31 | systemd.services."systemd-timedated".serviceConfig.WatchdogSec = 0; 32 | systemd.services."systemd-portabled".serviceConfig.WatchdogSec = 0; 33 | systemd.services."systemd-nspawn@".serviceConfig.WatchdogSec = 0; 34 | systemd.services."systemd-machined".serviceConfig.WatchdogSec = 0; 35 | systemd.services."systemd-localed".serviceConfig.WatchdogSec = 0; 36 | systemd.services."systemd-logind".serviceConfig.WatchdogSec = 0; 37 | systemd.services."systemd-journald@".serviceConfig.WatchdogSec = 0; 38 | systemd.services."systemd-journald".serviceConfig.WatchdogSec = 0; 39 | systemd.services."systemd-journal-remote".serviceConfig.WatchdogSec = 0; 40 | systemd.services."systemd-journal-upload".serviceConfig.WatchdogSec = 0; 41 | systemd.services."systemd-importd".serviceConfig.WatchdogSec = 0; 42 | systemd.services."systemd-hostnamed".serviceConfig.WatchdogSec = 0; 43 | systemd.services."systemd-homed".serviceConfig.WatchdogSec = 0; 44 | systemd.services."systemd-networkd".serviceConfig.WatchdogSec = 45 | lib.mkIf config.systemd.network.enable 0; 46 | 47 | # ssh config 48 | programs.ssh.extraConfig = '' 49 | Include /opt/orbstack-guest/etc/ssh_config 50 | ''; 51 | 52 | # indicate builder support for emulated architectures 53 | nix.settings.extra-platforms = [ 54 | "x86_64-linux" 55 | "i686-linux" 56 | ]; 57 | } 58 | -------------------------------------------------------------------------------- /hosts/raspi/default.nix: -------------------------------------------------------------------------------- 1 | # https://nixos.wiki/wiki/NixOS_on_ARM#Installation 2 | { 3 | inputs, 4 | lib', 5 | pkgs, 6 | ... 7 | }: 8 | { 9 | imports = [ 10 | "${inputs.nixos-hardware}/raspberry-pi/4" 11 | ./hardware.nix 12 | ] ++ lib'.flocken.optionalPath "/etc/nixos/default.nix"; 13 | 14 | custom.profile.isServer = true; 15 | custom.impureRebuild = true; 16 | 17 | boot.binfmt.emulatedSystems = [ "x86_64-linux" ]; 18 | 19 | hardware.raspberry-pi."4" = { 20 | # https://github.com/NixOS/nixos-hardware/blob/master/raspberry-pi/4/poe-plus-hat.nix 21 | poe-plus-hat.enable = true; 22 | }; 23 | 24 | systemd.network.links."20-ethernet0" = { 25 | # matchConfig.OriginalName = "end0"; 26 | matchConfig.PermanentMACAddress = "e4:5f:01:98:a7:60"; 27 | linkConfig.Name = "ethernet0"; 28 | }; 29 | 30 | services.tailscale = { 31 | extraSetFlags = [ 32 | "--advertise-exit-node" 33 | ]; 34 | useRoutingFeatures = "server"; 35 | }; 36 | 37 | environment.systemPackages = with pkgs; [ 38 | raspberrypi-eeprom 39 | ]; 40 | } 41 | -------------------------------------------------------------------------------- /hosts/raspi/hardware.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 | { lib, modulesPath, ... }: 5 | { 6 | imports = [ (modulesPath + "/installer/scan/not-detected.nix") ]; 7 | 8 | fileSystems."/" = { 9 | device = "/dev/disk/by-label/NIXOS_SD"; 10 | fsType = "ext4"; 11 | }; 12 | 13 | # Adding a swap file is optional, but recommended if you use RAM-intensive applications that might OOM otherwise. 14 | # Size is in MiB, set to whatever you want (though note a larger value will use more disk space). 15 | swapDevices = [ 16 | { 17 | device = "/swapfile"; 18 | size = 8192; 19 | } 20 | ]; 21 | 22 | nixpkgs.hostPlatform = lib.mkDefault "aarch64-linux"; 23 | powerManagement.cpuFreqGovernor = lib.mkDefault "ondemand"; 24 | } 25 | -------------------------------------------------------------------------------- /lib/default.nix: -------------------------------------------------------------------------------- 1 | lib: rec { 2 | systemInput = 3 | { 4 | inputs, 5 | name, 6 | channel, 7 | os, 8 | }: 9 | inputs."${name}-${os}-${channel}" or inputs."${name}-${channel}" or inputs.${name}; 10 | systemOs = system: lib.last (lib.splitString "-" system); 11 | systemArch = system: lib.head (lib.splitString "-" system); 12 | # compare two lists irrespective of order 13 | setEqual = list1: list2: (lib.naturalSort list1) == (lib.naturalSort list2); 14 | mkRegistry = 15 | { 16 | channel, 17 | inputs, 18 | os, 19 | }: 20 | { 21 | stable.flake = systemInput { 22 | inherit inputs os; 23 | channel = "stable"; 24 | name = "nixpkgs"; 25 | }; 26 | unstable.flake = systemInput { 27 | inherit inputs os; 28 | channel = "unstable"; 29 | name = "nixpkgs"; 30 | }; 31 | pkgs.flake = systemInput { 32 | inherit inputs os channel; 33 | name = "nixpkgs"; 34 | }; 35 | stable-small.flake = inputs.nixpkgs-stable-small; 36 | unstable-small.flake = inputs.nixpkgs-unstable-small; 37 | nixpkgs.flake = inputs.nixpkgs; 38 | self.flake = inputs.self; 39 | }; 40 | mkVimKeymap = 41 | { 42 | raw, 43 | prefix ? "", 44 | suffix ? "", 45 | mode ? "n", 46 | }: 47 | attrs: 48 | attrs 49 | // { 50 | action = 51 | if raw then 52 | { __raw = "function() ${prefix}${attrs.action}${suffix} end"; } 53 | else 54 | "${prefix}${attrs.action}${suffix}"; 55 | mode = attrs.mode or mode; 56 | }; 57 | mkVimKeymaps = opts: values: map (mkVimKeymap opts) values; 58 | } 59 | -------------------------------------------------------------------------------- /overlays/by-name.nix: -------------------------------------------------------------------------------- 1 | { inputs, ... }: 2 | final: prev: 3 | let 4 | inherit (prev.stdenv.hostPlatform) system; 5 | inherit (prev) lib; 6 | exportedFunctions = { 7 | mkApp = final.callPackage ./functions/make-app.nix { }; 8 | mkBuilder = final.callPackage ./functions/make-builder.nix { }; 9 | mkDocker = final.callPackage ./functions/make-docker.nix { }; 10 | linkExe = final.callPackage ./functions/link-exe.nix { }; 11 | }; 12 | exportedPackages = lib.packagesFromDirectoryRecursive { 13 | # inherit (prev) newScope; 14 | callPackage = lib.callPackageWith (final // { inherit inputs; }); 15 | directory = ./packages; 16 | }; 17 | in 18 | { 19 | exported-functions = exportedFunctions; 20 | exported-packages = lib.filterAttrs ( 21 | name: value: lib.meta.availableOn { inherit system; } value && lib.isDerivation value 22 | ) exportedPackages; 23 | vimPlugins = 24 | prev.vimPlugins 25 | // prev.lib.packagesFromDirectoryRecursive { 26 | inherit (prev) callPackage; 27 | directory = ./vim-plugins; 28 | }; 29 | } 30 | // exportedFunctions 31 | // exportedPackages 32 | -------------------------------------------------------------------------------- /overlays/channels.nix: -------------------------------------------------------------------------------- 1 | { 2 | inputs, 3 | lib', 4 | config, 5 | ... 6 | }: 7 | final: prev: 8 | let 9 | inherit (prev.stdenv.hostPlatform) system; 10 | os = lib'.self.systemOs system; 11 | importArgs = { 12 | inherit system config; 13 | }; 14 | in 15 | { 16 | inherit prev; 17 | nixpkgs = import inputs.nixpkgs importArgs; 18 | stable = import (lib'.self.systemInput { 19 | inherit inputs os; 20 | name = "nixpkgs"; 21 | channel = "stable"; 22 | }) importArgs; 23 | unstable = import (lib'.self.systemInput { 24 | inherit inputs os; 25 | name = "nixpkgs"; 26 | channel = "unstable"; 27 | }) importArgs; 28 | unstable-small = import inputs.nixpkgs-unstable-small importArgs; 29 | stable-small = import inputs.nixpkgs-stable-small importArgs; 30 | } 31 | -------------------------------------------------------------------------------- /overlays/default.nix: -------------------------------------------------------------------------------- 1 | args@{ inputs, ... }: 2 | [ 3 | inputs.nix-darwin-unstable.overlays.default 4 | (import ./by-name.nix args) 5 | (import ./channels.nix args) 6 | (import ./imports.nix args) 7 | (import ./overrides.nix args) 8 | ] 9 | -------------------------------------------------------------------------------- /overlays/functions/link-exe.nix: -------------------------------------------------------------------------------- 1 | { writeShellApplication, lib }: 2 | { 3 | name, 4 | package, 5 | directory, 6 | }: 7 | writeShellApplication { 8 | name = "link-${name}"; 9 | text = '' 10 | ln -snf "$@" ${lib.getExe package} "${directory}/${name}" 11 | ''; 12 | } 13 | -------------------------------------------------------------------------------- /overlays/functions/make-app.nix: -------------------------------------------------------------------------------- 1 | { 2 | stdenvNoCC, 3 | undmg, 4 | makeWrapper, 5 | lib, 6 | }: 7 | args@{ 8 | pname, 9 | appname ? pname, 10 | meta ? { }, 11 | nativeBuildInputs ? [ ], 12 | wrapperPath ? "", 13 | ... 14 | }: 15 | stdenvNoCC.mkDerivation ( 16 | { 17 | phases = [ 18 | "unpackPhase" 19 | "installPhase" 20 | ]; 21 | installPhase = '' 22 | runHook preInstall 23 | 24 | mkdir -p "$out/Applications" 25 | cp -R "${appname}.app" "$out/Applications" 26 | 27 | ${lib.optionalString (wrapperPath != "") '' 28 | mkdir -p "$out/bin" 29 | makeWrapper "$out/Applications/${appname}.app/${wrapperPath}" "$out/bin/${pname}" 30 | ''} 31 | 32 | runHook postInstall 33 | ''; 34 | # all of the following attributes need to removed from args 35 | nativeBuildInputs = 36 | nativeBuildInputs 37 | ++ [ 38 | undmg 39 | ] 40 | ++ (lib.optional (wrapperPath != "") makeWrapper); 41 | meta = { 42 | maintainers = with lib.maintainers; [ mirkolenz ]; 43 | platforms = lib.platforms.darwin; 44 | sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ]; 45 | mainProgram = pname; 46 | } // meta; 47 | } 48 | // (lib.removeAttrs args [ 49 | "nativeBuildInputs" 50 | "meta" 51 | ]) 52 | ) 53 | -------------------------------------------------------------------------------- /overlays/functions/make-builder.nix: -------------------------------------------------------------------------------- 1 | { 2 | lib, 3 | writeShellApplication, 4 | config-builder, 5 | darwin-rebuild, 6 | nixos-rebuild-ng, 7 | home-manager, 8 | }: 9 | { 10 | flake, 11 | args ? [ ], 12 | }: 13 | writeShellApplication { 14 | name = "config-builder"; 15 | text = '' 16 | exec ${lib.getExe config-builder} \ 17 | --darwin-builder ${lib.getExe darwin-rebuild} \ 18 | --linux-builder ${lib.getExe nixos-rebuild-ng} \ 19 | --home-builder ${lib.getExe home-manager} \ 20 | --flake ${flake} \ 21 | ${lib.escapeShellArgs args} \ 22 | "$@" 23 | ''; 24 | } 25 | -------------------------------------------------------------------------------- /overlays/functions/make-docker.nix: -------------------------------------------------------------------------------- 1 | { 2 | dockerTools, 3 | lib, 4 | }: 5 | args@{ 6 | meta ? { }, 7 | builder ? dockerTools.streamLayeredImage, 8 | ... 9 | }: 10 | lib.addMetaAttrs 11 | ( 12 | { 13 | maintainers = with lib.maintainers; [ mirkolenz ]; 14 | platforms = lib.platforms.linux; 15 | } 16 | // meta 17 | ) 18 | ( 19 | builder ( 20 | lib.removeAttrs args [ 21 | "meta" 22 | "builder" 23 | ] 24 | ) 25 | ) 26 | -------------------------------------------------------------------------------- /overlays/imports.nix: -------------------------------------------------------------------------------- 1 | { 2 | inputs, 3 | self, 4 | ... 5 | }: 6 | final: prev: 7 | let 8 | inherit (prev.stdenv.hostPlatform) system; 9 | fromInput = 10 | input: package: 11 | if (inputs.${input}.packages ? ${system}) then 12 | inputs.${input}.packages.${system}.${package} 13 | else 14 | null; 15 | in 16 | { 17 | inherit (self.packages.${system}) 18 | # nixvim-stable 19 | nixvim-unstable 20 | treefmt-nix 21 | ; 22 | angrr = fromInput "angrr" "angrr"; 23 | arguebuf = fromInput "arguebuf" "default"; 24 | codex = fromInput "codex" "codex-rs"; 25 | cosmic-manager = fromInput "cosmic-manager" "cosmic-manager"; 26 | nix-converter = fromInput "nix-converter" "default"; 27 | nixfmt = final.nixfmt-rfc-style; 28 | nixvim = final.nixvim-unstable; 29 | uv-bin = fromInput "uv2nix" "uv-bin"; 30 | } 31 | -------------------------------------------------------------------------------- /overlays/overrides.nix: -------------------------------------------------------------------------------- 1 | { ... }: 2 | final: prev: { 3 | } 4 | -------------------------------------------------------------------------------- /overlays/packages/bibtex2cff.nix: -------------------------------------------------------------------------------- 1 | { 2 | python3Packages, 3 | fetchFromGitHub, 4 | lib, 5 | }: 6 | python3Packages.buildPythonApplication rec { 7 | pname = "bibtex2cff"; 8 | version = "0.2.1"; 9 | pyproject = true; 10 | 11 | src = fetchFromGitHub { 12 | owner = "anselmoo"; 13 | repo = "bibtex2cff"; 14 | tag = "v${version}"; 15 | hash = "sha256-Xuj2kDJzX2owIjjBRrfXNJCZeGRZ7OoD1X+ibU4b1C8="; 16 | }; 17 | 18 | build-system = with python3Packages; [ poetry-core ]; 19 | 20 | dependencies = 21 | with python3Packages; 22 | [ 23 | bibtexparser 24 | pydantic_1 25 | pyyaml 26 | ] 27 | ++ pydantic_1.optional-dependencies.email; 28 | 29 | nativeCheckInputs = with python3Packages; [ 30 | pytest 31 | pytest-cov 32 | flake8 33 | black 34 | isort 35 | mypy 36 | pydocstyle 37 | pylint 38 | bandit 39 | types-pyyaml 40 | ]; 41 | 42 | meta = { 43 | description = "Convert from bibtex to CITATION.cff"; 44 | homepage = "https://github.com/Anselmoo/bibtex2cff"; 45 | downloadPage = "https://github.com/Anselmoo/bibtex2cff/releases"; 46 | license = lib.licenses.mit; 47 | mainProgram = "bibtex2cff"; 48 | platforms = with lib.platforms; darwin ++ linux; 49 | maintainers = with lib.maintainers; [ mirkolenz ]; 50 | }; 51 | } 52 | -------------------------------------------------------------------------------- /overlays/packages/bibtexbrowser.nix: -------------------------------------------------------------------------------- 1 | { 2 | stdenv, 3 | fetchFromGitHub, 4 | lib, 5 | }: 6 | stdenv.mkDerivation { 7 | name = "bibtexbrowser"; 8 | src = fetchFromGitHub { 9 | owner = "monperrus"; 10 | repo = "bibtexbrowser"; 11 | rev = "fbbf95f8a4085d81157ae0df58506b92e4a40b58"; 12 | hash = "sha256-CUnVkuoFLZkYM8fcHTemN/a66LycAH6LOWqNSZXgIeI="; 13 | }; 14 | installPhase = '' 15 | runHook preInstall 16 | 17 | mkdir -p $out 18 | cp -r $src/* $out/ 19 | 20 | runHook postInstall 21 | ''; 22 | meta = { 23 | description = "Beautiful publication lists with bibtex and PHP"; 24 | homepage = "www.monperrus.net/martin/bibtexbrowser/"; 25 | downloadPage = "https://github.com/monperrus/bibtexbrowser/releases/tag/latest"; 26 | maintainers = with lib.maintainers; [ mirkolenz ]; 27 | }; 28 | } 29 | -------------------------------------------------------------------------------- /overlays/packages/bibtexbrowser2cff.nix: -------------------------------------------------------------------------------- 1 | { 2 | writeShellApplication, 3 | bibtexbrowser, 4 | lib, 5 | php, 6 | }: 7 | writeShellApplication { 8 | name = "bibtexbrowser2cff"; 9 | text = '' 10 | exec ${lib.getExe php} ${bibtexbrowser}/bibtex-to-cff.php "$@" 11 | ''; 12 | meta = bibtexbrowser.meta // { 13 | platforms = php.meta.platforms; 14 | }; 15 | } 16 | -------------------------------------------------------------------------------- /overlays/packages/caddy-docker.nix: -------------------------------------------------------------------------------- 1 | # https://github.com/caddyserver/caddy-docker/blob/master/Dockerfile.tmpl 2 | { 3 | lib, 4 | caddy, 5 | cacert, 6 | tzdata, 7 | mkDocker, 8 | }: 9 | mkDocker { 10 | name = "caddy"; 11 | tag = "latest"; 12 | created = "now"; 13 | contents = [ 14 | cacert 15 | tzdata 16 | ]; 17 | extraCommands = '' 18 | mkdir -m 1777 tmp 19 | ''; 20 | config = { 21 | Entrypoint = [ (lib.getExe caddy) ]; 22 | Cmd = [ 23 | "run" 24 | "--config" 25 | "/etc/caddy/Caddyfile" 26 | "--adapter" 27 | "caddyfile" 28 | ]; 29 | ExposedPorts = { 30 | "80/tcp" = { }; 31 | "443/tcp" = { }; 32 | "443/udp" = { }; 33 | "2019/tcp" = { }; 34 | }; 35 | # https://caddyserver.com/docs/conventions#file-locations 36 | Env = [ 37 | "XDG_CONFIG_HOME=/config" 38 | "XDG_DATA_HOME=/data" 39 | "HOME=/root" 40 | ]; 41 | WorkingDir = "/srv"; 42 | }; 43 | } 44 | -------------------------------------------------------------------------------- /overlays/packages/caddy.nix: -------------------------------------------------------------------------------- 1 | { nixpkgs }: 2 | nixpkgs.caddy.withPlugins { 3 | plugins = [ 4 | # https://github.com/caddy-dns/cloudflare/tags 5 | "github.com/caddy-dns/cloudflare@v0.2.1" 6 | ]; 7 | hash = "sha256-saKJatiBZ4775IV2C5JLOmZ4BwHKFtRZan94aS5pO90="; 8 | } 9 | -------------------------------------------------------------------------------- /overlays/packages/claude-code/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "@anthropic-ai/claude-code": "^1" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /overlays/packages/claude-code/package.nix: -------------------------------------------------------------------------------- 1 | { 2 | lib, 3 | buildNpmPackage, 4 | fetchzip, 5 | writeShellApplication, 6 | importNpmLock, 7 | nodejs, 8 | nix-update, 9 | }: 10 | buildNpmPackage rec { 11 | pname = "claude-code"; 12 | version = "1.0.16"; 13 | # nix run .#claude-code.updateScript 14 | 15 | src = fetchzip { 16 | url = "https://registry.npmjs.org/@anthropic-ai/claude-code/-/claude-code-${version}.tgz"; 17 | hash = "sha256-WK6EnwciMGh5vo6EB35zbEjSS3ahYeY5lwEUk2a6f9o="; 18 | }; 19 | 20 | postPatch = '' 21 | cp ${./package-lock.json} package-lock.json 22 | ''; 23 | 24 | npmDeps = importNpmLock { npmRoot = ./.; }; 25 | inherit (importNpmLock) npmConfigHook; 26 | 27 | dontNpmBuild = true; 28 | 29 | # if (!process.env.AUTHORIZED) 30 | # Direct publishing is not allowed. 31 | # Please use the publish-external.sh script to publish this package. 32 | AUTHORIZED = "1"; 33 | 34 | passthru.updateScript = writeShellApplication { 35 | name = "claude-code-update"; 36 | runtimeInputs = [ 37 | nodejs 38 | nix-update 39 | ]; 40 | text = '' 41 | version="$(npm view @anthropic-ai/claude-code version)" 42 | workdir="overlays/packages/claude-code" 43 | npm update --prefix "$workdir" --ignore-scripts --package-lock-only 44 | nix-update --flake claude-code --version "$version" 45 | ''; 46 | }; 47 | 48 | meta = { 49 | description = "An agentic coding tool that lives in your terminal, understands your codebase, and helps you code faster"; 50 | homepage = "https://github.com/anthropics/claude-code"; 51 | downloadPage = "https://www.npmjs.com/package/@anthropic-ai/claude-code"; 52 | license = lib.licenses.unfree; 53 | maintainers = [ lib.maintainers.mirkolenz ]; 54 | mainProgram = "claude"; 55 | }; 56 | } 57 | -------------------------------------------------------------------------------- /overlays/packages/config-builder/package.nix: -------------------------------------------------------------------------------- 1 | { 2 | writers, 3 | python3Packages, 4 | }: 5 | writers.writePython3Bin "config-builder" { 6 | libraries = with python3Packages; [ typer ]; 7 | doCheck = false; 8 | } ./script.py 9 | -------------------------------------------------------------------------------- /overlays/packages/config-builder/script.py: -------------------------------------------------------------------------------- 1 | import json 2 | import shlex 3 | import subprocess 4 | from typing import Annotated 5 | 6 | import typer 7 | 8 | app = typer.Typer( 9 | add_completion=False, 10 | pretty_exceptions_enable=False, 11 | ) 12 | 13 | 14 | def subprocess_stdout(cmd: list[str]) -> str: 15 | result = subprocess.run(cmd, capture_output=True, text=True) 16 | 17 | try: 18 | result.check_returncode() 19 | except subprocess.CalledProcessError as e: 20 | typer.echo(e.stderr, err=True) 21 | exit(1) 22 | 23 | return result.stdout.strip() 24 | 25 | 26 | @app.command( 27 | context_settings={ 28 | "allow_extra_args": True, 29 | "ignore_unknown_options": True, 30 | "help_option_names": ["--wrapper-help"], 31 | } 32 | ) 33 | def run( 34 | ctx: typer.Context, 35 | nix_exe: Annotated[str, typer.Option()] = "nix", 36 | darwin_builder: Annotated[str, typer.Option()] = "darwin-rebuild", 37 | linux_builder: Annotated[str, typer.Option()] = "nixos-rebuild", 38 | home_builder: Annotated[str, typer.Option()] = "home-manager", 39 | operation: Annotated[ 40 | str, typer.Option("--operation", "-o", "--mode", "-m") 41 | ] = "switch", 42 | flake: str = "github:mirkolenz/nixos", 43 | name: Annotated[str | None, typer.Option("--name", "-n")] = None, 44 | ): 45 | node = subprocess_stdout(["uname", "-n"]).lower() 46 | kernel = subprocess_stdout(["uname", "-s"]).lower() 47 | user = subprocess_stdout(["whoami"]).lower() 48 | is_home = user != "root" 49 | 50 | if not name: 51 | name = f"{user}@{node}" if is_home else node 52 | 53 | if is_home: 54 | builder = home_builder 55 | elif kernel == "darwin": 56 | builder = darwin_builder 57 | else: 58 | builder = linux_builder 59 | 60 | if is_home: 61 | flake_attribute = "homeConfigurations" 62 | elif kernel == "darwin": 63 | flake_attribute = "darwinConfigurations" 64 | else: 65 | flake_attribute = "nixosConfigurations" 66 | 67 | is_impure: bool = json.loads( 68 | subprocess_stdout( 69 | [ 70 | nix_exe, 71 | "--extra-experimental-features", 72 | "nix-command flakes", 73 | "eval", 74 | "--json", 75 | f'{flake}#{flake_attribute}."{name}".config.custom.impureRebuild', 76 | ] 77 | ) 78 | ) 79 | 80 | cmd: list[str] = [builder, operation, "--flake", f"{flake}#{name}"] 81 | 82 | if is_impure: 83 | cmd.append("--impure") 84 | 85 | cmd.extend(ctx.args) 86 | 87 | typer.echo( 88 | shlex.join([cmd[0].split("/")[-1], *cmd[1:]]), 89 | err=True, 90 | ) 91 | 92 | subprocess.run(cmd) 93 | 94 | 95 | if __name__ == "__main__": 96 | app() 97 | -------------------------------------------------------------------------------- /overlays/packages/copilot-language-server.nix: -------------------------------------------------------------------------------- 1 | # https://github.com/NixOS/nixpkgs/blob/nixos-unstable/pkgs/by-name/co/copilot-language-server/package.nix 2 | { nixpkgs, fetchzip }: 3 | nixpkgs.copilot-language-server.overrideAttrs (prevAttrs: { 4 | version = "1.330.0"; 5 | # nix-update --flake copilot-language-server 6 | src = fetchzip { 7 | inherit (prevAttrs.src) url; 8 | hash = "sha256-/Em00UVEg46gEI52fG7aQo2rqKwqrF3V1tAVx2hpyMc="; 9 | stripRoot = false; 10 | }; 11 | }) 12 | -------------------------------------------------------------------------------- /overlays/packages/dummy.nix: -------------------------------------------------------------------------------- 1 | { writeShellScriptBin }: writeShellScriptBin "dummy" ":" 2 | -------------------------------------------------------------------------------- /overlays/packages/gibo.nix: -------------------------------------------------------------------------------- 1 | { 2 | lib, 3 | stdenv, 4 | buildGoModule, 5 | fetchFromGitHub, 6 | installShellFiles, 7 | buildPackages, 8 | }: 9 | buildGoModule rec { 10 | pname = "gibo"; 11 | version = "3.0.12"; 12 | 13 | src = fetchFromGitHub { 14 | owner = "simonwhitaker"; 15 | repo = "gibo"; 16 | tag = "v${version}"; 17 | hash = "sha256-ye6ql9NCoTdqABTPTQTIm60HSJ8Di+l9He5469ux3MI="; 18 | }; 19 | 20 | vendorHash = "sha256-Z1BzqZDTDa/G7Jnsv/YStihiToTzn3i0YS7ybgD96S0="; 21 | 22 | ldflags = [ 23 | "-s" 24 | "-w" 25 | "-X=github.com/simonwhitaker/gibo/cmd.version=${version}" 26 | ]; 27 | 28 | nativeBuildInputs = [ 29 | installShellFiles 30 | ]; 31 | 32 | postInstall = lib.optionalString (stdenv.hostPlatform.emulatorAvailable buildPackages) ( 33 | let 34 | emulator = stdenv.hostPlatform.emulator buildPackages; 35 | in 36 | '' 37 | installShellCompletion --cmd gibo \ 38 | --bash <(${emulator} $out/bin/gibo completion bash) \ 39 | --fish <(${emulator} $out/bin/gibo completion fish) \ 40 | --zsh <(${emulator} $out/bin/gibo completion zsh) 41 | '' 42 | ); 43 | 44 | meta = { 45 | description = "Easy access to gitignore boilerplates"; 46 | homepage = "https://github.com/simonwhitaker/gibo"; 47 | downloadPage = "https://github.com/simonwhitaker/gibo/releases"; 48 | license = lib.licenses.unlicense; 49 | maintainers = with lib.maintainers; [ mirkolenz ]; 50 | mainProgram = "gibo"; 51 | }; 52 | } 53 | -------------------------------------------------------------------------------- /overlays/packages/github-theme-contrib.nix: -------------------------------------------------------------------------------- 1 | { fetchFromGitHub }: 2 | fetchFromGitHub rec { 3 | pname = "github-theme-contrib"; 4 | version = "1.0.2"; 5 | owner = "projekt0n"; 6 | repo = "github-theme-contrib"; 7 | tag = "v${version}"; 8 | hash = "sha256-MKB9JtU6Gv16ma7S9J7n1QCjAiJhBrD0mUHum+blJOs="; 9 | meta = { 10 | downloadPage = "https://github.com/projekt0n/github-theme-contrib/releases"; 11 | }; 12 | } 13 | -------------------------------------------------------------------------------- /overlays/packages/goneovim-bin.nix: -------------------------------------------------------------------------------- 1 | { 2 | mkApp, 3 | fetchzip, 4 | lib, 5 | stdenv, 6 | }: 7 | let 8 | inherit (stdenv.hostPlatform) system; 9 | in 10 | mkApp rec { 11 | pname = "goneovim"; 12 | version = "0.6.13"; 13 | appname = pname; 14 | 15 | passthru = { 16 | urls = { 17 | x86_64-darwin = "https://github.com/akiyosi/goneovim/releases/download/v${version}/${pname}-v${version}-macos-x86_64.tar.bz2"; 18 | aarch64-darwin = "https://github.com/akiyosi/goneovim/releases/download/v${version}/${pname}-v${version}-macos-arm64.tar.bz2"; 19 | }; 20 | hashes = { 21 | aarch64-darwin = "sha256-iLy3A0MgPCsKsc8sapMz5P2BkNw+d2cXTg7EKhWWybI="; 22 | x86_64-darwin = "sha256-uuzYtsEDhIdhl6Mco5aQPbtSo9uaB0XQjmoq0CmFpIU="; 23 | }; 24 | }; 25 | 26 | src = fetchzip { 27 | url = passthru.urls.${system}; 28 | hash = passthru.hashes.${system}; 29 | }; 30 | wrapperPath = "Contents/MacOS/${pname}"; 31 | 32 | meta = { 33 | description = "GUI frontend for neovim"; 34 | homepage = "https://github.com/akiyosi/goneovim"; 35 | downloadPage = "https://github.com/akiyosi/goneovim/releases"; 36 | license = lib.licenses.mit; 37 | platforms = lib.attrNames passthru.urls; 38 | }; 39 | } 40 | -------------------------------------------------------------------------------- /overlays/packages/hkknx-bin.nix: -------------------------------------------------------------------------------- 1 | # https://nixos.wiki/wiki/Packaging/Binaries 2 | { 3 | lib, 4 | fetchzip, 5 | stdenv, 6 | autoPatchelfHook, 7 | }: 8 | let 9 | inherit (stdenv.hostPlatform) system; 10 | in 11 | stdenv.mkDerivation rec { 12 | pname = "hkknx"; 13 | version = "3.1.2"; 14 | 15 | passthru = { 16 | urls = { 17 | aarch64-darwin = "https://github.com/brutella/hkknx-public/releases/download/${version}/${pname}-${version}_darwin_arm64.tar.gz"; 18 | aarch64-linux = "https://github.com/brutella/hkknx-public/releases/download/${version}/${pname}-${version}_linux_arm64.tar.gz"; 19 | x86_64-darwin = "https://github.com/brutella/hkknx-public/releases/download/${version}/${pname}-${version}_darwin_amd64.tar.gz"; 20 | x86_64-linux = "https://github.com/brutella/hkknx-public/releases/download/${version}/${pname}-${version}_linux_amd64.tar.gz"; 21 | }; 22 | hashes = { 23 | aarch64-darwin = "sha256-DEiFoW6+MDR0+GKI8IVv+cYddk3Yvp4YsRA+WGfYeEA="; 24 | aarch64-linux = "sha256-Vw9Nnvpkhlg45pjQeIgaVf87nDNqXsayDP08zD0ErE4="; 25 | x86_64-darwin = "sha256-deN7bstlAhvh7bwdWFr9oiiZ60T5gLgzfYlOKTOj1Z8="; 26 | x86_64-linux = "sha256-wUg3NG427AnFX512cSZ7+SxN9uYrsKt/tvElaXM/NGc="; 27 | }; 28 | }; 29 | 30 | src = fetchzip { 31 | url = passthru.urls.${system}; 32 | hash = passthru.hashes.${system}; 33 | stripRoot = false; 34 | }; 35 | 36 | nativeBuildInputs = lib.optional (!stdenv.isDarwin) autoPatchelfHook; 37 | 38 | installPhase = '' 39 | runHook preInstall 40 | 41 | mkdir -p $out/bin 42 | install -m755 -D hkknx $out/bin/hkknx 43 | 44 | runHook postInstall 45 | ''; 46 | 47 | meta = { 48 | description = "HomeKit Bridge for KNX"; 49 | homepage = "https://hochgatterer.me/hkknx"; 50 | downloadPage = "https://github.com/brutella/hkknx-public/releases"; 51 | mainProgram = pname; 52 | platforms = lib.attrNames passthru.urls; 53 | maintainers = with lib.maintainers; [ mirkolenz ]; 54 | sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ]; 55 | license = lib.licenses.unfree; 56 | }; 57 | } 58 | -------------------------------------------------------------------------------- /overlays/packages/hkknx-docker.nix: -------------------------------------------------------------------------------- 1 | { 2 | lib, 3 | mkDocker, 4 | cacert, 5 | tzdata, 6 | hkknx-bin, 7 | }: 8 | let 9 | mkCliOptions = lib.cli.toGNUCommandLine rec { 10 | mkOptionName = k: "--${k}"; 11 | mkBool = k: v: [ 12 | (mkOptionName k) 13 | (lib.boolToString v) 14 | ]; 15 | }; 16 | defaultOptions = mkCliOptions { 17 | autoupdate = false; 18 | verbose = false; 19 | db = "/db"; 20 | port = 80; 21 | }; 22 | in 23 | mkDocker { 24 | name = "hkknx"; 25 | tag = "latest"; 26 | created = "now"; 27 | contents = [ 28 | cacert 29 | tzdata 30 | ]; 31 | # create /tmp for backup feature to work 32 | extraCommands = '' 33 | mkdir -m 1777 tmp 34 | ''; 35 | config.entrypoint = [ (lib.getExe hkknx-bin) ] ++ defaultOptions; 36 | } 37 | -------------------------------------------------------------------------------- /overlays/packages/infat-bin.nix: -------------------------------------------------------------------------------- 1 | { 2 | fetchurl, 3 | lib, 4 | stdenvNoCC, 5 | versionCheckHook, 6 | }: 7 | let 8 | inherit (stdenvNoCC.hostPlatform) system; 9 | in 10 | stdenvNoCC.mkDerivation (finalAttrs: { 11 | pname = "infat"; 12 | version = "2.4.0"; 13 | # prefetch-attrs .#infat-bin.passthru.urls 14 | 15 | passthru = { 16 | urls = { 17 | aarch64-darwin = "https://github.com/philocalyst/infat/releases/download/v${finalAttrs.version}/infat-arm64-apple-macos.tar.gz"; 18 | x86_64-darwin = "https://github.com/philocalyst/infat/releases/download/v${finalAttrs.version}/infat-x86_64-apple-macos.tar.gz"; 19 | }; 20 | hashes = { 21 | aarch64-darwin = "sha256-4r0SatEclupqFvEpnfMd001rQlX3r/FT9K4lKSDYcJ8="; 22 | x86_64-darwin = "sha256-4fA8L4WqxDvjHcOoySQn+p514lYVBhyDw3GvoVNY9gE="; 23 | }; 24 | }; 25 | 26 | src = fetchurl { 27 | url = finalAttrs.passthru.urls.${system}; 28 | hash = finalAttrs.passthru.hashes.${system}; 29 | }; 30 | 31 | # unpacking produces a single file, so we don't want to cd into it 32 | sourceRoot = "."; 33 | 34 | dontBuild = true; 35 | 36 | installPhase = '' 37 | runHook preInstall 38 | 39 | mkdir -p $out/bin 40 | install -m755 -D infat $out/bin/infat 41 | 42 | runHook postInstall 43 | ''; 44 | 45 | nativeInstallCheckInputs = [ 46 | versionCheckHook 47 | ]; 48 | versionCheckProgramArg = "--version"; 49 | doInstallCheck = true; 50 | 51 | meta = { 52 | description = "Command line tool to set default openers for file formats and url schemes on macos"; 53 | homepage = "https://github.com/philocalyst/infat"; 54 | license = lib.licenses.mit; 55 | mainProgram = "infat"; 56 | maintainers = with lib.maintainers; [ mirkolenz ]; 57 | platforms = lib.attrNames finalAttrs.passthru.urls; 58 | sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ]; 59 | }; 60 | }) 61 | -------------------------------------------------------------------------------- /overlays/packages/janice.nix: -------------------------------------------------------------------------------- 1 | { 2 | buildGoModule, 3 | fetchFromGitHub, 4 | fyne, 5 | lib, 6 | }: 7 | buildGoModule rec { 8 | pname = "janice"; 9 | version = "0.9.0"; 10 | # nix-update --flake janice 11 | 12 | src = fetchFromGitHub { 13 | owner = "ErikKalkoken"; 14 | repo = "janice"; 15 | tag = "v${version}"; 16 | hash = "sha256-gzSQFTvIqK+MUTs46lDWUCvxxuEC8N9VmBEOOc+kCV0="; 17 | }; 18 | 19 | vendorHash = "sha256-rNL3eMWaT+Q+NoutUDvD9Gs9SM0B6s95P88ynsRp1GQ="; 20 | 21 | ldflags = [ 22 | "-s" 23 | "-w" 24 | ]; 25 | 26 | inherit (fyne) buildInputs nativeBuildInputs; 27 | 28 | meta = { 29 | description = "A desktop app for viewing large JSON files"; 30 | homepage = "https://github.com/ErikKalkoken/janice"; 31 | downloadPage = "https://github.com/ErikKalkoken/janice/releases"; 32 | license = lib.licenses.mit; 33 | maintainers = with lib.maintainers; [ mirkolenz ]; 34 | mainProgram = "janice"; 35 | }; 36 | } 37 | -------------------------------------------------------------------------------- /overlays/packages/protobuf-ls.nix: -------------------------------------------------------------------------------- 1 | { 2 | lib, 3 | buildGoModule, 4 | fetchFromGitHub, 5 | }: 6 | 7 | buildGoModule rec { 8 | pname = "protobuf-language-server"; 9 | version = "0.1.1"; 10 | 11 | src = fetchFromGitHub { 12 | owner = "lasorda"; 13 | repo = "protobuf-language-server"; 14 | tag = "v${version}"; 15 | hash = "sha256-bDsvByXa2kH3DnvQpAq79XvwFg4gfhtOP2BpqA1LCI0="; 16 | }; 17 | 18 | vendorHash = "sha256-dRria1zm5Jk7ScXh0HXeU686EmZcRrz5ZgnF0ca9aUQ="; 19 | 20 | ldflags = [ 21 | "-s" 22 | "-w" 23 | ]; 24 | doCheck = false; 25 | 26 | meta = { 27 | description = "A language server implementation for Google Protocol Buffers"; 28 | homepage = "https://github.com/lasorda/protobuf-language-server"; 29 | license = lib.licenses.asl20; 30 | maintainers = with lib.maintainers; [ mirkolenz ]; 31 | mainProgram = "protobuf-language-server"; 32 | }; 33 | } 34 | -------------------------------------------------------------------------------- /overlays/packages/restic-browser-bin.nix: -------------------------------------------------------------------------------- 1 | { 2 | lib, 3 | mkApp, 4 | fetchzip, 5 | }: 6 | mkApp rec { 7 | pname = "restic-browser"; 8 | version = "0.3.2"; 9 | appname = "Restic-Browser"; 10 | src = fetchzip { 11 | url = "https://github.com/emuell/restic-browser/releases/download/v${version}/${appname}-v${version}-macOS.zip"; 12 | hash = "sha256-3uPmdJZmUPfQjVCuf5h9Wa/rzezJqgfqsDz0vdcf5AM="; 13 | # the downloaded zip contains a tar archive instead of the app 14 | postFetch = '' 15 | tar -xf "$out/${appname}.app.tar" -C "$out" 16 | rm "$out/${appname}.app.tar" 17 | ''; 18 | }; 19 | meta = { 20 | description = "A GUI to browse and restore restic backup repositories."; 21 | homepage = "https://github.com/emuell/restic-browser"; 22 | downloadPage = "https://github.com/emuell/restic-browser/releases"; 23 | license = lib.licenses.mit; 24 | }; 25 | } 26 | -------------------------------------------------------------------------------- /overlays/packages/sioyek-bin.nix: -------------------------------------------------------------------------------- 1 | { 2 | mkApp, 3 | fetchzip, 4 | lib, 5 | stdenv, 6 | rcodesign, 7 | }: 8 | let 9 | inherit (stdenv.hostPlatform) system; 10 | in 11 | mkApp rec { 12 | pname = "sioyek"; 13 | version = "3-alpha0"; 14 | appname = "sioyek"; 15 | 16 | passthru = { 17 | urls = { 18 | aarch64-darwin = "https://github.com/ahrm/sioyek/releases/download/sioyek${version}/${appname}-release-mac-arm.zip"; 19 | x86_64-darwin = "https://github.com/ahrm/sioyek/releases/download/sioyek${version}/${appname}-release-mac.zip"; 20 | }; 21 | hashes = { 22 | aarch64-darwin = "sha256-UsjGHj0OAuuMnX93jzvdMYmz1ZdVuU2jGN80ATvccTI="; 23 | x86_64-darwin = "sha256-vouYHiqaXAM99WXxkoP/Qz6nQcRa8IOOuGc2f0vhboo="; 24 | }; 25 | }; 26 | 27 | src = fetchzip { 28 | url = passthru.urls.${system}; 29 | hash = passthru.hashes.${system}; 30 | # the downloaded zip contains a dmg instead of the app 31 | # postFetch = '' 32 | # cd "$out" 33 | # ${lib.getExe undmg} "${appname}.dmg" 34 | # rm "${appname}.dmg" 35 | # ''; 36 | }; 37 | wrapperPath = "Contents/MacOS/${pname}"; 38 | 39 | nativeBuildInputs = [ 40 | rcodesign 41 | ]; 42 | 43 | preInstall = '' 44 | undmg ${appname}.dmg 45 | rcodesign sign ${appname}.app 46 | ''; 47 | 48 | meta = { 49 | description = "PDF viewer with a focus on textbooks and research papers"; 50 | homepage = "https://sioyek.info"; 51 | downloadPage = "https://github.com/ahrm/sioyek/releases"; 52 | license = lib.licenses.gpl3; 53 | platforms = lib.attrNames passthru.urls; 54 | }; 55 | } 56 | -------------------------------------------------------------------------------- /overlays/packages/ty-bin.nix: -------------------------------------------------------------------------------- 1 | { 2 | lib, 3 | fetchzip, 4 | stdenv, 5 | autoPatchelfHook, 6 | versionCheckHook, 7 | }: 8 | let 9 | inherit (stdenv.hostPlatform) system; 10 | in 11 | stdenv.mkDerivation rec { 12 | pname = "ty"; 13 | version = "0.0.1-alpha.8"; 14 | # prefetch-attrs .#ty-bin.passthru.urls --unpack 15 | 16 | passthru = { 17 | urls = { 18 | aarch64-darwin = "https://github.com/astral-sh/ty/releases/download/${version}/ty-aarch64-apple-darwin.tar.gz"; 19 | aarch64-linux = "https://github.com/astral-sh/ty/releases/download/${version}/ty-aarch64-unknown-linux-gnu.tar.gz"; 20 | x86_64-darwin = "https://github.com/astral-sh/ty/releases/download/${version}/ty-x86_64-apple-darwin.tar.gz"; 21 | x86_64-linux = "https://github.com/astral-sh/ty/releases/download/${version}/ty-x86_64-unknown-linux-gnu.tar.gz"; 22 | }; 23 | hashes = { 24 | aarch64-darwin = "sha256-dYPN2MuMFV8tUMlGdpxXWSvo32Z1K0u8Uh/9JRZDkls="; 25 | aarch64-linux = "sha256-Bji75WjzN0jxeqiqeF4s/B4GHR5hchRPVAT8+TIOUWU="; 26 | x86_64-darwin = "sha256-OfFnMz6xRPOtWim9Q7rtchTSkGPkl1VSh3knkA1rq0o="; 27 | x86_64-linux = "sha256-9DkG52uz6vg+gC2yW7QL1EluTX1ioybl5bXsDtupS+o="; 28 | }; 29 | }; 30 | 31 | src = fetchzip { 32 | url = passthru.urls.${system}; 33 | hash = passthru.hashes.${system}; 34 | }; 35 | 36 | buildInputs = lib.optional (!stdenv.isDarwin) (lib.getLib stdenv.cc.cc); 37 | 38 | nativeBuildInputs = lib.optional (!stdenv.isDarwin) autoPatchelfHook; 39 | 40 | dontBuild = true; 41 | 42 | installPhase = '' 43 | runHook preInstall 44 | 45 | mkdir -p $out/bin 46 | install -m755 -D ty $out/bin/ty 47 | 48 | runHook postInstall 49 | ''; 50 | 51 | nativeInstallCheckInputs = [ 52 | versionCheckHook 53 | ]; 54 | versionCheckProgramArg = "--version"; 55 | doInstallCheck = true; 56 | 57 | meta = { 58 | description = "An extremely fast Python type checker and language server, written in Rust"; 59 | homepage = "https://github.com/astral-sh/ty"; 60 | downloadPage = "https://github.com/astral-sh/ty/releases"; 61 | mainProgram = pname; 62 | platforms = lib.attrNames passthru.urls; 63 | maintainers = with lib.maintainers; [ mirkolenz ]; 64 | sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ]; 65 | license = lib.licenses.mit; 66 | }; 67 | } 68 | -------------------------------------------------------------------------------- /overlays/packages/uv-migrator.nix: -------------------------------------------------------------------------------- 1 | { 2 | lib, 3 | rustPlatform, 4 | fetchFromGitHub, 5 | }: 6 | rustPlatform.buildRustPackage rec { 7 | pname = "uv-migrator"; 8 | version = "2025.8.1"; 9 | useFetchCargoVendor = true; 10 | # nix-update --flake uv-migrator 11 | 12 | src = fetchFromGitHub { 13 | owner = "stvnksslr"; 14 | repo = "uv-migrator"; 15 | tag = "v${version}"; 16 | hash = "sha256-SzO9Z2y7LQ+AE90pGN734Z+0FOa3mcDeI7KMKqoWW4o="; 17 | }; 18 | 19 | cargoHash = "sha256-DsK8hDftdkVxxWuxCa8iHCDsD7huQAomj2fMSA7LjOY="; 20 | 21 | meta = { 22 | description = "Tool for migrating to the uv package manager"; 23 | homepage = "https://github.com/stvnksslr/uv-migrator"; 24 | changelog = "https://github.com/stvnksslr/uv-migrator/blob/${src.rev}/CHANGELOG.md"; 25 | license = lib.licenses.mpl20; 26 | maintainers = with lib.maintainers; [ mirkolenz ]; 27 | mainProgram = "uv-migrator"; 28 | }; 29 | } 30 | -------------------------------------------------------------------------------- /overlays/packages/vimr-bin.nix: -------------------------------------------------------------------------------- 1 | { 2 | mkApp, 3 | lib, 4 | fetchzip, 5 | rcodesign, 6 | }: 7 | mkApp rec { 8 | pname = "vimr"; 9 | version = "0.53.0"; 10 | build = "20250430.152427"; 11 | appname = "VimR"; 12 | src = fetchzip { 13 | url = "https://github.com/qvacua/vimr/releases/download/v${version}-${build}/${appname}-v${version}.tar.bz2"; 14 | hash = "sha256-D/6aZc0nvvCkjgoK+Co4623wPnE+QSbA/dFPdkZLlcY="; 15 | stripRoot = false; 16 | }; 17 | wrapperPath = "Contents/Resources/${pname}"; 18 | 19 | nativeBuildInputs = [ 20 | rcodesign 21 | ]; 22 | 23 | preInstall = '' 24 | rcodesign sign ${appname}.app 25 | ''; 26 | 27 | meta = { 28 | description = "Neovim GUI for macOS in Swift"; 29 | homepage = "https://github.com/qvacua/vimr"; 30 | downloadPage = "https://github.com/qvacua/vimr/releases"; 31 | license = lib.licenses.mit; 32 | }; 33 | } 34 | -------------------------------------------------------------------------------- /overlays/packages/wol.nix: -------------------------------------------------------------------------------- 1 | { 2 | lib, 3 | buildGoModule, 4 | fetchFromGitHub, 5 | }: 6 | buildGoModule rec { 7 | pname = "wol"; 8 | version = "0.1.0"; 9 | 10 | src = fetchFromGitHub { 11 | owner = "Trugamr"; 12 | repo = "wol"; 13 | tag = "v${version}"; 14 | hash = "sha256-kiV7DDGmVwJQzGMmvZHmmyz9IUfflbIrvxkIT5bY0Lw="; 15 | }; 16 | 17 | vendorHash = "sha256-DRA9PPNohzUtrIzucVIke5FhGvvA6zRuJzHt0qfB7PA="; 18 | 19 | ldflags = [ 20 | "-s" 21 | "-w" 22 | "-X=github.com/trugamr/wol/cmd.version=${version}" 23 | "-X=github.com/trugamr/wol/cmd.commit=${src.rev}" 24 | "-X=github.com/trugamr/wol/cmd.date=1970-01-01T00:00:00Z" 25 | ]; 26 | 27 | meta = { 28 | description = "Wake up your devices with a single command or click, a Wake-On-LAN tool that works via CLI and web interface"; 29 | homepage = "https://github.com/Trugamr/wol"; 30 | downloadPage = "https://github.com/Trugamr/wol/releases"; 31 | license = lib.licenses.mit; 32 | maintainers = with lib.maintainers; [ mirkolenz ]; 33 | mainProgram = "wol"; 34 | }; 35 | } 36 | -------------------------------------------------------------------------------- /overlays/packages/zigstar-multitool-bin.nix: -------------------------------------------------------------------------------- 1 | { 2 | lib, 3 | mkApp, 4 | fetchzip, 5 | }: 6 | mkApp rec { 7 | pname = "zigstar-multitool"; 8 | version = "0.4.2"; 9 | appname = "ZigStarGW-MT"; 10 | 11 | src = fetchzip { 12 | url = "https://github.com/xyzroe/ZigStarGW-MT/releases/download/v${version}/${appname}.app.zip"; 13 | hash = "sha256-8el7RqCVEHUkNY3JAHRkH9yKCCIRxDDOjR2+WW+zmKQ="; 14 | stripRoot = false; 15 | }; 16 | 17 | meta = { 18 | description = "UI wrapper designed for convenient service work with TI CC1352/CC2538/CC2652 based Zigbee sticks or gateways"; 19 | homepage = "https://github.com/xyzroe/ZigStarGW-MT"; 20 | downloadPage = "https://github.com/xyzroe/ZigStarGW-MT/releases"; 21 | license = lib.licenses.gpl3; 22 | }; 23 | } 24 | -------------------------------------------------------------------------------- /overlays/vim-plugins/copilot-lua.nix: -------------------------------------------------------------------------------- 1 | { vimUtils, fetchFromGitHub }: 2 | vimUtils.buildVimPlugin { 3 | name = "copilot.lua"; 4 | # prefetch-attr .#vimPlugins.copilot-lua.src.url --unpack 5 | src = fetchFromGitHub { 6 | owner = "zbirenbaum"; 7 | repo = "copilot.lua"; 8 | rev = "c1bb86abbed1a52a11ab3944ef00c8410520543d"; 9 | hash = "sha256-qxHpIsFFLDG/jtk6e1hkOZgDSRA5Q0+DMxxAxckNhIc="; 10 | }; 11 | meta.homepage = "https://github.com/zbirenbaum/copilot.lua/"; 12 | } 13 | -------------------------------------------------------------------------------- /overlays/vim-plugins/copilot-vim.nix: -------------------------------------------------------------------------------- 1 | { vimUtils, fetchFromGitHub }: 2 | vimUtils.buildVimPlugin rec { 3 | pname = "copilot.vim"; 4 | version = "1.50.0"; 5 | # prefetch-attr .#vimPlugins.copilot-vim.src.url --unpack 6 | src = fetchFromGitHub { 7 | owner = "github"; 8 | repo = "copilot.vim"; 9 | tag = "v${version}"; 10 | hash = "sha256-Y0VG+X16yB8gj+g/dCg2OUe1iXc0wGq94jGc3V/Lz7k="; 11 | }; 12 | meta.homepage = "https://github.com/github/copilot.vim/"; 13 | } 14 | -------------------------------------------------------------------------------- /overlays/vim-plugins/multicursor-nvim.nix: -------------------------------------------------------------------------------- 1 | { vimUtils, fetchFromGitHub }: 2 | vimUtils.buildVimPlugin { 3 | name = "multicursor.nvim"; 4 | # prefetch-attr .#vimPlugins.multicursor-nvim.src.url --unpack 5 | src = fetchFromGitHub { 6 | owner = "jake-stewart"; 7 | repo = "multicursor.nvim"; 8 | rev = "6fba38bccf45cfb681f4ff6098f886213f299a34"; 9 | hash = "sha256-NUOJlFZhB8OqBlkp+dXUQzFTHvPCMmWFMMTWmV7XdLQ="; 10 | }; 11 | meta.homepage = "https://github.com/jake-stewart/multicursor.nvim"; 12 | } 13 | -------------------------------------------------------------------------------- /overlays/vim-plugins/multiple-cursors.nix: -------------------------------------------------------------------------------- 1 | { vimUtils, fetchFromGitHub }: 2 | vimUtils.buildVimPlugin rec { 3 | pname = "multiple-cursors.nvim"; 4 | version = "0.15"; 5 | # prefetch-attr .#vimPlugins.multiple-cursors.src.url --unpack 6 | src = fetchFromGitHub { 7 | owner = "brenton-leighton"; 8 | repo = "multiple-cursors.nvim"; 9 | tag = "v${version}"; 10 | hash = "sha256-iTtohxL1uJu/KGGvZsnHfqPLj8EaGy1d30I+lHkJaRE="; 11 | }; 12 | meta.homepage = "https://github.com/brenton-leighton/multiple-cursors.nvim"; 13 | } 14 | -------------------------------------------------------------------------------- /renovate.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://docs.renovatebot.com/renovate-schema.json", 3 | "extends": ["github>mirkolenz/renovate-preset"] 4 | } 5 | -------------------------------------------------------------------------------- /system/common/default.nix: -------------------------------------------------------------------------------- 1 | { lib', config, ... }: 2 | { 3 | imports = lib'.flocken.getModules ./.; 4 | 5 | time.timeZone = "Europe/Berlin"; 6 | services.lorri.enable = config.custom.profile.isWorkstation; 7 | 8 | # networking.firewall = { 9 | # enable = true; 10 | # allowPing = true; 11 | # }; 12 | } 13 | -------------------------------------------------------------------------------- /system/common/nix.nix: -------------------------------------------------------------------------------- 1 | { 2 | user, 3 | config, 4 | inputs, 5 | lib', 6 | os, 7 | channel, 8 | pkgs, 9 | ... 10 | }: 11 | { 12 | nix = { 13 | package = pkgs.nix; 14 | extraOptions = '' 15 | !include nix.local.conf 16 | ''; 17 | # https://nixos.org/manual/nix/unstable/command-ref/conf-file.html#available-settings 18 | settings = { 19 | substituters = [ 20 | "https://nix-community.cachix.org" 21 | ]; 22 | trusted-public-keys = [ 23 | "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" 24 | "mirkolenz.cachix.org-1:R0dgCJ93t33K/gncNbKgUdJzwgsYVXeExRsZNz5jpho=" 25 | "wi2trier.cachix.org-1:8wJvKtRD8XUqYZMdjECTsN1zWxHy9kvp5aoPQiAm1fY=" 26 | "recap.cachix.org-1:KElwRDtaJbbQxmmS2SyxWHqs9bdJbaZHzb2iINTfQws=" 27 | "pyproject-nix.cachix.org-1:UNzugsOlQIu2iOz0VyZNBQm2JSrL/kwxeCcFGw+jMe0=" 28 | "nixbuild.net/BMAQHF-1:Q4LUtdLL0mXTO1Cs5jhcOKDZQUVlNA0u3QItwZ6uyq0=" 29 | "cache.garnix.io:CTFPyKSLcx5RMJKfLo5EEPUObbA78b0YQ2DTCJXqr9g=" 30 | ]; 31 | trusted-substituters = config.nix.settings.substituters ++ [ 32 | "https://mirkolenz.cachix.org" 33 | "https://wi2trier.cachix.org" 34 | "https://recap.cachix.org" 35 | "https://pyproject-nix.cachix.org" 36 | "ssh://eu.nixbuild.net" 37 | "https://cache.garnix.io" 38 | ]; 39 | # https://nix.dev/manual/nix/latest/development/experimental-features 40 | experimental-features = [ 41 | "flakes" 42 | "impure-derivations" 43 | "nix-command" 44 | "no-url-literals" 45 | "pipe-operators" 46 | ]; 47 | accept-flake-config = true; 48 | allow-import-from-derivation = true; 49 | allowed-users = [ user.login ]; 50 | always-allow-substitutes = true; 51 | bash-prompt-prefix = "(nix:$name)\\040"; 52 | builders-use-substitutes = true; 53 | cores = 0; 54 | download-buffer-size = 1000000000; # 1 GB 55 | keep-derivations = false; 56 | keep-failed = false; 57 | keep-going = true; 58 | keep-outputs = true; 59 | log-lines = 1000; 60 | max-jobs = "auto"; 61 | upgrade-nix-store-path-url = "https://install.determinate.systems/nix-upgrade/stable/universal"; 62 | warn-dirty = false; 63 | }; 64 | gc = { 65 | automatic = true; 66 | options = "--delete-older-than 7d"; 67 | }; 68 | optimise.automatic = true; 69 | registry = lib'.self.mkRegistry { inherit inputs os channel; }; 70 | channel.enable = false; 71 | # we set pkgs in the registry to the packages used to build the system 72 | # nixpkgs is set to nixpkgs-unstable in the registry 73 | nixPath = [ "nixpkgs=flake:pkgs" ]; 74 | }; 75 | # we do this ourselves 76 | nixpkgs.flake = { 77 | setFlakeRegistry = false; 78 | setNixPath = false; 79 | }; 80 | } 81 | -------------------------------------------------------------------------------- /system/common/options/default.nix: -------------------------------------------------------------------------------- 1 | { lib', ... }: 2 | { 3 | imports = lib'.flocken.getModules ./.; 4 | } 5 | -------------------------------------------------------------------------------- /system/common/options/secrets.nix: -------------------------------------------------------------------------------- 1 | { config, lib, ... }: 2 | { 3 | options.custom = { 4 | secretsPath = lib.mkOption { 5 | description = "Path to secrets file"; 6 | type = with lib.types; nullOr path; 7 | default = null; 8 | }; 9 | secrets = lib.mkOption { 10 | description = "Secrets parsed from file"; 11 | type = lib.types.attrs; 12 | default = if config.custom.secretsPath != null then import config.custom.secretsPath else { }; 13 | defaultText = "import custom.secretsPath or {}"; 14 | readOnly = true; 15 | }; 16 | }; 17 | } 18 | -------------------------------------------------------------------------------- /system/common/shell.nix: -------------------------------------------------------------------------------- 1 | { pkgs, ... }: 2 | { 3 | programs = { 4 | # bash is enabled by default 5 | fish = { 6 | enable = true; 7 | }; 8 | zsh = { 9 | enable = true; 10 | }; 11 | }; 12 | environment.shells = with pkgs; [ fish ]; 13 | environment.pathsToLink = [ 14 | "/share/bash-completion" 15 | "/share/fish" 16 | "/share/zsh" 17 | ]; 18 | } 19 | -------------------------------------------------------------------------------- /system/common/ssh.nix: -------------------------------------------------------------------------------- 1 | { ... }: 2 | { 3 | # update: ssh-keyscan -t ed25519 URL_OR_IP 4 | programs.ssh.knownHosts = { 5 | "github.com".publicKey = 6 | "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOMqqnkVzrm0SdG6UOoqKLsabgH5C9okWi0dh2l9GKJl"; 7 | "gitlab.com".publicKey = 8 | "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAfuCHKVTjquxvt6CM6tdG4SLp1Btn/nOeHHE5UOzRdf"; 9 | "gitlab.rlp.net".publicKey = 10 | "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMqZhJQejjLLmvCk0wEgSDN5+6oCgp3ggKw0MBl5VDXI"; 11 | "eu.nixbuild.net".publicKey = 12 | "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPIQCZc54poJ8vqawd8TraNryQeJnvH1eLpIDgbiqymM"; 13 | "gpu.wi2.uni-trier.de".publicKey = 14 | "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFjEIHTnzAhYtFJhcXrWm7OuzWli/YUNMsq9xmlEjUfE"; 15 | "macpro.lenz.casa".publicKey = 16 | "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIP5n2KpAU3E8iHy56vNURjh7E3l0EjkZ6BX450Z44hiH"; 17 | "raspi.lenz.casa".publicKey = 18 | "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGR8BCsN02425GzSv1PQNhUGx0rm8D4aKSZh8ut5OJ6/"; 19 | }; 20 | } 21 | -------------------------------------------------------------------------------- /system/common/users.nix: -------------------------------------------------------------------------------- 1 | { 2 | pkgs, 3 | lib, 4 | user, 5 | ... 6 | }: 7 | let 8 | homeDirectory = if pkgs.stdenv.isDarwin then "/Users/${user.login}" else "/home/${user.login}"; 9 | in 10 | { 11 | users = { 12 | users.root = lib.mkIf pkgs.stdenv.isLinux { 13 | # Disable root login 14 | # https://discourse.nixos.org/t/how-to-disable-root-user-account-in-configuration-nix/13235/2 15 | initialHashedPassword = lib.mkDefault "!"; 16 | }; 17 | users.${user.login} = lib.mkMerge [ 18 | { 19 | description = user.name; 20 | home = homeDirectory; 21 | shell = pkgs.fish; 22 | } 23 | (lib.mkIf pkgs.stdenv.isLinux { 24 | uid = lib.mkDefault 1000; 25 | group = user.login; 26 | # https://wiki.debian.org/SystemGroups#Other_System_Groups 27 | extraGroups = [ 28 | "users" 29 | "wheel" 30 | "video" 31 | "audio" 32 | ]; 33 | isNormalUser = true; 34 | initialHashedPassword = "$y$j9T$PNrr2mfD3mtxoSfR26fYh/$qNvFLgYOJFAms5MwZ42vM0F0aUP.ceHpD0j4LAr7IP5"; 35 | openssh.authorizedKeys.keys = user.sshKeys; 36 | subUidRanges = [ 37 | { 38 | count = 65536; 39 | startUid = 100000; 40 | } 41 | ]; 42 | subGidRanges = [ 43 | { 44 | count = 65536; 45 | startGid = 100000; 46 | } 47 | ]; 48 | }) 49 | (lib.mkIf pkgs.stdenv.isDarwin { 50 | uid = lib.mkDefault 501; 51 | gid = lib.mkDefault 20; 52 | }) 53 | ]; 54 | groups.${user.login} = lib.mkIf pkgs.stdenv.isLinux { 55 | gid = lib.mkDefault 1000; 56 | }; 57 | }; 58 | } 59 | -------------------------------------------------------------------------------- /system/darwin/builders/default.nix: -------------------------------------------------------------------------------- 1 | { ... }: 2 | { 3 | # https://github.com/LnL7/nix-darwin/blob/master/modules/nix/linux-builder.nix 4 | # The ServerAliveInterval and IPQoS settings have been found to make remote builds more reliable, 5 | # especially if there are long silent periods with no logs emitted by a build. 6 | imports = [ ./orbstack.nix ]; 7 | nix = { 8 | distributedBuilds = true; 9 | settings.builders-use-substitutes = true; 10 | }; 11 | } 12 | -------------------------------------------------------------------------------- /system/darwin/builders/nixbuild.nix: -------------------------------------------------------------------------------- 1 | { lib, user, ... }: 2 | { 3 | environment.etc."ssh/ssh_config.d/100-nixbuild.conf".text = '' 4 | Host nixbuild 5 | Hostname eu.nixbuild.net 6 | PubkeyAcceptedKeyTypes ssh-ed25519 7 | ServerAliveInterval 60 8 | IPQoS throughput 9 | ''; 10 | nix.buildMachines = lib.singleton { 11 | hostName = "nixbuild"; 12 | maxJobs = 100; 13 | systems = [ 14 | "x86_64-linux" 15 | "aarch64-linux" 16 | ]; 17 | supportedFeatures = [ 18 | "benchmark" 19 | "big-parallel" 20 | ]; 21 | sshKey = "/Users/${user.login}/.ssh/id_nixbuild"; 22 | protocol = "ssh-ng"; 23 | }; 24 | } 25 | -------------------------------------------------------------------------------- /system/darwin/builders/orbstack.nix: -------------------------------------------------------------------------------- 1 | { 2 | lib, 3 | pkgs, 4 | user, 5 | ... 6 | }: 7 | { 8 | # https://docs.orbstack.dev/machines/ssh 9 | environment.etc."ssh/ssh_config.d/100-orbstack-builder.conf".text = '' 10 | Host orbstack-builder 11 | Hostname 127.0.0.1 12 | Port 32222 13 | ServerAliveInterval 60 14 | IPQoS throughput 15 | ''; 16 | nix.buildMachines = lib.singleton { 17 | hostName = "orbstack-builder"; 18 | speedFactor = 2; 19 | maxJobs = 8; 20 | systems = [ "${pkgs.stdenv.hostPlatform.uname.processor}-linux" ]; 21 | supportedFeatures = [ 22 | "kvm" 23 | "benchmark" 24 | "big-parallel" 25 | ]; 26 | sshUser = "nixos"; 27 | sshKey = "/Users/${user.login}/.orbstack/ssh/id_ed25519"; 28 | protocol = "ssh-ng"; 29 | }; 30 | } 31 | -------------------------------------------------------------------------------- /system/darwin/channels/default.nix: -------------------------------------------------------------------------------- 1 | { channel, ... }: 2 | { 3 | imports = [ ./${channel}.nix ]; 4 | } 5 | -------------------------------------------------------------------------------- /system/darwin/channels/stable.nix: -------------------------------------------------------------------------------- 1 | { ... }: { } 2 | -------------------------------------------------------------------------------- /system/darwin/channels/unstable.nix: -------------------------------------------------------------------------------- 1 | { ... }: { } 2 | -------------------------------------------------------------------------------- /system/darwin/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | lib', 3 | pkgs, 4 | stateVersions, 5 | ... 6 | }: 7 | { 8 | imports = lib'.flocken.getModules ./.; 9 | 10 | environment.systemPackages = with pkgs; [ _1password-cli ]; 11 | 12 | system.stateVersion = stateVersions.darwin; 13 | } 14 | -------------------------------------------------------------------------------- /system/darwin/homebrew.nix: -------------------------------------------------------------------------------- 1 | { ... }: 2 | let 3 | caskApps = [ 4 | "1password" 5 | "adobe-creative-cloud" 6 | "alt-tab" 7 | "anydesk" 8 | "arq" 9 | "balenaetcher" 10 | "betterdisplay" 11 | "cameracontroller" 12 | "claude" 13 | "cleanshot" 14 | "ddpm" 15 | "default-folder-x" 16 | "devonthink" 17 | "discord" 18 | "drawio" 19 | "element" 20 | "figma" 21 | "firefox" 22 | "fission" 23 | "forklift" 24 | "ghostty" 25 | "godspeed" 26 | "google-chrome" 27 | "google-drive" 28 | "handbrake" 29 | "ia-presenter" 30 | "jordanbaird-ice" 31 | "kindavim" 32 | "lookaway" 33 | "mediathekview" 34 | "microsoft-auto-update" 35 | "microsoft-edge" 36 | "microsoft-teams" 37 | "neohtop" 38 | "notion" 39 | "obsidian" 40 | "omnigraffle" 41 | "orbstack" 42 | "orion" 43 | "parallels" 44 | "pixelsnap" 45 | "postman" 46 | "presentation" 47 | "raindropio" 48 | "raycast" 49 | "rode-central" 50 | "signal" 51 | "skim" 52 | "soundsource" 53 | "stats" 54 | "steermouse" 55 | "tailscale" 56 | "tiptoi-manager" 57 | "vimr" 58 | "viscosity" 59 | "visual-studio-code" 60 | "vivaldi" 61 | "wezterm" 62 | "wifiman" 63 | "zed" 64 | "zed@preview" 65 | "zoom" 66 | "zotero@beta" 67 | ]; 68 | 69 | masApps = { 70 | _1password-safari = 1569813296; 71 | ausweisapp = 948660805; 72 | bitwarden = 1352778147; 73 | daisydisk = 411643860; 74 | dropover = 1355679052; 75 | easyletter = 1495179755; 76 | gapplin = 768053424; 77 | goodnotes = 1444383602; 78 | home-assistant = 1099568401; 79 | kagi = 1622835804; 80 | keka = 470158793; 81 | kindle = 302584613; 82 | meeting-owl = 1219076447; 83 | mela = 1568924476; 84 | microsoft-excel = 462058435; 85 | microsoft-outlook = 985367838; 86 | microsoft-powerpoint = 462062816; 87 | microsoft-word = 462054704; 88 | onedrive = 823766827; 89 | pdf-expert = 1055273043; 90 | pure-paste = 1611378436; 91 | qr-factory = 1609285899; 92 | qr-pop = 1587360435; 93 | raindrop-io-safari = 1549370672; 94 | reeder = 6475002485; 95 | shellfish = 1336634154; 96 | step-two = 1448916662; 97 | stopthemadness-pro = 6471380298; 98 | tabback = 1660506599; 99 | testflight = 899247664; 100 | texstage = 6737460352; 101 | todoist = 585829637; 102 | vinegar = 1591303229; 103 | whatsapp = 310633997; 104 | }; 105 | 106 | caskFonts = map (name: "font-${name}") [ 107 | "big-shoulders-display" 108 | "big-shoulders-inline-display" 109 | "big-shoulders-inline-text" 110 | "big-shoulders-stencil-display" 111 | "big-shoulders-stencil-text" 112 | "big-shoulders-text" 113 | "cascadia-code-nf" 114 | "cascadia-code" 115 | "cascadia-mono" 116 | "caskaydia-cove-nerd-font" 117 | "eagle-lake" 118 | "eb-garamond" 119 | "expletus-sans" 120 | "fira-code-nerd-font" 121 | "fira-code" 122 | "fira-mono" 123 | "fira-sans" 124 | "fontawesome" 125 | "geist-mono" 126 | "geist" 127 | "ia-writer-duo" 128 | "ia-writer-mono" 129 | "ia-writer-quattro" 130 | "ibm-plex" 131 | "intel-one-mono" 132 | "inter" 133 | "intone-mono-nerd-font" 134 | "iosevka" 135 | "jetbrains-mono-nerd-font" 136 | "jetbrains-mono" 137 | "jost" 138 | "lugrasimo" 139 | "manrope" 140 | "monaspace-nerd-font" 141 | "monaspace" 142 | "overlock-sc" 143 | "overlock" 144 | "roboto-flex" 145 | "roboto-mono" 146 | "roboto-serif" 147 | "roboto-slab" 148 | "roboto" 149 | "source-code-pro" 150 | "source-sans-3" 151 | "source-serif-4" 152 | "tangerine" 153 | "tex-gyre-adventor" 154 | "tex-gyre-bonum-math" 155 | "tex-gyre-bonum" 156 | "tex-gyre-chorus" 157 | "tex-gyre-cursor" 158 | "tex-gyre-heros" 159 | "tex-gyre-pagella-math" 160 | "tex-gyre-pagella" 161 | "tex-gyre-schola-math" 162 | "tex-gyre-schola" 163 | "tex-gyre-termes-math" 164 | "tex-gyre-termes" 165 | "ubuntu-condensed" 166 | "ubuntu-mono-nerd-font" 167 | "ubuntu-mono" 168 | "ubuntu-nerd-font" 169 | "ubuntu-sans-mono" 170 | "ubuntu-sans-nerd-font" 171 | "ubuntu-sans" 172 | "ubuntu" 173 | "varela-round" 174 | "zed-mono-nerd-font" 175 | "zed-mono" 176 | "zed-sans" 177 | ]; 178 | in 179 | { 180 | environment.variables = { 181 | HOMEBREW_NO_ENV_HINTS = "1"; 182 | }; 183 | homebrew = { 184 | enable = true; 185 | global = { 186 | autoUpdate = true; 187 | }; 188 | onActivation = { 189 | autoUpdate = true; 190 | upgrade = true; 191 | cleanup = "zap"; 192 | }; 193 | taps = [ ]; 194 | brews = [ ]; 195 | casks = caskApps ++ caskFonts; 196 | inherit masApps; 197 | }; 198 | } 199 | -------------------------------------------------------------------------------- /system/darwin/nix.nix: -------------------------------------------------------------------------------- 1 | { 2 | user, 3 | lib, 4 | pkgs, 5 | ... 6 | }: 7 | { 8 | nix = { 9 | package = lib.mkForce pkgs.nixVersions.nix_2_29; 10 | settings = { 11 | build-users-group = "nixbld"; 12 | allowed-users = [ "@staff" ]; 13 | trusted-users = [ user.login ]; 14 | sandbox = false; 15 | }; 16 | }; 17 | } 18 | -------------------------------------------------------------------------------- /system/darwin/options/default.nix: -------------------------------------------------------------------------------- 1 | { lib', ... }: 2 | { 3 | imports = lib'.flocken.getModules ./.; 4 | } 5 | -------------------------------------------------------------------------------- /system/darwin/security.nix: -------------------------------------------------------------------------------- 1 | { ... }: 2 | { 3 | security = { 4 | pam.services.sudo_local = { 5 | enable = true; 6 | touchIdAuth = true; 7 | watchIdAuth = true; 8 | }; 9 | sudo.extraConfig = '' 10 | Defaults env_keep -= "HOME" 11 | ''; 12 | }; 13 | } 14 | -------------------------------------------------------------------------------- /system/darwin/users.nix: -------------------------------------------------------------------------------- 1 | { user, ... }: 2 | { 3 | system.primaryUser = user.login; 4 | users.knownUsers = [ user.login ]; 5 | } 6 | -------------------------------------------------------------------------------- /system/installer.nix: -------------------------------------------------------------------------------- 1 | { user, ... }: 2 | { 3 | users.users.root.openssh.authorizedKeys.keys = user.sshKeys; 4 | services.openssh.enable = true; 5 | 6 | programs = { 7 | git = { 8 | enable = true; 9 | }; 10 | neovim = { 11 | enable = true; 12 | defaultEditor = true; 13 | viAlias = true; 14 | vimAlias = true; 15 | }; 16 | }; 17 | } 18 | -------------------------------------------------------------------------------- /system/linux/channels/default.nix: -------------------------------------------------------------------------------- 1 | { channel, ... }: 2 | { 3 | imports = [ ./${channel}.nix ]; 4 | } 5 | -------------------------------------------------------------------------------- /system/linux/channels/stable.nix: -------------------------------------------------------------------------------- 1 | { ... }: { } 2 | -------------------------------------------------------------------------------- /system/linux/channels/unstable.nix: -------------------------------------------------------------------------------- 1 | { ... }: { } 2 | -------------------------------------------------------------------------------- /system/linux/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | lib', 4 | pkgs, 5 | stateVersions, 6 | ... 7 | }: 8 | { 9 | imports = lib'.flocken.getModules ./.; 10 | 11 | custom.podman.enable = true; 12 | 13 | i18n.defaultLocale = "en_US.UTF-8"; 14 | 15 | users = { 16 | mutableUsers = true; 17 | defaultUserShell = pkgs.fish; 18 | }; 19 | 20 | programs = { 21 | git = { 22 | enable = true; 23 | }; 24 | neovim = { 25 | enable = true; 26 | defaultEditor = true; 27 | viAlias = true; 28 | vimAlias = true; 29 | }; 30 | _1password.enable = true; 31 | }; 32 | 33 | environment.defaultPackages = with pkgs; [ 34 | rsync 35 | python3 36 | strace 37 | ]; 38 | 39 | environment.systemPackages = with pkgs; [ 40 | pciutils 41 | ]; 42 | 43 | services = { 44 | printing.enable = false; 45 | }; 46 | 47 | system.stateVersion = stateVersions.linux; 48 | system.rebuild.enableNg = true; 49 | 50 | security = { 51 | sudo = { 52 | execWheelOnly = true; 53 | }; 54 | sudo-rs = { 55 | enable = true; 56 | inherit (config.security.sudo) execWheelOnly wheelNeedsPassword; 57 | }; 58 | }; 59 | 60 | systemd.enableStrictShellChecks = true; 61 | documentation.man.generateCaches = false; 62 | 63 | boot.loader = { 64 | systemd-boot.configurationLimit = 10; 65 | generic-extlinux-compatible.configurationLimit = 10; 66 | grub.configurationLimit = 10; 67 | }; 68 | 69 | hardware.enableAllFirmware = true; 70 | 71 | zramSwap = { 72 | enable = true; 73 | memoryPercent = 100; 74 | memoryMax = 8 * 1024 * 1024 * 1024; 75 | }; 76 | } 77 | -------------------------------------------------------------------------------- /system/linux/desktop.nix: -------------------------------------------------------------------------------- 1 | { 2 | lib, 3 | config, 4 | user, 5 | ... 6 | }: 7 | lib.mkIf config.custom.profile.isDesktop { 8 | services.xserver.enable = true; 9 | 10 | security.rtkit.enable = config.services.pipewire.enable; 11 | services.pipewire = { 12 | enable = true; 13 | alsa = { 14 | enable = true; 15 | support32Bit = true; 16 | }; 17 | }; 18 | 19 | hardware.graphics.enable = true; 20 | 21 | networking.networkmanager.enable = true; 22 | systemd.network.wait-online.enable = false; 23 | users.users.${user.login}.extraGroups = [ "networkmanager" ]; 24 | 25 | programs = { 26 | _1password-gui = { 27 | enable = true; 28 | polkitPolicyOwners = [ user.login ]; 29 | }; 30 | }; 31 | 32 | nix.settings.trusted-users = [ user.login ]; 33 | } 34 | -------------------------------------------------------------------------------- /system/linux/network.nix: -------------------------------------------------------------------------------- 1 | # https://github.com/mirkolenz/nixos/commit/fb5a0a77b8157809c1b610f1931d4f94f5e6be42 2 | { lib, ... }: 3 | { 4 | networking = { 5 | useNetworkd = true; 6 | # this is overridden by NetworkManager on workstations 7 | useDHCP = lib.mkDefault true; 8 | # this is not compatible with networkd 9 | useHostResolvConf = false; 10 | }; 11 | 12 | systemd.network.wait-online = { 13 | timeout = 30; 14 | }; 15 | 16 | # Do not manage wifi interfaces with networkd by default 17 | systemd.network.networks."90-wlan" = { 18 | matchConfig.Type = "wlan"; 19 | linkConfig.Unmanaged = true; 20 | }; 21 | 22 | services.tailscale = { 23 | enable = true; 24 | openFirewall = true; 25 | }; 26 | } 27 | -------------------------------------------------------------------------------- /system/linux/nix.nix: -------------------------------------------------------------------------------- 1 | { 2 | nix = { 3 | settings = { 4 | # https://github.com/NixOS/nix/issues/7273#issuecomment-1310213986 5 | auto-optimise-store = true; 6 | allowed-users = [ "@wheel" ]; 7 | sandbox = true; 8 | }; 9 | }; 10 | } 11 | -------------------------------------------------------------------------------- /system/linux/options/default.nix: -------------------------------------------------------------------------------- 1 | { lib', ... }: 2 | { 3 | imports = lib'.flocken.getModules ./.; 4 | } 5 | -------------------------------------------------------------------------------- /system/linux/options/docker.nix: -------------------------------------------------------------------------------- 1 | { config, lib, ... }: 2 | let 3 | cfg = config.custom.docker; 4 | in 5 | { 6 | options.custom.docker = { 7 | enable = lib.mkEnableOption "Docker"; 8 | userns = lib.mkOption { 9 | type = with lib.types; nullOr str; 10 | default = null; 11 | }; 12 | enableIcc = lib.mkEnableOption "Enable inter-container communication"; 13 | }; 14 | 15 | config = lib.mkIf cfg.enable { 16 | virtualisation.docker = { 17 | enable = true; 18 | autoPrune = { 19 | enable = true; 20 | dates = "daily"; 21 | }; 22 | daemon.settings = { 23 | icc = cfg.enableIcc; 24 | userns-remap = lib.mkIf (cfg.userns != null) cfg.userns; 25 | }; 26 | }; 27 | }; 28 | } 29 | -------------------------------------------------------------------------------- /system/linux/options/podman.nix: -------------------------------------------------------------------------------- 1 | { config, lib, ... }: 2 | let 3 | cfg = config.custom.podman; 4 | in 5 | { 6 | options.custom.podman = { 7 | enable = lib.mkEnableOption "Podman"; 8 | }; 9 | 10 | config = lib.mkIf cfg.enable { 11 | virtualisation.podman = { 12 | enable = true; 13 | # logDriver = "json-file"; 14 | autoPrune = { 15 | enable = true; 16 | dates = "daily"; 17 | }; 18 | }; 19 | users.users.containers = { 20 | isSystemUser = true; 21 | group = "containers"; 22 | subUidRanges = [ 23 | { 24 | startUid = 2147483647; 25 | count = 2147483648; 26 | } 27 | ]; 28 | subGidRanges = [ 29 | { 30 | startGid = 2147483647; 31 | count = 2147483648; 32 | } 33 | ]; 34 | }; 35 | users.groups.containers = { }; 36 | }; 37 | } 38 | -------------------------------------------------------------------------------- /system/linux/options/quadlet/_container.nix: -------------------------------------------------------------------------------- 1 | { 2 | lib, 3 | name, 4 | ... 5 | }: 6 | let 7 | inherit (lib) mkOption types; 8 | in 9 | { 10 | options = { 11 | virtualHost = mkOption { 12 | default = { }; 13 | type = types.submodule ./_vhost.nix; 14 | }; 15 | }; 16 | config = { 17 | virtualHost.name = lib.mkDefault name; 18 | }; 19 | } 20 | -------------------------------------------------------------------------------- /system/linux/options/quadlet/_vhost.nix: -------------------------------------------------------------------------------- 1 | { 2 | name, 3 | lib, 4 | ... 5 | }: 6 | { 7 | options = { 8 | name = lib.mkOption { 9 | type = with lib.types; str; 10 | default = name; 11 | }; 12 | extraNames = lib.mkOption { 13 | type = with lib.types; listOf str; 14 | default = [ ]; 15 | }; 16 | reverseProxy = lib.mkOption { 17 | default = { }; 18 | type = lib.types.submodule { 19 | options = { 20 | upstreams = lib.mkOption { 21 | type = with lib.types; listOf str; 22 | default = [ ]; 23 | }; 24 | extraConfig = lib.mkOption { 25 | type = lib.types.lines; 26 | default = ""; 27 | description = '' 28 | Additional lines of configuration appended to the reverse proxy in the automatically generated `Caddyfile`. 29 | ''; 30 | }; 31 | }; 32 | }; 33 | }; 34 | extraConfig = lib.mkOption { 35 | type = lib.types.lines; 36 | default = ""; 37 | description = '' 38 | Additional lines of configuration appended to the virtual host in the automatically generated `Caddyfile`. 39 | ''; 40 | }; 41 | }; 42 | } 43 | -------------------------------------------------------------------------------- /system/linux/options/quadlet/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | lib, 3 | lib', 4 | ... 5 | }: 6 | let 7 | inherit (lib) types mkOption; 8 | in 9 | { 10 | imports = lib'.flocken.getModules ./.; 11 | options.virtualisation.quadlet = { 12 | containers = mkOption { 13 | type = types.attrsOf (types.submodule ./_container.nix); 14 | }; 15 | }; 16 | } 17 | -------------------------------------------------------------------------------- /system/linux/options/quadlet/proxy.nix: -------------------------------------------------------------------------------- 1 | { 2 | lib, 3 | pkgs, 4 | config, 5 | ... 6 | }: 7 | let 8 | cfg = config.virtualisation.quadlet.proxy; 9 | 10 | mkVirtualHost = 11 | { 12 | domain, 13 | vhost, 14 | }: 15 | let 16 | allNames = [ vhost.name ] ++ vhost.extraNames; 17 | allHostNames = map (name: "${name}.${domain}") allNames; 18 | in 19 | '' 20 | @${vhost.name} host ${lib.concatStringsSep " " allHostNames} 21 | handle @${vhost.name} { 22 | ${lib.optionalString (vhost.reverseProxy.upstreams != [ ]) '' 23 | reverse_proxy ${lib.concatStringsSep " " vhost.reverseProxy.upstreams} { 24 | ${vhost.reverseProxy.extraConfig} 25 | } 26 | ''} 27 | ${vhost.extraConfig} 28 | } 29 | ''; 30 | 31 | mkDomainConfig = domain: '' 32 | *.${domain.name} { 33 | ${domain.extraConfig} 34 | 35 | ${lib.concatLines ( 36 | map mkVirtualHost ( 37 | lib.mapAttrsToList (_: value: { 38 | domain = domain.name; 39 | vhost = value.virtualHost; 40 | }) config.virtualisation.quadlet.containers 41 | ) 42 | )} 43 | 44 | ${lib.concatLines ( 45 | map mkVirtualHost ( 46 | lib.mapAttrsToList (_: value: { 47 | domain = domain.name; 48 | vhost = value; 49 | }) cfg.virtualHosts 50 | ) 51 | )} 52 | 53 | handle { 54 | abort 55 | } 56 | } 57 | ''; 58 | 59 | Caddyfile-raw = pkgs.writeTextDir "Caddyfile" '' 60 | { 61 | email ${cfg.email} 62 | ${lib.optionalString cfg.acmeStaging "acme_ca https://acme-staging-v02.api.letsencrypt.org/directory"} 63 | ${cfg.globalConfig} 64 | } 65 | 66 | (only_lan) { 67 | @wan not remote_ip private_ranges 68 | abort @wan 69 | } 70 | 71 | ${cfg.extraConfig} 72 | 73 | ${lib.concatLines (map mkDomainConfig (lib.attrValues cfg.domains))} 74 | ''; 75 | 76 | Caddyfile-formatted = 77 | pkgs.runCommand "Caddyfile-formatted" { nativeBuildInputs = [ pkgs.caddy ]; } 78 | '' 79 | mkdir -p $out 80 | cp --no-preserve=mode ${Caddyfile-raw}/Caddyfile $out/Caddyfile 81 | caddy fmt --overwrite $out/Caddyfile 82 | ''; 83 | 84 | Caddyfile = 85 | if pkgs.stdenv.buildPlatform == pkgs.stdenv.hostPlatform then 86 | Caddyfile-formatted 87 | else 88 | Caddyfile-raw; 89 | in 90 | { 91 | options.virtualisation.quadlet.proxy = { 92 | enable = lib.mkEnableOption "Reverse proxy with Caddy"; 93 | 94 | systemdConfig = lib.mkOption { 95 | type = with lib.types; attrsOf anything; 96 | default = { }; 97 | }; 98 | 99 | networks = { 100 | internal = { 101 | ref = lib.mkOption { type = with lib.types; str; }; 102 | ip = lib.mkOption { type = with lib.types; str; }; 103 | }; 104 | external = { 105 | ref = lib.mkOption { type = with lib.types; str; }; 106 | ip = lib.mkOption { type = with lib.types; str; }; 107 | }; 108 | }; 109 | 110 | storage = { 111 | data = lib.mkOption { type = with lib.types; str; }; 112 | config = lib.mkOption { type = with lib.types; str; }; 113 | certificates = lib.mkOption { 114 | type = with lib.types; nullOr str; 115 | default = null; 116 | }; 117 | }; 118 | 119 | email = lib.mkOption { type = with lib.types; str; }; 120 | 121 | acmeStaging = lib.mkEnableOption "use Let's Encrypt staging server"; 122 | 123 | domains = lib.mkOption { 124 | default = { }; 125 | type = lib.types.attrsOf ( 126 | lib.types.submodule ( 127 | { name, ... }: 128 | { 129 | options = { 130 | name = lib.mkOption { 131 | type = lib.types.str; 132 | default = name; 133 | }; 134 | extraConfig = lib.mkOption { 135 | type = lib.types.lines; 136 | default = ""; 137 | }; 138 | }; 139 | } 140 | ) 141 | ); 142 | }; 143 | 144 | virtualHosts = lib.mkOption { 145 | default = { }; 146 | type = lib.types.attrsOf (lib.types.submodule ./_vhost.nix); 147 | }; 148 | 149 | extraConfig = lib.mkOption { 150 | type = lib.types.lines; 151 | default = ""; 152 | description = '' 153 | Additional lines of configuration appended to the automatically generated `Caddyfile`. 154 | ''; 155 | }; 156 | 157 | globalConfig = lib.mkOption { 158 | type = lib.types.lines; 159 | default = ""; 160 | description = '' 161 | Additional lines of global configuration appended to the automatically generated `Caddyfile`. 162 | ''; 163 | }; 164 | 165 | configFile = lib.mkOption { 166 | type = lib.types.path; 167 | default = "${Caddyfile}/Caddyfile"; 168 | }; 169 | }; 170 | config = lib.mkIf (config.virtualisation.quadlet.enable && cfg.enable) { 171 | virtualisation.quadlet.containers.proxy = lib.mkMerge [ 172 | { 173 | imageStream = pkgs.caddy-docker; 174 | containerConfig = { 175 | Volume = [ 176 | "${cfg.configFile}:/etc/caddy/Caddyfile:ro" 177 | "${cfg.storage.data}:/data" 178 | "${cfg.storage.config}:/config" 179 | ] ++ (lib.optional (cfg.storage.certificates != null) "${cfg.storage.certificates}:/certificates"); 180 | Network = [ 181 | "${cfg.networks.internal.ref}:ip=${cfg.networks.internal.ip}" 182 | "${cfg.networks.external.ref}:ip=${cfg.networks.external.ip}" 183 | ]; 184 | PublishPort = [ 185 | "80:80" 186 | "443:443" 187 | "443:443/udp" 188 | ]; 189 | }; 190 | } 191 | cfg.systemdConfig 192 | ]; 193 | }; 194 | } 195 | -------------------------------------------------------------------------------- /system/linux/options/quadlet/wrapper.nix: -------------------------------------------------------------------------------- 1 | { 2 | lib, 3 | pkgs, 4 | config, 5 | ... 6 | }: 7 | let 8 | cfg = config.virtualisation.quadlet.shellWrapper; 9 | 10 | wrapper = pkgs.writeShellApplication rec { 11 | name = "quadletctl"; 12 | text = '' 13 | if [ "$#" -eq 0 ]; then 14 | set -- "help" 15 | fi 16 | command="$1" 17 | shift 18 | if [ "$command" = "exec" ]; then 19 | exec sudo ${lib.getExe pkgs.podman} exec "$@" 20 | fi 21 | if [ "$command" = "update" ]; then 22 | exec sudo ${lib.getExe pkgs.podman} auto-update "$@" 23 | fi 24 | if [ "$command" = "service" ]; then 25 | exec systemctl "''${2:-status}" "$1.service" "''${@:3}" 26 | fi 27 | if [ "$command" = "journal" ]; then 28 | exec journalctl --pager-end --no-hostname --unit "$1.service" "''${@:2}" 29 | fi 30 | if [ "$command" = "unshare" ]; then 31 | exec unshare --user --map-auto --setuid "$1" --setgid "$1" -- "''${@:2}" 32 | fi 33 | if [ "$command" = "help" ]; then 34 | echo "Usage: ${name} 35 | 36 | Available commands: 37 | exec : Run a command in an existing container 38 | update : Run podman auto-update 39 | service : Control the systemd service 40 | journal : Show the logs of the podman service 41 | unshare : Run a command in a new user namespace 42 | " 43 | exit 0 44 | fi 45 | ''; 46 | }; 47 | in 48 | { 49 | options.virtualisation.quadlet.shellWrapper = { 50 | enable = lib.mkOption { 51 | default = true; 52 | type = with lib.types; bool; 53 | }; 54 | }; 55 | 56 | config = lib.mkIf cfg.enable { 57 | environment.systemPackages = [ wrapper ]; 58 | }; 59 | } 60 | -------------------------------------------------------------------------------- /system/linux/options/visiturl.nix: -------------------------------------------------------------------------------- 1 | { 2 | lib, 3 | pkgs, 4 | config, 5 | ... 6 | }: 7 | let 8 | cfg = config.custom.visiturl; 9 | in 10 | { 11 | options.custom.visiturl = lib.mkOption { 12 | default = { }; 13 | type = lib.types.attrsOf ( 14 | lib.types.submodule ( 15 | { name, ... }: 16 | { 17 | options = { 18 | enable = lib.mkEnableOption "periodically visit a URL"; 19 | name = lib.mkOption { 20 | type = lib.types.str; 21 | default = name; 22 | }; 23 | description = lib.mkOption { 24 | type = lib.types.str; 25 | default = ""; 26 | }; 27 | url = lib.mkOption { 28 | type = lib.types.str; 29 | example = "$URL"; 30 | }; 31 | interval = lib.mkOption { 32 | type = lib.types.str; 33 | }; 34 | envFile = lib.mkOption { 35 | type = with lib.types; nullOr path; 36 | default = null; 37 | }; 38 | }; 39 | } 40 | ) 41 | ); 42 | }; 43 | config = { 44 | systemd.timers = lib.mapAttrs' (_: entry: { 45 | inherit (entry) name; 46 | value = lib.mkIf entry.enable { 47 | wantedBy = [ "timers.target" ]; 48 | description = entry.description; 49 | timerConfig = { 50 | OnBootSec = entry.interval; 51 | OnUnitActiveSec = entry.interval; 52 | Unit = "${entry.name}.service"; 53 | }; 54 | }; 55 | }) cfg; 56 | systemd.services = lib.mapAttrs' (_: entry: { 57 | inherit (entry) name; 58 | value = lib.mkIf entry.enable { 59 | script = '' 60 | ${lib.getExe pkgs.wget} "${entry.url}" -O - 61 | ''; 62 | serviceConfig = { 63 | Type = "oneshot"; 64 | DynamicUser = true; 65 | EnvironmentFile = lib.mkIf (entry.envFile != null) entry.envFile; 66 | }; 67 | }; 68 | }) cfg; 69 | }; 70 | } 71 | -------------------------------------------------------------------------------- /system/linux/server.nix: -------------------------------------------------------------------------------- 1 | { lib, config, ... }: 2 | lib.mkMerge [ 3 | (lib.mkIf config.custom.profile.isHeadless { 4 | services.openssh.enable = lib.mkDefault true; 5 | environment.variables.BROWSER = "echo"; 6 | }) 7 | (lib.mkIf config.custom.profile.isServer { 8 | system.autoUpgrade = { 9 | enable = true; 10 | flake = "github:mirkolenz/nixos"; 11 | flags = lib.optional config.custom.impureRebuild "--impure"; 12 | dates = "04:00"; 13 | allowReboot = true; 14 | rebootWindow = { 15 | lower = "03:30"; 16 | upper = "05:00"; 17 | }; 18 | }; 19 | 20 | systemd.sleep.extraConfig = '' 21 | AllowSuspend=no 22 | AllowHibernation=no 23 | ''; 24 | }) 25 | ] 26 | -------------------------------------------------------------------------------- /system/linux/ssh.nix: -------------------------------------------------------------------------------- 1 | { ... }: 2 | { 3 | services.openssh = { 4 | settings = { 5 | PasswordAuthentication = false; 6 | KbdInteractiveAuthentication = false; 7 | PermitRootLogin = "no"; 8 | X11Forwarding = false; 9 | }; 10 | hostKeys = [ 11 | { 12 | path = "/etc/ssh/ssh_host_ed25519_key"; 13 | type = "ed25519"; 14 | } 15 | ]; 16 | }; 17 | } 18 | -------------------------------------------------------------------------------- /system/linux/xserver.nix: -------------------------------------------------------------------------------- 1 | { 2 | pkgs, 3 | config, 4 | lib, 5 | ... 6 | }: 7 | lib.mkIf config.services.xserver.enable { 8 | services = { 9 | desktopManager.cosmic.enable = true; 10 | displayManager.cosmic-greeter.enable = true; 11 | }; 12 | # Packages 13 | environment = { 14 | sessionVariables.NIXOS_OZONE_WL = "1"; 15 | systemPackages = with pkgs; [ 16 | anydesk 17 | google-chrome 18 | obsidian 19 | zoom-us 20 | zotero 21 | ]; 22 | }; 23 | services = { 24 | xserver = { 25 | xkb.layout = "us"; 26 | excludePackages = with pkgs; [ xterm ]; 27 | }; 28 | }; 29 | # there is an issue with wpa_supplicant and broadcom-wl (used in Macs) 30 | networking.networkmanager.wifi.backend = "iwd"; 31 | } 32 | -------------------------------------------------------------------------------- /vim/autocmd.nix: -------------------------------------------------------------------------------- 1 | { lib, ... }: 2 | { 3 | autoGroups = { 4 | autoformat = { }; 5 | autodir = { }; 6 | }; 7 | autoCmd = [ 8 | { 9 | callback = lib.nixvim.mkRaw '' 10 | function(args) 11 | vim.lsp.buf.format({ 12 | async = false, 13 | bufnr = args.buf, 14 | timeout_ms = 1000, 15 | }) 16 | end 17 | ''; 18 | event = "BufWritePre"; 19 | pattern = "*"; 20 | group = "autoformat"; 21 | desc = "Format buffer using LSP"; 22 | } 23 | { 24 | callback = lib.nixvim.mkRaw '' 25 | function() 26 | local args = vim.fn.argv() 27 | 28 | if #args > 0 then 29 | local arg = args[1] 30 | 31 | if vim.fn.isdirectory(arg) == 1 then 32 | -- Argument is a directory, change to it directly 33 | vim.api.nvim_set_current_dir(arg) 34 | -- vim.notify("Changed directory to: " .. arg, vim.log.levels.INFO) 35 | elseif vim.fn.filereadable(arg) == 1 then 36 | -- Argument is a file, change to its parent directory 37 | local dir = vim.fn.fnamemodify(arg, ":p:h") 38 | vim.api.nvim_set_current_dir(dir) 39 | -- vim.notify("Changed directory to: " .. dir, vim.log.levels.INFO) 40 | else 41 | -- Argument exists but is neither a readable file nor a directory 42 | vim.notify("Argument is not a valid file or directory: " .. arg, vim.log.levels.WARN) 43 | end 44 | else 45 | -- No arguments provided, using current directory 46 | -- vim.notify("No arguments provided, using current directory", vim.log.levels.INFO) 47 | end 48 | end 49 | ''; 50 | event = "VimEnter"; 51 | pattern = "*"; 52 | group = "autodir"; 53 | desc = "Change to directory based on first argument"; 54 | } 55 | ]; 56 | } 57 | -------------------------------------------------------------------------------- /vim/colorschemes.nix: -------------------------------------------------------------------------------- 1 | { ... }: 2 | { 3 | colorscheme = "github_dark_default"; 4 | colorschemes = { 5 | github-theme = { 6 | enable = true; 7 | settings.options = { 8 | transparent = false; 9 | terminal_colors = true; 10 | }; 11 | }; 12 | monokai-pro = { 13 | enable = false; 14 | settings = { 15 | filter = "spectrum"; 16 | }; 17 | }; 18 | catppuccin = { 19 | enable = false; 20 | settings = { 21 | background = { 22 | light = "latte"; 23 | dark = "mocha"; 24 | }; 25 | }; 26 | }; 27 | }; 28 | } 29 | -------------------------------------------------------------------------------- /vim/default.nix: -------------------------------------------------------------------------------- 1 | # https://nix-community.github.io/nixvim/ 2 | { lib', ... }: 3 | { 4 | imports = lib'.flocken.getModules ./.; 5 | 6 | viAlias = true; 7 | vimAlias = true; 8 | enableMan = true; 9 | 10 | # load ~/.config/nvim/init.lua for faster development iteration 11 | impureRtp = true; 12 | extraConfigLua = '' 13 | local init_lua_path = vim.fn.stdpath('config') .. '/init.lua' 14 | 15 | if vim.fn.filereadable(init_lua_path) == 1 then 16 | vim.cmd('luafile ' .. init_lua_path) 17 | end 18 | ''; 19 | 20 | withNodeJs = true; 21 | withPython3 = true; 22 | withRuby = true; 23 | withPerl = true; 24 | } 25 | -------------------------------------------------------------------------------- /vim/files/default.nix: -------------------------------------------------------------------------------- 1 | { ... }: 2 | { 3 | files = { 4 | "ftplugin/python.lua" = ./python.nix; 5 | "ftplugin/tex.lua" = ./tex.nix; 6 | }; 7 | } 8 | -------------------------------------------------------------------------------- /vim/files/python.nix: -------------------------------------------------------------------------------- 1 | { ... }: 2 | { 3 | opts = { 4 | shiftwidth = 4; 5 | tabstop = 4; 6 | }; 7 | } 8 | -------------------------------------------------------------------------------- /vim/files/tex.nix: -------------------------------------------------------------------------------- 1 | { ... }: 2 | { 3 | opts = { 4 | shiftwidth = 2; 5 | tabstop = 2; 6 | wrap = true; 7 | }; 8 | keymaps = [ 9 | { 10 | key = "tb"; 11 | mode = "n"; 12 | action = "TexlabWriteBuild"; 13 | options.desc = "Write and build the document"; 14 | } 15 | { 16 | key = "tB"; 17 | mode = "n"; 18 | action = "LspTexlabCancelBuild"; 19 | options.desc = "Cancel the current build"; 20 | } 21 | { 22 | key = "tc"; 23 | mode = "n"; 24 | action = "LspTexlabCleanAuxiliary"; 25 | options.desc = "Clean auxiliary files"; 26 | } 27 | { 28 | key = "tC"; 29 | mode = "n"; 30 | action = "LspTexlabCleanArtifacts"; 31 | options.desc = "Clean auxiliary and output files"; 32 | } 33 | ]; 34 | userCommands = { 35 | TexlabWriteBuild = { 36 | command = "write | LspTexlabBuild"; 37 | desc = "Write and build the document"; 38 | }; 39 | }; 40 | } 41 | -------------------------------------------------------------------------------- /vim/keymaps.nix: -------------------------------------------------------------------------------- 1 | { ... }: 2 | { 3 | keymaps = [ 4 | { 5 | key = ""; 6 | mode = "i"; 7 | action = "+"; 8 | options.desc = "Paste from system clipboard in insert mode"; 9 | } 10 | { 11 | key = ""; 12 | mode = [ 13 | "n" 14 | "v" 15 | ]; 16 | action = ''"+p''; 17 | options.desc = "Paste from system clipboard"; 18 | } 19 | { 20 | key = ""; 21 | mode = "n"; 22 | action = "nohlsearch"; 23 | options.desc = "Clear search highlights"; 24 | } 25 | { 26 | key = ""; 27 | mode = "t"; 28 | action = ""; 29 | options.desc = "Exit terminal mode"; 30 | } 31 | { 32 | key = "p"; 33 | mode = "x"; 34 | action = ''"_dp''; 35 | options.desc = "Delete to null register and paste after"; 36 | } 37 | { 38 | key = "P"; 39 | mode = "x"; 40 | action = ''"_dP''; 41 | options.desc = "Delete to null register and paste before"; 42 | } 43 | { 44 | key = "y"; 45 | mode = [ 46 | "n" 47 | "v" 48 | ]; 49 | action = ''"+y''; 50 | options.desc = "Yank to system clipboard"; 51 | } 52 | { 53 | key = "Y"; 54 | mode = "n"; 55 | action = ''"+Y''; 56 | options.desc = "Yank to system clipboard (whole line)"; 57 | } 58 | { 59 | key = "d"; 60 | mode = [ 61 | "n" 62 | "v" 63 | ]; 64 | action = ''"_d''; 65 | options.desc = "Delete without yanking"; 66 | } 67 | { 68 | key = "D"; 69 | mode = "n"; 70 | action = ''"_D''; 71 | options.desc = "Delete without yanking (whole line)"; 72 | } 73 | { 74 | key = ";"; 75 | mode = "n"; 76 | action = ":!"; 77 | options.desc = "Execute shell command"; 78 | } 79 | { 80 | key = "l"; 81 | mode = "n"; 82 | action = ":lua"; 83 | options.desc = "Enter Lua command mode"; 84 | } 85 | { 86 | key = ":"; 87 | mode = "n"; 88 | action = ":noautocmd"; 89 | options.desc = "Run without autocommands"; 90 | } 91 | # Use to switch between windows 92 | { 93 | key = ""; 94 | mode = "n"; 95 | action = "h"; 96 | options.desc = "Switch to window on the left"; 97 | } 98 | { 99 | key = ""; 100 | mode = "n"; 101 | action = "j"; 102 | options.desc = "Switch to window below"; 103 | } 104 | { 105 | key = ""; 106 | mode = "n"; 107 | action = "k"; 108 | options.desc = "Switch to window above"; 109 | } 110 | { 111 | key = ""; 112 | mode = "n"; 113 | action = "l"; 114 | options.desc = "Switch to window on the right"; 115 | } 116 | # Use [aouAOU] to write Umlauts 117 | { 118 | key = "a"; 119 | mode = "i"; 120 | action = "ä"; 121 | options.desc = "Write 'ä'"; 122 | } 123 | { 124 | key = "o"; 125 | mode = "i"; 126 | action = "ö"; 127 | options.desc = "Write 'ö'"; 128 | } 129 | { 130 | key = "u"; 131 | mode = "i"; 132 | action = "ü"; 133 | options.desc = "Write 'ü'"; 134 | } 135 | { 136 | key = "A"; 137 | mode = "i"; 138 | action = "Ä"; 139 | options.desc = "Write 'Ä'"; 140 | } 141 | { 142 | key = "O"; 143 | mode = "i"; 144 | action = "Ö"; 145 | options.desc = "Write 'Ö'"; 146 | } 147 | { 148 | key = "U"; 149 | mode = "i"; 150 | action = "Ü"; 151 | options.desc = "Write 'Ü'"; 152 | } 153 | { 154 | key = ""; 155 | mode = "i"; 156 | action = "ß"; 157 | options.desc = "Write 'ß'"; 158 | } 159 | ]; 160 | } 161 | -------------------------------------------------------------------------------- /vim/lsp/default.nix: -------------------------------------------------------------------------------- 1 | { lib', ... }: 2 | { 3 | imports = lib'.flocken.getModules ./.; 4 | plugins.lspconfig.enable = true; 5 | lsp = { 6 | inlayHints.enable = true; 7 | servers = { 8 | astro.enable = true; 9 | bashls.enable = true; 10 | cssls.enable = true; 11 | dockerls.enable = true; 12 | eslint.enable = true; 13 | gopls.enable = true; 14 | harper_ls.enable = true; 15 | html.enable = true; 16 | java_language_server.enable = true; 17 | jsonls.enable = true; 18 | ruff.enable = true; 19 | ts_ls.enable = true; 20 | tinymist.enable = true; 21 | yamlls.enable = true; 22 | }; 23 | }; 24 | } 25 | -------------------------------------------------------------------------------- /vim/lsp/keymaps.nix: -------------------------------------------------------------------------------- 1 | { ... }: 2 | { 3 | lsp.keymaps = [ 4 | { 5 | key = "bf"; 6 | mode = [ 7 | "n" 8 | "x" 9 | ]; 10 | lspBufAction = "format"; 11 | options.desc = "Format buffer"; 12 | } 13 | { 14 | key = "g."; 15 | mode = [ 16 | "n" 17 | "x" 18 | ]; 19 | lspBufAction = "code_action"; 20 | options.desc = "Code action"; 21 | } 22 | ]; 23 | } 24 | -------------------------------------------------------------------------------- /vim/lsp/nixd.nix: -------------------------------------------------------------------------------- 1 | { ... }: 2 | { 3 | lsp.servers.nixd = { 4 | enable = true; 5 | settings.settings = { 6 | formatting.command = [ "nixfmt" ]; 7 | nixpkgs.expr = "import (builtins.getFlake (\"git:\" + builtins.toString ./.)).inputs.nixpkgs { }"; 8 | }; 9 | }; 10 | } 11 | -------------------------------------------------------------------------------- /vim/lsp/pyright.nix: -------------------------------------------------------------------------------- 1 | { ... }: 2 | { 3 | lsp.servers.basedpyright = { 4 | enable = true; 5 | settings.settings.basedpyright = { 6 | typeCheckingMode = "standard"; 7 | analysis = { 8 | diagnosticMode = "workspace"; 9 | useLibraryCodeForTypes = false; 10 | }; 11 | }; 12 | }; 13 | } 14 | -------------------------------------------------------------------------------- /vim/lsp/texlab.nix: -------------------------------------------------------------------------------- 1 | { pkgs, ... }: 2 | { 3 | lsp.servers.texlab = { 4 | enable = true; 5 | settings.settings.texlab = { 6 | bibtexFormatter = "tex-fmt"; 7 | latexFormatter = "tex-fmt"; 8 | inlayHints = { 9 | labelDefinitions = false; 10 | labelReferences = false; 11 | maxLength = 32; 12 | }; 13 | build = { 14 | onSave = false; 15 | forwardSearchAfter = true; 16 | }; 17 | # https://github.com/latex-lsp/texlab/wiki/Previewing 18 | # https://github.com/rzukic/zed-latex/blob/main/src/preview_presets.rs 19 | forwardSearch = 20 | if pkgs.stdenv.isDarwin then 21 | { 22 | # displayline -h 23 | executable = "displayline"; 24 | args = [ 25 | "-r" 26 | "-g" 27 | "%l" 28 | "%p" 29 | "%f" 30 | ]; 31 | } 32 | else 33 | { 34 | executable = "sioyek"; 35 | args = [ 36 | "--reuse-window" 37 | "--nofocus" 38 | "--execute-command" 39 | "turn_on_synctex" 40 | "--forward-search-file" 41 | "%f" 42 | "--forward-search-line" 43 | "%l" 44 | "%p" 45 | ]; 46 | }; 47 | }; 48 | }; 49 | } 50 | -------------------------------------------------------------------------------- /vim/options/default.nix: -------------------------------------------------------------------------------- 1 | { lib', ... }: 2 | { 3 | imports = lib'.flocken.getModules ./.; 4 | } 5 | -------------------------------------------------------------------------------- /vim/options/multicursor.nix: -------------------------------------------------------------------------------- 1 | { lib, ... }: 2 | lib.nixvim.plugins.mkNeovimPlugin { 3 | name = "multicursor-nvim"; 4 | packPathName = "multicursor.nvim"; 5 | 6 | extraOptions = { 7 | keymapsLayer = lib.mkOption { 8 | default = [ ]; 9 | type = lib.types.listOf ( 10 | lib.types.submodule { 11 | options = { 12 | key = lib.mkOption { 13 | type = lib.types.str; 14 | }; 15 | mode = lib.nixvim.keymaps.mkModeOption "n"; 16 | action = lib.mkOption { 17 | type = lib.types.either lib.types.str lib.types.rawLua; 18 | }; 19 | }; 20 | } 21 | ); 22 | }; 23 | }; 24 | 25 | extraConfig = cfg: { 26 | plugins.multicursor-nvim.luaConfig.content = '' 27 | require("multicursor-nvim").addKeymapLayer(function(layerSet) 28 | ${lib.concatMapStringsSep "\n" ( 29 | { 30 | key, 31 | mode, 32 | action, 33 | }: 34 | if lib.isAttrs action then 35 | '' 36 | layerSet(${lib.nixvim.toLuaObject mode}, "${key}", function() 37 | ${action.__raw} 38 | end) 39 | '' 40 | else 41 | '' 42 | layerSet(${lib.nixvim.toLuaObject mode}, "${key}", require("multicursor-nvim").${action}) 43 | '' 44 | ) cfg.keymapsLayer} 45 | end) 46 | ''; 47 | }; 48 | 49 | maintainers = with lib.maintainers; [ mirkolenz ]; 50 | } 51 | -------------------------------------------------------------------------------- /vim/options/multiple-cursors.nix: -------------------------------------------------------------------------------- 1 | { lib, ... }: 2 | lib.nixvim.plugins.mkNeovimPlugin { 3 | name = "multiple-cursors"; 4 | maintainers = with lib.maintainers; [ mirkolenz ]; 5 | } 6 | -------------------------------------------------------------------------------- /vim/performance.nix: -------------------------------------------------------------------------------- 1 | { ... }: 2 | { 3 | performance = { 4 | byteCompileLua = { 5 | enable = false; 6 | configs = true; 7 | initLua = true; 8 | nvimRuntime = true; 9 | plugins = true; 10 | }; 11 | }; 12 | } 13 | -------------------------------------------------------------------------------- /vim/plugins/blink.nix: -------------------------------------------------------------------------------- 1 | { ... }: 2 | { 3 | plugins.blink-cmp = { 4 | enable = true; 5 | settings = { 6 | signature.enabled = true; 7 | completion = { 8 | ghost_text.enabled = false; 9 | documentation = { 10 | auto_show = true; 11 | auto_show_delay_ms = 0; 12 | update_delay_ms = 50; 13 | }; 14 | keyword.range = "full"; 15 | list.selection = { 16 | auto_insert = false; 17 | preselect = false; 18 | # lib.nixvim.mkRaw '' 19 | # function(ctx) 20 | # return not require('blink.cmp').snippet_active({ direction = 1 }) 21 | # end 22 | # ''; 23 | }; 24 | }; 25 | # https://cmp.saghen.dev/modes/cmdline.html 26 | cmdline = { 27 | completion.menu.auto_show = true; 28 | keymap = { 29 | "" = [ 30 | "show" 31 | "accept" 32 | ]; 33 | }; 34 | }; 35 | # https://cmp.saghen.dev/configuration/keymap#presets 36 | keymap = { 37 | preset = "super-tab"; 38 | "" = [ 39 | "accept" 40 | "fallback" 41 | ]; 42 | }; 43 | sources = { 44 | default = [ 45 | # "buffer" 46 | "lsp" 47 | "path" 48 | "snippets" 49 | ]; 50 | providers = { 51 | lsp.async = true; 52 | }; 53 | }; 54 | }; 55 | }; 56 | } 57 | -------------------------------------------------------------------------------- /vim/plugins/copilot.nix: -------------------------------------------------------------------------------- 1 | { 2 | lib, 3 | pkgs, 4 | config, 5 | ... 6 | }: 7 | { 8 | globals = lib.mkIf config.plugins.copilot-vim.enable { 9 | copilot_settings = { 10 | # selectedCompletionModel = ""; 11 | }; 12 | copilot_no_maps = true; 13 | }; 14 | keymaps = lib.mkIf config.plugins.copilot-vim.enable [ 15 | { 16 | key = ""; 17 | mode = "i"; 18 | action = "copilot#Accept()"; 19 | options = { 20 | expr = true; 21 | silent = true; 22 | nowait = true; 23 | replace_keycodes = false; 24 | desc = "Accept Copilot suggestion"; 25 | }; 26 | } 27 | { 28 | key = ""; 29 | mode = "i"; 30 | action = "copilot#AcceptLine()"; 31 | options = { 32 | expr = true; 33 | silent = true; 34 | nowait = true; 35 | replace_keycodes = false; 36 | desc = "Accept Copilot line"; 37 | }; 38 | } 39 | { 40 | key = ""; 41 | mode = "i"; 42 | action = "copilot#AcceptWord()"; 43 | options = { 44 | expr = true; 45 | silent = true; 46 | nowait = true; 47 | replace_keycodes = false; 48 | desc = "Accept Copilot word"; 49 | }; 50 | } 51 | { 52 | key = ""; 53 | mode = "i"; 54 | action = "call copilot#Dismiss()"; 55 | options = { 56 | silent = true; 57 | nowait = true; 58 | desc = "Dismiss Copilot suggestion"; 59 | }; 60 | } 61 | { 62 | key = ""; 63 | mode = "i"; 64 | action = "call copilot#Next()"; 65 | options = { 66 | silent = true; 67 | nowait = true; 68 | desc = "Next Copilot suggestion"; 69 | }; 70 | } 71 | { 72 | key = ""; 73 | mode = "i"; 74 | action = "call copilot#Previous()"; 75 | options = { 76 | silent = true; 77 | nowait = true; 78 | desc = "Next Copilot suggestion"; 79 | }; 80 | } 81 | { 82 | key = ""; 83 | mode = "i"; 84 | action = "call copilot#Suggest()"; 85 | options = { 86 | silent = true; 87 | nowait = true; 88 | desc = "Trigger Copilot suggestion"; 89 | }; 90 | } 91 | ]; 92 | plugins.copilot-vim = { 93 | enable = false; 94 | settings = { 95 | filetypes = { 96 | "*" = true; 97 | }; 98 | node_command = lib.getExe pkgs.nodejs; 99 | }; 100 | }; 101 | plugins.copilot-lua = { 102 | enable = true; 103 | settings = { 104 | filetypes = { 105 | "*" = true; 106 | }; 107 | panel = { 108 | enabled = true; 109 | auto_refresh = true; 110 | keymap = { 111 | jump_prev = "[["; 112 | jump_next = "]]"; 113 | accept = ""; 114 | refresh = "gr"; 115 | open = ""; 116 | }; 117 | layout = { 118 | position = "bottom"; 119 | ratio = 0.4; 120 | }; 121 | }; 122 | suggestion = { 123 | enabled = true; 124 | auto_trigger = true; 125 | hide_during_completion = false; 126 | keymap = { 127 | accept = ""; 128 | accept_line = ""; 129 | accept_word = ""; 130 | dismiss = ""; 131 | next = ""; 132 | prev = ""; 133 | }; 134 | }; 135 | copilot_node_command = lib.getExe pkgs.nodejs; 136 | # copilot_model = ""; 137 | server = { 138 | type = "binary"; 139 | custom_server_filepath = lib.getExe pkgs.copilot-language-server; 140 | }; 141 | }; 142 | }; 143 | } 144 | -------------------------------------------------------------------------------- /vim/plugins/dap.nix: -------------------------------------------------------------------------------- 1 | { ... }: 2 | { 3 | plugins = { 4 | dap.enable = true; 5 | dap-python.enable = true; 6 | dap-virtual-text.enable = true; 7 | dap-ui.enable = true; 8 | }; 9 | } 10 | -------------------------------------------------------------------------------- /vim/plugins/default.nix: -------------------------------------------------------------------------------- 1 | { lib', ... }: 2 | { 3 | imports = lib'.flocken.getModules ./.; 4 | plugins = { 5 | comment.enable = true; 6 | diffview.enable = true; 7 | flash.enable = true; 8 | git-conflict.enable = true; 9 | gitignore.enable = true; 10 | gitsigns.enable = true; 11 | grug-far.enable = true; 12 | neogit.enable = true; 13 | noice.enable = true; 14 | nvim-autopairs.enable = true; 15 | persistence.enable = true; 16 | web-devicons.enable = true; 17 | }; 18 | } 19 | -------------------------------------------------------------------------------- /vim/plugins/lightbulb.nix: -------------------------------------------------------------------------------- 1 | { ... }: 2 | { 3 | plugins.nvim-lightbulb = { 4 | enable = true; 5 | settings = { 6 | autocmd.enabled = true; 7 | }; 8 | }; 9 | } 10 | -------------------------------------------------------------------------------- /vim/plugins/lualine.nix: -------------------------------------------------------------------------------- 1 | { ... }: 2 | { 3 | plugins.lualine = { 4 | enable = true; 5 | settings = { 6 | sections = { 7 | lualine_a = [ "mode" ]; 8 | lualine_b = [ 9 | "branch" 10 | "diff" 11 | "diagnostics" 12 | ]; 13 | lualine_c = [ "filename" ]; 14 | lualine_x = [ 15 | "encoding" 16 | "fileformat" 17 | "filetype" 18 | ]; 19 | lualine_y = [ "progress" ]; 20 | lualine_z = [ "location" ]; 21 | }; 22 | inactive_sections = { 23 | lualine_a = [ ]; 24 | lualine_b = [ ]; 25 | lualine_c = [ "filename" ]; 26 | lualine_x = [ "location" ]; 27 | lualine_y = [ ]; 28 | lualine_z = [ ]; 29 | }; 30 | tabline = { 31 | lualine_a = [ "tabs" ]; 32 | lualine_b = [ "buffers" ]; 33 | lualine_c = [ ]; 34 | lualine_x = [ ]; 35 | lualine_y = [ ]; 36 | lualine_z = [ ]; 37 | }; 38 | winbar = { 39 | lualine_a = [ ]; 40 | lualine_b = [ ]; 41 | lualine_c = [ ]; 42 | lualine_x = [ ]; 43 | lualine_y = [ ]; 44 | lualine_z = [ ]; 45 | }; 46 | inactive_winbar = { 47 | lualine_a = [ ]; 48 | lualine_b = [ ]; 49 | lualine_c = [ ]; 50 | lualine_x = [ ]; 51 | lualine_y = [ ]; 52 | lualine_z = [ ]; 53 | }; 54 | }; 55 | }; 56 | } 57 | -------------------------------------------------------------------------------- /vim/plugins/multicursor.nix: -------------------------------------------------------------------------------- 1 | { 2 | lib', 3 | lib, 4 | config, 5 | ... 6 | }: 7 | { 8 | plugins.multicursor-nvim = { 9 | enable = true; 10 | keymapsLayer = [ 11 | # Select a different cursor as the main one 12 | { 13 | key = ""; 14 | mode = [ 15 | "n" 16 | "x" 17 | ]; 18 | action = "prevCursor"; 19 | } 20 | { 21 | key = ""; 22 | mode = [ 23 | "n" 24 | "x" 25 | ]; 26 | action = "nextCursor"; 27 | } 28 | # Delete the main cursor 29 | { 30 | key = "x"; 31 | mode = [ 32 | "n" 33 | "x" 34 | ]; 35 | action = "deleteCursor"; 36 | } 37 | { 38 | # Enable and clear cursors using escape 39 | key = ""; 40 | mode = "n"; 41 | action = lib.nixvim.mkRaw '' 42 | mc = require('multicursor-nvim') 43 | if not mc.cursorsEnabled() then 44 | mc.enableCursors() 45 | else 46 | mc.clearCursors() 47 | end 48 | ''; 49 | } 50 | ]; 51 | }; 52 | keymaps = lib.mkIf config.plugins.multicursor-nvim.enable ( 53 | lib'.self.mkVimKeymaps 54 | { 55 | prefix = "require('multicursor-nvim')."; 56 | raw = true; 57 | } 58 | [ 59 | { 60 | key = ""; 61 | mode = [ 62 | "n" 63 | "x" 64 | ]; 65 | action = "toggleCursor()"; 66 | options.desc = "Toggle multicursor"; 67 | } 68 | { 69 | key = "ga"; 70 | mode = [ 71 | "n" 72 | "x" 73 | ]; 74 | action = "matchAllAddCursors()"; 75 | options.desc = "Add all matching cursors"; 76 | } 77 | { 78 | key = "gA"; 79 | mode = [ 80 | "n" 81 | "x" 82 | ]; 83 | action = "alignCursors()"; 84 | options.desc = "Align cursor columns"; 85 | } 86 | { 87 | key = "g;"; 88 | mode = [ 89 | "n" 90 | "x" 91 | ]; 92 | action = "addCursorOperator()"; 93 | options.desc = "Add cursor using vim operator (e.g., g;ip for all lines in a paragraph)"; 94 | } 95 | # Add or skip cursor above/below the main cursor 96 | { 97 | key = "gk"; 98 | mode = [ 99 | "n" 100 | "x" 101 | ]; 102 | action = "lineAddCursor(-1)"; 103 | options.desc = "Add cursor above"; 104 | } 105 | { 106 | key = "gj"; 107 | mode = [ 108 | "n" 109 | "x" 110 | ]; 111 | action = "lineAddCursor(1)"; 112 | options.desc = "Add cursor below"; 113 | } 114 | { 115 | key = "gK"; 116 | mode = [ 117 | "n" 118 | "x" 119 | ]; 120 | action = "lineSkipCursor(-1)"; 121 | options.desc = "Skip cursor above"; 122 | } 123 | { 124 | key = "gJ"; 125 | mode = [ 126 | "n" 127 | "x" 128 | ]; 129 | action = "lineSkipCursor(1)"; 130 | options.desc = "Skip cursor below"; 131 | } 132 | # Add or skip adding a new cursor by matching word/selection 133 | { 134 | key = "gl"; 135 | mode = [ 136 | "n" 137 | "x" 138 | ]; 139 | action = "matchAddCursor(1)"; 140 | options.desc = "Add next matching cursor"; 141 | } 142 | { 143 | key = "gh"; 144 | mode = [ 145 | "n" 146 | "x" 147 | ]; 148 | action = "matchAddCursor(-1)"; 149 | options.desc = "Add previous matching cursor"; 150 | } 151 | { 152 | key = "gL"; 153 | mode = [ 154 | "n" 155 | "x" 156 | ]; 157 | action = "matchSkipCursor(1)"; 158 | options.desc = "Skip next matching cursor"; 159 | } 160 | { 161 | key = "gH"; 162 | mode = [ 163 | "n" 164 | "x" 165 | ]; 166 | action = "matchSkipCursor(-1)"; 167 | options.desc = "Skip previous matching cursor"; 168 | } 169 | { 170 | key = "gn"; 171 | mode = [ 172 | "n" 173 | "x" 174 | ]; 175 | action = "searchAddCursor(1)"; 176 | options.desc = "Add next search cursor"; 177 | } 178 | { 179 | key = "gN"; 180 | mode = [ 181 | "n" 182 | "x" 183 | ]; 184 | action = "searchAddCursor(-1)"; 185 | options.desc = "Add previous search cursor"; 186 | } 187 | { 188 | key = "gm"; 189 | mode = [ 190 | "n" 191 | "x" 192 | ]; 193 | action = "searchSkipCursor(1)"; 194 | options.desc = "Skip next search cursor"; 195 | } 196 | { 197 | key = "gM"; 198 | mode = [ 199 | "n" 200 | "x" 201 | ]; 202 | action = "searchSkipCursor(-1)"; 203 | options.desc = "Skip previous search cursor"; 204 | } 205 | # Add and remove cursors with control + left click 206 | { 207 | key = ""; 208 | mode = "n"; 209 | action = "handleMouse()"; 210 | options.desc = "Handle multicursor mouse"; 211 | } 212 | { 213 | key = ""; 214 | mode = "n"; 215 | action = "handleMouseDrag()"; 216 | options.desc = "Handle multicursor mouse drag"; 217 | } 218 | { 219 | key = ""; 220 | mode = "n"; 221 | action = "handleMouseRelease()"; 222 | options.desc = "Handle multicursor mouse release"; 223 | } 224 | ] 225 | ); 226 | } 227 | -------------------------------------------------------------------------------- /vim/plugins/multiple-cursors.nix: -------------------------------------------------------------------------------- 1 | { 2 | lib', 3 | lib, 4 | config, 5 | ... 6 | }: 7 | { 8 | plugins.multiple-cursors = { 9 | enable = false; 10 | }; 11 | keymaps = lib.mkIf config.plugins.multiple-cursors.enable ( 12 | lib'.self.mkVimKeymaps 13 | { 14 | prefix = "MultipleCursors"; 15 | raw = false; 16 | } 17 | [ 18 | { 19 | key = "gk"; 20 | mode = [ 21 | "n" 22 | "x" 23 | ]; 24 | action = "MultipleCursorsAddUp"; 25 | options.desc = "Add cursor and move up"; 26 | } 27 | { 28 | key = "gj"; 29 | mode = [ 30 | "n" 31 | "x" 32 | ]; 33 | action = "MultipleCursorsAddDown"; 34 | options.desc = "Add cursor and move down"; 35 | } 36 | { 37 | key = "gl"; 38 | mode = [ 39 | "n" 40 | "x" 41 | ]; 42 | action = "AddJumpNextMatch"; 43 | options.desc = "Add cursor and jump to next cword"; 44 | } 45 | { 46 | key = "gh"; 47 | mode = [ 48 | "n" 49 | "x" 50 | ]; 51 | action = "AddJumpPrevMatch"; 52 | options.desc = "Add cursor and jump to previous cword"; 53 | } 54 | { 55 | key = "gL"; 56 | mode = [ 57 | "n" 58 | "x" 59 | ]; 60 | action = "MultipleCursorsAddMatches"; 61 | options.desc = "Add cursors to cword"; 62 | } 63 | { 64 | key = "gH"; 65 | mode = [ 66 | "n" 67 | "x" 68 | ]; 69 | action = "MultipleCursorsAddMatchesV"; 70 | options.desc = "Add cursors to cword in previous area"; 71 | } 72 | { 73 | key = ""; 74 | mode = [ 75 | "n" 76 | "i" 77 | ]; 78 | action = "MouseAddDelete"; 79 | options.desc = "Add or remove cursor"; 80 | } 81 | ] 82 | ); 83 | } 84 | -------------------------------------------------------------------------------- /vim/plugins/oil.nix: -------------------------------------------------------------------------------- 1 | { ... }: 2 | { 3 | plugins.oil = { 4 | enable = true; 5 | settings = { 6 | default_file_explorer = false; 7 | delete_to_trash = true; 8 | }; 9 | }; 10 | } 11 | -------------------------------------------------------------------------------- /vim/plugins/snacks/dashboard.nix: -------------------------------------------------------------------------------- 1 | { ... }: 2 | { 3 | plugins.snacks.settings.dashboard = { 4 | enabled = true; 5 | preset.keys = [ 6 | { 7 | icon = " "; 8 | key = "f"; 9 | desc = "Find File"; 10 | action = ":lua Snacks.dashboard.pick('files')"; 11 | } 12 | { 13 | icon = " "; 14 | key = "n"; 15 | desc = "New File"; 16 | action = ":ene | startinsert"; 17 | } 18 | { 19 | icon = " "; 20 | key = "g"; 21 | desc = "Find Text"; 22 | action = ":lua Snacks.dashboard.pick('live_grep')"; 23 | } 24 | { 25 | icon = " "; 26 | key = "r"; 27 | desc = "Recent Files"; 28 | action = ":lua Snacks.dashboard.pick('oldfiles')"; 29 | } 30 | { 31 | icon = " "; 32 | key = "p"; 33 | desc = "Recent Projects"; 34 | action = ":lua Snacks.dashboard.pick('projects')"; 35 | } 36 | { 37 | icon = " "; 38 | key = "q"; 39 | desc = "Quit"; 40 | action = ":qa"; 41 | } 42 | ]; 43 | sections = [ 44 | { section = "header"; } 45 | { 46 | # icon = " "; 47 | # title = "Keymaps"; 48 | section = "keys"; 49 | padding = 1; 50 | # indent = 2; 51 | } 52 | { 53 | # icon = " "; 54 | # title = "Projects"; 55 | section = "projects"; 56 | padding = 1; 57 | # indent = 2; 58 | limit = 9; 59 | } 60 | ]; 61 | }; 62 | } 63 | -------------------------------------------------------------------------------- /vim/plugins/snacks/default.nix: -------------------------------------------------------------------------------- 1 | { lib', ... }: 2 | { 3 | imports = lib'.flocken.getModules ./.; 4 | plugins.snacks = { 5 | enable = true; 6 | settings = { 7 | bigfile.enabled = true; 8 | bufdelete.enabled = true; 9 | debug.enabled = true; 10 | explorer = { 11 | enabled = true; 12 | replace_netrw = false; 13 | }; 14 | git.enabled = true; 15 | gitbrowse.enabled = true; 16 | indent.enabled = true; 17 | input.enabled = true; 18 | lazygit = { 19 | enabled = true; 20 | configure = false; 21 | }; 22 | notifier = { 23 | enabled = true; 24 | timeout = 5000; 25 | }; 26 | picker.enabled = true; 27 | quickfile.enabled = true; 28 | rename.enabled = true; 29 | scope.enabled = true; 30 | scroll.enabled = false; 31 | terminal.enabled = true; 32 | toggle.enabled = true; 33 | words.enabled = true; 34 | zen.enabled = true; 35 | }; 36 | }; 37 | } 38 | -------------------------------------------------------------------------------- /vim/plugins/snacks/styles.nix: -------------------------------------------------------------------------------- 1 | { ... }: 2 | { 3 | plugins.snacks.settings.styles = { 4 | notification = { 5 | wo.wrap = true; 6 | }; 7 | float = { 8 | position = "float"; 9 | backdrop = 60; 10 | height = 0.9; 11 | width = 0.9; 12 | zindex = 50; 13 | }; 14 | split = { 15 | position = "bottom"; 16 | height = 0.3; 17 | width = 0.5; 18 | }; 19 | }; 20 | } 21 | -------------------------------------------------------------------------------- /vim/plugins/treesitter.nix: -------------------------------------------------------------------------------- 1 | { ... }: 2 | { 3 | plugins.treesitter = { 4 | enable = true; 5 | folding = true; 6 | settings = { 7 | highlight.enable = true; 8 | incremental_selection.enable = true; 9 | indent.enable = true; 10 | }; 11 | }; 12 | plugins.treesitter-refactor = { 13 | enable = true; 14 | highlightCurrentScope.enable = false; 15 | highlightDefinitions.enable = true; 16 | navigation.enable = true; 17 | smartRename.enable = true; 18 | }; 19 | plugins.treesitter-textobjects = { 20 | enable = true; 21 | lspInterop.enable = true; 22 | move.enable = true; 23 | select.enable = true; 24 | swap.enable = true; 25 | }; 26 | plugins.treesitter-context = { 27 | enable = true; 28 | }; 29 | } 30 | -------------------------------------------------------------------------------- /vim/plugins/trouble.nix: -------------------------------------------------------------------------------- 1 | { 2 | lib', 3 | lib, 4 | config, 5 | ... 6 | }: 7 | { 8 | plugins.trouble = { 9 | enable = true; 10 | }; 11 | plugins.todo-comments = { 12 | enable = true; 13 | }; 14 | keymaps = lib.mkIf config.plugins.trouble.enable ( 15 | lib'.self.mkVimKeymaps 16 | { 17 | prefix = "Trouble "; 18 | raw = false; 19 | } 20 | [ 21 | { 22 | key = "xx"; 23 | mode = "n"; 24 | action = "diagnostics toggle"; 25 | options.desc = "Diagnostics (Trouble)"; 26 | } 27 | { 28 | key = "xX"; 29 | mode = "n"; 30 | action = "diagnostics toggle filter.buf=0"; 31 | options.desc = "Buffer Diagnostics (Trouble)"; 32 | } 33 | { 34 | key = "cs"; 35 | mode = "n"; 36 | action = "symbols toggle focus=false"; 37 | options.desc = "Symbols (Trouble)"; 38 | } 39 | { 40 | key = "cl"; 41 | mode = "n"; 42 | action = "lsp toggle focus=false win.position=right"; 43 | options.desc = "LSP definitions/references/... (Trouble)"; 44 | } 45 | { 46 | key = "xL"; 47 | mode = "n"; 48 | action = "loclist toggle"; 49 | options.desc = "Location List (Trouble)"; 50 | } 51 | { 52 | key = "xQ"; 53 | mode = "n"; 54 | action = "qflist toggle"; 55 | options.desc = "Quickfix List (Trouble)"; 56 | } 57 | { 58 | key = "xt"; 59 | mode = "n"; 60 | action = "todo"; 61 | options.desc = "Todo Comments (Trouble)"; 62 | } 63 | { 64 | key = "xT"; 65 | mode = "n"; 66 | action = "todo filter.buf=0"; 67 | options.desc = "Buffer Todo Comments (Trouble)"; 68 | } 69 | ] 70 | ); 71 | } 72 | -------------------------------------------------------------------------------- /vim/plugins/which-key.nix: -------------------------------------------------------------------------------- 1 | { 2 | lib', 3 | lib, 4 | config, 5 | ... 6 | }: 7 | { 8 | plugins.which-key = { 9 | enable = true; 10 | settings = { 11 | preset = "modern"; 12 | }; 13 | }; 14 | keymaps = lib.mkIf config.plugins.which-key.enable ( 15 | lib'.self.mkVimKeymaps 16 | { 17 | prefix = "require('which-key')."; 18 | raw = true; 19 | } 20 | [ 21 | { 22 | key = "?"; 23 | action = "show({ global = false })"; 24 | options.desc = "Buffer Local Keymaps (which-key)"; 25 | } 26 | ] 27 | ); 28 | } 29 | -------------------------------------------------------------------------------- /vim/plugins/wrapping.nix: -------------------------------------------------------------------------------- 1 | { ... }: 2 | { 3 | plugins.wrapping = { 4 | enable = false; 5 | settings = { 6 | softener = { 7 | gitcommit = true; 8 | }; 9 | }; 10 | }; 11 | } 12 | -------------------------------------------------------------------------------- /vim/plugins/yazi.nix: -------------------------------------------------------------------------------- 1 | { 2 | lib', 3 | lib, 4 | config, 5 | ... 6 | }: 7 | { 8 | plugins.yazi = { 9 | enable = true; 10 | settings = { 11 | enable_mouse_support = true; 12 | }; 13 | }; 14 | keymaps = lib.mkIf config.plugins.yazi.enable ( 15 | lib'.self.mkVimKeymaps 16 | { 17 | prefix = "Yazi "; 18 | raw = false; 19 | } 20 | [ 21 | { 22 | key = "ef"; 23 | mode = [ 24 | "n" 25 | "v" 26 | ]; 27 | action = ""; 28 | options.desc = "Open explorer at current file"; 29 | } 30 | { 31 | key = "ed"; 32 | mode = [ 33 | "n" 34 | "v" 35 | ]; 36 | action = "cwd"; 37 | options.desc = "Open explorer at current directory"; 38 | } 39 | { 40 | key = "ee"; 41 | mode = [ 42 | "n" 43 | "v" 44 | ]; 45 | action = "toggle"; 46 | options.desc = "Toggle explorer"; 47 | } 48 | ] 49 | ); 50 | } 51 | -------------------------------------------------------------------------------- /vim/settings.nix: -------------------------------------------------------------------------------- 1 | { ... }: 2 | { 3 | clipboard.register = ""; 4 | opts = { 5 | autoindent = true; 6 | breakindent = true; 7 | confirm = true; 8 | cursorline = true; 9 | expandtab = true; 10 | foldenable = false; 11 | guifont = "JetBrainsMono_Nerd_Font:h13"; 12 | ignorecase = true; 13 | inccommand = "split"; 14 | laststatus = 3; 15 | linebreak = true; 16 | mouse = "a"; 17 | number = true; 18 | relativenumber = true; 19 | ruler = true; 20 | scrolloff = 10; 21 | shiftwidth = 2; 22 | showmode = false; 23 | signcolumn = "yes"; 24 | smartcase = true; 25 | spell = true; 26 | spelllang = "en_us,de_de"; 27 | spelloptions = "camel"; 28 | splitbelow = true; 29 | splitright = true; 30 | tabstop = 2; 31 | }; 32 | globals = { 33 | mapleader = " "; 34 | maplocalleader = " "; 35 | # https://neovim.io/doc/user/pi_netrw.html#netrw-noload 36 | loaded_netrw = 1; 37 | loaded_netrwPlugin = 1; 38 | # neovide 39 | neovide_input_macos_option_key_is_meta = "both"; 40 | }; 41 | } 42 | -------------------------------------------------------------------------------- /vim/spell.nix: -------------------------------------------------------------------------------- 1 | { pkgs, lib, ... }: 2 | let 3 | fileHashes = { 4 | "de.latin1.spl" = "sha256-iedU+cMNolKlNP6aSzTeDV/72DlnuqWccb/yb/UAw0I="; 5 | "de.latin1.sug" = "sha256-lT+tH0Hx0ZnUhp8IdsPm26tlNyIl+LoT7dAho0A74Fc="; 6 | "de.utf-8.spl" = "sha256-c8cQfqM5hWzb6SHeuSpFk5xN5uucByYdobndGfaDo9E="; 7 | "de.utf-8.sug" = "sha256-E9Ds+Shj2J72DNSopesqWhOg6Pm6jRxqvkerqFcUqUg="; 8 | "en.ascii.spl" = "sha256-zry6SJ1F2jNVlA80BYLiDONezc1E+cwWi+hz8I54JEk="; 9 | "en.ascii.sug" = "sha256-sNXQ7RlzX4NySO+XvMtEStcwNAsXhcj2qORFj2hyIWw="; 10 | "en.latin1.spl" = "sha256-Yg2e/Nec/J1jmBj7UoB+Pa5ho3yADWlKAQzVJaIWGEU="; 11 | "en.latin1.sug" = "sha256-5t6X5Lyz+bSq9+HrVKgbk5DVwjH0J/pL43mKJeRiKwI="; 12 | "en.utf-8.spl" = "sha256-/sq9yUm2o50ywImfolReqyXmPy7QozxK0VEUJjhNMHA="; 13 | "en.utf-8.sug" = "sha256-W25eYWVYLS/Xob+kH7zoJCxyR2IixV0XwqorqTPJMuw="; 14 | }; 15 | in 16 | { 17 | extraFiles = lib.mapAttrs' (name: hash: { 18 | name = "spell/${name}"; 19 | value.source = pkgs.fetchurl { 20 | url = "https://ftp.nluug.nl/vim/runtime/spell/${name}"; 21 | inherit hash; 22 | }; 23 | }) fileHashes; 24 | } 25 | --------------------------------------------------------------------------------