diff options
45 files changed, 2364 insertions, 0 deletions
@@ -0,0 +1 @@ +use flake diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a552332 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +/.direnv +/.pre-commit-config.yaml @@ -0,0 +1 @@ +**/hardware.nix diff --git a/.sops.yaml b/.sops.yaml new file mode 100644 index 0000000..96f058d --- /dev/null +++ b/.sops.yaml @@ -0,0 +1,11 @@ +keys: + - &admin_miran age1l088h7umwuxp0sw8wk0stfup0empdnldczxvrhueu7n0vxd0c57q9zvwsk + - &machine_wonderland age1xzqshnlstewfha28sqjp4lf97mm43axyrhga0vkjmt5zx6eydqhsvlsasc + - &machine_sagittarius age1jmpdssn7555g0pht7zwqq2dvrvzxyu65w6cf2su8pp2fz0zvaykq0jgern +creation_rules: + - path_regex: secrets/[^/]+\.(yaml|json|env|ini)$ + key_groups: + - age: + - *admin_miran + - *machine_wonderland + - *machine_sagittarius diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..51b4e88 --- /dev/null +++ b/flake.lock @@ -0,0 +1,699 @@ +{ + "nodes": { + "conduit": { + "inputs": { + "crane": "crane", + "fenix": "fenix", + "flake-utils": "flake-utils", + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1694631477, + "narHash": "sha256-35SgWnBkWTyyRwVPyUKoShjzXfX0H1+HDdEEjZ/LsXc=", + "owner": "famedly", + "repo": "conduit", + "rev": "3bfdae795d4d9ec9aeaac7465e7535ac88e47756", + "type": "gitlab" + }, + "original": { + "owner": "famedly", + "repo": "conduit", + "type": "gitlab" + } + }, + "crane": { + "inputs": { + "flake-compat": "flake-compat", + "flake-utils": [ + "conduit", + "flake-utils" + ], + "nixpkgs": [ + "conduit", + "nixpkgs" + ], + "rust-overlay": "rust-overlay" + }, + "locked": { + "lastModified": 1688772518, + "narHash": "sha256-ol7gZxwvgLnxNSZwFTDJJ49xVY5teaSvF7lzlo3YQfM=", + "owner": "ipetkov", + "repo": "crane", + "rev": "8b08e96c9af8c6e3a2b69af5a7fa168750fcf88e", + "type": "github" + }, + "original": { + "owner": "ipetkov", + "repo": "crane", + "type": "github" + } + }, + "crane_2": { + "inputs": { + "flake-compat": "flake-compat_2", + "flake-utils": [ + "helix", + "flake-utils" + ], + "nixpkgs": [ + "helix", + "nixpkgs" + ], + "rust-overlay": [ + "helix", + "rust-overlay" + ] + }, + "locked": { + "lastModified": 1688772518, + "narHash": "sha256-ol7gZxwvgLnxNSZwFTDJJ49xVY5teaSvF7lzlo3YQfM=", + "owner": "ipetkov", + "repo": "crane", + "rev": "8b08e96c9af8c6e3a2b69af5a7fa168750fcf88e", + "type": "github" + }, + "original": { + "owner": "ipetkov", + "repo": "crane", + "type": "github" + } + }, + "devshell": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ], + "systems": "systems_2" + }, + "locked": { + "lastModified": 1698410321, + "narHash": "sha256-MphuSlgpmKwtJncGMohryHiK55J1n6WzVQ/OAfmfoMc=", + "owner": "numtide", + "repo": "devshell", + "rev": "1aed986e3c81a4f6698e85a7452cbfcc4b31a36e", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "devshell", + "type": "github" + } + }, + "fenix": { + "inputs": { + "nixpkgs": [ + "conduit", + "nixpkgs" + ], + "rust-analyzer-src": "rust-analyzer-src" + }, + "locked": { + "lastModified": 1689488573, + "narHash": "sha256-diVASflKCCryTYv0djvMnP2444mFsIG0ge5pa7ahauQ=", + "owner": "nix-community", + "repo": "fenix", + "rev": "39096fe3f379036ff4a5fa198950b8e79defe939", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "fenix", + "type": "github" + } + }, + "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1673956053, + "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-compat_2": { + "flake": false, + "locked": { + "lastModified": 1673956053, + "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-compat_3": { + "flake": false, + "locked": { + "lastModified": 1673956053, + "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-parts": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib" + }, + "locked": { + "lastModified": 1698882062, + "narHash": "sha256-HkhafUayIqxXyHH1X8d9RDl1M2CkFgZLjKD3MzabiEo=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "8c9fa2545007b49a5db5f650ae91f227672c3877", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1689068808, + "narHash": "sha256-6ixXo3wt24N/melDWjq70UuHQLxGV8jZvooRanIHXw0=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "919d646de7be200f3bf08cb76ae1f09402b6f9b4", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_2": { + "inputs": { + "systems": "systems_3" + }, + "locked": { + "lastModified": 1689068808, + "narHash": "sha256-6ixXo3wt24N/melDWjq70UuHQLxGV8jZvooRanIHXw0=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "919d646de7be200f3bf08cb76ae1f09402b6f9b4", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_3": { + "inputs": { + "systems": "systems_5" + }, + "locked": { + "lastModified": 1685518550, + "narHash": "sha256-o2d0KcvaXzTrPRIo0kOLV0/QXHhDQ5DTi+OxcjO8xqY=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "a1720a10a6cfe8234c0e93907ffe81be440f4cef", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "gitignore": { + "inputs": { + "nixpkgs": [ + "pre-commit-hooks-nix", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1660459072, + "narHash": "sha256-8DFJjXG8zqoONA1vXtgeKXy68KdJL5UaXR8NtVMUbx8=", + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "a20de23b925fd8264fd7fad6454652e142fd7f73", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "gitignore.nix", + "type": "github" + } + }, + "helix": { + "inputs": { + "crane": "crane_2", + "flake-utils": "flake-utils_2", + "nixpkgs": [ + "nixpkgs" + ], + "rust-overlay": "rust-overlay_2" + }, + "locked": { + "lastModified": 1698972682, + "narHash": "sha256-gdQBTv13gGlXIEjm59CQhA/KrUdkisGeLl9ZMtA7Ufg=", + "owner": "helix-editor", + "repo": "helix", + "rev": "ae6a0a9cfd377fbfa494760282498cf2ca322782", + "type": "github" + }, + "original": { + "owner": "helix-editor", + "repo": "helix", + "type": "github" + } + }, + "home-manager": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1698896213, + "narHash": "sha256-u42NZt52F3o7pM5V7sYlLOp5tSN8z9+fO2wFcOs0EOQ=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "831b4fa31749208e576050c563e9773aafd04941", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, + "hyprland": { + "inputs": { + "hyprland-protocols": "hyprland-protocols", + "nixpkgs": [ + "nixpkgs" + ], + "systems": "systems_4", + "wlroots": "wlroots", + "xdph": "xdph" + }, + "locked": { + "lastModified": 1699013963, + "narHash": "sha256-hfgAj0JU4Xx4hFcfwUo3zpkewdKSqfo3Pj0OgpunDl8=", + "owner": "hyprwm", + "repo": "Hyprland", + "rev": "0f6e53079864d411aa2de3262ba4c01eeeec4f5b", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "Hyprland", + "type": "github" + } + }, + "hyprland-protocols": { + "inputs": { + "nixpkgs": [ + "hyprland", + "nixpkgs" + ], + "systems": [ + "hyprland", + "systems" + ] + }, + "locked": { + "lastModified": 1691753796, + "narHash": "sha256-zOEwiWoXk3j3+EoF3ySUJmberFewWlagvewDRuWYAso=", + "owner": "hyprwm", + "repo": "hyprland-protocols", + "rev": "0c2ce70625cb30aef199cb388f99e19a61a6ce03", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "hyprland-protocols", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1698924604, + "narHash": "sha256-GCFbkl2tj8fEZBZCw3Tc0AkGo0v+YrQlohhEGJ/X4s0=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "fa804edfb7869c9fb230e174182a8a1a7e512c40", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-lib": { + "locked": { + "dir": "lib", + "lastModified": 1698611440, + "narHash": "sha256-jPjHjrerhYDy3q9+s5EAsuhyhuknNfowY6yt6pjn9pc=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "0cbe9f69c234a7700596e943bfae7ef27a31b735", + "type": "github" + }, + "original": { + "dir": "lib", + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-stable": { + "locked": { + "lastModified": 1685801374, + "narHash": "sha256-otaSUoFEMM+LjBI1XL/xGB5ao6IwnZOXc47qhIgJe8U=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "c37ca420157f4abc31e26f436c1145f8951ff373", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-23.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-stable_2": { + "locked": { + "lastModified": 1698544399, + "narHash": "sha256-vhRmPyEyoPkrXF2iykBsWHA05MIaOSmMRLMF7Hul6+s=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "d87c5d8c41c9b3b39592563242f3a448b5cc4bc9", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "release-23.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "pre-commit-hooks-nix": { + "inputs": { + "flake-compat": "flake-compat_3", + "flake-utils": "flake-utils_3", + "gitignore": "gitignore", + "nixpkgs": [ + "nixpkgs" + ], + "nixpkgs-stable": "nixpkgs-stable" + }, + "locked": { + "lastModified": 1698852633, + "narHash": "sha256-Hsc/cCHud8ZXLvmm8pxrXpuaPEeNaaUttaCvtdX/Wug=", + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "rev": "dec10399e5b56aa95fcd530e0338be72ad6462a0", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "type": "github" + } + }, + "root": { + "inputs": { + "conduit": "conduit", + "devshell": "devshell", + "flake-parts": "flake-parts", + "helix": "helix", + "home-manager": "home-manager", + "hyprland": "hyprland", + "nixpkgs": "nixpkgs", + "pre-commit-hooks-nix": "pre-commit-hooks-nix", + "sops-nix": "sops-nix", + "treefmt-nix": "treefmt-nix" + } + }, + "rust-analyzer-src": { + "flake": false, + "locked": { + "lastModified": 1689441253, + "narHash": "sha256-4MSDZaFI4DOfsLIZYPMBl0snzWhX1/OqR/QHir382CY=", + "owner": "rust-lang", + "repo": "rust-analyzer", + "rev": "996e054f1eb1dbfc8455ecabff0f6ff22ba7f7c8", + "type": "github" + }, + "original": { + "owner": "rust-lang", + "ref": "nightly", + "repo": "rust-analyzer", + "type": "github" + } + }, + "rust-overlay": { + "inputs": { + "flake-utils": [ + "conduit", + "crane", + "flake-utils" + ], + "nixpkgs": [ + "conduit", + "crane", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1688351637, + "narHash": "sha256-CLTufJ29VxNOIZ8UTg0lepsn3X03AmopmaLTTeHDCL4=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "f9b92316727af9e6c7fee4a761242f7f46880329", + "type": "github" + }, + "original": { + "owner": "oxalica", + "repo": "rust-overlay", + "type": "github" + } + }, + "rust-overlay_2": { + "inputs": { + "flake-utils": [ + "helix", + "flake-utils" + ], + "nixpkgs": [ + "helix", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1690424156, + "narHash": "sha256-Bpml+L280tHTQpwpC5/BJbU4HSvEzMvW8IZ4gAXimhE=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "f335a0213504c7e6481c359dc1009be9cf34432c", + "type": "github" + }, + "original": { + "owner": "oxalica", + "repo": "rust-overlay", + "type": "github" + } + }, + "sops-nix": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ], + "nixpkgs-stable": "nixpkgs-stable_2" + }, + "locked": { + "lastModified": 1698929376, + "narHash": "sha256-TmROaV9W6HArdTUgxLN334Kw+CradxWHw1HYM/3H6xI=", + "owner": "Mic92", + "repo": "sops-nix", + "rev": "84d6b27dc71ac02422e192c35806d06915d2bf67", + "type": "github" + }, + "original": { + "owner": "Mic92", + "repo": "sops-nix", + "type": "github" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_2": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_3": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_4": { + "locked": { + "lastModified": 1689347949, + "narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=", + "owner": "nix-systems", + "repo": "default-linux", + "rev": "31732fcf5e8fea42e59c2488ad31a0e651500f68", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default-linux", + "type": "github" + } + }, + "systems_5": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "treefmt-nix": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1698438538, + "narHash": "sha256-AWxaKTDL3MtxaVTVU5lYBvSnlspOS0Fjt8GxBgnU0Do=", + "owner": "numtide", + "repo": "treefmt-nix", + "rev": "5deb8dc125a9f83b65ca86cf0c8167c46593e0b1", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "treefmt-nix", + "type": "github" + } + }, + "wlroots": { + "flake": false, + "locked": { + "host": "gitlab.freedesktop.org", + "lastModified": 1697909146, + "narHash": "sha256-jU0I6FoCKnj4zIBL4daosFWh81U1fM719Z6cae8PxSY=", + "owner": "wlroots", + "repo": "wlroots", + "rev": "47bf87ade2bd32395615a385ebde1fefbcdf79a2", + "type": "gitlab" + }, + "original": { + "host": "gitlab.freedesktop.org", + "owner": "wlroots", + "repo": "wlroots", + "rev": "47bf87ade2bd32395615a385ebde1fefbcdf79a2", + "type": "gitlab" + } + }, + "xdph": { + "inputs": { + "hyprland-protocols": [ + "hyprland", + "hyprland-protocols" + ], + "nixpkgs": [ + "hyprland", + "nixpkgs" + ], + "systems": [ + "hyprland", + "systems" + ] + }, + "locked": { + "lastModified": 1697981233, + "narHash": "sha256-y8q4XUwx+gVK7i2eLjfR32lVo7TYvEslyzrmzYEaPZU=", + "owner": "hyprwm", + "repo": "xdg-desktop-portal-hyprland", + "rev": "22e7a65ff9633e1dedfa5317fdffc49f68de2ff2", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "xdg-desktop-portal-hyprland", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..b90039d --- /dev/null +++ b/flake.nix @@ -0,0 +1,115 @@ +{ + description = "My NixOs dotfiles"; + + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + home-manager = { + url = "github:nix-community/home-manager"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + flake-parts.url = "github:hercules-ci/flake-parts"; + devshell = { + url = "github:numtide/devshell"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + conduit = { + url = "gitlab:famedly/conduit"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + hyprland = { + url = "github:hyprwm/Hyprland"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + sops-nix = { + url = "github:Mic92/sops-nix"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + treefmt-nix = { + url = "github:numtide/treefmt-nix"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + pre-commit-hooks-nix = { + url = "github:cachix/pre-commit-hooks.nix"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + helix = { + url = "github:helix-editor/helix"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + }; + + outputs = inputs@{ flake-parts, ... }: + inputs.flake-parts.lib.mkFlake { inherit inputs; } { + systems = [ "x86_64-linux" ]; + imports = [ + inputs.devshell.flakeModule + inputs.treefmt-nix.flakeModule + inputs.pre-commit-hooks-nix.flakeModule + ]; + + flake.nixosConfigurations = + let + generateNixosConfig = name: _value: { + system = "x86_64-linux"; # I don't have any other type of machine yet + modules = [ + inputs.home-manager.nixosModules.home-manager + inputs.sops-nix.nixosModules.sops + ./share/nixos-modules/nix-config.nix + + # This directory has to exist and have a `default.nix` in it, see + # `./hosts` directory for examples + ./hosts/${name} + ]; + specialArgs = { + inherit inputs; + flakeRoot = ./.; + }; + }; + # wrapper around nixpkgs.lib.nixosSystem to enable using it on attrsets + generateNixosSystem = _name: value: + inputs.nixpkgs.lib.nixosSystem value; + + hosts = builtins.readDir ./hosts; + nixosConfigs = builtins.mapAttrs generateNixosConfig hosts; + # If you want to add something to a particular system, do it here before + # the `in ...` line + + in + builtins.mapAttrs generateNixosSystem nixosConfigs; + + perSystem = { pkgs, config, ... }: { + devshells.default = { + name = "nixconf-sh"; + + devshell.startup.pre-commit-install.text = + config.pre-commit.installationScript; + + packages = (builtins.attrValues config.treefmt.build.programs); + commands = with pkgs; [ + { package = git; } + { package = lazygit; } + { package = sops; } + { package = config.treefmt.build.wrapper; } + ]; + }; + + treefmt = { + projectRootFile = ./flake.nix; + programs = { nixpkgs-fmt.enable = true; }; + }; + + pre-commit = { + check.enable = false; + settings = { + settings = { treefmt.package = config.treefmt.build.wrapper; }; + hooks = { + treefmt.enable = true; + deadnix.enable = true; + }; + }; + }; # end of pre-commit + }; # end of perSystem + }; # end of inputs.flake-parts.lib.mkFlake + + nixConfig = { }; +} diff --git a/hosts/sagittarius/default.nix b/hosts/sagittarius/default.nix new file mode 100644 index 0000000..6bf1a22 --- /dev/null +++ b/hosts/sagittarius/default.nix @@ -0,0 +1,57 @@ +{ pkgs, ... }: { + imports = [ + # Include the results of the hardware scan. + ./hardware.nix + ./home.nix + ./ssh.nix + ./web + ]; + + boot.loader.grub.device = "/dev/sda"; + time.timeZone = "Europe/Helsinki"; + + networking = { + hostName = "sagittarius"; + useNetworkd = true; + firewall.allowedTCPPorts = [ 22 ]; + }; + systemd.network = { + enable = true; + networks."10-wan" = { + matchConfig.Name = "enp1s0"; + networkConfig.DHCP = "ipv4"; + address = [ "2a01:4f9:c012:c7a7::/64" ]; + routes = [{ routeConfig.Gateway = "fe80::1"; }]; + }; + }; + + # Select internationalisation properties. + i18n.defaultLocale = "en_US.UTF-8"; + + programs.gnupg.agent = { + enable = true; + enableSSHSupport = true; + }; + + users.users = { + ascella = { + isNormalUser = true; + extraGroups = [ "wheel" ]; + openssh.authorizedKeys.keys = [ + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKiDCf9LMx9diW5BveEju9w2Xv2kk7qKCyLESLyymzih ihp@ihp-laptop" + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHOsgD2+McS1+FFMKV9N620ta4DqHCYR1LqyoIR+AwU7 osiris@underworld" + ]; + }; + }; + + programs.zsh.enable = true; + users.defaultUserShell = pkgs.zsh; + + # This value determines the NixOS release from which the default + # settings for stateful data, like file locations and database versions + # on your system were taken. It‘s perfectly fine and recommended to leave + # this value at the release version of the first install of this system. + # Before changing this value read the documentation for this option + # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). + system.stateVersion = "23.05"; # Did you read the comment? +} diff --git a/hosts/sagittarius/hardware.nix b/hosts/sagittarius/hardware.nix new file mode 100644 index 0000000..783b081 --- /dev/null +++ b/hosts/sagittarius/hardware.nix @@ -0,0 +1,31 @@ +# Do not modify this file! It was generated by ‘nixos-generate-config’ +# and may be overwritten by future invocations. Please make changes +# to /etc/nixos/configuration.nix instead. +{ config, lib, pkgs, modulesPath, ... }: + +{ + imports = + [ (modulesPath + "/profiles/qemu-guest.nix") + ]; + + boot.initrd.availableKernelModules = [ "ahci" "xhci_pci" "virtio_pci" "virtio_scsi" "sd_mod" "sr_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/34d333d4-2298-47c7-b015-5c3e2fd1a27e"; + fsType = "ext4"; + }; + + swapDevices = [ ]; + + # Enables DHCP on each ethernet and wireless interface. In case of scripted networking + # (the default) this is the recommended approach. When using systemd-networkd it's + # still possible to use this option, but it's recommended to use it in conjunction + # with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`. + networking.useDHCP = lib.mkDefault true; + # networking.interfaces.enp1s0.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; +} diff --git a/hosts/sagittarius/home.nix b/hosts/sagittarius/home.nix new file mode 100644 index 0000000..4c5999d --- /dev/null +++ b/hosts/sagittarius/home.nix @@ -0,0 +1,23 @@ +{ home-manager, flakeRoot, ... }: { + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + home-manager.sharedModules = [{ imports = [ (flakeRoot + /share/home) ]; }]; + + home-manager.users.ascella = { + programs.direnv = { + enable = true; + nix-direnv.enable = true; + }; + + home.stateVersion = "23.05"; + }; + + home-manager.users.root = { + programs.direnv = { + enable = true; + nix-direnv.enable = true; + }; + + home.stateVersion = "23.05"; + }; +} diff --git a/hosts/sagittarius/ssh.nix b/hosts/sagittarius/ssh.nix new file mode 100644 index 0000000..8c80a53 --- /dev/null +++ b/hosts/sagittarius/ssh.nix @@ -0,0 +1,10 @@ +{ ... }: { + services.openssh = { + enable = true; + settings = { + PermitRootLogin = "no"; + PasswordAuthentication = false; + AllowUsers = [ "ascella" ]; + }; + }; +} diff --git a/hosts/sagittarius/web/acme.nix b/hosts/sagittarius/web/acme.nix new file mode 100644 index 0000000..4cde574 --- /dev/null +++ b/hosts/sagittarius/web/acme.nix @@ -0,0 +1,10 @@ +{ ... }: { + security.acme = { + acceptTerms = true; + defaults = { + email = "miran.bastaja04@gmail.com"; + dnsProvider = "porkbun"; + credentialsFile = "/var/secrets/porkbun.env"; + }; + }; +} diff --git a/hosts/sagittarius/web/blog.nix b/hosts/sagittarius/web/blog.nix new file mode 100644 index 0000000..1226bd7 --- /dev/null +++ b/hosts/sagittarius/web/blog.nix @@ -0,0 +1,14 @@ +{ ... }: { + imports = [ ./acme.nix ]; + networking.firewall.allowedTCPPorts = [ 80 443 ]; + + services.nginx = { + enable = true; + + virtualHosts."sorre.xyz" = { + enableACME = true; + forceSSL = true; + root = "/var/www/blog"; + }; + }; +} diff --git a/hosts/sagittarius/web/default.nix b/hosts/sagittarius/web/default.nix new file mode 100644 index 0000000..3fc702e --- /dev/null +++ b/hosts/sagittarius/web/default.nix @@ -0,0 +1,8 @@ +{ ... }: { + imports = [ + ./blog.nix + ./matrix.nix + ./mediadb.nix + # ./git.nix + ]; +} diff --git a/hosts/sagittarius/web/git.nix b/hosts/sagittarius/web/git.nix new file mode 100644 index 0000000..732f7d0 --- /dev/null +++ b/hosts/sagittarius/web/git.nix @@ -0,0 +1,8 @@ +{ ... }: { + services.gitDaemon = { + enable = true; + repositories = [ "/srv/git/" ]; + exportAll = true; + basePath = "/srv/git/"; + }; +} diff --git a/hosts/sagittarius/web/matrix.nix b/hosts/sagittarius/web/matrix.nix new file mode 100644 index 0000000..fc32044 --- /dev/null +++ b/hosts/sagittarius/web/matrix.nix @@ -0,0 +1,115 @@ +{ pkgs, config, ... }: +let + server_name = "sorre.xyz"; + matrix_hostname = "matrix.${server_name}"; + #admin_email = "gloss_unranked088@simplelogin.com"; + + # Build a dervation that stores the content of `${server_name}/.well-known/matrix/server` + well_known_server = pkgs.writeText "well-known-matrix-server" '' + { + "m.server": "${matrix_hostname}" + } + ''; + + # Build a dervation that stores the content of `${server_name}/.well-known/matrix/client` + well_known_client = pkgs.writeText "well-known-matrix-client" '' + { + "m.homeserver": { + "base_url": "https://${matrix_hostname}" + } + } + ''; +in +{ + imports = [ ./acme.nix ]; + + networking.firewall.allowedTCPPorts = [ 80 443 8448 ]; + networking.firewall.allowedUDPPorts = [ 80 443 8448 ]; + + services.matrix-conduit = { + enable = true; + # Currently conduit seems to have no substituter for the flake, which means + # that the compilation would be done on the server, therefore we're using + # the (prebuilt) nixpkgs version of it for now. + #package = inputs.conduit.packages.${pkgs.system}.default; + package = pkgs.matrix-conduit; + settings.global.server_name = server_name; + settings.global.allow_registration = false; + }; + + services.nginx = { + enable = true; + recommendedProxySettings = true; + + virtualHosts."${matrix_hostname}" = { + enableACME = true; + forceSSL = true; + + listen = [ + { + addr = "0.0.0.0"; + port = 443; + ssl = true; + } + { + addr = "[::]"; + port = 443; + ssl = true; + } + { + addr = "0.0.0.0"; + port = 8448; + ssl = true; + } + { + addr = "[::]"; + port = 8448; + ssl = true; + } + ]; + locations."/_matrix/" = { + proxyPass = "http://backend_conduit$request_uri"; + proxyWebsockets = true; + extraConfig = '' + proxy_set_header Host $host; + proxy_buffering off; + ''; + }; + extraConfig = '' + merge_slashes off; + ''; + }; + + virtualHosts."${server_name}" = { + enableACME = true; + forceSSL = true; + + locations = { + "=/.well-known/matrix/server" = { + alias = "${well_known_server}"; + extraConfig = '' + # Set the header since by default NGINX thinks it's just bytes + default_type application/json; + ''; + }; + "=/.well-known/matrix/client" = { + # Use the contents of the derivation built previously + alias = "${well_known_client}"; + + extraConfig = '' + # Set the header since by default NGINX thinks it's just bytes + default_type application/json; + + # https://matrix.org/docs/spec/client_server/r0.4.0#web-browser-clients + add_header Access-Control-Allow-Origin "*"; + ''; + }; + }; + }; + + upstreams."backend_conduit".servers = { + "[::1]:${toString config.services.matrix-conduit.settings.global.port}" = + { }; + }; + }; +} diff --git a/hosts/sagittarius/web/mediadb.nix b/hosts/sagittarius/web/mediadb.nix new file mode 100644 index 0000000..78d76cd --- /dev/null +++ b/hosts/sagittarius/web/mediadb.nix @@ -0,0 +1,19 @@ +{ pkgs, ... }: { + networking.firewall.allowedTCPPorts = [ 5432 ]; + + services.postgresql = { + enable = true; + package = pkgs.postgresql_15_jit; + enableTCPIP = true; + enableJIT = true; + + settings = { password_encryption = "scram-sha-256"; }; + + authentication = '' + # TYPE DATABASE USER ADDRESS METHOD + local all postgres peer + host all postgres all reject + host all all all scram-sha-256 + ''; + }; # end of services.postgreslq +} diff --git a/hosts/wonderland/default.nix b/hosts/wonderland/default.nix new file mode 100644 index 0000000..b78eb4e --- /dev/null +++ b/hosts/wonderland/default.nix @@ -0,0 +1,149 @@ +{ config, pkgs, flakeRoot, ... }: { + imports = [ + # Include the results of the hardware scan. + ./hardware.nix + ./home.nix + ./sops.nix + (flakeRoot + /share/system/steam.nix) + (flakeRoot + /share/system/hyprland.nix) + #(flakeRoot + /share/system/spotifyd.nix) + ]; + + nixpkgs.config.allowUnfree = true; + nix.gc = { + dates = "weekly"; + automatic = true; + persistent = true; + randomizedDelaySec = "15min"; + }; + + # Use the systemd-boot EFI boot loader. + boot = { + loader.systemd-boot.enable = true; + loader.efi.canTouchEfiVariables = true; + initrd.kernelModules = [ "amdgpu" ]; + }; + + networking = { + hostName = "wonderland"; + useNetworkd = true; + + nftables.enable = true; + firewall = { + enable = true; + allowedTCPPorts = [ 80 443 34197 ]; + }; + + wireless = { + enable = true; + environmentFile = config.sops.secrets."wireless.env".path; + userControlled.enable = true; + networks = { + "@HOME_WIFI_SSID@".psk = "@HOME_WIFI_PSK@"; + "@PHONE_HOTSPOT_SSID@" = { + psk = "@PHONE_HOTSPOT_PSK@"; + hidden = true; + }; + "eduroam" = { + authProtocols = [ "WPA-EAP" ]; + auth = '' + pairwise=CCMP TKIP + eap=TTLS PEAP TLS + group=CCMP TKIP + identity="mbastaja@tvz.hr" + altsubject_match="DNS:freeradius.tvz.hr" + phase1="peaplabel=0" + phase2="auth=PAP" + password="@EDUROAM_PASS@" + anonymous_identity="anonymous@tvz.hr" + ''; + }; + }; + }; + }; + + # Set your time zone. + time.timeZone = "Europe/Zagreb"; + + # Select internationalisation properties. + i18n.defaultLocale = "en_US.UTF-8"; + + services.xserver = { + enable = true; + displayManager = { + sddm.enable = true; + defaultSession = "plasmawayland"; + }; + desktopManager.plasma5.enable = true; + videoDrivers = [ "amdgpu" ]; + }; + + # Enable sound. + sound.enable = true; + services.pipewire = { + enable = true; + alsa.enable = true; + pulse.enable = true; + }; + + services.printing = { + enable = true; + drivers = with pkgs; [ + gutenprint + gutenprintBin + epson_201207w + epson-201401w + ]; + }; + + programs.gnupg.agent = { + enable = true; + enableSSHSupport = true; + }; + + hardware.bluetooth.enable = true; + services.mullvad-vpn.enable = true; + + virtualisation.podman = { + enable = true; + dockerSocket.enable = true; + dockerCompat = true; + autoPrune.enable = true; + }; + + users.users = { + alice = { + isNormalUser = true; + extraGroups = [ "wheel" "video" "network" "podman" ]; + }; + madhatter = { + isNormalUser = true; + extraGroups = [ "video" "network" ]; + }; + guest = { + isNormalUser = true; + extraGroups = [ "video" "network" ]; + }; + }; + + programs.zsh.enable = true; + users.defaultUserShell = pkgs.zsh; + + fonts.packages = with pkgs; [ + noto-fonts + noto-fonts-cjk + noto-fonts-emoji + proggyfonts + (nerdfonts.override { fonts = [ "FiraCode" ]; }) + overpass + inter + ]; + + # This value determines the NixOS release from which the default + # settings for stateful data, like file locations and database versions + # on your system were taken. It‘s perfectly fine and recommended to leave + # this value at the release version of the first install of this system. + # Before changing this value read the documentation for this option + # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). + system.stateVersion = "22.05"; # Did you read the comment? +} diff --git a/hosts/wonderland/hardware.nix b/hosts/wonderland/hardware.nix new file mode 100644 index 0000000..a99d2a3 --- /dev/null +++ b/hosts/wonderland/hardware.nix @@ -0,0 +1,39 @@ +# Do not modify this file! It was generated by ‘nixos-generate-config’ +# and may be overwritten by future invocations. Please make changes +# to /etc/nixos/configuration.nix instead. +{ config, lib, pkgs, modulesPath, ... }: + +{ + imports = + [ (modulesPath + "/installer/scan/not-detected.nix") + ]; + + boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "ahci" "usb_storage" "sd_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-amd" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/fc1a2a05-efb0-45e7-83f2-2b9dae515b0a"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/FEB7-A352"; + fsType = "vfat"; + }; + + swapDevices = + [ { device = "/dev/disk/by-uuid/f16d9af0-4043-4d39-a8d6-e788451f8e9e"; } + ]; + + # Enables DHCP on each ethernet and wireless interface. In case of scripted networking + # (the default) this is the recommended approach. When using systemd-networkd it's + # still possible to use this option, but it's recommended to use it in conjunction + # with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`. + networking.useDHCP = lib.mkDefault true; + # networking.interfaces.enp1s0.useDHCP = lib.mkDefault true; + # networking.interfaces.wlp2s0.useDHCP = lib.mkDefault true; + + hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/hosts/wonderland/home.nix b/hosts/wonderland/home.nix new file mode 100644 index 0000000..c29420b --- /dev/null +++ b/hosts/wonderland/home.nix @@ -0,0 +1,136 @@ +{ pkgs +, flakeRoot +, ... +}: +let + desktop-pkgs = with pkgs; [ + mullvad-vpn + bitwarden + calibre + beekeeper-studio + thunderbird + brightnessctl + + libsForQt5.plasma-browser-integration + libsForQt5.kdeconnect-kde + libsForQt5.ark + libsForQt5.kate + haruna # Video player + libreoffice-qt + gimp + audacity + discord + whatsapp-for-linux + inkscape + + wineWowPackages.full + winetricks + ]; +in +{ + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + home-manager.sharedModules = [{ imports = [ (flakeRoot + /share/home) ]; }]; + + home-manager.users.alice = { + imports = + let + home = flakeRoot + /share/home; + in + [ + # Custom home manager modules + (flakeRoot + /share/hm-modules/wpaperd.nix) + + # Config + (home + /kitty.nix) + (home + /hyprland.nix) + (home + /git.nix) + (home + /firefox) + (home + /wezterm) + ]; + home.packages = with pkgs; + [ + signal-desktop + tdesktop # Telegram desktop + qbittorrent + okteta + emacs + # spotify-qt librespot + nheko # matrix client + + # Various utils + # qemu_kvm + pijul # alternative vsc system + tokei # counts lines of code + dua # modern du with interactive mode (dua i) + btop # modern top + + # Gaming + libsForQt5.kpat # solitare + jdk17_headless + superTuxKart + + linux-wifi-hotspot + qemu_kvm + ] + ++ desktop-pkgs; + + home.stateVersion = "22.05"; + + programs.gallery-dl = { + enable = true; + settings.extractor = { + base-directory = "$XDG_DOWNLOAD_DIR/gallery-dl"; + + postprocessors = [ + { + name = "metadata"; + mode = "json"; + whitelist = [ + "danbooru" + "moebooru" + "gelbooru" + "sankaku" + "nhentai" + "rule34" + ]; + } + { + name = "zip"; + compression = "store"; + extension = "cbz"; + filter = "extension not in ('zip', 'rar')"; + whitelist = [ "nhentai" "mangadex" ]; + } + ]; + + Danbooru.metadata = true; + }; # End of settings.extractor + }; # End of programs.gallery-dl + }; # End of users.alice + + home-manager.users.madhatter = { + home.packages = desktop-pkgs; + imports = + let + home = flakeRoot + /share/home; + in + [ + # Config + (home + /kitty.nix) + (home + /git.nix) + (home + /firefox) + ]; + + home.stateVersion = "23.05"; + }; + + home-manager.users.root = { + home.packages = with pkgs; [ + linux-wifi-hotspot + dua # modern du with interactive mode (dua i) + ]; + + home.stateVersion = "22.05"; + }; +} diff --git a/hosts/wonderland/sops.nix b/hosts/wonderland/sops.nix new file mode 100644 index 0000000..0ac9d3d --- /dev/null +++ b/hosts/wonderland/sops.nix @@ -0,0 +1,23 @@ +{ ... }: { + sops = { + age.sshKeyPaths = [ "/etc/ssh/ssh_host_ed25519_key" ]; + defaultSopsFile = ../../secrets/credentials.json; + secrets = { + # FIXME: using mode 444 here is a hack so that spotifyd can cat the + # values out, but it obviously exposes the secrets to anyone that knows + # they are there. A better solution would be to override the spotifyd + # module to make the systemd service run the program with a group, and + # then give read priviledges to only that group. + # "spotify/password" = { + # mode = "444"; + # }; + # "spotify/username" = { + # mode = "444"; + # }; + "wireless.env" = { + sopsFile = ../../secrets/wireless.env; + format = "dotenv"; + }; + }; + }; # end of sops +} diff --git a/secrets/credentials.json b/secrets/credentials.json new file mode 100644 index 0000000..6a5dece --- /dev/null +++ b/secrets/credentials.json @@ -0,0 +1,31 @@ +{ + "spotify": { + "username": "ENC[AES256_GCM,data:OvW9x8BY7ZZp5S6jml6edU6n64HCBXgL,iv:4B8ExJ6Ra1QHdOLLe372RcXzKvJUJjwNKtLXcw56eJU=,tag:JZTEJOfujWs60FkLjiXuew==,type:str]", + "password": "ENC[AES256_GCM,data:Uy85J7INl2GkzPaWfgpmxxG8xOq3oSbZ,iv:HwTKeT/xLu3yZKMWDmGXeQg4IvkopcYGYhQ/kIaR/rE=,tag:mRlNI9faNhTl4s6b3qP4aw==,type:str]" + }, + "sops": { + "kms": null, + "gcp_kms": null, + "azure_kv": null, + "hc_vault": null, + "age": [ + { + "recipient": "age1l088h7umwuxp0sw8wk0stfup0empdnldczxvrhueu7n0vxd0c57q9zvwsk", + "enc": "-----BEGIN AGE ENCRYPTED FILE-----\nYWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBDcmhaTitOeTcrc1d4ZHhz\nZjhPdVA1R3QyS2dYMEoyVS9BeEFnQkI0Nm5FCklVOU9mZFR2ZEVZZ2xFd2w0aUZT\nMEhobDV1SzF4QTJ1K1p0TDhxWGZxdkEKLS0tIEtWME5yRFdReGc3UkJhRzJ5MzBW\nb2dFWlJMMVlIZCs0RmR2WUNBYzBQZjAKY6sr+efYtibnfKXXpH+2FX/lBa0iAoBa\nrjviK4M/VYMSpxTWtJOX5xcrDef/FvMiYgYu5lN5fvA5p/u2c6oGDg==\n-----END AGE ENCRYPTED FILE-----\n" + }, + { + "recipient": "age1xzqshnlstewfha28sqjp4lf97mm43axyrhga0vkjmt5zx6eydqhsvlsasc", + "enc": "-----BEGIN AGE ENCRYPTED FILE-----\nYWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBicVFxWDRxRjF2OGpuMVoz\nSHhPdnpqdFdib3VERXMwTXhZODlVL2tJckhVCnlpTnEvdHZQVWJ6YUtyWWtBQXQz\nWXFpSzJFTWdrR21jNDNpNWFicFV6S0UKLS0tIFJ5a0h6M0pCbDFWTUgwUDEzTzdL\nbUxXN1ZNRDFSZldQSjR1bWVTd01Vbm8KGpF/Lf56ktFHhzoghyEaAn6nYVR0lt6k\nBn0Ut1Xh9k5QAYSNCdsjQnNG/vPnLbyavUZD4tm7za8DkndzwrAnJw==\n-----END AGE ENCRYPTED FILE-----\n" + }, + { + "recipient": "age1jmpdssn7555g0pht7zwqq2dvrvzxyu65w6cf2su8pp2fz0zvaykq0jgern", + "enc": "-----BEGIN AGE ENCRYPTED FILE-----\nYWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBIV3lTUnEyQnRtNW03QXlQ\nTmJ3U3dld3NsSHI0TEtIamRrWkFWaTVHM1JZCnZqQjVwVitienlTMGx5WllLbkti\nUVhuMjUxMzloUVRTbHcxU1JGMEJMalkKLS0tIFU5Z3hVRUNxaE1QZVhEemVWS29P\nblcxRjduZGNVdEY3OEpldGFNbDlzSGcKpOoeOf3FRqlN6qAMZE+0x9W4TOeTCiBV\nnMUoXcwR2SoZLNexD2S2fDa7G661U4tIzzeB/xp3D6kGMwxeN9zToQ==\n-----END AGE ENCRYPTED FILE-----\n" + } + ], + "lastmodified": "2023-09-25T21:05:28Z", + "mac": "ENC[AES256_GCM,data:xs6I8jo0cgVelfD8Kj+tSRCdifFeVrX5LjB1TdLC5V/YYncYGySItkwo/S5Cd9+yW4O5xYNVq3tM0N2F/Nw9Py93pnpMDUDezy7cOGz3NETeukPTv1byhVyoh/N80G2kgyxd/GeWt09RHd7DjL2GBsQGyNSh1jNOPHxlskyjfqg=,iv:gbKDgdxR73X5y2RFhmRao6itN0f6f/DTZ1xmyN89K8Q=,tag:nc9TcYjDLQbkAUqsz73AXw==,type:str]", + "pgp": null, + "unencrypted_suffix": "_unencrypted", + "version": "3.8.0" + } +}
\ No newline at end of file diff --git a/secrets/wireless.env b/secrets/wireless.env new file mode 100644 index 0000000..0425706 --- /dev/null +++ b/secrets/wireless.env @@ -0,0 +1,15 @@ +HOME_WIFI_SSID=ENC[AES256_GCM,data:yHs04AgAYmTb7ckENQOPOWeG,iv:uPDKg4jYmHLzvFwdbAqek6R1SEtHiYjS7szcW0LMtMg=,tag:d2GETvgZfIR5uLQZWQZ6Bw==,type:str] +HOME_WIFI_PSK=ENC[AES256_GCM,data:P+tHxQbgXgUmK8dS4c349A==,iv:Mw6sNT/ggGkOKiqjybfptGPNgttZShU7EY3LKH+067U=,tag:htL4fbhg+NAfzeFx0mPMVA==,type:str] +PHONE_HOTSPOT_SSID=ENC[AES256_GCM,data:W+JXND8COh9c+PkS,iv:ORUs7sh/HsQEtZRJ9qzTUSahZ+OS/tKwSozQavuk+oA=,tag:6vja8Gqt2N3RbFmZNzsbjA==,type:str] +PHONE_HOTSPOT_PSK=ENC[AES256_GCM,data:9osnsF/BTm8jfbFKqR+r,iv:MHqyWNEu+ovzI1KRvGQ7/VG7CslW2UNf1BWsNK0PkLI=,tag:n6n7zyUXd6P9fPpTPSO1ZQ==,type:str] +EDUROAM_PASS=ENC[AES256_GCM,data:7kllDsOz9Pg=,iv:4T2XqpWZLLercbLvamWzaTTzTtwu8QyCy9xrZKYwNM0=,tag:L6RHGEn+fSvPnf0AqQZgMg==,type:str] +sops_age__list_0__map_enc=-----BEGIN AGE ENCRYPTED FILE-----\nYWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBiYnZMdWs0SDl0K1pGNjk2\naHBsT2tRSERTYkJMbXgwN1NqVFBtS0NZRkc4CmVVWldLMlhVeXQ1bnZyYkhQRkpS\nSkwxYm1zajdUa1JjVHNmUkJmbEE4TTQKLS0tIFZWVjNCVTVnM3ZRUHlGdWxybkhw\nVFVMWE1STzdaQUpWS0VJNVpvWmRMZjgKuFe2OrlzVw72I4AERJBX295d3ChmdgJ0\nZJjcuqose5OcjIYcx9e6MlJ+fVEDgE8cvd50xvcZLi3fPK7IJKyejw==\n-----END AGE ENCRYPTED FILE-----\n +sops_age__list_0__map_recipient=age1l088h7umwuxp0sw8wk0stfup0empdnldczxvrhueu7n0vxd0c57q9zvwsk +sops_age__list_1__map_enc=-----BEGIN AGE ENCRYPTED FILE-----\nYWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBYTUZvNjhZOGxKQnFpbitB\nZVRQOXNRdTUrRURzb2NTQWQ1NU5ad0d1a2lrCmRmVFRLOVZERkpva3RqVFpBRTRr\ncVgrdE9ROERndmJPUnpuTWFOV2gxb2MKLS0tIGxGYzRJTE1QM2xGSXdtZ21CNENL\nRlZUSW5GNVBoSGtXclBtOG1QUTRKdGsKY3ldZ8QY9/7FimA2qZuN+ZZXM47mS4AB\nomHCAWiILYbbTuL9duSnjeaxN+X/ol6amjjaPkp+8czMQaGOlNa6BQ==\n-----END AGE ENCRYPTED FILE-----\n +sops_age__list_1__map_recipient=age1xzqshnlstewfha28sqjp4lf97mm43axyrhga0vkjmt5zx6eydqhsvlsasc +sops_age__list_2__map_enc=-----BEGIN AGE ENCRYPTED FILE-----\nYWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSB1cmRKZzhhY2RKZEdZa0Jp\nL3drMUd2RWlHQ0JWaG1YRTkxeVR1MjdnV0FzClpsZzFSQTRvRDVPNUZDSUtSbVhh\nN3IwemVRMTRlalY4c0c5SXk3TTludmcKLS0tIEpMcWJxa0ZhU09JbzZobC8wYmtB\nWWVNcDNFNnJTMFp0cXhVU1N0YkhXUDgKLr7Z+zkoSZZm3OICdBLiDXTCiScC89Cl\na8gmRhHLfiuEbUqDcMLFdVGtvJX1epIDR2nl5CkvUjAAEQT+2NCazw==\n-----END AGE ENCRYPTED FILE-----\n +sops_age__list_2__map_recipient=age1jmpdssn7555g0pht7zwqq2dvrvzxyu65w6cf2su8pp2fz0zvaykq0jgern +sops_lastmodified=2023-11-03T13:06:38Z +sops_mac=ENC[AES256_GCM,data:rUzAZsx9awHma/6dFoXGfL7/jtZslHBG4ufbBfbGdPHrAXSbKJ+kqvjmVvIoVKcXgfMfhyY/ZRev+wzAEUIaJAsUtIJ42MNzmefYOFAIruZ1kaEXhv3qxhUoHmglsx9Wb+QcdAUOJpk3LP5QtcRK2bKQKF9DXxxxXAzzdrDUIhY=,iv:6FvIfwAKH383FW75y/yCfsvf4JZCUlTxW/zOEso3duw=,tag:YIrNcp7x8DnUMmCfREXsXQ==,type:str] +sops_unencrypted_suffix=_unencrypted +sops_version=3.8.1 diff --git a/share/hm-modules/wpaperd.nix b/share/hm-modules/wpaperd.nix new file mode 100644 index 0000000..c38da21 --- /dev/null +++ b/share/hm-modules/wpaperd.nix @@ -0,0 +1,74 @@ +{ config, lib, pkgs, ... }: +with lib; +let + cfg = config.services.wpaperd; + tomlFormat = pkgs.formats.toml { }; +in +{ + options.services.wpaperd = { + enable = mkEnableOption "enable wpaperd"; + + package = mkOption { + default = pkgs.wpaperd; + defaultText = literalExpression "pkgs.wpaperd"; + type = types.package; + example = literalExpression "pkgs.wpaperd"; + description = "The package to use for the wpaperd binary."; + }; + + settings = mkOption { + type = tomlFormat.type; + description = '' + Configuration for wpaperd. Options are specified on: + https://github.com/danyspin97/wpaperd#wallpaper-configuration + ''; + example = literalExpression '' + { + default = { + path = "/home/myusername/Pictures/Wallpapers/"; + duration = "10m" + sorting = "random"; + }; + } + ''; + }; + + systemdTarget = mkOption { + type = types.str; + default = "hyprland-session.target"; + description = '' + Systemd target to bind to. + Note: if you're using home-manager to configure hyprland, you want to + have `wayland.windowManager.hyprland.systemdIntegration` enabled. + ''; + }; + }; + + config = mkIf cfg.enable { + assertions = [ + (hm.assertions.assertPlatform "services.wpaperd" pkgs platforms.linux) + ]; + + home.packages = [ cfg.package ]; + + xdg.configFile = { + "wpaperd/wallpaper.toml" = mkIf (cfg.settings != { }) { + source = tomlFormat.generate "wpaperd-config" cfg.settings; + }; + }; + + systemd.user.services.wpaperd = { + Unit = { + Description = "Wallpaper daemon for Wayland"; + BindsTo = [ cfg.systemdTarget ]; + }; + + Service = { + Type = "simple"; + ExecStart = "${cfg.package}/bin/wpaperd --no-daemon"; + }; + + Install.WantedBy = [ cfg.systemdTarget ]; + }; + }; +} diff --git a/share/home/default.nix b/share/home/default.nix new file mode 100644 index 0000000..f1ecf45 --- /dev/null +++ b/share/home/default.nix @@ -0,0 +1,64 @@ +# Minimal home configuration containing everything that I want on all of +# my machines +{ pkgs, config, ... }: { + imports = [ ./helix.nix ./zsh.nix ]; + + home.packages = with pkgs; [ + xclip + wget + hunspell + hunspellDicts.en_US + hunspellDicts.hr_HR + ripgrep + git + age + gnupg + xh + fd + sd + bc # CLI calculator + ffmpeg + amfora # Gemini CLI browser + trashy # Trash CLI + + # Useful nix tooling + nix-tree + ]; + + programs.direnv = { + enable = true; + nix-direnv.enable = true; + }; + + xdg = { + enable = true; + systemDirs.data = + let + gds = pkgs.gsettings-desktop-schemas; + gtk3 = pkgs.gtk3; + in + [ + "${gds}/share/gsettings-schemas/${gds.name}" + "${gtk3}/share/gsettings-schemas/${gtk3.name}" + ]; + userDirs = { + enable = true; + createDirectories = true; + }; + }; + + # Lots of these are courtesy of xdg-ninja + # https://github.com/b3nj5m1n/xdg-ninja + home.sessionVariables = with config.xdg; { + CARGO_HOME = "${dataHome}/cargo"; + GOPATH = "${dataHome}/go"; + WINEPREFIX = "${dataHome}/wine"; + XCOMPOSECACHE = "${cacheHome}/X11/xcompose"; + GTK2_RC_FILES = "${configHome}/gtk-2.0/gtkrc"; + NODE_REPL_HISTORY = "${dataHome}/node_repl_history"; + NPM_CONFIG_USERCONFIG = "${configHome}/npm/npmrc"; + # shell + HISTFILE = "${stateHome}/shell/history"; + ZDOTDIR = "${configHome}/zsh"; + }; +} diff --git a/share/home/eww/config/eww.scss b/share/home/eww/config/eww.scss new file mode 100644 index 0000000..8172b28 --- /dev/null +++ b/share/home/eww/config/eww.scss @@ -0,0 +1,13 @@ +* { + all: unset; // Unsets everything so you can style everything from scratch +} + +.bar { + background-color: #3a3a3a; + color: #fff; +} + +.workspaces { + font-size: 1.5em; +} + diff --git a/share/home/eww/config/eww.yuck b/share/home/eww/config/eww.yuck new file mode 100644 index 0000000..0f27d9f --- /dev/null +++ b/share/home/eww/config/eww.yuck @@ -0,0 +1,54 @@ +(defwidget bar [] + (centerbox :orientation "v" + (workspaces) + "test" + (battery))) + +(defwidget workspace-btn [n ?icon] + (button :onclick "hyprctl dispatch 'workspace ${n}'" + :halign "baseline" + :hexpand true + "${icon ?: n}")) + +(defwidget workspaces [] + (box :class "workspaces" + :orientation "v" + :space-evenly true + :valign "start" + :halign "center" + (workspace-btn :n 1 :icon "") + (workspace-btn :n 2 :icon "") + (workspace-btn :n 3 :icon "") + (workspace-btn :n 4 :icon "") + (workspace-btn :n 5 :icon "") + (workspace-btn :n 6 :icon "") + (workspace-btn :n 7 :icon "") + (workspace-btn :n 8 :icon "") + (workspace-btn :n 9 :icon ""))) + +(defwidget battery [] + (metric :label "" + :value {EWW_BATTERY} + :onchange "")) + +(defwidget metric [label value onchange] + (box :orientation "v" + :class "metric" + :space-evenly false + (box :class "label" label) + (scale :min 0 + :max 101 + :active {onchange != ""} + :value value + :onchange onchange))) + +(defwindow bar + :monitor 0 + :geometry (geometry :width "1.25%" + :height "98%" + :anchor "right center") + :stacking "fg" + :windowtype "dock" + :exclusive true + (bar)) + diff --git a/share/home/eww/default.nix b/share/home/eww/default.nix new file mode 100644 index 0000000..63fe356 --- /dev/null +++ b/share/home/eww/default.nix @@ -0,0 +1,7 @@ +{ pkgs, ... }: { + programs.eww = { + enable = true; + configDir = ./config; + package = pkgs.eww-wayland; # If you're using x11, delete this + }; +} diff --git a/share/home/firefox/default.nix b/share/home/firefox/default.nix new file mode 100644 index 0000000..f1ee260 --- /dev/null +++ b/share/home/firefox/default.nix @@ -0,0 +1,62 @@ +{ pkgs, ... }: +let + # Concatenate all files in the `./usercss` directory into one string + css-files = + map (n: ./usercss/${n}) (builtins.attrNames (builtins.readDir ./usercss)); + userChrome = builtins.concatStringsSep "\n" (map builtins.readFile css-files); +in +{ + programs.firefox = { + enable = true; + profiles = { + alice = { + name = "alice"; + isDefault = true; + inherit userChrome; + + search = { + default = "DuckDuckGo"; + engines = { + "Nix Packages" = { + urls = [{ + template = "https://search.nixos.org/packages"; + params = [ + { + name = "type"; + value = "packages"; + } + { + name = "query"; + value = "{searchTerms}"; + } + ]; + }]; + + icon = + "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg"; + definedAliases = [ "@np" ]; + }; + + "NixOS Wiki" = { + urls = [{ + template = "https://nixos.wiki/index.php?search={searchTerms}"; + }]; + iconUpdateURL = "https://nixos.wiki/favicon.png"; + updateInterval = 24 * 60 * 60 * 1000; # every day + definedAliases = [ "@nw" ]; + }; + + "Bing".metaData.hidden = true; + # builtin engines only support specifying one additional alias + "Google".medaData.alias = "@g"; + }; + }; # end of search + + settings = { + "browser.compactmode.show" = true; + "toolkit.legacyUserProfileCustomizations.stylesheets" = true; + }; + }; # end of alice (profile) + }; # end of profiles + }; +} diff --git a/share/home/firefox/usercss/compact-about-config.css b/share/home/firefox/usercss/compact-about-config.css new file mode 100644 index 0000000..55e30f7 --- /dev/null +++ b/share/home/firefox/usercss/compact-about-config.css @@ -0,0 +1,24 @@ +/* Source file https://github.com/MrOtherGuy/firefox-csshacks/tree/master/content/compact_about_config.css made available under Mozilla Public License v. 2.0 +See the above repository for updates as well as full license text. */ + +/* Makes about:config list more compact */ + +@-moz-document url("about:config"){ + .button-delete, + .button-edit, + .button-reset, + .button-save, + .button-toggle{ + margin-block: 1px !important; + padding-block: 11px 0 !important; + padding-inline: 0 !important; + min-height: 22px !important; + width: 22px !important; + outline-offset: 0 !important; + } + .cell-edit{ width: 28px !important; } + form > input, + tr:not(.add) > th, + tr:not(.add) > .cell-value{ padding-block: 0 !important; } + tr:not(:hover) .semi-transparent:not(.primary,.button-add){ background-color: transparent !important; } +} diff --git a/share/home/firefox/usercss/context-menu.css b/share/home/firefox/usercss/context-menu.css new file mode 100644 index 0000000..0bf5749 --- /dev/null +++ b/share/home/firefox/usercss/context-menu.css @@ -0,0 +1,12 @@ +/*** Remove items from image context menu ***/ +#context-sendimage, /* Email image */ +#context-inspect-a11y, +#context-savelinktopocket, +#context-pocket, +#context-savepage, +#context-print-selection, /* Print selected text */ +#context-selectall, +#context-sep-selectall /* Seperator bar */ +{ + display: none !important; +} diff --git a/share/home/firefox/usercss/tab-separator-lines.css b/share/home/firefox/usercss/tab-separator-lines.css new file mode 100644 index 0000000..2f77db4 --- /dev/null +++ b/share/home/firefox/usercss/tab-separator-lines.css @@ -0,0 +1,23 @@ +/* Source file https://github.com/MrOtherGuy/firefox-csshacks/tree/master/chrome/tab_separator_lines.css made available under Mozilla Public License v. 2.0 +See the above repository for updates as well as full license text. */ + +/* Bring back tab separator lines that were removed in Proton */ + +.tabbrowser-tab{ + border-inline-start: 1px solid transparent !important; + border-image: 0 1 linear-gradient( + transparent 20%, + color-mix(in srgb, currentColor 20%, transparent) 20%, + color-mix(in srgb, currentColor 20%, transparent) 80%, + transparent 80% + ) !important; +} + +.tabbrowser-tab:hover, +#tabbrowser-tabs:not([movingtab]) .tabbrowser-tab:hover + .tabbrowser-tab:not([first-visible-unpinned-tab]), +.tabbrowser-tab:first-child, +.tabbrowser-tab[selected], +.tabbrowser-tab[multiselected], +#tabbrowser-arrowscrollbox[overflowing] > .tabbrowser-tab[first-visible-unpinned-tab], +#tabbrowser-tabs:not([movingtab]) .tabbrowser-tab[multiselected] + .tabbrowser-tab, +#tabbrowser-tabs:not([movingtab]) .tabbrowser-tab[selected] + .tabbrowser-tab { border-image: none !important; }
\ No newline at end of file diff --git a/share/home/firefox/usercss/unified-extensions-view.css b/share/home/firefox/usercss/unified-extensions-view.css new file mode 100644 index 0000000..876a7d0 --- /dev/null +++ b/share/home/firefox/usercss/unified-extensions-view.css @@ -0,0 +1,46 @@ +/*** Clean and tight extensions menu ***/ +#unified-extensions-view { + --uei-icon-size: 20px; +} + +#unified-extensions-view .panel-header, +#unified-extensions-view .panel-header + toolbarseparator, +#unified-extensions-view .panel-subview-body + toolbarseparator, +#unified-extensions-view #unified-extensions-manage-extensions { + display:none !important; +} + +#unified-extensions-view .unified-extensions-item-menu-button.subviewbutton { + visibility: hidden !important; + transition: 300ms !important; + -moz-margin-end: -3.6em !important; +} + +#unified-extensions-view .panel-subview-body { + padding-top: 8px !important; + padding-bottom: 8px !important; +} + +#unified-extensions-view:hover +.unified-extensions-item-menu-button.subviewbutton { + visibility: visible !important; + transition: 300ms !important; + -moz-margin-end: initial !important; +} + +#unified-extensions-view .unified-extensions-item .unified-extensions-item-icon, +#unified-extensions-view .unified-extensions-item .toolbarbutton-badge-stack { + margin-inline-end: 2px !important; +} + +#unified-extensions-view .unified-extensions-item-name, +#unified-extensions-view .unified-extensions-item-message { + padding-inline-start: 0.5em !important; + width: 21em !important; +} + +#unified-extensions-view .unified-extensions-item-action-button.subviewbutton { + padding-top: 2px !important; + padding-bottom: 2px !important; +} + diff --git a/share/home/git.nix b/share/home/git.nix new file mode 100644 index 0000000..98cafa2 --- /dev/null +++ b/share/home/git.nix @@ -0,0 +1,12 @@ +{ ... }: { + programs.git = { + enable = true; + userEmail = "miran.bastaja04@gmail.com"; + userName = "Miran Bastaja"; + signing = { + key = "002426427AE095E093D51B3EF42E936D529F5760"; + signByDefault = true; + }; + delta.enable = true; + }; +} diff --git a/share/home/helix.nix b/share/home/helix.nix new file mode 100644 index 0000000..c7b7cad --- /dev/null +++ b/share/home/helix.nix @@ -0,0 +1,42 @@ +{ pkgs, ... }: { + programs.helix = { + enable = true; + defaultEditor = true; + + extraPackages = with pkgs; [ + rust-analyzer + rustfmt + nil + nixfmt + python311Packages.python-lsp-server + clang-tools + black + ]; + + settings = { + theme = "tokyonight"; + editor = { + line-number = "relative"; + cursor-shape = { + insert = "bar"; + normal = "block"; + select = "underline"; + }; + whitespace.render = { + space = "all"; + tab = "all"; + newline = "none"; + }; + whitespace.characters = { + space = "·"; + nbsp = "⍽"; + tab = "→"; + newline = "⏎"; + tabpad = "·"; # Tabs will look like "→···" (depending on tab width) + }; + cursorline = true; + lsp.display-messages = true; + }; + }; + }; +} diff --git a/share/home/hyprland.nix b/share/home/hyprland.nix new file mode 100644 index 0000000..63d5d77 --- /dev/null +++ b/share/home/hyprland.nix @@ -0,0 +1,65 @@ +# IMPORTANT: this module requires the system to already have `programs.hyprland` +# enabled. You can enable it by importing `share/system/hyprland.nix` +{ pkgs, ... }: { + imports = [ ./kitty.nix ./wpaperd.nix ./eww ]; + + wayland.windowManager.hyprland = { + enable = true; + extraConfig = '' + $mod = SUPER + + bind = $mod SHIFT, Return, exec, kitty + + general { + layout = master + } + + master { + mfact = 0.5 + new_is_master = false + } + + # workspaces + # binds $mod + [shift +] {1..10} to [move to] workspace {1..10} + ${builtins.concatStringsSep "\n" (builtins.genList (x: + let ws = let c = (x + 1) / 10; in builtins.toString (x + 1 - (c * 10)); + in '' + bind = $mod, ${ws}, workspace, ${toString (x + 1)} + bind = $mod SHIFT, ${ws}, movetoworkspacesilent, ${toString (x + 1)} + '') 10)} + + bind = $mod SHIFT, C, killactive + bind = $mod SHIFT, F, togglefloating + bind = $mod SHIFT, Q, exit + bind = $mod, P, exec, rofi -show run + + bind = $mod, H, cyclenext, prev + bind = $mod, L, cyclenext + bind = $mod SHIFT, H, swapnext, prev + bind = $mod SHIFT, L, swapnext + + # audio control + binde =, XF86AudioRaiseVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ --limit 1.0 5%+ + binde =, XF86AudioLowerVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ --limit 1.0 5%- + bind =, XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle + + # monitor brightness control + binde =, XF86MonBrightnessUp, exec, brightnessctl set +5% + binde =, XF86MonBrightnessDown, exec, brightnessctl set 5%- + + input { + # focus change on cursor move + follow_mouse = 1 + accel_profile = flat + } + monitor=,preferred,auto,1 + + # set opacity to 0.9 active and 0.5 inactive for kitty + windowrule = opacity 0.9 override 0.5 override,^(kitty)$ + ''; + }; + + home.packages = with pkgs; [ brightnessctl wireplumber ]; + services.dunst.enable = true; + programs.rofi.enable = true; +} diff --git a/share/home/kitty.nix b/share/home/kitty.nix new file mode 100644 index 0000000..3cdc18b --- /dev/null +++ b/share/home/kitty.nix @@ -0,0 +1,26 @@ +{ pkgs, ... }: { + programs.kitty = { + enable = true; + theme = "Mayukai"; + + font = { + package = pkgs.nerdfonts.override { fonts = [ "AnonymousPro" ]; }; + name = "AnonymousPro"; + size = 10; + }; + + settings = { cursor_shape = "beam"; }; + + keybindings = { + "ctrl+tab" = "new_tab"; + + "alt+1" = "goto_tab 1"; + "alt+2" = "goto_tab 2"; + "alt+3" = "goto_tab 3"; + "alt+4" = "goto_tab 4"; + "alt+5" = "goto_tab 5"; + }; + }; + + home.shellAliases = { s = "kitty +kitten ssh"; }; +} diff --git a/share/home/wezterm/config.lua b/share/home/wezterm/config.lua new file mode 100644 index 0000000..872a1aa --- /dev/null +++ b/share/home/wezterm/config.lua @@ -0,0 +1,62 @@ +local wezterm = require 'wezterm' +local act = wezterm.action +local config = {} + +if wezterm.config_builder then + config = wezterm.config_builder() +end + +config.color_scheme = 'Catppuccin Mocha' +config.window_background_opacity = 0.9 + +config.default_cursor_style = "SteadyBar" +config.font = wezterm.font('Blex Mono Nerd Font') +config.font_size = 9.5 + +config.keys = { + -- Tab management + { key = '1', mods = 'ALT', action = act.ActivateTab(0) }, + { key = '2', mods = 'ALT', action = act.ActivateTab(1) }, + { key = '3', mods = 'ALT', action = act.ActivateTab(2) }, + { key = '4', mods = 'ALT', action = act.ActivateTab(3) }, + { key = '5', mods = 'ALT', action = act.ActivateTab(4) }, + { key = '6', mods = 'ALT', action = act.ActivateTab(5) }, + { key = '7', mods = 'ALT', action = act.ActivateTab(6) }, + { key = '8', mods = 'ALT', action = act.ActivateTab(7) }, + { key = 't', mods = 'CTRL|SHIFT', action = act.SpawnTab 'CurrentPaneDomain' }, + { key = 'w', mods = 'CTRL|SHIFT', action = act.CloseCurrentTab{ confirm = true}}, + { key = '{', mods = 'CTRL|SHIFT', action = act.MoveTabRelative(-1) }, + { key = '}', mods = 'CTRL|SHIFT', action = act.MoveTabRelative(1) }, + + -- Split management + { + key = 'h', + mods = 'CTRL', + action = act.SplitHorizontal { domain = 'CurrentPaneDomain' }, + }, + { + key = 'v', + mods = 'CTRL', + action = act.SplitVertical { domain = 'CurrentPaneDomain' }, + }, + { + key = 'q', + mods = 'CTRL', + action = act.CloseCurrentPane { confirm = true }, + }, + -- Split movement + -- activate pane selection mode with the default alphabet (labels are "a", "s", "d", "f" and so on) + -- (j)ump to split + { key = 'j', mods = 'CTRL', action = act.PaneSelect }, + -- show the pane selection mode, but have it swap the active and selected panes + -- (m)ove split + { + key = 'm', + mods = 'CTRL', + action = act.PaneSelect { + mode = 'SwapWithActive', + }, + }, +} + +return config diff --git a/share/home/wezterm/default.nix b/share/home/wezterm/default.nix new file mode 100644 index 0000000..b06022b --- /dev/null +++ b/share/home/wezterm/default.nix @@ -0,0 +1,10 @@ +{ pkgs, ... }: { + programs.wezterm = { + enable = true; + extraConfig = builtins.readFile ./config.lua; + }; + + fonts.fontconfig.enable = true; + home.packages = with pkgs; + [ (nerdfonts.override { fonts = [ "IBMPlexMono" ]; }) ]; +} diff --git a/share/home/wpaperd.nix b/share/home/wpaperd.nix new file mode 100644 index 0000000..d348c27 --- /dev/null +++ b/share/home/wpaperd.nix @@ -0,0 +1,15 @@ +# IMPORTANT: this is the config for a custom module that's located at +# /share/hm-modules/wpaperd.nix. In order to use this config you have to also +# import that module. +{ config, ... }: +let wallpapers-dir = "${config.xdg.userDirs.pictures}/Wallpapers"; +in { + services.wpaperd = { + enable = true; + settings.default = { + path = wallpapers-dir; + duration = "5m"; + sorting = "random"; + }; + }; +} diff --git a/share/home/zsh.nix b/share/home/zsh.nix new file mode 100644 index 0000000..ef79acb --- /dev/null +++ b/share/home/zsh.nix @@ -0,0 +1,72 @@ +{ pkgs, ... }: { + programs.zsh = { + enable = true; + enableAutosuggestions = true; + enableCompletion = true; + syntaxHighlighting.enable = true; + enableVteIntegration = true; + autocd = true; + dotDir = ".config/zsh"; + + shellAliases = { + battery-status = '' + upower -i $(upower -e | grep BAT) | grep -E "state|to full|percentage" + ''; + ip = ''ip --color=auto''; + ltg = "ls --git --tree"; + ltgi = "ltg --git-ignore"; + sl = "sl -awFc5"; + }; + }; + home.packages = with pkgs; [ sl ]; + + programs.eza = { + enable = true; + enableAliases = true; + icons = true; + extraOptions = [ "--header" "--group-directories-first" "--long" ]; + }; + + programs.starship = { + enable = true; + enableZshIntegration = true; + + # settings = let + # lightblue-bg = "bg:#769ff0"; + # lightblue-fg = "fg:#e3e5e5"; + # lightblue = "${lightblue-fg} ${lightblue-bg}"; + # in { + # format = lib.concatStrings [ + # "[░▒▓](#a3aed2)" + # "[$username @ $hostname](${lightblue})" + # "$directory" + # "$rust" + # "$package" + # "\n" + # "> " + # ]; + # + # hostname = { + # ssh_only = false; + # format = "[$hostname]($style)"; + # trim_at = ""; # disable trimming + # style = lightblue; + # }; + # + # username = { + # show_always = true; + # format = "[$user]($style)"; + # style_user = lightblue; + # style_root = "${lightblue-bg} fg:red bold"; + # }; + # + # directory = { + # format = "[ $path ]($style)"; + # truncation_length = 3; + # truncation_symbol = "…/"; + # }; + # }; # end of settings + }; # end of programs.starship + + programs.wezterm.enableZshIntegration = true; +} diff --git a/share/nixos-modules/iwd-ext.nix b/share/nixos-modules/iwd-ext.nix new file mode 100644 index 0000000..ddf0494 --- /dev/null +++ b/share/nixos-modules/iwd-ext.nix @@ -0,0 +1,106 @@ +{ config, lib, pkgs, ... }: +let + inherit (lib) mkEnableOption mkIf mkOption types recursiveUpdate; + + cfg = config.networking.wireless.iwd-ext; + ini = pkgs.formats.ini { }; + defaults = { + # without UseDefaultInterface, sometimes wlan0 simply goes AWOL with + # NetworkManager + # https://iwd.wiki.kernel.org/interface_lifecycle#interface_management_in_iwd + General.UseDefaultInterface = with config.networking.networkmanager; + (enable && (wifi.backend == "iwd")); + }; + configFile = ini.generate "main.conf" (recursiveUpdate defaults cfg.settings); + +in +{ + options.networking.wireless.iwd-ext = { + enable = mkEnableOption (lib.mdDoc "iwd"); + + package = mkOption { + type = types.package; + default = pkgs.iwd; + defaultText = lib.literalExpression "pkgs.iwd"; + description = lib.mdDoc '' + The iwd package to use + ''; + }; + + settings = mkOption { + type = ini.type; + default = { }; + + example = { + Settings.AutoConnect = true; + + Network = { + EnableIPv6 = true; + RoutePriorityOffset = 300; + }; + }; + + description = lib.mdDoc '' + Options passed to iwd. + See [here](https://iwd.wiki.kernel.org/networkconfigurationsettings) for + supported options. + ''; + }; + + networks = mkOption { + type = types.attrsOf ini.type; + default = { }; + example = { + HomeNetwork = { + Security.PreSharedKey = "totallysecurepsk"; + }; + "@NETWORK_2_SSID@" = { + Security.PreSharedKey = "@NETWORK_2_PSK@"; + }; + }; + + description = lib.mdDoc '' + AttrSet of type SSID - iwd network INI config. + See [here](https://iwd.wiki.kernel.org/networkconfigurationsettings) for + supported options. + ''; + }; + }; # end of options.networking.wireless.iwd-ext + + config = mkIf cfg.enable { + assertions = [ + { + assertion = !config.networking.wireless.enable; + message = '' + Only one wireless daemon is allowed at the time: + networking.wireless.enable and networking.wireless.iwd-ext.enable are + mutually exclusive. + ''; + } + { + assertion = !config.networking.iwd.enable; + message = '' + Only one wireless daemon is allowed at the time: + networking.wireless.iwd.enable and networking.wireless.iwd-ext.enable are + mutually exclusive. + ''; + } + ]; + + environment.etc."iwd/${configFile.name}".source = configFile; + + environment.systemPackages = [ cfg.package ]; # for iwctl + services.dbus.packages = [ cfg.package ]; + systemd.packages = [ cfg.package ]; + + systemd.network.links."80-iwd" = { + matchConfig.Type = "wlan"; + linkConfig.NamePolicy = "keep kernel"; + }; + + systemd.services.iwd = { + wantedBy = [ "multi-user.target" ]; + restartTriggers = [ configFile ]; + }; + }; +} diff --git a/share/nixos-modules/nix-config.nix b/share/nixos-modules/nix-config.nix new file mode 100644 index 0000000..9634bcf --- /dev/null +++ b/share/nixos-modules/nix-config.nix @@ -0,0 +1,15 @@ +{ inputs, ... }: { + nix.settings = { + experimental-features = [ "nix-command" "flakes" ]; + auto-optimise-store = true; + + extra-substituters = + [ "https://helix.cachix.org" "https://hyprland.cachix.org" ]; + extra-trusted-public-keys = [ + "helix.cachix.org-1:ejp9KQpR1FBI2onstMQ34yogDm4OgU2ru6lIwPvuCVs=" + "hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc=" + ]; + }; + nixpkgs.overlays = + [ inputs.helix.overlays.default inputs.hyprland.overlays.default ]; +} diff --git a/share/system/hyprland.nix b/share/system/hyprland.nix new file mode 100644 index 0000000..2e1c679 --- /dev/null +++ b/share/system/hyprland.nix @@ -0,0 +1,6 @@ +{ inputs, pkgs, ... }: { + programs.hyprland = { + enable = true; + package = inputs.hyprland.packages.${pkgs.system}.hyprland; + }; +} diff --git a/share/system/spotifyd.nix b/share/system/spotifyd.nix new file mode 100644 index 0000000..5e04898 --- /dev/null +++ b/share/system/spotifyd.nix @@ -0,0 +1,13 @@ +{ config, ... }: +let secrets = config.sops.secrets; +in { + services.spotifyd = { + enable = true; + settings.global = { + username_cmd = "cat ${secrets."spotify/username".path}"; + password_cmd = "cat ${secrets."spotify/password".path}"; + device_name = "nixos_${config.networking.hostName}"; + device_type = "computer"; + }; + }; +} diff --git a/share/system/steam.nix b/share/system/steam.nix new file mode 100644 index 0000000..7137bfa --- /dev/null +++ b/share/system/steam.nix @@ -0,0 +1,24 @@ +{ lib, ... }: { + programs.steam.enable = true; + + nixpkgs.config = { + allowUnfreePredicate = pkg: + builtins.elem (lib.getName pkg) [ + "steam" + "steam-original" + "steam-runtime" + ]; + packageOverrides = pkgs: { + steam = + pkgs.steam.override { extraPkgs = pkgs: with pkgs; [ libgdiplus ]; }; + }; + }; + + environment.sessionVariables = rec { + # Steam needs this to find Proton-GE + STEAM_EXTRA_COMPAT_TOOLS_PATHS = + "\${HOME}/.steam/root/compatibilitytools.d"; + # note: this doesn't replace PATH, it just adds this to it + PATH = [ "\${XDG_BIN_HOME}" ]; + }; +} |
