Compare commits

..

34 Commits

Author SHA1 Message Date
Daniel Olsen
7b72adab7f add consolidation 2023-11-10 20:18:17 +01:00
Daniel Olsen
556a31b334 add wackattack ssh config 2023-11-06 10:30:09 +01:00
Daniel Olsen
8fa457dc8d toggle voice-changer 2023-11-06 10:17:26 +01:00
Daniel Olsen
760228bcc6 work without overlays 2023-11-04 23:34:27 +01:00
Daniel Olsen
7f333af4b5 lmao puuush 2023-11-04 23:28:47 +01:00
Daniel Olsen
764a209200 Update tailscale hostnames 2023-08-05 21:46:35 +02:00
Daniel Olsen
3b70b6c977 make atuin act more sensibly 2023-06-03 19:14:34 +02:00
Daniel Olsen
09f7f00394 23.05 2023-06-03 04:38:32 +02:00
Daniel Olsen
85dcafb4e0 Add devenv to gitignore 2023-05-19 10:02:27 +02:00
Daniel Olsen
c56fcae38c flake update 2023-05-02 19:50:41 +02:00
Daniel Olsen
14711673b7 enable atuin 2023-05-02 04:26:35 +02:00
Daniel Olsen
1ea1e189bb flake update 2023-04-27 23:39:18 +02:00
Daniel Olsen
060ab92af6 Install openvpn for htb 2023-04-27 23:26:48 +02:00
Daniel Olsen
7fe0dc8d53 Install often used packages 2023-04-27 23:26:20 +02:00
Daniel Olsen
172ef4ec81 add lock screen button 2023-04-27 13:36:59 +02:00
Daniel Olsen
b1ce7ce98f flake update use normal helix 2023-04-27 13:17:48 +02:00
Daniel Olsen
abec0c9f38 fix girt 2023-04-27 12:02:42 +02:00
Daniel Olsen
90410802c3 update ssh files wit new vpn names 2023-04-27 11:51:34 +02:00
Daniel Olsen
2bf5d3c165 install timewarrior 2023-01-19 00:38:49 +01:00
Daniel Olsen
fd22fa23b7 limit app slice to less than all ram as well 2023-01-16 11:09:00 +01:00
Daniel Olsen
b94a54ec98 xsession: Start applications in their own scopes and limit their memory usage 2023-01-16 06:59:07 +01:00
Daniel Olsen
6f9cddb513 update flake 2023-01-16 06:58:04 +01:00
Daniel Olsen
30b4614657 base: https-everywhere is deprecated 2023-01-16 05:00:27 +01:00
Daniel Olsen
abf29baf20 access lilith over ssh over vpn 2023-01-16 04:28:15 +01:00
Daniel Olsen
8c221759c9 helix: fix poor mans us keyboard curlies 2022-12-28 17:58:03 +01:00
Daniel Olsen
cad1567687 base: fix ssh config 2022-12-28 03:51:09 +01:00
Daniel Olsen
a8649e9b2f disable girt for now 2022-12-24 02:19:35 +01:00
Daniel Olsen
aca058dbae ignore .envrc 2022-12-09 03:42:20 +01:00
Daniel Olsen
b95ed726eb update to nixos-22.11 2022-12-01 21:14:53 +01:00
Daniel Olsen
b9ea792ddc use nom from unstable 2022-12-01 16:27:16 +01:00
Daniel Olsen
37c94e0b67 update cargodeps hash for girt 2022-12-01 16:26:57 +01:00
Daniel Olsen
cc450395c0 remove libaom overlay no longer used 2022-12-01 16:26:23 +01:00
Daniel Olsen
97eacaac91 update flake to point to new git server 2022-12-01 16:25:49 +01:00
Daniel Olsen
115f530077 base: add .vscode to gitignore 2022-10-17 22:24:44 +02:00
10 changed files with 314 additions and 301 deletions

245
flake.lock generated
View File

