modules/lan-mouse: move to the home-manager

This commit is contained in:
Dmitriy Pleshevskiy 2024-04-16 11:28:28 +03:00
parent 9092a13846
commit df41cd9697
Signed by: pleshevskiy
GPG key ID: 17041163DA10A9A2
9 changed files with 157 additions and 20 deletions

View file

@ -161,6 +161,24 @@
"type": "github" "type": "github"
} }
}, },
"flake-utils_3": {
"inputs": {
"systems": "systems_2"
},
"locked": {
"lastModified": 1705309234,
"narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flakeCompat": { "flakeCompat": {
"flake": false, "flake": false,
"locked": { "locked": {
@ -267,6 +285,27 @@
"type": "github" "type": "github"
} }
}, },
"lan-mouse": {
"inputs": {
"nixpkgs": [
"nixpkgs-unstable"
],
"rust-overlay": "rust-overlay"
},
"locked": {
"lastModified": 1713168888,
"narHash": "sha256-pNd6KbkLlZtXKQvHWYwQB/Wbqa7lQYVffpSq5uWJqzQ=",
"owner": "feschber",
"repo": "lan-mouse",
"rev": "36855a1a1767f4a777bad580d5a76fec1be5d9d1",
"type": "github"
},
"original": {
"owner": "feschber",
"repo": "lan-mouse",
"type": "github"
}
},
"lspsaga-nvim": { "lspsaga-nvim": {
"flake": false, "flake": false,
"locked": { "locked": {
@ -404,7 +443,7 @@
"nixpkgs": [ "nixpkgs": [
"nixpkgs" "nixpkgs"
], ],
"rust-overlay": "rust-overlay" "rust-overlay": "rust-overlay_2"
}, },
"locked": { "locked": {
"lastModified": 1694177726, "lastModified": 1694177726,
@ -635,6 +674,7 @@
"flake-utils": "flake-utils_2", "flake-utils": "flake-utils_2",
"hardware": "hardware", "hardware": "hardware",
"home-manager": "home-manager_2", "home-manager": "home-manager_2",
"lan-mouse": "lan-mouse",
"myneovim": "myneovim", "myneovim": "myneovim",
"nil": "nil", "nil": "nil",
"nixpkgs": "nixpkgs_2", "nixpkgs": "nixpkgs_2",
@ -644,6 +684,28 @@
} }
}, },
"rust-overlay": { "rust-overlay": {
"inputs": {
"flake-utils": "flake-utils_3",
"nixpkgs": [
"lan-mouse",
"nixpkgs"
]
},
"locked": {
"lastModified": 1710987136,
"narHash": "sha256-Q8GRdlAIKZ8tJUXrbcRO1pA33AdoPfTUirsSnmGQnOU=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "97596b54ac34ad8184ca1eef44b1ec2e5c2b5f9e",
"type": "github"
},
"original": {
"owner": "oxalica",
"repo": "rust-overlay",
"type": "github"
}
},
"rust-overlay_2": {
"inputs": { "inputs": {
"flake-utils": [ "flake-utils": [
"nil", "nil",
@ -683,6 +745,21 @@
"type": "github" "type": "github"
} }
}, },
"systems_2": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"tabby-nvim": { "tabby-nvim": {
"flake": false, "flake": false,
"locked": { "locked": {

View file

@ -23,6 +23,11 @@
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
lan-mouse = {
url = "github:feschber/lan-mouse";
inputs.nixpkgs.follows = "nixpkgs-unstable";
};
# nix lsp # nix lsp
nil = { nil = {
url = "github:oxalica/nil"; url = "github:oxalica/nil";
@ -46,9 +51,7 @@
}; };
outputs = inputs @ { self, flake-utils, nixpkgs, ... }: outputs = inputs @ { self, flake-utils, nixpkgs, ... }:
let let inherit (flake-utils.lib) eachSystem system; in
inherit (flake-utils.lib) eachSystem system;
in
eachSystem [ system.x86_64-linux ] eachSystem [ system.x86_64-linux ]
(system: (system:
let let
@ -143,6 +146,7 @@
imports = [ imports = [
./modules/home-manager ./modules/home-manager
inputs.wired.homeManagerModules.default inputs.wired.homeManagerModules.default
inputs.lan-mouse.homeManagerModules.default
]; ];
} }
]; ];

View file

@ -153,7 +153,7 @@ in
ltex.enable = mkEnableOption "ltex language server"; ltex.enable = mkEnableOption "ltex language server";
orgmode.enable = mkEnableOption "orgmode"; orgmode.enable = mkEnableOption "orgmode";
nix.enable = mkEnableOptions "nix"; nix.enable = mkEnableOption "nix";
rust.enable = mkEnableOption "rust"; rust.enable = mkEnableOption "rust";
typescript.enable = mkEnableOption "typescript"; typescript.enable = mkEnableOption "typescript";
vue.enable = mkEnableOption "vue"; vue.enable = mkEnableOption "vue";

View file

@ -1,5 +1,8 @@
{ ... }: { ... }:
{ {
imports = [ ./wired ]; imports = [
./lan-mouse
./wired
];
} }

View file

@ -0,0 +1,29 @@
{ config, pkgs, lib, ... }:
let
cfg = config.local.services.lan-mouse;
# See: https://github.com/feschber/lan-mouse/blob/main/src/config.rs#L79
lanMouseConfig = pkgs.writeText "config.toml" ''
port = ${toString cfg.port}
'';
in
{
options.local.services.lan-mouse = with lib; {
enable = mkEnableOption "lan-mouse";
port = mkOption {
type = types.int;
default = 4242;
};
};
config = lib.mkIf cfg.enable {
programs.lan-mouse = {
enable = true;
systemd = true;
package = pkgs.unstable.lan-mouse;
};
xdg.configFile."lan-mouse/config.toml".source = lanMouseConfig;
};
}

View file

@ -1,11 +1,16 @@
{ config, pkgs, ... }: { config, pkgs, lib, ... }:
let let
cfg = config.local.services.wired;
themeCfg = config.local.themes."${config.local.theme.name}"; themeCfg = config.local.themes."${config.local.theme.name}";
in in
{ {
options.local.services.wired.enable = lib.mkEnableOption "wired";
config = lib.mkIf cfg.enable {
services.wired = { services.wired = {
enable = true; enable = true;
config = pkgs.substituteAll ({ src = ./wired.ron; } // themeCfg.notification); config = pkgs.substituteAll ({ src = ./wired.ron; } // themeCfg.notification);
}; };
};
} }

View file

@ -10,10 +10,7 @@
local.system.kernel = lib.mkDefault "stable"; local.system.kernel = lib.mkDefault "stable";
local.keyboard = { local.keyboard.enable = lib.mkDefault true;
enable = lib.mkDefault true;
lan-mouse.enable = lib.mkDefault true;
};
local.fonts.enable = lib.mkDefault true; local.fonts.enable = lib.mkDefault true;
local.sound.enable = lib.mkDefault true; local.sound.enable = lib.mkDefault true;

View file

@ -6,13 +6,9 @@ in
{ {
options.local.keyboard = with lib; { options.local.keyboard = with lib; {
enable = mkEnableOption "base keyboard configuration"; enable = mkEnableOption "base keyboard configuration";
lan-mouse.enable = mkEnableOption "a software KVM switch for sharing a mouse and keyboard with multiple hosts through the network";
}; };
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
environment.systemPackages =
lib.optional cfg.lan-mouse.enable pkgs.unstable.lan-mouse;
services.xserver = { services.xserver = {
xkbModel = "pc105"; xkbModel = "pc105";
layout = "us,us"; layout = "us,us";

View file

@ -33,6 +33,10 @@
users.groups.plugdev = lib.mkIf config.programs.adb.enable { }; users.groups.plugdev = lib.mkIf config.programs.adb.enable { };
networking.firewall.allowedUDPPorts =
let lanMouseCfg = config.home-manager.users.jan.local.services.lan-mouse;
in lib.optional lanMouseCfg.enable lanMouseCfg.port;
home-manager.users.jan = { home-manager.users.jan = {
imports = [ imports = [
./accounts.secret.nix ./accounts.secret.nix
@ -63,7 +67,18 @@
local.programs.terminals.wezterm.enable = lib.mkDefault true; local.programs.terminals.wezterm.enable = lib.mkDefault true;
local.programs.editors.neovim.enable = lib.mkDefault true; local.programs.editors.neovim = {
enable = lib.mkDefault true;
defaultEditor = lib.mkDefault true;
ltex.enable = lib.mkDefault true;
nix.enable = lib.mkDefault true;
rust.enable = lib.mkDefault true;
typescript.enable = lib.mkDefault true;
vue.enable = lib.mkDefault true;
deno.enable = lib.mkDefault true;
python.enable = lib.mkDefault true;
};
local.programs.file-managers.vifm.enable = lib.mkDefault true; local.programs.file-managers.vifm.enable = lib.mkDefault true;
@ -88,7 +103,18 @@
zoxide.enable = lib.mkDefault true; zoxide.enable = lib.mkDefault true;
}; };
local.programs.share-files.croc.enable = true; local.programs.share-files.croc.enable = lib.mkDefault true;
################################################################################
# Services
################################################################################
local.services.wired.enable = lib.mkDefault true;
local.services.lan-mouse = {
enable = lib.mkDefault true;
port = lib.mkDefault 32000;
};
################################################################################ ################################################################################
# Packages # Packages