Merge remote-tracking branch 'origin/nixos' into nixos

This commit is contained in:
Moritz Böhme 2023-02-27 23:49:00 +01:00
commit 14b39fcd44
Signed by: moritz
GPG key ID: 970C6E89EB0547A9
18 changed files with 142 additions and 60 deletions

View file

@ -82,6 +82,22 @@
"type": "github" "type": "github"
} }
}, },
"copilot-lua": {
"flake": false,
"locked": {
"lastModified": 1677479736,
"narHash": "sha256-n/SCrzzzL5WUHJk0sCXbgGusk/dQuy8DI9Pqdh+lVeQ=",
"owner": "zbirenbaum",
"repo": "copilot.lua",
"rev": "b41d4c9c7d4f5e0272bcf94061b88e244904c56f",
"type": "github"
},
"original": {
"owner": "zbirenbaum",
"repo": "copilot.lua",
"type": "github"
}
},
"crane": { "crane": {
"inputs": { "inputs": {
"flake-compat": [ "flake-compat": [
@ -813,6 +829,7 @@
"arkenfox-userjs": "arkenfox-userjs", "arkenfox-userjs": "arkenfox-userjs",
"asus-touchpad-numpad-driver": "asus-touchpad-numpad-driver", "asus-touchpad-numpad-driver": "asus-touchpad-numpad-driver",
"attic": "attic", "attic": "attic",
"copilot-lua": "copilot-lua",
"emacs": "emacs", "emacs": "emacs",
"flake-utils": "flake-utils_3", "flake-utils": "flake-utils_3",
"forgit-git": "forgit-git", "forgit-git": "forgit-git",

View file

@ -83,6 +83,11 @@
inputs.nixpkgs-stable.follows = "stable"; inputs.nixpkgs-stable.follows = "stable";
inputs.flake-utils.follows = "flake-utils"; inputs.flake-utils.follows = "flake-utils";
}; };
copilot-lua = {
url = "github:zbirenbaum/copilot.lua";
flake = false;
};
}; };
outputs = outputs =

View file

@ -5,7 +5,7 @@ let
cfg = config.my.theming; cfg = config.my.theming;
in in
{ {
config = mkIf (cfg.scheme == "catppuccin-frappe") config = mkIf (cfg.enable && cfg.scheme == "catppuccin-frappe")
(import ./catppuccin.nix (import ./catppuccin.nix
{ {
inherit config lib pkgs; inherit config lib pkgs;

View file

@ -5,7 +5,7 @@ let
cfg = config.my.theming; cfg = config.my.theming;
in in
{ {
config = mkIf (cfg.scheme == "catppuccin-latte") config = mkIf (cfg.enable && cfg.scheme == "catppuccin-latte")
(import ./catppuccin.nix (import ./catppuccin.nix
{ {
inherit config lib pkgs; inherit config lib pkgs;

View file

@ -5,7 +5,7 @@ let
cfg = config.my.theming; cfg = config.my.theming;
in in
{ {
config = mkIf (cfg.scheme == "catppuccin-macchiato") config = mkIf (cfg.enable && cfg.scheme == "catppuccin-macchiato")
(import ./catppuccin.nix (import ./catppuccin.nix
{ {
inherit config lib pkgs; inherit config lib pkgs;

View file

@ -5,7 +5,7 @@ let
cfg = config.my.theming; cfg = config.my.theming;
in in
{ {
config = mkIf (cfg.scheme == "catppuccin-mocha") config = mkIf (cfg.enable && cfg.scheme == "catppuccin-mocha")
(import ./catppuccin.nix (import ./catppuccin.nix
{ {
inherit config lib pkgs; inherit config lib pkgs;

View file

@ -17,7 +17,7 @@ let
yellow = "#f1fa8c"; yellow = "#f1fa8c";
in in
{ {
config = mkIf (cfg.scheme == "dracula") { config = mkIf (cfg.enable && cfg.scheme == "dracula") {
home-manager.users.moritz = { home-manager.users.moritz = {
programs = { programs = {
kitty.extraConfig = kitty.extraConfig =

View file

@ -75,11 +75,9 @@ with lib; {
git.signing = true; git.signing = true;
gpg.enable = true; gpg.enable = true;
hub.enable = true; hub.enable = true;
kitty.enable = true;
ledger.enable = true; ledger.enable = true;
logseq.enable = true; logseq.enable = true;
python.enable = true; python.versions."311".enable = true;
rofi.enable = true;
ssh = { ssh = {
enable = true; enable = true;
includeSecrets = [ ../../secrets/ssh-home.age ]; includeSecrets = [ ../../secrets/ssh-home.age ];

View file

@ -37,7 +37,7 @@ in
"feh".state = "floating"; "feh".state = "floating";
"Vampire_Survivors".state = "fullscreen"; "Vampire_Survivors".state = "fullscreen";
}; };
settings = with config.scheme.withHashtag; { settings = {
border_width = 2; border_width = 2;
window_gap = 5; window_gap = 5;
borderless_monocle = true; borderless_monocle = true;

View file

@ -18,10 +18,12 @@
./gpg.nix ./gpg.nix
./helix.nix ./helix.nix
./hub.nix ./hub.nix
./hyprland
./kakoune.nix ./kakoune.nix
./kitty.nix ./kitty.nix
./ledger ./ledger
./logseq.nix ./logseq.nix
./miracast.nix
./python.nix ./python.nix
./rofi ./rofi
./spotify.nix ./spotify.nix
@ -32,6 +34,5 @@
./xmonad ./xmonad
./zathura.nix ./zathura.nix
./zsh.nix ./zsh.nix
./hyprland
]; ];
} }

View file

@ -141,6 +141,8 @@ in
# Fullscreen Applications # Fullscreen Applications
# ${mkRules ["opaque" "noblur" "noborder" "noshadow" "forceinput"] ["fullscreen:1"]} # ${mkRules ["opaque" "noblur" "noborder" "noshadow" "forceinput"] ["fullscreen:1"]}
${mkRules ["opaque" "noblur" "noshadow"] ["class:^jetbrains-pycharm$"]}
# See https://wiki.hyprland.org/Configuring/Keywords/ for more # See https://wiki.hyprland.org/Configuring/Keywords/ for more
$mainMod = SUPER $mainMod = SUPER
$windowMod = ALT $windowMod = ALT

View file

@ -28,6 +28,13 @@ in
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
my = {
programs = {
kitty.enable = true;
rofi.enable = true;
};
services.dunst.enable = true;
};
# enable nix module # enable nix module
programs.hyprland = { programs.hyprland = {
@ -35,6 +42,7 @@ in
package = null; # because we use the home-manager module package = null; # because we use the home-manager module
}; };
# enable home-manager module # enable home-manager module
home-manager.users.moritz = { home-manager.users.moritz = {
# import home-manager module # import home-manager module
@ -146,11 +154,12 @@ in
# add user packages for wayland and hyprland in particular # add user packages for wayland and hyprland in particular
users.users.moritz.packages = with pkgs; [ users.users.moritz.packages = with pkgs; [
pamixer # pulse audio cli
playerctl # control media playback
brightnessctl # control brightness brightnessctl # control brightness
grimblast # screenshot tool for hyprland grimblast # screenshot tool for hyprland
pamixer # pulse audio cli
playerctl # control media playback
slurp # region select for wayland (for screensharing) slurp # region select for wayland (for screensharing)
wdisplays # manage monitors
wl-clipboard # clipboard tool for wayland wl-clipboard # clipboard tool for wayland
]; ];
@ -169,7 +178,6 @@ in
} // (optionalAttrs cfg.nvidiaSupport } // (optionalAttrs cfg.nvidiaSupport
{ {
LIBVA_DRIVER_NAME = "nvidia"; LIBVA_DRIVER_NAME = "nvidia";
XDG_SESSION_TYPE = "wayland";
GBM_BACKEND = "nvidia-drm"; GBM_BACKEND = "nvidia-drm";
__GLX_VENDOR_LIBRARY_NAME = "nvidia"; __GLX_VENDOR_LIBRARY_NAME = "nvidia";
WLR_NO_HARDWARE_CURSORS = "1"; WLR_NO_HARDWARE_CURSORS = "1";

View file

@ -0,0 +1,23 @@
{ config
, lib
, pkgs
, ...
}:
with lib;
let
cfg = config.my.programs.miracast;
in
{
options.my.programs.miracast.enable = mkEnableOption "miracast";
config = mkIf cfg.enable {
networking.firewall = {
allowedTCPPorts = [ 7236 7250 ];
allowedUDPPorts = [ 7236 5353 ];
};
users.users.moritz.packages = with pkgs; [
gnome-network-displays
];
};
}

View file

@ -8,26 +8,6 @@
with lib; with lib;
let let
cfg = config.my.programs.vim; cfg = config.my.programs.vim;
mkDate = longDate: (lib.concatStringsSep "-" [
(builtins.substring 0 4 longDate)
(builtins.substring 4 2 longDate)
(builtins.substring 6 2 longDate)
]);
mkVersionInput = input: mkDate (input.lastModifiedDate or "19700101") + "_" + (input.shortRev or "dirty");
nvim-treesitter-textsubjects = pkgs.vimUtils.buildVimPluginFrom2Nix {
pname = "nvim-treesitter-textsubjects";
version = mkVersionInput inputs.nvim-treesitter-textsubjects;
src = inputs.nvim-treesitter-textsubjects;
};
smartcolumn-nvim = pkgs.vimUtils.buildVimPluginFrom2Nix {
pname = "smartcolumn-nvim";
version = mkVersionInput inputs.smartcolumn-nvim;
src = inputs.smartcolumn-nvim;
};
in in
{ {
options.my.programs.vim = { options.my.programs.vim = {

View file

@ -329,7 +329,7 @@ local function lspconfig_setup(lsp, options)
lspconfig[lsp].setup(final_options) lspconfig[lsp].setup(final_options)
end end
local servers = { "nil_ls", "pylsp", "rust_analyzer" } local servers = { "nil_ls", "pylsp", "rust_analyzer", "ruff_lsp" }
for _, lsp in ipairs(servers) do for _, lsp in ipairs(servers) do
lspconfig_setup(lsp, {}) lspconfig_setup(lsp, {})
end end
@ -440,6 +440,10 @@ require("copilot").setup({
suggestion = { enabled = false }, suggestion = { enabled = false },
panel = { enabled = false }, panel = { enabled = false },
}) })
vim.api.nvim_create_autocmd("VimEnter", {
desc = "Disable Copilot by default on startup",
command = "Copilot disable",
})
require("copilot_cmp").setup() require("copilot_cmp").setup()
local orgmode = require("orgmode") local orgmode = require("orgmode")

View file

@ -8,40 +8,55 @@ with lib;
let let
cfg = config.my.programs.python; cfg = config.my.programs.python;
mkPython = packages: version: pkgs.${version}.withPackages (ps: map (flip getAttr ps) packages); pythonVersions = map (version: "3${toString version}") (range 8 11);
enabledVersions = filterAttrs (name: value: value.enable) cfg.versions;
pythonVersions = [ pythonPackages = version: attrNames pkgs."python${version}Packages";
"python311"
"python310"
"python39"
"python38"
];
packageLists = map (version: attrNames pkgs."${version}Packages") cfg.versions; commonPackages =
let
packageLists = map pythonPackages (attrNames enabledVersions);
in
foldl' intersectLists (head packageLists) (tail packageLists);
commonPackages = foldl' intersectLists (head packageLists) (tail packageLists); versionOpts = version: {
enable = mkEnableOption (toString version);
pythonPackages = mkOption {
default = [ ];
type = with types; listOf (enum (pythonPackages version));
};
};
in in
{ {
options.my.programs.python = { options.my.programs.python = {
enable = mkEnableOption "python"; versions = genAttrs pythonVersions versionOpts;
versions = mkOption { defaultPackages = mkOption {
default = [ "python310" ]; default = [ ];
type = with types; nonEmptyListOf (enum pythonVersions);
example = [ "python39" ];
};
packages = mkOption {
default = [
"flake8"
"isort"
"mypy"
"pytest"
];
type = with types; listOf (enum commonPackages); type = with types; listOf (enum commonPackages);
}; };
extraPackages = mkOption {
default = with pkgs; [
poetry
ruff
python310Packages.python-lsp-server
];
type = with types; listOf package;
};
}; };
config = mkIf cfg.enable { config = {
users.users.moritz.packages = map (mkPython cfg.packages) cfg.versions users.users.moritz.packages =
++ [ pkgs.poetry pkgs.nodePackages.pyright ]; (
let
mkPython = version:
let
package = pkgs."python${version}";
finalPythonPackages = cfg.versions.${version}.pythonPackages ++ cfg.defaultPackages;
getPythonPackages = ps: map (flip getAttr ps) finalPythonPackages;
in
package.withPackages getPythonPackages;
in
map mkPython (attrNames enabledVersions)
) ++ cfg.extraPackages;
}; };
} }

View file

@ -15,6 +15,7 @@ in
virtualisation.podman = { virtualisation.podman = {
enable = true; enable = true;
dockerCompat = true; dockerCompat = true;
defaultNetwork.settings.dns_enabled = true;
}; };
}; };
} }

View file

@ -1,4 +1,13 @@
{ inputs }: final: prev: { { inputs }: final: prev:
let
mkDate = longDate: (prev.lib.concatStringsSep "-" [
(builtins.substring 0 4 longDate)
(builtins.substring 4 2 longDate)
(builtins.substring 6 2 longDate)
]);
mkVersionInput = input: "unstable" + mkDate (input.lastModifiedDate or "19700101") + "_" + (input.shortRev or "dirty");
in
{
agenix = inputs.agenix.packages.${prev.system}.default; agenix = inputs.agenix.packages.${prev.system}.default;
attic = inputs.attic.packages.${prev.system}.default; attic = inputs.attic.packages.${prev.system}.default;
hyprpaper = inputs.hyprpaper.packages.${prev.system}.default; hyprpaper = inputs.hyprpaper.packages.${prev.system}.default;
@ -23,6 +32,25 @@
mesonFlags = old.mesonFlags or [ ] ++ [ "-Dexperimental=true" ]; mesonFlags = old.mesonFlags or [ ] ++ [ "-Dexperimental=true" ];
}); });
vimPlugins = prev.vimPlugins // {
nvim-treesitter-textsubjects = prev.vimUtils.buildVimPluginFrom2Nix {
pname = "nvim-treesitter-textsubjects";
version = mkVersionInput inputs.nvim-treesitter-textsubjects;
src = inputs.nvim-treesitter-textsubjects;
};
smartcolumn-nvim = prev.vimUtils.buildVimPluginFrom2Nix {
pname = "smartcolumn-nvim";
version = mkVersionInput inputs.smartcolumn-nvim;
src = inputs.smartcolumn-nvim;
};
copilot-lua = prev.vimPlugins.copilot-lua.overrideAttrs (old: {
version = mkVersionInput inputs.copilot-lua;
src = inputs.copilot-lua;
});
};
master = import inputs.master { master = import inputs.master {
inherit (prev) system; inherit (prev) system;
config.allowUnfree = true; config.allowUnfree = true;