diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..0d69151 --- /dev/null +++ b/.envrc @@ -0,0 +1,2 @@ +use flake +eval "$shellHook" diff --git a/.gitignore b/.gitignore index 8b13789..726d2d6 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ - +result +.direnv diff --git a/config.nix b/config.nix deleted file mode 100644 index 7e0a949..0000000 --- a/config.nix +++ /dev/null @@ -1,4 +0,0 @@ -{ - allowUnfree = true; - allowUnsupportedSystem = true; -} diff --git a/configs/kak/colors/nord.kak b/configs/kak/colors/nord.kak index bc009d0..cb97cd4 100644 --- a/configs/kak/colors/nord.kak +++ b/configs/kak/colors/nord.kak @@ -63,13 +63,13 @@ set-face global StatusLineMode rgb:5e81ac,rgb:3b4252 # face used for the current mode except the normal mode set-face global StatusLineInfo rgb:5e81ac,rgb:3b4252 - # face used for special information + # face used for special information set-face global StatusLineValue rgb:5e81ac,rgb:3b4252 # face used for special values (numeric prefixes, registers, etc.) set-face global StatusCursor rgb:2e3440,rgb:ebcb8b - # face used for the status line cursor + # face used for the status line cursor set-face global Prompt rgb:88c0d0,rgb:3b4252 # face used prompt displayed on the status line diff --git a/configs/rofi/onedark.rasi b/configs/rofi/onedark.rasi new file mode 100644 index 0000000..f63f4fb --- /dev/null +++ b/configs/rofi/onedark.rasi @@ -0,0 +1,100 @@ +/* + * ROFI One Dark + * + * Based on OneDark.vim (https://github.com/joshdick/onedark.vim) + * + * Author: Benjamin Stauss + * User: me-benni + * + */ + + +* { + black: #000000; + red: #eb6e67; + green: #95ee8f; + yellow: #f8c456; + blue: #6eaafb; + mangenta: #d886f3; + cyan: #6cdcf7; + emphasis: #50536b; + text: #dfdfdf; + text-alt: #b2b2b2; + fg: #abb2bf; + bg: #282c34; + + spacing: 0; + background-color: transparent; + + font: "Knack Nerd Font 14"; + text-color: @text; +} + +window { + transparency: "real"; + fullscreen: true; + background-color: #282c34dd; +} + +mainbox { + padding: 30% 30%; +} + +inputbar { + margin: 0px 0px 20px 0px; + children: [prompt, textbox-prompt-colon, entry, case-indicator]; +} + +prompt { + text-color: @blue; +} + +textbox-prompt-colon { + expand: false; + str: ":"; + text-color: @text-alt; +} + +entry { + margin: 0px 10px; +} + +listview { + spacing: 5px; + dynamic: true; + scrollbar: false; +} + +element { + padding: 5px; + text-color: @text-alt; + highlight: bold #95ee8f; /* green */ + border-radius: 3px; +} + +element selected { + background-color: @emphasis; + text-color: @text; +} + +element urgent, element selected urgent { + text-color: @red; +} + +element active, element selected active { + text-color: @purple; +} + +message { + padding: 5px; + border-radius: 3px; + background-color: @emphasis; + border: 1px; + border-color: @cyan; +} + +button selected { + padding: 5px; + border-radius: 3px; + background-color: @emphasis; +} \ No newline at end of file diff --git a/custom/cocktail-bar-cli/default.nix b/custom/cocktail-bar-cli/default.nix index 1aa5b11..a47aef3 100644 --- a/custom/cocktail-bar-cli/default.nix +++ b/custom/cocktail-bar-cli/default.nix @@ -1,4 +1,4 @@ -{ pkgs, stdenv, autoPatchelfHook, ... }: +{ stdenv, autoPatchelfHook, ... }: stdenv.mkDerivation rec { name = "cocktail-bar-cli"; version = "1.0"; diff --git a/custom/default.nix b/custom/default.nix index cb5f006..ce76210 100644 --- a/custom/default.nix +++ b/custom/default.nix @@ -4,10 +4,9 @@ let self = with pkgs; { - lockscreen = callPackage ./lockscreen {}; - update-background = callPackage ./update-background {}; - cocktail-bar-cli = callPackage ./cocktail-bar-cli {}; - # joystickwake = callPackage ./joystickwake {}; + lockscreen = callPackage ./lockscreen { }; + update-background = callPackage ./update-background { }; + cocktail-bar-cli = callPackage ./cocktail-bar-cli { }; }; in (self) diff --git a/custom/joystickwake/default.nix b/custom/joystickwake/default.nix deleted file mode 100644 index 514ce4a..0000000 --- a/custom/joystickwake/default.nix +++ /dev/null @@ -1,36 +0,0 @@ -{ lib, python3, fetchFromGitHub }: -python3.pkgs.buildPythonApplication rec { - pname = "joystickwake"; - version = "0.2.4"; - - src = fetchFromGitHub { - owner = "foresto"; - repo = pname; - rev = "v${version}"; - sha256 = "0j8xwfmzzmc9s88zvzc3lv67821r6x28vy6vli3srvx859wprppd"; - }; - - buildInputs = with python3.pkgs; [ - pyudev - xlib - ]; - - propagatedBuildInputs = with python3.pkgs; [ - pyudev - xlib - ]; - - doCheck = false; - - meta = with lib; { - description = "A joystick-aware screen waker"; - longDescription = '' - Linux gamers often find themselves unexpectedly staring at a blank screen, because their display server fails to recognize game controllers as input devices, allowing the screen blanker to activate during gameplay. - This program works around the problem by temporarily disabling screen blankers when joystick activity is detected. - ''; - homepage = "https://github.com/foresto/joystickwake"; - license = licenses.mit; - platforms = platforms.linux; - }; - -} diff --git a/custom/lockscreen/default.nix b/custom/lockscreen/default.nix index c9e0693..3b8e1da 100644 --- a/custom/lockscreen/default.nix +++ b/custom/lockscreen/default.nix @@ -1,18 +1,16 @@ { lib -, stdenv , rice , roboto , i3lock-color -, update-background -, writeScript +, writeScriptBin , font ? { package = roboto; name = "Roboto"; } -, palette ? rice.palette.palette {} +, palette ? rice.palette.palette { } , ... }: let - strPalette = rice.palette.toRGBAHex palette; + strPalette = lib.rice.palette.toRGBAHex palette; in -writeScript "lockscreen.sh" '' +writeScriptBin "lockscreen" '' #!/bin/sh # Using font package ${font.package} ${i3lock-color}/bin/i3lock-color \ @@ -53,6 +51,5 @@ writeScript "lockscreen.sh" '' --pass-media-keys \ --pass-screen-keys \ --pass-volume-keys \ - --nofork && - ${update-background} + --nofork '' diff --git a/custom/update-background/default.nix b/custom/update-background/default.nix index 1a74946..92d3c17 100644 --- a/custom/update-background/default.nix +++ b/custom/update-background/default.nix @@ -1,18 +1,17 @@ -{ lib -, stdenv -, feh +{ feh , glib , findutils , gnugrep , coreutils -, writeScript -, backgrounds_directory ? "$HOME/Immagini/Sfondi"}: +, writeScriptBin +, backgrounds_directory ? "$HOME/Immagini/Sfondi" +}: let find = "${findutils}/bin/find"; grep = "${gnugrep}/bin/grep"; shuf = "${coreutils}/bin/shuf"; in -writeScript "update-background.sh" '' +writeScriptBin "update-background" '' #!/bin/sh if [ $# -eq 0 ]; then image=`${find} ${backgrounds_directory} -type f | ${grep} -v "/\." | ${shuf} -n 1` @@ -22,4 +21,5 @@ writeScript "update-background.sh" '' echo "image: $image" ${feh}/bin/feh --bg-fill --no-fehbg "$image" ${glib}/bin/gsettings set org.gnome.desktop.background picture-uri "file://$image" + true '' diff --git a/environment.nix b/environment.nix deleted file mode 100644 index 112b4f8..0000000 --- a/environment.nix +++ /dev/null @@ -1,15 +0,0 @@ -values: { - enableCpp = false; - enableData = false; - enableGo = false; - enableHtml = false; - enableJava = false; - enableJavascript = false; - enableLatex = false; - enableNix = false; - enablePython = false; - enableRust = false; - enableShell = false; - enableSpelling = false; - enableOffice = true; -} // values diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..62307be --- /dev/null +++ b/flake.lock @@ -0,0 +1,298 @@ +{ + "nodes": { + "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1650374568, + "narHash": "sha256-Z+s0J8/r907g149rllvwhb4pKi8Wam5ij0st8PwAh+E=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "b4a34015c698c7793d592d66adbab377907a2be8", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-utils": { + "locked": { + "lastModified": 1656065134, + "narHash": "sha256-oc6E6ByIw3oJaIyc67maaFcnjYOz1mMcOtHxbEf9NwQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "bee6a7250dd1b01844a2de7e02e4df7d8a0a206c", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "home-manager": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1655880690, + "narHash": "sha256-pO+EqUefNFolIWV1DHXPfI8NuUtD4fd7JFKoaCjVXOs=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "a839432a5c3d2a762d68168093349097e6affb07", + "type": "github" + }, + "original": { + "owner": "nix-community", + "ref": "release-22.05", + "repo": "home-manager", + "type": "github" + } + }, + "home-manager-unstable": { + "inputs": { + "flake-compat": "flake-compat", + "nixpkgs": [ + "unstable" + ], + "nmd": "nmd", + "nmt": "nmt", + "utils": "utils" + }, + "locked": { + "lastModified": 1656199469, + "narHash": "sha256-17t4qc016C1p6oNSKOrYbOCErWhQI4dr4nzJKrGO8VE=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "1dbac84b846e4bfa21a08e31e95e11f0965ed042", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, + "nix-rice": { + "inputs": { + "flake-utils": [ + "flake-utils" + ], + "nixpkgs": "nixpkgs", + "pre-commit-hooks": "pre-commit-hooks" + }, + "locked": { + "lastModified": 1654440289, + "narHash": "sha256-Mgm0eUNDb9td3aVImg7jYq/0W0XWPJo1g6K4ONgr31U=", + "owner": "bertof", + "repo": "nix-rice", + "rev": "9faf7bdc8935577f48eb80d4625a01a024e82489", + "type": "github" + }, + "original": { + "owner": "bertof", + "repo": "nix-rice", + "type": "github" + } + }, + "nixos-hardware": { + "locked": { + "lastModified": 1656241064, + "narHash": "sha256-+jWwBt515aFGukeX8WSafg9CM3Ju3FD0XrF+X4ph0mU=", + "owner": "NixOS", + "repo": "nixos-hardware", + "rev": "99e33a57149916ebede78ec13edd9ba310c10f2f", + "type": "github" + }, + "original": { + "owner": "NixOS", + "repo": "nixos-hardware", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1653931853, + "narHash": "sha256-O3wncIouj9x7gBPntzHeK/Hkmm9M1SGlYq7JI7saTAE=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "f1c167688a6f81f4a51ab542e5f476c8c595e457", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1656219440, + "narHash": "sha256-2dhFA29f3dpw4axAKhVj8JsHQzHViG92a7AfkXLHnBY=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "4a155658a7c3a9e465c365beb0a50352efa64ca0", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "release-22.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "nmd": { + "flake": false, + "locked": { + "lastModified": 1653339422, + "narHash": "sha256-RNLq09vfj21TyYuUCeD6BNTNC6Ew8bLhQULZytN4Xx8=", + "owner": "rycee", + "repo": "nmd", + "rev": "91dee681dd1c478d6040a00835d73c0f4a4c5c29", + "type": "gitlab" + }, + "original": { + "owner": "rycee", + "repo": "nmd", + "type": "gitlab" + } + }, + "nmt": { + "flake": false, + "locked": { + "lastModified": 1648075362, + "narHash": "sha256-u36WgzoA84dMVsGXzml4wZ5ckGgfnvS0ryzo/3zn/Pc=", + "owner": "rycee", + "repo": "nmt", + "rev": "d83601002c99b78c89ea80e5e6ba21addcfe12ae", + "type": "gitlab" + }, + "original": { + "owner": "rycee", + "repo": "nmt", + "type": "gitlab" + } + }, + "pre-commit-hooks": { + "inputs": { + "flake-utils": [ + "nix-rice", + "flake-utils" + ], + "nixpkgs": [ + "nix-rice", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1652714503, + "narHash": "sha256-qQKVEfDe5FqvGgkZtg5Pc491foeiDPIOeycHMqnPDps=", + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "rev": "521a524771a8e93caddaa0ac1d67d03766a8b0b3", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "type": "github" + } + }, + "pre-commit-hooks_2": { + "inputs": { + "flake-utils": [ + "flake-utils" + ], + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1656169028, + "narHash": "sha256-y9DRauokIeVHM7d29lwT8A+0YoGUBXV3H0VErxQeA8s=", + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "rev": "db3bd555d3a3ceab208bed48f983ccaa6a71a25e", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "home-manager": "home-manager", + "home-manager-unstable": "home-manager-unstable", + "nix-rice": "nix-rice", + "nixos-hardware": "nixos-hardware", + "nixpkgs": "nixpkgs_2", + "pre-commit-hooks": "pre-commit-hooks_2", + "tex2nix": "tex2nix", + "unstable": "unstable" + } + }, + "tex2nix": { + "inputs": { + "flake-utils": [ + "flake-utils" + ], + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1646670117, + "narHash": "sha256-fU6gLOP2xm6lTRKfMKeXAm7rEhYAVR4RcRFK1zh/QTM=", + "owner": "Mic92", + "repo": "tex2nix", + "rev": "74159694f0c27ffa3f9172c6d691635568fbece4", + "type": "github" + }, + "original": { + "owner": "Mic92", + "repo": "tex2nix", + "type": "github" + } + }, + "unstable": { + "locked": { + "lastModified": 1655983783, + "narHash": "sha256-0h1FzkYWei24IdKNpCX93onkF/FMiXQG8SdEbTc0r8A=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "6141b8932a5cf376fe18fcd368cecd9ad946cb68", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "utils": { + "locked": { + "lastModified": 1653893745, + "narHash": "sha256-0jntwV3Z8//YwuOjzhV2sgJJPt+HY6KhU7VZUL0fKZQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "1ed9fb1935d260de5fe1c2f7ee0ebaae17ed2fa1", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..96a5eee --- /dev/null +++ b/flake.nix @@ -0,0 +1,177 @@ +{ + description = "Thor system configuration"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/release-22.05"; + home-manager = { url = "github:nix-community/home-manager/release-22.05"; inputs.nixpkgs.follows = "nixpkgs"; }; + + unstable.url = "github:NixOS/nixpkgs/nixos-unstable"; + home-manager-unstable = { url = "github:nix-community/home-manager"; inputs.nixpkgs.follows = "unstable"; }; + + flake-utils.url = "github:numtide/flake-utils"; + nixos-hardware.url = "github:NixOS/nixos-hardware"; + + nix-rice = { url = "github:bertof/nix-rice"; inputs.inxpkgs.follows = "unstable"; inputs.flake-utils.follows = "flake-utils"; }; + pre-commit-hooks = { url = "github:cachix/pre-commit-hooks.nix"; inputs.nixpkgs.follows = "nixpkgs"; inputs.flake-utils.follows = "flake-utils"; }; + tex2nix = { url = github:Mic92/tex2nix; inputs.nixpkgs.follows = "nixpkgs"; inputs.flake-utils.follows = "flake-utils"; }; + }; + + outputs = + { self + , nixpkgs + , home-manager + , unstable + , home-manager-unstable + , flake-utils + , nixos-hardware + , tex2nix + , nix-rice + , pre-commit-hooks + }: + let + system = "x86_64-linux"; + overlaysBuilder = system: [ + (nix-rice.overlays.default) + (import ./rice.nix) + (_: _: { inherit (tex2nix.packages.${system}) tex2nix; }) + (final: _: { + update-background = final.callPackage ./custom/update-background { backgrounds_directory = "$HOME/Immagini/Sfondi/1080+/1440+"; }; + lockscreen = final.callPackage ./custom/lockscreen { palette = final.rice.colorPalette; font = final.rice.font.normal; }; + }) + (_: _: { stable = pkgs; }) + (_: _: { unstable = unstablePkgs; }) + ]; + nixpkgsSettings = { + inherit system; + overlays = overlaysBuilder system; + config = { + extraOptions = "experimental-features = nix-command flakes"; + allowUnfree = true; + permittedInsecurePackages = [ "electron-9.4.4" ]; # authy dependency + }; + }; + pkgs = import nixpkgs nixpkgsSettings; + unstablePkgs = import unstable nixpkgsSettings; + homeManagerSettings = { home-manager = { useGlobalPkgs = true; useUserPackages = true; }; }; + + odinBaseModules = [ + { nixpkgs = nixpkgsSettings; } + ./odin/hardware-configuration.nix + nixos-hardware.nixosModules.common-cpu-intel + nixos-hardware.nixosModules.common-pc-laptop + nixos-hardware.nixosModules.common-pc-laptop-ssd + ./odin/common_configuration.nix + ]; + + thorBaseModules = [ + { nixpkgs = nixpkgsSettings; } + ./thor/hardware-configuration.nix + nixos-hardware.nixosModules.common-cpu-amd + nixos-hardware.nixosModules.common-pc-ssd + ./thor/configuration.nix + ]; + + lokiBaseModules = [ + { nixpkgs = nixpkgsSettings; } + ./loki/hardware-configuration.nix + nixos-hardware.nixosModules.common-cpu-intel + nixos-hardware.nixosModules.common-pc-ssd + ./loki/configuration.nix + ]; + + odinStable = extraModules: nixpkgs.lib.nixosSystem { + inherit system; + modules = odinBaseModules ++ [ + home-manager.nixosModules.home-manager + homeManagerSettings + { home-manager.users.bertof = import ./home_manager/odin.nix; } + ] ++ extraModules; + }; + + odinUnstable = extraModules: unstable.lib.nixosSystem { + inherit system; + modules = odinBaseModules ++ [ + home-manager-unstable.nixosModules.home-manager + homeManagerSettings + { home-manager.users.bertof = import ./home_manager/odin.nix; } + ] ++ extraModules; + }; + + thorStable = extraModules: nixpkgs.lib.nixosSystem { + inherit system; + modules = thorBaseModules ++ [ + home-manager.nixosModules.home-manager + homeManagerSettings + { home-manager.users.bertof = import ./home_manager/thor.nix; } + ] ++ extraModules; + }; + + thorUnstable = extraModules: unstable.lib.nixosSystem { + inherit system; + modules = thorBaseModules ++ [ + home-manager-unstable.nixosModules.home-manager + homeManagerSettings + { home-manager.users.bertof = import ./home_manager/thor.nix; } + ] ++ extraModules; + }; + + lokiUnstable = extraModules: unstable.lib.nixosSystem { + inherit system; + modules = lokiBaseModules ++ [ + home-manager-unstable.nixosModules.home-manager + homeManagerSettings + { home-manager.users.bertof = import ./home_manager/loki.nix; } + ] ++ extraModules; + }; + + lokiStable = extraModules: nixpkgs.lib.nixosSystem { + inherit system; + modules = lokiBaseModules ++ [ + home-manager.nixosModules.home-manager + homeManagerSettings + { home-manager.users.bertof = import ./home_manager/loki.nix; } + ] ++ extraModules; + }; + + in + { + packages.${system} = unstablePkgs; + + nixosConfigurations = rec { + + thor = thor-unstable; + thor-stable = thorStable [ ./nixos_modules/pro_audio.nix ./nixos_modules/sesar.nix ]; + thor-unstable = thorUnstable [ ./nixos_modules/pro_audio.nix ./nixos_modules/sesar.nix ]; + # thor-big-data = thorUnstable [ ./nixos_modules/pro_audio.nix ./nixos_modules/big_data.nix ./nixos_modules/sesar.nix ]; + + odin = odin-intel; + odin-intel = odin-intel-stable; + odin-nvidia = odin-nvidia-stable; + odin-intel-unstable = odinUnstable [ ./odin/configuration-intel.nix ./nixos_modules/pro_audio.nix ./nixos_modules/sesar.nix ]; + odin-nvidia-unstable = odinUnstable [ ./odin/configuration-nvidia.nix ./nixos_modules/pro_audio.nix ./nixos_modules/sesar.nix ]; + odin-intel-stable = odinStable [ ./odin/configuration-intel.nix ./nixos_modules/pro_audio.nix ./nixos_modules/sesar.nix ]; + odin-nvidia-stable = odinStable [ ./odin/configuration-nvidia.nix ./nixos_modules/pro_audio.nix ./nixos_modules/sesar.nix ]; + + loki = loki-stable; + loki-stable = lokiStable [ ]; + loki-unstable = lokiUnstable [ ]; + + }; + } // (flake-utils.lib.eachDefaultSystem (system: + let unstablePkgs = import unstable { inherit system; overlays = overlaysBuilder system; }; + in + rec { + checks = { + pre-commit-check = pre-commit-hooks.lib.${system}.run { + src = ./.; + hooks = { nixpkgs-fmt.enable = true; nix-linter.enable = true; }; + }; + }; + + devShells.default = unstablePkgs.mkShell { + shellHook = '' + ${self.checks.${system}.pre-commit-check.shellHook} + ''; + }; + })); +} diff --git a/freya.nix b/freya.nix deleted file mode 100644 index 0468e42..0000000 --- a/freya.nix +++ /dev/null @@ -1,62 +0,0 @@ -{ pkgs, lib, ... }: -{ - nixpkgs.overlays = [ - (final: prev: { - devEnvironment = (import ./environment.nix) { - # enableCpp = true; - # enableData = true; - # enableGo = true; - # enableHtml = true; - # enableJavascript = true; - # enableJava = true; - # enableLatex = true; - # enableNix = true; - # enableOffice = true; - # enablePython = true; - # enableRust = true; - # enableShell = true; - # enableSpelling = true; - }; - }) - ]; - home = { - language.base = "it_IT.UTF-8"; - keyboard = { - layout = "it"; - options = [ "terminate:ctrl_alt_bksp" "compose:rctrl" ]; - }; - packages = with pkgs; [ - htop - neofetch - nix-prefetch-scripts - ripgrep - wget - ]; - }; - imports = [ - ./modules/configurations.nix - ./modules/fonts.nix - ./modules/bash.nix - ./modules/bat.nix - ./modules/bottom.nix - ./modules/broot.nix - ./modules/dircolors.nix - ./modules/direnv.nix - ./modules/git.nix - ./modules/gpg.nix - ./modules/info.nix - ./modules/jq.nix - ./modules/kakoune.nix - ./modules/keychain.nix - ./modules/lf.nix - ./modules/man.nix - ./modules/megasync.nix - ./modules/noti.nix - ./modules/ssh.nix - ./modules/starship.nix - ./modules/tmux.nix - ./modules/zoxide.nix - ./modules/zsh.nix - ./modules/shell_aliases.nix - ]; -} diff --git a/home.nix b/home.nix deleted file mode 100644 index dbb7757..0000000 --- a/home.nix +++ /dev/null @@ -1,14 +0,0 @@ -{ pkgs, lib, ... }: -let - hostname = lib.fileContents /etc/hostname; - user = builtins.getEnv "USER"; - host_config = builtins.toPath "/home/${user}/.config/nixpkgs/${hostname}.nix"; -in -{ - nixpkgs.overlays = [ - (import ./rice.nix) - ]; - imports = [ host_config ]; - - programs.home-manager.enable = true; -} diff --git a/home_manager/basic_env.nix b/home_manager/basic_env.nix new file mode 100644 index 0000000..93e29a9 --- /dev/null +++ b/home_manager/basic_env.nix @@ -0,0 +1,46 @@ +{ pkgs, ... }: +{ + home = { + language.base = "it_IT.UTF-8"; + packages = with pkgs; [ + file + htop + mmv-go + neofetch + nixos-option + nix-tree + unrar + unzip + wget + xclip + yq + zip + ]; + }; + + imports = [ + ./modules/configurations.nix + + ./modules/bash.nix + ./modules/bat.nix + ./modules/bottom.nix + ./modules/broot.nix + ./modules/dircolors.nix + ./modules/direnv.nix + ./modules/fonts.nix + ./modules/fzf.nix + ./modules/git.nix + ./modules/gpg.nix + ./modules/info.nix + ./modules/jq.nix + ./modules/keychain.nix + ./modules/lf.nix + ./modules/man.nix + ./modules/shell_aliases.nix + ./modules/ssh.nix + ./modules/starship.nix + ./modules/tmux.nix + ./modules/zoxide.nix + ./modules/zsh.nix + ]; +} diff --git a/loki.nix b/home_manager/loki.nix similarity index 96% rename from loki.nix rename to home_manager/loki.nix index c0b3618..806235d 100644 --- a/loki.nix +++ b/home_manager/loki.nix @@ -1,7 +1,7 @@ -{ pkgs, lib, ... }: +{ pkgs, ... }: { nixpkgs.overlays = [ - (final: prev: { + (_: _: { devEnvironment = (import ./environment.nix) { # enableCpp = true; enableData = true; @@ -47,6 +47,7 @@ ./modules/direnv.nix ./modules/git.nix ./modules/gpg.nix + ./modules/helix.nix ./modules/info.nix ./modules/jq.nix ./modules/kakoune.nix diff --git a/modules/alacritty.nix b/home_manager/modules/alacritty.nix similarity index 93% rename from modules/alacritty.nix rename to home_manager/modules/alacritty.nix index 2f8b250..ff027e9 100644 --- a/modules/alacritty.nix +++ b/home_manager/modules/alacritty.nix @@ -1,6 +1,6 @@ -{ pkgs, lib, ... }: +{ pkgs, ... }: let - strPalette = with pkgs.rice; palette.toRgbHex rec { + strPalette = with pkgs.rice; pkgs.lib.rice.palette.toRgbHex rec { inherit (colorPalette) normal bright; dim = colorPalette.dark; diff --git a/home_manager/modules/autorandr.nix b/home_manager/modules/autorandr.nix new file mode 100644 index 0000000..660946b --- /dev/null +++ b/home_manager/modules/autorandr.nix @@ -0,0 +1,33 @@ +{ + programs.autorandr = { + enable = true; + profiles = { + odin-intel = { + fingerprint = { "eDP1" = "00ffffffffffff0030e43f0500000000001a010495221378eaa1c59459578f27205054000000010101010101010101010101010101012e3680a070381f403020350058c21000001a5c2b80a070381f403020350058c21000001a000000fe0034584b3133803135365746360a000000000000413196001000000a010a202000c5"; }; + config = { + "eDP1" = { primary = true; crtc = 0; mode = "1920x1080"; dpi = 96; }; + }; + }; + odin-intel-laboratorio = { + fingerprint = { + "DP1-3" = "00ffffffffffff0010ac71404c473344281601030e331d78eadd45a3554fa027125054a54b00714f8180d1c001010101010101010101023a801871382d40582c4500fe1f1100001e000000ff004b463837593241364433474c0a000000fc0044454c4c205532333132484d0a000000fd00384c1e5311000a2020202020200081"; + "eDP1" = "00ffffffffffff0030e43f0500000000001a010495221378eaa1c59459578f27205054000000010101010101010101010101010101012e3680a070381f403020350058c21000001a5c2b80a070381f403020350058c21000001a000000fe0034584b3133803135365746360a000000000000413196001000000a010a202000c5"; + }; + config = { + "DP1-3" = { primary = true; crtc = 1; mode = "1920x1080"; position = "0x0"; }; + "eDP1" = { crtc = 0; mode = "1920x1080"; position = "0x1080"; dpi = 96; }; + }; + }; + thor-two-screens = { + fingerprint = { + "DP-4" = "00ffffffffffff001e6d7f5ba1c60a00011f0104b53c22789f8cb5af4f43ab260e5054254b007140818081c0a9c0b300d1c08100d1cf09ec00a0a0a0675030203a0055502100001a000000fd0030901ee63c000a202020202020000000fc004c4720554c545241474541520a000000ff003130314e5454514c533230390a017102031a7123090607e305c000e606050160592846100403011f136fc200a0a0a0555030203a0055502100001a565e00a0a0a029503020350055502100001a5aa000a0a0a0465030203a005550210000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000da"; + "HDMI-0" = "00ffffffffffff004c2d2c0d443650302e19010380341d782a5295a556549d250e5054bb8c00b30081c0810081809500a9c001010101023a801871382d40582c450009252100001e000000fd0030481e5216000a202020202020000000fc00433234463339300a2020202020000000ff00485451483330353636370a20200163020324f14690041f131203230907078301000067030c001000802b681a00000101304800011d00bc52d01e20b828554009252100001e8c0ad090204031200c4055000925210000188c0ad08a20e02d10103e9600092521000018215280a07238304088c8350009252100001c00000000000000000000000000000000000000fa"; + }; + config = { + "DP-4" = { primary = true; crtc = 0; mode = "2560x1440"; position = "1080x162"; }; + "HDMI-0" = { crtc = 1; mode = "1920x1080"; position = "0x0"; rotate = "right"; }; + }; + }; + }; + }; +} diff --git a/modules/bash.nix b/home_manager/modules/bash.nix similarity index 100% rename from modules/bash.nix rename to home_manager/modules/bash.nix diff --git a/modules/bat.nix b/home_manager/modules/bat.nix similarity index 100% rename from modules/bat.nix rename to home_manager/modules/bat.nix diff --git a/home_manager/modules/bottom.nix b/home_manager/modules/bottom.nix new file mode 100644 index 0000000..d83d4c5 --- /dev/null +++ b/home_manager/modules/bottom.nix @@ -0,0 +1,13 @@ +{ pkgs, ... }: +let + tomlGenerate = (pkgs.formats.toml { }).generate "bottom-toml"; +in +{ + home.packages = with pkgs; [ bottom ]; + xdg.configFile."bottom/bottom.toml".source = tomlGenerate { + "flags" = { + "left_legend" = true; + "color" = "nord"; + }; + }; +} diff --git a/modules/nix-index.nix b/home_manager/modules/broot.nix similarity index 79% rename from modules/nix-index.nix rename to home_manager/modules/broot.nix index c38d223..93b6086 100644 --- a/modules/nix-index.nix +++ b/home_manager/modules/broot.nix @@ -1,5 +1,5 @@ { - programs.nix-index = { + programs.broot = { enable = true; enableBashIntegration = true; enableZshIntegration = true; diff --git a/home_manager/modules/bspwm.nix b/home_manager/modules/bspwm.nix new file mode 100644 index 0000000..cb6467a --- /dev/null +++ b/home_manager/modules/bspwm.nix @@ -0,0 +1,48 @@ +{ pkgs, lib, ... }: + +let + monitorPages = [ "I" "II" "III" "IV" "V" "VI" "VII" "VIII" "IX" "X" ]; + monitorPagesString = lib.strings.concatStringsSep " " monitorPages; + strPalette = pkgs.lib.rice.palette.toRGBHex pkgs.rice.colorPalette; + xrandr = "${pkgs.xorg.xrandr}/bin/xrandr"; + xsetroot = "${pkgs.xorg.xsetroot}/bin/xsetroot"; +in +{ + xsession.windowManager.bspwm = { + enable = true; + settings = { + border_width = 2; + border_radius = 8; + window_gap = 4; + split_ratio = 0.5; + top_padding = 0; + borderless_monocle = true; + gapless_monocle = false; + normal_border_color = strPalette.normal.blue; + focused_border_color = strPalette.bright.blue; + }; + # monitors = builtins.foldl' (acc: monitor: acc // { ${monitor} = monitorPages; }) { } monitors; + rules = { + "*" = { follow = true; }; + "Zathura" = { state = "tiled"; }; + }; + extraConfig = '' + for monitor in $(${xrandr} --listactivemonitors | cut -d " " -f 6); do + bspc monitor $monitor -d ${monitorPagesString} + done + + autorandr -c + ${xsetroot} -solid black -cursor_name left_ptr + + systemctl --user restart \ + polybar.service \ + update-background.service + ''; + startupPrograms = [ ]; + }; + services = { + network-manager-applet.enable = true; + blueman-applet.enable = true; + }; + home.packages = with pkgs; [ blueman ]; +} diff --git a/modules/configurations.nix b/home_manager/modules/configurations.nix similarity index 100% rename from modules/configurations.nix rename to home_manager/modules/configurations.nix diff --git a/home_manager/modules/cpp.nix b/home_manager/modules/cpp.nix new file mode 100644 index 0000000..08fa37c --- /dev/null +++ b/home_manager/modules/cpp.nix @@ -0,0 +1,6 @@ +{ pkgs, ... }: +{ + home.packages = with pkgs; [ + clang-tools + ]; +} diff --git a/home_manager/modules/dircolors.nix b/home_manager/modules/dircolors.nix new file mode 100644 index 0000000..6d231c1 --- /dev/null +++ b/home_manager/modules/dircolors.nix @@ -0,0 +1,7 @@ +{ + programs.dircolors = { + enable = true; + enableBashIntegration = true; + enableZshIntegration = true; + }; +} diff --git a/modules/direnv.nix b/home_manager/modules/direnv.nix similarity index 100% rename from modules/direnv.nix rename to home_manager/modules/direnv.nix diff --git a/modules/dunst.nix b/home_manager/modules/dunst.nix similarity index 89% rename from modules/dunst.nix rename to home_manager/modules/dunst.nix index 23c8371..38ba672 100644 --- a/modules/dunst.nix +++ b/home_manager/modules/dunst.nix @@ -1,9 +1,6 @@ { pkgs, ... }: let - rofi_dmenu = "${pkgs.rofi} -dmenu"; - firefox = "${pkgs.firefox}/bin/firefox"; - dmenu = "${pkgs.dmenu}/bin/dmenu"; - palette = pkgs.rice.palette.toRGBHex pkgs.rice.colorPalette; + palette = pkgs.lib.rice.palette.toRGBHex pkgs.rice.colorPalette; in { home.packages = with pkgs; [ dunst rice.font.normal.package ]; @@ -47,8 +44,8 @@ in max_icon_size = 32; sticky_history = "yes"; history_length = 20; - dmenu = "${dmenu} -p dunst:"; - browser = "${firefox} -new-tab"; + dmenu = "dmenu -p dunst:"; + browser = "google-chrome-stable"; always_run_script = "true"; title = "Dunst"; class = "Dunst"; diff --git a/home_manager/modules/easyeffects.nix b/home_manager/modules/easyeffects.nix new file mode 100644 index 0000000..6a94385 --- /dev/null +++ b/home_manager/modules/easyeffects.nix @@ -0,0 +1,3 @@ +{ + services.easyeffects.enable = true; +} diff --git a/modules/fonts.nix b/home_manager/modules/fonts.nix similarity index 70% rename from modules/fonts.nix rename to home_manager/modules/fonts.nix index 9e7e5e8..c85dac8 100644 --- a/modules/fonts.nix +++ b/home_manager/modules/fonts.nix @@ -7,7 +7,9 @@ dejavu_fonts noto-fonts noto-fonts-extra - noto-fonts-cjk + noto-fonts-cjk-sans font-awesome + corefonts # Microsoft fonts + vistafonts ]; } diff --git a/home_manager/modules/fzf.nix b/home_manager/modules/fzf.nix new file mode 100644 index 0000000..a421031 --- /dev/null +++ b/home_manager/modules/fzf.nix @@ -0,0 +1,8 @@ +{ + programs.fzf = { + enable = true; + tmux.enableShellIntegration = true; + enableBashIntegration = true; + enableZshIntegration = true; + }; +} diff --git a/modules/git.nix b/home_manager/modules/git.nix similarity index 94% rename from modules/git.nix rename to home_manager/modules/git.nix index 82f0ceb..c65db70 100644 --- a/modules/git.nix +++ b/home_manager/modules/git.nix @@ -1,7 +1,5 @@ -{ config, pkgs, lib, ... }: +{ pkgs, ... }: let - kak = "${pkgs.kakoune}/bin/kak"; - meld = "${pkgs.meld}/bin/meld"; shellAliases = { "g" = "git"; "ga" = "git add"; @@ -99,11 +97,13 @@ in # }; extraConfig = { commit.gpgSign = true; - core.editor = kak; - credential.helper = "cache --timeout = 3600 "; - diff.guitool = meld; + # core.editor = kak; + credential.helper = "cache --timeout=3600 "; + delta.navigate = true; + diff.guitool = "meld"; init.defaultBranch = "main"; - merge.guitool = meld; + merge.guitool = "meld"; + merge.tool = "meld"; pull.rebase = true; rebase.autoStash = true; user.signingKey = "berto.f@protonmail.com"; @@ -117,5 +117,6 @@ in gh git-secret glab + meld ]; } diff --git a/home_manager/modules/go.nix b/home_manager/modules/go.nix new file mode 100644 index 0000000..9f7fe72 --- /dev/null +++ b/home_manager/modules/go.nix @@ -0,0 +1,9 @@ +{ pkgs, ... }: { + programs.go = { + enable = true; + }; + + home.packages = with pkgs; [ + gopls + ]; +} diff --git a/home_manager/modules/gpg.nix b/home_manager/modules/gpg.nix new file mode 100644 index 0000000..2a09965 --- /dev/null +++ b/home_manager/modules/gpg.nix @@ -0,0 +1,12 @@ +{ + programs.gpg = { + enable = true; + settings = { }; + }; + + services.gpg-agent = { + enable = true; + defaultCacheTtl = 600; + # extraConfig = "allow-loopback-pinentry"; + }; +} diff --git a/modules/grobi.nix b/home_manager/modules/grobi.nix similarity index 94% rename from modules/grobi.nix rename to home_manager/modules/grobi.nix index 14d1121..48f77b3 100644 --- a/modules/grobi.nix +++ b/home_manager/modules/grobi.nix @@ -1,4 +1,3 @@ -{ config, lib, pkgs, ... }: { services.grobi = { enable = true; diff --git a/modules/gtk_theme.nix b/home_manager/modules/gtk_theme.nix similarity index 83% rename from modules/gtk_theme.nix rename to home_manager/modules/gtk_theme.nix index 63a607d..9cd79c2 100644 --- a/modules/gtk_theme.nix +++ b/home_manager/modules/gtk_theme.nix @@ -18,11 +18,13 @@ platformTheme = "gtk"; }; - xsession = { + home = { pointerCursor = { package = pkgs.qogir-icon-theme; name = "Qogir"; - size = 24; + # size = 64; + # x11.enable = true; + gtk.enable = true; }; }; } diff --git a/home_manager/modules/helix.nix b/home_manager/modules/helix.nix new file mode 100644 index 0000000..46577b1 --- /dev/null +++ b/home_manager/modules/helix.nix @@ -0,0 +1,86 @@ +{ pkgs, ... }: +{ + programs.bash.shellAliases = { x = "hx"; }; + programs.zsh.shellAliases = { x = "hx"; }; + home.sessionVariables = { EDITOR = "hx"; VISUAL = "hx"; }; + home.packages = [ + (pkgs.makeDesktopItem + { + name = "helix"; + exec = "hx %F"; + icon = "helix"; + desktopName = "Helix"; + comment = "Helix text editor"; + terminal = true; + categories = [ "Development" ]; + }) + ]; + programs.helix = { + enable = true; + package = pkgs.unstable.helix; + languages = [ ]; + settings = { + theme = "monokai_pro_octagon"; + editor.lsp.display-messages = true; + editor.scrolloff = 5; + editor.true-color = true; + }; + themes = + let + transparent = "none"; + gray = "#665c54"; + dark-gray = "#3c3836"; + white = "#fbf1c7"; + black = "#282828"; + red = "#fb4934"; + green = "#b8bb26"; + yellow = "#fabd2f"; + orange = "#fe8019"; + blue = "#83a598"; + magenta = "#d3869b"; + cyan = "#8ec07c"; + in + { + base16 = { + "ui.menu" = transparent; + "ui.menu.selected" = { modifiers = [ "reversed" ]; }; + "ui.linenr" = { fg = gray; bg = dark-gray; }; + "ui.popup" = { modifiers = [ "reversed" ]; }; + "ui.linenr.selected" = { fg = white; bg = black; modifiers = [ "bold" ]; }; + "ui.selection" = { fg = black; bg = blue; }; + "ui.selection.primary" = { modifiers = [ "reversed" ]; }; + "comment" = { fg = gray; }; + "ui.statusline" = { fg = white; bg = dark-gray; }; + "ui.statusline.inactive" = { fg = dark-gray; bg = white; }; + "ui.help" = { fg = dark-gray; bg = white; }; + "ui.cursor" = { modifiers = [ "reversed" ]; }; + "variable" = red; + "variable.builtin" = orange; + "constant.numeric" = orange; + "constant" = orange; + "attributes" = yellow; + "type" = yellow; + "ui.cursor.match" = { fg = yellow; modifiers = [ "underlined" ]; }; + "string" = green; + "variable.other.member" = red; + "constant.character.escape" = cyan; + "function" = blue; + "constructor" = blue; + "special" = blue; + "keyword" = magenta; + "label" = magenta; + "namespace" = blue; + "diff.plus" = green; + "diff.delta" = yellow; + "diff.minus" = red; + "diagnostic" = { modifiers = [ "underlined" ]; }; + "ui.gutter" = { bg = black; }; + "info" = blue; + "hint" = dark-gray; + "debug" = dark-gray; + "warning" = yellow; + "error" = red; + }; + }; + }; +} diff --git a/modules/info.nix b/home_manager/modules/info.nix similarity index 100% rename from modules/info.nix rename to home_manager/modules/info.nix diff --git a/home_manager/modules/java.nix b/home_manager/modules/java.nix new file mode 100644 index 0000000..5910761 --- /dev/null +++ b/home_manager/modules/java.nix @@ -0,0 +1,3 @@ +{ + programs.java.enable = true; +} diff --git a/home_manager/modules/javascript.nix b/home_manager/modules/javascript.nix new file mode 100644 index 0000000..80e714a --- /dev/null +++ b/home_manager/modules/javascript.nix @@ -0,0 +1,7 @@ +{ pkgs, ... }: +{ + home.packages = with pkgs; [ + flow + ]; +} + diff --git a/modules/joystickwake.nix b/home_manager/modules/joystickwake.nix similarity index 95% rename from modules/joystickwake.nix rename to home_manager/modules/joystickwake.nix index 25f0aaf..5cc1113 100644 --- a/modules/joystickwake.nix +++ b/home_manager/modules/joystickwake.nix @@ -1,4 +1,4 @@ -{ pkgs, config, ... }: +{ pkgs, ... }: let joystickwakeCmd = "${pkgs.joystickwake}/bin/joystickwake"; in diff --git a/modules/jq.nix b/home_manager/modules/jq.nix similarity index 100% rename from modules/jq.nix rename to home_manager/modules/jq.nix diff --git a/home_manager/modules/kakoune.nix b/home_manager/modules/kakoune.nix new file mode 100644 index 0000000..12df5ab --- /dev/null +++ b/home_manager/modules/kakoune.nix @@ -0,0 +1,256 @@ +{ pkgs, ... }: +let + themeBuilder = palette: with palette; '' + set-face global value rgb:${normal.magenta},default + set-face global type rgb:${bright.white},default + set-face global identifier rgb:${normal.cyan},default + set-face global string rgb:${normal.green},default + set-face global error rgb:${normal.red},default + set-face global keyword rgb:${normal.blue},default + set-face global operator rgb:${normal.blue},default + set-face global attribute rgb:${bright.blue},default + set-face global comment rgb:${bright.blue},default + set-face global meta rgb:${normal.yellow},default + set-face global Default rgb:${normal.white},default + set-face global PrimarySelection rgb:${normal.black},rgb:${dark.yellow} + set-face global SecondarySelection rgb:${normal.black},rgb:${dark.white} + set-face global PrimaryCursor rgb:${normal.black},rgb:${normal.yellow} + set-face global SecondaryCursor rgb:${normal.black},rgb:${normal.white} + set-face global MenuForeground rgb:${normal.white},rgb:${bright.black} + set-face global MenuBackground default,rgb:${normal.black} + set-face global MenuInfo default,rgb:${normal.black} + set-face global Information rgb:${dark.black},rgb:${normal.cyan} + set-face global StatusLine rgb:${normal.white},rgb:${normal.black} + set-face global StatusLineMode rgb:${normal.blue},rgb:${normal.black} + set-face global StatusLineInfo rgb:${normal.blue},rgb:${normal.black} + set-face global StatusLineValue rgb:${normal.blue},rgb:${normal.black} + set-face global StatusCursor rgb:${dark.black},rgb:${normal.yellow} + set-face global Prompt rgb:${normal.cyan},rgb:${normal.black} + set-face global BufferPadding default,default + ''; + + packages = with pkgs; [ + yaml-language-server + nodePackages.vscode-langservers-extracted + rnix-lsp + editorconfig-core-c + aspell + aspellDicts.en + aspellDicts.en-computers + aspellDicts.en-science + aspellDicts.it + + (pkgs.makeDesktopItem + { + name = "kakoune"; + exec = "kak %F"; + icon = "kakoune"; + desktopName = "Kakoune"; + comment = "Kakoune text editor"; + terminal = true; + categories = [ "Development" ]; + }) + ]; + +in +{ + programs.bash.shellAliases = { k = "kak"; }; + programs.zsh.shellAliases = { k = "kak"; }; + home.packages = packages; + programs.kakoune = { + enable = true; + config = { + colorScheme = "nord"; + tabStop = 2; + indentWidth = 2; + alignWithTabs = true; + scrollOff = { lines = 5; columns = 3; }; + ui = { setTitle = true; changeColors = true; enableMouse = true; }; + wrapLines = { enable = true; word = true; }; + numberLines = { enable = true; highlightCursor = true; }; + keyMappings = [ + { mode = "normal"; docstring = "Edit file"; key = ""; effect = ":edit"; } + { mode = "user"; docstring = "Code actions"; key = "a"; effect = ":lsp-code-actions"; } + { mode = "user"; docstring = "Comment block"; key = "b"; effect = ":comment-block"; } + { mode = "user"; docstring = "Comment line"; key = "l"; effect = ":comment-line"; } + { mode = "user"; docstring = "Copy to clipboard"; key = "y"; effect = "${pkgs.xclip}/bin/xclip -i -selection clipboard"; } + { mode = "user"; docstring = "Format code with formatter"; key = "f"; effect = ":format"; } + { mode = "user"; docstring = "Format code with LSP"; key = "F"; effect = ":lsp-formatting-sync"; } + { mode = "user"; docstring = "Jump to definition"; key = "d"; effect = ":lsp-definition"; } + { mode = "user"; docstring = "Rename object"; key = "r"; effect = ":lsp-rename-prompt"; } + { mode = "user"; docstring = "Jump to type definition"; key = "t"; effect = ":lsp-type-definition"; } + { mode = "user"; docstring = "List project diagnostics"; key = "i"; effect = ":lsp-diagnostics"; } + { mode = "user"; docstring = "Paste from clipboard (after)"; key = "P"; effect = "${pkgs.xclip}/bin/xclip -selection clipboard -o"; } + { mode = "user"; docstring = "Paste from clipboard (before)"; key = "p"; effect = "!${pkgs.xclip}/bin/xclip -selection clipboard -o"; } + { mode = "user"; docstring = "Show hover info"; key = "q"; effect = ":lsp-hover"; } + { mode = "user"; docstring = "Spellcheck English"; key = "S"; effect = ":spell en"; } + { mode = "user"; docstring = "Spellcheck"; key = "s"; effect = ":spell "; } + { mode = "normal"; docstring = "Try next snippet placeholder"; key = ""; effect = ": insert-c-n"; } + # { mode = "normal"; docstring = "Search"; key = "/"; effect = "/(?i)"; } + # { mode = "normal"; docstring = "Reverse search"; key = ""; effect = "(?i)"; } + ]; + hooks = with pkgs; [ + { name = "BufCreate"; option = ".*"; commands = "editorconfig-load"; } + # { name = "ModuleLoaded"; option = "auto-pairs"; commands = "auto-pairs-enable"; } + { name = "ModuleLoaded"; option = "powerline"; commands = "powerline-enable; powerline-start"; } + { name = "BufSetOption"; option = "filetype=latex"; commands = "set-option buffer formatcmd latexindent"; } + { name = "BufSetOption"; option = "filetype=python"; commands = "set-option buffer formatcmd 'black -'"; } + { name = "BufSetOption"; option = "filetype=(markdown|html|json|yaml|css|scss|less)"; commands = "set-option buffer formatcmd prettier"; } + { name = "BufSetOption"; option = "filetype=rust"; commands = "set-option buffer formatcmd 'rustfmt'"; } + { name = "BufSetOption"; option = "filetype=sh"; commands = "set-option buffer formatcmd 'rustfmt'"; } + ]; + # TODO add more formatters from https://github.com/mawww/kakoune/wiki/Format + }; + extraConfig = builtins.concatStringsSep "\n" [ + "# Custom commands" + "add-highlighter global/ regex \\h+$ 0:Error # Highlight trailing spaces" + "eval %sh{kak-lsp --kakoune -s $kak_session}" + "lsp-enable" + '' + def -hidden insert-c-n %{ + try %{ + lsp-snippets-select-next-placeholders + exec 'd' + } catch %{ + exec -with-hooks '' + } + } + '' + "require-module powerline" + "require-module connect-broot" + "require-module connect-lf" + "require-module connect-rofi" + ]; + plugins = with pkgs.kakounePlugins; [ + prelude-kak + kak-lsp + auto-pairs-kak + powerline-kak + connect-kak + ]; + }; + + # THEME FILE + xdg.configFile."kak/colors/nord.kak".text = themeBuilder (pkgs.lib.rice.palette.toRgbShortHex pkgs.rice.colorPalette); + + xdg.configFile."kak-lsp/kak-lsp.toml".text = '' + snippet_support = false + verbosity = 2 + [server] + timeout = 1800 # seconds = 30 minutes + + [language.c_cpp] + filetypes = ["c", "cpp"] + roots = ["compile_commands.json", ".clangd"] + command = "clangd" + offset_encoding = "utf-8" + + [language.json] + filetypes = ["json"] + roots = ["package.json"] + command = "vscode-json-language-server" + args = ["--stdio"] + + [language.yaml] + filetypes = ["yaml"] + roots = [".git"] + command = "yaml-language-server" + args = ["--stdio"] + + [language.yaml.settings] + # See https://github.com/redhat-developer/yaml-language-server#language-server-settings + # Defaults are at https://github.com/redhat-developer/yaml-language-server/blob/master/src/yamlSettings.ts + yaml.format.enable = true + + [language.go] + filetypes = ["go"] + roots = ["Gopkg.toml", "go.mod", ".git", ".hg"] + command = "gopls" + offset_encoding = "utf-8" + settings_section = "gopls" + + [language.go.settings.gopls] + # See https://github.com/golang/tools/blob/master/gopls/doc/settings.md + # "build.buildFlags" = [] + + [language.html] + filetypes = ["html"] + roots = ["package.json"] + command = "vscode-html-language-server" + args = ["--stdio"] + + [language.css] + filetypes = ["css"] + roots = ["package.json", ".git"] + command = "vscode-css-language-server" + args = ["--stdio"] + + [language.less] + filetypes = ["less"] + roots = ["package.json", ".git"] + command = "vscode-css-language-server" + args = ["--stdio"] + + [language.scss] + filetypes = ["scss"] + roots = ["package.json", ".git"] + command = "vscode-css-language-server" + args = ["--stdio"] + + [language.javascript] + filetypes = ["javascript"] + roots = [".flowconfig"] + command = "flow" + args = ["lsp"] + + [language.latex] + filetypes = ["latex"] + roots = [".git"] + command = "texlab" + settings_section = "texlab" + + [language.latex.settings.texlab] + # See https://github.com/latex-lsp/texlab/blob/master/src/options.rs + # bibtexFormatter = "texlab" + + [language.nix] + filetypes = ["nix"] + roots = ["flake.nix", "shell.nix", ".git"] + command = "rnix-lsp" + + [language.python] + filetypes = ["python"] + roots = ["requirements.txt", "setup.py", ".git", ".hg"] + command = "pylsp" + offset_encoding = "utf-8" + + [language.python.settings] + # See https://github.com/palantir/python-language-server#configuration + # and https://github.com/palantir/python-language-server/blob/develop/vscode-client/package.json + # "pyls.configurationSources" = ["flake8"] + + [language.rust] + filetypes = ["rust"] + roots = ["Cargo.toml"] + command = "rust-analyzer" + settings_section = "rust-analyzer" + + [language.rust.settings.rust-analyzer] + hoverActions.enable = false # kak-lsp doesn't support this at the moment + # cargo.features = [] + # See https://rust-analyzer.github.io/manual.html#configuration + # If you get 'unresolved proc macro' warnings, you have two options + # 1. The safe choice is two disable the warning: + diagnostics.disabled = ["unresolved-proc-macro"] + # 2. Or you can opt-in for proc macro support + procMacro.enable = true + cargo.loadOutDirsFromCheck = true + # See https://github.com/rust-analyzer/rust-analyzer/issues/6448 + + [language.bash] + filetypes = ["sh"] + roots = [".git", ".hg"] + command = "bash-language-server" + args = ["start"] + ''; +} diff --git a/modules/keepassxc.nix b/home_manager/modules/keepassxc.nix similarity index 93% rename from modules/keepassxc.nix rename to home_manager/modules/keepassxc.nix index 7d2f75b..f1effce 100644 --- a/modules/keepassxc.nix +++ b/home_manager/modules/keepassxc.nix @@ -1,4 +1,4 @@ -{ config, pkgs, ... }: +{ pkgs, ... }: { config.systemd.user.services.keepassxc = { Unit = { diff --git a/modules/keychain.nix b/home_manager/modules/keychain.nix similarity index 100% rename from modules/keychain.nix rename to home_manager/modules/keychain.nix diff --git a/modules/kitty.nix b/home_manager/modules/kitty.nix similarity index 88% rename from modules/kitty.nix rename to home_manager/modules/kitty.nix index a26e960..e0fa498 100644 --- a/modules/kitty.nix +++ b/home_manager/modules/kitty.nix @@ -1,5 +1,5 @@ -{ pkgs, lib, ... }: -let strPalette = with pkgs.rice; palette.toRgbHex rec { +{ pkgs, ... }: +let strPalette = with pkgs.rice; pkgs.lib.rice.palette.toRgbHex rec { foreground = colorPalette.normal.white; background = colorPalette.normal.black; color0 = colorPalette.normal.black; @@ -23,6 +23,7 @@ in { programs.kitty = { enable = true; + package = pkgs.unstable.kitty; settings = { scrollback_lines = 10000; enable_audio_bell = false; @@ -37,6 +38,7 @@ in keybindings = { "ctrl+shift+t" = "new_tab_with_cwd"; "ctrl+shift+enter" = "new_window_with_cwd"; + "ctrl+shift+n" = "new_os_window_with_cwd"; }; font = pkgs.rice.font.monospace; }; diff --git a/home_manager/modules/latex.nix b/home_manager/modules/latex.nix new file mode 100644 index 0000000..96e61ef --- /dev/null +++ b/home_manager/modules/latex.nix @@ -0,0 +1,9 @@ +{ pkgs, ... }: +{ + home.packages = with pkgs; [ + bibtool + tex2nix + texlab + texlive.combined.scheme-medium + ]; +} diff --git a/modules/lf.nix b/home_manager/modules/lf.nix similarity index 100% rename from modules/lf.nix rename to home_manager/modules/lf.nix diff --git a/modules/libinput-gestures.nix b/home_manager/modules/libinput-gestures.nix similarity index 96% rename from modules/libinput-gestures.nix rename to home_manager/modules/libinput-gestures.nix index 4a6f522..c578c63 100644 --- a/modules/libinput-gestures.nix +++ b/home_manager/modules/libinput-gestures.nix @@ -1,4 +1,4 @@ -{ pkgs, config, ... }: +{ pkgs, ... }: let libinputGesturesCmd = "${pkgs.libinput-gestures}/bin/libinput-gestures"; xdotool = "${pkgs.xdotool}/bin/xdotool"; diff --git a/modules/lorri.nix b/home_manager/modules/lorri.nix similarity index 100% rename from modules/lorri.nix rename to home_manager/modules/lorri.nix diff --git a/modules/man.nix b/home_manager/modules/man.nix similarity index 61% rename from modules/man.nix rename to home_manager/modules/man.nix index 801cf1e..a2507e6 100644 --- a/modules/man.nix +++ b/home_manager/modules/man.nix @@ -1,6 +1,6 @@ { programs.man = { enable = true; - generateCaches = true; + # generateCaches = true; }; } diff --git a/modules/mangohud.nix b/home_manager/modules/mangohud.nix similarity index 58% rename from modules/mangohud.nix rename to home_manager/modules/mangohud.nix index 6b6c175..cde1857 100644 --- a/modules/mangohud.nix +++ b/home_manager/modules/mangohud.nix @@ -1,7 +1,9 @@ -{ ... }: { programs.mangohud = { enable = true; enableSessionWide = true; + settings = { + toggle_hud = "Shift_R+F12"; + }; }; } diff --git a/modules/megasync.nix b/home_manager/modules/megasync.nix similarity index 94% rename from modules/megasync.nix rename to home_manager/modules/megasync.nix index 239e93a..363d9d9 100644 --- a/modules/megasync.nix +++ b/home_manager/modules/megasync.nix @@ -1,4 +1,4 @@ -{ pkgs, config, ... }: +{ pkgs, ... }: let megasyncCmd = "${pkgs.megacmd}/bin/mega-cmd-server"; in diff --git a/home_manager/modules/nautilus.nix b/home_manager/modules/nautilus.nix new file mode 100644 index 0000000..a6f4e75 --- /dev/null +++ b/home_manager/modules/nautilus.nix @@ -0,0 +1,4 @@ +{ pkgs, ... }: +{ + home.packages = with pkgs; [ gnome.nautilus ]; +} diff --git a/home_manager/modules/nix-index.nix b/home_manager/modules/nix-index.nix new file mode 100644 index 0000000..975c5ac --- /dev/null +++ b/home_manager/modules/nix-index.nix @@ -0,0 +1,27 @@ +{ pkgs, ... }: +{ + programs.nix-index = { + enable = true; + enableBashIntegration = true; + enableZshIntegration = true; + }; + + systemd.user = { + services."nix-index" = { + Unit = { + Description = "Update the nix-locate database"; + After = [ "network.target" ]; + }; + Service = { + Type = "oneshot"; + ExecStart = "${pkgs.nix-index}/bin/nix-index"; + }; + }; + + timers."nix-index" = { + Unit.Description = "Daily update the nix-locate database"; + Timer = { OnCalendar = "daily"; Persistent = true; Unit = "nix-index.service"; }; + Install.WantedBy = [ "timers.target" ]; + }; + }; +} diff --git a/modules/noti.nix b/home_manager/modules/noti.nix similarity index 100% rename from modules/noti.nix rename to home_manager/modules/noti.nix diff --git a/modules/obs-studio.nix b/home_manager/modules/obs-studio.nix similarity index 100% rename from modules/obs-studio.nix rename to home_manager/modules/obs-studio.nix diff --git a/home_manager/modules/office.nix b/home_manager/modules/office.nix new file mode 100644 index 0000000..7813c0a --- /dev/null +++ b/home_manager/modules/office.nix @@ -0,0 +1,11 @@ +{ pkgs, ... }: +{ + home.packages = with pkgs; [ + # libreoffice-fresh + onlyoffice-bin + hunspellDicts.en_GB-large + hunspellDicts.en_US-large + hunspellDicts.it_IT + hunspell.bin + ]; +} diff --git a/modules/onedrive.nix b/home_manager/modules/onedrive.nix similarity index 100% rename from modules/onedrive.nix rename to home_manager/modules/onedrive.nix diff --git a/home_manager/modules/pass.nix b/home_manager/modules/pass.nix new file mode 100644 index 0000000..23de304 --- /dev/null +++ b/home_manager/modules/pass.nix @@ -0,0 +1,5 @@ +{ + programs.password-store = { + enable = true; + }; +} diff --git a/modules/picom.nix b/home_manager/modules/picom.nix similarity index 95% rename from modules/picom.nix rename to home_manager/modules/picom.nix index 2e613ce..89f6265 100644 --- a/modules/picom.nix +++ b/home_manager/modules/picom.nix @@ -1,4 +1,3 @@ -{ pkgs, ... }: { services.picom = { enable = true; diff --git a/modules/polybar.nix b/home_manager/modules/polybar.nix similarity index 60% rename from modules/polybar.nix rename to home_manager/modules/polybar.nix index 2a072b8..e9cfe67 100644 --- a/modules/polybar.nix +++ b/home_manager/modules/polybar.nix @@ -1,5 +1,7 @@ -{ config, lib, pkgs, ... }: +{ config, pkgs, lib, ... }: +with lib; let + inherit (pkgs.rice) colorPalette opacity; grep = "${pkgs.gnugrep}/bin/grep"; cut = "${pkgs.coreutils}/bin/cut"; head = "${pkgs.coreutils}/bin/head"; @@ -8,22 +10,34 @@ let pkill = "${pkgs.procps}/bin/pkill"; playerCtl = "${pkgs.playerctl}/bin/playerctl"; playerStatus = "${playerCtl} -f '{{emoji(status)}} {{title}} - {{artist}}' metadata | ${head} -c 60"; - alacritty = "${pkgs.alacritty}/bin/alacritty"; - btm = "${pkgs.bottom}/bin/btm"; - colors = with pkgs.rice; palette.toARGBHex rec { + systemctl = "${pkgs.systemd}/bin/systemctl"; + loginctl = "${pkgs.systemd}/bin/loginctl"; + shutdown = "${pkgs.systemd}/bin/shutdown"; + logout = pkgs.writeShellScript "logout" '' + session=`${loginctl} session-status | ${pkgs.coreutils}/bin/head -n 1 | ${pkgs.gawk}/bin/awk '{print $1}'` + ${loginctl} terminate-session $session + ''; + colors = with pkgs.lib.rice; let + alpha = 255 * opacity; + in + palette.toARGBHex rec { normal = { foreground = colorPalette.normal.white; - background = colorPalette.normal.black; - underline = colorPalette.normal.blue; + background = color.setAlphaRgba alpha (colorPalette.normal.black); + underline = colorPalette.dark.blue; }; - active = palette.brighten "50%" normal; + active = { + foreground = colorPalette.bright.white; + background = color.setAlphaRgba alpha (colorPalette.normal.black); + underline = colorPalette.bright.blue; + }; selected = { foreground = colorPalette.bright.white; - background = color.tAlphaRgba (v: 240) colorPalette.dark.blue; - underline = colorPalette.dark.white; + background = color.setAlphaRgba alpha (color.brighten 10 colorPalette.bright.black); + underline = colorPalette.bright.red; }; alert = colorPalette.bright.red; @@ -47,10 +61,7 @@ let foreground = colors.normal.foreground; line-size = 2; line-color = colors.normal.underline; - padding = { - left = 0; - right = 0; - }; + padding = { left = 0; right = 0; }; module.margin = { left = 0; right = 0; }; separator = " "; border = { @@ -62,8 +73,11 @@ let }; font = [ "${pkgs.rice.font.monospace.name}:size=${toString pkgs.rice.font.monospace.size};2" - "Material Design Icons:size=${toString pkgs.rice.font.monospace.size};2" - "NotoEmoji Nerd Font Mono:size=${toString pkgs.rice.font.monospace.size};0" + # "Font Awesome 6 Free:size=14;0" + # "Noto Color Emoji:size=2;2" + "Noto Sans Symbols2:size=${toString pkgs.rice.font.monospace.size};2" + # "Material Design Icons:size=${toString pkgs.rice.font.monospace.size};2" + # "EmojiOne Color:size=${toString pkgs.rice.font.monospace.size};0" ]; wm-restack = "bspwm"; }; @@ -73,9 +87,11 @@ in { home.packages = with pkgs; [ pkgs.rice.font.monospace.package - emojione - noto-fonts-emoji - material-design-icons + # emojione + # noto-fonts-emoji + noto-fonts + # material-design-icons + # font-awesome ]; services.polybar = { enable = true; @@ -95,7 +111,7 @@ in screenchange-reload = false; }; - "bar/primary" = commonBar // { + "bar/primary" = recursiveUpdate commonBar { modules-left = "bspwm"; # modules-center = modules-right = "player pulseaudio temperature cpu memory battery date powermenu"; @@ -106,7 +122,7 @@ in }; }; - "bar/secondary" = commonBar // { + "bar/secondary" = recursiveUpdate commonBar { modules-left = "bspwm"; # modules-center = modules-right = "player pulseaudio temperature cpu memory battery date powermenu"; @@ -132,52 +148,42 @@ in }; format = { - charging = colors.selected // { - padding = 1; - text = " "; - }; - discharging = colors.active // { - padding = 1; - text = " "; - }; - full = colors.normal // { - padding = 1; - text = " "; - }; + charging = recursiveUpdate colors.selected { text = " "; }; + discharging = recursiveUpdate colors.active { text = " "; }; + full = recursiveUpdate colors.normal { text = " "; }; }; - label = { - chargin = "%percentage%%"; - dischargin = "%percentage%%"; - full = "%percentage%%"; - }; + label.text = "%percentage%%"; + # = { + # chargin = "%percentage%%"; + # dischargin = "%percentage%%"; + # full = "%percentage%%"; + # }; }; "module/bspwm" = { type = "internal/bspwm"; format = ""; - label = let - common = { - padding = 1; - separator = " "; - text = "%name%"; - }; - in + label = + let + common = { + padding = 1; + separator = " "; + text = "%name%"; + }; + in { - focused = colors.selected // common; - occupied = colors.active // common; - urgent = colors.active // common // { background = colors.alert; }; - empty = colors.normal // common // { text = "󰧟"; padding = 0; }; + focused = recursiveUpdate colors.selected common; + occupied = recursiveUpdate colors.active common; + urgent = recursiveUpdate (recursiveUpdate colors.active common) { background = colors.alert; }; + empty = recursiveUpdate (recursiveUpdate colors.normal common) { text = "󰧟"; padding = 0; }; }; }; "module/cpu" = { type = "internal/cpu"; - format = colors.normal // { - text = "󰍛