From d5c1a63ba3be9319f9b52681a19b155d198c52b3 Mon Sep 17 00:00:00 2001 From: Yusuf Bera Ertan Date: Mon, 3 May 2021 07:48:31 +0300 Subject: [PATCH] refactor!: port to devos --- flake.lock | 287 +++++- flake.nix | 5 + hosts/default.nix | 58 -- hosts/lungmen.nix | 12 +- hosts/niximg.nix | 12 - lib/utils.nix | 29 - local/locale.nix => locale/default.nix | 0 overlays/hydrus.nix | 14 - profiles/core.nix | 144 --- profiles/core/default.nix | 146 +-- profiles/network/default.nix | 13 - .../default.nix} | 2 +- repl.nix | 5 - users/modules/module-list.nix | 1 + users/patriot/default.nix | 945 +++++++++++++++++- users/patriot/home.nix | 939 ----------------- 16 files changed, 1274 insertions(+), 1338 deletions(-) delete mode 100644 hosts/default.nix delete mode 100644 hosts/niximg.nix delete mode 100644 lib/utils.nix rename local/locale.nix => locale/default.nix (100%) delete mode 100644 overlays/hydrus.nix delete mode 100644 profiles/core.nix rename profiles/network/{networkmanager.nix => networkmanager/default.nix} (66%) delete mode 100644 repl.nix delete mode 100644 users/patriot/home.nix diff --git a/flake.lock b/flake.lock index 141d503..82f7495 100644 --- a/flake.lock +++ b/flake.lock @@ -1,25 +1,120 @@ { "nodes": { - "cachix": { + "ci-agent": { + "inputs": { + "flake-compat": [ + "flake-compat" + ], + "nix-darwin": [ + "darwin" + ], + "nixos-20_09": [ + "nixos" + ], + "nixos-unstable": [ + "override" + ], + "pre-commit-hooks-nix": "pre-commit-hooks-nix" + }, "locked": { - "lastModified": 1619970086, - "narHash": "sha256-93FzftIPlkQAapwb2Wq0IOktSUCsDW87tcKVWG5YnyQ=", - "owner": "nixos", - "repo": "nixpkgs", - "rev": "dc326c78a93862efb30a76216f527a56496e6284", + "lastModified": 1619598097, + "narHash": "sha256-g8Qha/DlieKpc92yW/2HsucHQ6m+mjJPsc7p6bsBG8s=", + "owner": "hercules-ci", + "repo": "hercules-ci-agent", + "rev": "43d12815b3d53fb062fa23a2053618c1bccf304c", "type": "github" }, "original": { - "owner": "nixos", - "ref": "nixos-20.09", - "repo": "nixpkgs", + "owner": "hercules-ci", + "repo": "hercules-ci-agent", + "type": "github" + } + }, + "darwin": { + "inputs": { + "nixpkgs": [ + "override" + ] + }, + "locked": { + "lastModified": 1617693609, + "narHash": "sha256-/+6wm08yHK8mhyljzELD4WE9Gh8XUVbHL0R1TQpZtTQ=", + "owner": "LnL7", + "repo": "nix-darwin", + "rev": "a7492a8c76dcc702d0a65cd820a5f9baa8702684", + "type": "github" + }, + "original": { + "owner": "LnL7", + "repo": "nix-darwin", + "type": "github" + } + }, + "deploy": { + "inputs": { + "flake-compat": [ + "flake-compat" + ], + "naersk": [ + "naersk" + ], + "nixpkgs": [ + "override" + ], + "utils": [ + "utils" + ] + }, + "locked": { + "lastModified": 1616406726, + "narHash": "sha256-n9zmgxR03QNrvs9/fHewqE0j3SjL7Y+cglBCFu3U3rg=", + "owner": "serokell", + "repo": "deploy-rs", + "rev": "9e405fbc5ab5bacbd271fd78c6b6b6877c4d9f8d", + "type": "github" + }, + "original": { + "owner": "serokell", + "repo": "deploy-rs", + "type": "github" + } + }, + "devshell": { + "locked": { + "lastModified": 1618523768, + "narHash": "sha256-Gev9da35pHUey3kGz/zrJFc/9ICs++vPCho7qB1mqd8=", + "owner": "numtide", + "repo": "devshell", + "rev": "709fe4d04a9101c9d224ad83f73416dce71baf21", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "devshell", + "type": "github" + } + }, + "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1611461076, + "narHash": "sha256-ad++dTtMNeitUIKi1c66aTrVJOSf+mdZTrGrXzjDr6Q=", + "owner": "BBBSnowball", + "repo": "flake-compat", + "rev": "a565cb46bee9fa856a6c15bc9c3bb947fbb784ec", + "type": "github" + }, + "original": { + "owner": "BBBSnowball", + "ref": "pr-1", + "repo": "flake-compat", "type": "github" } }, "home": { "inputs": { "nixpkgs": [ - "nixpkgs" + "nixos" ] }, "locked": { @@ -36,26 +131,10 @@ "type": "github" } }, - "impermanence": { - "flake": false, - "locked": { - "lastModified": 1611747548, - "narHash": "sha256-2z5wmWda1uI4IkTZrW52jiHq3bzhYLc+GgjvaSd544M=", - "owner": "nix-community", - "repo": "impermanence", - "rev": "58558845bc68dcf2bb32caa80564f7fe3f6cbc61", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "impermanence", - "type": "github" - } - }, "mynex": { "inputs": { "nixpkgs": [ - "nixpkgs" + "nixos" ] }, "locked": { @@ -72,7 +151,27 @@ "type": "gitlab" } }, - "nixpkgs": { + "naersk": { + "inputs": { + "nixpkgs": [ + "override" + ] + }, + "locked": { + "lastModified": 1618844365, + "narHash": "sha256-Z9t0rr+5OG/ru3jdg3jivfYVU4ydV/nqt8UwIut7uHs=", + "owner": "nmattia", + "repo": "naersk", + "rev": "32e3ba39d9d83098b13720a4384bdda191dd0445", + "type": "github" + }, + "original": { + "owner": "nmattia", + "repo": "naersk", + "type": "github" + } + }, + "nixos": { "locked": { "lastModified": 1619464443, "narHash": "sha256-R7WAb8EnkIJxxaF6GTHUPytjonhB4Zm0iatyWoW169A=", @@ -82,40 +181,132 @@ "type": "github" }, "original": { - "owner": "NixOS", + "id": "nixpkgs", "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" + "type": "indirect" } }, - "nixpkgsWayland": { - "inputs": { - "cachix": "cachix", - "nixpkgs": [ - "nixpkgs" - ] - }, + "nixos-hardware": { "locked": { - "lastModified": 1620003682, - "narHash": "sha256-JEtSqDPpvYIrsXiVc8t4CemnKOeFwbSOawWP7CsQpVo=", - "owner": "colemickens", - "repo": "nixpkgs-wayland", - "rev": "9354b29893139d6ed98b4374521a3042e1b30626", + "lastModified": 1619336929, + "narHash": "sha256-joIC2D26jtSbHodR/o8r+5T9XL2hXs6NIp5mVyA4JOc=", + "owner": "nixos", + "repo": "nixos-hardware", + "rev": "f7540d6c27704ec0fe56ecc8b2a9b663181850b0", "type": "github" }, "original": { - "owner": "colemickens", - "repo": "nixpkgs-wayland", + "owner": "nixos", + "repo": "nixos-hardware", + "type": "github" + } + }, + "nixosPersistence": { + "locked": { + "lastModified": 1611747548, + "narHash": "sha256-2z5wmWda1uI4IkTZrW52jiHq3bzhYLc+GgjvaSd544M=", + "owner": "nix-community", + "repo": "impermanence", + "rev": "58558845bc68dcf2bb32caa80564f7fe3f6cbc61", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "impermanence", + "type": "github" + } + }, + "nur": { + "locked": { + "lastModified": 1620002927, + "narHash": "sha256-M6BL1znBMzxabeXTlQvaZhnWzia4aTmXc5GKBp/XoTc=", + "owner": "nix-community", + "repo": "NUR", + "rev": "167a18afb94ca3356ea0f8caf19f068d07e41857", + "type": "github" + }, + "original": { + "id": "nur", + "type": "indirect" + } + }, + "override": { + "locked": { + "lastModified": 1619464443, + "narHash": "sha256-R7WAb8EnkIJxxaF6GTHUPytjonhB4Zm0iatyWoW169A=", + "path": "/nix/store/i4c4ph7frbzhfrn4408ghpmayafdmhr3-source", + "rev": "8e4fe32876ca15e3d5eb3ecd3ca0b224417f5f17", + "type": "path" + }, + "original": { + "id": "nixpkgs", + "type": "indirect" + } + }, + "pkgs": { + "inputs": { + "nixpkgs": [ + "nixos" + ] + }, + "locked": { + "narHash": "sha256-Zs7dc0dNNa0Z3//+Gckxj7SKrMqVovY0xZZ1z8xWnEg=", + "path": "./pkgs", + "type": "path" + }, + "original": { + "path": "./pkgs", + "type": "path" + } + }, + "pre-commit-hooks-nix": { + "flake": false, + "locked": { + "lastModified": 1617783930, + "narHash": "sha256-SigoU2LWM1fMggqfM9H8XEIvjOjBVQ/wj/zrn02J28c=", + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "rev": "2d169bb1b23f3b71a894a66ea81f45c788943248", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "pre-commit-hooks.nix", "type": "github" } }, "root": { "inputs": { + "ci-agent": "ci-agent", + "darwin": "darwin", + "deploy": "deploy", + "devshell": "devshell", + "flake-compat": "flake-compat", "home": "home", - "impermanence": "impermanence", "mynex": "mynex", - "nixpkgs": "nixpkgs", - "nixpkgsWayland": "nixpkgsWayland" + "naersk": "naersk", + "nixos": "nixos", + "nixos-hardware": "nixos-hardware", + "nixosPersistence": "nixosPersistence", + "nur": "nur", + "override": "override", + "pkgs": "pkgs", + "utils": "utils" + } + }, + "utils": { + "locked": { + "lastModified": 1619345332, + "narHash": "sha256-qHnQkEp1uklKTpx3MvKtY6xzgcqXDsz5nLilbbuL+3A=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "2ebf2558e5bf978c7fb8ea927dfaed8fefab2e28", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" } } }, diff --git a/flake.nix b/flake.nix index 27024b0..9443717 100644 --- a/flake.nix +++ b/flake.nix @@ -21,6 +21,11 @@ pkgs.url = "path:./pkgs"; pkgs.inputs.nixpkgs.follows = "nixos"; + mynex = { + url = "gitlab:yusdacra/nix-exprs"; + inputs.nixpkgs.follows = "nixos"; + }; + nixosPersistence.url = "github:nix-community/impermanence"; }; outputs = inputs@{ self, pkgs, digga, nixos, ci-agent, home, nixos-hardware, nur, ... }: diff --git a/hosts/default.nix b/hosts/default.nix deleted file mode 100644 index 19284b1..0000000 --- a/hosts/default.nix +++ /dev/null @@ -1,58 +0,0 @@ -inputs@{ home, impermanence, mynex, nixpkgs, self, pkgs, system, ... }: -let - utils = import ../lib/utils.nix { inherit lib pkgs; }; - - inherit (nixpkgs) lib; - inherit (utils) recImport; - - config = hostName: - lib.nixosSystem { - inherit system; - - specialArgs = { - usr = { inherit utils; }; - util = utils; - nixosPersistence = "${impermanence}/nixos.nix"; - inputs = inputs; - }; - - modules = - let - inherit (home.nixosModules) home-manager; - inherit (mynex.nixosModules) security networking; - - core = ../profiles/core.nix; - - global = { - networking.hostName = hostName; - nix = { - nixPath = [ - "nixpkgs=${nixpkgs}" - "nixos-config=/etc/nixos/configuration.nix" - "nixpkgs-overlays=/etc/nixos/overlays" - ]; - - binaryCachePublicKeys = [ - "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=" - "nixpkgs-wayland.cachix.org-1:3lwxaILxMRkVhehr5StQprHdEo4IrE8sRho9R9HOLYA=" - ]; - binaryCaches = [ - "https://cache.nixos.org" - "https://nixpkgs-wayland.cachix.org" - ]; - }; - - nixpkgs = { inherit pkgs; }; - }; - - local = import "${toString ./.}/${hostName}.nix"; - in - [ core global local home-manager security networking ]; - }; - - hosts = recImport { - dir = ./.; - _import = config; - }; -in -hosts diff --git a/hosts/lungmen.nix b/hosts/lungmen.nix index 76f9d3f..b256ded 100644 --- a/hosts/lungmen.nix +++ b/hosts/lungmen.nix @@ -1,4 +1,4 @@ -{ config, lib, pkgs, modulesPath, nixosPersistence, ... }: +{ config, lib, pkgs, modulesPath, suites, ... }: let btrfsPartPath = "/dev/disk/by-label/NIXOS"; btrfsOptions = [ "compress-force=zstd" "noatime" ]; @@ -32,13 +32,9 @@ let ''; in { - imports = [ - ../users/patriot - ../users/root - ../profiles/network/networkmanager.nix - ../profiles/develop + imports = suites.work ++ [ + ../profiles/network/networkmanager (modulesPath + "/installer/scan/not-detected.nix") - nixosPersistence ]; boot = { @@ -184,7 +180,7 @@ in postgresql = { enable = false; enableTCPIP = true; - authentication = pkgs.lib.mkOverride 10 '' + authentication = lib.mkOverride 10 '' local all all trust host all all 0.0.0.0/0 md5 ''; diff --git a/hosts/niximg.nix b/hosts/niximg.nix deleted file mode 100644 index 3b3cb51..0000000 --- a/hosts/niximg.nix +++ /dev/null @@ -1,12 +0,0 @@ -{ modulesPath, ... }: { - imports = [ - # passwd is nixos by default - ../users/nixos - ../users/root - "${modulesPath}/installer/cd-dvd/iso-image.nix" - ]; - - isoImage.makeEfiBootable = true; - isoImage.makeUsbBootable = true; - networking.networkmanager.enable = true; -} diff --git a/lib/utils.nix b/lib/utils.nix deleted file mode 100644 index 04ae1a4..0000000 --- a/lib/utils.nix +++ /dev/null @@ -1,29 +0,0 @@ -{ lib, pkgs, ... }: -let - inherit (builtins) attrNames isAttrs isInt readDir toJSON; - - inherit (lib) filterAttrs hasSuffix mapAttrs' nameValuePair removeSuffix; - - # mapFilterAttrs :: - # (name -> value -> bool ) - # (name -> value -> { name = any; value = any; }) - # attrs - mapFilterAttrs = seive: f: attrs: filterAttrs seive (mapAttrs' f attrs); -in -{ - inherit mapFilterAttrs; - - recImport = { dir, _import ? base: import "${dir}/${base}.nix" }: - mapFilterAttrs (_: v: v != null) - (n: v: - if n != "default.nix" && hasSuffix ".nix" n && v == "regular" - - then - let name = removeSuffix ".nix" n; in nameValuePair (name) (_import name) - - else - nameValuePair ("") (null)) - (readDir dir); - - pkgBin = name: "${pkgs."${name}"}/bin/${name}"; -} diff --git a/local/locale.nix b/locale/default.nix similarity index 100% rename from local/locale.nix rename to locale/default.nix diff --git a/overlays/hydrus.nix b/overlays/hydrus.nix deleted file mode 100644 index 5f20dc2..0000000 --- a/overlays/hydrus.nix +++ /dev/null @@ -1,14 +0,0 @@ -final: prev: { - hydrus = prev.hydrus.overrideAttrs (old: - let version = "436"; in - { - inherit version; - - src = prev.fetchFromGitHub { - owner = "hydrusnetwork"; - repo = old.pname; - rev = "v${version}"; - sha256 = "sha256-FXm8VUEY0OZ6/dc/qNwOXekhv5H2C9jjg/eNDoMvMn0="; - }; - }); -} diff --git a/profiles/core.nix b/profiles/core.nix deleted file mode 100644 index d124336..0000000 --- a/profiles/core.nix +++ /dev/null @@ -1,144 +0,0 @@ -{ config, lib, pkgs, util, inputs, ... }: -let - inherit (util) pkgBin; - inherit (lib) fileContents mkIf; - -in -{ - imports = [ ../local/locale.nix ]; - - boot = { - tmpOnTmpfs = true; - loader.systemd-boot.configurationLimit = 10; - }; - - console.font = "7x14"; - - environment = - let - coreBin = v: "${pkgs.coreutils}/bin/${v}"; - nixBin = "${config.nix.package}/bin/nix"; - in - { - systemPackages = with pkgs; [ - bat - exa - ripgrep - curl - jq - git - gptfdisk - iputils - lm_sensors - mkpasswd - ntfs3g - zoxide - bottom - tealdeer - amber - unzip - unrar - grit - hydra-check - nix-index - ]; - - shellAliases = - let ifSudo = string: mkIf config.security.sudo.enable string; - in - { - gtw = "${pkgBin "grit"} tree wnv"; - gtwa = "${pkgBin "grit"} add -p wnv"; - gt = pkgBin "grit"; - - g = pkgBin "git"; - - grep = "${pkgs.ripgrep}/bin/rg"; - cat = "${pkgBin "bat"} -pp --theme=base16"; - c = "${pkgBin "bat"} -pp --theme=base16"; - - df = "${coreBin "df"} -h"; - free = "${pkgs.procps}/bin/free -h"; - - ls = pkgBin "exa"; - l = "${pkgBin "exa"} -lhg --git"; - la = "${pkgBin "exa"} -lhg --git -a"; - t = "${pkgBin "exa"} -lhg --git -T"; - ta = "${pkgBin "exa"} -lhg --git -a -T"; - - n = nixBin; - nf = "${nixBin} flake"; - nfc = "${nixBin} flake check"; - nfu = "${nixBin} flake update"; - nfua = "${nixBin} flake update --recreate-lock-file"; - nfs = "${nixBin} flake show"; - np = "${nixBin} profile"; - npl = "${nixBin} profile info"; - npi = "${nixBin} profile install"; - npr = "${nixBin} profile remove"; - nsh = "${nixBin} shell"; - nsr = "${nixBin} search"; - nsrp = "${nixBin} search nixpkgs"; - ndev = "${nixBin} develop"; - - nosce = "cd /etc/nixos"; - nosr = ifSudo "sudo nixos-rebuild --fast"; - nosrs = ifSudo "sudo nixos-rebuild switch"; - nosrb = ifSudo "sudo nixos-rebuild boot"; - nosrt = ifSudo "sudo nixos-rebuild test"; - ncg = ifSudo "sudo nix-collect-garbage"; - ncgdo = ifSudo "sudo nix-collect-garbage --delete-old"; - - top = "${pkgs.bottom}/bin/btm"; - - myip = - "${pkgs.dnsutils}/bin/dig +short myip.opendns.com @208.67.222.222 2>&1"; - - sys-repl = - "source /etc/set-environment && ${nixBin} repl ${./..}/repl.nix"; - }; - }; - - nix = - let - flakes = lib.filterAttrs (name: value: value ? outputs) inputs; - - nixPath = lib.mapAttrsToList - (name: _: "${name}=${inputs.${name}}") - flakes; - - registry = builtins.mapAttrs - (name: v: { flake = v; }) - flakes; - in - { - package = pkgs.nixFlakes; - autoOptimiseStore = true; - optimise.automatic = true; - allowedUsers = [ "@wheel" ]; - trustedUsers = [ "root" "@wheel" ]; - extraOptions = '' - experimental-features = nix-command flakes ca-references - ''; - nixPath = nixPath ++ [ "repl=${./..}/repl.nix" ]; - inherit registry; - }; - - system.activationScripts.diff = '' - ${pkgs.nixUnstable}/bin/nix store \ - --experimental-features 'nix-command' \ - diff-closures /run/current-system "$systemConfig" - ''; - - # security = { - # hideProcessInformation = true; - # protectKernelImage = true; - # }; - - programs.command-not-found.enable = false; - - home-manager.useGlobalPkgs = true; - home-manager.useUserPackages = true; - - users.mutableUsers = false; -} diff --git a/profiles/core/default.nix b/profiles/core/default.nix index 41b5136..267ffcd 100644 --- a/profiles/core/default.nix +++ b/profiles/core/default.nix @@ -1,13 +1,24 @@ -{ self, config, lib, pkgs, ... }: -let inherit (lib) fileContents; +{ self, config, pkgs, ... }: +let + lib = pkgs.lib; + + inherit (lib) fileContents mkIf; + pkgBin = lib.dev.pkgBinNoDep pkgs; + + coreBin = v: "${pkgs.coreutils}/bin/${v}"; + nixBin = "${config.nix.package}/bin/nix"; in { - imports = [ ../cachix ]; + imports = [ ../cachix ../../locale ]; - nix.systemFeatures = [ "nixos-test" "benchmark" "big-parallel" "kvm" ]; + boot = { + tmpOnTmpfs = true; + loader.systemd-boot.configurationLimit = 10; + }; + + console.font = "7x14"; environment = { - systemPackages = with pkgs; [ binutils coreutils @@ -31,46 +42,72 @@ in usbutils utillinux whois + bat + exa + git + lm_sensors + mkpasswd + ntfs3g + zoxide + bottom + amber + unzip + unrar + grit + hydra-check + nix-index ]; - shellInit = '' - export STARSHIP_CONFIG=${ - pkgs.writeText "starship.toml" - (fileContents ./starship.toml) - } - ''; - shellAliases = - let ifSudo = lib.mkIf config.security.sudo.enable; + let ifSudo = string: mkIf config.security.sudo.enable string; in { - # quick cd - ".." = "cd .."; - "..." = "cd ../.."; - "...." = "cd ../../.."; - "....." = "cd ../../../.."; + gtw = "${pkgBin "grit"} tree wnv"; + gtwa = "${pkgBin "grit"} add -p wnv"; + gt = pkgBin "grit"; - # git - g = "git"; + g = pkgBin "git"; - # grep - grep = "rg"; - gi = "grep -i"; + grep = "${pkgs.ripgrep}/bin/rg"; + cat = "${pkgBin "bat"} -pp --theme=base16"; + c = "${pkgBin "bat"} -pp --theme=base16"; - # internet ip - myip = "dig +short myip.opendns.com @208.67.222.222 2>&1"; + df = "${coreBin "df"} -h"; + free = "${pkgs.procps}/bin/free -h"; - # nix - n = "nix"; - np = "n profile"; - ni = "np install"; - nr = "np remove"; - ns = "n search --no-update-lock-file"; - nf = "n flake"; - nepl = "n repl ''"; - srch = "ns nixos"; - orch = "ns override"; - nrb = ifSudo "sudo nixos-rebuild"; + ls = pkgBin "exa"; + l = "${pkgBin "exa"} -lhg --git"; + la = "${pkgBin "exa"} -lhg --git -a"; + t = "${pkgBin "exa"} -lhg --git -T"; + ta = "${pkgBin "exa"} -lhg --git -a -T"; + + n = nixBin; + nf = "${nixBin} flake"; + nfc = "${nixBin} flake check"; + nfu = "${nixBin} flake update"; + nfua = "${nixBin} flake update --recreate-lock-file"; + nfs = "${nixBin} flake show"; + np = "${nixBin} profile"; + npl = "${nixBin} profile info"; + npi = "${nixBin} profile install"; + npr = "${nixBin} profile remove"; + nsh = "${nixBin} shell"; + nsr = "${nixBin} search"; + nsrp = "${nixBin} search nixpkgs"; + ndev = "${nixBin} develop"; + + nosce = "cd /etc/nixos"; + nosr = ifSudo "sudo nixos-rebuild --fast"; + nosrs = ifSudo "sudo nixos-rebuild switch"; + nosrb = ifSudo "sudo nixos-rebuild boot"; + nosrt = ifSudo "sudo nixos-rebuild test"; + ncg = ifSudo "sudo nix-collect-garbage"; + ncgdo = ifSudo "sudo nix-collect-garbage --delete-old"; + + top = "${pkgs.bottom}/bin/btm"; + + myip = + "${pkgs.dnsutils}/bin/dig +short myip.opendns.com @208.67.222.222 2>&1"; mn = '' manix "" | grep '^# ' | sed 's/^# \(.*\) (.*/\1/;s/ (.*//;s/^# //' | sk --preview="manix '{}'" | xargs manix ''; @@ -95,54 +132,33 @@ in up = ifSudo "s systemctl start"; dn = ifSudo "s systemctl stop"; jtl = "journalctl"; - }; }; - fonts = { - fonts = with pkgs; [ powerline-fonts dejavu_fonts ]; - - fontconfig.defaultFonts = { - - monospace = [ "DejaVu Sans Mono for Powerline" ]; - - sansSerif = [ "DejaVu Sans" ]; - - }; - }; + system.activationScripts.diff = '' + ${pkgs.nixUnstable}/bin/nix store \ + --experimental-features 'nix-command' \ + diff-closures /run/current-system "$systemConfig" + ''; nix = { - autoOptimiseStore = true; - gc.automatic = true; - optimise.automatic = true; - useSandbox = true; - allowedUsers = [ "@wheel" ]; - trustedUsers = [ "root" "@wheel" ]; - extraOptions = '' min-free = 536870912 keep-outputs = true keep-derivations = true fallback = true ''; - }; - programs.bash = { - promptInit = '' - eval "$(${pkgs.starship}/bin/starship init bash)" - ''; - interactiveShellInit = '' - eval "$(${pkgs.direnv}/bin/direnv hook bash)" - ''; - }; + programs.command-not-found.enable = false; + home-manager.useGlobalPkgs = true; + users.mutableUsers = false; services.earlyoom.enable = true; - } diff --git a/profiles/network/default.nix b/profiles/network/default.nix index 8e4c084..37b501a 100644 --- a/profiles/network/default.nix +++ b/profiles/network/default.nix @@ -7,17 +7,4 @@ noarp nodelay ''; - - /*systemd.network = { - enable = true; - networks = { - internet0 = { - matchConfig = { Name = "enp6s0"; }; - networkConfig = { - Address = "192.168.1.33"; - Gateway = "192.168.1.255"; - }; - }; - }; - };*/ } diff --git a/profiles/network/networkmanager.nix b/profiles/network/networkmanager/default.nix similarity index 66% rename from profiles/network/networkmanager.nix rename to profiles/network/networkmanager/default.nix index 217c6c3..a5da3e5 100644 --- a/profiles/network/networkmanager.nix +++ b/profiles/network/networkmanager/default.nix @@ -1,5 +1,5 @@ { - imports = [ ./dns ]; + imports = [ ../dns ]; networking.networkmanager.enable = true; } diff --git a/repl.nix b/repl.nix deleted file mode 100644 index 833ea26..0000000 --- a/repl.nix +++ /dev/null @@ -1,5 +0,0 @@ -let - sysFlake = builtins.getFlake (toString ./.); - nixpkgs = import { }; -in -{ inherit sysFlake; } // nixpkgs diff --git a/users/modules/module-list.nix b/users/modules/module-list.nix index 1e3ec72..e18e705 100644 --- a/users/modules/module-list.nix +++ b/users/modules/module-list.nix @@ -1 +1,2 @@ [ ] + diff --git a/users/patriot/default.nix b/users/patriot/default.nix index d238142..43958c3 100644 --- a/users/patriot/default.nix +++ b/users/patriot/default.nix @@ -1,5 +1,14 @@ -{ config, pkgs, ... }: { - imports = [ ./home.nix ]; +{ config, pkgs, ... }: +let + lib = pkgs.lib; + + inherit (lib) mapAttrs' nameValuePair; + inherit (builtins) readDir fetchGit; + pkgBin = lib.dev.pkgBinNoDep pkgs; + + nixosConfig = config; +in +{ users.users.patriot = { isNormalUser = true; @@ -73,4 +82,936 @@ NetworkManager-wait-online.enable = false; }; }; + + home-manager.users.patriot = + { config, pkgs, ... }: + let + name = "Yusuf Bera Ertan"; + email = "y.bera003.06@protonmail.com"; + + font = "Iosevka Term"; + fontSize = 10; + fontComb = "${font} ${toString fontSize}"; + fontPackage = pkgs.iosevka; + + kideSrc = fetchGit { + url = "https://gitlab.com/yusdacra/kide.git"; + rev = "778d68df0cfcb96d6113bfe6a59e5dfc71ee7d82"; + submodules = true; + }; + kideFiles = + mapAttrs' (n: _: nameValuePair "kak/${n}" { source = "${kideSrc}/${n}"; }) + (readDir kideSrc); + kideDeps = with pkgs; [ + fzf + bat + ripgrep + universal-ctags + kak-lsp + wl-clipboard + xclip + shellcheck + perl + socat + gdb + kcr + jq + file + ]; + + chromiumWayland = + let + flags = [ + "--enable-features=UseOzonePlatform" + "--ozone-platform=wayland" + "--enable-vulkan" + "--enable-webrtc-pipewire-capturer" + "--ignore-gpu-blocklist" + "--enable-gpu-rasterization" + "--enable-zero-copy" + "--disable-gpu-driver-bug-workarounds" + ]; + in + pkgs.writeScriptBin "chromium-wayland" '' + #!${pkgs.stdenv.shell} + chromium ${lib.concatStringsSep " " flags} + ''; + chromiumWaylandPkg = with pkgs; + let name = "chromium-wayland"; in + stdenv.mkDerivation { + pname = name; + version = chromium.version; + + nativeBuildInputs = [ copyDesktopItems ]; + desktopItems = [ + (makeDesktopItem { + inherit name; + exec = name; + desktopName = "Chromium Wayland"; + genericName = "Web Browser"; + }) + ]; + + phases = [ "installPhase" ]; + installPhase = '' + mkdir -p $out/bin + ln -s ${chromiumWayland}/bin/chromium-wayland $out/bin/chromium-wayland + ''; + }; + + colorSchemeLight = { + primary = { + normal = { + background = "fbf3db"; + foreground = "53676d"; + }; + bright = { + background = "d5cdb6"; + foreground = "3a4d53"; + }; + }; + normal = { + black = "ece3cc"; + gray = "5b5b5b"; + red = "d2212d"; + green = "489100"; + yellow = "ad8900"; + blue = "0072d4"; + magenta = "ca4898"; + cyan = "009c8f"; + white = "909995"; + }; + bright = { + black = "d5cdb6"; + gray = "7b7b7b"; + red = "cc1729"; + green = "428b00"; + yellow = "a78300"; + blue = "006dce"; + magenta = "c44392"; + cyan = "00978a"; + white = "3a4d53"; + }; + }; + + colorSchemeDark = + let + normal = { + black = "252525"; + gray = "5b5b5b"; + red = "ed4a46"; + green = "70b433"; + yellow = "dbb32d"; + blue = "368aeb"; + magenta = "eb6eb7"; + cyan = "3fc5b7"; + white = "777777"; + }; + bright = { + black = "3b3b3b"; + gray = "7b7b7b"; + red = "ff5e56"; + green = "83c746"; + yellow = "efc541"; + blue = "4f9cfe"; + magenta = "ff81ca"; + cyan = "56d8c9"; + white = "dedede"; + }; + in + { + inherit normal bright; + + primary = { + normal = { + background = "181818"; + foreground = "b9b9b9"; + }; + bright = { + background = bright.black; + foreground = bright.white; + }; + }; + }; + + colorScheme = + # if builtins.pathExists ./light then colorSchemeLight else colorSchemeDark; + colorSchemeDark; + + bgColor = colorScheme.primary.normal.background; + fgColor = colorScheme.primary.bright.foreground; + acColor = colorScheme.normal.yellow; + acColor2 = colorScheme.normal.magenta; + + alacrittyColors = { + primary = { + background = "0x${bgColor}"; + foreground = "0x${fgColor}"; + }; + normal = lib.mapAttrs (_: v: "0x${v}") colorScheme.normal; + bright = lib.mapAttrs (_: v: "0x${v}") colorScheme.bright; + }; + + # sway attrs reused + focusedWorkspace = { + background = "#${bgColor}"; + border = "#${acColor}"; + text = "#${acColor}"; + }; + activeWorkspace = { + background = "#${bgColor}"; + border = "#${colorScheme.primary.bright.background}"; + text = "#${fgColor}"; + }; + inactiveWorkspace = { + background = "#${bgColor}"; + border = "#${bgColor}"; + text = "#${fgColor}"; + }; + urgentWorkspace = { + background = "#${bgColor}"; + border = "#${acColor2}"; + text = "#${acColor2}"; + }; + addIndSway = x: { + background = x.background; + border = x.border; + childBorder = x.border; + text = x.text; + indicator = "#111111"; # don't care + }; + fonts = [ fontComb ]; + + extraEnv = '' + # export SDL_VIDEODRIVER=wayland + # needs qt5.qtwayland in systemPackages + export QT_QPA_PLATFORM=wayland + export QT_WAYLAND_DISABLE_WINDOWDECORATION="1" + # Fix for some Java AWT applications (e.g. Android Studio), + # use this if they aren't displayed properly: + export _JAVA_AWT_WM_NONREPARENTING=1 + export QT_QPA_PLATFORMTHEME=qt5ct + export QT_PLATFORM_PLUGIN=qt5ct + ''; + in + { + imports = [ ../profiles/hikari.nix ]; + + # needs to be fixed to use nix profile??? + /*gtk = { + enable = false; + font = { + package = pkgs.dejavu_fonts; + name = "DejaVu Sans 12"; + }; + iconTheme = { + package = pkgs.papirus-icon-theme; + name = "Papirus Dark"; + }; + theme = { + package = pkgs.numix-gtk-theme; + name = "Numix Dark"; + }; + }; + + qt = { + enable = false; + style = { + package = pkgs.adwaita-qt; + name = "adwaita-dark"; + }; + };*/ + + fonts.fontconfig.enable = true; + home = { + homeDirectory = nixosConfig.users.users.patriot.home; + packages = with pkgs; + [ + # Font stuff + fontPackage + noto-fonts-cjk + noto-fonts-emoji-blob-bin + font-awesome + (nerdfonts.override { fonts = [ "Iosevka" ]; }) + # Programs + discord + ripcord + audacity + krita + gimp + kdenlive + gnome3.seahorse + gnome3.gnome-boxes + wine-staging + cachix + chromiumWaylandPkg + appimage-run + bitwarden + pfetch + neofetch + gnupg + imv + mpv + youtube-dl + ffmpeg + mupdf + transmission-qt + steam-run + lutris + xdg_utils + tagref + libreoffice-fresh + mako + hydrus + musikcube + qt5ct + phantomstyle + papirus-icon-theme + pcmanfm-qt + ] ++ kideDeps; + }; + + wayland.windowManager = { + hikari = { + enable = false; + inherit font; + }; + sway = { + enable = true; + extraSessionCommands = extraEnv; + wrapperFeatures.gtk = true; + config = { + inherit fonts; + bars = [{ + command = "${pkgBin "waybar"}"; + }]; + colors = { + background = "#${bgColor}"; + focused = addIndSway focusedWorkspace; + focusedInactive = addIndSway inactiveWorkspace; + unfocused = addIndSway activeWorkspace; + urgent = addIndSway urgentWorkspace; + }; + gaps.smartBorders = "on"; + menu = "${pkgBin "rofi"} -show drun | ${pkgs.sway}/bin/swaymsg --"; + modifier = "Mod4"; + terminal = pkgBin "alacritty"; + keybindings = + let + mod = config.wayland.windowManager.sway.config.modifier; + cat = pkgs.coreutils + "/bin/cat"; + grim = pkgBin "grim"; + slurp = pkgBin "slurp"; + pactl = pkgs.pulseaudio + "/bin/pactl"; + playerctl = pkgBin "playerctl"; + wf-recorder = pkgBin "wf-recorder"; + wl-copy = pkgs.wl-clipboard + "/bin/wl-copy"; + wl-paste = pkgs.wl-clipboard + "/bin/wl-paste"; + shotFile = config.home.homeDirectory + + "/shots/shot_$(date '+%Y_%m_%d_%H_%M')"; + in + lib.mkOptionDefault { + "${mod}+q" = "kill"; + "${mod}+Shift+e" = "exit"; + "${mod}+Shift+r" = "reload"; + # Screenshot and copy it to clipboard + "Mod1+s" = '' + exec export SFILE="${shotFile}.png" && ${grim} "$SFILE" && ${cat} "$SFILE" | ${wl-copy} -t image/png + ''; + # Save selected area as a picture and copy it to clipboard + "Mod1+Shift+s" = '' + exec export SFILE="${shotFile}.png" && ${grim} -g "$(${slurp})" "$SFILE" && ${cat} "$SFILE" | ${wl-copy} -t image/png + ''; + # Record screen + "Mod1+r" = ''exec ${wf-recorder} -f "${shotFile}.mp4"''; + # Record an area + "Mod1+Shift+r" = + ''exec ${wf-recorder} -g "$(${slurp})" -f "${shotFile}.mp4"''; + # Stop recording + "Mod1+c" = "exec pkill -INT wf-recorder"; + "XF86AudioRaiseVolume" = "exec ${pactl} set-sink-volume 0 +5%"; + "XF86AudioLowerVolume" = "exec ${pactl} set-sink-volume 0 -5%"; + "XF86AudioMute" = "exec ${pactl} set-sink-mute 0 toggle"; + "XF86AudioPlay" = "exec ${playerctl} play-pause"; + "XF86AudioPrev" = "exec ${playerctl} previous"; + "XF86AudioNext" = "exec ${playerctl} next"; + "XF86AudioStop" = "exec ${playerctl} stop"; + }; + input = { + "*" = { + xkb_layout = nixosConfig.services.xserver.layout; + accel_profile = "flat"; + }; + }; + output = { + "*" = { + bg = config.home.homeDirectory + "/wallpaper.png" + " fill"; + }; + }; + }; + }; + }; + + programs = { + alacritty = { + enable = true; + settings = { + shell = { + program = "${pkgs.tmux}/bin/tmux"; + args = [ "attach" ]; + }; + font = { + normal = { family = font; }; + size = fontSize; + }; + colors = alacrittyColors; + }; + }; + tmux = { + enable = true; + newSession = true; + secureSocket = true; + baseIndex = 1; + escapeTime = 0; + keyMode = "vi"; + shortcut = "a"; + extraConfig = '' + set -g default-terminal "alacritty" + set -ga terminal-overrides ",alacritty:Tc" + set -g status off + ''; + }; + chromium = { + enable = true; + extensions = [ + "gcbommkclmclpchllfjekcdonpmejbdp" # https everywhere + "cjpalhdlnbpafiamejdnhcphjbkeiagm" # ublock + "nngceckbapebfimnlniiiahkandclblb" # bitwarden + "ldpochfccmkkmhdbclfhpagapcfdljkj" # decentraleyes + "annfbnbieaamhaimclajlajpijgkdblo" # dark theme + "eimadpbcbfnmbkopoojfekhnkhdbieeh" # dark reader + "hlepfoohegkhhmjieoechaddaejaokhf" # github refined + "pmcmeagblkinmogikoikkdjiligflglb" # privacy redirect + ]; + }; + qutebrowser = { + enable = false; + settings = { + content.javascript.enabled = false; + colors.webpage.darkmode.enabled = false; + tabs = { + show = "multiple"; + tabs_are_windows = true; + }; + }; + extraConfig = + let + domains = [ + "discord.com" + "github.com" + "gitlab.com" + "nixos.org" + "protonmail.com" + "bitwarden.com" + "duckduckgo.com" + "youtube.com" + "docker.com" + ]; + enableJsForDomain = d: '' + config.set('content.javascript.enabled', True, 'https://*.${d}') + ''; + in + '' + ${lib.concatStrings (map enableJsForDomain domains)} + ''; + }; + git = { + enable = true; + aliases = { + a = "add"; + b = "branch"; + c = "commit"; + d = "diff"; + l = "log"; + s = "status"; + co = "checkout"; + dc = "diff --cached"; + qc = "commit -am"; + pl = "pull"; + ps = "push"; + rb = "rebase"; + rs = "restore"; + rv = "revert"; + ss = "stash"; + rst = "reset"; + rss = "restore --staged"; + ssp = "stash pop"; + ssl = "stash list"; + ssd = "stash drop"; + }; + extraConfig = { pull.rebase = true; }; + lfs.enable = true; + signing = { + key = "E1C119F91F4CAE53E8445CAFBB57FCE7E35984F6"; + signByDefault = true; + }; + userName = name; + userEmail = email; + }; + ssh = { + enable = true; + compression = true; + hashKnownHosts = true; + userKnownHostsFile = "~/.local/share/ssh/known-hosts"; + # Only needed for darcs hub + # extraConfig = '' + # Host hub.darcs.net + # ControlMaster no + # ForwardAgent no + # ForwardX11 no + # Ciphers +aes256-cbc + # MACs +hmac-sha1 + # ''; + }; + zsh = { + enable = true; + autocd = true; + enableVteIntegration = true; + enableAutosuggestions = true; + enableCompletion = true; + plugins = + let + fast-syntax-highlighting = + let name = "fast-syntax-highlighting"; in + { + inherit name; + src = pkgs."zsh-${name}".out; + }; + per-directory-history = { + name = "per-directory-history"; + src = pkgs.fetchFromGitHub { + owner = "jimhester"; + repo = "per-directory-history"; + rev = "d2e291dd6434e340d9be0e15e1f5b94f32771c06"; + hash = "sha256-VHRgrVCqzILqOes8VXGjSgLek38BFs9eijmp0JHtD5Q="; + }; + }; + in + [ fast-syntax-highlighting per-directory-history ]; + # xdg compliant + dotDir = ".config/zsh"; + history.path = ".local/share/zsh/history"; + envExtra = extraEnv; + loginExtra = + '' + if [ "$(${pkgs.coreutils}/bin/tty)" = "/dev/tty1" ]; then + exec sway + fi + ''; + initExtra = '' + export TERM=alacritty + + function tomp4 () { + ${pkgs.ffmpeg}/bin/ffmpeg -i $1 -c:v libx264 -preset slow -crf 30 -c:a aac -b:a 128k "$1.mp4" + } + + function topng () { + ${pkgs.ffmpeg}/bin/ffmpeg -i $1 "$1.png" + } + + bindkey "$terminfo[kRIT5]" forward-word + bindkey "$terminfo[kLFT5]" backward-word + zstyle ':completion:*' menu select + + eval "$(zoxide init zsh)" + ''; + shellAliases = nixosConfig.environment.shellAliases // { + rember = '' + ${pkgs.kakoune-unwrapped}/bin/kak -e "try %(gtd-jump-today)" "${config.home.homeDirectory}/rember/stuff$(date '+_%m_%Y').gtd" + ''; + }; + }; + starship = { + enable = true; + settings = { + add_newline = false; + character.symbol = ">"; + directory = { + truncation_length = 2; + truncate_to_repo = false; + }; + }; + }; + direnv = { + enable = true; + enableNixDirenvIntegration = true; + }; + fzf.enable = true; + rofi = + let + bgc = "#${bgColor}"; + fgc = "#${fgColor}"; + acc = "#${acColor}"; + in + { + enable = true; + colors = { + window = { + background = bgc; + border = bgc; + separator = bgc; + }; + rows = { + normal = { + background = bgc; + foreground = fgc; + backgroundAlt = bgc; + highlight = { + background = bgc; + foreground = acc; + }; + }; + }; + }; + font = fontComb; + separator = "none"; + terminal = pkgBin "alacritty"; + }; + waybar = + let + swayEnabled = config.wayland.windowManager.sway.enable; + in + { + enable = swayEnabled || config.wayland.windowManager.hikari.enable; + settings = [{ + layer = "top"; + position = "top"; + modules-left = if swayEnabled then [ "sway/workspaces" ] else [ ]; + modules-center = if swayEnabled then [ "sway/window" ] else [ ]; + modules-right = + [ "pulseaudio" "cpu" "memory" "temperature" "clock" "tray" ]; + modules = { + "tray" = { spacing = 8; }; + "cpu" = { format = "/cpu {usage}/"; }; + "memory" = { format = "/mem {}/"; }; + "temperature" = { + hwmon-path = "/sys/class/hwmon/hwmon1/temp2_input"; + format = "/tmp {temperatureC}C/"; + }; + "pulseaudio" = { + format = "/vol {volume}/ {format_source}"; + format-bluetooth = "/volb {volume}/ {format_source}"; + format-bluetooth-muted = "/volb/ {format_source}"; + format-muted = "/vol/ {format_source}"; + format-source = "/mic {volume}/"; + format-source-muted = "/mic/"; + }; + }; + }]; + style = + let + makeBorder = color: "border-bottom: 3px solid #${color};"; + makeInfo = color: '' + color: #${color}; + ${makeBorder color} + ''; + + clockColor = colorScheme.bright.magenta; + cpuColor = colorScheme.bright.green; + memColor = colorScheme.bright.blue; + pulseColor = { + normal = colorScheme.bright.cyan; + muted = colorScheme.bright.gray; + }; + tmpColor = { + normal = colorScheme.bright.yellow; + critical = colorScheme.bright.red; + }; + in + '' + * { + border: none; + border-radius: 0; + /* `otf-font-awesome` is required to be installed for icons */ + font-family: ${font}; + font-size: 13px; + min-height: 0; + } + + window#waybar { + background-color: #${bgColor}; + /* border-bottom: 0px solid rgba(100, 114, 125, 0.5); */ + color: #${fgColor}; + transition-property: background-color; + transition-duration: .5s; + } + + #workspaces button { + padding: 0 5px; + background-color: transparent; + color: #${fgColor}; + border-bottom: 3px solid transparent; + } + + /* https://github.com/Alexays/Waybar/wiki/FAQ#the-workspace-buttons-have-a-strange-hover-effect */ + #workspaces button:hover { + background: rgba(0, 0, 0, 0.2); + box-shadow: inherit; + border-bottom: 3px solid #ffffff; + } + + #workspaces button.focused { + border-bottom: 3px solid #${acColor}; + } + + #workspaces button.urgent { + background-color: #${acColor}; + color: #${bgColor}; + } + + #mode { + background-color: #64727D; + border-bottom: 3px solid #ffffff; + } + + #clock, + #battery, + #cpu, + #memory, + #temperature, + #backlight, + #network, + #pulseaudio, + #custom-media, + #tray, + #mode, + #idle_inhibitor, + #mpd { + padding: 0 10px; + margin: 0 4px; + background-color: transparent; + ${makeInfo fgColor} + } + + label:focus { + color: #000000; + } + + #clock { + ${makeInfo clockColor} + } + + #cpu { + ${makeInfo cpuColor} + } + + #memory { + ${makeInfo memColor} + } + + #pulseaudio { + ${makeInfo pulseColor.normal} + } + + #pulseaudio.muted { + ${makeInfo pulseColor.muted} + } + + #temperature { + ${makeInfo tmpColor.normal} + } + + #temperature.critical { + ${makeInfo tmpColor.critical} + } + ''; + }; + vscode = { + enable = false; + package = pkgs.vscodium; + extensions = + let + mkExt = n: v: p: s: { name = n; version = v; publisher = p; sha256 = s; }; + in + (pkgs.vscode-utils.extensionsFromVscodeMarketplace [ + # Rust + (mkExt "rust-analyzer" "0.2.513" "matklad" "sha256-95B5AZkw4MigZ1XsnALzy9Th9U59SDLrGCpA1FYy6vQ=") + (mkExt "even-better-toml" "0.11.1" "tamasfe" "sha256-0JpOydgcEs9PR2wUiVT9cmp9OnLX01idt0/d9UE+VI4=") + (mkExt "crates" "0.5.7" "serayuzgur" "sha256-g0eobd8QlBgWOOhqQdJX1rsplBECryRC3+9Wg8yqKeA=") + # Nix + (mkExt "nix-env-selector" "1.0.4" "arrterian" "sha256-qsz8Gj9s68BIaia80p5lw3J0OFLU3/om4XPNwn69oDY=") + # Go + (mkExt "Go" "0.23.1" "golang" "sha256-+WGWGzCBNktZFyaupiUi9DwgTTfI3uUy9UmOiS8Js6k=") + # Flutter and dart + (mkExt "flutter" "3.20.0" "Dart-Code" "sha256-egnfhJrTn6JG0jxvwyQiXIcyfpdGs0IGVor1LKf6+wI=") + (mkExt "dart-code" "3.20.0" "Dart-Code" "sha256-HeTJHH22ltrlSQkxsw+3ktO2Zvt1n+LKHeHx3rAHEL0=") + # protobuf + (mkExt "vscode-proto3" "0.5.3" "zxh404" "sha256-oUSih+YdAXYkTNejZBJjcXewQewgQFMGhAFdJ/CBMd4=") + # git + (mkExt "gitlens" "11.3.0" "eamodio" "sha256-m2Zn+e6hj59SujcW5ptdrYDrc4CviZ4wyCndO2BhyF8=") + (mkExt "vscode-commitizen" "0.12.1" "KnisterPeter" "sha256-TpfRzePDeXQlSMmjRhphN3XXTc+pp92JySZoe6ltxZg=") + # Customization + # (mkExt "dance" "0.3.2" "gregoire" "sha256-+g8EXeCkPOPvZ60JoXkGTeSXYWrXmKrcbUaEfDppdgA=") + (mkExt "material-icon-theme" "4.4.0" "PKief" "sha256-yiM+jtc7UW8PQTwmHmXHSSmvYC73GLh/cLYnmYqONdU=") + (mkExt "github-vscode-theme" "1.1.5" "github" "sha256-EPAJjM4CbR8MhV+3pm6mC12KzSt2Em6pT+c2HknNntI=") + (mkExt "koka" "0.0.1" "maelvalais" "sha256-ty8Mql19HgUWForggeZuHQpzTbmmB/eBFHqof5ZMKr0=") + ]) ++ (with pkgs.vscode-extensions; [ a5huynh.vscode-ron vadimcn.vscode-lldb jnoortheen.nix-ide ]); + userSettings = { + "workbench.iconTheme" = "material-icon-theme"; + "workbench.colorTheme" = "GitHub Dark"; + "rust-analyzer.cargo.allFeatures" = true; + "rust-analyzer.cargo.loadOutDirsFromCheck" = true; + "rust-analyzer.procMacro.enable" = true; + "editor.fontFamily" = "'${font}'"; + "debug.console.fontFamily" = "${font}"; + "debug.console.fontSize" = 12; + "terminal.integrated.fontSize" = 12; + "go.useLanguageServer" = true; + "rust-analyzer.checkOnSave.command" = "clippy"; + }; + }; + }; + + services = { + gpg-agent = + let + defaultCacheTtl = 3600 * 6; + maxCacheTtl = 3600 * 24; + in + { + inherit defaultCacheTtl maxCacheTtl; + + enable = true; + enableSshSupport = true; + sshKeys = [ "8369D9CA26C3EAAAB8302A88CEE6FD14B58AA965" ]; + defaultCacheTtlSsh = defaultCacheTtl; + maxCacheTtlSsh = maxCacheTtl; + grabKeyboardAndMouse = false; + pinentryFlavor = "qt"; + }; + }; + + xdg = { + enable = true; + configFile = { + "kak/user/kakrc".text = '' + source "%val{config}/user/color/colorscheme.kak" + ''; + "kak/user/color/colorscheme.kak".text = '' + evaluate-commands %sh{ + fg="rgb:${colorScheme.primary.normal.foreground}" + bg="rgb:${colorScheme.primary.normal.background}" + br_fg="rgb:${colorScheme.primary.bright.foreground}" + br_bg="rgb:${colorScheme.primary.bright.background}" + + red="rgb:${colorScheme.normal.red}" + green="rgb:${colorScheme.normal.green}" + yellow="rgb:${colorScheme.normal.yellow}" + blue="rgb:${colorScheme.normal.blue}" + magenta="rgb:${colorScheme.normal.magenta}" + cyan="rgb:${colorScheme.normal.cyan}" + + br_red="rgb:${colorScheme.bright.red}" + br_green="rgb:${colorScheme.bright.green}" + br_yellow="rgb:${colorScheme.bright.yellow}" + br_blue="rgb:${colorScheme.bright.blue}" + br_magenta="rgb:${colorScheme.bright.magenta}" + br_cyan="rgb:${colorScheme.bright.cyan}" + + echo " + set-face global value $yellow+b + set-face global type $br_yellow + set-face global variable $magenta + set-face global module $blue + set-face global function $br_cyan + set-face global string $br_green + set-face global keyword $br_red+b + set-face global operator $br_cyan + set-face global attribute $yellow + set-face global comment $fg + set-face global meta $br_yellow + set-face global builtin $br_fg+b + + set-face global title $blue+u + set-face global header $br_cyan+u + set-face global bold $br_fg+b + set-face global italic $br_fg+i + set-face global mono $br_green + set-face global block $yellow + set-face global link $blue + set-face global bullet $br_magenta + set-face global list $magenta + + set-face global Default $br_fg,$bg + set-face global PrimarySelection $bg,$br_fg + set-face global SecondarySelection $br_fg,$br_bg+i + set-face global PrimaryCursor $bg,$red+b + set-face global SecondaryCursor $bg,$br_cyan+i + set-face global MatchingChar $bg,$blue + set-face global Search $br_fg,$green + set-face global CurrentWord $br_fg,$blue + + set-face global MenuForeground $cyan,$br_bg+b + set-face global MenuBackground $br_fg,$bg + + set-face global Information $br_yellow,$bg + set-face global Error $br_bg,$br_red + + set-face global BufferPadding $bg,$bg + set-face global Whitespace $bg + set-face global StatusLine $br_fg,$bg + set-face global StatusLineInfo $yellow,$bg + + set-face global LineNumbers default + set-face global LineNumberCursor default,default+r + " + } + ''; + "kak-lsp/kak-lsp.toml".text = '' + snippet_support = true + verbosity = 2 + + [semantic_scopes] + variable = "variable" + entity_name_function = "function" + entity_name_type = "type" + variable_other_enummember = "variable" + entity_name_namespace = "module" + + [semantic_tokens] + type = "type" + variable = "variable" + namespace = "module" + function = "function" + string = "string" + keyword = "keyword" + operator = "operator" + comment = "comment" + + [semantic_modifiers] + documentation = "documentation" + readonly = "default+d" + + [server] + timeout = 1800 + + [language.rust] + filetypes = ["rust"] + roots = ["Cargo.toml"] + command = "${pkgBin "rust-analyzer"}" + + [language.nix] + filetypes = ["nix"] + roots = ["flake.nix", "shell.nix", ".git"] + command = "${pkgBin "rnix-lsp"}" + ''; + "nixpkgs/config.nix".text = '' + { + android_sdk.accept_license = true; + allowUnfree = true; + } + ''; + } // kideFiles; + }; + }; } diff --git a/users/patriot/home.nix b/users/patriot/home.nix deleted file mode 100644 index 62d8d8c..0000000 --- a/users/patriot/home.nix +++ /dev/null @@ -1,939 +0,0 @@ -{ config, lib, pkgs, util, ... }: -let - inherit (lib) mapAttrs' nameValuePair; - inherit (builtins) readDir; - inherit (util) pkgBin; - - nixosConfig = config; - - name = "Yusuf Bera Ertan"; - email = "y.bera003.06@protonmail.com"; - - font = "Iosevka Term"; - fontSize = 10; - fontComb = "${font} ${toString fontSize}"; - fontPackage = pkgs.iosevka; - - kideSrc = builtins.fetchGit { - url = "https://gitlab.com/yusdacra/kide.git"; - rev = "778d68df0cfcb96d6113bfe6a59e5dfc71ee7d82"; - submodules = true; - }; - kideFiles = - mapAttrs' (n: _: nameValuePair "kak/${n}" { source = "${kideSrc}/${n}"; }) - (readDir kideSrc); - kideDeps = with pkgs; [ - fzf - bat - ripgrep - universal-ctags - kak-lsp - wl-clipboard - xclip - shellcheck - perl - socat - gdb - kcr - jq - file - ]; - - chromiumWayland = - let - flags = [ - "--enable-features=UseOzonePlatform" - "--ozone-platform=wayland" - "--enable-vulkan" - "--enable-webrtc-pipewire-capturer" - "--ignore-gpu-blocklist" - "--enable-gpu-rasterization" - "--enable-zero-copy" - "--disable-gpu-driver-bug-workarounds" - ]; - in - pkgs.writeScriptBin "chromium-wayland" '' - #!${pkgs.stdenv.shell} - chromium ${lib.concatStringsSep " " flags} - ''; - chromiumWaylandPkg = with pkgs; - let name = "chromium-wayland"; in - stdenv.mkDerivation { - pname = name; - version = chromium.version; - - nativeBuildInputs = [ copyDesktopItems ]; - desktopItems = [ - (makeDesktopItem { - inherit name; - exec = name; - desktopName = "Chromium Wayland"; - genericName = "Web Browser"; - }) - ]; - - phases = [ "installPhase" ]; - installPhase = '' - mkdir -p $out/bin - ln -s ${chromiumWayland}/bin/chromium-wayland $out/bin/chromium-wayland - ''; - }; - - colorSchemeLight = { - primary = { - normal = { - background = "fbf3db"; - foreground = "53676d"; - }; - bright = { - background = "d5cdb6"; - foreground = "3a4d53"; - }; - }; - normal = { - black = "ece3cc"; - gray = "5b5b5b"; - red = "d2212d"; - green = "489100"; - yellow = "ad8900"; - blue = "0072d4"; - magenta = "ca4898"; - cyan = "009c8f"; - white = "909995"; - }; - bright = { - black = "d5cdb6"; - gray = "7b7b7b"; - red = "cc1729"; - green = "428b00"; - yellow = "a78300"; - blue = "006dce"; - magenta = "c44392"; - cyan = "00978a"; - white = "3a4d53"; - }; - }; - - colorSchemeDark = - let - normal = { - black = "252525"; - gray = "5b5b5b"; - red = "ed4a46"; - green = "70b433"; - yellow = "dbb32d"; - blue = "368aeb"; - magenta = "eb6eb7"; - cyan = "3fc5b7"; - white = "777777"; - }; - bright = { - black = "3b3b3b"; - gray = "7b7b7b"; - red = "ff5e56"; - green = "83c746"; - yellow = "efc541"; - blue = "4f9cfe"; - magenta = "ff81ca"; - cyan = "56d8c9"; - white = "dedede"; - }; - in - { - inherit normal bright; - - primary = { - normal = { - background = "181818"; - foreground = "b9b9b9"; - }; - bright = { - background = bright.black; - foreground = bright.white; - }; - }; - }; - - colorScheme = - # if builtins.pathExists ./light then colorSchemeLight else colorSchemeDark; - colorSchemeDark; - - bgColor = colorScheme.primary.normal.background; - fgColor = colorScheme.primary.bright.foreground; - acColor = colorScheme.normal.yellow; - acColor2 = colorScheme.normal.magenta; - - alacrittyColors = { - primary = { - background = "0x${bgColor}"; - foreground = "0x${fgColor}"; - }; - normal = lib.mapAttrs (_: v: "0x${v}") colorScheme.normal; - bright = lib.mapAttrs (_: v: "0x${v}") colorScheme.bright; - }; - - # sway attrs reused - focusedWorkspace = { - background = "#${bgColor}"; - border = "#${acColor}"; - text = "#${acColor}"; - }; - activeWorkspace = { - background = "#${bgColor}"; - border = "#${colorScheme.primary.bright.background}"; - text = "#${fgColor}"; - }; - inactiveWorkspace = { - background = "#${bgColor}"; - border = "#${bgColor}"; - text = "#${fgColor}"; - }; - urgentWorkspace = { - background = "#${bgColor}"; - border = "#${acColor2}"; - text = "#${acColor2}"; - }; - addIndSway = x: { - background = x.background; - border = x.border; - childBorder = x.border; - text = x.text; - indicator = "#111111"; # don't care - }; - fonts = [ fontComb ]; - - extraEnv = '' - # export SDL_VIDEODRIVER=wayland - # needs qt5.qtwayland in systemPackages - export QT_QPA_PLATFORM=wayland - export QT_WAYLAND_DISABLE_WINDOWDECORATION="1" - # Fix for some Java AWT applications (e.g. Android Studio), - # use this if they aren't displayed properly: - export _JAVA_AWT_WM_NONREPARENTING=1 - export QT_QPA_PLATFORMTHEME=qt5ct - export QT_PLATFORM_PLUGIN=qt5ct - ''; -in -{ - home-manager.users.patriot = { config, pkgs, ... }: { - imports = [ ../profiles/hikari.nix ]; - - # needs to be fixed to use nix profile??? - /*gtk = { - enable = false; - font = { - package = pkgs.dejavu_fonts; - name = "DejaVu Sans 12"; - }; - iconTheme = { - package = pkgs.papirus-icon-theme; - name = "Papirus Dark"; - }; - theme = { - package = pkgs.numix-gtk-theme; - name = "Numix Dark"; - }; - }; - - qt = { - enable = false; - style = { - package = pkgs.adwaita-qt; - name = "adwaita-dark"; - }; - };*/ - - fonts.fontconfig.enable = true; - home = { - homeDirectory = nixosConfig.users.users.patriot.home; - packages = with pkgs; - [ - # Font stuff - fontPackage - noto-fonts-cjk - noto-fonts-emoji-blob-bin - font-awesome - (nerdfonts.override { fonts = [ "Iosevka" ]; }) - # Programs - discord - ripcord - audacity - krita - gimp - kdenlive - gnome3.seahorse - gnome3.gnome-boxes - wine-staging - cachix - chromiumWaylandPkg - appimage-run - bitwarden - pfetch - neofetch - gnupg - imv - mpv - youtube-dl - ffmpeg - mupdf - transmission-qt - steam-run - lutris - xdg_utils - tagref - libreoffice-fresh - mako - hydrus - musikcube - qt5ct - phantomstyle - papirus-icon-theme - pcmanfm-qt - ] ++ kideDeps; - }; - - wayland.windowManager = { - hikari = { - enable = false; - inherit font; - }; - sway = { - enable = true; - extraSessionCommands = extraEnv; - wrapperFeatures.gtk = true; - config = { - inherit fonts; - bars = [{ - command = "${pkgBin "waybar"}"; - }]; - colors = { - background = "#${bgColor}"; - focused = addIndSway focusedWorkspace; - focusedInactive = addIndSway inactiveWorkspace; - unfocused = addIndSway activeWorkspace; - urgent = addIndSway urgentWorkspace; - }; - gaps.smartBorders = "on"; - menu = "${pkgBin "rofi"} -show drun | ${pkgs.sway}/bin/swaymsg --"; - modifier = "Mod4"; - terminal = pkgBin "alacritty"; - keybindings = - let - mod = config.wayland.windowManager.sway.config.modifier; - cat = pkgs.coreutils + "/bin/cat"; - grim = pkgBin "grim"; - slurp = pkgBin "slurp"; - pactl = pkgs.pulseaudio + "/bin/pactl"; - playerctl = pkgBin "playerctl"; - wf-recorder = pkgBin "wf-recorder"; - wl-copy = pkgs.wl-clipboard + "/bin/wl-copy"; - wl-paste = pkgs.wl-clipboard + "/bin/wl-paste"; - shotFile = config.home.homeDirectory - + "/shots/shot_$(date '+%Y_%m_%d_%H_%M')"; - in - lib.mkOptionDefault { - "${mod}+q" = "kill"; - "${mod}+Shift+e" = "exit"; - "${mod}+Shift+r" = "reload"; - # Screenshot and copy it to clipboard - "Mod1+s" = '' - exec export SFILE="${shotFile}.png" && ${grim} "$SFILE" && ${cat} "$SFILE" | ${wl-copy} -t image/png - ''; - # Save selected area as a picture and copy it to clipboard - "Mod1+Shift+s" = '' - exec export SFILE="${shotFile}.png" && ${grim} -g "$(${slurp})" "$SFILE" && ${cat} "$SFILE" | ${wl-copy} -t image/png - ''; - # Record screen - "Mod1+r" = ''exec ${wf-recorder} -f "${shotFile}.mp4"''; - # Record an area - "Mod1+Shift+r" = - ''exec ${wf-recorder} -g "$(${slurp})" -f "${shotFile}.mp4"''; - # Stop recording - "Mod1+c" = "exec pkill -INT wf-recorder"; - "XF86AudioRaiseVolume" = "exec ${pactl} set-sink-volume 0 +5%"; - "XF86AudioLowerVolume" = "exec ${pactl} set-sink-volume 0 -5%"; - "XF86AudioMute" = "exec ${pactl} set-sink-mute 0 toggle"; - "XF86AudioPlay" = "exec ${playerctl} play-pause"; - "XF86AudioPrev" = "exec ${playerctl} previous"; - "XF86AudioNext" = "exec ${playerctl} next"; - "XF86AudioStop" = "exec ${playerctl} stop"; - }; - input = { - "*" = { - xkb_layout = nixosConfig.services.xserver.layout; - accel_profile = "flat"; - }; - }; - output = { - "*" = { - bg = config.home.homeDirectory + "/wallpaper.png" + " fill"; - }; - }; - }; - }; - }; - - programs = { - alacritty = { - enable = true; - settings = { - shell = { - program = "${pkgs.tmux}/bin/tmux"; - args = [ "attach" ]; - }; - font = { - normal = { family = font; }; - size = fontSize; - }; - colors = alacrittyColors; - }; - }; - tmux = { - enable = true; - newSession = true; - secureSocket = true; - baseIndex = 1; - escapeTime = 0; - keyMode = "vi"; - shortcut = "a"; - extraConfig = '' - set -g default-terminal "alacritty" - set -ga terminal-overrides ",alacritty:Tc" - set -g status off - ''; - }; - chromium = { - enable = true; - extensions = [ - "gcbommkclmclpchllfjekcdonpmejbdp" # https everywhere - "cjpalhdlnbpafiamejdnhcphjbkeiagm" # ublock - "nngceckbapebfimnlniiiahkandclblb" # bitwarden - "ldpochfccmkkmhdbclfhpagapcfdljkj" # decentraleyes - "annfbnbieaamhaimclajlajpijgkdblo" # dark theme - "eimadpbcbfnmbkopoojfekhnkhdbieeh" # dark reader - "hlepfoohegkhhmjieoechaddaejaokhf" # github refined - "pmcmeagblkinmogikoikkdjiligflglb" # privacy redirect - ]; - }; - qutebrowser = { - enable = false; - settings = { - content.javascript.enabled = false; - colors.webpage.darkmode.enabled = false; - tabs = { - show = "multiple"; - tabs_are_windows = true; - }; - }; - extraConfig = - let - domains = [ - "discord.com" - "github.com" - "gitlab.com" - "nixos.org" - "protonmail.com" - "bitwarden.com" - "duckduckgo.com" - "youtube.com" - "docker.com" - ]; - enableJsForDomain = d: '' - config.set('content.javascript.enabled', True, 'https://*.${d}') - ''; - in - '' - ${lib.concatStrings (map enableJsForDomain domains)} - ''; - }; - git = { - enable = true; - aliases = { - a = "add"; - b = "branch"; - c = "commit"; - d = "diff"; - l = "log"; - s = "status"; - co = "checkout"; - dc = "diff --cached"; - qc = "commit -am"; - pl = "pull"; - ps = "push"; - rb = "rebase"; - rs = "restore"; - rv = "revert"; - ss = "stash"; - rst = "reset"; - rss = "restore --staged"; - ssp = "stash pop"; - ssl = "stash list"; - ssd = "stash drop"; - }; - extraConfig = { pull.rebase = true; }; - lfs.enable = true; - signing = { - key = "E1C119F91F4CAE53E8445CAFBB57FCE7E35984F6"; - signByDefault = true; - }; - userName = name; - userEmail = email; - }; - ssh = { - enable = true; - compression = true; - hashKnownHosts = true; - userKnownHostsFile = "~/.local/share/ssh/known-hosts"; - # Only needed for darcs hub - # extraConfig = '' - # Host hub.darcs.net - # ControlMaster no - # ForwardAgent no - # ForwardX11 no - # Ciphers +aes256-cbc - # MACs +hmac-sha1 - # ''; - }; - zsh = { - enable = true; - autocd = true; - enableVteIntegration = true; - enableAutosuggestions = true; - enableCompletion = true; - plugins = - let - fast-syntax-highlighting = - let name = "fast-syntax-highlighting"; in - { - inherit name; - src = pkgs."zsh-${name}".out; - }; - per-directory-history = { - name = "per-directory-history"; - src = pkgs.fetchFromGitHub { - owner = "jimhester"; - repo = "per-directory-history"; - rev = "d2e291dd6434e340d9be0e15e1f5b94f32771c06"; - hash = "sha256-VHRgrVCqzILqOes8VXGjSgLek38BFs9eijmp0JHtD5Q="; - }; - }; - in - [ fast-syntax-highlighting per-directory-history ]; - # xdg compliant - dotDir = ".config/zsh"; - history.path = ".local/share/zsh/history"; - envExtra = extraEnv; - loginExtra = - '' - if [ "$(${pkgs.coreutils}/bin/tty)" = "/dev/tty1" ]; then - exec sway - fi - ''; - initExtra = '' - export TERM=alacritty - - function tomp4 () { - ${pkgs.ffmpeg}/bin/ffmpeg -i $1 -c:v libx264 -preset slow -crf 30 -c:a aac -b:a 128k "$1.mp4" - } - - function topng () { - ${pkgs.ffmpeg}/bin/ffmpeg -i $1 "$1.png" - } - - bindkey "$terminfo[kRIT5]" forward-word - bindkey "$terminfo[kLFT5]" backward-word - zstyle ':completion:*' menu select - - eval "$(zoxide init zsh)" - ''; - shellAliases = nixosConfig.environment.shellAliases // { - rember = '' - ${pkgs.kakoune-unwrapped}/bin/kak -e "try %(gtd-jump-today)" "${config.home.homeDirectory}/rember/stuff$(date '+_%m_%Y').gtd" - ''; - }; - }; - starship = { - enable = true; - settings = { - add_newline = false; - character.symbol = ">"; - directory = { - truncation_length = 2; - truncate_to_repo = false; - }; - }; - }; - direnv = { - enable = true; - enableNixDirenvIntegration = true; - }; - fzf.enable = true; - rofi = - let - bgc = "#${bgColor}"; - fgc = "#${fgColor}"; - acc = "#${acColor}"; - in - { - enable = true; - colors = { - window = { - background = bgc; - border = bgc; - separator = bgc; - }; - rows = { - normal = { - background = bgc; - foreground = fgc; - backgroundAlt = bgc; - highlight = { - background = bgc; - foreground = acc; - }; - }; - }; - }; - font = fontComb; - separator = "none"; - terminal = pkgBin "alacritty"; - }; - waybar = - let - swayEnabled = config.wayland.windowManager.sway.enable; - in - { - enable = swayEnabled || config.wayland.windowManager.hikari.enable; - settings = [{ - layer = "top"; - position = "top"; - modules-left = if swayEnabled then [ "sway/workspaces" ] else [ ]; - modules-center = if swayEnabled then [ "sway/window" ] else [ ]; - modules-right = - [ "pulseaudio" "cpu" "memory" "temperature" "clock" "tray" ]; - modules = { - "tray" = { spacing = 8; }; - "cpu" = { format = "/cpu {usage}/"; }; - "memory" = { format = "/mem {}/"; }; - "temperature" = { - hwmon-path = "/sys/class/hwmon/hwmon1/temp2_input"; - format = "/tmp {temperatureC}C/"; - }; - "pulseaudio" = { - format = "/vol {volume}/ {format_source}"; - format-bluetooth = "/volb {volume}/ {format_source}"; - format-bluetooth-muted = "/volb/ {format_source}"; - format-muted = "/vol/ {format_source}"; - format-source = "/mic {volume}/"; - format-source-muted = "/mic/"; - }; - }; - }]; - style = - let - makeBorder = color: "border-bottom: 3px solid #${color};"; - makeInfo = color: '' - color: #${color}; - ${makeBorder color} - ''; - - clockColor = colorScheme.bright.magenta; - cpuColor = colorScheme.bright.green; - memColor = colorScheme.bright.blue; - pulseColor = { - normal = colorScheme.bright.cyan; - muted = colorScheme.bright.gray; - }; - tmpColor = { - normal = colorScheme.bright.yellow; - critical = colorScheme.bright.red; - }; - in - '' - * { - border: none; - border-radius: 0; - /* `otf-font-awesome` is required to be installed for icons */ - font-family: ${font}; - font-size: 13px; - min-height: 0; - } - - window#waybar { - background-color: #${bgColor}; - /* border-bottom: 0px solid rgba(100, 114, 125, 0.5); */ - color: #${fgColor}; - transition-property: background-color; - transition-duration: .5s; - } - - #workspaces button { - padding: 0 5px; - background-color: transparent; - color: #${fgColor}; - border-bottom: 3px solid transparent; - } - - /* https://github.com/Alexays/Waybar/wiki/FAQ#the-workspace-buttons-have-a-strange-hover-effect */ - #workspaces button:hover { - background: rgba(0, 0, 0, 0.2); - box-shadow: inherit; - border-bottom: 3px solid #ffffff; - } - - #workspaces button.focused { - border-bottom: 3px solid #${acColor}; - } - - #workspaces button.urgent { - background-color: #${acColor}; - color: #${bgColor}; - } - - #mode { - background-color: #64727D; - border-bottom: 3px solid #ffffff; - } - - #clock, - #battery, - #cpu, - #memory, - #temperature, - #backlight, - #network, - #pulseaudio, - #custom-media, - #tray, - #mode, - #idle_inhibitor, - #mpd { - padding: 0 10px; - margin: 0 4px; - background-color: transparent; - ${makeInfo fgColor} - } - - label:focus { - color: #000000; - } - - #clock { - ${makeInfo clockColor} - } - - #cpu { - ${makeInfo cpuColor} - } - - #memory { - ${makeInfo memColor} - } - - #pulseaudio { - ${makeInfo pulseColor.normal} - } - - #pulseaudio.muted { - ${makeInfo pulseColor.muted} - } - - #temperature { - ${makeInfo tmpColor.normal} - } - - #temperature.critical { - ${makeInfo tmpColor.critical} - } - ''; - }; - vscode = { - enable = false; - package = pkgs.vscodium; - extensions = - let - mkExt = n: v: p: s: { name = n; version = v; publisher = p; sha256 = s; }; - in - (pkgs.vscode-utils.extensionsFromVscodeMarketplace [ - # Rust - (mkExt "rust-analyzer" "0.2.513" "matklad" "sha256-95B5AZkw4MigZ1XsnALzy9Th9U59SDLrGCpA1FYy6vQ=") - (mkExt "even-better-toml" "0.11.1" "tamasfe" "sha256-0JpOydgcEs9PR2wUiVT9cmp9OnLX01idt0/d9UE+VI4=") - (mkExt "crates" "0.5.7" "serayuzgur" "sha256-g0eobd8QlBgWOOhqQdJX1rsplBECryRC3+9Wg8yqKeA=") - # Nix - (mkExt "nix-env-selector" "1.0.4" "arrterian" "sha256-qsz8Gj9s68BIaia80p5lw3J0OFLU3/om4XPNwn69oDY=") - # Go - (mkExt "Go" "0.23.1" "golang" "sha256-+WGWGzCBNktZFyaupiUi9DwgTTfI3uUy9UmOiS8Js6k=") - # Flutter and dart - (mkExt "flutter" "3.20.0" "Dart-Code" "sha256-egnfhJrTn6JG0jxvwyQiXIcyfpdGs0IGVor1LKf6+wI=") - (mkExt "dart-code" "3.20.0" "Dart-Code" "sha256-HeTJHH22ltrlSQkxsw+3ktO2Zvt1n+LKHeHx3rAHEL0=") - # protobuf - (mkExt "vscode-proto3" "0.5.3" "zxh404" "sha256-oUSih+YdAXYkTNejZBJjcXewQewgQFMGhAFdJ/CBMd4=") - # git - (mkExt "gitlens" "11.3.0" "eamodio" "sha256-m2Zn+e6hj59SujcW5ptdrYDrc4CviZ4wyCndO2BhyF8=") - (mkExt "vscode-commitizen" "0.12.1" "KnisterPeter" "sha256-TpfRzePDeXQlSMmjRhphN3XXTc+pp92JySZoe6ltxZg=") - # Customization - # (mkExt "dance" "0.3.2" "gregoire" "sha256-+g8EXeCkPOPvZ60JoXkGTeSXYWrXmKrcbUaEfDppdgA=") - (mkExt "material-icon-theme" "4.4.0" "PKief" "sha256-yiM+jtc7UW8PQTwmHmXHSSmvYC73GLh/cLYnmYqONdU=") - (mkExt "github-vscode-theme" "1.1.5" "github" "sha256-EPAJjM4CbR8MhV+3pm6mC12KzSt2Em6pT+c2HknNntI=") - (mkExt "koka" "0.0.1" "maelvalais" "sha256-ty8Mql19HgUWForggeZuHQpzTbmmB/eBFHqof5ZMKr0=") - ]) ++ (with pkgs.vscode-extensions; [ a5huynh.vscode-ron vadimcn.vscode-lldb jnoortheen.nix-ide ]); - userSettings = { - "workbench.iconTheme" = "material-icon-theme"; - "workbench.colorTheme" = "GitHub Dark"; - "rust-analyzer.cargo.allFeatures" = true; - "rust-analyzer.cargo.loadOutDirsFromCheck" = true; - "rust-analyzer.procMacro.enable" = true; - "editor.fontFamily" = "'${font}'"; - "debug.console.fontFamily" = "${font}"; - "debug.console.fontSize" = 12; - "terminal.integrated.fontSize" = 12; - "go.useLanguageServer" = true; - "rust-analyzer.checkOnSave.command" = "clippy"; - }; - }; - }; - - services = { - gpg-agent = - let - defaultCacheTtl = 3600 * 6; - maxCacheTtl = 3600 * 24; - in - { - inherit defaultCacheTtl maxCacheTtl; - - enable = true; - enableSshSupport = true; - sshKeys = [ "8369D9CA26C3EAAAB8302A88CEE6FD14B58AA965" ]; - defaultCacheTtlSsh = defaultCacheTtl; - maxCacheTtlSsh = maxCacheTtl; - grabKeyboardAndMouse = false; - pinentryFlavor = "qt"; - }; - }; - - xdg = { - enable = true; - configFile = { - "kak/user/kakrc".text = '' - source "%val{config}/user/color/colorscheme.kak" - ''; - "kak/user/color/colorscheme.kak".text = '' - evaluate-commands %sh{ - fg="rgb:${colorScheme.primary.normal.foreground}" - bg="rgb:${colorScheme.primary.normal.background}" - br_fg="rgb:${colorScheme.primary.bright.foreground}" - br_bg="rgb:${colorScheme.primary.bright.background}" - - red="rgb:${colorScheme.normal.red}" - green="rgb:${colorScheme.normal.green}" - yellow="rgb:${colorScheme.normal.yellow}" - blue="rgb:${colorScheme.normal.blue}" - magenta="rgb:${colorScheme.normal.magenta}" - cyan="rgb:${colorScheme.normal.cyan}" - - br_red="rgb:${colorScheme.bright.red}" - br_green="rgb:${colorScheme.bright.green}" - br_yellow="rgb:${colorScheme.bright.yellow}" - br_blue="rgb:${colorScheme.bright.blue}" - br_magenta="rgb:${colorScheme.bright.magenta}" - br_cyan="rgb:${colorScheme.bright.cyan}" - - echo " - set-face global value $yellow+b - set-face global type $br_yellow - set-face global variable $magenta - set-face global module $blue - set-face global function $br_cyan - set-face global string $br_green - set-face global keyword $br_red+b - set-face global operator $br_cyan - set-face global attribute $yellow - set-face global comment $fg - set-face global meta $br_yellow - set-face global builtin $br_fg+b - - set-face global title $blue+u - set-face global header $br_cyan+u - set-face global bold $br_fg+b - set-face global italic $br_fg+i - set-face global mono $br_green - set-face global block $yellow - set-face global link $blue - set-face global bullet $br_magenta - set-face global list $magenta - - set-face global Default $br_fg,$bg - set-face global PrimarySelection $bg,$br_fg - set-face global SecondarySelection $br_fg,$br_bg+i - set-face global PrimaryCursor $bg,$red+b - set-face global SecondaryCursor $bg,$br_cyan+i - set-face global MatchingChar $bg,$blue - set-face global Search $br_fg,$green - set-face global CurrentWord $br_fg,$blue - - set-face global MenuForeground $cyan,$br_bg+b - set-face global MenuBackground $br_fg,$bg - - set-face global Information $br_yellow,$bg - set-face global Error $br_bg,$br_red - - set-face global BufferPadding $bg,$bg - set-face global Whitespace $bg - set-face global StatusLine $br_fg,$bg - set-face global StatusLineInfo $yellow,$bg - - set-face global LineNumbers default - set-face global LineNumberCursor default,default+r - " - } - ''; - "kak-lsp/kak-lsp.toml".text = '' - snippet_support = true - verbosity = 2 - - [semantic_scopes] - variable = "variable" - entity_name_function = "function" - entity_name_type = "type" - variable_other_enummember = "variable" - entity_name_namespace = "module" - - [semantic_tokens] - type = "type" - variable = "variable" - namespace = "module" - function = "function" - string = "string" - keyword = "keyword" - operator = "operator" - comment = "comment" - - [semantic_modifiers] - documentation = "documentation" - readonly = "default+d" - - [server] - timeout = 1800 - - [language.rust] - filetypes = ["rust"] - roots = ["Cargo.toml"] - command = "${pkgBin "rust-analyzer"}" - - [language.nix] - filetypes = ["nix"] - roots = ["flake.nix", "shell.nix", ".git"] - command = "${pkgBin "rnix-lsp"}" - ''; - "nix/nix.conf".text = nixosConfig.nix.extraOptions; - "nixpkgs/config.nix".text = '' - { - android_sdk.accept_license = true; - allowUnfree = true; - } - ''; - } // kideFiles; - }; - }; -}