diff --git a/.gitignore b/.gitignore index 1377554..1b03bbe 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,4 @@ *.swp + +# Generated by nix-pre-commit-hooks +/.pre-commit-config.yaml diff --git a/flake.lock b/flake.lock index 234541a..8f94934 100644 --- a/flake.lock +++ b/flake.lock @@ -87,6 +87,22 @@ } }, "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1696426674, + "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-compat_2": { "flake": false, "locked": { "lastModified": 1673956053, @@ -139,6 +155,50 @@ "type": "github" } }, + "git-hooks": { + "inputs": { + "flake-compat": "flake-compat", + "gitignore": "gitignore", + "nixpkgs": [ + "nixpkgs" + ], + "nixpkgs-stable": "nixpkgs-stable" + }, + "locked": { + "lastModified": 1730302582, + "narHash": "sha256-W1MIJpADXQCgosJZT8qBYLRuZls2KSiKdpnTVdKBuvU=", + "owner": "cachix", + "repo": "git-hooks.nix", + "rev": "af8a16fe5c264f5e9e18bcee2859b40a656876cf", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "git-hooks.nix", + "type": "github" + } + }, + "gitignore": { + "inputs": { + "nixpkgs": [ + "git-hooks", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1709087332, + "narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=", + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "637db329424fd7e46cf4185293b9cc8c88c95394", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "gitignore.nix", + "type": "github" + } + }, "gnome-shell": { "flake": false, "locked": { @@ -265,6 +325,22 @@ } }, "nixpkgs-stable": { + "locked": { + "lastModified": 1720386169, + "narHash": "sha256-NGKVY4PjzwAa4upkGtAMz1npHGoRzWotlSnVlqI40mo=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "194846768975b7ad2c4988bdb82572c00222c0d7", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-24.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-stable_2": { "locked": { "lastModified": 1729691686, "narHash": "sha256-BAuPWW+9fa1moZTU+jFh+1cUtmsuF8asgzFwejM4wac=", @@ -306,14 +382,16 @@ "root": { "inputs": { "disko": "disko", + "git-hooks": "git-hooks", "home-manager": "home-manager", "impermanence": "impermanence", "nix-index-database": "nix-index-database", "nixos-hardware": "nixos-hardware", "nixpkgs": "nixpkgs", - "nixpkgs-stable": "nixpkgs-stable", + "nixpkgs-stable": "nixpkgs-stable_2", "plasma-manager": "plasma-manager", - "stylix": "stylix" + "stylix": "stylix", + "treefmt-nix": "treefmt-nix" } }, "stylix": { @@ -322,7 +400,7 @@ "base16-fish": "base16-fish", "base16-helix": "base16-helix", "base16-vim": "base16-vim", - "flake-compat": "flake-compat", + "flake-compat": "flake-compat_2", "flake-utils": "flake-utils", "gnome-shell": "gnome-shell", "home-manager": "home-manager_2", @@ -411,6 +489,26 @@ "repo": "tinted-tmux", "type": "github" } + }, + "treefmt-nix": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1730321837, + "narHash": "sha256-vK+a09qq19QNu2MlLcvN4qcRctJbqWkX7ahgPZ/+maI=", + "owner": "numtide", + "repo": "treefmt-nix", + "rev": "746901bb8dba96d154b66492a29f5db0693dbfcc", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "treefmt-nix", + "type": "github" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index aee9c73..068f113 100644 --- a/flake.nix +++ b/flake.nix @@ -1,6 +1,6 @@ { description = "Nixos config flake"; - + inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; nixpkgs-stable.url = "github:nixos/nixpkgs/nixos-24.05"; @@ -17,10 +17,19 @@ plasma-manager.url = "github:nix-community/plasma-manager"; plasma-manager.inputs.nixpkgs.follows = "nixpkgs"; plasma-manager.inputs.home-manager.follows = "home-manager"; + treefmt-nix.url = "github:numtide/treefmt-nix"; + treefmt-nix.inputs.nixpkgs.follows = "nixpkgs"; + git-hooks.url = "github:cachix/git-hooks.nix"; + git-hooks.inputs.nixpkgs.follows = "nixpkgs"; }; - outputs = - inputs@{ nixpkgs, self, ... }: + outputs = + inputs@{ + nixpkgs, + self, + treefmt-nix, + ... + }: let system = "x86_64-linux"; pkgs = import inputs.nixpkgs { @@ -55,9 +64,65 @@ "x86_64-darwin" "aarch64-darwin" ] (system: fn (createCommonArgs system)); + treefmtEval = forAllSystems ( + { pkgs, ... }: + treefmt-nix.lib.evalModule pkgs { + projectRootFile = "flake.nix"; + programs.nixfmt-rfc-style.enable = true; + settings.global.excludes = [ "flake.lock" ]; + } + ); in { inherit lib self; - nixosConfigurations = (import ./src/hosts/default.nix commonArgs); + nixosConfigurations = import ./src/hosts/default.nix commonArgs; + + checks = forAllSystems ( + { + pkgs, + system, + ... + }: + { + formatting = treefmtEval.${system}.config.build.check self; + pre-commit-check = inputs.git-hooks.lib.${system}.run { + src = ./.; + excludes = [ "flake.lock" ]; + hooks = { + treefmt = { + enable = true; + package = lib.mkOverride 900 treefmtEval.${system}.config.build.wrapper; + }; + }; + }; + } + ); + + devShells = forAllSystems ( + { + pkgs, + system, + ... + }: + { + default = pkgs.mkShell { + inherit (self.checks.${system}.pre-commit-check) shellHook; + + name = "dotfiles"; + buildInputs = self.checks.${system}.pre-commit-check.enabledPackages; + nativeBuildInputs = [ + treefmtEval.${system}.config.build.wrapper + ]; + packages = [ + pkgs.sops + pkgs.ssh-to-age + pkgs.nixfmt-rfc-style + ]; + DIRENV_LOG_FORMAT = ""; + }; + } + ); + + formatter = forAllSystems ({ system, ... }: treefmtEval.${system}.config.build.wrapper); }; } diff --git a/src/home/default.nix b/src/home/default.nix index c640809..441bc40 100644 --- a/src/home/default.nix +++ b/src/home/default.nix @@ -5,12 +5,10 @@ user, ... }: - { imports = [ ./emacs.nix ./impermanence.nix - ./git.nix ./gui ./latex.nix ./shell @@ -20,7 +18,6 @@ ]; config = { - # setup fonts for other distros, run "fc-cache -f" to refresh fonts fonts.fontconfig.enable = true; @@ -38,40 +35,40 @@ # mkdir -p ${config.home.homeDirectory}/.local/share/applications/home-manager # mkdir -p ${config.home.homeDirectory}/.icons # ln -sf ${config.home.homeDirectory}/.nix-profile/share/icons ${config.home.homeDirectory}/.icons/nix-icons - + # # Check if the cached desktop files list exists # if [ -f ${config.home.homeDirectory}/.cache/current_desktop_files.txt ]; then # current_files=$(cat ${config.home.homeDirectory}/.cache/current_desktop_files.txt) # else # current_files="" # fi - + # # Symlink new desktop entries - # ${pkgs.bash}/bin/bash -c < + # ${pkgs.bash}/bin/bash -c < # for desktop_file in "${config.home.homeDirectory}/.nix-profile/share/applications/*.desktop"; do # if ! echo "$current_files" | grep -q "$(basename $desktop_file)"; then # echo $desktop_file # ln -sf "$desktop_file" ${config.home.homeDirectory}/.local/share/applications/home-manager/$(basename $desktop_file) # fi # done - + # # Update desktop database # ${pkgs.desktop-file-utils}/bin/update-desktop-database ${config.home.homeDirectory}/.local/share/applications # ''; # }; }; - }; - + programs.home-manager.enable = true; services.mpris-proxy.enable = true; xdg = { enable = true; - userDirs = - let + userDirs = + let homeDir = config.home.homeDirectory; - in { + in + { enable = true; download = "${homeDir}/downloads"; documents = "${homeDir}/documents"; diff --git a/src/home/emacs.nix b/src/home/emacs.nix index eb50a68..475465a 100644 --- a/src/home/emacs.nix +++ b/src/home/emacs.nix @@ -1,8 +1,7 @@ { pkgs, ... }: - { programs.emacs = { enable = true; - package = pkgs.emacs; + package = pkgs.emacs; }; } diff --git a/src/home/gui/1password.nix b/src/home/gui/1password.nix index e590571..ae4ad8a 100644 --- a/src/home/gui/1password.nix +++ b/src/home/gui/1password.nix @@ -1,8 +1,11 @@ -{ config, pkgs, ... }: - +{ + config, + pkgs, + ... +}: { custom.persist = { - home.directories = [ + home.directories = [ ".config/1Password" ]; }; diff --git a/src/home/gui/chromium.nix b/src/home/gui/chromium.nix index 60d7b82..0f201ac 100644 --- a/src/home/gui/chromium.nix +++ b/src/home/gui/chromium.nix @@ -1,5 +1,4 @@ { pkgs, ... }: - { programs.chromium = { enable = true; diff --git a/src/home/gui/default.nix b/src/home/gui/default.nix index a356ea1..2b9bdd9 100644 --- a/src/home/gui/default.nix +++ b/src/home/gui/default.nix @@ -1,5 +1,8 @@ -{ pkgs, config, ... }: - +{ + pkgs, + config, + ... +}: { imports = [ ./1password.nix @@ -39,7 +42,6 @@ }; }; - qt = { enable = true; # platformTheme.name = "adwaita"; diff --git a/src/home/gui/discord.nix b/src/home/gui/discord.nix index 3df5e6c..9b01081 100644 --- a/src/home/gui/discord.nix +++ b/src/home/gui/discord.nix @@ -1,5 +1,4 @@ { pkgs, ... }: - { home.packages = with pkgs; [ discord diff --git a/src/home/gui/firefox.nix b/src/home/gui/firefox.nix index 48d07aa..7eaddc9 100644 --- a/src/home/gui/firefox.nix +++ b/src/home/gui/firefox.nix @@ -1,26 +1,29 @@ -{ config, pkgs, lib, user, ... }: - +{ + config, + pkgs, + lib, + user, + ... +}: let - vendorPath = ".config/.mozilla"; - configPath = "${vendorPath}/firefox"; + vendorPath = ".config/.mozilla"; + configPath = "${vendorPath}/firefox"; in { programs.firefox = { enable = true; package = pkgs.firefox-bin.overrideAttrs (o: { - buildCommand = + buildCommand = o.buildCommand + '' wrapProgram "$executablePath" \ --set 'HOME' '${config.xdg.configHome}' \ --append-flags "${ - lib.concatStringsSep " " ( - [ - "--name firefox" - "-P ${user}" - # "--profile ${config.xdg.configHome}/.mozilla/${user}" - ] - ) + lib.concatStringsSep " " [ + "--name firefox" + "-P ${user}" + # "--profile ${config.xdg.configHome}/.mozilla/${user}" + ] }" ''; }); diff --git a/src/home/gui/foot.nix b/src/home/gui/foot.nix index de054d7..3fa66fa 100644 --- a/src/home/gui/foot.nix +++ b/src/home/gui/foot.nix @@ -1,5 +1,8 @@ -{ pkgs, config, ... }: - +{ + pkgs, + config, + ... +}: { programs.foot = { enable = true; diff --git a/src/home/gui/gnome.nix b/src/home/gui/gnome.nix index 8186e14..da3f9af 100644 --- a/src/home/gui/gnome.nix +++ b/src/home/gui/gnome.nix @@ -1,9 +1,13 @@ -{ lib, pkgs, config, ... }: - +{ + lib, + pkgs, + config, + ... +}: { home.packages = with pkgs; [ pop-launcher - gnomeExtensions.pop-shell + gnomeExtensions.pop-shell gnomeExtensions.tray-icons-reloaded gnomeExtensions.hibernate-status-button gnomeExtensions.appindicator @@ -16,8 +20,8 @@ }; "org/gnome/shell" = { disable-user-extensions = false; - enabled-extensions = [ - "pop-shell@system76.com" + enabled-extensions = [ + "pop-shell@system76.com" "keyd" "appindicatorsupport@rgcjonas.gmail.com" # "just-perfection-desktop@just-perfection" @@ -30,22 +34,25 @@ ]; }; "org/gnome/desktop/wm/preferences" = { - num-workspaces = 10; + num-workspaces = 10; }; "org/gnome/desktop/wm/keybindings" = { - minimize = []; - lock = []; - switch-to-workspace-left = []; - switch-to-workspace-right = []; + minimize = [ ]; + lock = [ ]; + switch-to-workspace-left = [ ]; + switch-to-workspace-right = [ ]; maximize = [ "f" ]; unmaximize = [ "f" ]; - move-to-monitor-up = []; - move-to-monitor-down = []; - move-to-monitor-left = []; - move-to-monitor-right = []; - move-to-workspace-down = []; - move-to-workspace-up = []; - close = [ "q" "F4" ]; + move-to-monitor-up = [ ]; + move-to-monitor-down = [ ]; + move-to-monitor-left = [ ]; + move-to-monitor-right = [ ]; + move-to-workspace-down = [ ]; + move-to-workspace-up = [ ]; + close = [ + "q" + "F4" + ]; switch-to-workspace-1 = [ "1" ]; switch-to-workspace-2 = [ "2" ]; switch-to-workspace-3 = [ "3" ]; @@ -68,24 +75,27 @@ move-to-workspace-10 = [ "0" ]; }; "org/gnome/shell/keybindings" = { - toggle-quick-settings = []; - switch-to-application-1 = []; - switch-to-application-2 = []; - switch-to-application-3 = []; - switch-to-application-4 = []; - switch-to-application-5 = []; - switch-to-application-6 = []; - switch-to-application-7 = []; - switch-to-application-8 = []; - switch-to-application-9 = []; - show-screenshot-ui = [ "Print" "o" ]; + toggle-quick-settings = [ ]; + switch-to-application-1 = [ ]; + switch-to-application-2 = [ ]; + switch-to-application-3 = [ ]; + switch-to-application-4 = [ ]; + switch-to-application-5 = [ ]; + switch-to-application-6 = [ ]; + switch-to-application-7 = [ ]; + switch-to-application-8 = [ ]; + switch-to-application-9 = [ ]; + show-screenshot-ui = [ + "Print" + "o" + ]; }; "org/gnome/settings-daemon/plugins/media-keys" = { - video-out = [ ]; - rotate-video-lock-static = [ "XF88RotationLockToggle" ]; - custom-keybindings = [ - "/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/terminal/" - ]; + video-out = [ ]; + rotate-video-lock-static = [ "XF88RotationLockToggle" ]; + custom-keybindings = [ + "/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/terminal/" + ]; }; "org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/terminal" = { binding = "Return"; @@ -94,32 +104,32 @@ name = "Open Terminal"; }; "org/gnome/mutter/keybindings" = { - toggle-tiled-left = []; - toggle-tiled-right = []; - switch-monitor = [ "XF86Display" ]; + toggle-tiled-left = [ ]; + toggle-tiled-right = [ ]; + switch-monitor = [ "XF86Display" ]; }; "org/gnome/shell/extensions/pop-shell" = { - activate-launcher = [ "Space" ]; - toggle-floating = [ "p" ]; - tile-enter = ["r"]; - tile-by-default = true; - tile-orientation = [ "v" ]; - toggle-stacking-global = [ "s" ]; + activate-launcher = [ "Space" ]; + toggle-floating = [ "p" ]; + tile-enter = [ "r" ]; + tile-by-default = true; + tile-orientation = [ "v" ]; + toggle-stacking-global = [ "s" ]; + }; + "org/gnome/desktop/background" = { + picture-uri-dark = "file://${pkgs.nixos-artwork.wallpapers.nineish-dark-gray.src}"; + }; + "org/gnome/desktop/interface" = { + color-scheme = "prefer-dark"; + show-battery-percentage = true; + clock-format = "12h"; + }; + "org/gnome/settings-daemon/plugins/power" = { + ambient-enabled = false; + }; + "org/gtk/Settings/FileChooser" = { + clock-format = "12h"; }; - "org/gnome/desktop/background" = { - picture-uri-dark = "file://${pkgs.nixos-artwork.wallpapers.nineish-dark-gray.src}"; - }; - "org/gnome/desktop/interface" = { - color-scheme = "prefer-dark"; - show-battery-percentage = true; - clock-format = "12h"; - }; - "org/gnome/settings-daemon/plugins/power" = { - ambient-enabled = false; - }; - "org/gtk/Settings/FileChooser" = { - clock-format = "12h"; - }; }; custom.persist = { diff --git a/src/home/gui/i3status-rust.nix b/src/home/gui/i3status-rust.nix index f46f4bf..918d301 100644 --- a/src/home/gui/i3status-rust.nix +++ b/src/home/gui/i3status-rust.nix @@ -1,5 +1,9 @@ -{ pkgs, config, lib, ... }: - +{ + pkgs, + config, + lib, + ... +}: let bar = { position = "bottom"; @@ -35,14 +39,16 @@ in blocks = [ { block = "sound"; - click = [{ - button = "left"; - cmd = lib.getExe' pkgs.pwvucontrol "pwvucontrol"; - }]; + click = [ + { + button = "left"; + cmd = lib.getExe' pkgs.pwvucontrol "pwvucontrol"; + } + ]; } { block = "net"; - format = " $icon {$signal_strength|Wired connection} "; + format = " $icon {$signal_strength|Wired connection} "; } { block = "weather"; diff --git a/src/home/gui/kde.nix b/src/home/gui/kde.nix index 4038d3b..004af0a 100644 --- a/src/home/gui/kde.nix +++ b/src/home/gui/kde.nix @@ -1,5 +1,11 @@ -{ inputs, lib, pkgs, config, stdenv, ... }: - +{ + inputs, + lib, + pkgs, + config, + stdenv, + ... +}: { home.packages = with pkgs; [ kdePackages.krohnkite @@ -29,7 +35,7 @@ "Screensaver" "Meta+Ctrl+Alt+L" ]; - }; + }; kwin = { "Window Close" = [ "Alt+F4" @@ -43,8 +49,8 @@ ]; }; plasmashell = { - "activate task manager entry 1" = []; - "activate task manager entry 2" = []; + "activate task manager entry 1" = [ ]; + "activate task manager entry 2" = [ ]; }; }; @@ -66,7 +72,7 @@ scripts.polonium.enable = false; }; - configFile ={ + configFile = { kwinrc = { Desktops.Number = { value = 1; @@ -83,4 +89,3 @@ }; }; } - diff --git a/src/home/gui/keyd.nix b/src/home/gui/keyd.nix index 7211380..4f8227b 100644 --- a/src/home/gui/keyd.nix +++ b/src/home/gui/keyd.nix @@ -1,16 +1,15 @@ { pkgs, ... }: - { xdg.configFile."keyd/app.conf" = { text = '' -[firefox] + [firefox] -control.p = up -control.n = down -control.e = end -control.a = home -control.shift.p = macro(C-S-p) -''; + control.p = up + control.n = down + control.e = end + control.a = home + control.shift.p = macro(C-S-p) + ''; }; home.file.".local/share/gnome-shell/extensions/keyd" = { diff --git a/src/home/gui/kitty.nix b/src/home/gui/kitty.nix index 2a20264..068d44e 100644 --- a/src/home/gui/kitty.nix +++ b/src/home/gui/kitty.nix @@ -1,5 +1,8 @@ -{ pkgs, config, ... }: - +{ + pkgs, + config, + ... +}: { programs.kitty = { enable = true; diff --git a/src/home/gui/skype.nix b/src/home/gui/skype.nix index 4ecbe6d..b03d121 100644 --- a/src/home/gui/skype.nix +++ b/src/home/gui/skype.nix @@ -1,12 +1,15 @@ -{ config, pkgs, ... }: - +{ + config, + pkgs, + ... +}: { home.packages = with pkgs; [ skypeforlinux ]; custom.persist = { - home.directories = [ + home.directories = [ ".config/skypeforlinux" ]; }; diff --git a/src/home/gui/slack.nix b/src/home/gui/slack.nix index 2d2e5c0..16272f5 100644 --- a/src/home/gui/slack.nix +++ b/src/home/gui/slack.nix @@ -1,12 +1,15 @@ -{ config, pkgs, ... }: - +{ + config, + pkgs, + ... +}: { home.packages = with pkgs; [ slack ]; custom.persist = { - home.directories = [ + home.directories = [ ".config/Slack" ]; }; diff --git a/src/home/gui/spotify.nix b/src/home/gui/spotify.nix index 0cbb6ac..a32a468 100644 --- a/src/home/gui/spotify.nix +++ b/src/home/gui/spotify.nix @@ -1,14 +1,16 @@ -{ pkgs, config, ... }: - +{ + pkgs, + config, + ... +}: { home.packages = with pkgs; [ spotify ]; - + custom.persist = { home.directories = [ ".config/spotify" ]; }; } - diff --git a/src/home/gui/teams.nix b/src/home/gui/teams.nix index 00b7fe5..2f6b2fb 100644 --- a/src/home/gui/teams.nix +++ b/src/home/gui/teams.nix @@ -1,5 +1,4 @@ { pkgs, ... }: - { home.packages = with pkgs; [ teams-for-linux diff --git a/src/home/gui/vscode.nix b/src/home/gui/vscode.nix index 9ced0ba..5a3d17f 100644 --- a/src/home/gui/vscode.nix +++ b/src/home/gui/vscode.nix @@ -1,5 +1,8 @@ -{ config, pkgs, ... }: - +{ + config, + pkgs, + ... +}: { programs.vscode = { enable = true; @@ -8,7 +11,7 @@ stylix.targets.vscode.enable = false; custom.persist = { - home.directories = [ + home.directories = [ ".config/Code" ]; }; diff --git a/src/home/gui/wezterm.nix b/src/home/gui/wezterm.nix index a4958c2..f90f7c2 100644 --- a/src/home/gui/wezterm.nix +++ b/src/home/gui/wezterm.nix @@ -1,5 +1,4 @@ { pkgs, ... }: - { programs.wezterm = { enable = true; diff --git a/src/home/gui/zathura.nix b/src/home/gui/zathura.nix index 50023b7..5d0a38f 100644 --- a/src/home/gui/zathura.nix +++ b/src/home/gui/zathura.nix @@ -1,8 +1,5 @@ -_: - -{ +_: { programs.zathura = { enable = true; }; } - diff --git a/src/home/gui/zoom.nix b/src/home/gui/zoom.nix index 6d661c3..d79e4dd 100644 --- a/src/home/gui/zoom.nix +++ b/src/home/gui/zoom.nix @@ -1,14 +1,20 @@ -{ config, pkgs, ... }: - +{ + config, + pkgs, + ... +}: let zoom = pkgs.zoom-us.overrideAttrs (attrs: { - nativeBuildInputs = (attrs.nativeBuildInputs or []) ++ [ pkgs.bbe ]; - postFixup = '' + nativeBuildInputs = (attrs.nativeBuildInputs or [ ]) ++ [ pkgs.bbe ]; + postFixup = + '' cp $out/opt/zoom/zoom . bbe -e 's/\0manjaro\0/\0nixos\0\0\0/' < zoom > $out/opt/zoom/zoom - '' + (attrs.postFixup or "") + '' + '' + + (attrs.postFixup or "") + + '' sed -i 's|Exec=|Exec=env XDG_CURRENT_DESKTOP="gnome" |' $out/share/applications/Zoom.desktop - ''; + ''; }); in { @@ -17,7 +23,7 @@ in ]; custom.persist = { - home.directories = [ + home.directories = [ ".zoom" ]; home.files = [ diff --git a/src/home/impermanence.nix b/src/home/impermanence.nix index 018bf6e..d52d70a 100644 --- a/src/home/impermanence.nix +++ b/src/home/impermanence.nix @@ -1,8 +1,12 @@ # note: this file exists just to define options for home-manager, # impermanence is not actually used in standalone home-manager as # it doesn't serve much utility on legacy distros -{ lib, user, config, ... }: - +{ + lib, + user, + config, + ... +}: let cfg = config.custom.persist; in @@ -35,14 +39,14 @@ in }; }; }; - + config = { # home.persistence = { # "/persist/home/${user}" = { # files = cfg.home.files; # directories = cfg.home.directories; # allowOther = false; - # }; + # }; # "/cache/home/${user}" = { # files = cfg.home.cache.files; # directories = cfg.home.cache.directories; diff --git a/src/home/latex.nix b/src/home/latex.nix index 6c75eb4..b206489 100644 --- a/src/home/latex.nix +++ b/src/home/latex.nix @@ -1,5 +1,4 @@ { pkgs, ... }: - { home.packages = with pkgs; [ texlive.combined.scheme-full diff --git a/src/home/shell/bash.nix b/src/home/shell/bash.nix index ca733a3..f467cc6 100644 --- a/src/home/shell/bash.nix +++ b/src/home/shell/bash.nix @@ -1,23 +1,27 @@ -{ lib, pkgs, config, ... }: - +{ + lib, + pkgs, + config, + ... +}: { programs.bash.enable = true; programs.bash.enableVteIntegration = true; programs.bash.bashrcExtra = lib.mkAfter '' -if [ "$term" != "dumb" ] || [ -n "$inside_emacs" ]; then - prompt_color="1;32m" - if [ -n "$inside_emacs" ]; then - # emacs term mode doesn't support xterm title escape sequence (\e]0;) - PS1="\n\[\033[$prompt_color\][\h \w]\\$\[\033[0m\] " - else - PS1="\[\e[32m\][\[\e[m\]\[\e[31m\]\u\[\e[m\]\[\e[33m\]@\[\e[m\]\[\e[32m\]\h\[\e[m\]:\[\e[36m\]\w\[\e[m\]\[\e[32m\]]\[\e[m\]\[\e[33m\]\\$\[\e[m\] " - # PS1="\n\[\033[$prompt_color\][\[\e]0;\h: \w\a\]\u@\h:\w]\\$\[\033[0m\] " - fi - if test "$term" = "xterm"; then - PS1="\[\033]2;\h:\u:\w\007\]$PS1" - fi -fi -''; + if [ "$term" != "dumb" ] || [ -n "$inside_emacs" ]; then + prompt_color="1;32m" + if [ -n "$inside_emacs" ]; then + # emacs term mode doesn't support xterm title escape sequence (\e]0;) + PS1="\n\[\033[$prompt_color\][\h \w]\\$\[\033[0m\] " + else + PS1="\[\e[32m\][\[\e[m\]\[\e[31m\]\u\[\e[m\]\[\e[33m\]@\[\e[m\]\[\e[32m\]\h\[\e[m\]:\[\e[36m\]\w\[\e[m\]\[\e[32m\]]\[\e[m\]\[\e[33m\]\\$\[\e[m\] " + # PS1="\n\[\033[$prompt_color\][\[\e]0;\h: \w\a\]\u@\h:\w]\\$\[\033[0m\] " + fi + if test "$term" = "xterm"; then + PS1="\[\033]2;\h:\u:\w\007\]$PS1" + fi + fi + ''; custom.persist = { home.files = [ diff --git a/src/home/shell/default.nix b/src/home/shell/default.nix index 53aa886..2909ba2 100644 --- a/src/home/shell/default.nix +++ b/src/home/shell/default.nix @@ -1,14 +1,63 @@ -{ config, lib, pkgs, ... }: - +{ + config, + lib, + pkgs, + ... +}: { imports = [ ./bash.nix ./direnv.nix - ./fzf.nix + ./git.nix ./lazygit.nix + ./nix.nix ./ripgrep.nix ./shell.nix ./tmux ./zoxide.nix ]; + + config = { + home.packages = + with pkgs; + [ + fd + fx + jq + sd + ugrep + ] + ++ (lib.attrValues config.custom.shell.packages); + + programs = { + bat = { + enable = true; + extraPackages = [ + (pkgs.symlinkJoin { + name = "batman"; + paths = [ pkgs.bat-extras.batman ]; + postBuild = '' + mkdir -p $out/share/bash-completion/completions + echo 'complete -F _comp_cmd_man batman' > $out/share/bash-completion/completions/batman + + mkdir -p $out/share/fish/vendor_completions.d + echo 'complete batman --wraps man' > $out/share/fish/vendor_completions.d/batman.fish + + mkdir -p $out/share/zsh/site-functions + cat << EOF > $out/share/zsh/site-functions/_batman + #compdef batman + _man "$@" + EOF + ''; + meta.mainProgram = "batman"; + }) + ]; + }; + fzf = { + enable = true; + enableBashIntegration = config.programs.bash.enable; + enableFishIntegration = config.programs.fish.enable; + }; + }; + }; } diff --git a/src/home/shell/fzf.nix b/src/home/shell/fzf.nix deleted file mode 100644 index da4a144..0000000 --- a/src/home/shell/fzf.nix +++ /dev/null @@ -1,8 +0,0 @@ -{ config, ... }: - -{ - programs.fzf = { - enable = true; - enableBashIntegration = config.programs.bash.enable; - }; -} diff --git a/src/home/git.nix b/src/home/shell/git.nix similarity index 72% rename from src/home/git.nix rename to src/home/shell/git.nix index aaa26a9..cafc373 100644 --- a/src/home/git.nix +++ b/src/home/shell/git.nix @@ -1,5 +1,9 @@ -{ lib, pkgs, config, ... }: - +{ + lib, + pkgs, + config, + ... +}: { home.packages = with pkgs; [ git diff --git a/src/home/shell/lazygit.nix b/src/home/shell/lazygit.nix index 349af69..c7bf75d 100644 --- a/src/home/shell/lazygit.nix +++ b/src/home/shell/lazygit.nix @@ -1,11 +1,11 @@ { pkgs, ... }: - { programs.lazygit = { enable = true; settings = { reporting = "off"; - startupPopupVersion = 1; + # startupPopupVersion = 1; + disableStartupPopups = true; }; }; } diff --git a/src/home/shell/nix.nix b/src/home/shell/nix.nix new file mode 100644 index 0000000..5cebde2 --- /dev/null +++ b/src/home/shell/nix.nix @@ -0,0 +1,46 @@ +{ + pkgs, + lib, + ... +}: +let + nixpkgs-review = pkgs.nixpkgs-review.override { withNom = true; }; +in +{ + home = { + packages = with pkgs; [ + nh + nixd + nix-output-monitor + nix-tree + nixpkgs-review + nvfetcher + ]; + + shellAliases = { + nfl = "nix flake lock"; + nfu = "nix flake update"; + nfui = "nix flake lock --update-input"; + nsh = "nix-shell --command fish -p"; + nshp = "nix-shell --pure --command fish -p"; + }; + }; + + custom.shell.packages = { + # outputs the current nixos generation + nix-current-generation = '' + # previous desktop versions: 1196 + sudo nix-env --list-generations --profile /nix/var/nix/profiles/system | grep current | awk '{print $1}' + ''; + }; + + programs = { + nix-index.enable = true; + }; + + custom.persist = { + home = { + cache.directories = [ ".cache/nix-index" ]; + }; + }; +} diff --git a/src/home/shell/shell.nix b/src/home/shell/shell.nix index 6d51bd6..54a3179 100644 --- a/src/home/shell/shell.nix +++ b/src/home/shell/shell.nix @@ -1,5 +1,9 @@ -{ config, lib, pkgs, ... }: - +{ + config, + lib, + pkgs, + ... +}: { options.custom = with lib; { shell = { diff --git a/src/home/shell/tmux/default.nix b/src/home/shell/tmux/default.nix index 57df3d8..9469160 100644 --- a/src/home/shell/tmux/default.nix +++ b/src/home/shell/tmux/default.nix @@ -1,5 +1,4 @@ { pkgs, ... }: - { home.packages = with pkgs; [ tmux @@ -13,5 +12,5 @@ home.directories = [ ".tmux" ]; - }; + }; } diff --git a/src/home/shell/zoxide.nix b/src/home/shell/zoxide.nix index b025032..0240869 100644 --- a/src/home/shell/zoxide.nix +++ b/src/home/shell/zoxide.nix @@ -1,5 +1,4 @@ -{ config, ... }: - +{ config, ... }: { home.shellAliases = { z = "zoxide query -i"; diff --git a/src/home/ssh.nix b/src/home/ssh.nix index 6fd9122..d1bb2c0 100644 --- a/src/home/ssh.nix +++ b/src/home/ssh.nix @@ -1,6 +1,9 @@ -{ config, pkgs, ... }: - -{ +{ + config, + pkgs, + ... +}: +{ programs.ssh = { enable = false; }; @@ -10,7 +13,7 @@ ]; custom.persist = { - home.directories = [ + home.directories = [ ".ssh" ]; }; diff --git a/src/home/vim.nix b/src/home/vim.nix index 7186cf0..de5b1de 100644 --- a/src/home/vim.nix +++ b/src/home/vim.nix @@ -1,5 +1,4 @@ { pkgs, ... }: - { home.packages = with pkgs; [ vim-full diff --git a/src/home/wm/awesome.nix b/src/home/wm/awesome.nix index 3b835d1..47a34d2 100644 --- a/src/home/wm/awesome.nix +++ b/src/home/wm/awesome.nix @@ -1,5 +1,9 @@ -{ pkgs, lib, config, ... }: - +{ + pkgs, + lib, + config, + ... +}: { options.custom = with lib; { wm = { diff --git a/src/home/wm/common-i3.nix b/src/home/wm/common-i3.nix index b3fe0f7..355c678 100644 --- a/src/home/wm/common-i3.nix +++ b/src/home/wm/common-i3.nix @@ -1,18 +1,19 @@ -{ config -, pkgs -, lib -, menu -, terminal -, light ? lib.getExe' pkgs.brightnessctl "brightnessctl" -, playerctl ? lib.getExe' pkgs.playerctl "playerctl" -, sound ? "pactl" -, alt ? "Mod1" -, modifier ? "Mod4" -, extraWindowOptions ? { } -, extraFocusOptions ? { } -, extraModes ? { } -, extraConfig ? "" -, workspaces ? [ +{ + config, + pkgs, + lib, + menu, + terminal, + light ? lib.getExe' pkgs.brightnessctl "brightnessctl", + playerctl ? lib.getExe' pkgs.playerctl "playerctl", + sound ? "pactl", + alt ? "Mod1", + modifier ? "Mod4", + extraWindowOptions ? { }, + extraFocusOptions ? { }, + extraModes ? { }, + extraConfig ? "", + workspaces ? [ { ws = 1; name = "1"; @@ -53,17 +54,24 @@ ws = 0; name = "10"; } - ] -, ... + ], + ... }: - let powerManagementMode = " : Screen [l]ock, [e]xit, [s]uspend, [h]ibernate, [R]eboot, [S]hutdown"; resizeMode = " : [h]  , [j]  , [k]  , [l] "; # Helpers - mapDirection = { prefixKey ? null, leftCmd, downCmd, upCmd, rightCmd }: - with lib.strings; { + mapDirection = + { + prefixKey ? null, + leftCmd, + downCmd, + upCmd, + rightCmd, + }: + with lib.strings; + { # Arrow keys "${optionalString (prefixKey != null) "${prefixKey}+"}Left" = leftCmd; "${optionalString (prefixKey != null) "${prefixKey}+"}Down" = downCmd; @@ -76,7 +84,11 @@ let "${optionalString (prefixKey != null) "${prefixKey}+"}l" = rightCmd; }; - mapDirectionDefault = { prefixKey ? null, prefixCmd }: + mapDirectionDefault = + { + prefixKey ? null, + prefixCmd, + }: (mapDirection { inherit prefixKey; leftCmd = "${prefixCmd} left"; @@ -85,21 +97,32 @@ let rightCmd = "${prefixCmd} right"; }); - mapWorkspacesStr = with builtins; + mapWorkspacesStr = + with builtins; with lib.strings; - { workspaces, prefixKey ? null, prefixCmd }: - (concatStringsSep "\n" (map - ({ ws, name }: - '' - bindsym ${optionalString (prefixKey != null) "${prefixKey}+"}${ - toString ws - } ${prefixCmd} "${name}"'') - workspaces)); + { + workspaces, + prefixKey ? null, + prefixCmd, + }: + (concatStringsSep "\n" ( + map ( + { + ws, + name, + }: + ''bindsym ${ + optionalString (prefixKey != null) "${prefixKey}+" + }${toString ws} ${prefixCmd} "${name}"'' + ) workspaces + )); in { inherit modifier terminal; - helpers = { inherit mapDirection mapDirectionDefault mapWorkspacesStr; }; + helpers = { + inherit mapDirection mapDirectionDefault mapWorkspacesStr; + }; config = { inherit modifier terminal; @@ -116,7 +139,7 @@ in "${modifier}+Shift+c" = "reload"; "${modifier}+Shift+r" = "restart"; "${modifier}+Shift+q" = "kill"; - "${modifier}+Shift+e" = "exit"; + # "${modifier}+Shift+e" = "exit"; "${alt}+F4" = "kill"; "${modifier}+h" = "focus left"; @@ -143,10 +166,10 @@ in "XF86MonBrightnessUp" = "exec --no-startup-id ${light} s +10%"; "XF86MonBrightnessDown" = "exec --no-startup-id ${light} s 10%-"; - "XF86AudioPlay" = "exec --no-startup-id ${playerctl} play-pause"; + "XF86AudioPlay" = "exec --no-startup-id ${playerctl} play-pause"; "XF86AudioPause" = "exec --no-startup-id ${playerctl} play-pause"; - "XF86AudioNext" = "exec --no-startup-id ${playerctl} next"; - "XF86AudioPrev" = "exec --no-startup-id ${playerctl} previous"; + "XF86AudioNext" = "exec --no-startup-id ${playerctl} next"; + "XF86AudioPrev" = "exec --no-startup-id ${playerctl} previous"; }; modes = @@ -157,12 +180,14 @@ in }; in { - ${resizeMode} = (mapDirection { - leftCmd = "resize shrink width 10px or 10ppt"; - downCmd = "resize grow height 10px or 10ppt"; - upCmd = "resize shrink height 10px or 10ppt"; - rightCmd = "resize grow width 10px or 10ppt"; - }) // exitMode; + ${resizeMode} = + (mapDirection { + leftCmd = "resize shrink width 10px or 10ppt"; + downCmd = "resize grow height 10px or 10ppt"; + upCmd = "resize shrink height 10px or 10ppt"; + rightCmd = "resize grow width 10px or 10ppt"; + }) + // exitMode; ${powerManagementMode} = { l = "mode default, exec loginctl lock-session"; e = "mode default, exec loginctl terminate-session $XDG_SESSION_ID"; @@ -171,7 +196,8 @@ in "Shift+r" = "mode default, exec systemctl reboot"; "Shift+s" = "mode default, exec systemctl poweroff"; } // exitMode; - } // extraModes; + } + // extraModes; workspaceAutoBackAndForth = true; workspaceLayout = "tabbed"; @@ -182,14 +208,16 @@ in titlebar = false; } // extraWindowOptions; - focus = { followMouse = false; } // extraFocusOptions; - }; + focus = { + followMouse = false; + } // extraFocusOptions; + }; # Until this issue is fixed we need to map workspaces directly to config file # https://github.com/nix-community/home-manager/issues/695 extraConfig = let - workspaceStr = (builtins.concatStringsSep "\n" [ + workspaceStr = builtins.concatStringsSep "\n" [ (mapWorkspacesStr { inherit workspaces; prefixKey = modifier; @@ -200,7 +228,7 @@ in prefixKey = "${modifier}+Shift"; prefixCmd = "move container to workspace number"; }) - ]); + ]; in '' ${workspaceStr} diff --git a/src/home/wm/i3.nix b/src/home/wm/i3.nix index 09922e0..5001e65 100644 --- a/src/home/wm/i3.nix +++ b/src/home/wm/i3.nix @@ -1,6 +1,9 @@ -{ pkgs, lib, config, ... }: - - +{ + pkgs, + lib, + config, + ... +}: let pactl = lib.getExe' pkgs.pulseaudio "pactl"; maim = lib.getExe' pkgs.maim "maim"; @@ -31,22 +34,23 @@ in xsession.windowManager.i3 = { enable = true; extraConfig = commonOptions.extraConfig; - config = lib.mkMerge ([ - commonOptions.config + config = lib.mkMerge [ + commonOptions.config { # modifier = "Mod4"; - # terminal = "kitty"; + # terminal = "kitty"; keybindings = { - "XF86AudioRaiseVolume" = "exec --no-startup-id ${pactl} set-sink-volume @DEFAULT_SINK@ +1%"; - "XF86AudioLowerVolume" = "exec --no-startup-id ${pactl} set-sink-volume @DEFAULT_SINK@ -1%"; - "XF86AudioMute" = "exec --no-startup-id ${pactl} set-sink-mute @DEFAULT_SINK@ toggle"; - "XF86AudioMicMute" = "exec --no-startup-id ${pactl} set-source-mute @DEFAULT_SOURCE@ toggle"; - "${commonOptions.modifier}+o" = "exec --no-startup-id ${maim} -s ~/pictures/screenshots/$(date +%Y-%m-%d-%H-%M-%S).png"; + "${commonOptions.modifier}+Shift+e" = "exec \"i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -B 'Yes, exit i3' 'i3-msg exit'\""; + "XF86AudioRaiseVolume" = "exec --no-startup-id ${pactl} set-sink-volume @DEFAULT_SINK@ +1%"; + "XF86AudioLowerVolume" = "exec --no-startup-id ${pactl} set-sink-volume @DEFAULT_SINK@ -1%"; + "XF86AudioMute" = "exec --no-startup-id ${pactl} set-sink-mute @DEFAULT_SINK@ toggle"; + "XF86AudioMicMute" = "exec --no-startup-id ${pactl} set-source-mute @DEFAULT_SOURCE@ toggle"; + "${commonOptions.modifier}+o" = "exec --no-startup-id ${maim} -s ~/pictures/screenshots/$(date +%Y-%m-%d-%H-%M-%S).png"; "${commonOptions.modifier}+Shift+o" = "exec --no-startup-id ${maim} -s | ${clipboard-copy} -selection clipboard -t image/png"; - "PRINT" = "exec --no-startup-id ${maim} -s | ${clipboard-copy} -selection clipboard -t image/png"; + "PRINT" = "exec --no-startup-id ${maim} -s | ${clipboard-copy} -selection clipboard -t image/png"; }; } - ]); + ]; }; stylix.targets.i3.enable = true; }; diff --git a/src/home/wm/sway.nix b/src/home/wm/sway.nix index 2c7ea0c..4b7d2b0 100644 --- a/src/home/wm/sway.nix +++ b/src/home/wm/sway.nix @@ -1,5 +1,9 @@ -{ pkgs, lib, config, ... }: - +{ + pkgs, + lib, + config, + ... +}: let swayosd = lib.getExe' config.services.swayosd.package "swayosd-client"; pactl = lib.getExe' pkgs.pulseaudio "pactl"; @@ -32,20 +36,21 @@ in wayland.windowManager.sway = { enable = true; extraConfig = commonOptions.extraConfig; - config = lib.mkMerge ([ - commonOptions.config + config = lib.mkMerge [ + commonOptions.config { keybindings = { - "XF86AudioRaiseVolume" = "exec --no-startup-id '${swayosd} --output-volume=raise'"; - "XF86AudioLowerVolume" = "exec --no-startup-id '${swayosd} --output-volume=lower'"; - "XF86AudioMute" = "exec --no-startup-id '${swayosd} --output-volume=mute-toggle"; - "XF86AudioMicMute" = "exec --no-startup-id '${pactl} set-source-mute @DEFAULT_SOURCE@ toggle'"; - "${commonOptions.modifier}+o" = "exec --no-startup-id ${grim} -g \"\$(${slurp})\" ~/pictures/screenshots/$(date +%Y-%m-%d-%H-%M-%S).png"; + "${commonOptions.modifier}+Shift+e" = "exec swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -B 'Yes, exit sway' 'swaymsg exit'"; + "XF86AudioRaiseVolume" = "exec --no-startup-id '${swayosd} --output-volume=raise'"; + "XF86AudioLowerVolume" = "exec --no-startup-id '${swayosd} --output-volume=lower'"; + "XF86AudioMute" = "exec --no-startup-id '${swayosd} --output-volume=mute-toggle"; + "XF86AudioMicMute" = "exec --no-startup-id '${pactl} set-source-mute @DEFAULT_SOURCE@ toggle'"; + "${commonOptions.modifier}+o" = "exec --no-startup-id ${grim} -g \"\$(${slurp})\" ~/pictures/screenshots/$(date +%Y-%m-%d-%H-%M-%S).png"; "${commonOptions.modifier}+Shift+o" = "exec --no-startup-id ${grim} -g \"\$(${slurp})\" -t png - | ${clipboard-copy}"; - "PRINT" = "exec --no-startup-id ${grim} -g \"\$(${slurp})\" -t png - | ${clipboard-copy}"; + "PRINT" = "exec --no-startup-id ${grim} -g \"\$(${slurp})\" -t png - | ${clipboard-copy}"; }; } - ]); + ]; }; stylix.targets.sway.enable = true; }; diff --git a/src/hosts/pickwick/default.nix b/src/hosts/pickwick/default.nix index 977dc29..b84721e 100644 --- a/src/hosts/pickwick/default.nix +++ b/src/hosts/pickwick/default.nix @@ -1,7 +1,13 @@ -{ config, lib, pkgs, inputs, user, ... }: - { - imports = []; + config, + lib, + pkgs, + inputs, + user, + ... +}: +{ + imports = [ ]; networking.hostName = "pickwick"; networking.hostId = builtins.substring 0 8 (builtins.hashString "md5" config.networking.hostName); @@ -44,14 +50,13 @@ }; gnome = { enable = true; - stylix = true; + stylix = true; }; kde = { enable = false; - stylix = true; + stylix = true; }; }; system.stateVersion = "24.11"; } - diff --git a/src/hosts/pickwick/disko.nix b/src/hosts/pickwick/disko.nix index 83e747d..2850600 100644 --- a/src/hosts/pickwick/disko.nix +++ b/src/hosts/pickwick/disko.nix @@ -1,7 +1,7 @@ { device ? throw "Set this to your disk device, e.g. /dev/sda", ... -}: +}: { disko.devices = { nodev = { @@ -47,26 +47,32 @@ "defaults" "umask=0077" ]; - extraArgs = [ "-n" "BOOT" ]; + extraArgs = [ + "-n" + "BOOT" + ]; }; }; swap = { - size = "108G"; - content = { + size = "108G"; + content = { type = "swap"; discardPolicy = "both"; resumeDevice = true; - extraArgs = [ "--label" "SWAP" ]; - }; - }; - zfs = { + extraArgs = [ + "--label" + "SWAP" + ]; + }; + }; + zfs = { size = "100%"; content = { type = "zfs"; pool = "zroot"; }; }; - }; + }; }; }; zpool = { @@ -81,8 +87,8 @@ rootFsOptions = { compression = "zstd"; acltype = "posixacl"; - xattr = "sa"; - mountpoint = "none"; + xattr = "sa"; + mountpoint = "none"; encryption = "aes-256-gcm"; keyformat = "passphrase"; keylocation = "prompt"; @@ -105,7 +111,7 @@ persist = { type = "zfs_fs"; options.mountpoint = "legacy"; - mountpoint = "/persist"; + mountpoint = "/persist"; }; tmp = { type = "zfs_fs"; diff --git a/src/hosts/pickwick/hardware.nix b/src/hosts/pickwick/hardware.nix index 0a3b6fe..5c9ce99 100644 --- a/src/hosts/pickwick/hardware.nix +++ b/src/hosts/pickwick/hardware.nix @@ -1,16 +1,29 @@ # 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. -{ inputs, config, lib, pkgs, modulesPath, ... }: - { - imports = [ + inputs, + config, + lib, + pkgs, + modulesPath, + ... +}: +{ + imports = [ (modulesPath + "/installer/scan/not-detected.nix") (import ./disko.nix { device = "/dev/nvme0n1"; }) inputs.nixos-hardware.nixosModules.framework-13-7040-amd ]; - boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "thunderbolt" "usb_storage" "usbhid" "sd_mod" ]; + boot.initrd.availableKernelModules = [ + "nvme" + "xhci_pci" + "thunderbolt" + "usb_storage" + "usbhid" + "sd_mod" + ]; boot.initrd.kernelModules = [ "dm-snapshot" ]; boot.kernelModules = [ "kvm-amd" ]; boot.extraModulePackages = [ ]; diff --git a/src/hosts/pickwick/home.nix b/src/hosts/pickwick/home.nix index c906897..aea01e8 100644 --- a/src/hosts/pickwick/home.nix +++ b/src/hosts/pickwick/home.nix @@ -1,6 +1,11 @@ -{ config, pkgs, inputs, lib, ... }: - -{ +{ + config, + pkgs, + inputs, + lib, + ... +}: +{ home.packages = with pkgs; [ fw-ectool ]; diff --git a/src/lib.nix b/src/lib.nix index cc4d4b4..b3cf768 100644 --- a/src/lib.nix +++ b/src/lib.nix @@ -1,62 +1,67 @@ -{ lib, pkgs, ... }: +{ + lib, + pkgs, + ... +}: +lib.extend ( + _: libprev: { + custom = rec { + # taken from https://github.com/iynaix/dotfiles/blob/main/lib.nix + # writeShellApplication with support for completions + writeShellApplicationCompletions = + { + name, + bashCompletion ? null, + zshCompletion ? null, + fishCompletion ? null, + ... + }@shellArgs: + let + inherit (pkgs) writeShellApplication writeTextFile symlinkJoin; + # get the needed arguments for writeShellApplication + app = writeShellApplication (lib.intersectAttrs (lib.functionArgs writeShellApplication) shellArgs); + completions = + lib.optional (bashCompletion != null) (writeTextFile { + name = "${name}.bash"; + destination = "/share/bash-completion/completions/${name}.bash"; + text = bashCompletion; + }) + ++ lib.optional (zshCompletion != null) (writeTextFile { + name = "${name}.zsh"; + destination = "/share/zsh/site-functions/_${name}"; + text = zshCompletion; + }) + ++ lib.optional (fishCompletion != null) (writeTextFile { + name = "${name}.fish"; + destination = "/share/fish/vendor_completions.d/${name}.fish"; + text = fishCompletion; + }); + in + if lib.length completions == 0 then + app + else + symlinkJoin { + inherit name; + inherit (app) meta; + paths = [ app ] ++ completions; + }; -lib.extend (_: libprev: { - custom = rec { - # taken from https://github.com/iynaix/dotfiles/blob/main/lib.nix - # writeShellApplication with support for completions - writeShellApplicationCompletions = - { - name, - bashCompletion ? null, - zshCompletion ? null, - fishCompletion ? null, - ... - }@shellArgs: - let - inherit (pkgs) writeShellApplication writeTextFile symlinkJoin; - # get the needed arguments for writeShellApplication - app = writeShellApplication (lib.intersectAttrs (lib.functionArgs writeShellApplication) shellArgs); - completions = - lib.optional (bashCompletion != null) (writeTextFile { - name = "${name}.bash"; - destination = "/share/bash-completion/completions/${name}.bash"; - text = bashCompletion; - }) - ++ lib.optional (zshCompletion != null) (writeTextFile { - name = "${name}.zsh"; - destination = "/share/zsh/site-functions/_${name}"; - text = zshCompletion; - }) - ++ lib.optional (fishCompletion != null) (writeTextFile { - name = "${name}.fish"; - destination = "/share/fish/vendor_completions.d/${name}.fish"; - text = fishCompletion; - }); - in - if lib.length completions == 0 then - app - else - symlinkJoin { - inherit name; - inherit (app) meta; - paths = [ app ] ++ completions; - }; - - # taken from https://github.com/iynaix/dotfiles/blob/main/lib.nix - # produces an attrset shell package with completions from either a string / writeShellApplication attrset / package - mkShellPackages = lib.mapAttrs ( - name: value: - if lib.isString value then - pkgs.writeShellApplication { - inherit name; - text = value; - } - # packages - else if lib.isDerivation value then - value - # attrs to pass to writeShellApplication - else - writeShellApplicationCompletions (value // { inherit name; }) - ); - }; -}) + # taken from https://github.com/iynaix/dotfiles/blob/main/lib.nix + # produces an attrset shell package with completions from either a string / writeShellApplication attrset / package + mkShellPackages = lib.mapAttrs ( + name: value: + if lib.isString value then + pkgs.writeShellApplication { + inherit name; + text = value; + } + # packages + else if lib.isDerivation value then + value + # attrs to pass to writeShellApplication + else + writeShellApplicationCompletions (value // { inherit name; }) + ); + }; + } +) diff --git a/src/nixos/1password.nix b/src/nixos/1password.nix index a5c7903..3e60ffe 100644 --- a/src/nixos/1password.nix +++ b/src/nixos/1password.nix @@ -1,5 +1,9 @@ -{ config, pkgs, user, ... }: - +{ + config, + pkgs, + user, + ... +}: { programs._1password.enable = true; programs._1password-gui = { diff --git a/src/nixos/bluetooth.nix b/src/nixos/bluetooth.nix index 173b9ba..323b27d 100644 --- a/src/nixos/bluetooth.nix +++ b/src/nixos/bluetooth.nix @@ -1,5 +1,9 @@ -{ config, lib, pkgs, ... }: - +{ + config, + lib, + pkgs, + ... +}: { options.custom = with lib; { bluetooth = { diff --git a/src/nixos/default.nix b/src/nixos/default.nix index 28c2fa7..be00caf 100644 --- a/src/nixos/default.nix +++ b/src/nixos/default.nix @@ -4,7 +4,6 @@ pkgs, ... }: - { imports = [ ./1password.nix @@ -60,20 +59,23 @@ }; }; - config = { + config = { environment = { - systemPackages = with pkgs; [ - curl - eza - neovim - yazi - ripgrep - htop - vim - wget - htop-vim - keyd - ] ++ (lib.attrValues config.custom.shell.packages); + systemPackages = + with pkgs; + [ + curl + eza + neovim + yazi + ripgrep + htop + vim + wget + htop-vim + keyd + ] + ++ (lib.attrValues config.custom.shell.packages); }; }; } diff --git a/src/nixos/displaymanager.nix b/src/nixos/displaymanager.nix index 96cb8aa..4a70897 100644 --- a/src/nixos/displaymanager.nix +++ b/src/nixos/displaymanager.nix @@ -1,5 +1,4 @@ -{ config, ...}: - +{ config, ... }: { services = { xserver = { @@ -26,4 +25,10 @@ }; security.polkit.enable = true; + + custom.persist = { + root.directories = [ + "/var/lib/AccountsService/users" + ]; + }; } diff --git a/src/nixos/fingerprint.nix b/src/nixos/fingerprint.nix index 0bac02e..f1cb194 100644 --- a/src/nixos/fingerprint.nix +++ b/src/nixos/fingerprint.nix @@ -1,5 +1,9 @@ -{ pkgs, lib, config, ... }: - +{ + pkgs, + lib, + config, + ... +}: { options.custom = with lib; { fingerprint = { @@ -11,6 +15,7 @@ services.fprintd.enable = true; security.pam.services.login.fprintAuth = false; security.pam.services.sudo.fprintAuth = false; + security.pam.services.i3lock.fprintAuth = false; custom.persist = { root.directories = [ "/var/lib/fprint" diff --git a/src/nixos/fonts.nix b/src/nixos/fonts.nix index 1561d2f..723ad55 100644 --- a/src/nixos/fonts.nix +++ b/src/nixos/fonts.nix @@ -1,5 +1,9 @@ -{ pkgs, lib, config, ... }: - +{ + pkgs, + lib, + config, + ... +}: { options.custom = with lib; { nerdfonts = { @@ -7,22 +11,22 @@ type = types.package; default = pkgs.nerdfonts.override { fonts = config.custom.nerdfonts.fonts; - }; + }; }; fonts = mkOption { type = types.listOf types.str; description = "Nerdfonts package"; - default = [ - "FiraCode" - "DroidSansMono" - "SourceCodePro" - "SpaceMono" - "Iosevka" - "IosevkaTerm" - "Inconsolata" - "InconsolataGo" - "UbuntuMono" - ]; + default = [ + "FiraCode" + "DroidSansMono" + "SourceCodePro" + "SpaceMono" + "Iosevka" + "IosevkaTerm" + "Inconsolata" + "InconsolataGo" + "UbuntuMono" + ]; }; }; }; diff --git a/src/nixos/gnome.nix b/src/nixos/gnome.nix index a8a983e..413bed6 100644 --- a/src/nixos/gnome.nix +++ b/src/nixos/gnome.nix @@ -1,5 +1,9 @@ -{ config, lib, pkgs, ... }: - +{ + config, + lib, + pkgs, + ... +}: { options.custom = with lib; { gnome = { @@ -19,7 +23,6 @@ cheese epiphany simple-scan - yelp evince geary gnome-tour @@ -27,6 +30,12 @@ gnome-music gnome-maps gnome-disk-utility + gnome-characters + tali # poker game + iagno # go game + hitori # sudoku game + atomix # puzzle game + yelp # Help view ]; }) { diff --git a/src/nixos/impermanence.nix b/src/nixos/impermanence.nix index 64c6043..76a4f3c 100644 --- a/src/nixos/impermanence.nix +++ b/src/nixos/impermanence.nix @@ -86,7 +86,7 @@ in directories = [ "/var/log" # systemd journal is stored in /var/log/journal "/var/lib/nixos" # for persisting user uids and gids - "/etc/NetworkManager/system-connections" + "/etc/NetworkManager/system-connections" ] ++ cfg.root.directories; users.${user} = { @@ -95,8 +95,8 @@ in [ ".cache/dconf" ".config/dconf" - ] - ++ cfg.home.directories + ] + ++ cfg.home.directories ++ hmPersistCfg.home.directories ); }; diff --git a/src/nixos/kde.nix b/src/nixos/kde.nix index 4fb3945..5817756 100644 --- a/src/nixos/kde.nix +++ b/src/nixos/kde.nix @@ -1,5 +1,9 @@ -{ config, lib, pkgs, ... }: - +{ + config, + lib, + pkgs, + ... +}: { options.custom = with lib; { kde = { diff --git a/src/nixos/keyd.nix b/src/nixos/keyd.nix index bb51307..600b21c 100644 --- a/src/nixos/keyd.nix +++ b/src/nixos/keyd.nix @@ -1,10 +1,13 @@ -{ config, lib, ... }: - +{ + config, + lib, + ... +}: let commonSettings = { main = { capslock = "layer(capslock)"; - insert = "S-insert"; + insert = "S-insert"; }; meta = { w = "macro(C-w)"; @@ -14,7 +17,7 @@ let }; in { - users.groups.keyd = {}; + users.groups.keyd = { }; services.keyd = { enable = true; keyboards = { @@ -24,39 +27,39 @@ in }; framework = { ids = [ "0001:0001:a38e6885" ]; - settings = lib.mkMerge ([ + settings = lib.mkMerge [ commonSettings { main = { leftalt = "layer(meta)"; leftmeta = "layer(alt)"; - }; + }; } - ]); + ]; }; normal = { - ids = [ "413c:2107:eb8bfad1" ]; - settings = lib.mkMerge ([ + ids = [ "413c:2107:eb8bfad1" ]; + settings = lib.mkMerge [ commonSettings { main = { leftalt = "layer(meta)"; leftmeta = "layer(alt)"; - }; + }; } - ]); + ]; }; }; }; systemd.services.keyd.serviceConfig.CapabilityBoundingSet = [ - "CAP_SETGID" + "CAP_SETGID" ]; environment.etc."libinput/local-overrides.quirks".text = lib.mkIf config.custom.touchpad.enable '' -[Serial Keyboards] -MatchUdevType=keyboard -MatchName=keyd virtual keyboard -AttrKeyboardIntegration=internal + [Serial Keyboards] + MatchUdevType=keyboard + MatchName=keyd virtual keyboard + AttrKeyboardIntegration=internal ''; } diff --git a/src/nixos/nix.nix b/src/nixos/nix.nix index 81c97a6..eb287b9 100644 --- a/src/nixos/nix.nix +++ b/src/nixos/nix.nix @@ -37,19 +37,18 @@ in "D! /nix/var/nix/profiles/per-user/root 1755 root root 1d" ]; - custom.shell.packages = - { - # list all installed packages - nix-list-packages = { - text = - let - allPkgs = map (p: p.name) ( - config.environment.systemPackages ++ config.users.users.${user}.packages ++ config.hm.home.packages - ); - in - ''sort -ui <<< "${lib.concatLines allPkgs}"''; - }; + custom.shell.packages = { + # list all installed packages + nix-list-packages = { + text = + let + allPkgs = map (p: p.name) ( + config.environment.systemPackages ++ config.users.users.${user}.packages ++ config.hm.home.packages + ); + in + ''sort -ui <<< "${lib.concatLines allPkgs}"''; }; + }; nix = let diff --git a/src/nixos/stylix.nix b/src/nixos/stylix.nix index de24f6f..251ca27 100644 --- a/src/nixos/stylix.nix +++ b/src/nixos/stylix.nix @@ -1,5 +1,8 @@ -{ pkgs, config, ... }: - +{ + pkgs, + config, + ... +}: { stylix = { enable = true; @@ -12,7 +15,7 @@ serif = config.stylix.fonts.sansSerif; sansSerif = { package = pkgs.dejavu_fonts; - name = "DejaVu Sans"; + name = "DejaVu Sans"; }; # sansSerif = { # package = config.custom.nerdfonts.package; diff --git a/src/nixos/touchpad.nix b/src/nixos/touchpad.nix index a2e2186..17830de 100644 --- a/src/nixos/touchpad.nix +++ b/src/nixos/touchpad.nix @@ -1,7 +1,10 @@ -{ pkgs, lib, config, ... }: - { - + pkgs, + lib, + config, + ... +}: +{ options.custom = with lib; { touchpad = { enable = mkEnableOption "Enable touchpad"; diff --git a/src/nixos/users.nix b/src/nixos/users.nix index f92eeb3..e58df1e 100644 --- a/src/nixos/users.nix +++ b/src/nixos/users.nix @@ -4,7 +4,6 @@ user, ... }: - { config = lib.mkMerge [ { diff --git a/src/nixos/wm/i3.nix b/src/nixos/wm/i3.nix index 0779f42..fd64a69 100644 --- a/src/nixos/wm/i3.nix +++ b/src/nixos/wm/i3.nix @@ -1,5 +1,9 @@ -{ pkgs, lib, config, ... }: - +{ + pkgs, + lib, + config, + ... +}: { options.custom = with lib; { wm = { @@ -20,10 +24,12 @@ dmenu i3status i3lock - i3blocks ]; }; }; + programs.xss-lock = { + enable = true; + }; hm.custom.wm.i3.enable = true; hm.custom.i3status-rust.enable = true; }; diff --git a/src/nixos/wm/sway.nix b/src/nixos/wm/sway.nix index e309021..26f2683 100644 --- a/src/nixos/wm/sway.nix +++ b/src/nixos/wm/sway.nix @@ -1,5 +1,9 @@ -{ pkgs, lib, config, ... }: - +{ + pkgs, + lib, + config, + ... +}: { options.custom = with lib; { wm = { diff --git a/src/nixos/xdg-portal.nix b/src/nixos/xdg-portal.nix index e5f3d2f..0d67a3d 100644 --- a/src/nixos/xdg-portal.nix +++ b/src/nixos/xdg-portal.nix @@ -1,13 +1,12 @@ { pkgs, ... }: - { xdg.portal = { enable = true; # xdgOpenUsePortal = true; wlr.enable = true; extraPortals = with pkgs; [ - # xdg-desktop-portal-kde - # xdg-desktop-portal-gnome + # xdg-desktop-portal-kde + # xdg-desktop-portal-gnome xdg-desktop-portal-gtk ]; # config = { diff --git a/src/nixos/zfs.nix b/src/nixos/zfs.nix index 63c7251..8199a09 100644 --- a/src/nixos/zfs.nix +++ b/src/nixos/zfs.nix @@ -1,11 +1,15 @@ -{ config, pkgs, lib, ... }: - +{ + config, + pkgs, + lib, + ... +}: { boot.supportedFilesystems.zfs = true; boot.zfs = { - devNodes ="/dev/disk/by-partuuid"; + devNodes = "/dev/disk/by-partuuid"; package = pkgs.zfs_unstable; - requestEncryptionCredentials = true; + requestEncryptionCredentials = true; }; # boot.kernelPackages = # assert lib.assertMsg (lib.versionOlder pkgs.zfs_unstable.version "2.3")