From 49a4b8f76cbaabc886f88587faa1bb2b77eb3ca7 Mon Sep 17 00:00:00 2001 From: Vinny Meller Date: Thu, 2 May 2024 14:38:07 -0400 Subject: [PATCH] add gbrowse shortcut and reformat --- dotfiles/nvim/lua/plugins/lsp.lua | 2 +- dotfiles/nvim/lua/plugins/vim-fugitive.lua | 2 + dotfiles/qtile/flake.nix | 43 +- flake.nix | 97 +-- hosts/camovinny/default.nix | 8 +- hosts/camovinny/home.nix | 22 +- hosts/home-wsl/configuration.nix | 21 +- hosts/home-wsl/default.nix | 8 +- hosts/home-wsl/home.nix | 25 +- hosts/home-wsl/nixos-wsl/default.nix | 16 +- hosts/home-wsl/nixos-wsl/flake.nix | 44 +- .../nixos-wsl/modules/build-tarball.nix | 77 ++- .../nixos-wsl/modules/docker-desktop.nix | 68 ++- .../nixos-wsl/modules/docker-native.nix | 37 +- .../home-wsl/nixos-wsl/modules/installer.nix | 161 ++--- hosts/home-wsl/nixos-wsl/modules/interop.nix | 115 ++-- .../home-wsl/nixos-wsl/modules/wsl-distro.nix | 224 +++---- hosts/home-wsl/nixos-wsl/syschdemd.nix | 11 +- hosts/vinnix/configuration.nix | 51 +- hosts/vinnix/default.nix | 37 +- hosts/vinnix/hardware.nix | 21 +- hosts/vinnix/users/vinny/home.nix | 13 +- hosts/wdtech-eos/default.nix | 4 +- hosts/wdtech-eos/home.nix | 22 +- hosts/work-laptop/default.nix | 12 +- hosts/work-laptop/home.nix | 15 +- nixpkgs.nix | 6 +- overlays/default.nix | 9 +- pkgs/default.nix | 3 +- pkgs/discord_audio_share/default.nix | 5 +- pkgs/kill_and_attach/default.nix | 5 +- pkgs/screenshot_to_clipboard/default.nix | 13 +- pkgs/vim-plugins.nix | 3 +- pkgs/worktree_helper/default.nix | 9 +- programs/git/default.nix | 16 +- programs/gpg/default.nix | 9 +- programs/kitty/default.nix | 5 +- programs/ncvim/default.nix | 568 +++++++++--------- programs/ncvim/overlays/default.nix | 26 +- programs/nix/default.nix | 25 +- programs/qtile/default.nix | 7 +- programs/ranger/default.nix | 6 +- programs/tmux/default.nix | 4 +- programs/zk/default.nix | 8 +- programs/zsh/default.nix | 7 +- shell.nix | 11 +- 46 files changed, 1090 insertions(+), 811 deletions(-) diff --git a/dotfiles/nvim/lua/plugins/lsp.lua b/dotfiles/nvim/lua/plugins/lsp.lua index e06476d..1118f9f 100644 --- a/dotfiles/nvim/lua/plugins/lsp.lua +++ b/dotfiles/nvim/lua/plugins/lsp.lua @@ -185,7 +185,7 @@ local languages = { require("efmls-configs.formatters.rustfmt"), }, nix = { - require("efmls-configs.formatters.alejandra"), + require("efmls-configs.formatters.nixfmt"), }, sh = { require("efmls-configs.formatters.shfmt"), diff --git a/dotfiles/nvim/lua/plugins/vim-fugitive.lua b/dotfiles/nvim/lua/plugins/vim-fugitive.lua index 2b3c9b4..99c296b 100644 --- a/dotfiles/nvim/lua/plugins/vim-fugitive.lua +++ b/dotfiles/nvim/lua/plugins/vim-fugitive.lua @@ -14,3 +14,5 @@ map("n", "g", "Git status", { desc = "[G]it [S]tatus" }) map("n", "gr", "Git restore %", { desc = "[G]it [R]estore current file" }) map("n", "gR", "Git restore .", { desc = "[G]it [R]estore all files" }) map("n", "gP", "Git pull", { desc = "[G]it [P]ull" }) +map("n", "go", "GBrowse!:GBrowse", { desc = "[G]it [O]pen in browser" }) +map("v", "go", "GBrowse!gv:GBrowse", { desc = "[G]it [O]pen in browser" }) diff --git a/dotfiles/qtile/flake.nix b/dotfiles/qtile/flake.nix index 5aae73b..32d2a3c 100644 --- a/dotfiles/qtile/flake.nix +++ b/dotfiles/qtile/flake.nix @@ -3,19 +3,32 @@ inputs.flake-utils.url = "github:numtide/flake-utils"; - outputs = { - self, - nixpkgs, - flake-utils, - }: - flake-utils.lib.eachDefaultSystem (system: let - pkgs = nixpkgs.legacyPackages.${system}; - python-pkgs = - pkgs.python3.withPackages (ps: with ps; [black mypy qtile]); - in { - devShells.default = pkgs.mkShell rec { - name = "qtileDevEnv"; - packages = with pkgs; [python-pkgs qtile]; - }; - }); + outputs = + { + self, + nixpkgs, + flake-utils, + }: + flake-utils.lib.eachDefaultSystem ( + system: + let + pkgs = nixpkgs.legacyPackages.${system}; + python-pkgs = pkgs.python3.withPackages ( + ps: with ps; [ + black + mypy + qtile + ] + ); + in + { + devShells.default = pkgs.mkShell rec { + name = "qtileDevEnv"; + packages = with pkgs; [ + python-pkgs + qtile + ]; + }; + } + ); } diff --git a/flake.nix b/flake.nix index c89819f..5874076 100644 --- a/flake.nix +++ b/flake.nix @@ -47,55 +47,56 @@ }; }; - outputs = inputs @ { - self, - flake-utils, - nixpkgs, - nixpkgs-master, - nixpkgs-stable, - nix-index-database, - home-manager, - lanzaboote, - nixCats, - ... - }: let - inherit (self) outputs; - - forAllSystems = - nixpkgs.lib.genAttrs - flake-utils.lib.defaultSystems; # change this if i need some weird systems - - myNixCats = import ./programs/ncvim {inherit inputs;}; - in { - myNixCats = myNixCats; - - packages = - forAllSystems ( - system: let + outputs = + inputs@{ + self, + flake-utils, + nixpkgs, + nixpkgs-master, + nixpkgs-stable, + nix-index-database, + home-manager, + lanzaboote, + nixCats, + ... + }: + let + inherit (self) outputs; + + forAllSystems = nixpkgs.lib.genAttrs flake-utils.lib.defaultSystems; # change this if i need some weird systems + + myNixCats = import ./programs/ncvim { inherit inputs; }; + in + { + myNixCats = myNixCats; + + packages = + forAllSystems ( + system: + let + pkgs = nixpkgs.legacyPackages.${system}; + in + import ./pkgs { inherit pkgs; } + ) + // myNixCats.packages; + + devShells = forAllSystems ( + system: + let pkgs = nixpkgs.legacyPackages.${system}; in - import ./pkgs {inherit pkgs;} - ) - // myNixCats.packages; - - devShells = forAllSystems ( - system: let - pkgs = nixpkgs.legacyPackages.${system}; - in - import ./shell.nix {inherit pkgs;} - ); - - overlays = import ./overlays {inherit inputs;}; - - nixosConfigurations = { - vinnix = import ./hosts/vinnix {inherit inputs outputs;}; - vindows = import ./hosts/home-wsl {inherit inputs outputs;}; + import ./shell.nix { inherit pkgs; } + ); + + overlays = import ./overlays { inherit inputs; }; + + nixosConfigurations = { + vinnix = import ./hosts/vinnix { inherit inputs outputs; }; + vindows = import ./hosts/home-wsl { inherit inputs outputs; }; + }; + homeConfigurations = { + "vinny@wdtech-eos" = import ./hosts/wdtech-eos { inherit inputs outputs; }; + "vinny@camovinny" = import ./hosts/camovinny { inherit inputs outputs; }; + }; }; - homeConfigurations = { - "vinny@wdtech-eos" = - import ./hosts/wdtech-eos {inherit inputs outputs;}; - "vinny@camovinny" = - import ./hosts/camovinny {inherit inputs outputs;}; - }; - }; } diff --git a/hosts/camovinny/default.nix b/hosts/camovinny/default.nix index d65bd4b..43c0d37 100644 --- a/hosts/camovinny/default.nix +++ b/hosts/camovinny/default.nix @@ -2,8 +2,12 @@ inputs.home-manager.lib.homeManagerConfiguration { pkgs = import inputs.nixpkgs { system = "aarch64-darwin"; - config = { allowUnfree = true; }; + config = { + allowUnfree = true; + }; + }; + extraSpecialArgs = { + inherit inputs outputs; }; - extraSpecialArgs = { inherit inputs outputs; }; modules = [ ./home.nix ]; } diff --git a/hosts/camovinny/home.nix b/hosts/camovinny/home.nix index 34a4d6c..6b40562 100644 --- a/hosts/camovinny/home.nix +++ b/hosts/camovinny/home.nix @@ -3,9 +3,11 @@ outputs, pkgs, ... -}: let - cust_pkgs = import ../../pkgs {inherit pkgs;}; -in { +}: +let + cust_pkgs = import ../../pkgs { inherit pkgs; }; +in +{ imports = [ ../../programs/zsh ../../programs/git @@ -22,15 +24,21 @@ in { allowUnfree = true; }; nix.package = pkgs.nixFlakes; - nix.settings.experimental-features = ["nix-command" "flakes"]; + nix.settings.experimental-features = [ + "nix-command" + "flakes" + ]; nix.settings.auto-optimise-store = true; nix.settings.require-sigs = false; - nix.settings.trusted-users = ["vinny" "root"]; - nix.settings.trusted-public-keys = ["vinnix:xCPWQjVNXvqsEJgdEhUMpmVIyJseAPAcZEm3b6HU8vk="]; + nix.settings.trusted-users = [ + "vinny" + "root" + ]; + nix.settings.trusted-public-keys = [ "vinnix:xCPWQjVNXvqsEJgdEhUMpmVIyJseAPAcZEm3b6HU8vk=" ]; nixCats = { enable = true; - packageNames = ["nixCats"]; + packageNames = [ "nixCats" ]; }; home.packages = with pkgs; [ diff --git a/hosts/home-wsl/configuration.nix b/hosts/home-wsl/configuration.nix index 9c71649..2718964 100755 --- a/hosts/home-wsl/configuration.nix +++ b/hosts/home-wsl/configuration.nix @@ -7,9 +7,11 @@ modulesPath, ... }: -with lib; let +with lib; +let nixos-wsl = import ./nixos-wsl; -in { +in +{ imports = [ "${modulesPath}/profiles/minimal.nix" @@ -37,14 +39,17 @@ in { nixpkgs.config.allowBroken = true; # Enable nix flakes nix.package = pkgs.nixFlakes; - nix.settings.experimental-features = ["nix-command" "flakes"]; + nix.settings.experimental-features = [ + "nix-command" + "flakes" + ]; nix.gc.automatic = true; nix.settings.auto-optimise-store = true; nix.gc.options = "--delete-older-than 14d"; boot.kernelPackages = pkgs.linuxPackages_latest; - services.xserver.videoDrivers = ["nvidia"]; + services.xserver.videoDrivers = [ "nvidia" ]; hardware.opengl.enable = true; security.polkit.enable = true; @@ -52,7 +57,7 @@ in { users.users.vinny = { isNormalUser = true; initialPassword = "passwordington"; - extraGroups = ["wheel"]; + extraGroups = [ "wheel" ]; shell = pkgs.zsh; }; programs.zsh = { @@ -61,7 +66,11 @@ in { }; networking.hostName = "home-nix-wsl"; # Define your hostname. - environment.systemPackages = with pkgs; [git vim neovim]; + environment.systemPackages = with pkgs; [ + git + vim + neovim + ]; nixpkgs.config.allowUnfree = true; system.stateVersion = "22.05"; } diff --git a/hosts/home-wsl/default.nix b/hosts/home-wsl/default.nix index 8ab0908..4db6c6e 100755 --- a/hosts/home-wsl/default.nix +++ b/hosts/home-wsl/default.nix @@ -1,7 +1,9 @@ { inputs, outputs, ... }: inputs.nixpkgs.lib.nixosSystem { - specialArgs = { inherit inputs outputs; }; + specialArgs = { + inherit inputs outputs; + }; modules = [ ./configuration.nix inputs.home-manager.nixosModules.home-manager @@ -9,7 +11,9 @@ inputs.nixpkgs.lib.nixosSystem { home-manager.useGlobalPkgs = true; home-manager.useUserPackages = true; home-manager.users.vinny = import ./home.nix; - home-manager.extraSpecialArgs = {inherit inputs outputs;}; + home-manager.extraSpecialArgs = { + inherit inputs outputs; + }; } ]; } diff --git a/hosts/home-wsl/home.nix b/hosts/home-wsl/home.nix index 39534ad..210fe68 100755 --- a/hosts/home-wsl/home.nix +++ b/hosts/home-wsl/home.nix @@ -3,9 +3,11 @@ lib, outputs, ... -}: let - cust_pkgs = import ../../pkgs {inherit pkgs;}; -in { +}: +let + cust_pkgs = import ../../pkgs { inherit pkgs; }; +in +{ imports = [ ../../programs/zsh ../../programs/git @@ -16,11 +18,18 @@ in { nixCats = { enable = true; - packageNames = ["nixCats"]; + packageNames = [ "nixCats" ]; }; - home.packages = with pkgs; - [openvpn mesa kubectl helm] ++ builtins.attrValues cust_pkgs; + home.packages = + with pkgs; + [ + openvpn + mesa + kubectl + helm + ] + ++ builtins.attrValues cust_pkgs; programs.direnv.enable = true; programs.direnv.nix-direnv.enable = true; @@ -31,5 +40,7 @@ in { programs.home-manager.enable = true; - programs.zsh.sessionVariables = {TMUX_TMPDIR = "/tmp";}; + programs.zsh.sessionVariables = { + TMUX_TMPDIR = "/tmp"; + }; } diff --git a/hosts/home-wsl/nixos-wsl/default.nix b/hosts/home-wsl/nixos-wsl/default.nix index 80aeb43..e7e18e3 100755 --- a/hosts/home-wsl/nixos-wsl/default.nix +++ b/hosts/home-wsl/nixos-wsl/default.nix @@ -1,6 +1,10 @@ -(import (let lock = builtins.fromJSON (builtins.readFile ./flake.lock); -in fetchTarball { - url = - "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz"; - sha256 = lock.nodes.flake-compat.locked.narHash; -}) { src = ./.; }).defaultNix +(import ( + let + lock = builtins.fromJSON (builtins.readFile ./flake.lock); + in + fetchTarball { + url = "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz"; + sha256 = lock.nodes.flake-compat.locked.narHash; + } +) { src = ./.; }).defaultNix + diff --git a/hosts/home-wsl/nixos-wsl/flake.nix b/hosts/home-wsl/nixos-wsl/flake.nix index 7b92cb8..2ac0180 100755 --- a/hosts/home-wsl/nixos-wsl/flake.nix +++ b/hosts/home-wsl/nixos-wsl/flake.nix @@ -11,7 +11,13 @@ }; }; - outputs = { self, nixpkgs, flake-utils, ... }: + outputs = + { + self, + nixpkgs, + flake-utils, + ... + }: { nixosModules.wsl = { @@ -29,19 +35,27 @@ system = "x86_64-linux"; modules = [ ./configuration.nix ]; }; + } + // + flake-utils.lib.eachSystem + (with flake-utils.lib.system; [ + "x86_64-linux" + "aarch64-linux" + ]) + ( + system: + let + pkgs = import nixpkgs { inherit system; }; + in + { + checks.check-format = + pkgs.runCommand "check-format" { buildInputs = with pkgs; [ nixpkgs-fmt ]; } + '' + nixpkgs-fmt --check ${./.} + mkdir $out # success + ''; - } // flake-utils.lib.eachSystem - (with flake-utils.lib.system; [ "x86_64-linux" "aarch64-linux" ]) (system: - let pkgs = import nixpkgs { inherit system; }; - in { - checks.check-format = pkgs.runCommand "check-format" { - buildInputs = with pkgs; [ nixpkgs-fmt ]; - } '' - nixpkgs-fmt --check ${./.} - mkdir $out # success - ''; - - devShell = - pkgs.mkShell { nativeBuildInputs = with pkgs; [ nixpkgs-fmt ]; }; - }); + devShell = pkgs.mkShell { nativeBuildInputs = with pkgs; [ nixpkgs-fmt ]; }; + } + ); } diff --git a/hosts/home-wsl/nixos-wsl/modules/build-tarball.nix b/hosts/home-wsl/nixos-wsl/modules/build-tarball.nix index 12f7a95..440de65 100755 --- a/hosts/home-wsl/nixos-wsl/modules/build-tarball.nix +++ b/hosts/home-wsl/nixos-wsl/modules/build-tarball.nix @@ -1,8 +1,14 @@ -{ config, pkgs, lib, ... }: +{ + config, + pkgs, + lib, + ... +}: with builtins; with lib; let - pkgs2storeContents = l: + pkgs2storeContents = + l: map (x: { object = x; symlink = "none"; @@ -10,23 +16,19 @@ let nixpkgs = lib.cleanSource pkgs.path; - channelSources = pkgs.runCommand "nixos-${config.system.nixos.version}" { - preferLocalBuild = true; - } '' - mkdir -p $out - cp -prd ${nixpkgs.outPath} $out/nixos - chmod -R u+w $out/nixos - if [ ! -e $out/nixos/nixpkgs ]; then - ln -s . $out/nixos/nixpkgs - fi - echo -n ${toString config.system.nixos.revision} > $out/nixos/.git-revision - echo -n ${ - toString config.system.nixos.versionSuffix - } > $out/nixos/.version-suffix - echo ${ - toString config.system.nixos.versionSuffix - } | sed -e s/pre// > $out/nixos/svn-revision - ''; + channelSources = + pkgs.runCommand "nixos-${config.system.nixos.version}" { preferLocalBuild = true; } + '' + mkdir -p $out + cp -prd ${nixpkgs.outPath} $out/nixos + chmod -R u+w $out/nixos + if [ ! -e $out/nixos/nixpkgs ]; then + ln -s . $out/nixos/nixpkgs + fi + echo -n ${toString config.system.nixos.revision} > $out/nixos/.git-revision + echo -n ${toString config.system.nixos.versionSuffix} > $out/nixos/.version-suffix + echo ${toString config.system.nixos.versionSuffix} | sed -e s/pre// > $out/nixos/svn-revision + ''; preparer = pkgs.writeShellScriptBin "wsl-prepare" '' set -e @@ -67,40 +69,37 @@ let sed -i 's|import \./default\.nix|import \./nixos-wsl|' ./etc/nixos/configuration.nix ''} ''; - -in { +in +{ options.wsl.tarball = { includeConfig = mkOption { type = types.bool; default = true; - description = - "Whether or not to copy the system configuration into the tarball"; + description = "Whether or not to copy the system configuration into the tarball"; }; }; config = mkIf config.wsl.enable { # These options make no sense without the wsl-distro module anyway - system.build.tarball = - pkgs.callPackage "${nixpkgs}/nixos/lib/make-system-tarball.nix" { - # No contents, structure will be added by prepare script - contents = [ ]; + system.build.tarball = pkgs.callPackage "${nixpkgs}/nixos/lib/make-system-tarball.nix" { + # No contents, structure will be added by prepare script + contents = [ ]; - fileName = "nixos-wsl-${pkgs.hostPlatform.system}"; + fileName = "nixos-wsl-${pkgs.hostPlatform.system}"; - storeContents = pkgs2storeContents [ - config.system.build.toplevel - channelSources - preparer - ]; + storeContents = pkgs2storeContents [ + config.system.build.toplevel + channelSources + preparer + ]; - extraCommands = "${preparer}/bin/wsl-prepare"; - - # Use gzip - compressCommand = "gzip"; - compressionExtension = ".gz"; - }; + extraCommands = "${preparer}/bin/wsl-prepare"; + # Use gzip + compressCommand = "gzip"; + compressionExtension = ".gz"; + }; }; } diff --git a/hosts/home-wsl/nixos-wsl/modules/docker-desktop.nix b/hosts/home-wsl/nixos-wsl/modules/docker-desktop.nix index 13b778f..52b5f29 100755 --- a/hosts/home-wsl/nixos-wsl/modules/docker-desktop.nix +++ b/hosts/home-wsl/nixos-wsl/modules/docker-desktop.nix @@ -1,33 +1,53 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: with builtins; -with lib; { - - imports = - [ (mkRenamedOptionModule [ "wsl" "docker" ] [ "wsl" "docker-desktop" ]) ]; +with lib; +{ + + imports = [ + (mkRenamedOptionModule + [ + "wsl" + "docker" + ] + [ + "wsl" + "docker-desktop" + ] + ) + ]; options.wsl.docker-desktop = with types; { enable = mkEnableOption "Docker Desktop integration"; }; - config = let cfg = config.wsl.docker-desktop; - in mkIf (config.wsl.enable && cfg.enable) { - - environment.systemPackages = with pkgs; [ docker docker-compose ]; - - systemd.services.docker-desktop-proxy = { - description = "Docker Desktop proxy"; - script = '' - ${config.wsl.automountPath}/wsl/docker-desktop/docker-desktop-user-distro proxy --docker-desktop-root ${config.wsl.automountPath}/wsl/docker-desktop - ''; - wantedBy = [ "multi-user.target" ]; - serviceConfig = { - Restart = "on-failure"; - RestartSec = "30s"; + config = + let + cfg = config.wsl.docker-desktop; + in + mkIf (config.wsl.enable && cfg.enable) { + + environment.systemPackages = with pkgs; [ + docker + docker-compose + ]; + + systemd.services.docker-desktop-proxy = { + description = "Docker Desktop proxy"; + script = '' + ${config.wsl.automountPath}/wsl/docker-desktop/docker-desktop-user-distro proxy --docker-desktop-root ${config.wsl.automountPath}/wsl/docker-desktop + ''; + wantedBy = [ "multi-user.target" ]; + serviceConfig = { + Restart = "on-failure"; + RestartSec = "30s"; + }; }; - }; - - users.groups.docker.members = [ config.wsl.defaultUser ]; - - }; + users.groups.docker.members = [ config.wsl.defaultUser ]; + }; } diff --git a/hosts/home-wsl/nixos-wsl/modules/docker-native.nix b/hosts/home-wsl/nixos-wsl/modules/docker-native.nix index dba8ccd..a0af848 100755 --- a/hosts/home-wsl/nixos-wsl/modules/docker-native.nix +++ b/hosts/home-wsl/nixos-wsl/modules/docker-native.nix @@ -1,6 +1,12 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: with builtins; -with lib; { +with lib; +{ options.wsl.docker-native = with types; { enable = mkEnableOption "Native Docker integration in NixOS."; @@ -16,19 +22,22 @@ with lib; { }; }; - config = let cfg = config.wsl.docker-native; - in mkIf (config.wsl.enable && cfg.enable) { - nixpkgs.overlays = [ - (self: super: { - docker = super.docker.override { iptables = pkgs.iptables-legacy; }; - }) - ]; + config = + let + cfg = config.wsl.docker-native; + in + mkIf (config.wsl.enable && cfg.enable) { + nixpkgs.overlays = [ + (self: super: { docker = super.docker.override { iptables = pkgs.iptables-legacy; }; }) + ]; - environment.systemPackages = with pkgs; [ docker docker-compose ]; + environment.systemPackages = with pkgs; [ + docker + docker-compose + ]; - virtualisation.docker.enable = true; + virtualisation.docker.enable = true; - users.groups.docker.members = - lib.mkIf cfg.addToDockerGroup [ config.wsl.defaultUser ]; - }; + users.groups.docker.members = lib.mkIf cfg.addToDockerGroup [ config.wsl.defaultUser ]; + }; } diff --git a/hosts/home-wsl/nixos-wsl/modules/installer.nix b/hosts/home-wsl/nixos-wsl/modules/installer.nix index 29f3a23..378551e 100755 --- a/hosts/home-wsl/nixos-wsl/modules/installer.nix +++ b/hosts/home-wsl/nixos-wsl/modules/installer.nix @@ -1,91 +1,98 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: with builtins; -with lib; { +with lib; +{ - config = mkIf config.wsl.enable (let - mkTarball = pkgs.callPackage - "${lib.cleanSource pkgs.path}/nixos/lib/make-system-tarball.nix"; + config = mkIf config.wsl.enable ( + let + mkTarball = pkgs.callPackage "${lib.cleanSource pkgs.path}/nixos/lib/make-system-tarball.nix"; - pkgs2storeContents = map (x: { - object = x; - symlink = "none"; - }); + pkgs2storeContents = map (x: { + object = x; + symlink = "none"; + }); - rootfs = let tarball = config.system.build.tarball; - in "${tarball}/tarball/${tarball.fileName}.tar${tarball.extension}"; + rootfs = + let + tarball = config.system.build.tarball; + in + "${tarball}/tarball/${tarball.fileName}.tar${tarball.extension}"; - installer = pkgs.writeScript "installer.sh" '' - #!${pkgs.busybox}/bin/sh - BASEPATH=$PATH - export PATH=$BASEPATH:${pkgs.busybox}/bin # Add busybox to path + installer = pkgs.writeScript "installer.sh" '' + #!${pkgs.busybox}/bin/sh + BASEPATH=$PATH + export PATH=$BASEPATH:${pkgs.busybox}/bin # Add busybox to path - set -e - cd / + set -e + cd / - echo "Unpacking root file system..." - ${pkgs.pv}/bin/pv ${rootfs} | tar xz + echo "Unpacking root file system..." + ${pkgs.pv}/bin/pv ${rootfs} | tar xz - echo "Activating nix configuration..." - /nix/var/nix/profiles/system/activate - PATH=$BASEPATH:/run/current-system/sw/bin # Use packages from target system + echo "Activating nix configuration..." + /nix/var/nix/profiles/system/activate + PATH=$BASEPATH:/run/current-system/sw/bin # Use packages from target system - echo "Cleaning up installer files..." - nix-collect-garbage - rm /nix-path-registration + echo "Cleaning up installer files..." + nix-collect-garbage + rm /nix-path-registration - echo "Optimizing store..." - nix-store --optimize + echo "Optimizing store..." + nix-store --optimize - # Don't package the shell here, it's contained in the rootfs - exec ${ - builtins.unsafeDiscardStringContext config.users.users.root.shell - } "$@" - ''; - - # Set installer.sh as the root shell - passwd = pkgs.writeText "passwd" '' - root:x:0:0:System administrator:/root:${installer} - ''; - in { - - system.build.installer = mkTarball { - fileName = "nixos-wsl-installer"; - compressCommand = "gzip"; - compressionExtension = ".gz"; - extraArgs = "--hard-dereference"; - - storeContents = with pkgs; pkgs2storeContents [ installer ]; - - contents = [ - { - source = config.environment.etc."wsl.conf".source; - target = "/etc/wsl.conf"; - } - { - source = config.environment.etc."fstab".source; - target = "/etc/fstab"; - } - { - source = passwd; - target = "/etc/passwd"; - } - { - source = "${pkgs.busybox}/bin/busybox"; - target = "/bin/sh"; - } - { - source = "${pkgs.busybox}/bin/busybox"; - target = "/bin/mount"; - } - ]; - - extraCommands = pkgs.writeShellScript "prepare" '' - export PATH=$PATH:${pkgs.coreutils}/bin - mkdir -p bin - ln -s /init bin/wslpath + # Don't package the shell here, it's contained in the rootfs + exec ${builtins.unsafeDiscardStringContext config.users.users.root.shell} "$@" ''; - }; - - }); + # Set installer.sh as the root shell + passwd = pkgs.writeText "passwd" '' + root:x:0:0:System administrator:/root:${installer} + ''; + in + { + + system.build.installer = mkTarball { + fileName = "nixos-wsl-installer"; + compressCommand = "gzip"; + compressionExtension = ".gz"; + extraArgs = "--hard-dereference"; + + storeContents = with pkgs; pkgs2storeContents [ installer ]; + + contents = [ + { + source = config.environment.etc."wsl.conf".source; + target = "/etc/wsl.conf"; + } + { + source = config.environment.etc."fstab".source; + target = "/etc/fstab"; + } + { + source = passwd; + target = "/etc/passwd"; + } + { + source = "${pkgs.busybox}/bin/busybox"; + target = "/bin/sh"; + } + { + source = "${pkgs.busybox}/bin/busybox"; + target = "/bin/mount"; + } + ]; + + extraCommands = pkgs.writeShellScript "prepare" '' + export PATH=$PATH:${pkgs.coreutils}/bin + mkdir -p bin + ln -s /init bin/wslpath + ''; + }; + } + ); } diff --git a/hosts/home-wsl/nixos-wsl/modules/interop.nix b/hosts/home-wsl/nixos-wsl/modules/interop.nix index d61fb76..cc6f353 100755 --- a/hosts/home-wsl/nixos-wsl/modules/interop.nix +++ b/hosts/home-wsl/nixos-wsl/modules/interop.nix @@ -1,21 +1,33 @@ -{ lib, pkgs, config, ... }: +{ + lib, + pkgs, + config, + ... +}: with builtins; -with lib; { +with lib; +{ imports = [ - (mkRenamedOptionModule [ "wsl" "compatibility" "interopPreserveArgvZero" ] [ - "wsl" - "interop" - "preserveArgvZero" - ]) + (mkRenamedOptionModule + [ + "wsl" + "compatibility" + "interopPreserveArgvZero" + ] + [ + "wsl" + "interop" + "preserveArgvZero" + ] + ) ]; options.wsl.interop = with types; { register = mkOption { type = bool; default = false; # Use the existing registration by default - description = - "Explicitly register the binfmt_misc handler for Windows executables"; + description = "Explicitly register the binfmt_misc handler for Windows executables"; }; includePath = mkOption { @@ -37,50 +49,57 @@ with lib; { }; }; - config = let cfg = config.wsl.interop; - in mkIf config.wsl.enable { + config = + let + cfg = config.wsl.interop; + in + mkIf config.wsl.enable { - boot.binfmt.registrations = mkIf cfg.register { - WSLInterop = let - compat = cfg.preserveArgvZero; + boot.binfmt.registrations = mkIf cfg.register { + WSLInterop = + let + compat = cfg.preserveArgvZero; - # WSL Preview 0.58 and up registers the /init binfmt interp for Windows executable - # with the "preserve argv[0]" flag, so if you run `./foo.exe`, the interp gets invoked - # as `/init foo.exe ./foo.exe`. - # argv[0] --^ ^-- actual path - # - # Older versions expect to be called without the argv[0] bit, simply as `/init ./foo.exe`. - # - # We detect that by running `/init /known-not-existing-path.exe` and checking the exit code: - # the new style interp expects at least two arguments, so exits with exit code 1, - # presumably meaning "parsing error"; the old style interp attempts to actually run - # the executable, fails to find it, and exits with 255. - compatWrapper = pkgs.writeShellScript "nixos-wsl-binfmt-hack" '' - /init /nixos-wsl-does-not-exist.exe - [ $? -eq 255 ] && shift - exec /init "$@" - ''; + # WSL Preview 0.58 and up registers the /init binfmt interp for Windows executable + # with the "preserve argv[0]" flag, so if you run `./foo.exe`, the interp gets invoked + # as `/init foo.exe ./foo.exe`. + # argv[0] --^ ^-- actual path + # + # Older versions expect to be called without the argv[0] bit, simply as `/init ./foo.exe`. + # + # We detect that by running `/init /known-not-existing-path.exe` and checking the exit code: + # the new style interp expects at least two arguments, so exits with exit code 1, + # presumably meaning "parsing error"; the old style interp attempts to actually run + # the executable, fails to find it, and exits with 255. + compatWrapper = pkgs.writeShellScript "nixos-wsl-binfmt-hack" '' + /init /nixos-wsl-does-not-exist.exe + [ $? -eq 255 ] && shift + exec /init "$@" + ''; - # use the autodetect hack if unset, otherwise call /init directly - interpreter = if compat == null then compatWrapper else "/init"; + # use the autodetect hack if unset, otherwise call /init directly + interpreter = if compat == null then compatWrapper else "/init"; - # enable for the wrapper and autodetect hack - preserveArgvZero = if compat == false then false else true; - in { - magicOrExtension = "MZ"; - fixBinary = true; - wrapInterpreterInShell = false; - inherit interpreter preserveArgvZero; + # enable for the wrapper and autodetect hack + preserveArgvZero = if compat == false then false else true; + in + { + magicOrExtension = "MZ"; + fixBinary = true; + wrapInterpreterInShell = false; + inherit interpreter preserveArgvZero; + }; }; - }; - - # Include Windows %PATH% in Linux $PATH. - environment.extraInit = mkIf cfg.includePath ''PATH="$PATH:$WSLPATH"''; - warnings = let registrations = config.boot.binfmt.registrations; - in optional (!(registrations ? WSLInterop) - && (length (attrNames config.boot.binfmt.registrations)) != 0) - "Having any binfmt registrations without re-registering WSLInterop (wsl.interop.register) will break running .exe files from WSL2"; - }; + # Include Windows %PATH% in Linux $PATH. + environment.extraInit = mkIf cfg.includePath ''PATH="$PATH:$WSLPATH"''; + warnings = + let + registrations = config.boot.binfmt.registrations; + in + optional + (!(registrations ? WSLInterop) && (length (attrNames config.boot.binfmt.registrations)) != 0) + "Having any binfmt registrations without re-registering WSLInterop (wsl.interop.register) will break running .exe files from WSL2"; + }; } diff --git a/hosts/home-wsl/nixos-wsl/modules/wsl-distro.nix b/hosts/home-wsl/nixos-wsl/modules/wsl-distro.nix index cb61527..dda291f 100755 --- a/hosts/home-wsl/nixos-wsl/modules/wsl-distro.nix +++ b/hosts/home-wsl/nixos-wsl/modules/wsl-distro.nix @@ -1,10 +1,23 @@ -{ lib, pkgs, config, ... }: +{ + lib, + pkgs, + config, + ... +}: with builtins; -with lib; { - options.wsl = with types; - let coercedToStr = coercedTo (oneOf [ bool path int ]) (toString) str; - in { +with lib; +{ + options.wsl = + with types; + let + coercedToStr = coercedTo (oneOf [ + bool + path + int + ]) (toString) str; + in + { enable = mkEnableOption "support for running NixOS as a WSL distribution"; automountPath = mkOption { type = str; @@ -21,122 +34,131 @@ with lib; { default = "nixos"; description = "The name of the default user"; }; - startMenuLaunchers = mkEnableOption - "shortcuts for GUI applications in the windows start menu"; + startMenuLaunchers = mkEnableOption "shortcuts for GUI applications in the windows start menu"; wslConf = mkOption { - type = attrsOf (attrsOf (oneOf [ string int bool ])); + type = attrsOf ( + attrsOf (oneOf [ + string + int + bool + ]) + ); description = "Entries that are added to /etc/wsl.conf"; }; }; - config = let - cfg = config.wsl; - syschdemd = import ../syschdemd.nix { - inherit lib pkgs config; - inherit (cfg) automountPath defaultUser; - defaultUserHome = config.users.users.${cfg.defaultUser}.home; - }; - in mkIf cfg.enable { - - wsl.wslConf = { - automount = { - enabled = true; - mountFsTab = true; - root = "${cfg.automountPath}/"; - options = cfg.automountOptions; + config = + let + cfg = config.wsl; + syschdemd = import ../syschdemd.nix { + inherit lib pkgs config; + inherit (cfg) automountPath defaultUser; + defaultUserHome = config.users.users.${cfg.defaultUser}.home; }; - network = { - generateResolvConf = mkDefault true; - generateHosts = mkDefault true; + in + mkIf cfg.enable { + + wsl.wslConf = { + automount = { + enabled = true; + mountFsTab = true; + root = "${cfg.automountPath}/"; + options = cfg.automountOptions; + }; + network = { + generateResolvConf = mkDefault true; + generateHosts = mkDefault true; + }; }; - }; - # WSL is closer to a container than anything else - boot.isContainer = true; + # WSL is closer to a container than anything else + boot.isContainer = true; - environment.noXlibs = lib.mkForce - false; # override xlibs not being installed (due to isContainer) to enable the use of GUI apps - hardware.opengl.enable = true; # Enable GPU acceleration + environment.noXlibs = lib.mkForce false; # override xlibs not being installed (due to isContainer) to enable the use of GUI apps + hardware.opengl.enable = true; # Enable GPU acceleration - environment = { + environment = { - etc = { - "wsl.conf".text = generators.toINI { } cfg.wslConf; - - # DNS settings are managed by WSL - hosts.enable = !config.wsl.wslConf.network.generateHosts; - "resolv.conf".enable = !config.wsl.wslConf.network.generateResolvConf; - }; + etc = { + "wsl.conf".text = generators.toINI { } cfg.wslConf; - systemPackages = [ - (pkgs.runCommand "wslpath" { } '' - mkdir -p $out/bin - ln -s /init $out/bin/wslpath - '') - ]; - }; + # DNS settings are managed by WSL + hosts.enable = !config.wsl.wslConf.network.generateHosts; + "resolv.conf".enable = !config.wsl.wslConf.network.generateResolvConf; + }; - networking.dhcpcd.enable = false; + systemPackages = [ + (pkgs.runCommand "wslpath" { } '' + mkdir -p $out/bin + ln -s /init $out/bin/wslpath + '') + ]; + }; - users.users.${cfg.defaultUser} = { - isNormalUser = true; - uid = 1000; - extraGroups = [ "wheel" ]; # Allow the default user to use sudo - }; + networking.dhcpcd.enable = false; - users.users.root = { - shell = "${syschdemd}/bin/syschdemd"; - # Otherwise WSL fails to login as root with "initgroups failed 5" - extraGroups = [ "root" ]; - }; + users.users.${cfg.defaultUser} = { + isNormalUser = true; + uid = 1000; + extraGroups = [ "wheel" ]; # Allow the default user to use sudo + }; - security.sudo = { - extraConfig = '' - Defaults env_keep+=INSIDE_NAMESPACE - ''; - wheelNeedsPassword = - mkDefault false; # The default user will not have a password by default - }; + users.users.root = { + shell = "${syschdemd}/bin/syschdemd"; + # Otherwise WSL fails to login as root with "initgroups failed 5" + extraGroups = [ "root" ]; + }; - system.activationScripts = { - copy-launchers = mkIf cfg.startMenuLaunchers (stringAfter [ ] '' - for x in applications icons; do - echo "Copying /usr/share/$x" - mkdir -p /usr/share/$x - ${pkgs.rsync}/bin/rsync -ar --delete $systemConfig/sw/share/$x/. /usr/share/$x - done - ''); - populateBin = stringAfter [ ] '' - echo "setting up /bin..." - ln -sf /init /bin/wslpath - ln -sf ${pkgs.bashInteractive}/bin/bash /bin/sh - ln -sf ${pkgs.util-linux}/bin/mount /bin/mount - ''; - }; + security.sudo = { + extraConfig = '' + Defaults env_keep+=INSIDE_NAMESPACE + ''; + wheelNeedsPassword = mkDefault false; # The default user will not have a password by default + }; - systemd = { - # Disable systemd units that don't make sense on WSL - services = { - "serial-getty@ttyS0".enable = false; - "serial-getty@hvc0".enable = false; - "getty@tty1".enable = false; - "autovt@".enable = false; - firewall.enable = false; - systemd-resolved.enable = false; - systemd-udevd.enable = false; + system.activationScripts = { + copy-launchers = mkIf cfg.startMenuLaunchers ( + stringAfter [ ] '' + for x in applications icons; do + echo "Copying /usr/share/$x" + mkdir -p /usr/share/$x + ${pkgs.rsync}/bin/rsync -ar --delete $systemConfig/sw/share/$x/. /usr/share/$x + done + '' + ); + populateBin = stringAfter [ ] '' + echo "setting up /bin..." + ln -sf /init /bin/wslpath + ln -sf ${pkgs.bashInteractive}/bin/bash /bin/sh + ln -sf ${pkgs.util-linux}/bin/mount /bin/mount + ''; }; - tmpfiles.rules = [ - # Don't remove the X11 socket - "d /tmp/.X11-unix 1777 root root" - ]; + systemd = { + # Disable systemd units that don't make sense on WSL + services = { + "serial-getty@ttyS0".enable = false; + "serial-getty@hvc0".enable = false; + "getty@tty1".enable = false; + "autovt@".enable = false; + firewall.enable = false; + systemd-resolved.enable = false; + systemd-udevd.enable = false; + }; + + tmpfiles.rules = [ + # Don't remove the X11 socket + "d /tmp/.X11-unix 1777 root root" + ]; + + # Don't allow emergency mode, because we don't have a console. + enableEmergencyMode = false; + }; - # Don't allow emergency mode, because we don't have a console. - enableEmergencyMode = false; + warnings = ( + optional ( + config.systemd.services.systemd-resolved.enable && config.wsl.wslConf.network.generateResolvConf + ) "systemd-resolved is enabled, but resolv.conf is managed by WSL" + ); }; - - warnings = (optional (config.systemd.services.systemd-resolved.enable - && config.wsl.wslConf.network.generateResolvConf) - "systemd-resolved is enabled, but resolv.conf is managed by WSL"); - }; } diff --git a/hosts/home-wsl/nixos-wsl/syschdemd.nix b/hosts/home-wsl/nixos-wsl/syschdemd.nix index c729d59..8ccbccf 100755 --- a/hosts/home-wsl/nixos-wsl/syschdemd.nix +++ b/hosts/home-wsl/nixos-wsl/syschdemd.nix @@ -1,5 +1,12 @@ -{ lib, pkgs, config, automountPath, defaultUser -, defaultUserHome ? "/home/${defaultUser}", ... }: +{ + lib, + pkgs, + config, + automountPath, + defaultUser, + defaultUserHome ? "/home/${defaultUser}", + ... +}: pkgs.substituteAll { name = "syschdemd"; diff --git a/hosts/vinnix/configuration.nix b/hosts/vinnix/configuration.nix index 7f8ac49..1692ef5 100644 --- a/hosts/vinnix/configuration.nix +++ b/hosts/vinnix/configuration.nix @@ -5,7 +5,8 @@ pkgs, users, ... -}: { +}: +{ imports = [ ../../programs/nix ../../programs/qtile # ALSO need to make sure config is copied from home manager @@ -15,32 +16,46 @@ nixpkgs = { overlays = builtins.attrValues outputs.overlays; config = { - permittedInsecurePackages = ["electron-25.9.0"]; - allowBroken = - true; # should probably set to false every once in a while to see if broken packages are fixed + permittedInsecurePackages = [ "electron-25.9.0" ]; + allowBroken = true; # should probably set to false every once in a while to see if broken packages are fixed allowUnfree = true; }; }; boot = { - supportedFilesystems = ["ntfs"]; + supportedFilesystems = [ "ntfs" ]; kernelPackages = pkgs.linuxPackages_latest; # use newest kernel - kernelParams = ["amd_iommu=on"]; - blacklistedKernelModules = ["nvidia" "nouveau"]; - kernelModules = ["kvm-amd" "vfio_virqfd" "vfio_pci" "vfio_iommu_type1" "vfio"]; + kernelParams = [ "amd_iommu=on" ]; + blacklistedKernelModules = [ + "nvidia" + "nouveau" + ]; + kernelModules = [ + "kvm-amd" + "vfio_virqfd" + "vfio_pci" + "vfio_iommu_type1" + "vfio" + ]; extraModprobeConfig = '' options vfio-pci ids=10de:13c0,10de:0fbb options btusb enable_autosuspend=n ''; loader = { - systemd-boot = {enable = true;}; - efi = {canTouchEfiVariables = true;}; + systemd-boot = { + enable = true; + }; + efi = { + canTouchEfiVariables = true; + }; }; kernel.sysctl."net.ipv4.ip_forward" = 1; }; security = { - polkit = {enable = true;}; + polkit = { + enable = true; + }; pam = { loginLimits = [ { @@ -97,8 +112,7 @@ }; networking.hostName = "vinnix"; # Define your hostname. - networking.networkmanager.enable = - true; # Easiest to use and most distros use this by default. + networking.networkmanager.enable = true; # Easiest to use and most distros use this by default. # Set your time zone. time.timeZone = "America/Detroit"; @@ -120,14 +134,21 @@ users.users.vinny = { isNormalUser = true; initialPassword = "passwordington"; - extraGroups = ["wheel" "libvirtd" "kvm" "qemu-libvirtd"]; + extraGroups = [ + "wheel" + "libvirtd" + "kvm" + "qemu-libvirtd" + ]; shell = pkgs.zsh; }; environment.systemPackages = with pkgs; [ # linuxPackages_latest.perf # TODO: readd this when its working # openvpn - (firefox.override {nativeMessagingHosts = [inputs.pipewire-screenaudio.packages.${pkgs.system}.default];}) + (firefox.override { + nativeMessagingHosts = [ inputs.pipewire-screenaudio.packages.${pkgs.system}.default ]; + }) gnupg killall pkgs.stable-pkgs.looking-glass-client diff --git a/hosts/vinnix/default.nix b/hosts/vinnix/default.nix index 4cf216a..c8971b8 100644 --- a/hosts/vinnix/default.nix +++ b/hosts/vinnix/default.nix @@ -1,27 +1,24 @@ -{ - inputs, - outputs, - ... -}: +{ inputs, outputs, ... }: inputs.nixpkgs.lib.nixosSystem { - specialArgs = {inherit inputs outputs;}; + specialArgs = { + inherit inputs outputs; + }; modules = [ inputs.lanzaboote.nixosModules.lanzaboote - ({ - pkgs, - lib, - ... - }: { - environment.systemPackages = [pkgs.sbctl]; + ( + { pkgs, lib, ... }: + { + environment.systemPackages = [ pkgs.sbctl ]; - boot.loader.systemd-boot.enable = lib.mkForce false; + boot.loader.systemd-boot.enable = lib.mkForce false; - boot.lanzaboote = { - enable = true; - pkiBundle = "/etc/secureboot"; - }; - }) + boot.lanzaboote = { + enable = true; + pkiBundle = "/etc/secureboot"; + }; + } + ) inputs.nix-index-database.nixosModules.nix-index @@ -33,7 +30,9 @@ inputs.nixpkgs.lib.nixosSystem { home-manager.useGlobalPkgs = true; home-manager.useUserPackages = true; home-manager.users.vinny = import ./users/vinny/home.nix; - home-manager.extraSpecialArgs = {inherit inputs outputs;}; + home-manager.extraSpecialArgs = { + inherit inputs outputs; + }; } ]; } diff --git a/hosts/vinnix/hardware.nix b/hosts/vinnix/hardware.nix index adad86e..1088971 100644 --- a/hosts/vinnix/hardware.nix +++ b/hosts/vinnix/hardware.nix @@ -1,13 +1,25 @@ # Do not modify this file! It was generated by ‘nixos-generate-config’ # and may be overwritten by future invocations. Please make changes # to /etc/nixos/configuration.nix instead. -{ config, lib, pkgs, modulesPath, ... }: +{ + config, + lib, + pkgs, + modulesPath, + ... +}: { imports = [ (modulesPath + "/installer/scan/not-detected.nix") ]; - boot.initrd.availableKernelModules = - [ "nvme" "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" ]; + boot.initrd.availableKernelModules = [ + "nvme" + "xhci_pci" + "ahci" + "usbhid" + "usb_storage" + "sd_mod" + ]; boot.initrd.kernelModules = [ ]; boot.extraModulePackages = [ ]; @@ -33,6 +45,5 @@ # networking.interfaces.wlp7s0.useDHCP = lib.mkDefault true; nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; - hardware.cpu.amd.updateMicrocode = - lib.mkDefault config.hardware.enableRedistributableFirmware; + hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; } diff --git a/hosts/vinnix/users/vinny/home.nix b/hosts/vinnix/users/vinny/home.nix index d19a9bf..d922f36 100644 --- a/hosts/vinnix/users/vinny/home.nix +++ b/hosts/vinnix/users/vinny/home.nix @@ -4,9 +4,11 @@ inputs, outputs, ... -}: let - cust_pkgs = import ../../../../pkgs {inherit pkgs;}; -in { +}: +let + cust_pkgs = import ../../../../pkgs { inherit pkgs; }; +in +{ imports = [ ../../../../programs/git ../../../../programs/zsh @@ -21,7 +23,7 @@ in { nixCats = { enable = true; - packageNames = ["nixCats"]; + packageNames = [ "nixCats" ]; }; # direnv ! @@ -42,7 +44,8 @@ in { defaultCacheTtlSsh = 10; }; - home.packages = with pkgs; + home.packages = + with pkgs; [ anki-bin chromium diff --git a/hosts/wdtech-eos/default.nix b/hosts/wdtech-eos/default.nix index 4ce45ce..87bce89 100644 --- a/hosts/wdtech-eos/default.nix +++ b/hosts/wdtech-eos/default.nix @@ -1,6 +1,8 @@ { inputs, outputs, ... }: inputs.home-manager.lib.homeManagerConfiguration { pkgs = inputs.nixpkgs.legacyPackages.x86_64-linux; - extraSpecialArgs = { inherit inputs outputs; }; + extraSpecialArgs = { + inherit inputs outputs; + }; modules = [ ./home.nix ]; } diff --git a/hosts/wdtech-eos/home.nix b/hosts/wdtech-eos/home.nix index 245e849..2e9c3f7 100644 --- a/hosts/wdtech-eos/home.nix +++ b/hosts/wdtech-eos/home.nix @@ -1,6 +1,13 @@ -{ inputs, outputs, pkgs, ... }: -let cust_pkgs = import ../../pkgs { inherit pkgs; }; -in { +{ + inputs, + outputs, + pkgs, + ... +}: +let + cust_pkgs = import ../../pkgs { inherit pkgs; }; +in +{ imports = [ ../../programs/neovim ../../programs/zsh @@ -11,7 +18,13 @@ in { nixpkgs.overlays = builtins.attrValues outputs.overlays; - home.packages = with pkgs; [ openvpn mesa ] ++ builtins.attrValues cust_pkgs; + home.packages = + with pkgs; + [ + openvpn + mesa + ] + ++ builtins.attrValues cust_pkgs; programs.direnv.enable = true; programs.direnv.nix-direnv.enable = true; @@ -21,5 +34,4 @@ in { home.stateVersion = "22.11"; programs.home-manager.enable = true; - } diff --git a/hosts/work-laptop/default.nix b/hosts/work-laptop/default.nix index 046bf89..8cb04a6 100644 --- a/hosts/work-laptop/default.nix +++ b/hosts/work-laptop/default.nix @@ -1,5 +1,13 @@ -{ nixpkgs, home-manager, overlays, ... }: +{ + nixpkgs, + home-manager, + overlays, + ... +}: home-manager.lib.homeManagerConfiguration { pkgs = nixpkgs.legacyPackages.x86_64-darwin; - modules = [ { nixpkgs.overlays = overlays; } ./home.nix ]; + modules = [ + { nixpkgs.overlays = overlays; } + ./home.nix + ]; } diff --git a/hosts/work-laptop/home.nix b/hosts/work-laptop/home.nix index f9876ac..499e8a0 100644 --- a/hosts/work-laptop/home.nix +++ b/hosts/work-laptop/home.nix @@ -1,6 +1,8 @@ { pkgs, lib, ... }: -let cust_pkgs = import ../../pkgs { inherit pkgs; }; -in { +let + cust_pkgs = import ../../pkgs { inherit pkgs; }; +in +{ imports = [ ../../programs/neovim ../../programs/zsh @@ -9,7 +11,13 @@ in { ../../programs/kitty ]; - home.packages = with pkgs; [ openvpn mesa ] ++ builtins.attrValues cust_pkgs; + home.packages = + with pkgs; + [ + openvpn + mesa + ] + ++ builtins.attrValues cust_pkgs; programs.direnv.enable = true; programs.direnv.nix-direnv.enable = true; @@ -19,5 +27,4 @@ in { home.stateVersion = "22.11"; programs.home-manager.enable = true; - } diff --git a/nixpkgs.nix b/nixpkgs.nix index 76485a1..1ba7e0e 100644 --- a/nixpkgs.nix +++ b/nixpkgs.nix @@ -2,9 +2,9 @@ # This is useful to avoid using channels when using legacy nix commands # Can get rid of this when they are deprecated and I know how to do the equivalent with new nix commands let - lock = - (builtins.fromJSON (builtins.readFile ./flake.lock)).nodes.nixpkgs.locked; -in import (fetchTarball { + lock = (builtins.fromJSON (builtins.readFile ./flake.lock)).nodes.nixpkgs.locked; +in +import (fetchTarball { url = "https://github.com/nixos/nixpkgs/archive/${lock.rev}.tar.gz"; sha256 = lock.narHash; }) diff --git a/overlays/default.nix b/overlays/default.nix index 9078fd8..d2ad29f 100644 --- a/overlays/default.nix +++ b/overlays/default.nix @@ -1,12 +1,13 @@ -{inputs, ...}: { - cust-pkgs = final: prev: import ../pkgs {pkgs = final;}; +{ inputs, ... }: +{ + cust-pkgs = final: prev: import ../pkgs { pkgs = final; }; master-pkgs-overlay = final: prev: { - master-pkgs = import inputs.nixpkgs-master {system = final.system;}; + master-pkgs = import inputs.nixpkgs-master { system = final.system; }; }; stable-pkgs-overlay = final: prev: { - stable-pkgs = import inputs.nixpkgs-stable {system = final.system;}; + stable-pkgs = import inputs.nixpkgs-stable { system = final.system; }; }; # cust-pkgs-overlay = final: prev: { diff --git a/pkgs/default.nix b/pkgs/default.nix index 9dd8ca4..7ae0f6c 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -1,5 +1,6 @@ { pkgs }: -with pkgs; { +with pkgs; +{ discord_audio_share = callPackage ./discord_audio_share { }; kill_and_attach = callPackage ./kill_and_attach { }; screenshot_to_clipboard = callPackage ./screenshot_to_clipboard { }; diff --git a/pkgs/discord_audio_share/default.nix b/pkgs/discord_audio_share/default.nix index 7789d76..862a28c 100644 --- a/pkgs/discord_audio_share/default.nix +++ b/pkgs/discord_audio_share/default.nix @@ -4,7 +4,10 @@ with pkgs; writeShellApplication { name = "discord_audio_share"; - runtimeInputs = [ bash pulseaudio ]; + runtimeInputs = [ + bash + pulseaudio + ]; text = builtins.readFile ../../scripts/discord_audio_share.sh; } diff --git a/pkgs/kill_and_attach/default.nix b/pkgs/kill_and_attach/default.nix index 6a81d90..e699bc2 100644 --- a/pkgs/kill_and_attach/default.nix +++ b/pkgs/kill_and_attach/default.nix @@ -4,6 +4,9 @@ with pkgs; writeShellApplication { name = "kill_and_attach"; - runtimeInputs = [ bash tmux ]; + runtimeInputs = [ + bash + tmux + ]; text = builtins.readFile ../../scripts/kill_and_attach.sh; } diff --git a/pkgs/screenshot_to_clipboard/default.nix b/pkgs/screenshot_to_clipboard/default.nix index 59c11da..e9b6cfc 100644 --- a/pkgs/screenshot_to_clipboard/default.nix +++ b/pkgs/screenshot_to_clipboard/default.nix @@ -1,10 +1,19 @@ -{ pkgs, use-notify ? true, ... }: +{ + pkgs, + use-notify ? true, + ... +}: with pkgs; writeShellApplication { name = "screenshot_to_clipboard"; - runtimeInputs = [ bash xclip scrot (if use-notify then libnotify else null) ]; + runtimeInputs = [ + bash + xclip + scrot + (if use-notify then libnotify else null) + ]; text = builtins.readFile ../../scripts/screenshot_to_clipboard.sh; } diff --git a/pkgs/vim-plugins.nix b/pkgs/vim-plugins.nix index f341c95..67da72e 100644 --- a/pkgs/vim-plugins.nix +++ b/pkgs/vim-plugins.nix @@ -4,7 +4,8 @@ buildNeovimPlugin, fetchFromGitHub, fetchgit, -}: final: prev: { +}: +final: prev: { leetcode-nvim = buildVimPlugin { pname = "leetcode.nvim"; version = "unstable-2024-04-06"; diff --git a/pkgs/worktree_helper/default.nix b/pkgs/worktree_helper/default.nix index d4d153d..d62aa09 100644 --- a/pkgs/worktree_helper/default.nix +++ b/pkgs/worktree_helper/default.nix @@ -4,7 +4,14 @@ with pkgs; writeShellApplication { name = "worktree_helper"; - runtimeInputs = [ bash coreutils gawk git fzf master-pkgs.twm ]; + runtimeInputs = [ + bash + coreutils + gawk + git + fzf + master-pkgs.twm + ]; text = builtins.readFile ../../scripts/worktree_helper.sh; } diff --git a/programs/git/default.nix b/programs/git/default.nix index 9b1a6b0..ed0dc76 100644 --- a/programs/git/default.nix +++ b/programs/git/default.nix @@ -1,4 +1,5 @@ -{...}: { +{ ... }: +{ programs.git = { enable = true; userName = "Vinny Meller"; @@ -28,10 +29,8 @@ pall = ''!f() { git commit -am "$1" && git push; }; f''; cob = "checkout -b"; del = "branch -D"; - lg = '' - !git log --pretty=format:"%C(magenta)%h%Creset -%C(red)%d%Creset %s %C(dim green)(%cr) [%an]" --abbrev-commit -30''; - clone-bare = '' - !f() { git clone --bare "$1" "$2" && cd "$2" && git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"; }; f''; + lg = ''!git log --pretty=format:"%C(magenta)%h%Creset -%C(red)%d%Creset %s %C(dim green)(%cr) [%an]" --abbrev-commit -30''; + clone-bare = ''!f() { git clone --bare "$1" "$2" && cd "$2" && git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"; }; f''; delete-gone-branches = "!git branch --list --format '%(if:equals=[gone])%(upstream:track)%(then)%(refname:short)%(end)' | sed 's,^refs/heads/,,' | grep . | xargs git branch -D"; up = "!git pull && git fetch --prune && git delete-gone-branches && git b"; ca = "commit --amend"; @@ -48,12 +47,13 @@ programs.gh = { enable = true; - settings = {version = "1";}; + settings = { + version = "1"; + }; }; home.shellAliases = { fork = "gh repo fork --clone --default-branch-only --remote"; - gs = "git swap"; # depends on the git alias above - + gs = "git swap"; # depends on the git alias above }; } diff --git a/programs/gpg/default.nix b/programs/gpg/default.nix index 7118f2b..4f5f325 100644 --- a/programs/gpg/default.nix +++ b/programs/gpg/default.nix @@ -5,14 +5,15 @@ lib, pkgs, ... -}: { +}: +{ programs.ssh.startAgent = false; services.pcscd.enable = true; - environment.systemPackages = with pkgs; [gnupg]; + environment.systemPackages = with pkgs; [ gnupg ]; - services.udev.packages = with pkgs; [yubikey-personalization]; + services.udev.packages = with pkgs; [ yubikey-personalization ]; programs.gnupg.agent = { enable = true; @@ -26,7 +27,7 @@ systemd.user.timers."restart-gpg-agent" = { enable = true; - wantedBy = ["timers.target"]; + wantedBy = [ "timers.target" ]; timerConfig = { OnCalendar = "*:0/5"; Unit = "restart-gpg-agent.service"; diff --git a/programs/kitty/default.nix b/programs/kitty/default.nix index 1020244..8d4f775 100644 --- a/programs/kitty/default.nix +++ b/programs/kitty/default.nix @@ -1,8 +1,5 @@ +{ config, pkgs, ... }: { - config, - pkgs, - ... -}: { programs.kitty = { enable = true; font = { diff --git a/programs/ncvim/default.nix b/programs/ncvim/default.nix index eb8e6d7..ab73e13 100644 --- a/programs/ncvim/default.nix +++ b/programs/ncvim/default.nix @@ -1,4 +1,5 @@ -{inputs, ...} @ attrs: let +{ inputs, ... }@attrs: +let inherit (inputs) flake-utils nixpkgs; inherit (inputs.nixCats) utils; luaPath = "${../../dotfiles/nvim}"; @@ -12,265 +13,280 @@ allowUnfree = true; }; inherit - (forEachSystem (system: let - # see :help nixCats.flake.outputs.overlays - # This overlay grabs all the inputs named in the format - # `plugins-` - # Once we add this overlay to our nixpkgs, we are able to - # use `pkgs.neovimPlugins`, which is a set of our plugins. - dependencyOverlays = [ - (utils.mergeOverlayLists inputs.nixCats.dependencyOverlays.${system} - ((import ./overlays inputs) + (forEachSystem ( + system: + let + # see :help nixCats.flake.outputs.overlays + # This overlay grabs all the inputs named in the format + # `plugins-` + # Once we add this overlay to our nixpkgs, we are able to + # use `pkgs.neovimPlugins`, which is a set of our plugins. + dependencyOverlays = [ + (utils.mergeOverlayLists inputs.nixCats.dependencyOverlays.${system} ( + (import ./overlays inputs) ++ [ (utils.standardPluginOverlay inputs) # add any flake overlays here. - ])) - ]; - in {inherit dependencyOverlays;})) + ] + )) + ]; + in + { + inherit dependencyOverlays; + } + )) dependencyOverlays ; - categoryDefinitions = { - pkgs, - settings, - categories, - name, - ... - } @ packageDef: let - custom-vim-plugins = - pkgs.vimPlugins.extend - (pkgs.callPackage ../../pkgs/vim-plugins.nix { - inherit (pkgs.vimUtils) buildVimPlugin; - inherit (pkgs.neovimUtils) buildNeovimPlugin; - }); - in { - propagatedBuildInputs = { - generalBuildInputs = with pkgs; [ - ]; - }; + categoryDefinitions = + { + pkgs, + settings, + categories, + name, + ... + }@packageDef: + let + custom-vim-plugins = pkgs.vimPlugins.extend ( + pkgs.callPackage ../../pkgs/vim-plugins.nix { + inherit (pkgs.vimUtils) buildVimPlugin; + inherit (pkgs.neovimUtils) buildNeovimPlugin; + } + ); + in + { + propagatedBuildInputs = { + generalBuildInputs = with pkgs; [ ]; + }; - lspsAndRuntimeDeps = { - general = with pkgs; - [ - alejandra - ast-grep - black - cargo - ccls - dockerfile-language-server-nodejs - efm-langserver - fd - gcc - haskellPackages.haskell-language-server - imagemagick - isort - ltex-ls - lua-language-server - nil - nixfmt - nodePackages.pyright - nodePackages.sql-formatter - nodePackages.typescript-language-server - nodejs - ocamlPackages.ocaml-lsp - postgresql - prettierd - ripgrep - rust-analyzer - shellcheck - shfmt - src-cli - stylua - tailwindcss-language-server - terraform-ls - vscode-langservers-extracted - xsel - yaml-language-server - zk - ] - ++ ( - if stdenv.isLinux - then [pkgs.htmx-lsp] - else [] - ); - }; + lspsAndRuntimeDeps = { + general = + with pkgs; + [ + alejandra + ast-grep + black + cargo + ccls + dockerfile-language-server-nodejs + efm-langserver + fd + gcc + haskellPackages.haskell-language-server + imagemagick + isort + ltex-ls + lua-language-server + nil + nixfmt-rfc-style + nodePackages.pyright + nodePackages.sql-formatter + nodePackages.typescript-language-server + nodejs + ocamlPackages.ocaml-lsp + postgresql + prettierd + ripgrep + rust-analyzer + shellcheck + shfmt + src-cli + stylua + tailwindcss-language-server + terraform-ls + vscode-langservers-extracted + xsel + yaml-language-server + zk + ] + ++ (if stdenv.isLinux then [ pkgs.htmx-lsp ] else [ ]); + }; - startupPlugins = { - general = with pkgs.vimPlugins; [ - SchemaStore-nvim - autosave-nvim - catppuccin-nvim - cmp-buffer - cmp-git - cmp-nvim-lsp - cmp-nvim-lsp-signature-help - cmp-nvim-lua - cmp-path - cmp_luasnip - comment-nvim - copilot-lua - custom-vim-plugins.leetcode-nvim - diffview-nvim - efmls-configs-nvim - pkgs.neovimPlugins.jsonfly-nvim - fidget-nvim - flash-nvim - gitsigns-nvim - gruvbox-nvim - harpoon2 - image-nvim - indent-blankline-nvim - lspkind-nvim - lualine-nvim - luasnip - markdown-preview-nvim - molten-nvim - neogit - nui-nvim - nvim-autopairs - nvim-cmp - nvim-lspconfig - nvim-treesitter-context - nvim-treesitter-textobjects - nvim-treesitter.withAllGrammars - nvim-ts-autotag - nvim-web-devicons - oil-nvim - nvim-remote-containers - telescope-sg - plenary-nvim - rustaceanvim - sg-nvim - sniprun - telescope-live-grep-args-nvim - telescope-nvim - tint-nvim - tmux-nvim - trouble-nvim - undotree - vim-be-good - vim-dadbod - vim-dadbod-completion - vim-dadbod-ui - vim-fugitive - vim-indent-object - vim-matchup - vim-rhubarb - vim-sleuth - vim-surround - which-key-nvim - wilder-nvim - zk-nvim - ]; - }; + startupPlugins = { + general = with pkgs.vimPlugins; [ + SchemaStore-nvim + autosave-nvim + catppuccin-nvim + cmp-buffer + cmp-git + cmp-nvim-lsp + cmp-nvim-lsp-signature-help + cmp-nvim-lua + cmp-path + cmp_luasnip + comment-nvim + copilot-lua + custom-vim-plugins.leetcode-nvim + diffview-nvim + efmls-configs-nvim + pkgs.neovimPlugins.jsonfly-nvim + fidget-nvim + flash-nvim + gitsigns-nvim + gruvbox-nvim + harpoon2 + image-nvim + indent-blankline-nvim + lspkind-nvim + lualine-nvim + luasnip + markdown-preview-nvim + molten-nvim + neogit + nui-nvim + nvim-autopairs + nvim-cmp + nvim-lspconfig + nvim-treesitter-context + nvim-treesitter-textobjects + nvim-treesitter.withAllGrammars + nvim-ts-autotag + nvim-web-devicons + oil-nvim + nvim-remote-containers + telescope-sg + plenary-nvim + rustaceanvim + sg-nvim + sniprun + telescope-live-grep-args-nvim + telescope-nvim + tint-nvim + tmux-nvim + trouble-nvim + undotree + vim-be-good + vim-dadbod + vim-dadbod-completion + vim-dadbod-ui + vim-fugitive + vim-indent-object + vim-matchup + vim-rhubarb + vim-sleuth + vim-surround + which-key-nvim + wilder-nvim + zk-nvim + ]; + }; - optionalPlugins = { - customPlugins = with pkgs.nixCatsBuilds; []; - gitPlugins = with pkgs.neovimPlugins; []; - general = with pkgs.vimPlugins; [ - ]; - }; + optionalPlugins = { + customPlugins = with pkgs.nixCatsBuilds; [ ]; + gitPlugins = with pkgs.neovimPlugins; [ ]; + general = with pkgs.vimPlugins; [ ]; + }; - # shared libraries to be added to LD_LIBRARY_PATH - # variable available to nvim runtime - sharedLibraries = { - general = with pkgs; [ - # libgit2 - ]; - }; + # shared libraries to be added to LD_LIBRARY_PATH + # variable available to nvim runtime + sharedLibraries = { + general = with pkgs; [ + # libgit2 + ]; + }; - environmentVariables = { - test = { - CATTESTVAR = "It worked!"; + environmentVariables = { + test = { + CATTESTVAR = "It worked!"; + }; }; - }; - extraWrapperArgs = { - # https://github.com/NixOS/nixpkgs/blob/master/pkgs/build-support/setup-hooks/make-wrapper.sh - test = [ - ''--set CATTESTVAR2 "It worked again!"'' - ]; - }; + extraWrapperArgs = { + # https://github.com/NixOS/nixpkgs/blob/master/pkgs/build-support/setup-hooks/make-wrapper.sh + test = [ ''--set CATTESTVAR2 "It worked again!"'' ]; + }; - # lists of the functions you would have passed to - # python.withPackages or lua.withPackages + # lists of the functions you would have passed to + # python.withPackages or lua.withPackages - # get the path to this python environment - # in your lua config via - # vim.g.python3_host_prog - # or run from nvim terminal via :!-python3 - extraPython3Packages = { - python = py: - with py; [ - cairosvg - jupyter-client - nbformat - plotly - pnglatex - pynvim - pyperclip - ]; - }; - extraPythonPackages = { - test = _: []; - }; - # populates $LUA_PATH and $LUA_CPATH - extraLuaPackages = { - lua = [(l: with l; [magick])]; + # get the path to this python environment + # in your lua config via + # vim.g.python3_host_prog + # or run from nvim terminal via :!-python3 + extraPython3Packages = { + python = + py: with py; [ + cairosvg + jupyter-client + nbformat + plotly + pnglatex + pynvim + pyperclip + ]; + }; + extraPythonPackages = { + test = _: [ ]; + }; + # populates $LUA_PATH and $LUA_CPATH + extraLuaPackages = { + lua = [ (l: with l; [ magick ]) ]; + }; }; - }; packageDefinitions = { - nixCats = {pkgs, ...}: { - # they contain a settings set defined above - # see :help nixCats.flake.outputs.settings - settings = { - extraName = "ncvim"; - configDirName = "ncvim"; - wrapRc = true; - # IMPORTANT: - # you may not alias to nvim - # your alias may not conflict with your other packages. - aliases = ["ncvim" "nv" "ea"]; - # caution: this option must be the same for all packages. - nvimSRC = inputs.neovim; - }; - # and a set of categories that you want - # (and other information to pass to lua) - categories = { - general = true; - generalBuildInputs = true; - test = true; - example = { - youCan = "add more than just booleans"; - toThisSet = [ - "and the contents of this categories set" - "will be accessible to your lua with" - "nixCats('path.to.value')" - "see :help nixCats" + nixCats = + { pkgs, ... }: + { + # they contain a settings set defined above + # see :help nixCats.flake.outputs.settings + settings = { + extraName = "ncvim"; + configDirName = "ncvim"; + wrapRc = true; + # IMPORTANT: + # you may not alias to nvim + # your alias may not conflict with your other packages. + aliases = [ + "ncvim" + "nv" + "ea" ]; + # caution: this option must be the same for all packages. + nvimSRC = inputs.neovim; + }; + # and a set of categories that you want + # (and other information to pass to lua) + categories = { + general = true; + generalBuildInputs = true; + test = true; + example = { + youCan = "add more than just booleans"; + toThisSet = [ + "and the contents of this categories set" + "will be accessible to your lua with" + "nixCats('path.to.value')" + "see :help nixCats" + ]; + }; }; }; - }; }; # In this section, the main thing you will need to do is change the default package name # to the name of the packageDefinitions entry you wish to use as the default. defaultPackageName = "nixCats"; in - # see :help nixCats.flake.outputs.exports - forEachSystem (system: let +# see :help nixCats.flake.outputs.exports +forEachSystem ( + system: + let inherit (utils) baseBuilder; - customPackager = - baseBuilder luaPath { - inherit system dependencyOverlays extra_pkg_config nixpkgs; - } - categoryDefinitions; + customPackager = baseBuilder luaPath { + inherit + system + dependencyOverlays + extra_pkg_config + nixpkgs + ; + } categoryDefinitions; nixCatsBuilder = customPackager packageDefinitions; # this is just for using utils such as pkgs.mkShell # The one used to build neovim is resolved inside the builder # and is passed to our categoryDefinitions and packageDefinitions - pkgs = import nixpkgs {inherit system;}; - in { + pkgs = import nixpkgs { inherit system; }; + in + { # this will make a package out of each of the packageDefinitions defined above # and set the default package to the one named here. packages = utils.mkPackages nixCatsBuilder packageDefinitions defaultPackageName; @@ -280,59 +296,61 @@ in devShells = { default = pkgs.mkShell { name = defaultPackageName; - packages = [(nixCatsBuilder defaultPackageName)]; - inputsFrom = []; - shellHook = '' - ''; + packages = [ (nixCatsBuilder defaultPackageName) ]; + inputsFrom = [ ]; + shellHook = ''''; }; }; # To choose settings and categories from the flake that calls this flake. # and you export overlays so people dont have to redefine stuff. inherit customPackager; - }) - // { - # these outputs will be NOT wrapped with ${system} + } +) +// { + # these outputs will be NOT wrapped with ${system} - # this will make an overlay out of each of the packageDefinitions defined above - # and set the default overlay to the one named here. - overlays = - utils.makeOverlays luaPath { - # we pass in the things to make a pkgs variable to build nvim with later - inherit nixpkgs dependencyOverlays extra_pkg_config; - # and also our categoryDefinitions - } + # this will make an overlay out of each of the packageDefinitions defined above + # and set the default overlay to the one named here. + overlays = utils.makeOverlays luaPath { + # we pass in the things to make a pkgs variable to build nvim with later + inherit nixpkgs dependencyOverlays extra_pkg_config; + # and also our categoryDefinitions + } categoryDefinitions packageDefinitions defaultPackageName; + + # we also export a nixos module to allow configuration from configuration.nix + nixosModules.default = utils.mkNixosModules { + inherit + defaultPackageName + dependencyOverlays + luaPath categoryDefinitions packageDefinitions - defaultPackageName; + nixpkgs + ; + }; + # and the same for home manager + homeModule = utils.mkHomeModules { + inherit + defaultPackageName + dependencyOverlays + luaPath + categoryDefinitions + packageDefinitions + nixpkgs + ; + }; + # now we can export some things that can be imported in other + # flakes, WITHOUT needing to use a system variable to do it. + # and update them into the rest of the outputs returned by the + # eachDefaultSystem function. + inherit + utils + categoryDefinitions + packageDefinitions + dependencyOverlays + ; + inherit (utils) templates baseBuilder; + keepLuaBuilder = utils.baseBuilder luaPath; +} - # we also export a nixos module to allow configuration from configuration.nix - nixosModules.default = utils.mkNixosModules { - inherit - defaultPackageName - dependencyOverlays - luaPath - categoryDefinitions - packageDefinitions - nixpkgs - ; - }; - # and the same for home manager - homeModule = utils.mkHomeModules { - inherit - defaultPackageName - dependencyOverlays - luaPath - categoryDefinitions - packageDefinitions - nixpkgs - ; - }; - # now we can export some things that can be imported in other - # flakes, WITHOUT needing to use a system variable to do it. - # and update them into the rest of the outputs returned by the - # eachDefaultSystem function. - inherit utils categoryDefinitions packageDefinitions dependencyOverlays; - inherit (utils) templates baseBuilder; - keepLuaBuilder = utils.baseBuilder luaPath; - } diff --git a/programs/ncvim/overlays/default.nix b/programs/ncvim/overlays/default.nix index f58168e..ce3d5f7 100644 --- a/programs/ncvim/overlays/default.nix +++ b/programs/ncvim/overlays/default.nix @@ -8,22 +8,23 @@ # This will allow you not to worry about other nixCats overlay # imports from having import naming conflicts with your own. /* -This file imports overlays defined in the following format. -Plugins will still only be downloaded if included in a category. -You may copy paste this example into a new file and then import that file here. + This file imports overlays defined in the following format. + Plugins will still only be downloaded if included in a category. + You may copy paste this example into a new file and then import that file here. */ # Example overlay: /* -importName: inputs: let - overlay = self: super: { - ${importName} = { - # define your overlay derivations here - }; + importName: inputs: let + overlay = self: super: { + ${importName} = { + # define your overlay derivations here }; - in - overlay + }; + in + overlay */ -inputs: let +inputs: +let overlaySet = { # this is how you would add another overlay file # for if your customBuildsOverlay gets too long @@ -32,4 +33,5 @@ inputs: let # nixCatsBuilds = import ./customBuildsOverlay.nix; }; in - builtins.attrValues (builtins.mapAttrs (name: value: (value name inputs)) overlaySet) +builtins.attrValues (builtins.mapAttrs (name: value: (value name inputs)) overlaySet) + diff --git a/programs/nix/default.nix b/programs/nix/default.nix index 2253953..d2a9279 100644 --- a/programs/nix/default.nix +++ b/programs/nix/default.nix @@ -1,20 +1,31 @@ -{inputs, ...}: { +{ inputs, ... }: +{ nix = { settings = { - experimental-features = ["nix-command" "flakes"]; + experimental-features = [ + "nix-command" + "flakes" + ]; auto-optimise-store = true; - substituters = ["https://nix-community.cachix.org" "https://cache.nixos.org"]; - trusted-public-keys = [ - "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" + substituters = [ + "https://nix-community.cachix.org" + "https://cache.nixos.org" ]; + trusted-public-keys = [ "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" ]; }; gc = { automatic = true; options = "--delete-older-than 14d"; }; # registry = {nixpkgs = {flake = inputs.nixpkgs;};}; - registry = (inputs.nixpkgs.lib.mapAttrs (_: flake: {inherit flake;})) ((inputs.nixpkgs.lib.filterAttrs (_: inputs.nixpkgs.lib.isType "flake")) inputs); + registry = (inputs.nixpkgs.lib.mapAttrs (_: flake: { inherit flake; })) ( + (inputs.nixpkgs.lib.filterAttrs (_: inputs.nixpkgs.lib.isType "flake")) inputs + ); }; - nixpkgs = {config = {allowUnfree = true;};}; + nixpkgs = { + config = { + allowUnfree = true; + }; + }; } diff --git a/programs/qtile/default.nix b/programs/qtile/default.nix index cabc443..9a8f228 100644 --- a/programs/qtile/default.nix +++ b/programs/qtile/default.nix @@ -3,7 +3,8 @@ pkgs, services, ... -}: { +}: +{ environment.variables = { GDK_SCALE = "2"; GDK_DPI_SCALE = "0.5"; @@ -41,7 +42,7 @@ } ]; xkb.layout = "us"; - videoDrivers = ["nvidia"]; + videoDrivers = [ "nvidia" ]; }; services.picom = { @@ -49,7 +50,7 @@ backend = "glx"; fade = true; fadeDelta = 5; - opacityRules = ["100:QTILE_INTERNAL:32c"]; + opacityRules = [ "100:QTILE_INTERNAL:32c" ]; shadow = true; shadowOpacity = 0.5; }; diff --git a/programs/ranger/default.nix b/programs/ranger/default.nix index daf405c..cb8b69f 100644 --- a/programs/ranger/default.nix +++ b/programs/ranger/default.nix @@ -1,9 +1,9 @@ -{ config, pkgs, ... }: { +{ config, pkgs, ... }: +{ home.packages = with pkgs; [ ranger ]; home.shellAliases = { - ranger = - "ranger --confdir=${config.home.homeDirectory}/.nixdots/dotfiles/ranger"; # have to do this because ranger requires the config dir to be writable + ranger = "ranger --confdir=${config.home.homeDirectory}/.nixdots/dotfiles/ranger"; # have to do this because ranger requires the config dir to be writable }; } diff --git a/programs/tmux/default.nix b/programs/tmux/default.nix index c89dc89..641c533 100644 --- a/programs/tmux/default.nix +++ b/programs/tmux/default.nix @@ -1,7 +1,7 @@ -{ config, pkgs, ... }: { +{ config, pkgs, ... }: +{ programs.tmux.enable = true; programs.tmux.extraConfig = builtins.readFile ../../dotfiles/.tmux.conf; home.file.".config/twm/twm.yaml".source = ../../dotfiles/twm/twm.yaml; - } diff --git a/programs/zk/default.nix b/programs/zk/default.nix index 22f9a59..b1965b9 100644 --- a/programs/zk/default.nix +++ b/programs/zk/default.nix @@ -1,5 +1,9 @@ -{ pkgs, ... }: { - home.packages = with pkgs; [ zk fzf ]; +{ pkgs, ... }: +{ + home.packages = with pkgs; [ + zk + fzf + ]; home.file.".config/zk".source = ../../dotfiles/zk; } diff --git a/programs/zsh/default.nix b/programs/zsh/default.nix index fc5ff89..5241f3f 100644 --- a/programs/zsh/default.nix +++ b/programs/zsh/default.nix @@ -1,8 +1,5 @@ +{ config, pkgs, ... }: { - config, - pkgs, - ... -}: { # zsh doesn't have an extraPackages option, so we have to add them to home.packages home.packages = with pkgs; [ master-pkgs.twm @@ -82,7 +79,7 @@ oh-my-zsh = { enable = true; - plugins = ["git"]; + plugins = [ "git" ]; }; }; diff --git a/shell.nix b/shell.nix index b6cea58..758a727 100644 --- a/shell.nix +++ b/shell.nix @@ -1,6 +1,13 @@ -{ pkgs ? (import ./nixpkgs.nix) { } }: { +{ + pkgs ? (import ./nixpkgs.nix) { }, +}: +{ default = pkgs.mkShell { NIX_CONFIG = "experimental-features = nix-command flakes"; - nativeBuildInputs = with pkgs; [ nix home-manager git ]; + nativeBuildInputs = with pkgs; [ + nix + home-manager + git + ]; }; }