From c7c11e2780994aaf6d258aecbac4770e02c6769a Mon Sep 17 00:00:00 2001 From: Yusuf Bera Ertan Date: Fri, 18 Feb 2022 20:31:01 +0300 Subject: [PATCH] stuff --- bud/default.nix | 23 +- default.nix | 36 +- flake.lock | 168 ++--- flake.nix | 187 +++--- hosts/NixOS.nix | 8 +- hosts/bootstrap.nix | 10 +- hosts/lungmen.nix | 239 ++++--- lib/compat/default.nix | 13 +- lib/compat/nixos/default.nix | 3 +- lib/default.nix | 11 +- lib/html.nix | 41 +- locale/default.nix | 5 +- modules/hm-system-defaults.nix | 13 +- modules/nix-path.nix | 13 +- modules/security/mitigations.nix | 47 +- overlays/chromium-wayland.nix | 12 +- overlays/discord-canary-system.nix | 390 +++++------ overlays/discord-canary.nix | 53 +- overlays/manix.nix | 6 +- overlays/overrides.nix | 3 +- overlays/phantom.nix | 45 +- overlays/various-flake-fixes.nix | 6 +- overlays/vscode-wayland.nix | 73 +- pkgs/_sources/generated.nix | 23 +- pkgs/default.nix | 2 +- profiles/cachix/default.nix | 11 +- profiles/cachix/harmony.nix | 8 +- profiles/cachix/nix-cargo-integration.nix | 8 +- profiles/cachix/nix-community.nix | 8 +- profiles/cachix/nixpkgs-wayland.nix | 8 +- profiles/cachix/nrdxp.nix | 8 +- profiles/cachix/veloren-nix.nix | 8 +- profiles/core/default.nix | 215 +++--- profiles/develop/default.nix | 12 +- profiles/develop/editor/default.nix | 13 +- profiles/develop/editor/helix.nix | 12 +- profiles/develop/editor/kakoune.nix | 12 +- profiles/develop/godot.nix | 12 +- profiles/network/default.nix | 12 +- profiles/network/dns/default.nix | 3 +- profiles/network/dns/nextdns.nix | 5 +- profiles/network/dns/stubby/default.nix | 3 +- profiles/network/dns/stubby/nextdns.nix | 6 +- profiles/network/iwd.nix | 3 +- profiles/network/networkmanager/default.nix | 3 +- profiles/network/wpa_supplicant.nix | 3 +- secrets/secrets.nix | Bin 287 -> 289 bytes shell/default.nix | 18 +- shell/devos.nix | 97 ++- shell/hooks/default.nix | 2 +- users/nixos/default.nix | 2 +- users/patriot/default.nix | 709 +++++++++++--------- users/profiles/git/default.nix | 9 +- users/profiles/hikari/default.nix | 370 +++++----- users/profiles/starship/default.nix | 3 +- users/profiles/wtf/default.nix | 8 +- 56 files changed, 1546 insertions(+), 1475 deletions(-) diff --git a/bud/default.nix b/bud/default.nix index c486636..018f1b0 100644 --- a/bud/default.nix +++ b/bud/default.nix @@ -1,10 +1,17 @@ -{ pkgs, lib, budUtils, ... }: { - bud.cmds = with pkgs; { - get = { - writer = budUtils.writeBashWithPaths [ nixUnstable git coreutils ]; - synopsis = "get [DEST]"; - help = "Copy the desired template to DEST"; - script = ./get.bash; +{ + pkgs, + lib, + budUtils, + ... +}: +{ + bud.cmds = + with pkgs; { + get = { + writer = budUtils.writeBashWithPaths [nixUnstable git coreutils]; + synopsis = "get [DEST]"; + help = "Copy the desired template to DEST"; + script = ./get.bash; + }; }; - }; } diff --git a/default.nix b/default.nix index 0e6bdee..02ef261 100644 --- a/default.nix +++ b/default.nix @@ -1,31 +1,17 @@ let inherit (default.inputs.nixos) lib; - default = (import ./lib/compat).defaultNix; - - ciSystems = [ - "aarch64-linux" - "i686-linux" - "x86_64-linux" - ]; - - filterSystems = lib.filterAttrs - (system: _: lib.elem system ciSystems); - - recurseIntoAttrsRecursive = lib.mapAttrs (_: v: - if lib.isAttrs v - then recurseIntoAttrsRecursive (lib.recurseIntoAttrs v) - else v - ); - - systemOutputs = lib.filterAttrs - (name: set: lib.isAttrs set - && lib.any - (system: set ? ${system} && name != "legacyPackages") - ciSystems - ) + ciSystems = ["aarch64-linux" "i686-linux" "x86_64-linux"]; + filterSystems = lib.filterAttrs (system: _: lib.elem system ciSystems); + recurseIntoAttrsRecursive = + lib.mapAttrs (_: v: + if lib.isAttrs v + then recurseIntoAttrsRecursive (lib.recurseIntoAttrs v) + else v); + systemOutputs = + lib.filterAttrs + (name: set: lib.isAttrs set && lib.any (system: set ? ${system} && name != "legacyPackages") ciSystems) default.outputs; - ciDrvs = lib.mapAttrs (_: system: filterSystems system) systemOutputs; in -(recurseIntoAttrsRecursive ciDrvs) // { shell = import ./shell.nix; } + (recurseIntoAttrsRecursive ciDrvs) // { shell = import ./shell.nix; } diff --git a/flake.lock b/flake.lock index d4bbe82..9badba7 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,26 @@ { "nodes": { + "alejandra": { + "inputs": { + "flakeCompat": "flakeCompat", + "nixpkgs": [ + "nixos" + ] + }, + "locked": { + "lastModified": 1645204343, + "narHash": "sha256-h/R5uZwiCPh/i8eOcGgAD1hRFF6gHvD1GYZxkKYXTaQ=", + "owner": "kamadorueda", + "repo": "alejandra", + "rev": "4a7a938e8d29a9a3b7f45660f0f7a3f6247965bf", + "type": "github" + }, + "original": { + "owner": "kamadorueda", + "repo": "alejandra", + "type": "github" + } + }, "blank": { "locked": { "lastModified": 1625557891, @@ -17,11 +38,11 @@ }, "cachix": { "locked": { - "lastModified": 1637798660, - "narHash": "sha256-MrPmoGeiOjlT17j3ZQx6iab07YVnomRiBFLcOCiCYnk=", + "lastModified": 1642244250, + "narHash": "sha256-vWpUEqQdVP4srj+/YLJRTN9vjpTs4je0cdWKXPbDItc=", "owner": "nixos", "repo": "nixpkgs", - "rev": "91e6a9a6568f751bb10222a937507e7e151a035e", + "rev": "0fd9ee1aa36ce865ad273f4f07fdc093adeb5c00", "type": "github" }, "original": { @@ -34,7 +55,10 @@ "deploy": { "inputs": { "flake-compat": "flake-compat", - "nixpkgs": "nixpkgs", + "nixpkgs": [ + "digga", + "latest" + ], "utils": "utils" }, "locked": { @@ -71,7 +95,6 @@ "blank": "blank", "deploy": "deploy", "devshell": "devshell", - "flake-utils": "flake-utils", "flake-utils-plus": "flake-utils-plus", "home-manager": [ "home" @@ -86,11 +109,11 @@ ] }, "locked": { - "lastModified": 1640031018, - "narHash": "sha256-ZzyS803XuCl99XE4581m0Suni+q1Hz+Mpw6A9bs7VKM=", + "lastModified": 1643510242, + "narHash": "sha256-9C9DyJhQ5bevk0CEEjGct+U9EqUgHg8T70nxz47zjMI=", "owner": "divnix", "repo": "digga", - "rev": "3157889810e51a1ae03f82bf6bf6657ba8cf93c6", + "rev": "33bfb05b8a148d8ad6a842de74e22209bf9fe5d7", "type": "github" }, "original": { @@ -133,34 +156,35 @@ }, "flake-utils-plus": { "inputs": { - "flake-utils": "flake-utils_2" + "flake-utils": "flake-utils" }, "locked": { - "lastModified": 1638994888, - "narHash": "sha256-iz/ynGNZlvqKCOnFrEKqGA+BVKGQMG+g2JT+e3OOLN8=", - "owner": "divnix", + "lastModified": 1639385028, + "narHash": "sha256-oqorKz3mwf7UuDJwlbCEYCB2LfcWLL0DkeCWhRIL820=", + "owner": "gytis-ivaskevicius", "repo": "flake-utils-plus", - "rev": "b4f9f517574cb7bd6ee3f19c72c19634c9f536e1", + "rev": "be1be083af014720c14f3b574f57b6173b4915d0", "type": "github" }, "original": { - "owner": "divnix", + "owner": "gytis-ivaskevicius", "repo": "flake-utils-plus", "type": "github" } }, - "flake-utils_2": { + "flakeCompat": { + "flake": false, "locked": { - "lastModified": 1638122382, - "narHash": "sha256-sQzZzAbvKEqN9s0bzWuYmRaA03v40gaJ4+iL1LXjaeI=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "74f7e4319258e287b0f9cb95426c9853b282730b", + "lastModified": 1641205782, + "narHash": "sha256-4jY7RCWUoZ9cKD8co0/4tFARpWB+57+r1bLLvXNJliY=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "b7547d3eed6f32d06102ead8991ec52ab0a4f1a7", "type": "github" }, "original": { - "owner": "numtide", - "repo": "flake-utils", + "owner": "edolstra", + "repo": "flake-compat", "type": "github" } }, @@ -171,11 +195,11 @@ ] }, "locked": { - "lastModified": 1640417317, - "narHash": "sha256-jT2uMARXs0Xm65ccroFsKyr4LTHSecw+9HAnmBdJO8U=", + "lastModified": 1645140957, + "narHash": "sha256-WTJzLSCDLBI537o2L/3kRyqEV5YRT7+1QSGryeKReHE=", "owner": "nix-community", "repo": "home-manager", - "rev": "48f2b381dd397ec88040d3354ac9c036739ba139", + "rev": "4f4165a8b9108818ab0193bbd1a252106870b2a2", "type": "github" }, "original": { @@ -223,11 +247,11 @@ }, "nixlib": { "locked": { - "lastModified": 1639874050, - "narHash": "sha256-S4lNc3fb9UpYgVtTa/mZZXphq7+xGy74YGIlOWB1ceE=", + "lastModified": 1641688481, + "narHash": "sha256-6L+EU12xLDHby7y8elgFtRKVBxix+7qV8DhVgXqrKZo=", "owner": "nix-community", "repo": "nixpkgs.lib", - "rev": "2762facc37b4f6f2bf61edc43dd63caef265f85a", + "rev": "f697717b3d3a074ffc16c8c8227504f0db292886", "type": "github" }, "original": { @@ -238,11 +262,11 @@ }, "nixos": { "locked": { - "lastModified": 1640319671, - "narHash": "sha256-ZkKmakwaOaLiZOpIZWbeJZwap5CzJ30s4UJTfydYIYc=", + "lastModified": 1644525281, + "narHash": "sha256-D3VuWLdnLmAXIkooWAtbTGSQI9Fc1lkvAr94wTxhnTU=", "owner": "nixos", "repo": "nixpkgs", - "rev": "eac07edbd20ed4908b98790ba299250b5527ecdf", + "rev": "48d63e924a2666baf37f4f14a18f19347fbd54a2", "type": "github" }, "original": { @@ -255,7 +279,10 @@ "nixos-generators": { "inputs": { "nixlib": "nixlib", - "nixpkgs": "nixpkgs_2" + "nixpkgs": [ + "digga", + "blank" + ] }, "locked": { "lastModified": 1637655461, @@ -273,11 +300,11 @@ }, "nixos-hardware": { "locked": { - "lastModified": 1639986101, - "narHash": "sha256-Ow0+pkY7qMw6lMAvR1mEdUT9svJnrkbaRoqp4bkMTpg=", + "lastModified": 1644870092, + "narHash": "sha256-RLPD92lqXW98LDIbbwYqwAbt3R4iD1V1PiylfgBq5cU=", "owner": "nixos", "repo": "nixos-hardware", - "rev": "3f92db38374b2977aea8daf4c4fe2fa0eddbd60c", + "rev": "10eab1c4cd8e715c0b41d32c28af2b89fc67bed0", "type": "github" }, "original": { @@ -288,11 +315,11 @@ }, "nixosPersistence": { "locked": { - "lastModified": 1638981861, - "narHash": "sha256-rDEn/hU9ayDig2HMYKN71InhY1LV5slxp9Zy2iPBysQ=", + "lastModified": 1644791231, + "narHash": "sha256-iDihsF1fUMK4xXiUudPnDM3veH1LXbbxfP9Lzekw9iU=", "owner": "nix-community", "repo": "impermanence", - "rev": "df5038f20c9efd442944fe26b93f41c0dc5217da", + "rev": "635bcd2d88739197a0b584aa9fadaa53c717a853", "type": "github" }, "original": { @@ -301,22 +328,6 @@ "type": "github" } }, - "nixpkgs": { - "locked": { - "lastModified": 1640328990, - "narHash": "sha256-KQbvJx4qO9bo04tfTZuISyY4vRC5k3ZB3lyLS21XWIw=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "ab93217a2b74a1c36bc892c14f44ee5959c33f12", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixpkgs-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, "nixpkgsWayland": { "inputs": { "cachix": "cachix", @@ -325,11 +336,11 @@ ] }, "locked": { - "lastModified": 1637983357, - "narHash": "sha256-kferWoUKAAJO17t2D2nsEMvjMmOH1zyJPFUHtm+Cgn4=", + "lastModified": 1643841979, + "narHash": "sha256-/TNrk/59NpBADaHzFVraQQlHLfIgAPCgoR3F3vIw0EA=", "owner": "colemickens", "repo": "nixpkgs-wayland", - "rev": "1e481bafca9e03ead4b85e4f46d8d959c5f9b11c", + "rev": "da0699ec283382fcc018072bafd573b4d7257d0e", "type": "github" }, "original": { @@ -338,22 +349,6 @@ "type": "github" } }, - "nixpkgs_2": { - "locked": { - "lastModified": 1640328990, - "narHash": "sha256-KQbvJx4qO9bo04tfTZuISyY4vRC5k3ZB3lyLS21XWIw=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "ab93217a2b74a1c36bc892c14f44ee5959c33f12", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixpkgs-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, "rnixLsp": { "inputs": { "naersk": [ @@ -362,17 +357,14 @@ "nixpkgs": [ "nixos" ], - "utils": [ - "digga", - "flake-utils" - ] + "utils": "utils_2" }, "locked": { - "lastModified": 1640347520, - "narHash": "sha256-UkieGBW9ap0pQbumYoG60Ed+BpzMRGuLQ6Zb41u7Fkk=", + "lastModified": 1643586450, + "narHash": "sha256-BRIAc3+zavSlJPYSbov2n1W9/a4Iuh2swFPYRWjCm1g=", "owner": "nix-community", "repo": "rnix-lsp", - "rev": "d7cc2887ac9e65dd01715aac472edbf46b93ed31", + "rev": "41eb2f3366e3f351bf2563c2a7c46fd17e78dfe0", "type": "github" }, "original": { @@ -383,6 +375,7 @@ }, "root": { "inputs": { + "alejandra": "alejandra", "digga": "digga", "home": "home", "naersk": "naersk", @@ -407,6 +400,21 @@ "repo": "flake-utils", "type": "github" } + }, + "utils_2": { + "locked": { + "lastModified": 1638122382, + "narHash": "sha256-sQzZzAbvKEqN9s0bzWuYmRaA03v40gaJ4+iL1LXjaeI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "74f7e4319258e287b0f9cb95426c9853b282730b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index f4b329d..b05fc48 100644 --- a/flake.nix +++ b/flake.nix @@ -1,91 +1,105 @@ { description = "A highly structured configuration database."; - - inputs = - { - nixos.url = "github:nixos/nixpkgs/nixos-unstable"; - - digga.url = "github:divnix/digga/main"; - digga.inputs.nixpkgs.follows = "nixos"; - digga.inputs.nixlib.follows = "nixos"; - digga.inputs.home-manager.follows = "home"; - - home.url = "github:nix-community/home-manager/master"; - home.inputs.nixpkgs.follows = "nixos"; - - naersk.url = "github:nmattia/naersk"; - naersk.inputs.nixpkgs.follows = "nixos"; - - nixos-hardware.url = "github:nixos/nixos-hardware"; - - rnixLsp = { - url = "github:nix-community/rnix-lsp"; - inputs.naersk.follows = "naersk"; - inputs.nixpkgs.follows = "nixos"; - inputs.utils.follows = "digga/flake-utils"; - }; - /*helix = { - url = "https://github.com/helix-editor/helix.git"; - type = "git"; - submodules = true; - inputs.nixpkgs.follows = "nixos"; - };*/ - nixosPersistence.url = "github:nix-community/impermanence"; - nixpkgsWayland = { - url = "github:colemickens/nixpkgs-wayland"; - inputs.nixpkgs.follows = "nixos"; - }; + inputs = { + nixos.url = "github:nixos/nixpkgs/nixos-unstable"; + digga.url = "github:divnix/digga/main"; + digga.inputs.nixpkgs.follows = "nixos"; + digga.inputs.nixlib.follows = "nixos"; + digga.inputs.home-manager.follows = "home"; + home.url = "github:nix-community/home-manager/master"; + home.inputs.nixpkgs.follows = "nixos"; + naersk.url = "github:nmattia/naersk"; + naersk.inputs.nixpkgs.follows = "nixos"; + nixos-hardware.url = "github:nixos/nixos-hardware"; + rnixLsp = { + url = "github:nix-community/rnix-lsp"; + inputs.naersk.follows = "naersk"; + inputs.nixpkgs.follows = "nixos"; }; - + alejandra = { + url = "github:kamadorueda/alejandra"; + inputs.nixpkgs.follows = "nixos"; + }; + /* + helix = { + url = "https://github.com/helix-editor/helix.git"; + type = "git"; + submodules = true; + inputs.nixpkgs.follows = "nixos"; + }; + */ + nixosPersistence.url = "github:nix-community/impermanence"; + nixpkgsWayland = { + url = "github:colemickens/nixpkgs-wayland"; + inputs.nixpkgs.follows = "nixos"; + }; + }; outputs = - { self - , digga - , nixos - , home - , nixos-hardware - , nixosPersistence - , nixpkgsWayland - , rnixLsp - #, helix - , ... - } @ inputs: - digga.lib.mkFlake + { + self, + digga, + nixos, + home, + nixos-hardware, + nixosPersistence, + nixpkgsWayland, + rnixLsp, + alejandra, + ... + } + @ inputs: + digga.lib.mkFlake { inherit self inputs; - channelsConfig = { allowUnfree = true; }; - channels = { nixos = { - imports = [ (digga.lib.importOverlays ./overlays) ]; + imports = [(digga.lib.importOverlays ./overlays)]; overlays = [ #nixpkgsWayland.overlay - (_: prev: { - #helix = helix.packages.${prev.system}.helix; - #helix-src = prev.helix.src; - #rnix-lsp = rnixLsp.packages.${prev.system}.rnix-lsp; - }) + ( + _: prev: { + #helix = helix.packages.${prev.system}.helix; + #helix-src = prev.helix.src; + #rnix-lsp = rnixLsp.packages.${prev.system}.rnix-lsp; + } + ) + ( + _: prev: { + alejandra = alejandra.defaultPackage.${prev.system}; + remarshal = + prev.remarshal.overrideAttrs + ( + old: { + postPatch = + '' + substituteInPlace pyproject.toml \ + --replace "poetry.masonry.api" "poetry.core.masonry.api" \ + --replace 'PyYAML = "^5.3"' 'PyYAML = "*"' \ + --replace 'tomlkit = "^0.7"' 'tomlkit = "*"' + ''; + } + ); + } + ) ./pkgs/default.nix ]; }; }; - lib = import ./lib { lib = digga.lib // nixos.lib; }; - sharedOverlays = [ - (_: prev: { - __dontExport = true; - lib = prev.lib.extend (_: _: { - our = self.lib; - }); - }) + ( + _: prev: { + __dontExport = true; + lib = prev.lib.extend (_: _: { our = self.lib; }); + } + ) ]; - nixos = { hostDefaults = { system = "x86_64-linux"; channelName = "nixos"; - imports = [ (digga.lib.importExportableModules ./modules) ]; + imports = [(digga.lib.importExportableModules ./modules)]; modules = [ { lib.our = self.lib; } digga.nixosModules.bootstrapIso @@ -94,37 +108,32 @@ nixosPersistence.nixosModules.impermanence ]; }; - - imports = [ (digga.lib.importHosts ./hosts) ]; - hosts = { }; + imports = [(digga.lib.importHosts ./hosts)]; + hosts = {}; importables = rec { - profiles = (digga.lib.rakeLeaves ./profiles) // { - users = digga.lib.rakeLeaves ./users; - nixos-hardware = nixos-hardware.nixosModules; - }; - suites = with profiles; { - base = [ cachix core users.root ]; - work = [ users.patriot develop ]; - }; + profiles = + (digga.lib.rakeLeaves ./profiles) + // { + users = digga.lib.rakeLeaves ./users; + nixos-hardware = nixos-hardware.nixosModules; + }; + suites = + with profiles; { + base = [cachix core users.root]; + work = [users.patriot develop]; + }; }; }; - home = { - imports = [ (digga.lib.importExportableModules ./users/modules) ]; - modules = [ ]; + imports = [(digga.lib.importExportableModules ./users/modules)]; + modules = []; importables = rec { profiles = digga.lib.rakeLeaves ./users/profiles; - suites = with profiles; rec { - base = [ direnv git starship ]; - }; + suites = with profiles; rec { base = [direnv git starship]; }; }; }; - devshell = ./shell; - homeConfigurations = digga.lib.mkHomeConfigurations self.nixosConfigurations; - - deploy.nodes = digga.lib.mkDeployNodes self.nixosConfigurations { }; - } - ; + deploy.nodes = digga.lib.mkDeployNodes self.nixosConfigurations {}; + }; } diff --git a/hosts/NixOS.nix b/hosts/NixOS.nix index 3b08411..c1d573b 100644 --- a/hosts/NixOS.nix +++ b/hosts/NixOS.nix @@ -1,12 +1,12 @@ -{ suites, ... }: +{ + suites, + ... +}: { ### root password is empty by default ### imports = suites.base; - boot.loader.systemd-boot.enable = true; boot.loader.efi.canTouchEfiVariables = true; - networking.networkmanager.enable = true; - fileSystems."/" = { device = "/dev/disk/by-label/nixos"; }; } diff --git a/hosts/bootstrap.nix b/hosts/bootstrap.nix index d491855..5b301cc 100644 --- a/hosts/bootstrap.nix +++ b/hosts/bootstrap.nix @@ -1,4 +1,7 @@ -{ profiles, ... }: +{ + profiles, + ... +}: { # build with: `bud build bootstrap bootstrapIso` # reachable on the local link via ssh root@fe80::47%eno1 @@ -7,12 +10,11 @@ imports = [ # profiles.networking profiles.core - profiles.users.root # make sure to configure ssh keys + profiles.users.root + # make sure to configure ssh keys profiles.users.nixos ]; - boot.loader.systemd-boot.enable = true; - # will be overridden by the bootstrapIso instrumentation fileSystems."/" = { device = "/dev/disk/by-label/nixos"; }; } diff --git a/hosts/lungmen.nix b/hosts/lungmen.nix index 54d671b..8e96e1e 100644 --- a/hosts/lungmen.nix +++ b/hosts/lungmen.nix @@ -1,76 +1,83 @@ -{ config, lib, pkgs, modulesPath, suites, profiles, ... }: +{ + config, + lib, + pkgs, + modulesPath, + suites, + profiles, + ... +}: let btrfsPartPath = "/dev/disk/by-label/NIXOS"; - btrfsOptions = [ "compress-force=zstd" "noatime" ]; + btrfsOptions = ["compress-force=zstd" "noatime"]; + btrfsDiff = + pkgs.writeScriptBin + "btrfs-diff" + '' + #!${pkgs.bash}/bin/bash + set -euo pipefail - btrfsDiff = pkgs.writeScriptBin "btrfs-diff" '' - #!${pkgs.bash}/bin/bash - set -euo pipefail + sudo mkdir -p /mnt + sudo mount -o subvol=/ ${btrfsPartPath} /mnt - sudo mkdir -p /mnt - sudo mount -o subvol=/ ${btrfsPartPath} /mnt + OLD_TRANSID=$(sudo btrfs subvolume find-new /mnt/root-blank 9999999) - OLD_TRANSID=$(sudo btrfs subvolume find-new /mnt/root-blank 9999999) - - sudo btrfs subvolume find-new "/mnt/root" "$OLD_TRANSID" | - sed '$d' | - cut -f17- -d' ' | - sort | - uniq | - while read path; do - path="/$path" - if [ -L "$path" ]; then - : # The path is a symbolic link, so is probably handled by NixOS already - elif [ -d "$path" ]; then - : # The path is a directory, ignore - else - echo "$path" - fi - done - - sudo umount /mnt - ''; -in -{ - imports = suites.base ++ suites.work ++ [ - ../profiles/network/networkmanager - (modulesPath + "/installer/scan/not-detected.nix") - ] ++ (with profiles.nixos-hardware; [ common-pc-ssd common-pc common-gpu-amd common-cpu-amd ]); + sudo btrfs subvolume find-new "/mnt/root" "$OLD_TRANSID" | + sed '$d' | + cut -f17- -d' ' | + sort | + uniq | + while read path; do + path="/$path" + if [ -L "$path" ]; then + : # The path is a symbolic link, so is probably handled by NixOS already + elif [ -d "$path" ]; then + : # The path is a directory, ignore + else + echo "$path" + fi + done + sudo umount /mnt + ''; +in { + imports = + suites.base + ++ suites.work + ++ [../profiles/network/networkmanager (modulesPath + "/installer/scan/not-detected.nix")] + ++ (with profiles.nixos-hardware; [common-pc-ssd common-pc common-gpu-amd common-cpu-amd]); boot = { loader = { efi.canTouchEfiVariables = true; systemd-boot.enable = true; }; kernelPackages = pkgs.linuxPackages_latest; - supportedFilesystems = [ "btrfs" ]; + supportedFilesystems = ["btrfs"]; initrd = { - availableKernelModules = - [ "xhci_pci" "ahci" "usb_storage" "usbhid" "sd_mod" ]; - kernelModules = [ "amdgpu" ]; - }; - kernelModules = [ "kvm-amd" ]; - extraModulePackages = [ ]; - initrd.postDeviceCommands = pkgs.lib.mkBefore '' - mkdir -p /mnt - mount -o subvol=/ ${btrfsPartPath} /mnt - btrfs subvolume list -o /mnt/root | - cut -f9 -d' ' | - while read subvolume; do - echo "deleting /$subvolume subvolume..." - btrfs subvolume delete "/mnt/$subvolume" - done && - echo "deleting /root subvolume..." && - btrfs subvolume delete /mnt/root - echo "restoring blank /root subvolume" - btrfs subvolume snapshot /mnt/root-blank /mnt/root - umount /mnt - ''; - kernel.sysctl = { - "fs.inotify.max_user_watches" = 524288; + availableKernelModules = ["xhci_pci" "ahci" "usb_storage" "usbhid" "sd_mod"]; + kernelModules = ["amdgpu"]; }; + kernelModules = ["kvm-amd"]; + extraModulePackages = []; + initrd.postDeviceCommands = + pkgs.lib.mkBefore + '' + mkdir -p /mnt + mount -o subvol=/ ${btrfsPartPath} /mnt + btrfs subvolume list -o /mnt/root | + cut -f9 -d' ' | + while read subvolume; do + echo "deleting /$subvolume subvolume..." + btrfs subvolume delete "/mnt/$subvolume" + done && + echo "deleting /root subvolume..." && + btrfs subvolume delete /mnt/root + echo "restoring blank /root subvolume" + btrfs subvolume snapshot /mnt/root-blank /mnt/root + umount /mnt + ''; + kernel.sysctl = { "fs.inotify.max_user_watches" = 524288; }; }; - security.pam.loginLimits = [ { domain = "*"; @@ -85,61 +92,52 @@ in value = "524288"; } ]; - fileSystems."/" = { device = btrfsPartPath; fsType = "btrfs"; - options = [ "subvol=root" ] ++ btrfsOptions; + options = ["subvol=root"] ++ btrfsOptions; }; - fileSystems."/home" = { device = btrfsPartPath; fsType = "btrfs"; - options = [ "subvol=home" ] ++ btrfsOptions; + options = ["subvol=home"] ++ btrfsOptions; }; - - fileSystems."/media/archive" = { - device = "/dev/disk/by-uuid/f9b5f7f3-51e8-4357-8518-986b16311c71"; - fsType = "btrfs"; - options = btrfsOptions; - }; - + #fileSystems."/media/archive" = { + # device = "/dev/disk/by-uuid/f9b5f7f3-51e8-4357-8518-986b16311c71"; + # fsType = "btrfs"; + # options = btrfsOptions; + #}; fileSystems."/nix" = { device = btrfsPartPath; fsType = "btrfs"; - options = [ "subvol=nix" ] ++ btrfsOptions; + options = ["subvol=nix"] ++ btrfsOptions; }; - fileSystems."/persist" = { device = btrfsPartPath; fsType = "btrfs"; - options = [ "subvol=persist" ] ++ btrfsOptions; + options = ["subvol=persist"] ++ btrfsOptions; neededForBoot = true; }; - fileSystems."/boot" = { device = "/dev/disk/by-uuid/5784-BBB1"; fsType = "vfat"; }; - - swapDevices = [ ]; + swapDevices = []; zramSwap = { enable = true; algorithm = "zstd"; }; - - nix.maxJobs = lib.mkDefault 4; - + nix.settings.max-jobs = lib.mkDefault 4; security = { mitigations.disable = true; allowSimultaneousMultithreading = false; # Deleting root subvolume makes sudo show lecture every boot - sudo.extraConfig = '' - Defaults lecture = never - ''; + sudo.extraConfig = + '' + Defaults lecture = never + ''; rtkit.enable = true; }; - sound.enable = false; services.pipewire = { enable = true; @@ -153,52 +151,40 @@ in driSupport = true; driSupport32Bit = true; enable = true; - extraPackages = with pkgs; [ - amdvlk - libvdpau-va-gl - vaapiVdpau - libva - vulkan-loader - pipewire - ]; - extraPackages32 = with pkgs.pkgsi686Linux; - [ - libvdpau-va-gl - vaapiVdpau - libva - vulkan-loader - pipewire - ] - ++ [ pkgs.driversi686Linux.amdvlk ]; + extraPackages = with pkgs; [amdvlk libvdpau-va-gl vaapiVdpau libva vulkan-loader pipewire]; + extraPackages32 = + with pkgs.pkgsi686Linux; + [libvdpau-va-gl vaapiVdpau libva vulkan-loader pipewire] ++ [pkgs.driversi686Linux.amdvlk]; }; pulseaudio = { enable = false; support32Bit = true; }; }; - fonts = { enableDefaultFonts = true; fontconfig.enable = true; - fonts = [ pkgs.dejavu_fonts ]; + fonts = [pkgs.dejavu_fonts]; }; - environment = { - systemPackages = [ btrfsDiff ]; - pathsToLink = [ "/share/zsh" ]; + systemPackages = [btrfsDiff]; + pathsToLink = ["/share/zsh"]; persistence."/persist" = { - directories = [ "/etc/nixos" ]; - files = [ "/etc/machine-id" ]; + directories = ["/etc/nixos"]; + files = ["/etc/machine-id"]; }; variables = { - VK_ICD_FILENAMES = lib.mkForce "${pkgs.amdvlk}/share/vulkan/icd.d/amd_icd64.json:${pkgs.driversi686Linux.amdvlk}/share/vulkan/icd.d/amd_icd32.json"; + VK_ICD_FILENAMES = + lib.mkForce + "${pkgs.amdvlk}/share/vulkan/icd.d/amd_icd64.json:${pkgs.driversi686Linux.amdvlk}/share/vulkan/icd.d/amd_icd32.json"; }; sessionVariables = { - VK_ICD_FILENAMES = lib.mkForce "${pkgs.amdvlk}/share/vulkan/icd.d/amd_icd64.json:${pkgs.driversi686Linux.amdvlk}/share/vulkan/icd.d/amd_icd32.json"; + VK_ICD_FILENAMES = + lib.mkForce + "${pkgs.amdvlk}/share/vulkan/icd.d/amd_icd64.json:${pkgs.driversi686Linux.amdvlk}/share/vulkan/icd.d/amd_icd32.json"; }; }; networking.interfaces.enp6s0.useDHCP = true; - services = { ipfs = { enable = false; @@ -206,30 +192,31 @@ in autoMount = true; }; flatpak.enable = false; - xserver = { - videoDrivers = [ "amdgpu" ]; - }; + xserver = { videoDrivers = ["amdgpu"]; }; postgresql = { enable = false; enableTCPIP = true; - authentication = lib.mkOverride 10 '' - local all all trust - host all all 0.0.0.0/0 md5 - ''; - settings = { - listen_addresses = "*"; - }; - initialScript = pkgs.writeText "backend-initScript" '' - CREATE ROLE patriot WITH LOGIN PASSWORD 'patriot' CREATEDB; - CREATE DATABASE harmony; - GRANT ALL PRIVILEGES ON DATABASE harmony TO patriot; - ''; + authentication = + lib.mkOverride + 10 + '' + local all all trust + host all all 0.0.0.0/0 md5 + ''; + settings = { listen_addresses = "*"; }; + initialScript = + pkgs.writeText + "backend-initScript" + '' + CREATE ROLE patriot WITH LOGIN PASSWORD 'patriot' CREATEDB; + CREATE DATABASE harmony; + GRANT ALL PRIVILEGES ON DATABASE harmony TO patriot; + ''; }; }; virtualisation = { - podman.enable = true; + podman.enable = false; libvirtd.enable = false; }; - system.stateVersion = "20.09"; } diff --git a/lib/compat/default.nix b/lib/compat/default.nix index 9d0c283..7bad31d 100644 --- a/lib/compat/default.nix +++ b/lib/compat/default.nix @@ -1,14 +1,15 @@ let rev = "e7e5d481a0e15dcd459396e55327749989e04ce0"; - flake = (import + flake = ( + import ( - fetchTarball { + fetchTarball + { url = "https://github.com/edolstra/flake-compat/archive/${rev}.tar.gz"; sha256 = "0zd3x46fswh5n6faq4x2kkpy6p3c6j593xbdlbsl40ppkclwc80x"; } ) - { - src = ../../.; - }); + { src = ../../.; } + ); in -flake + flake diff --git a/lib/compat/nixos/default.nix b/lib/compat/nixos/default.nix index e4e0e68..b5d7786 100644 --- a/lib/compat/nixos/default.nix +++ b/lib/compat/nixos/default.nix @@ -1,10 +1,9 @@ { ... }: let inherit (default.inputs.nixos) lib; - host = configs.${hostname} or configs.NixOS; configs = default.nixosConfigurations; default = (import ../.).defaultNix; hostname = lib.fileContents /etc/hostname; in -host + host diff --git a/lib/default.nix b/lib/default.nix index ade4d8e..da6c5a1 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -1,5 +1,8 @@ { lib }: -lib.makeExtensible (self: { - pkgBinNoDep = pkgs: name: "${pkgs.${name}}/bin/${name}"; - html = import ./html.nix { format = true; }; -}) +lib.makeExtensible +( + self: { + pkgBinNoDep = pkgs: name: "${pkgs.${name}}/bin/${name}"; + html = import ./html.nix { format = true; }; + } +) diff --git a/lib/html.nix b/lib/html.nix index 72e3100..b59b9e2 100644 --- a/lib/html.nix +++ b/lib/html.nix @@ -1,22 +1,33 @@ { format ? false }: let inherit (builtins) isAttrs isList map; - - fmt = if format then "\n " else ""; + fmt = + if format + then "\n " + else ""; mapAttrsToList = f: attrs: map (name: f name attrs.${name}) (builtins.attrNames attrs); concatStrings = builtins.concatStringsSep ""; - genAttrs = f: names: builtins.listToAttrs (map (n: { name = n; value = (f n); }) names); - evalAttrs = attrs: concatStrings (mapAttrsToList (name: value: " ${name}=\"${value}\"") attrs); - evalChildren = children: if isList children then concatStrings children else children; - tag = name: maybeAttrs: - if isAttrs maybeAttrs - then (children: "<${name}${evalAttrs maybeAttrs}>${fmt}${evalChildren children}${fmt}") - else tag name { } maybeAttrs; - - tags = (genAttrs tag [ "html" "head" "body" "div" "p" "a" ]); + genAttrs = f: names: + builtins.listToAttrs (map + (n: { + name = n; + value = (f n); + }) + names); + evalChildren = children: + if isList children + then concatStrings children + else children; + tag = + name: maybeAttrs: + if isAttrs maybeAttrs + then (children: "<${name}${evalAttrs maybeAttrs}>${fmt}${evalChildren children}${fmt}") + else tag name {} maybeAttrs; + tags = (genAttrs tag ["html" "head" "body" "div" "p" "a"]); in -tags // { - inherit tag; - link = url: tags.a { href = url; }; -} + tags + // { + inherit tag; + link = url: tags.a { href = url; }; + } diff --git a/locale/default.nix b/locale/default.nix index 71ab6f7..0e9acb7 100644 --- a/locale/default.nix +++ b/locale/default.nix @@ -1,8 +1,9 @@ -{ ... }: { +{ ... }: +{ console.keyMap = "trq"; i18n = { defaultLocale = "en_US.UTF-8"; - supportedLocales = [ "en_US.UTF-8/UTF-8" ]; + supportedLocales = ["en_US.UTF-8/UTF-8"]; }; time.timeZone = "Turkey"; services.xserver.layout = "tr"; diff --git a/modules/hm-system-defaults.nix b/modules/hm-system-defaults.nix index 7b442a6..36b8d60 100644 --- a/modules/hm-system-defaults.nix +++ b/modules/hm-system-defaults.nix @@ -1,11 +1,12 @@ -{ config, ... }: { +{ + config, + ... +}: +{ home-manager.sharedModules = [ { - home.sessionVariables = { - inherit (config.environment.sessionVariables) NIX_PATH; - }; - xdg.configFile."nix/registry.json".text = - config.environment.etc."nix/registry.json".text; + home.sessionVariables = { inherit (config.environment.sessionVariables) NIX_PATH; }; + xdg.configFile."nix/registry.json".text = config.environment.etc."nix/registry.json".text; } ]; } diff --git a/modules/nix-path.nix b/modules/nix-path.nix index 273f67a..411bfba 100644 --- a/modules/nix-path.nix +++ b/modules/nix-path.nix @@ -1,7 +1,8 @@ -{ channel, inputs, ... }: { - nix.nixPath = [ - "nixpkgs=${channel.input}" - "nixos-config=${../lib/compat/nixos}" - "home-manager=${inputs.home}" - ]; +{ + channel, + inputs, + ... +}: +{ + nix.nixPath = ["nixpkgs=${channel.input}" "nixos-config=${../lib/compat/nixos}" "home-manager=${inputs.home}"]; } diff --git a/modules/security/mitigations.nix b/modules/security/mitigations.nix index 454084e..071ce98 100644 --- a/modules/security/mitigations.nix +++ b/modules/security/mitigations.nix @@ -1,27 +1,28 @@ -{ config, lib, ... }: -with lib; -let - inherit (builtins) readFile fetchurl; - - cfg = config.security.mitigations; - - cmdline = '' - ibrs noibpb nopti nospectre_v2 nospectre_v1 l1tf=off nospec_store_bypass_disable no_stf_barrier mds=off tsx=on tsx_async_abort=off mitigations=off''; -in { + config, + lib, + ... +}: +with lib; let + inherit (builtins) readFile fetchurl; + cfg = config.security.mitigations; + cmdline = + '' + ibrs noibpb nopti nospectre_v2 nospectre_v1 l1tf=off nospec_store_bypass_disable no_stf_barrier mds=off tsx=on tsx_async_abort=off mitigations=off''; +in { options = { - security.mitigations.disable = mkOption { - type = types.bool; - default = false; - description = '' - Whether to disable spectre and meltdown mitigations in the kernel. Do - not use this in mission critical deployments, or on any machine you do - not have physical access to. - ''; - }; - }; - - config = mkIf cfg.disable { - boot.kernelParams = splitString " " cmdline; + security.mitigations.disable = + mkOption + { + type = types.bool; + default = false; + description = + '' + Whether to disable spectre and meltdown mitigations in the kernel. Do + not use this in mission critical deployments, or on any machine you do + not have physical access to. + ''; + }; }; + config = mkIf cfg.disable { boot.kernelParams = splitString " " cmdline; }; } diff --git a/overlays/chromium-wayland.nix b/overlays/chromium-wayland.nix index 1cb2b5d..11c0249 100644 --- a/overlays/chromium-wayland.nix +++ b/overlays/chromium-wayland.nix @@ -1,5 +1,4 @@ -_: prev: -let +_: prev: let cliArgs = let flags = [ @@ -16,10 +15,5 @@ let "--process-per-site" ]; in - prev.lib.concatStringsSep " " flags; -in -{ - chromium = prev.chromium.override { - commandLineArgs = cliArgs; - }; -} + prev.lib.concatStringsSep " " flags; +in { chromium = prev.chromium.override { commandLineArgs = cliArgs; }; } diff --git a/overlays/discord-canary-system.nix b/overlays/discord-canary-system.nix index 902b9da..13677f4 100644 --- a/overlays/discord-canary-system.nix +++ b/overlays/discord-canary-system.nix @@ -1,196 +1,212 @@ final: prev: rec { - discord-canary-system = prev.callPackage mkDiscord (rec { - pname = "discord-canary"; - version = "0.0.131"; - binaryName = "DiscordCanary"; - desktopName = "Discord Canary"; - src = prev.fetchurl { - url = "https://dl-canary.discordapp.net/apps/linux/${version}/discord-canary-${version}.tar.gz"; - sha256 = "sha256-ZYPdE02Jq79LmvXu7KIJFugJX++Nnj0Og/mBuaP/+SA="; - }; - isWayland = true; - enableVulkan = false; - extraOptions = [ - "--ignore-gpu-blocklist" - "--enable-gpu-rasterization" - "--enable-zero-copy" - "--disable-gpu-driver-bug-workarounds" - ]; - }); + discord-canary-system = + prev.callPackage + mkDiscord + ( + rec { + pname = "discord-canary"; + version = "0.0.131"; + binaryName = "DiscordCanary"; + desktopName = "Discord Canary"; + src = + prev.fetchurl + { + url = "https://dl-canary.discordapp.net/apps/linux/${version}/discord-canary-${version}.tar.gz"; + sha256 = "sha256-ZYPdE02Jq79LmvXu7KIJFugJX++Nnj0Og/mBuaP/+SA="; + }; + isWayland = true; + enableVulkan = false; + extraOptions = [ + "--ignore-gpu-blocklist" + "--enable-gpu-rasterization" + "--enable-zero-copy" + "--disable-gpu-driver-bug-workarounds" + ]; + } + ); mkDiscord = - { pname - , version - , src - , binaryName - , desktopName - , isWayland ? false - , enableVulkan ? false - , extraOptions ? [ ] - , autoPatchelfHook - , makeDesktopItem - , lib - , stdenv - , wrapGAppsHook - , alsaLib - , at-spi2-atk - , at-spi2-core - , atk - , cairo - , cups - , dbus - , electron - , expat - , fontconfig - , freetype - , gdk-pixbuf - , glib - , gtk3 - , libcxx - , libdrm - , libnotify - , libpulseaudio - , libuuid - , libX11 - , libXScrnSaver - , libXcomposite - , libXcursor - , libXdamage - , libXext - , libXfixes - , libXi - , libXrandr - , libXrender - , libXtst - , libxcb - , mesa - , nspr - , nss - , pango - , systemd - , libappindicator-gtk3 - , libdbusmenu - , nodePackages - , vulkan-loader - , vulkan-extension-layer - , libGL - , pipewire + { + pname, + version, + src, + binaryName, + desktopName, + isWayland ? false, + enableVulkan ? false, + extraOptions ? [], + autoPatchelfHook, + makeDesktopItem, + lib, + stdenv, + wrapGAppsHook, + alsaLib, + at-spi2-atk, + at-spi2-core, + atk, + cairo, + cups, + dbus, + electron, + expat, + fontconfig, + freetype, + gdk-pixbuf, + glib, + gtk3, + libcxx, + libdrm, + libnotify, + libpulseaudio, + libuuid, + libX11, + libXScrnSaver, + libXcomposite, + libXcursor, + libXdamage, + libXext, + libXfixes, + libXi, + libXrandr, + libXrender, + libXtst, + libxcb, + mesa, + nspr, + nss, + pango, + systemd, + libappindicator-gtk3, + libdbusmenu, + nodePackages, + vulkan-loader, + vulkan-extension-layer, + libGL, + pipewire, }: - stdenv.mkDerivation rec { - inherit pname version src; + stdenv.mkDerivation + rec { + inherit pname version src; + nativeBuildInputs = [ + nodePackages.asar + alsaLib + autoPatchelfHook + cups + libdrm + libuuid + libXdamage + libX11 + libXScrnSaver + libXtst + libxcb + mesa.drivers + nss + wrapGAppsHook + ]; + dontWrapGApps = true; + libPath = + lib.makeLibraryPath + [ + libcxx + systemd + libpulseaudio + stdenv.cc.cc + alsaLib + atk + at-spi2-atk + at-spi2-core + cairo + cups + dbus + expat + fontconfig + freetype + gdk-pixbuf + glib + gtk3 + libnotify + libX11 + libXcomposite + libuuid + libXcursor + libXdamage + libXext + libXfixes + libXi + libXrandr + libXrender + libXtst + nspr + nss + libxcb + pango + systemd + libXScrnSaver + libappindicator-gtk3 + libdbusmenu + vulkan-loader + vulkan-extension-layer + libGL + pipewire + ]; + flags = + ( + lib.optionals + isWayland + [ + "--flag-switches-begin" + "--enable-features=UseOzonePlatform,WebRTCPipeWireCapturer${ + lib.optionalString enableVulkan ",Vulkan" + }" + "--flag-switches-end" + "--ozone-platform=wayland" + "--enable-webrtc-pipewire-capturer" + ] + ) + ++ extraOptions; + installPhase = + '' + mkdir -p $out/{bin,usr/lib/${pname},share/pixmaps} + ln -s discord.png $out/share/pixmaps/${pname}.png + ln -s "${desktopItem}/share/applications" $out/share/ - nativeBuildInputs = [ - nodePackages.asar - alsaLib - autoPatchelfHook - cups - libdrm - libuuid - libXdamage - libX11 - libXScrnSaver - libXtst - libxcb - mesa.drivers - nss - wrapGAppsHook - ]; + # HACKS FOR SYSTEM ELECTRON + asar e resources/app.asar resources/app + rm resources/app.asar + sed -i "s|process.resourcesPath|'$out/usr/lib/${pname}'|" resources/app/app_bootstrap/buildInfo.js + sed -i "s|exeDir,|'$out/share/pixmaps',|" resources/app/app_bootstrap/autoStart/linux.js + asar p resources/app resources/app.asar --unpack-dir '**' + rm -rf resources/app - dontWrapGApps = true; + # Copy Relevanat data + cp -r resources/* $out/usr/lib/${pname}/ - libPath = lib.makeLibraryPath [ - libcxx - systemd - libpulseaudio - stdenv.cc.cc - alsaLib - atk - at-spi2-atk - at-spi2-core - cairo - cups - dbus - expat - fontconfig - freetype - gdk-pixbuf - glib - gtk3 - libnotify - libX11 - libXcomposite - libuuid - libXcursor - libXdamage - libXext - libXfixes - libXi - libXrandr - libXrender - libXtst - nspr - nss - libxcb - pango - systemd - libXScrnSaver - libappindicator-gtk3 - libdbusmenu - vulkan-loader - vulkan-extension-layer - libGL - pipewire - ]; + # Create starter script for discord + echo "#!${stdenv.shell}" > $out/bin/${pname} + echo "exec ${electron}/bin/electron ${lib.concatStringsSep " " flags} $out/usr/lib/${pname}/app.asar \$@" >> $out/bin/${pname} + chmod 755 $out/bin/${pname} - flags = (lib.optionals isWayland [ - "--flag-switches-begin" - "--enable-features=UseOzonePlatform,WebRTCPipeWireCapturer${lib.optionalString enableVulkan ",Vulkan"}" - "--flag-switches-end" - "--ozone-platform=wayland" - "--enable-webrtc-pipewire-capturer" - ]) ++ extraOptions; - - installPhase = '' - mkdir -p $out/{bin,usr/lib/${pname},share/pixmaps} - ln -s discord.png $out/share/pixmaps/${pname}.png - ln -s "${desktopItem}/share/applications" $out/share/ - - # HACKS FOR SYSTEM ELECTRON - asar e resources/app.asar resources/app - rm resources/app.asar - sed -i "s|process.resourcesPath|'$out/usr/lib/${pname}'|" resources/app/app_bootstrap/buildInfo.js - sed -i "s|exeDir,|'$out/share/pixmaps',|" resources/app/app_bootstrap/autoStart/linux.js - asar p resources/app resources/app.asar --unpack-dir '**' - rm -rf resources/app - - # Copy Relevanat data - cp -r resources/* $out/usr/lib/${pname}/ - - # Create starter script for discord - echo "#!${stdenv.shell}" > $out/bin/${pname} - echo "exec ${electron}/bin/electron ${lib.concatStringsSep " " flags} $out/usr/lib/${pname}/app.asar \$@" >> $out/bin/${pname} - chmod 755 $out/bin/${pname} - - wrapProgram $out/bin/${pname} \ - "''${gappsWrapperArgs[@]}" \ - --prefix XDG_DATA_DIRS : "${gtk3}/share/gsettings-schemas/${gtk3.name}/" \ - --prefix LD_LIBRARY_PATH : ${libPath} - ''; - - desktopItem = makeDesktopItem { - name = pname; - exec = pname; - icon = pname; - inherit desktopName; - genericName = meta.description; - categories = "Network;InstantMessaging;"; - mimeType = "x-scheme-handler/discord"; + wrapProgram $out/bin/${pname} \ + "''${gappsWrapperArgs[@]}" \ + --prefix XDG_DATA_DIRS : "${gtk3}/share/gsettings-schemas/${gtk3.name}/" \ + --prefix LD_LIBRARY_PATH : ${libPath} + ''; + desktopItem = + makeDesktopItem + { + name = pname; + exec = pname; + icon = pname; + inherit desktopName; + genericName = meta.description; + categories = "Network;InstantMessaging;"; + mimeType = "x-scheme-handler/discord"; + }; + meta = + with lib; { + description = "All-in-one cross-platform voice and text chat for gamers"; + homepage = "https://discordapp.com/"; + downloadPage = "https://discordapp.com/download"; + platforms = ["x86_64-linux"]; + }; }; - - meta = with lib; { - description = "All-in-one cross-platform voice and text chat for gamers"; - homepage = "https://discordapp.com/"; - downloadPage = "https://discordapp.com/download"; - platforms = [ "x86_64-linux" ]; - }; - }; } diff --git a/overlays/discord-canary.nix b/overlays/discord-canary.nix index 91995f3..6780bfb 100644 --- a/overlays/discord-canary.nix +++ b/overlays/discord-canary.nix @@ -1,25 +1,32 @@ final: prev: { - discord-canary = prev.discord-canary.overrideAttrs (old: - let binaryName = "DiscordCanary"; in - rec { - version = "0.0.123"; - src = prev.fetchurl { - url = "https://dl-canary.discordapp.net/apps/linux/${version}/discord-canary-${version}.tar.gz"; - sha256 = "0bijwfsd9s4awqkgxd9c2cxh7y5r06vix98qjp0dkv63r6jig8ch"; - }; - installPhase = '' - mkdir -p $out/{bin,opt/${binaryName},share/pixmaps} - mv * $out/opt/${binaryName} - chmod +x $out/opt/${binaryName}/${binaryName} - patchelf --set-interpreter ${prev.stdenv.cc.bintools.dynamicLinker} \ - $out/opt/${binaryName}/${binaryName} - wrapProgram $out/opt/${binaryName}/${binaryName} \ - "''${gappsWrapperArgs[@]}" \ - --prefix XDG_DATA_DIRS : "${prev.gtk3}/share/gsettings-schemas/${prev.gtk3.name}/" \ - --prefix LD_LIBRARY_PATH : "${old.libPath}:${prev.electron_9}/lib/electron:${prev.libdrm}/lib:${prev.libGL_driver.out}/lib" - ln -s $out/opt/${binaryName}/${binaryName} $out/bin/ - ln -s $out/opt/${binaryName}/discord.png $out/share/pixmaps/${old.pname}.png - ln -s "${old.desktopItem}/share/applications" $out/share/ - ''; - }); + discord-canary = + prev.discord-canary.overrideAttrs + ( + old: let + binaryName = "DiscordCanary"; + in rec { + version = "0.0.123"; + src = + prev.fetchurl + { + url = "https://dl-canary.discordapp.net/apps/linux/${version}/discord-canary-${version}.tar.gz"; + sha256 = "0bijwfsd9s4awqkgxd9c2cxh7y5r06vix98qjp0dkv63r6jig8ch"; + }; + installPhase = + '' + mkdir -p $out/{bin,opt/${binaryName},share/pixmaps} + mv * $out/opt/${binaryName} + chmod +x $out/opt/${binaryName}/${binaryName} + patchelf --set-interpreter ${prev.stdenv.cc.bintools.dynamicLinker} \ + $out/opt/${binaryName}/${binaryName} + wrapProgram $out/opt/${binaryName}/${binaryName} \ + "''${gappsWrapperArgs[@]}" \ + --prefix XDG_DATA_DIRS : "${prev.gtk3}/share/gsettings-schemas/${prev.gtk3.name}/" \ + --prefix LD_LIBRARY_PATH : "${old.libPath}:${prev.electron_9}/lib/electron:${prev.libdrm}/lib:${prev.libGL_driver.out}/lib" + ln -s $out/opt/${binaryName}/${binaryName} $out/bin/ + ln -s $out/opt/${binaryName}/discord.png $out/share/pixmaps/${old.pname}.png + ln -s "${old.desktopItem}/share/applications" $out/share/ + ''; + } + ); } diff --git a/overlays/manix.nix b/overlays/manix.nix index d39baa7..7afc698 100644 --- a/overlays/manix.nix +++ b/overlays/manix.nix @@ -1,5 +1 @@ -final: prev: { - manix = prev.manix.overrideAttrs (o: rec{ - inherit (prev.sources.manix) pname version src; - }); -} +final: prev: { manix = prev.manix.overrideAttrs (o: rec { inherit (prev.sources.manix) pname version src; }); } diff --git a/overlays/overrides.nix b/overlays/overrides.nix index 3fc1369..5d5e510 100644 --- a/overlays/overrides.nix +++ b/overlays/overrides.nix @@ -1,3 +1,4 @@ channels: final: prev: { - __dontExport = true; # overrides clutter up actual creations + __dontExport = true; + # overrides clutter up actual creations } diff --git a/overlays/phantom.nix b/overlays/phantom.nix index 3653460..2afa4f4 100644 --- a/overlays/phantom.nix +++ b/overlays/phantom.nix @@ -1,25 +1,26 @@ final: prev: { - phantomstyle = prev.stdenv.mkDerivation { - pname = "phantomstyle"; - version = "6e9580b"; - - src = builtins.fetchGit { - url = "https://github.com/randrew/phantomstyle.git"; - rev = "6e9580b72e372b5acecd616434eaf441bf73bcf4"; + phantomstyle = + prev.stdenv.mkDerivation + { + pname = "phantomstyle"; + version = "6e9580b"; + src = + builtins.fetchGit + { + url = "https://github.com/randrew/phantomstyle.git"; + rev = "6e9580b72e372b5acecd616434eaf441bf73bcf4"; + }; + dontWrapQtApps = true; + buildInputs = [prev.libsForQt5.qt5.qtbase]; + buildPhase = + '' + cd src/styleplugin + qmake && make + ''; + installPhase = + '' + mkdir -p $out/$qtPluginPrefix/styles + mv libphantomstyleplugin.so $out/$qtPluginPrefix/styles + ''; }; - - dontWrapQtApps = true; - - buildInputs = [ prev.libsForQt5.qt5.qtbase ]; - - buildPhase = '' - cd src/styleplugin - qmake && make - ''; - - installPhase = '' - mkdir -p $out/$qtPluginPrefix/styles - mv libphantomstyleplugin.so $out/$qtPluginPrefix/styles - ''; - }; } diff --git a/overlays/various-flake-fixes.nix b/overlays/various-flake-fixes.nix index 7dbfc18..d35f381 100644 --- a/overlays/various-flake-fixes.nix +++ b/overlays/various-flake-fixes.nix @@ -2,10 +2,6 @@ final: prev: { # Since: https://github.com/NixOS/nixpkgs/pull/126137 nix-direnv = if builtins.hasAttr "enableFlakes" prev.nix-direnv.override.__functionArgs - then - prev.nix-direnv.override - { - enableFlakes = true; - } + then prev.nix-direnv.override { enableFlakes = true; } else prev.nix-direnv; } diff --git a/overlays/vscode-wayland.nix b/overlays/vscode-wayland.nix index 1ef9a46..cf172b9 100644 --- a/overlays/vscode-wayland.nix +++ b/overlays/vscode-wayland.nix @@ -1,5 +1,4 @@ -_: prev: -let +_: prev: let pkgs = prev; lib = pkgs.lib; vscodeWayland = @@ -16,36 +15,50 @@ let "--disable-gpu-driver-bug-workarounds" ]; in - pkgs.writeScriptBin "vscode-wayland" '' - #!${pkgs.stdenv.shell} - ${pkgs.vscode}/bin/code ${lib.concatStringsSep " " flags} - ''; -in -{ + pkgs.writeScriptBin + "vscode-wayland" + '' + #!${pkgs.stdenv.shell} + ${pkgs.vscode}/bin/code ${lib.concatStringsSep " " flags} + ''; +in { vscodeWayland = let pname = "vscode"; - desktop = pkgs.makeDesktopItem { - name = pname; - exec = pname; - icon = "vscode"; - desktopName = "VSCode Wayland"; - }; + desktop = + pkgs.makeDesktopItem + { + name = pname; + exec = pname; + icon = "vscode"; + desktopName = "VSCode Wayland"; + }; in - lib.hiPrio (pkgs.stdenv.mkDerivation { - inherit pname; - version = pkgs.vscode.version; - - nativeBuildInputs = [ pkgs.makeWrapper ]; - phases = [ "installPhase" /*"fixupPhase"*/ ]; - installPhase = '' - mkdir -p $out/bin - install -m755 ${vscodeWayland}/bin/${pname}-wayland $out/bin/${pname} - cp -r ${desktop}/share $out/share - ''; - /*fixupPhase = '' - wrapProgram $out/bin/${pname} \ - --prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath (with pkgs; [ vulkan-loader vulkan-extension-layer libGL ])} - '';*/ - }); + lib.hiPrio + ( + pkgs.stdenv.mkDerivation + { + inherit pname; + version = pkgs.vscode.version; + nativeBuildInputs = [pkgs.makeWrapper]; + phases = [ + "installPhase" + /* + "fixupPhase" + */ + ]; + installPhase = + '' + mkdir -p $out/bin + install -m755 ${vscodeWayland}/bin/${pname}-wayland $out/bin/${pname} + cp -r ${desktop}/share $out/share + ''; + /* + fixupPhase = '' + wrapProgram $out/bin/${pname} \ + --prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath (with pkgs; [ vulkan-loader vulkan-extension-layer libGL ])} + ''; + */ + } + ); } diff --git a/pkgs/_sources/generated.nix b/pkgs/_sources/generated.nix index 71be396..c5fe280 100644 --- a/pkgs/_sources/generated.nix +++ b/pkgs/_sources/generated.nix @@ -1,16 +1,21 @@ # This file was generated by nvfetcher, please do not modify it manually. -{ fetchgit, fetchurl }: +{ + fetchgit, + fetchurl, +}: { manix = { pname = "manix"; version = "d08e7ca185445b929f097f8bfb1243a8ef3e10e4"; - src = fetchgit { - url = "https://github.com/mlvzk/manix"; - rev = "d08e7ca185445b929f097f8bfb1243a8ef3e10e4"; - fetchSubmodules = false; - deepClone = false; - leaveDotGit = false; - sha256 = "1b7xi8c2drbwzfz70czddc4j33s7g1alirv12dwl91hbqxifx8qs"; - }; + src = + fetchgit + { + url = "https://github.com/mlvzk/manix"; + rev = "d08e7ca185445b929f097f8bfb1243a8ef3e10e4"; + fetchSubmodules = false; + deepClone = false; + leaveDotGit = false; + sha256 = "1b7xi8c2drbwzfz70czddc4j33s7g1alirv12dwl91hbqxifx8qs"; + }; }; } diff --git a/pkgs/default.nix b/pkgs/default.nix index 924a230..1addf90 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -1,5 +1,5 @@ final: prev: { # keep sources this first - sources = prev.callPackage (import ./_sources/generated.nix) { }; + sources = prev.callPackage (import ./_sources/generated.nix) {}; # then, call packages with `final.callPackage` } diff --git a/profiles/cachix/default.nix b/profiles/cachix/default.nix index 1ddf562..12770f3 100644 --- a/profiles/cachix/default.nix +++ b/profiles/cachix/default.nix @@ -1,11 +1,14 @@ -{ pkgs, lib, ... }: +{ + pkgs, + lib, + ... +}: let folder = ./.; toImport = name: value: folder + ("/" + name); filterCaches = key: value: value == "regular" && lib.hasSuffix ".nix" key && key != "default.nix"; imports = lib.mapAttrsToList toImport (lib.filterAttrs filterCaches (builtins.readDir folder)); -in -{ +in { #inherit imports; - nix.binaryCaches = [ "https://cache.nixos.org/" ]; + nix.settings.substituters = ["https://cache.nixos.org/"]; } diff --git a/profiles/cachix/harmony.nix b/profiles/cachix/harmony.nix index 8dd7e70..287a62f 100644 --- a/profiles/cachix/harmony.nix +++ b/profiles/cachix/harmony.nix @@ -1,10 +1,6 @@ { nix = { - binaryCaches = [ - "https://harmony.cachix.org" - ]; - binaryCachePublicKeys = [ - "harmony.cachix.org-1:yv78QZHgS0UHkrMW56rccNghWHRz18fFRl8mWQ63M6E=" - ]; + settings.substituters = ["https://harmony.cachix.org"]; + binaryCachePublicKeys = ["harmony.cachix.org-1:yv78QZHgS0UHkrMW56rccNghWHRz18fFRl8mWQ63M6E="]; }; } diff --git a/profiles/cachix/nix-cargo-integration.nix b/profiles/cachix/nix-cargo-integration.nix index c276e2f..dd7a1e0 100644 --- a/profiles/cachix/nix-cargo-integration.nix +++ b/profiles/cachix/nix-cargo-integration.nix @@ -1,10 +1,6 @@ { nix = { - binaryCaches = [ - "https://nix-cargo-integration.cachix.org" - ]; - binaryCachePublicKeys = [ - "nix-cargo-integration.cachix.org-1:wphySON/RyTC2DCzwKPBQGLEZv5mj0s1I1lsfQObaLs=" - ]; + settings.substituters = ["https://nix-cargo-integration.cachix.org"]; + binaryCachePublicKeys = ["nix-cargo-integration.cachix.org-1:wphySON/RyTC2DCzwKPBQGLEZv5mj0s1I1lsfQObaLs="]; }; } diff --git a/profiles/cachix/nix-community.nix b/profiles/cachix/nix-community.nix index 7e4be28..994f816 100644 --- a/profiles/cachix/nix-community.nix +++ b/profiles/cachix/nix-community.nix @@ -1,10 +1,6 @@ { nix = { - binaryCaches = [ - "https://nix-community.cachix.org" - ]; - binaryCachePublicKeys = [ - "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" - ]; + settings.substituters = ["https://nix-community.cachix.org"]; + binaryCachePublicKeys = ["nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="]; }; } diff --git a/profiles/cachix/nixpkgs-wayland.nix b/profiles/cachix/nixpkgs-wayland.nix index aa84dce..7c9028b 100644 --- a/profiles/cachix/nixpkgs-wayland.nix +++ b/profiles/cachix/nixpkgs-wayland.nix @@ -1,10 +1,6 @@ { nix = { - binaryCaches = [ - "https://nixpkgs-wayland.cachix.org" - ]; - binaryCachePublicKeys = [ - "nixpkgs-wayland.cachix.org-1:3lwxaILxMRkVhehr5StQprHdEo4IrE8sRho9R9HOLYA=" - ]; + settings.substituters = ["https://nixpkgs-wayland.cachix.org"]; + binaryCachePublicKeys = ["nixpkgs-wayland.cachix.org-1:3lwxaILxMRkVhehr5StQprHdEo4IrE8sRho9R9HOLYA="]; }; } diff --git a/profiles/cachix/nrdxp.nix b/profiles/cachix/nrdxp.nix index bb3b4a5..5fa0576 100644 --- a/profiles/cachix/nrdxp.nix +++ b/profiles/cachix/nrdxp.nix @@ -1,10 +1,6 @@ { nix = { - binaryCaches = [ - "https://nrdxp.cachix.org" - ]; - binaryCachePublicKeys = [ - "nrdxp.cachix.org-1:Fc5PSqY2Jm1TrWfm88l6cvGWwz3s93c6IOifQWnhNW4=" - ]; + settings.substituters = ["https://nrdxp.cachix.org"]; + binaryCachePublicKeys = ["nrdxp.cachix.org-1:Fc5PSqY2Jm1TrWfm88l6cvGWwz3s93c6IOifQWnhNW4="]; }; } diff --git a/profiles/cachix/veloren-nix.nix b/profiles/cachix/veloren-nix.nix index 2aa0a45..1ed4fc1 100644 --- a/profiles/cachix/veloren-nix.nix +++ b/profiles/cachix/veloren-nix.nix @@ -1,10 +1,6 @@ { nix = { - binaryCaches = [ - "https://veloren-nix.cachix.org" - ]; - binaryCachePublicKeys = [ - "veloren-nix.cachix.org-1:zokfKJqVsNV6kI/oJdLF6TYBdNPYGSb+diMVQPn/5Rc=" - ]; + settings.substituters = ["https://veloren-nix.cachix.org"]; + binaryCachePublicKeys = ["veloren-nix.cachix.org-1:zokfKJqVsNV6kI/oJdLF6TYBdNPYGSb+diMVQPn/5Rc="]; }; } diff --git a/profiles/core/default.nix b/profiles/core/default.nix index f598d38..7bf5bc2 100644 --- a/profiles/core/default.nix +++ b/profiles/core/default.nix @@ -1,98 +1,101 @@ -{ self, inputs, config, pkgs, lib, ... }: +{ + self, + inputs, + config, + pkgs, + lib, + ... +}: let inherit (lib) fileContents mkIf; pkgBin = lib.our.pkgBinNoDep pkgs; - coreBin = v: "${pkgs.coreutils}/bin/${v}"; nixBin = "${config.nix.package}/bin/nix"; -in -{ - imports = [ ../cachix ../../locale ]; - +in { + imports = [../cachix ../../locale]; boot = { tmpOnTmpfs = true; loader.systemd-boot.configurationLimit = 10; }; - console.font = "7x14"; - environment = { - systemPackages = with pkgs; [ - binutils - coreutils - curl - direnv - dnsutils - dosfstools - fd - git - bottom - gptfdisk - iputils - jq - manix - moreutils - nix-index - nmap - ripgrep - skim - tealdeer - usbutils - utillinux - whois - bat - fzf - exa - git - lm_sensors - mkpasswd - ntfs3g - zoxide - bottom - amber - unzip - unrar - grit - hydra-check - nix-index - du-dust - mosh - ( - pkgs.runCommand "0x0.sh" { } '' - mkdir -p $out/bin - cp ${pkgs.fetchurl { - url = "https://raw.githubusercontent.com/Calinou/0x0/master/bin/0x0"; - sha256 = "sha256-Fad+AKBuA49qtRQfnroqjaNWeuRaCekXZG9sS9JVeaM="; - }} $out/bin/0x0 - chmod +x $out/bin/0x0 - '' - ) - ]; - + systemPackages = + with pkgs; [ + binutils + coreutils + curl + direnv + dnsutils + dosfstools + fd + git + bottom + gptfdisk + iputils + jq + manix + moreutils + nix-index + nmap + ripgrep + skim + tealdeer + usbutils + utillinux + whois + bat + fzf + exa + git + lm_sensors + mkpasswd + ntfs3g + zoxide + bottom + amber + unzip + unrar + grit + hydra-check + nix-index + du-dust + mosh + ( + pkgs.runCommand + "0x0.sh" + {} + '' + mkdir -p $out/bin + cp ${ + pkgs.fetchurl + { + url = "https://raw.githubusercontent.com/Calinou/0x0/master/bin/0x0"; + sha256 = "sha256-Fad+AKBuA49qtRQfnroqjaNWeuRaCekXZG9sS9JVeaM="; + } + } $out/bin/0x0 + chmod +x $out/bin/0x0 + '' + ) + ]; shellAliases = - let ifSudo = string: mkIf config.security.sudo.enable string; - in - { + 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"; git-optimize = "${pkgBin "git"} gc --aggressive --prune=now"; - cat = "${pkgBin "bat"} -pp --theme=base16"; c = "cat"; - du = "${pkgs.du-dust}/bin/dust"; 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"; @@ -109,34 +112,25 @@ in nsrp = "${nixBin} search nixpkgs"; ndev = "${nixBin} develop"; nrun = "${nixBin} run"; - nrefs = "nix-store -qR"; - noscd = "cd /etc/nixos"; nosrs = ifSudo "sudo nixos-rebuild --fast switch"; nosrb = ifSudo "sudo nixos-rebuild --fast boot"; nosrt = ifSudo "sudo nixos-rebuild --fast test"; ngc = ifSudo "sudo nix-collect-garbage"; ngcdo = 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"; - + myip = "${pkgs.dnsutils}/bin/dig +short myip.opendns.com @208.67.222.222 2>&1"; mn = - let manix_preview = "manix '{}' | sed 's/type: /> type: /g' | bat -l Markdown --color=always --plain"; in - ''manix "" | rg '^# ' | sed 's/^# \(.*\) (.*/\1/;s/ (.*//;s/^# //' | sk --preview="${manix_preview}" | xargs manix''; - - + let + manix_preview = "manix '{}' | sed 's/type: /> type: /g' | bat -l Markdown --color=always --plain"; + in ''manix "" | rg '^# ' | sed 's/^# \(.*\) (.*/\1/;s/ (.*//;s/^# //' | sk --preview="${manix_preview}" | xargs manix''; # fix nixos-option nixos-option = "nixos-option -I nixpkgs=${self}/lib/compat"; - # sudo s = ifSudo "sudo -E"; si = ifSudo "sudo -i"; se = ifSudo "sudoedit"; - # systemd ctl = "systemctl"; stl = ifSudo "s systemctl"; @@ -148,49 +142,46 @@ in jtl = "journalctl"; }; }; - - system.activationScripts.diff = '' - ${pkgs.nixUnstable}/bin/nix store \ - --experimental-features 'nix-command' \ - diff-closures /run/current-system "$systemConfig" - ''; - + system.activationScripts.diff = + '' + ${pkgs.nixUnstable}/bin/nix store \ + --experimental-features 'nix-command' \ + diff-closures /run/current-system "$systemConfig" + ''; nix = let registry = builtins.removeAttrs - (builtins.mapAttrs - (_: v: { flake = v; }) - (lib.filterAttrs (_: v: v ? outputs) inputs)) - [ "bud" ]; - in - { + (builtins.mapAttrs (_: v: { flake = v; }) (lib.filterAttrs (_: v: v ? outputs) inputs)) + ["bud"]; + in { package = pkgs.nixUnstable; - 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 - ''; + extraOptions = + '' + min-free = 536870912 + keep-outputs = true + keep-derivations = true + fallback = true + ''; inherit registry; + settings = { + sandbox = true; + allowed-users = ["@wheel"]; + trusted-users = ["root" "@wheel"]; + auto-optimise-store = true; + }; }; - programs.command-not-found.enable = false; home-manager.useGlobalPkgs = true; users.mutableUsers = false; - # For rage encryption, all hosts need a ssh key pair - /*services.openssh = { - enable = true; - openFirewall = lib.mkDefault false; - };*/ - + /* + services.openssh = { + enable = true; + openFirewall = lib.mkDefault false; + }; + */ services.earlyoom.enable = true; } - diff --git a/profiles/develop/default.nix b/profiles/develop/default.nix index a910968..28bc9bc 100644 --- a/profiles/develop/default.nix +++ b/profiles/develop/default.nix @@ -1,7 +1,9 @@ -{ pkgs, ... }: { - imports = [ ./editor ]; - - environment.systemPackages = with pkgs; [ git tokei ]; - +{ + pkgs, + ... +}: +{ + imports = [./editor]; + environment.systemPackages = with pkgs; [git tokei]; documentation.dev.enable = true; } diff --git a/profiles/develop/editor/default.nix b/profiles/develop/editor/default.nix index c17982c..1a2f416 100644 --- a/profiles/develop/editor/default.nix +++ b/profiles/develop/editor/default.nix @@ -1,6 +1,9 @@ -{ pkgs, ... }: { - imports = [ ./helix.nix ]; - - environment.systemPackages = with pkgs; [ nixpkgs-fmt ]; - environment.shellAliases = { nixf-all = "nixpkgs-fmt **/**.nix"; }; +{ + pkgs, + ... +}: +{ + imports = [./helix.nix]; + environment.systemPackages = with pkgs; [alejandra]; + environment.shellAliases = { nixf-all = "alejandra **/**.nix"; }; } diff --git a/profiles/develop/editor/helix.nix b/profiles/develop/editor/helix.nix index e93cee4..7abcf95 100644 --- a/profiles/develop/editor/helix.nix +++ b/profiles/develop/editor/helix.nix @@ -1,15 +1,15 @@ -{ pkgs, ... }: +{ + pkgs, + ... +}: let pkg = pkgs.helix; bin = "${pkg}/bin/hx"; -in -{ - environment.systemPackages = [ pkg ]; - +in { + environment.systemPackages = [pkg]; environment.sessionVariables = { EDITOR = bin; VISUAL = bin; }; - environment.shellAliases = { e = bin; }; } diff --git a/profiles/develop/editor/kakoune.nix b/profiles/develop/editor/kakoune.nix index 8ec1a0d..ff6c84b 100644 --- a/profiles/develop/editor/kakoune.nix +++ b/profiles/develop/editor/kakoune.nix @@ -1,14 +1,14 @@ -{ pkgs, ... }: +{ + pkgs, + ... +}: let pkg = pkgs.kakoune-unwrapped; -in -{ - environment.systemPackages = [ pkg ]; - +in { + environment.systemPackages = [pkg]; environment.sessionVariables = { EDITOR = "${pkg}/bin/kak"; VISUAL = "${pkg}/bin/kak"; }; - environment.shellAliases = { k = "${pkg}/bin/kak"; }; } diff --git a/profiles/develop/godot.nix b/profiles/develop/godot.nix index f331544..195deeb 100644 --- a/profiles/develop/godot.nix +++ b/profiles/develop/godot.nix @@ -1,7 +1,5 @@ -{ pkgs, ... }: { - environment.systemPackages = with pkgs; [ - godot-bin - godot-headless-bin - godot-server-bin - ]; -} +{ + pkgs, + ... +}: +{ environment.systemPackages = with pkgs; [godot-bin godot-headless-bin godot-server-bin]; } diff --git a/profiles/network/default.nix b/profiles/network/default.nix index 37b501a..bc5de15 100644 --- a/profiles/network/default.nix +++ b/profiles/network/default.nix @@ -1,10 +1,10 @@ { - imports = [ ./dns ]; - + imports = [./dns]; networking.dhcpcd.enable = false; networking.useDHCP = false; - networking.dhcpcd.extraConfig = '' - noarp - nodelay - ''; + networking.dhcpcd.extraConfig = + '' + noarp + nodelay + ''; } diff --git a/profiles/network/dns/default.nix b/profiles/network/dns/default.nix index 584d4b3..633c548 100644 --- a/profiles/network/dns/default.nix +++ b/profiles/network/dns/default.nix @@ -1,5 +1,4 @@ { - imports = [ ./nextdns.nix ]; - + imports = [./nextdns.nix]; networking.resolvconf.useLocalResolver = true; } diff --git a/profiles/network/dns/nextdns.nix b/profiles/network/dns/nextdns.nix index bf4ef01..1e92168 100644 --- a/profiles/network/dns/nextdns.nix +++ b/profiles/network/dns/nextdns.nix @@ -1,6 +1,7 @@ -{ ... }: { +{ ... }: +{ services.nextdns = { enable = true; - arguments = [ "-config" "75e43d" ]; + arguments = ["-config" "75e43d"]; }; } diff --git a/profiles/network/dns/stubby/default.nix b/profiles/network/dns/stubby/default.nix index 7851537..844fde6 100644 --- a/profiles/network/dns/stubby/default.nix +++ b/profiles/network/dns/stubby/default.nix @@ -1,6 +1,5 @@ { - imports = [ ./nextdns.nix ]; - + imports = [./nextdns.nix]; networking.networkmanager.dns = "none"; services.stubby.enable = true; } diff --git a/profiles/network/dns/stubby/nextdns.nix b/profiles/network/dns/stubby/nextdns.nix index d15363a..cfcfc24 100644 --- a/profiles/network/dns/stubby/nextdns.nix +++ b/profiles/network/dns/stubby/nextdns.nix @@ -2,9 +2,9 @@ services.stubby = { roundRobinUpstreams = false; upstreamServers = - let nextDnsId = "75e43d"; - in - '' + let + nextDnsId = "75e43d"; + in '' - address_data: 45.90.28.0 tls_auth_name: "${nextDnsId}.dns1.nextdns.io" - address_data: 2a07:a8c0::0 diff --git a/profiles/network/iwd.nix b/profiles/network/iwd.nix index 04506f9..990c657 100644 --- a/profiles/network/iwd.nix +++ b/profiles/network/iwd.nix @@ -1,6 +1,5 @@ { - imports = [ ./dns ]; - + imports = [./dns]; networking.wireless.iwd.enable = true; networking.networkmanager.wifi.backend = "iwd"; services.connman.wifi.backend = "iwd"; diff --git a/profiles/network/networkmanager/default.nix b/profiles/network/networkmanager/default.nix index a5da3e5..871f6ca 100644 --- a/profiles/network/networkmanager/default.nix +++ b/profiles/network/networkmanager/default.nix @@ -1,5 +1,4 @@ { - imports = [ ../dns ]; - + imports = [../dns]; networking.networkmanager.enable = true; } diff --git a/profiles/network/wpa_supplicant.nix b/profiles/network/wpa_supplicant.nix index 1ce15b1..d284604 100644 --- a/profiles/network/wpa_supplicant.nix +++ b/profiles/network/wpa_supplicant.nix @@ -1,6 +1,5 @@ { - imports = [ ./dns ]; - + imports = [./dns]; networking.wireless = { enable = true; userControlled.enable = true; diff --git a/secrets/secrets.nix b/secrets/secrets.nix index 15b279b2fc2d4e1f0a5fcba26a159805afa6b484..460f579d39e1818ee5c8a57fdf2785a4da36bae9 100644 GIT binary patch literal 289 zcmV++0p9)qM@dveQdv+`0Q1#`y_egP1`f;tEKj(( z!Mdr?4<`Qa>di`r-w0f&n30MZ$SzW|`j#Ep`ItfNo9o6%1)Keq>lNMXy=-$g>Ordh zFQj72aRpF3-|-PtJWtD~#Rp@l=x<9rGqFo*-vM n#h$G|dH$$~5cN%Mm0gyM#qI(=x1p>pjKZKv1G)wk*|fe$ zx=nf8RQwcLGdQD;2vn0Fcp+<#Z}+gk&z+qOEj#tU?_#Uz1Z?!fU@8ds z8FE=5qw^8~v~599OUCJBGVi$D_K`ym=^l-hQkGAL!%Bf;#b9BB{QCSJJn8 zYWsNYd3X2Jk6NBuhW-5Jw)?1NVc%+i9*zh+;`Y4GB(Wn;dsH6z*J{il`XCZT|5*DN zx{b)pm552%#pDPQTd&APz%Uru_r!-*@`QIo^4NWo5;FYlP6#`nUtozjA=9McQGw$N ldrIPE`aV&NMjf&KG)pp`%)DA~g%sZoFjHcOU$(vz2U*S(kAwgK diff --git a/shell/default.nix b/shell/default.nix index 410410c..b638d4a 100644 --- a/shell/default.nix +++ b/shell/default.nix @@ -1,10 +1,12 @@ -{ self, inputs, ... }: { - modules = with inputs; [ - #bud.devshellModules.bud - ]; - exportedModules = [ - ./devos.nix - ]; + self, + inputs, + ... +}: +{ + modules = + with inputs; [ + #bud.devshellModules.bud + ]; + exportedModules = [./devos.nix]; } - diff --git a/shell/devos.nix b/shell/devos.nix index 0491d8b..7a4cc20 100644 --- a/shell/devos.nix +++ b/shell/devos.nix @@ -1,61 +1,56 @@ -{ pkgs, extraModulesPath, ... }: +{ + pkgs, + extraModulesPath, + ... +}: let - hooks = import ./hooks; - pkgWithCategory = category: package: { inherit package category; }; linter = pkgWithCategory "linter"; docs = pkgWithCategory "docs"; devos = pkgWithCategory "devos"; - -in -{ +in { _file = toString ./.; - - imports = [ "${extraModulesPath}/git/hooks.nix" ]; + imports = ["${extraModulesPath}/git/hooks.nix"]; git = { inherit hooks; }; - # tempfix: remove when merged https://github.com/numtide/devshell/pull/123 - devshell.startup.load_profiles = pkgs.lib.mkForce (pkgs.lib.noDepEntry '' - # PATH is devshell's exorbitant privilige: - # fence against its pollution - _PATH=''${PATH} - # Load installed profiles - for file in "$DEVSHELL_DIR/etc/profile.d/"*.sh; do - # If that folder doesn't exist, bash loves to return the whole glob - [[ -f "$file" ]] && source "$file" - done - # Exert exorbitant privilige and leave no trace - export PATH=''${_PATH} - unset _PATH - ''); - - packages = with pkgs; [ - git-crypt - ]; - - commands = with pkgs; [ - (devos nixUnstable) - #(devos agenix) - /*{ - category = "devos"; - name = pkgs.nvfetcher-bin.pname; - help = pkgs.nvfetcher-bin.meta.description; - command = "cd $PRJ_ROOT/pkgs; ${pkgs.nvfetcher-bin}/bin/nvfetcher -c ./sources.toml $@"; - }*/ - (linter nixpkgs-fmt) - (linter editorconfig-checker) - # (docs python3Packages.grip) too many deps - # (docs mdbook) - ] - - ++ lib.optional - (pkgs ? deploy-rs) - (devos deploy-rs.deploy-rs) - - ++ lib.optional - (system != "i686-linux") - (devos cachix) - - ; + devshell.startup.load_profiles = + pkgs.lib.mkForce + ( + pkgs.lib.noDepEntry + '' + # PATH is devshell's exorbitant privilige: + # fence against its pollution + _PATH=''${PATH} + # Load installed profiles + for file in "$DEVSHELL_DIR/etc/profile.d/"*.sh; do + # If that folder doesn't exist, bash loves to return the whole glob + [[ -f "$file" ]] && source "$file" + done + # Exert exorbitant privilige and leave no trace + export PATH=''${_PATH} + unset _PATH + '' + ); + packages = with pkgs; [git-crypt]; + commands = + with pkgs; + [ + (devos nixUnstable) + #(devos agenix) + /* + { + category = "devos"; + name = pkgs.nvfetcher-bin.pname; + help = pkgs.nvfetcher-bin.meta.description; + command = "cd $PRJ_ROOT/pkgs; ${pkgs.nvfetcher-bin}/bin/nvfetcher -c ./sources.toml $@"; + } + */ + #(linter nixpkgs-fmt) + #(linter editorconfig-checker) + # (docs python3Packages.grip) too many deps + # (docs mdbook) + ] + ++ lib.optional (pkgs ? deploy-rs) (devos deploy-rs.deploy-rs) + ++ lib.optional (system != "i686-linux") (devos cachix); } diff --git a/shell/hooks/default.nix b/shell/hooks/default.nix index 10f2c9d..4c9e464 100644 --- a/shell/hooks/default.nix +++ b/shell/hooks/default.nix @@ -1,4 +1,4 @@ { - enable = true; + enable = false; pre-commit.text = builtins.readFile ./pre-commit.sh; } diff --git a/users/nixos/default.nix b/users/nixos/default.nix index d0f85ef..c867d7d 100644 --- a/users/nixos/default.nix +++ b/users/nixos/default.nix @@ -5,6 +5,6 @@ password = "nixos"; description = "default"; isNormalUser = true; - extraGroups = [ "wheel" ]; + extraGroups = ["wheel"]; }; } diff --git a/users/patriot/default.nix b/users/patriot/default.nix index f0f0626..a199588 100644 --- a/users/patriot/default.nix +++ b/users/patriot/default.nix @@ -1,36 +1,40 @@ -{ config, pkgs, lib, ... }: +{ + config, + pkgs, + lib, + ... +}: let inherit (lib) mapAttrs' nameValuePair; inherit (builtins) readDir fetchGit; pkgBin = lib.our.pkgBinNoDep pkgs; - nixosConfig = config; -in -{ +in { users.users.patriot = { isNormalUser = true; createHome = true; home = "/home/patriot"; - extraGroups = [ "wheel" "adbusers" "dialout" /* "wireshark" */ ]; + extraGroups = [ + "wheel" + "adbusers" + "dialout" + /* + "wireshark" + */ + ]; shell = pkgs.zsh; hashedPassword = "$6$spzqhAyJfhHy$iHgLBlhjGn1l8PnbjJdWTn1GPvcjMqYNKUzdCe/7IrX6sHNgETSr/Nfpdmq9FCXLhrAfwHOd/q/8SvfeIeNX4/"; }; - environment = { - systemPackages = [ pkgs.qt5.qtwayland ]; - shells = with pkgs; [ bashInteractive zsh ]; + systemPackages = [pkgs.qt5.qtwayland]; + shells = with pkgs; [bashInteractive zsh]; }; - xdg.portal = { enable = true; gtkUsePortal = true; - extraPortals = with pkgs; [ - xdg-desktop-portal - xdg-desktop-portal-wlr - ]; + extraPortals = with pkgs; [xdg-desktop-portal xdg-desktop-portal-wlr]; }; - programs = { adb.enable = true; steam.enable = true; @@ -40,7 +44,6 @@ in }; wireshark.enable = false; }; - security = { pam.services.patriot = { enableGnomeKeyring = true; @@ -48,11 +51,13 @@ in }; sudo.extraRules = [ { - users = [ "patriot" ]; - commands = [{ - command = "${pkgs.profile-sync-daemon}/bin/psd-overlay-helper"; - options = [ "SETENV" "NOPASSWD" ]; - }]; + users = ["patriot"]; + commands = [ + { + command = "${pkgs.profile-sync-daemon}/bin/psd-overlay-helper"; + options = ["SETENV" "NOPASSWD"]; + } + ]; } ]; }; @@ -86,32 +91,29 @@ in }; }; }; - - systemd.user.services.gnome-session-restart-dbus.serviceConfig = { - Slice = "-.slice"; - }; + systemd.user.services.gnome-session-restart-dbus.serviceConfig = { Slice = "-.slice"; }; systemd = { - targets = { - network-online.enable = false; - }; + targets = { network-online.enable = false; }; services = { systemd-networkd-wait-online.enable = false; NetworkManager-wait-online.enable = false; }; }; - home-manager.users.patriot = - { config, pkgs, suites, ... }: + { + config, + pkgs, + suites, + ... + }: let personal = import ../../personal.nix; name = personal.name; email = personal.emails.primary; - - font = "Iosevka Term"; - fontSize = 12; + font = "Monoid"; + fontSize = 10; fontComb = "${font} ${toString fontSize}"; - fontPackage = pkgs.iosevka; - + fontPackage = pkgs.monoid; colorSchemeLight = { primary = { normal = { @@ -146,7 +148,6 @@ in white = "3a4d53"; }; }; - colorSchemeDark = let normal = { @@ -171,10 +172,8 @@ in cyan = "56d8c9"; white = "dedede"; }; - in - { + in { inherit normal bright; - primary = { normal = { background = "181818"; @@ -186,16 +185,13 @@ in }; }; }; - 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}"; @@ -204,7 +200,6 @@ in normal = lib.mapAttrs (_: v: "0x${v}") colorScheme.normal; bright = lib.mapAttrs (_: v: "0x${v}") colorScheme.bright; }; - # sway attrs reused focusedWorkspace = { background = "#${bgColor}"; @@ -226,78 +221,73 @@ in 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 - { + 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 = suites.base; - # 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"; - }; - };*/ - + /* + 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; - [ + packages = + with pkgs; [ # Font stuff fontPackage noto-fonts-cjk font-awesome dejavu_fonts - (nerdfonts.override { fonts = [ "Iosevka" ]; }) + (nerdfonts.override { fonts = ["Monoid"]; }) # Programs - #discord-canary-system vulkan-tools - audacity krita - gimp - kdenlive gnome3.seahorse - gnome3.gnome-boxes cachix appimage-run - bitwarden pfetch gnupg imv @@ -306,47 +296,63 @@ in ffmpeg mupdf transmission-qt - (lib.hiPrio (lutris.overrideAttrs (old: { - profile = '' - ${old.profile or ""} - unset VK_ICD_FILENAMES - export VK_ICD_FILENAMES=${nixosConfig.environment.variables.VK_ICD_FILENAMES}''; - }))) + ( + lib.hiPrio + ( + lutris.overrideAttrs + ( + old: { + profile = + '' + ${old.profile or ""} + unset VK_ICD_FILENAMES + export VK_ICD_FILENAMES=${nixosConfig.environment.variables.VK_ICD_FILENAMES}''; + } + ) + ) + ) xdg_utils tagref - libreoffice-fresh hydrus papirus-icon-theme wl-clipboard rust-analyzer - (lib.hiPrio (steam.override { - extraLibraries = pkgs: [ pkgs.pipewire ]; - extraProfile = '' - unset VK_ICD_FILENAMES - export VK_ICD_FILENAMES=${nixosConfig.environment.variables.VK_ICD_FILENAMES}''; - })) - /*(multimc.overrideAttrs (old: { - src = builtins.fetchGit { url = "https://github.com/AfoninZ/MultiMC5-Cracked.git"; ref = "develop"; rev = "9069e9c9d0b7951c310fdcc8bdc70ebc422a7634"; submodules = true; }; - }))*/ + ( + lib.hiPrio + ( + steam.override + { + extraLibraries = pkgs: [pkgs.pipewire]; + extraProfile = + '' + unset VK_ICD_FILENAMES + export VK_ICD_FILENAMES=${nixosConfig.environment.variables.VK_ICD_FILENAMES}''; + } + ) + ) + /* + (multimc.overrideAttrs (old: { + src = builtins.fetchGit { url = "https://github.com/AfoninZ/MultiMC5-Cracked.git"; ref = "develop"; rev = "9069e9c9d0b7951c310fdcc8bdc70ebc422a7634"; submodules = true; }; + })) + */ + standardnotes ]; }; - wayland.windowManager = { sway = { enable = false; extraSessionCommands = extraEnv; wrapperFeatures.gtk = true; - extraConfig = '' - exec dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=sway - ''; + extraConfig = + '' + exec dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=sway + ''; config = { fonts = { - names = [ font ]; + names = [font]; size = fontSize + 0.0; }; - bars = [{ - command = "${pkgBin "waybar"}"; - }]; + bars = [{ command = "${pkgBin "waybar"}"; }]; colors = { background = "#${bgColor}"; focused = addIndSway focusedWorkspace; @@ -369,58 +375,54 @@ in 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')"; + 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"; - }; + 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"; - }; - }; + output = { "*" = { bg = config.home.homeDirectory + "/wallpaper.png" + " fill"; }; }; }; }; }; - programs = { alacritty = { enable = true; settings = { shell = { program = "${pkgs.tmux}/bin/tmux"; - args = [ "attach" ]; + args = ["attach"]; }; font = { normal = { family = font; }; @@ -437,24 +439,33 @@ in escapeTime = 0; keyMode = "vi"; shortcut = "a"; - extraConfig = '' - set -g default-terminal "alacritty" - set -ga terminal-overrides ",alacritty:Tc" - set -g status off - ''; + extraConfig = + '' + set -g default-terminal "alacritty" + set -ga terminal-overrides ",alacritty:Tc" + set -g status off + ''; }; chromium = { enable = true; package = pkgs.chromium; extensions = [ - "gcbommkclmclpchllfjekcdonpmejbdp" # https everywhere - "cjpalhdlnbpafiamejdnhcphjbkeiagm" # ublock - "nngceckbapebfimnlniiiahkandclblb" # bitwarden - "ldpochfccmkkmhdbclfhpagapcfdljkj" # decentraleyes - "annfbnbieaamhaimclajlajpijgkdblo" # dark theme - "eimadpbcbfnmbkopoojfekhnkhdbieeh" # dark reader - "hlepfoohegkhhmjieoechaddaejaokhf" # github refined - "pmcmeagblkinmogikoikkdjiligflglb" # privacy redirect + "gcbommkclmclpchllfjekcdonpmejbdp" + # https everywhere + "cjpalhdlnbpafiamejdnhcphjbkeiagm" + # ublock + "nngceckbapebfimnlniiiahkandclblb" + # bitwarden + "ldpochfccmkkmhdbclfhpagapcfdljkj" + # decentraleyes + "annfbnbieaamhaimclajlajpijgkdblo" + # dark theme + "eimadpbcbfnmbkopoojfekhnkhdbieeh" + # dark reader + "hlepfoohegkhhmjieoechaddaejaokhf" + # github refined + "pmcmeagblkinmogikoikkdjiligflglb" + # privacy redirect ]; }; qutebrowser = { @@ -480,11 +491,11 @@ in "youtube.com" "docker.com" ]; - enableJsForDomain = d: '' - config.set('content.javascript.enabled', True, 'https://*.${d}') - ''; - in - '' + enableJsForDomain = + d: '' + config.set('content.javascript.enabled', True, 'https://*.${d}') + ''; + in '' ${lib.concatStrings (map enableJsForDomain domains)} ''; }; @@ -520,55 +531,63 @@ in plugins = let fast-syntax-highlighting = - let name = "fast-syntax-highlighting"; in - { + 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="; - }; + src = + pkgs.fetchFromGitHub + { + owner = "jimhester"; + repo = "per-directory-history"; + rev = "d2e291dd6434e340d9be0e15e1f5b94f32771c06"; + hash = "sha256-VHRgrVCqzILqOes8VXGjSgLek38BFs9eijmp0JHtD5Q="; + }; }; - in - [ fast-syntax-highlighting per-directory-history ]; + in [fast-syntax-highlighting per-directory-history]; # xdg compliant dotDir = ".config/zsh"; history.path = ".local/share/zsh/history"; envExtra = extraEnv; - /*loginExtra = + /* + loginExtra = + '' + if [ "$(${pkgs.coreutils}/bin/tty)" = "/dev/tty1" ]; then + exec sway + fi + ''; + */ + initExtra = '' - if [ "$(${pkgs.coreutils}/bin/tty)" = "/dev/tty1" ]; then - exec sway - fi - '';*/ - initExtra = '' - export TERM=alacritty - export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket) + export TERM=alacritty + export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket) - function tomp4 () { - ${pkgs.ffmpeg}/bin/ffmpeg -i $1 -c:v libx264 -preset slow -crf 30 -c:a aac -b:a 128k "$1.mp4" - } + 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" - } + function topng () { + ${pkgs.ffmpeg}/bin/ffmpeg -i $1 "$1.png" + } - bindkey "$terminfo[kRIT5]" forward-word - bindkey "$terminfo[kLFT5]" backward-word - zstyle ':completion:*' menu select + bindkey "$terminfo[kRIT5]" forward-word + bindkey "$terminfo[kLFT5]" backward-word + zstyle ':completion:*' menu select - eval "$(zoxide init zsh)" - ''; - shellAliases = nixosConfig.environment.shellAliases // { - harmony-ssh = '' - ${pkgs.mosh}/bin/mosh root@chat.harmonyapp.io + eval "$(zoxide init zsh)" ''; - }; + shellAliases = + nixosConfig.environment.shellAliases + // { + harmony-ssh = + '' + ${pkgs.mosh}/bin/mosh root@chat.harmonyapp.io + ''; + }; }; fzf.enable = true; rofi = @@ -576,8 +595,7 @@ in bgc = "#${bgColor}"; fgc = "#${fgColor}"; acc = "#${acColor}"; - in - { + in { enable = false; cycle = true; font = fontComb; @@ -588,39 +606,68 @@ in package = pkgs.vscodeWayland; extensions = let - mkExt = n: v: p: s: { name = n; version = v; publisher = p; sha256 = s; }; + mkExt = + n: v: p: s: { + name = n; + version = v; + publisher = p; + sha256 = s; + }; in - (pkgs.vscode-utils.extensionsFromVscodeMarketplace [ - # Rust - (mkExt "rust-analyzer" "0.2.760" "matklad" "sha256-M+eFqIFwiKkiwqFRwkX5h6mc/W+NBqkXcNUdTewwkCI=") - (mkExt "even-better-toml" "0.14.2" "tamasfe" "sha256-lE2t+KUfClD/xjpvexTJlEr7Kufo+22DUM9Ju4Tisp0=") - (mkExt "crates" "0.5.9" "serayuzgur" "sha256-YHIbnl2R7lqwJHi8qUQImClx9MWm+5Pc12vYw7e/RlA=") - # Nix - (mkExt "nix-env-selector" "1.0.7" "arrterian" "sha256-DnaIXJ27bcpOrIp1hm7DcrlIzGSjo4RTJ9fD72ukKlc=") - # Go - (mkExt "Go" "0.25.1" "golang" "sha256-ZDUWN9lzDnR77W7xcMFQaaFl/6Lf/x1jgaBkwZPqGGw=") - # Flutter and dart - (mkExt "flutter" "3.22.0" "Dart-Code" "sha256-woygN6hOWlP2UayqwDhJh9KcZk1GzH7mDF5IueDRxs4=") - (mkExt "dart-code" "3.22.0" "Dart-Code" "sha256-1nTewVmlrxbXdRR1EPts46u24LHdnP5BblFsMaGlNYg=") - # protobuf - (mkExt "vscode-proto3" "0.5.4" "zxh404" "sha256-S89qRRlfiTsJ+fJuwdNkZywe6mei48KxIEWbGWChriE=") - (mkExt "vscode-buf" "0.3.1" "bufbuild" "sha256-KjU6WlDxYPPJjh45mCq6Kczi6odYwnLaGj4RHe3fc2w=") - # git - (mkExt "gitlens" "11.6.0" "eamodio" "sha256-JxCNE/IL/v94xWmhebsRZo1Gw+nSSpDgZ41ZGongGVI=") - (mkExt "vscode-commitizen" "0.14.1" "KnisterPeter" "sha256-yw8XKGL7Ul9wV+C0yL1LFJCE3+E8u/sR9s3TjkGJPZM=") - # Customization - # (mkExt "dance" "0.3.2" "gregoire" "sha256-+g8EXeCkPOPvZ60JoXkGTeSXYWrXmKrcbUaEfDppdgA=") - (mkExt "material-icon-theme" "4.6.0" "PKief" "sha256-i+3lrw3mDqK2vTMDhJYTACW5JleA+lN1XAC2imgQLUo=") - (mkExt "github-vscode-theme" "4.1.1" "GitHub" "sha256-yLySHOx6pe7w2cyi95pQlKkn/o4VMCTkrTYHu8ASn5M=") - (mkExt "koka" "0.0.1" "maelvalais" "sha256-ty8Mql19HgUWForggeZuHQpzTbmmB/eBFHqof5ZMKr0=") - (mkExt "vscode-rhai" "0.6.3" "rhaiscript" "sha256-gEdpM/TkkiZ50bG9qDU6BH04AJLRDcHLquniRs6m0mg=") - (mkExt "copilot" "1.2.1991" "GitHub" "sha256-pGb5xfjuy+g646doZEuKhQalkOte5dH+I+1op+vZY48=") - ]) ++ (with pkgs.vscode-extensions; [ a5huynh.vscode-ron /* vadimcn.vscode-lldb */ jnoortheen.nix-ide ]); + ( + pkgs.vscode-utils.extensionsFromVscodeMarketplace + [ + # Rust + (mkExt "rust-analyzer" "0.2.760" "matklad" "sha256-M+eFqIFwiKkiwqFRwkX5h6mc/W+NBqkXcNUdTewwkCI=") + (mkExt "even-better-toml" "0.14.2" "tamasfe" "sha256-lE2t+KUfClD/xjpvexTJlEr7Kufo+22DUM9Ju4Tisp0=") + (mkExt "crates" "0.5.9" "serayuzgur" "sha256-YHIbnl2R7lqwJHi8qUQImClx9MWm+5Pc12vYw7e/RlA=") + # Nix + ( + mkExt "nix-env-selector" "1.0.7" "arrterian" "sha256-DnaIXJ27bcpOrIp1hm7DcrlIzGSjo4RTJ9fD72ukKlc=" + ) + # Go + (mkExt "Go" "0.25.1" "golang" "sha256-ZDUWN9lzDnR77W7xcMFQaaFl/6Lf/x1jgaBkwZPqGGw=") + # Flutter and dart + (mkExt "flutter" "3.22.0" "Dart-Code" "sha256-woygN6hOWlP2UayqwDhJh9KcZk1GzH7mDF5IueDRxs4=") + (mkExt "dart-code" "3.22.0" "Dart-Code" "sha256-1nTewVmlrxbXdRR1EPts46u24LHdnP5BblFsMaGlNYg=") + # protobuf + (mkExt "vscode-proto3" "0.5.4" "zxh404" "sha256-S89qRRlfiTsJ+fJuwdNkZywe6mei48KxIEWbGWChriE=") + (mkExt "vscode-buf" "0.3.1" "bufbuild" "sha256-KjU6WlDxYPPJjh45mCq6Kczi6odYwnLaGj4RHe3fc2w=") + # git + (mkExt "gitlens" "11.6.0" "eamodio" "sha256-JxCNE/IL/v94xWmhebsRZo1Gw+nSSpDgZ41ZGongGVI=") + ( + mkExt + "vscode-commitizen" + "0.14.1" + "KnisterPeter" + "sha256-yw8XKGL7Ul9wV+C0yL1LFJCE3+E8u/sR9s3TjkGJPZM=" + ) + # Customization + # (mkExt "dance" "0.3.2" "gregoire" "sha256-+g8EXeCkPOPvZ60JoXkGTeSXYWrXmKrcbUaEfDppdgA=") + (mkExt "material-icon-theme" "4.6.0" "PKief" "sha256-i+3lrw3mDqK2vTMDhJYTACW5JleA+lN1XAC2imgQLUo=") + ( + mkExt "github-vscode-theme" "4.1.1" "GitHub" "sha256-yLySHOx6pe7w2cyi95pQlKkn/o4VMCTkrTYHu8ASn5M=" + ) + (mkExt "koka" "0.0.1" "maelvalais" "sha256-ty8Mql19HgUWForggeZuHQpzTbmmB/eBFHqof5ZMKr0=") + (mkExt "vscode-rhai" "0.6.3" "rhaiscript" "sha256-gEdpM/TkkiZ50bG9qDU6BH04AJLRDcHLquniRs6m0mg=") + (mkExt "copilot" "1.2.1991" "GitHub" "sha256-pGb5xfjuy+g646doZEuKhQalkOte5dH+I+1op+vZY48=") + ] + ) + ++ ( + 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.loadOutDirsFromCheck" = true; "rust-analyzer.procMacro.enable" = true; + "rust-analyzer.server.path" = "${pkgs.rust-analyzer}/bin/rust-analyzer"; "rust-analyzer.updates.channel" = "nightly"; "editor.fontFamily" = "'${font}'"; "debug.console.fontFamily" = "${font}"; @@ -634,117 +681,124 @@ in }; }; }; - services = { gpg-agent = let defaultCacheTtl = 3600 * 6; maxCacheTtl = 3600 * 24; - in - { + in { inherit defaultCacheTtl maxCacheTtl; - enable = true; enableSshSupport = true; - sshKeys = [ "8369D9CA26C3EAAAB8302A88CEE6FD14B58AA965" ]; + sshKeys = ["8369D9CA26C3EAAAB8302A88CEE6FD14B58AA965"]; defaultCacheTtlSsh = defaultCacheTtl; maxCacheTtlSsh = maxCacheTtl; grabKeyboardAndMouse = false; pinentryFlavor = "qt"; }; }; - xdg = { enable = true; configFile = { - "helix/themes/mytheme.toml".text = '' - "attribute" = { fg = "#${colorScheme.bright.yellow}]" } - "comment" = { fg = "#${colorScheme.normal.gray}", modifiers = ['italic'] } - "constant" = { fg = "#${colorScheme.normal.blue}" } - "constant.builtin" = { fg = "#${colorScheme.bright.blue}" } - "constructor" = { fg = "#${colorScheme.bright.blue}" } - "escape" = { fg = "#${colorScheme.bright.yellow}" } - "function" = { fg = "#${colorScheme.bright.blue}" } - "function.builtin" = { fg = "#${colorScheme.bright.blue}" } - "function.macro" = { fg = "#${colorScheme.bright.magenta}" } - "keyword" = { fg = "#${colorScheme.normal.magenta}", modifiers = ['italic'] } - "keyword.directive" = { fg = "#${colorScheme.normal.magenta}" } - "label" = { fg = "#${colorScheme.bright.magenta}" } - "namespace" = { fg = "#${colorScheme.bright.blue}" } - "number" = { fg = "#${colorScheme.normal.cyan}" } - "operator" = { fg = "#${colorScheme.bright.magenta}", modifiers = ['italic'] } - "property" = { fg = "#${colorScheme.normal.red}" } - "special" = { fg = "#${colorScheme.bright.blue}" } - "string" = { fg = "#${colorScheme.normal.green}" } - "type" = { fg = "#${colorScheme.normal.cyan}", modifiers = ['bold'] } - "type.builtin" = { fg = "#${colorScheme.normal.cyan}", modifiers = ['bold'] } - "variable" = { fg = "#${colorScheme.bright.blue}", modifiers = ['italic'] } - "variable.builtin" = { fg = "#${colorScheme.bright.blue}", modifiers = ['italic'] } - "variable.parameter" = { fg = "#${colorScheme.bright.red}", modifiers = ['italic'] } - "ui.menu.selected" = { fg = "#${bgColor}", bg = "#${acColor}" } - "ui.background" = { fg = "#${fgColor}", bg = "#${bgColor}" } - "ui.help" = { bg = "#${colorScheme.normal.black}" } - "ui.linenr" = { fg = "#${colorScheme.primary.bright.background}", modifiers = ['bold'] } - "ui.linenr.selected" = { fg = "#${fgColor}", modifiers = ['bold'] } - "ui.popup" = { bg = "#${colorScheme.normal.black}" } - "ui.statusline" = { fg = "#${fgColor}", bg = "#${bgColor}" } - "ui.statusline.inactive" = { fg = "#${fgColor}", bg = "#${bgColor}" } - "ui.selection" = { bg = "#${colorScheme.primary.bright.background}" } - "ui.text" = { fg = "#${fgColor}", bg = "#${bgColor}" } - "ui.text.focus" = { fg = "#${fgColor}", bg = "#${bgColor}", modifiers = ['bold'] } - "ui.window" = { bg = "#${bgColor}" } - "ui.cursor.primary" = { fg = "#${fgColor}", modifiers = ["reversed"] } + "helix/themes/mytheme.toml".text = + '' + "attribute" = { fg = "#${colorScheme.bright.yellow}]" } + "comment" = { fg = "#${colorScheme.normal.gray}", modifiers = ['italic'] } + "constant" = { fg = "#${colorScheme.normal.blue}" } + "constant.builtin" = { fg = "#${colorScheme.bright.blue}" } + "constructor" = { fg = "#${colorScheme.bright.blue}" } + "escape" = { fg = "#${colorScheme.bright.yellow}" } + "function" = { fg = "#${colorScheme.bright.blue}" } + "function.builtin" = { fg = "#${colorScheme.bright.blue}" } + "function.macro" = { fg = "#${colorScheme.bright.magenta}" } + "keyword" = { fg = "#${colorScheme.normal.magenta}", modifiers = ['italic'] } + "keyword.directive" = { fg = "#${colorScheme.normal.magenta}" } + "label" = { fg = "#${colorScheme.bright.magenta}" } + "namespace" = { fg = "#${colorScheme.bright.blue}" } + "number" = { fg = "#${colorScheme.normal.cyan}" } + "operator" = { fg = "#${colorScheme.bright.magenta}", modifiers = ['italic'] } + "property" = { fg = "#${colorScheme.normal.red}" } + "special" = { fg = "#${colorScheme.bright.blue}" } + "string" = { fg = "#${colorScheme.normal.green}" } + "type" = { fg = "#${colorScheme.normal.cyan}", modifiers = ['bold'] } + "type.builtin" = { fg = "#${colorScheme.normal.cyan}", modifiers = ['bold'] } + "variable" = { fg = "#${colorScheme.bright.blue}", modifiers = ['italic'] } + "variable.builtin" = { fg = "#${colorScheme.bright.blue}", modifiers = ['italic'] } + "variable.parameter" = { fg = "#${colorScheme.bright.red}", modifiers = ['italic'] } + "ui.menu.selected" = { fg = "#${bgColor}", bg = "#${acColor}" } + "ui.background" = { fg = "#${fgColor}", bg = "#${bgColor}" } + "ui.help" = { bg = "#${colorScheme.normal.black}" } + "ui.linenr" = { fg = "#${colorScheme.primary.bright.background}", modifiers = ['bold'] } + "ui.linenr.selected" = { fg = "#${fgColor}", modifiers = ['bold'] } + "ui.popup" = { bg = "#${colorScheme.normal.black}" } + "ui.statusline" = { fg = "#${fgColor}", bg = "#${bgColor}" } + "ui.statusline.inactive" = { fg = "#${fgColor}", bg = "#${bgColor}" } + "ui.selection" = { bg = "#${colorScheme.primary.bright.background}" } + "ui.text" = { fg = "#${fgColor}", bg = "#${bgColor}" } + "ui.text.focus" = { fg = "#${fgColor}", bg = "#${bgColor}", modifiers = ['bold'] } + "ui.window" = { bg = "#${bgColor}" } + "ui.cursor.primary" = { fg = "#${fgColor}", modifiers = ["reversed"] } - "info" = { fg = "#${colorScheme.normal.blue}", modifiers = ['bold'] } - "hint" = { fg = "#${colorScheme.bright.green}", modifiers = ['bold'] } - "warning" = { fg = "#${colorScheme.normal.yellow}", modifiers = ['bold'] } - "error" = { fg = "#${colorScheme.bright.red}", modifiers = ['bold'] } - ''; - "helix/config.toml".text = '' - theme = "mytheme" - [editor] - line-number = "relative" - [lsp] - display-messages = true - ''; - "helix/languages.toml".text = '' - [[language]] - name = "nix" - language-server = { command = "${pkgBin "rnix-lsp"}" } - ''; + "info" = { fg = "#${colorScheme.normal.blue}", modifiers = ['bold'] } + "hint" = { fg = "#${colorScheme.bright.green}", modifiers = ['bold'] } + "warning" = { fg = "#${colorScheme.normal.yellow}", modifiers = ['bold'] } + "error" = { fg = "#${colorScheme.bright.red}", modifiers = ['bold'] } + ''; + "helix/config.toml".text = + '' + theme = "mytheme" + [editor] + line-number = "relative" + [lsp] + display-messages = true + ''; + "helix/languages.toml".text = + '' + [[language]] + name = "nix" + language-server = { command = "${pkgBin "rnix-lsp"}" } + ''; "waybar/config".text = - let swayEnabled = config.wayland.windowManager.sway.enable; in - builtins.toJSON { - 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" ]; - tray = { spacing = 8; }; - cpu = { format = "/cpu {usage}/"; }; - memory = { format = "/mem {}/"; }; - temperature = { - hwmon-path = "/sys/class/hwmon/hwmon1/temp2_input"; - format = "/tmp {temperatureC}C/"; + let + swayEnabled = config.wayland.windowManager.sway.enable; + in + builtins.toJSON + { + 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"]; + 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/"; + }; }; - 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/"; - }; - }; "waybar/style.css".text = let makeBorder = color: "border-bottom: 3px solid #${color};"; - makeInfo = color: '' - color: #${color}; - ${makeBorder color} - ''; - + makeInfo = + color: '' + color: #${color}; + ${makeBorder color} + ''; clockColor = colorScheme.bright.magenta; cpuColor = colorScheme.bright.green; memColor = colorScheme.bright.blue; @@ -756,8 +810,7 @@ in normal = colorScheme.bright.yellow; critical = colorScheme.bright.red; }; - in - '' + in '' * { border: none; border-radius: 0; diff --git a/users/profiles/git/default.nix b/users/profiles/git/default.nix index 09c2243..f730572 100644 --- a/users/profiles/git/default.nix +++ b/users/profiles/git/default.nix @@ -25,22 +25,17 @@ ssp = "stash pop"; ssl = "stash list"; ssd = "stash drop"; - # reset rsoft = "reset --soft"; rhard = "reset --hard"; rs1ft = "soft HEAD~1"; rh1rd = "hard HEAD~1"; - # logging l = "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"; - plog = - "log --graph --pretty='format:%C(red)%d%C(reset) %C(yellow)%h%C(reset) %ar %C(green)%aN%C(reset) %s'"; - tlog = - "log --stat --since='1 Day Ago' --graph --pretty=oneline --abbrev-commit --date=relative"; + plog = "log --graph --pretty='format:%C(red)%d%C(reset) %C(yellow)%h%C(reset) %ar %C(green)%aN%C(reset) %s'"; + tlog = "log --stat --since='1 Day Ago' --graph --pretty=oneline --abbrev-commit --date=relative"; rank = "shortlog -sn --no-merges"; - # delete merged branches bdm = "!git branch --merged | grep -v '*' | xargs -n 1 git branch -d"; }; diff --git a/users/profiles/hikari/default.nix b/users/profiles/hikari/default.nix index 4550148..e99f84a 100644 --- a/users/profiles/hikari/default.nix +++ b/users/profiles/hikari/default.nix @@ -1,197 +1,205 @@ -{ fontComb ? "Iosevka 10", config, pkgs, ... }: { - home.packages = with pkgs; [ hikari xwayland ]; - + fontComb ? "Iosevka 10", + config, + pkgs, + ... +}: +{ + home.packages = with pkgs; [hikari xwayland]; xdg = { enable = true; configFile = { - "hikari/hikari.conf".text = '' - ui { - border = 1 - gap = 0 - step = 120 - font = "${fontComb}" + "hikari/hikari.conf".text = + '' + ui { + border = 1 + gap = 0 + step = 120 + font = "${fontComb}" - colorscheme { - background = 0x282C34 - foreground = 0x000000 - selected = 0xF5E094 - grouped = 0xFDAF53 - first = 0xB8E673 - conflict = 0xED6B32 - insert = 0xE3C3FA - active = 0xFFFFFF - inactive = 0x465457 + colorscheme { + background = 0x282C34 + foreground = 0x000000 + selected = 0xF5E094 + grouped = 0xFDAF53 + first = 0xB8E673 + conflict = 0xED6B32 + insert = 0xE3C3FA + active = 0xFFFFFF + inactive = 0x465457 + } } - } - outputs { - "*" { - background = "${config.home.homeDirectory}/wallpaper.png" - } - } - - inputs { - keyboards { + outputs { "*" { - xkb = { - layout = "tr" + background = "${config.home.homeDirectory}/wallpaper.png" + } + } + + inputs { + keyboards { + "*" { + xkb = { + layout = "tr" + } + } + } + pointers { + "*" { + accel-profile = "flat" } } } - pointers { - "*" { - accel-profile = "flat" + + layouts { + # main stack + s = { + scale = { + min = 0.5 + max = 0.75 + } + left = single + right = stack + } + + # main queue + q = { + scale = 0.75 + top = single + bottom = queue + } + + f = full + h = stack + v = queue + g = grid + } + + actions { + terminal = "${pkgs.alacritty}/bin/alacritty" + run = "${pkgs.wofi}/bin/wofi --show drun" + } + + bindings { + keyboard { + "L+0" = workspace-switch-to-sheet-0 + "L+1" = workspace-switch-to-sheet-1 + "L+2" = workspace-switch-to-sheet-2 + "L+3" = workspace-switch-to-sheet-3 + "L+4" = workspace-switch-to-sheet-4 + "L+5" = workspace-switch-to-sheet-5 + "L+6" = workspace-switch-to-sheet-6 + "L+7" = workspace-switch-to-sheet-7 + "L+8" = workspace-switch-to-sheet-8 + "L+9" = workspace-switch-to-sheet-9 + "L+numbersign" = workspace-switch-to-sheet-alternate + "L+Period" = workspace-switch-to-sheet-current + "L+j" = workspace-switch-to-sheet-next + "L+k" = workspace-switch-to-sheet-prev + "L+Comma" = workspace-switch-to-sheet-next-inhabited + "LS+Comma" = workspace-switch-to-sheet-prev-inhabited + "LSC+g" = workspace-show-group + "LSC+i" = workspace-show-invisible + "LSC+Period" = workspace-show-all + "LC+n" = workspace-cycle-next + "LC+p" = workspace-cycle-prev + + "LC+i" = sheet-show-invisible + "LC+Period" = sheet-show-all + "LC+g" = sheet-show-group + + "LA+r" = layout-reset + "LA+Return" = layout-restack-append + "LAS+Return" = layout-restack-prepend + "L+Home" = layout-cycle-view-first + "L+End" = layout-cycle-view-last + "L+n" = layout-cycle-view-next + "L+p" = layout-cycle-view-prev + "L+x" = layout-exchange-view-next + "LS+x" = layout-exchange-view-prev + "LA+x" = layout-exchange-view-main + + "LS+0" = view-pin-to-sheet-0 + "LS+1" = view-pin-to-sheet-1 + "LS+2" = view-pin-to-sheet-2 + "LS+3" = view-pin-to-sheet-3 + "LS+4" = view-pin-to-sheet-4 + "LS+5" = view-pin-to-sheet-5 + "LS+6" = view-pin-to-sheet-6 + "LS+7" = view-pin-to-sheet-7 + "LS+8" = view-pin-to-sheet-8 + "LS+9" = view-pin-to-sheet-9 + "LS+numbersign" = view-pin-to-sheet-alternate + "LS+Period" = view-pin-to-sheet-current + "LS+j" = view-pin-to-sheet-next + "LS+k" = view-pin-to-sheet-prev + + "L+q" = view-quit + "L+Tab" = view-cycle-next + "LS+Tab" = view-cycle-prev + + "L+Up" = view-move-up + "L+Down" = view-move-down + "L+Left" = view-move-left + "L+Right" = view-move-right + "LA+Up" = view-decrease-size-up + "LAS+Up" = view-increase-size-up + "LA+Down" = view-increase-size-down + "LAS+Down" = view-decrease-size-down + "LA+Left" = view-decrease-size-left + "LAS+Left" = view-increase-size-left + "LA+Right" = view-increase-size-right + "LAS+Right" = view-decrease-size-right + "LS+Up" = view-snap-up + "LS+Down" = view-snap-down + "LS+Left" = view-snap-left + "LS+Right" = view-snap-right + "L+r" = view-reset-geometry + + "L+minus" = view-toggle-maximize-vertical + "L+less" = view-toggle-maximize-horizontal + "L+f" = view-toggle-maximize-full + "L5+plus" = view-toggle-floating + "L+i" = view-toggle-invisible + "L5+p" = view-toggle-public + + "L+l" = mode-enter-layout + "L+s" = mode-enter-sheet-assign + "L+g" = mode-enter-group-assign + "L+m" = mode-enter-mark-assign + "L+acute" = mode-enter-mark-select + "LS+acute" = mode-enter-mark-switch-select + "LCA+g" = mode-enter-input-grab + + "LS+Backspace" = lock + "LCA+q" = quit + "LCA+r" = reload + + "L+Return" = action-terminal + "L+d" = action-run + + "A+F1" = vt-switch-to-1 + "A+F2" = vt-switch-to-2 + "A+F3" = vt-switch-to-3 + "A+F4" = vt-switch-to-4 + "A+F5" = vt-switch-to-5 + "A+F6" = vt-switch-to-6 + "A+F7" = vt-switch-to-7 + "A+F8" = vt-switch-to-8 + "A+F9" = vt-switch-to-9 + } + + mouse { + "L+left" = mode-enter-move + "L+right" = mode-enter-resize } } - } - - layouts { - # main stack - s = { - scale = { - min = 0.5 - max = 0.75 - } - left = single - right = stack - } - - # main queue - q = { - scale = 0.75 - top = single - bottom = queue - } - - f = full - h = stack - v = queue - g = grid - } - - actions { - terminal = "${pkgs.alacritty}/bin/alacritty" - run = "${pkgs.wofi}/bin/wofi --show drun" - } - - bindings { - keyboard { - "L+0" = workspace-switch-to-sheet-0 - "L+1" = workspace-switch-to-sheet-1 - "L+2" = workspace-switch-to-sheet-2 - "L+3" = workspace-switch-to-sheet-3 - "L+4" = workspace-switch-to-sheet-4 - "L+5" = workspace-switch-to-sheet-5 - "L+6" = workspace-switch-to-sheet-6 - "L+7" = workspace-switch-to-sheet-7 - "L+8" = workspace-switch-to-sheet-8 - "L+9" = workspace-switch-to-sheet-9 - "L+numbersign" = workspace-switch-to-sheet-alternate - "L+Period" = workspace-switch-to-sheet-current - "L+j" = workspace-switch-to-sheet-next - "L+k" = workspace-switch-to-sheet-prev - "L+Comma" = workspace-switch-to-sheet-next-inhabited - "LS+Comma" = workspace-switch-to-sheet-prev-inhabited - "LSC+g" = workspace-show-group - "LSC+i" = workspace-show-invisible - "LSC+Period" = workspace-show-all - "LC+n" = workspace-cycle-next - "LC+p" = workspace-cycle-prev - - "LC+i" = sheet-show-invisible - "LC+Period" = sheet-show-all - "LC+g" = sheet-show-group - - "LA+r" = layout-reset - "LA+Return" = layout-restack-append - "LAS+Return" = layout-restack-prepend - "L+Home" = layout-cycle-view-first - "L+End" = layout-cycle-view-last - "L+n" = layout-cycle-view-next - "L+p" = layout-cycle-view-prev - "L+x" = layout-exchange-view-next - "LS+x" = layout-exchange-view-prev - "LA+x" = layout-exchange-view-main - - "LS+0" = view-pin-to-sheet-0 - "LS+1" = view-pin-to-sheet-1 - "LS+2" = view-pin-to-sheet-2 - "LS+3" = view-pin-to-sheet-3 - "LS+4" = view-pin-to-sheet-4 - "LS+5" = view-pin-to-sheet-5 - "LS+6" = view-pin-to-sheet-6 - "LS+7" = view-pin-to-sheet-7 - "LS+8" = view-pin-to-sheet-8 - "LS+9" = view-pin-to-sheet-9 - "LS+numbersign" = view-pin-to-sheet-alternate - "LS+Period" = view-pin-to-sheet-current - "LS+j" = view-pin-to-sheet-next - "LS+k" = view-pin-to-sheet-prev - - "L+q" = view-quit - "L+Tab" = view-cycle-next - "LS+Tab" = view-cycle-prev - - "L+Up" = view-move-up - "L+Down" = view-move-down - "L+Left" = view-move-left - "L+Right" = view-move-right - "LA+Up" = view-decrease-size-up - "LAS+Up" = view-increase-size-up - "LA+Down" = view-increase-size-down - "LAS+Down" = view-decrease-size-down - "LA+Left" = view-decrease-size-left - "LAS+Left" = view-increase-size-left - "LA+Right" = view-increase-size-right - "LAS+Right" = view-decrease-size-right - "LS+Up" = view-snap-up - "LS+Down" = view-snap-down - "LS+Left" = view-snap-left - "LS+Right" = view-snap-right - "L+r" = view-reset-geometry - - "L+minus" = view-toggle-maximize-vertical - "L+less" = view-toggle-maximize-horizontal - "L+f" = view-toggle-maximize-full - "L5+plus" = view-toggle-floating - "L+i" = view-toggle-invisible - "L5+p" = view-toggle-public - - "L+l" = mode-enter-layout - "L+s" = mode-enter-sheet-assign - "L+g" = mode-enter-group-assign - "L+m" = mode-enter-mark-assign - "L+acute" = mode-enter-mark-select - "LS+acute" = mode-enter-mark-switch-select - "LCA+g" = mode-enter-input-grab - - "LS+Backspace" = lock - "LCA+q" = quit - "LCA+r" = reload - - "L+Return" = action-terminal - "L+d" = action-run - - "A+F1" = vt-switch-to-1 - "A+F2" = vt-switch-to-2 - "A+F3" = vt-switch-to-3 - "A+F4" = vt-switch-to-4 - "A+F5" = vt-switch-to-5 - "A+F6" = vt-switch-to-6 - "A+F7" = vt-switch-to-7 - "A+F8" = vt-switch-to-8 - "A+F9" = vt-switch-to-9 - } - - mouse { - "L+left" = mode-enter-move - "L+right" = mode-enter-resize - } - } - ''; - "hikari/autostart".source = "${ - pkgs.writeScriptBin "hikari-autostart" '' + ''; + "hikari/autostart".source = + "${ + pkgs.writeScriptBin + "hikari-autostart" + '' #!${pkgs.stdenv.shell} ${pkgs.waybar}/bin/waybar & '' diff --git a/users/profiles/starship/default.nix b/users/profiles/starship/default.nix index 1f5d098..62d00d5 100644 --- a/users/profiles/starship/default.nix +++ b/users/profiles/starship/default.nix @@ -1,4 +1,5 @@ -{ ... }: { +{ ... }: +{ programs.starship = { enable = true; settings = { diff --git a/users/profiles/wtf/default.nix b/users/profiles/wtf/default.nix index b565c7f..59c149a 100644 --- a/users/profiles/wtf/default.nix +++ b/users/profiles/wtf/default.nix @@ -1,3 +1,5 @@ -{ pkgs, ... }: { - home.packages = [ pkgs.wtf ]; -} +{ + pkgs, + ... +}: +{ home.packages = [pkgs.wtf]; }