This commit is contained in:
Ray Andrew 2024-11-03 15:27:57 -06:00
parent 3a32e50429
commit b2cf19f883
64 changed files with 885 additions and 445 deletions

3
.gitignore vendored
View file

@ -1 +1,4 @@
*.swp
# Generated by nix-pre-commit-hooks
/.pre-commit-config.yaml

View file

@ -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",

View file

@ -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, ... }:
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);
};
}

View file

@ -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;
@ -60,7 +57,6 @@
# '';
# };
};
};
programs.home-manager.enable = true;
@ -71,7 +67,8 @@
userDirs =
let
homeDir = config.home.homeDirectory;
in {
in
{
enable = true;
download = "${homeDir}/downloads";
documents = "${homeDir}/documents";

View file

@ -1,5 +1,4 @@
{ pkgs, ... }:
{
programs.emacs = {
enable = true;

View file

@ -1,5 +1,8 @@
{ config, pkgs, ... }:
{
config,
pkgs,
...
}:
{
custom.persist = {
home.directories = [

View file

@ -1,5 +1,4 @@
{ pkgs, ... }:
{
programs.chromium = {
enable = true;

View file

@ -1,5 +1,8 @@
{ pkgs, config, ... }:
{
pkgs,
config,
...
}:
{
imports = [
./1password.nix
@ -39,7 +42,6 @@
};
};
qt = {
enable = true;
# platformTheme.name = "adwaita";

View file

@ -1,5 +1,4 @@
{ pkgs, ... }:
{
home.packages = with pkgs; [
discord

View file

@ -1,8 +1,13 @@
{ config, pkgs, lib, user, ... }:
{
config,
pkgs,
lib,
user,
...
}:
let
vendorPath = ".config/.mozilla";
configPath = "${vendorPath}/firefox";
vendorPath = ".config/.mozilla";
configPath = "${vendorPath}/firefox";
in
{
programs.firefox = {
@ -14,13 +19,11 @@ in
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}"
]
}"
'';
});

View file

@ -1,5 +1,8 @@
{ pkgs, config, ... }:
{
pkgs,
config,
...
}:
{
programs.foot = {
enable = true;

View file

@ -1,5 +1,9 @@
{ lib, pkgs, config, ... }:
{
lib,
pkgs,
config,
...
}:
{
home.packages = with pkgs; [
pop-launcher
@ -33,19 +37,22 @@
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 = [ "<Super>f" ];
unmaximize = [ "<Super><Shift>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 = [ "<Super><Shift>q" "<Alt>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 = [
"<Super><Shift>q"
"<Alt>F4"
];
switch-to-workspace-1 = [ "<Super>1" ];
switch-to-workspace-2 = [ "<Super>2" ];
switch-to-workspace-3 = [ "<Super>3" ];
@ -68,24 +75,27 @@
move-to-workspace-10 = [ "<Super><Shift>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" "<Super>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"
"<Super>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 = "<Super>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 = [ "<Super>Space" ];
toggle-floating = [ "<Super>p" ];
tile-enter = ["<Super>r"];
tile-by-default = true;
tile-orientation = [ "<Super>v" ];
toggle-stacking-global = [ "<Super>s" ];
activate-launcher = [ "<Super>Space" ];
toggle-floating = [ "<Super>p" ];
tile-enter = [ "<Super>r" ];
tile-by-default = true;
tile-orientation = [ "<Super>v" ];
toggle-stacking-global = [ "<Super>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 = {

View file

@ -1,5 +1,9 @@
{ pkgs, config, lib, ... }:
{
pkgs,
config,
lib,
...
}:
let
bar = {
position = "bottom";
@ -35,10 +39,12 @@ in
blocks = [
{
block = "sound";
click = [{
button = "left";
cmd = lib.getExe' pkgs.pwvucontrol "pwvucontrol";
}];
click = [
{
button = "left";
cmd = lib.getExe' pkgs.pwvucontrol "pwvucontrol";
}
];
}
{
block = "net";

View file

@ -1,5 +1,11 @@
{ inputs, lib, pkgs, config, stdenv, ... }:
{
inputs,
lib,
pkgs,
config,
stdenv,
...
}:
{
home.packages = with pkgs; [
kdePackages.krohnkite
@ -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 @@
};
};
}

View file

@ -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" = {

View file

@ -1,5 +1,8 @@
{ pkgs, config, ... }:
{
pkgs,
config,
...
}:
{
programs.kitty = {
enable = true;

View file

@ -1,5 +1,8 @@
{ config, pkgs, ... }:
{
config,
pkgs,
...
}:
{
home.packages = with pkgs; [
skypeforlinux

View file

@ -1,5 +1,8 @@
{ config, pkgs, ... }:
{
config,
pkgs,
...
}:
{
home.packages = with pkgs; [
slack

View file

@ -1,5 +1,8 @@
{ pkgs, config, ... }:
{
pkgs,
config,
...
}:
{
home.packages = with pkgs; [
spotify
@ -11,4 +14,3 @@
];
};
}

View file

@ -1,5 +1,4 @@
{ pkgs, ... }:
{
home.packages = with pkgs; [
teams-for-linux

View file

@ -1,5 +1,8 @@
{ config, pkgs, ... }:
{
config,
pkgs,
...
}:
{
programs.vscode = {
enable = true;

View file

@ -1,5 +1,4 @@
{ pkgs, ... }:
{
programs.wezterm = {
enable = true;

View file

@ -1,8 +1,5 @@
_:
{
_: {
programs.zathura = {
enable = true;
};
}

View file

@ -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
{

View file

@ -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

View file

@ -1,5 +1,4 @@
{ pkgs, ... }:
{
home.packages = with pkgs; [
texlive.combined.scheme-full

View file

@ -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 = [

View file

@ -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;
};
};
};
}

View file

@ -1,8 +0,0 @@
{ config, ... }:
{
programs.fzf = {
enable = true;
enableBashIntegration = config.programs.bash.enable;
};
}

View file

@ -1,5 +1,9 @@
{ lib, pkgs, config, ... }:
{
lib,
pkgs,
config,
...
}:
{
home.packages = with pkgs; [
git

View file

@ -1,11 +1,11 @@
{ pkgs, ... }:
{
programs.lazygit = {
enable = true;
settings = {
reporting = "off";
startupPopupVersion = 1;
# startupPopupVersion = 1;
disableStartupPopups = true;
};
};
}

46
src/home/shell/nix.nix Normal file
View file

@ -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" ];
};
};
}

View file

@ -1,5 +1,9 @@
{ config, lib, pkgs, ... }:
{
config,
lib,
pkgs,
...
}:
{
options.custom = with lib; {
shell = {

View file

@ -1,5 +1,4 @@
{ pkgs, ... }:
{
home.packages = with pkgs; [
tmux

View file

@ -1,5 +1,4 @@
{ config, ... }:
{
home.shellAliases = {
z = "zoxide query -i";

View file

@ -1,5 +1,8 @@
{ config, pkgs, ... }:
{
config,
pkgs,
...
}:
{
programs.ssh = {
enable = false;

View file

@ -1,5 +1,4 @@
{ pkgs, ... }:
{
home.packages = with pkgs; [
vim-full

View file

@ -1,5 +1,9 @@
{ pkgs, lib, config, ... }:
{
pkgs,
lib,
config,
...
}:
{
options.custom = with lib; {
wm = {

View file

@ -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}

View file

@ -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 ([
config = lib.mkMerge [
commonOptions.config
{
# modifier = "Mod4";
# 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;
};

View file

@ -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 ([
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;
};

View file

@ -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);
@ -54,4 +60,3 @@
system.stateVersion = "24.11";
}

View file

@ -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";

View file

@ -1,8 +1,14 @@
# 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, ... }:
{
inputs,
config,
lib,
pkgs,
modulesPath,
...
}:
{
imports = [
(modulesPath + "/installer/scan/not-detected.nix")
@ -10,7 +16,14 @@
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 = [ ];

View file

@ -1,5 +1,10 @@
{ config, pkgs, inputs, lib, ... }:
{
config,
pkgs,
inputs,
lib,
...
}:
{
home.packages = with pkgs; [
fw-ectool

View file

@ -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; })
);
};
}
)

View file

@ -1,5 +1,9 @@
{ config, pkgs, user, ... }:
{
config,
pkgs,
user,
...
}:
{
programs._1password.enable = true;
programs._1password-gui = {

View file

@ -1,5 +1,9 @@
{ config, lib, pkgs, ... }:
{
config,
lib,
pkgs,
...
}:
{
options.custom = with lib; {
bluetooth = {

View file

@ -4,7 +4,6 @@
pkgs,
...
}:
{
imports = [
./1password.nix
@ -62,18 +61,21 @@
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);
};
};
}

View file

@ -1,5 +1,4 @@
{ config, ...}:
{ config, ... }:
{
services = {
xserver = {
@ -26,4 +25,10 @@
};
security.polkit.enable = true;
custom.persist = {
root.directories = [
"/var/lib/AccountsService/users"
];
};
}

View file

@ -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"

View file

@ -1,5 +1,9 @@
{ pkgs, lib, config, ... }:
{
pkgs,
lib,
config,
...
}:
{
options.custom = with lib; {
nerdfonts = {
@ -7,21 +11,21 @@
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"
"FiraCode"
"DroidSansMono"
"SourceCodePro"
"SpaceMono"
"Iosevka"
"IosevkaTerm"
"Inconsolata"
"InconsolataGo"
"UbuntuMono"
];
};
};

View file

@ -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
];
})
{

View file

@ -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} = {

View file

@ -1,5 +1,9 @@
{ config, lib, pkgs, ... }:
{
config,
lib,
pkgs,
...
}:
{
options.custom = with lib; {
kde = {

View file

@ -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,27 +27,27 @@ 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 ([
settings = lib.mkMerge [
commonSettings
{
main = {
leftalt = "layer(meta)";
leftmeta = "layer(alt)";
};
};
}
]);
];
};
};
};
@ -54,9 +57,9 @@ in
];
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
'';
}

View file

@ -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

View file

@ -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;

View file

@ -1,7 +1,10 @@
{ pkgs, lib, config, ... }:
{
pkgs,
lib,
config,
...
}:
{
options.custom = with lib; {
touchpad = {
enable = mkEnableOption "Enable touchpad";

View file

@ -4,7 +4,6 @@
user,
...
}:
{
config = lib.mkMerge [
{

View file

@ -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;
};

View file

@ -1,5 +1,9 @@
{ pkgs, lib, config, ... }:
{
pkgs,
lib,
config,
...
}:
{
options.custom = with lib; {
wm = {

View file

@ -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 = {

View file

@ -1,9 +1,13 @@
{ 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;
};