@@ -1,21 +1,5 @@
{
"nodes": {
"crane": {
"flake": false,
"locked": {
"lastModified": 1661875961,
"narHash": "sha256-f1h/2c6Teeu1ofAHWzrS8TwBPcnN+EEu+z1sRVmMQTk=",
"owner": "ipetkov",
"repo": "crane",
"rev": "d9f394e4e20e97c2a60c3ad82c2b6ef99be19e24",
"type": "github"
},
"original": {
"owner": "ipetkov",
"repo": "crane",
"type": "github"
}
},
"dan": {
"inputs": {
"nixpkgs": [
@@ -23,111 +7,20 @@
]
},
"locked": {
"host": "git.dodsorf.as",
"lastModified": 1656687988,
"narHash": "sha256-2ywoy3wUvFAyxDTw7VPlz5TGh9mk/um2AWOjhJqJxNQ=",
"owner": "Dandellion",
"repo": "NUR",
"ref": "refs/heads/master",
"rev": "7e85f62e40cd585ce81fa1f3debd5385bb0cad03",
"type": "gitlab"
"revCount": 160,
"type": "git",
"url": "https://git.dodsorf.as/Dandellion/NUR.git"
},
"original": {
"host": "git.dodsorf.as",
"owner": "Dandellion",
"repo": "NUR",
"type": "gitlab"
}
},
"devshell": {
"flake": false,
"locked": {
"lastModified": 1660811669,
"narHash": "sha256-V6lmsaLNFz41myppL0yxglta92ijkSvpZ+XVygAh+bU=",
"owner": "numtide",
"repo": "devshell",
"rev": "c2feacb46ee69949124c835419861143c4016fb5",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "devshell",
"type": "github"
}
},
"dream2nix": {
"inputs": {
"alejandra": [
"helix",
"nci",
"nixpkgs"
],
"crane": "crane",
"devshell": [
"helix",
"nci",
"devshell"
],
"flake-utils-pre-commit": [
"helix",
"nci",
"nixpkgs"
],
"gomod2nix": [
"helix",
"nci",
"nixpkgs"
],
"mach-nix": [
"helix",
"nci",
"nixpkgs"
],
"nixpkgs": [
"helix",
"nci",
"nixpkgs"
],
"poetry2nix": [
"helix",
"nci",
"nixpkgs"
],
"pre-commit-hooks": [
"helix",
"nci",
"nixpkgs"
]
},
"locked": {
"lastModified": 1662176993,
"narHash": "sha256-Sy7DsGAveDUFBb6YDsUSYZd/AcXfP/MOMIwMt/NgY84=",
"owner": "nix-community",
"repo": "dream2nix",
"rev": "809bc5940214744eb29778a9a0b03f161979c1b2",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "dream2nix",
"type": "github"
"type": "git",
"url": "https://git.dodsorf.as/Dandellion/NUR.git"
}
},
"flake-utils": {
"locked": {
"lastModified": 1656928814,
"narHash": "sha256-RIFfgBuKz6Hp89yRr7+NR5tzIAbn52h8vT6vXkYjZoM=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "7e2a3b3dfd9af950a856d66b0a7d01e3c18aa249",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils_2": {
"locked": {
"lastModified": 1659877975,
"narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=",
@@ -142,89 +35,40 @@
"type": "github"
}
},
"helix": {
"inputs": {
"nci": "nci",
"nixpkgs": [
"unstable"
],
"rust-overlay": "rust-overlay"
},
"locked": {
"lastModified": 1662645858,
"narHash": "sha256-KvZpyPfugKwis6lKQpuZYFkqa3HGjfqaRIfRO+qxH/E=",
"owner": "helix-editor",
"repo": "helix",
"rev": "5ab85283e944b9b0409c70953c7655b9c5f84067",
"type": "github"
},
"original": {
"owner": "helix-editor",
"repo": "helix",
"type": "github"
}
},
"home-manager-2205": {
"home-manager": {
"inputs": {
"nixpkgs": [
"nixos-2205"
]
},
"locked": {
"lastModified": 1656169755,
"narHash": "sha256-Nlnm4jeQWEGjYrE6hxi/7HYHjBSZ/E0RtjCYifnNsWk=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "4a3d01fb53f52ac83194081272795aa4612c2381",
"type": "github"
},
"original": {
"owner": "nix-community",
"ref": "release-22.05",
"repo": "home-manager",
"type": "github"
}
},
"nci": {
"inputs": {
"devshell": "devshell",
"dream2nix": "dream2nix",
"nixpkgs": [
"helix",
"nixpkgs"
],
"rust-overlay": [
"helix",
"rust-overlay"
]
},
"locked": {
"lastModified": 1662177071,
"narHash": "sha256-x6XF//RdZlw81tFAYM1TkjY+iQIpyMCWZ46r9o4wVQY=",
"owner": "yusdacra",
"repo": "nix-cargo-integration",
"rev": "65270dea87bb82fc02102a15221677eea237680e",
"lastModified": 1695108154,
"narHash": "sha256-gSg7UTVtls2yO9lKtP0yb66XBHT1Fx5qZSZbGMpSn2c=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "07682fff75d41f18327a871088d20af2710d4744",
"type": "github"
},
"original": {
"owner": "yusdacra",
"repo": "nix-cargo-integration",
"owner": "nix-community",
"ref": "release-23.05",
"repo": "home-manager",
"type": "github"
}
},
"nixgl": {
"inputs": {
"flake-utils": "flake-utils_2",
"flake-utils": "flake-utils",
"nixpkgs": [
"nixos-2205"
"nixpkgs"
]
},
"locked": {
"lastModified": 1661367362,
"narHash": "sha256-Qc8MXcV+YCPREu8kk6oggk23ZBKLqeQRAIsLbHEviPE=",
"lastModified": 1685908677,
"narHash": "sha256-E4zUPEUFyVWjVm45zICaHRpfGepfkE9Z2OECV9HXfA4=",
"owner": "guibou",
"repo": "nixGL",
"rev": "7165ffbccbd2cf4379b6cd6d2edd1620a427e5ae",
"rev": "489d6b095ab9d289fe11af0219a9ff00fe87c7c5",
"type": "github"
},
"original": {
@@ -233,29 +77,29 @@
"type": "github"
}
},
"nixos-2205": {
"nixpkgs": {
"locked": {
"lastModified": 1662099760,
"narHash": "sha256-MdZLCTJPeHi/9fg6R9fiunyDwP3XHJqDd51zWWz9px0=",
"lastModified": 1698942558,
"narHash": "sha256-/UmnB+mEd6Eg3mJBrAgqRcyZX//RSjHphcCO7Ig9Bpk=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "67e45078141102f45eff1589a831aeaa3182b41e",
"rev": "621f51253edffa1d6f08d5fce4f08614c852d17e",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-22.05",
"ref": "nixos-23.05",
"repo": "nixpkgs",
"type": "github"
}
},
"nur": {
"locked": {
"lastModified": 1662661687,
"narHash": "sha256-ze1bQpIad0S7ofPBteBfl+E4e7FQ87PQFyrZT5QI2VY=",
"lastModified": 1699131694,
"narHash": "sha256-dKWORPD0ODREKihqCZqEqc1zJ3wACmoMmuf2BGg3DbE=",
"owner": "nix-community",
"repo": "NUR",
"rev": "cbd713ef9bb050c5859466d97dc692c29e4e5195",
"rev": "6226a48fb329802a63da2babbdd2d375713af333",
"type": "github"
},
"original": {
@@ -267,43 +111,20 @@
"root": {
"inputs": {
"dan": "dan",
"helix": "helix",
"home-manager-2205": "home-manager-2205",
"home-manager": "home-manager",
"nixgl": "nixgl",
"nixos-2205": "nixos-2205",
"nixpkgs": "nixpkgs",
"nur": "nur",
"unstable": "unstable"
}
},
"rust-overlay": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": [
"helix",
"nixpkgs"
]
},
"locked": {
"lastModified": 1662087605,
"narHash": "sha256-Gpf2gp2JenKGf+TylX/YJpttY2bzsnvAMLdLaxoZRyU=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "60c2cfaa8b90ed8cebd18b214fac8682dcf222dd",
"type": "github"
},
"original": {
"owner": "oxalica",
"repo": "rust-overlay",
"type": "github"
}
},
"unstable": {
"locked": {
"lastModified": 1662096612,
"narHash": "sha256-R+Q8l5JuyJryRPdiIaYpO5O3A55rT+/pItBrKcy7LM4=",
"lastModified": 1699094435,
"narHash": "sha256-YLZ5/KKZ1PyLrm2MO8UxRe4H3M0/oaYqNhSlq6FDeeA=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "21de2b973f9fee595a7a1ac4693efff791245c34",
"rev": "9d5d25bbfe8c0297ebe85324addcb5020ed1a454",
"type": "github"
},
"original": {

View File

@@ -1,36 +1,35 @@
{
description = "dandellion's home-manager profiles";
nixConfig.extra-substituters = ["https://cache.dodsorf.as"];
nixConfig.exta-trusted-public-keys = "cache.dodsorf.as:FYKGadXTyI2ax8mirBTOjEqS/8PZKAWxiJVOBjESQXc=";
# nixConfig.extra-substituters = ["https://cache.dodsorf.as"];
# nixConfig.exta-trusted-public-keys = "cache.dodsorf.as:FYKGadXTyI2ax8mirBTOjEqS/8PZKAWxiJVOBjESQXc=";
inputs = {
home-manager-2205.url = "github:nix-community/home-manager/release-22.05";
nixos-2205.url = "github:nixos/nixpkgs/nixos-22.05";
home-manager-2205.inputs.nixpkgs.follows = "nixos-2205";
nixpkgs.url = "github:nixos/nixpkgs/nixos-23.05";
home-manager.url = "github:nix-community/home-manager/release-23.05";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
unstable.url = "github:nixos/nixpkgs/nixpkgs-unstable";
nur.url = "github:nix-community/NUR";
nur.inputs.nixpkgs.follows = "unstable";
dan.url = "gitlab:Dandellion/NUR?host=git.dodsorf.as"; #"git+https://git.dodsorf.as/Dandellion/NUR";
dan.url = "git+https://git.dodsorf.as/Dandellion/NUR.git"; #"git+https://git.dodsorf.as/Dandellion/NUR";
dan.inputs.nixpkgs.follows = "unstable";
helix.url = "github:helix-editor/helix";
helix.inputs.nixpkgs.follows = "unstable";
# helix.url = "github:helix-editor/helix";
# helix.inputs.nixpkgs.follows = "unstable";
nixgl.url = "github:guibou/nixGL";
nixgl.inputs.nixpkgs.follows = "nixos-2205";
nixgl.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = {self, home-manager-2205, unstable, nur, dan, nixgl, ... }@inputs:
outputs = {self, nixpkgs, home-manager, unstable, nur, dan, nixgl, ... }@inputs:
let
nixlib = unstable.lib;
mkHome =
{ machine
, hmChannel ? home-manager-2205
, configuration ? self.nixosModules.home-manager.${machine}
, system ? "x86_64-linux"
, username ? "daniel"
@@ -38,8 +37,17 @@
, stateVersion ? "22.05"
, extraSpecialArgs ? { inherit (self) overlays; }
}:
hmChannel.lib.homeManagerConfiguration {
inherit configuration system username homeDirectory stateVersion extraSpecialArgs;
home-manager.lib.homeManagerConfiguration {
pkgs = nixpkgs.legacyPackages.${system};
modules = [
configuration
{
home = {
inherit username homeDirectory stateVersion;
};
}
];
inherit extraSpecialArgs;
};
mkHomes = machines: extraArgs: nixlib.genAttrs machines (machine: mkHome ({inherit machine; } // extraArgs));
@@ -62,7 +70,7 @@
inherit (prev) system config;
};
dan = dan.packages.${prev.system};
helix = inputs.helix.packages.${prev.system}.helix;
# helix = inputs.helix.packages.${prev.system}.helix;
})
nur.overlay
nixgl.overlay

View File

@@ -12,7 +12,5 @@
};
profiles.base.enable = true;
profiles.base.enable = false;
profiles.zsh.enable = true;
}

View File

@@ -10,6 +10,7 @@
name = "DanixLaptop";
eth = "enp0s31f6";
wlan = "wlp5s0";
cores = 4;
};
profiles.base.enable = true;
profiles.base.plus = true;

View File

@@ -1,19 +0,0 @@
self: super:
{
mylibaom = super.libaom.overrideAttrs (old: rec {
version = "1.0.0-a5e3f02b186";
src = super.fetchgit {
url = "https://aomedia.googlesource.com/aom";
rev = "a5e3f02b18668957bbd054a1058cb190f298ca6f";
sha256 = "1i7lk91rdwviqnmxc6k2ihjqx5glf6siirnlhyi50vbqwgpjiyv4";
};
cmakeFlags = [
"-DCMAKE_INSTALL_LIBDIR=lib"
"-DCMAKE_INSTALL_BINDIR=bin"
"-DCMAKE_INSTALL_INCLUDEDIR=include"
];
});
}

View File

@@ -2,27 +2,20 @@
let
cfg = config.profiles.base;
helixDesktop = pkgs.makeDesktopItem {
name = "Helix";
type = "Application";
desktopName = "Helix";
genericName = "Text Editor";
comment = "Edit text files";
tryExec = "hx";
exec = "kitty hx %F";
terminal = false; # Until you can globally set a prefered terminal we hardcoding this
mimeTypes = [ "ext/english" "text/plain" "text/x-makefile" "text/x-c++hdr" "text/x-c++src" "text/x-chdr" "text/x-csrc" "text/x-java" "text/x-moc" "text/x-pascal" "text/x-tcl" "text/x-tex" "application/x-shellscript" "text/x-c" "text/x-c++" ];
categories = [ "Utility" "TextEditor" ];
keywords = [ "Text" "editor" ];
startupNotify = false;
};
in
{
options.machine = {
name = lib.mkOption {
type = lib.types.str;
};
cores = lib.mkOption {
type = lib.types.ints.positive;
default = 1;
};
systemd = lib.mkOption {
type = lib.types.bool;
default = true;
};
eth = lib.mkOption { };
wlan = lib.mkOption { };
secondary-fs = lib.mkOption {
@@ -45,25 +38,32 @@ in
home.packages = with pkgs; [
nix-output-monitor
unstable.nix-output-monitor
nix-top
nix-index
nix-tree
unstable.comma
rnix-lsp
helixDesktop
openvpn
ldns
mtr
nmap
inetutils
httpie
lsof
htop
progress
file
tmux
timewarrior
unzip
p7zip
@@ -109,7 +109,7 @@ in
blender
mkvtoolnix
] ++ lib.optionals (config.nixpkgs.config.allowUnfree && config.profiles.gui.enable) [
] ++ lib.optionals (config.profiles.gui.enable && (config ? nixpkgs && config.nixpkgs.config.allowUnfree) ) [
geogebra
];
@@ -134,14 +134,17 @@ in
url = "https://rycee.gitlab.io/home-manager/options.html#opt-%s";
};
};
extensions = with pkgs.nur.repos.rycee.firefox-addons; [ bitwarden cookies-txt metamask no-pdf-download sponsorblock ublock-origin ];
};
};
extensions = with pkgs.nur.repos.rycee.firefox-addons; [ bitwarden cookies-txt https-everywhere metamask no-pdf-download sponsorblock ublock-origin ];
};
programs.obs-studio.enable = (config.profiles.gui.enable && cfg.plus);
programs.tealdeer.enable = true;
programs.helix = {
enable = true;
package = pkgs.helix;
@@ -181,7 +184,7 @@ in
keys.insert = {
"S-tab" = "unindent";
# Poor man's US-Keyboard
"Å" = [(c "{}") "move_char_left"];
"Å" = [(c "{}") "move_char_right"];
"º" = c "Å";
"^" = c "}";
"¤" = c "^";
@@ -217,24 +220,28 @@ in
n = "!git commit --all --amend --no-edit && git rc";
};
ignores = [
".envrc"
".direnv"
".devenv"
".vscode"
];
extraConfig = {
pull.rebase = true;
sequence.editor = let
girt = pkgs.unstable.git-interactive-rebase-tool.overrideAttrs (old: rec {
src = pkgs.fetchFromGitHub {
owner = "Dali99";
repo = "git-interactive-rebase-tool";
rev = "590f87d8ed16992373e214bca5994f89c69fa942";
sha256 = "sha256-vUjqnt5ZSpzoohkzDXEqTMhMEkYzPMUZiaYWS0ZQcPQ=";
};
cargoDeps = old.cargoDeps.overrideAttrs (oldB: {
name = "${oldB.name}";
inherit src;
outputHash = "197dv8hbj4vd9grvhiinpsww3vfmmbl9b8gxk7la4gs8535s08x7";
});
});
# girt = pkgs.unstable.git-interactive-rebase-tool.overrideAttrs (old: rec {
# src = pkgs.fetchFromGitHub {
# owner = "Dali99";
# repo = "git-interactive-rebase-tool";
# rev = "590f87d8ed16992373e214bca5994f89c69fa942";
# sha256 = "sha256-vUjqnt5ZSpzoohkzDXEqTMhMEkYzPMUZiaYWS0ZQcPQ=";
# };
# cargoDeps = old.cargoDeps.overrideAttrs (oldB: {
# name = "${oldB.name}";
# inherit src;
# outputHash = "sha256-/I465/PlOckvov9PgSCg7CN5hEKeeQCw8rPsvpKJons=";
# });
# });
girt = pkgs.git-interactive-rebase-tool;
in "${girt}/bin/interactive-rebase-tool";
};
delta.enable = true;
@@ -245,16 +252,15 @@ in
enable = true;
matchBlocks = {
"lilith" = {
hostname = "lilith.d.d.dodsorf.as";
hostname = "lilith.daniel";
user = "dandellion";
};
"desktop" = {
hostname = "10.42.42.10";
proxyJump = "lilith";
hostname = "desktop.daniel";
user = "dan";
};
"laptop" = {
hostname = "10.42.42.13";
hostname = "laptop.daniel";
user = "daniel";
};
"pvv.ntnu.no" = {
@@ -263,13 +269,22 @@ in
"*.pvv.ntnu.no" = {
user = "danio";
};
"pascal" = {
hostname = "wiki.wackattack.eu";
port = 1337;
user = "dandellion";
};
"ireul" = {
hostname = "62.92.111.85";
port = 1337;
user = "dandellion";
};
"gitlab.stud.idi.ntnu.no" = {
proxyJump = "login.pvv.ntnu.no";
};
"workshop" = {
user = "student";
hostname = "129.241.99.15";
proxyJump = "hildring.pvv.ntnu.no";
"consolidation" = {
hostname = "62.92.111.62";
user = "root";
};
};
};

View File

@@ -18,7 +18,7 @@ in {
] ++ lib.optionals config.profiles.gui.enable [
steam
unstable.polymc
unstable.prismlauncher
# minetest
# dwarf-fortress-packages.dwarf-fortress-full
# superTuxKart

View File

@@ -4,6 +4,7 @@ let
cfg = config.profiles.xsession;
non-nixos = config.profiles.non-nixos;
mkGL = program: "${lib.strings.optionalString non-nixos.enable "${pkgs.nixgl.auto.nixGLDefault}/bin/nixGL "}${program}";
execScope = program: "exec bash -c \"systemd-run --user --scope --unit='app-i3-exec-$RANDOM' -p CollectMode=inactive-or-failed -p MemoryHigh=85% -p MemoryMax=92% -p MemorySwapMax=5G -p MemoryAccounting=true \"${program}\"\"";
in
{
imports = [ ./dunstrc.nix ./terminal.nix ./polybar.nix ];
@@ -16,6 +17,14 @@ in
config = lib.mkIf cfg.enable {
profiles.gui.enable = true;
systemd.user.slices.app.Slice = {
MemoryHigh="90%";
MemoryMax="94%";
MemorySwapMax="8G";
CPUQuota="${toString ((config.machine.cores - 1)*100)}%";
MemoryAccounting = true;
};
home.keyboard = {
layout = "no";
variant = "nodeadkeys";
@@ -49,6 +58,7 @@ in
terminal = "${pkgs.kitty}/bin/kitty";
keybindings = let
modifier = config.xsession.windowManager.i3.config.modifier;
dmenu = if config.machine.systemd then "${../../scripts/dmenu_run_systemd}" else "dmenu_run";
in lib.mkOptionDefault {
"${modifier}+0" = "workspace 10";
"${modifier}+Shift+0" = "move container to workspace 10";
@@ -64,20 +74,45 @@ in
"XF86MonBrightnessUp" = "exec --no-startup-id brightnessctl set +5%";
"XF86MonBrightnessDown" = "exec --no-startup-id brightnessctl set 5%-";
"XF86Display" = "exec arandr";
"Print" = "exec scrot %Y-%m-%d_$wx$h_scrot.png -z -e 'mv $f /home/daniel/Pictures/screenshots/'";
"${modifier}+Print" = "exec scrot /home/daniel/Pictures/Screenshots/%Y-%m-%d_$wx$h_scrot.png -z";
"${modifier}+l" = "exec ${pkgs.writers.writeBash "hello_world" ''
dunstctl set-paused true
${pkgs.i3lock}/bin/i3lock -n -i ~/images/wallpapers/locked.png
dunstctl set-paused false
''}";
"XF86Display" = "exec arandr";
"${modifier}+Shift+U" = "exec $HOME/.config/nixpkgs/nix-dotfiles/scripts/dmenuunicode";
"${modifier}+n" = "exec dolphin";
"${modifier}+b" = "exec firefox";
"${modifier}+t" = "exec gedit";
"${modifier}+Shift+s" = "exec $HOME/.config/nixpkgs/nix-dotfiles/scripts/dmenuaudio";
"${modifier}+Shift+v" = "exec ${pkgs.writers.writeBash "switch_audio" ''
if pw-link -l | grep "^VirtualMic:input_FL" -A 2 | grep FilteredMic; then
${pkgs.pipewire}/bin/pw-link -d "FilteredMic:capture_MONO" "VirtualMic:input_FL"
${pkgs.pipewire}/bin/pw-link -d "FilteredMic:capture_MONO" "VirtualMic:input_FR"
${pkgs.pipewire}/bin/pw-link "VoiceChanger:monitor_FL" "VirtualMic:input_FL"
${pkgs.pipewire}/bin/pw-link "VoiceChanger:monitor_FR" "VirtualMic:input_FR"
${pkgs.pipewire}/bin/pw-link "VoiceChanger:monitor_FL" "VirtualHeadset:playback_FL"
${pkgs.pipewire}/bin/pw-link "VoiceChanger:monitor_FR" "VirtualHeadset:playback_FR"
else
${pkgs.pipewire}/bin/pw-link "FilteredMic:capture_MONO" "VirtualMic:input_FL"
${pkgs.pipewire}/bin/pw-link "FilteredMic:capture_MONO" "VirtualMic:input_FR"
${pkgs.pipewire}/bin/pw-link -d "VoiceChanger:monitor_FL" "VirtualMic:input_FL"
${pkgs.pipewire}/bin/pw-link -d "VoiceChanger:monitor_FR" "VirtualMic:input_FR"
${pkgs.pipewire}/bin/pw-link -d "VoiceChanger:monitor_FL" "VirtualHeadset:playback_FL"
${pkgs.pipewire}/bin/pw-link -d "VoiceChanger:monitor_FR" "VirtualHeadset:playback_FR"
fi
''}";
# "${modifier}+Return" = lib.mkForce "exec kitty";
"${modifier}+Shift+Return" = "exec kitty -e ssh dandellion@lilith";
"${modifier}+d" = "exec ${dmenu}";
"${modifier}+n" = execScope "dolphin";
"${modifier}+b" = execScope "firefox";
"${modifier}+t" = execScope "gedit";
"${modifier}+Return" = execScope "kitty";
"${modifier}+Shift+Return" = execScope "kitty -e ssh dandellion@lilith";
};
startup = [
{
@@ -90,14 +125,19 @@ in
titlebar = false;
hideEdgeBorders = "smart";
};
floating.criteria = [
{ title = "Steam - Update News"; }
];
};
i3.extraConfig = ''
for_window [title="Steam Big Picture Mode"] floating enable, resize set 1920 1080, move position 0 0, border pixel 0
'';
};
};
services.picom = {
enable = true;
backend = "xrender";
experimentalBackends = true;
};

View File

@@ -68,8 +68,17 @@ in
programs.direnv = {
enable = true;
};
programs.atuin = {
enable = true;
enableZshIntegration = true;
settings = {
filter_mode = "directory";
filter_mode_shell_up_key_binding = "session";
};
};
home.packages = [
home.packages = lib.optionals (config.profiles.gui.enable && config ? nixpkgs) [
pkgs.dan.mesloNFp10k
];
};

140
scripts/dmenu_run_systemd Executable file
View File

@@ -0,0 +1,140 @@
#!/usr/bin/env bash
# SPDX-License-Identifier: MIT
#
# dmenu_run_systemd: start a program from dmenu as transient systemd .scope
# (C) Copyright Benjamin Block 2021
# (C) Copyright Daniel Olsen 2023
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice (including the next
# paragraph) shall be included in all copies or substantial portions of the
# Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
#
# Requirements:
# - Package: bash
# - Package: dmenu
# - dmenu_path
# - dmenu
# - Package: coreutils
# - basenc
# - tr
# - Package: systemd
# - systemd-run
# - Package: util-linux
# - getopt
#
# Usage: dmenu_run_systemd
#
# Start demnu to select program to execute, then start selected program in
# background.
#
# Usage: dmenu_run_systemd [Options] [--] <command> [<arg1>[, <arg2>[...]]]
#
# Start <command> with <arg1..N> without involving dmenu.
# E.g. in i3 config: `bindsym $mod+Return exec dmenu_run_systemd alacritty`.
#
# Options:
# -f, --forground Start <command> as forground task (default: no)
# -p, --pwd Use the current ${PWD} as working directory (default:
# ${HOME})
declare -g prefix forground=false cpwd=false
declare -ga selection
if [ "${#}" -lt 1 ]; then
prefix="dmenu-"
selection=("$(dmenu_path | dmenu)") || exit 127
else
prefix="xrun-"
declare opts
opts="$(getopt --shell bash \
-o "fp" \
-l "forground,pwd" \
-n "dmenu_run_systemd" -- "${@}")" || exit 122
eval set -- "${opts}"
unset opts
while true; do
case "${1}" in
'-f'|'--forground')
forground=true
;;
'-p'|'--pwd')
cpwd=true
;;
'--') shift; break;;
esac
shift
done
selection=("${@}")
fi
readonly selection prefix
declare -g name
# Max unit name length: 256
# - ".scope" - 6
# - "<prefix>-" - 6
# - "-<rand>" - 33
# ------
# "<name>" <= 211
read -r -d '' -n 192 name < <(
echo -n "${selection[*]}" | tr -c 'a-zA-Z0-9_-' '[_*]' || exit 1
echo -e '\0' || exit 2
) || exit 126
readonly name
{ [ "${#name}" -gt 0 ] && [ "${#name}" -le 211 ]; } || exit 125
declare -g rand
# ~5 bits per character => 32*5 = ~160 bits random number
read -r -N 32 rand < <(basenc --base32 < /dev/urandom) || exit 124
readonly rand
[ "${#rand}" -eq 32 ] || exit 123
declare -ga runargs=(
--quiet
--user # run in per-User slice
--scope # create transient `.scope` unit,
# instead of `.service`
--collect # garbage collect everything after run,
# even on failure
--slice="app.slice" # run as part of `app.slice`
--unit="${prefix}${name}-${rand}"
-p MemoryHigh=85%
-p MemoryMax=92%
-p MemorySwapMax=5G
# unit name
--description="dmenu selection ${selection[*]@Q}"
)
if ${cpwd}; then
runargs+=( --working-directory="${PWD:-/}" )
else
runargs+=( --working-directory="${HOME:-/}" )
fi
readonly runargs
## Debugging:
#declare -p prefix selection name rand runargs
if ${forground}; then
systemd-run "${runargs[@]}" -- "${selection[@]}"
else
systemd-run "${runargs[@]}" -- "${selection[@]}" &
fi