From 4a10a3536ab082fe5657a749c719f15f349bcf70 Mon Sep 17 00:00:00 2001 From: ItsDrike Date: Wed, 26 Jun 2024 20:47:04 +0200 Subject: [PATCH 1/4] Update float window rules --- .../graphical/wms/hyprland/config/window_rules.nix | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/home/programs/graphical/wms/hyprland/config/window_rules.nix b/home/programs/graphical/wms/hyprland/config/window_rules.nix index 4268218..5ece79f 100644 --- a/home/programs/graphical/wms/hyprland/config/window_rules.nix +++ b/home/programs/graphical/wms/hyprland/config/window_rules.nix @@ -40,9 +40,10 @@ "float, class:^(com.github.wwmm.easyeffects)" "float, class:^(opensnitch_ui)$" "float, class:^(Brave-browser)$,title:^(_crx_.+)$" - "float, class:^(hyprland-share-picker)$" - "float,class:^(floating)$" + "float, class:^(floating)$" + # Float hyprland-share-picker & some extra actions + "float, class:^(hyprland-share-picker)$" "center, class:^(hyprland-share-picker)$" "animation slide, class:^(hyprland-share-picker)$" @@ -77,6 +78,9 @@ "float, class:^(splash)$" "float, class:^(confirmreset)$" + # Float all windows that don't have a title nor a class + "float, class:^$,title:^$" + # # Fixes # From 507f364e5bc83a12d40ff29e1ba29962b39c4649 Mon Sep 17 00:00:00 2001 From: ItsDrike Date: Wed, 26 Jun 2024 22:51:51 +0200 Subject: [PATCH 2/4] Support persisting data separately from config --- home/impermanence/default.nix | 13 +++++++++++ hosts/voyager/default.nix | 22 ++++++++++++------- options/system/impermanence.nix | 39 ++++++++++++++++++++++++++++++--- 3 files changed, 63 insertions(+), 11 deletions(-) diff --git a/home/impermanence/default.nix b/home/impermanence/default.nix index 0c7f196..998659c 100644 --- a/home/impermanence/default.nix +++ b/home/impermanence/default.nix @@ -25,5 +25,18 @@ in { # Docker, etc. Requires NixOS configuration programs.fuse.userAllowOther = true; allowOther = true; }; + + home.persistence."${cfg.persistentDataMountPoint}" = { + directories = [ + + ] ++ cfg.extraDataDirectories; + + files = [ + + ] ++ cfg.extraDataFiles; + + # See comment for this above + allowOther = true; + }; }; } diff --git a/hosts/voyager/default.nix b/hosts/voyager/default.nix index e579cbc..e9b0e21 100644 --- a/hosts/voyager/default.nix +++ b/hosts/voyager/default.nix @@ -53,14 +53,6 @@ enable = true; persistentMountPoint = "/persist/home"; extraDirectories = [ - # Nixos flake - "dots" - - # Personal data - "Downloads" - "Personal" - "Media" - # Browsers ".mozilla" ".mullvad" @@ -95,6 +87,20 @@ ".config/pcmanfm-qt/default/recent-files.conf" ".config/qalculate/qalculate-gtk.cfg" ]; + + persistentDataMountPoint = "/data/Data"; + extraDataDirectories = [ + # Nixos flake + "dots" + + # XDG user dirs + "Downloads" + "Media" + + # Other personal data + "Personal" + ]; + extraDataFiles = []; }; # Configure automatic root subvolume wiping on boot from initrd diff --git a/options/system/impermanence.nix b/options/system/impermanence.nix index ff50350..a5fe4ff 100644 --- a/options/system/impermanence.nix +++ b/options/system/impermanence.nix @@ -60,7 +60,7 @@ in extraDirectories = mkOption { default = []; type = types.listOf types.str; - example = literalExpression ''["Downloads"]''; + example = literalExpression ''[".config/chromium"]''; description = '' Additional directories in home to link to persistent storage. ''; @@ -70,13 +70,46 @@ in default = "/persist/home"; description = '' Path to a persistent directory (usually a mount point to a - standalone partition / subvolume), which will hold the persistent + standalone partition or subvolume), which will hold the persistent system state files. - This does not expect any subdirectories, all of the persistent home files + This does not create any subdirectories, all of the persistent home files will be put directly in here. The user should be the owner of this direcotry. ''; }; + + persistentDataMountPoint = mkOption { + default = "/persist/home"; + description = '' + Path to a persistent directory (usually a mount point to a + standalone partition or subvolume), which will hold the persistent + data files. + + This does not create any subdirectories, all of the persistent home files + fill be put directly in here. The user should be the owner of this directory. + + If you don't wish to distinguish between data and system / configuration files, + you can point this to the same location. + ''; + }; + + extraDataFiles = mkOption { + default = []; + type = types.listOf types.str; + example = literalExpression ''["notes.txt"]''; + description = '' + Additional files in home to link to persistent data storage. + ''; + }; + + extraDataDirectories = mkOption { + default = []; + type = types.listOf types.str; + example = literalExpression ''["Downloads"]''; + description = '' + Additional directories in home to link to persistent data storage. + ''; + }; }; autoWipeBtrfs = let From 7c3098c74fea2c7a3d0145b836cb349e0b2c46e1 Mon Sep 17 00:00:00 2001 From: ItsDrike Date: Wed, 26 Jun 2024 23:46:50 +0200 Subject: [PATCH 3/4] Add python packages --- home/programs/terminal/coding/default.nix | 5 + .../terminal/coding/python/default.nix | 10 ++ .../terminal/coding/python/ipython.nix | 14 ++ .../terminal/coding/python/poetry.nix | 22 +++ .../terminal/coding/python/pyright.nix | 14 ++ .../terminal/coding/python/python.nix | 22 +++ home/programs/terminal/coding/python/ruff.nix | 164 ++++++++++++++++++ home/programs/terminal/coding/python/rye.nix | 14 ++ hosts/voyager/default.nix | 3 + options/home/programs/default.nix | 4 + 10 files changed, 272 insertions(+) create mode 100644 home/programs/terminal/coding/default.nix create mode 100644 home/programs/terminal/coding/python/default.nix create mode 100644 home/programs/terminal/coding/python/ipython.nix create mode 100644 home/programs/terminal/coding/python/poetry.nix create mode 100644 home/programs/terminal/coding/python/pyright.nix create mode 100644 home/programs/terminal/coding/python/python.nix create mode 100644 home/programs/terminal/coding/python/ruff.nix create mode 100644 home/programs/terminal/coding/python/rye.nix diff --git a/home/programs/terminal/coding/default.nix b/home/programs/terminal/coding/default.nix new file mode 100644 index 0000000..0a59fe5 --- /dev/null +++ b/home/programs/terminal/coding/default.nix @@ -0,0 +1,5 @@ +{ + imports = [ + ./python + ]; +} diff --git a/home/programs/terminal/coding/python/default.nix b/home/programs/terminal/coding/python/default.nix new file mode 100644 index 0000000..c35e3d0 --- /dev/null +++ b/home/programs/terminal/coding/python/default.nix @@ -0,0 +1,10 @@ +{ + imports = [ + ./python.nix + ./ipython.nix + ./poetry.nix + ./rye.nix + ./pyright.nix + ./ruff.nix + ]; +} diff --git a/home/programs/terminal/coding/python/ipython.nix b/home/programs/terminal/coding/python/ipython.nix new file mode 100644 index 0000000..13c3b22 --- /dev/null +++ b/home/programs/terminal/coding/python/ipython.nix @@ -0,0 +1,14 @@ +{ + lib, + pkgs, + osConfig, + ... +}: let + inherit (lib) mkIf; + + cfg = osConfig.myOptions.home-manager.programs.coding.python; +in { + config = mkIf cfg.enable { + home.packages = with pkgs; [ python312Packages.ipython ]; + }; +} diff --git a/home/programs/terminal/coding/python/poetry.nix b/home/programs/terminal/coding/python/poetry.nix new file mode 100644 index 0000000..c3356fe --- /dev/null +++ b/home/programs/terminal/coding/python/poetry.nix @@ -0,0 +1,22 @@ +{ + lib, + osConfig, + ... +}: let + inherit (lib) mkIf; + + cfg = osConfig.myOptions.home-manager.programs.coding.python; +in { + config = mkIf cfg.enable { + programs.poetry = { + enable = true; + + settings = { + virtualenvs = { + in-project = true; + prefer-active-python = true; + }; + }; + }; + }; +} diff --git a/home/programs/terminal/coding/python/pyright.nix b/home/programs/terminal/coding/python/pyright.nix new file mode 100644 index 0000000..58c884a --- /dev/null +++ b/home/programs/terminal/coding/python/pyright.nix @@ -0,0 +1,14 @@ +{ + lib, + pkgs, + osConfig, + ... +}: let + inherit (lib) mkIf; + + cfg = osConfig.myOptions.home-manager.programs.coding.python; +in { + config = mkIf cfg.enable { + home.packages = with pkgs; [ pyright ]; + }; +} diff --git a/home/programs/terminal/coding/python/python.nix b/home/programs/terminal/coding/python/python.nix new file mode 100644 index 0000000..703b945 --- /dev/null +++ b/home/programs/terminal/coding/python/python.nix @@ -0,0 +1,22 @@ +{ + lib, + pkgs, + osConfig, + ... +}: let + inherit (lib) mkIf; + + cfg = osConfig.myOptions.home-manager.programs.coding.python; +in { + config = mkIf cfg.enable { + home.packages = with pkgs; [ + python38 + python39 + python310 + python311 + python312 + python313 + ]; + }; +} + diff --git a/home/programs/terminal/coding/python/ruff.nix b/home/programs/terminal/coding/python/ruff.nix new file mode 100644 index 0000000..0ed47be --- /dev/null +++ b/home/programs/terminal/coding/python/ruff.nix @@ -0,0 +1,164 @@ +{ + lib, + osConfig, + ... +}: let + inherit (lib) mkIf; + + cfg = osConfig.myOptions.home-manager.programs.coding.python; +in { + config = mkIf cfg.enable { + programs.ruff = { + enable = true; + + settings = { + line-length = 119; + lint = { + select = [ + "F" # Pyflakes + "E" # Pycodestyle (errors) + "W" # Pycodestyle (warnigns) + "N" # pep8-naming + "D" # pydocstyle + "UP" # pyupgrade + "YTT" # flake8-2020 + "ANN" # flake8-annotations + "ASYNC" # flake8-async + "S" # flake8-bandit + "BLE" # flake8-blind-except + "B" # flake8-bugbear + "A" # flake8-builtins + "COM" # flake8-commas + "C4" # flake8-comprehensions + "DTZ" # flake8-datetimez + "T10" # flake8-debugger + "EM" # flake8-errmsg + "EXE" # flake8-executable + "FA" # flake8-future-annotations + "ISC" # flake8-implicit-str-concat + "ICN" # flake8-import-conventions + "LOG" # flake8-logging + "G" # flake8-logging-format + "INP" # flake8-no-pep420 + "PIE" # flake8-pie + "T20" # flake8-print + "PYI" # flake8-pyi + "PT" # flake8-pytest-style + "Q" # flake8-quotes + "RSE" # flake8-raise + "RET" # flake8-return + "SLOT" # flake8-slots + "SIM" # flake8-simplify + "TID" # flake8-tidy-imports + "TCH" # flake8-type-checking + "INT" # flake8-gettext + "PTH" # flake8-use-pathlib + "TD" # flake8-todos + "ERA" # flake8-eradicate + "PGH" # pygrep-hooks + "PL" # pylint + "TRY" # tryceratops + "FLY" # flynt + "PERF" # perflint + "RUF" # ruff-specific rules + ]; + ignore = [ + "D100" # Missing docstring in public module + "D104" # Missing docstring in public package + "D105" # Missing docstring in magic method + "D107" # Missing docstring in __init__ + "D203" # Blank line required before class docstring + "D213" # Multi-line summary should start at second line (incompatible with D212) + "D301" # Use r""" if any backslashes in a docstring + "D405" # Section name should be properly capitalized + "D406" # Section name should end with a newline + "D407" # Missing dashed underline after section + "D408" # Section underline should be in the line following the section's name + "D409" # Section underline should match the length of its name + "D410" # Missing blank line after section + "D411" # Missing blank line before section + "D412" # No blank lines allowed between a section header and its content + "D413" # Missing blank line after last section + "D414" # Section has no content + "D416" # Section name should end with a colon + "D417" # Missing argument descrition in the docstring + + "ANN002" # Missing type annotation for *args + "ANN003" # Missing type annotation for **kwargs + "ANN101" # Missing type annotation for self in method + "ANN102" # Missing type annotation for cls in classmethod + "ANN204" # Missing return type annotation for special method + "ANN401" # Dynamically typed expressions (typing.Any) disallowed + + "SIM102" # use a single if statement instead of nested if statements + "SIM108" # Use ternary operator {contents} instead of if-else-block + + "TCH001" # Move application imports used only for annotations into a type-checking block + "TCH002" # Move 3rd-party imports used only for annotations into a type-checking block + "TCH003" # Move standard library imports used only for annotations into a type-checking block + + "TD002" # Missing author in TODO + "TD003" # Missing issue link on the line following this TODO + + "PT011" # pytest.raises without match parameter is too broad # TODO: Unignore this + "TRY003" # No f-strings in raise statements + "EM101" # No string literals in exception init + "EM102" # No f-strings in exception init + "UP024" # Using errors that alias OSError + "PLR2004" # Using unnamed numerical constants + "PGH003" # Using specific rule codes in type ignores + "E731" # Don't asign a lambda expression, use a def + + # Redundant rules with ruff-format: + "E111" # Indentation of a non-multiple of 4 spaces + "E114" # Comment with indentation of a non-multiple of 4 spaces + "E117" # Cheks for over-indented code + "D206" # Checks for docstrings indented with tabs + "D300" # Checks for docstring that use ''' instead of """ + "Q000" # Checks of inline strings that use wrong quotes (' instead of ") + "Q001" # Multiline string that use wrong quotes (''' instead of """) + "Q002" # Checks for docstrings that use wrong quotes (''' instead of """) + "Q003" # Checks for avoidable escaped quotes ("\"" -> '"') + "COM812" # Missing trailing comma (in multi-line lists/tuples/...) + "COM819" # Prohibited trailing comma (in single-line lists/tuples/...) + "ISC001" # Single line implicit string concatenation ("hi" "hey" -> "hihey") + "ISC002" # Multi line implicit string concatenation + ]; + extend-per-file-ignores = { + "tests/*" = [ + "ANN" # flake8-annotations + "S101" # Use of assert + ]; + "docs/conf.py" = [ + "INP" # allow implicit namespace (pep 420) + ]; + }; + isort = { + order-by-type = false; + case-sensitive = true; + combine-as-imports = true; + + # Redundant rules with ruff-format + force-single-line = false; # forces all imports to appear on their own line + force-wrap-aliases = false; # Split imports with multiple members and at least one alias + lines-after-imports = -1; # The number of blank lines to place after imports + lines-between-types = 0; # Number of lines to place between "direct" and import from imports + split-on-trailing-comma = false; # if last member of multiline import has a comma, don't fold it to single line + }; + pylint = { + max-args = 20; + max-branches = 20; + max-returns = 20; + max-statements = 250; + }; + flake8-tidy-imports = { + ban-relative-imports = "all"; + }; + }; + format = { + line-ending = "lf"; + }; + }; + }; + }; +} diff --git a/home/programs/terminal/coding/python/rye.nix b/home/programs/terminal/coding/python/rye.nix new file mode 100644 index 0000000..5e06e4c --- /dev/null +++ b/home/programs/terminal/coding/python/rye.nix @@ -0,0 +1,14 @@ +{ + lib, + pkgs, + osConfig, + ... +}: let + inherit (lib) mkIf; + + cfg = osConfig.myOptions.home-manager.programs.coding.python; +in { + config = mkIf cfg.enable { + home.packages = with pkgs; [ rye ]; + }; +} diff --git a/hosts/voyager/default.nix b/hosts/voyager/default.nix index e9b0e21..fd5f18e 100644 --- a/hosts/voyager/default.nix +++ b/hosts/voyager/default.nix @@ -207,6 +207,9 @@ file-managers = { pcmanfm-qt.enable = true; }; + coding = { + python.enable = true; + }; }; services = { diff --git a/options/home/programs/default.nix b/options/home/programs/default.nix index 26f7c22..ac3222c 100644 --- a/options/home/programs/default.nix +++ b/options/home/programs/default.nix @@ -57,5 +57,9 @@ in fastfetch.enable = mkEnableOption "FastFetch (fast neofetch)"; hyfetch.enable = mkEnableOption "Neofetch with pride flags"; }; + + coding = { + python.enable = mkEnableOption "Python coding utilities"; + }; }; } From 8a4d6ba1cb7314d8a45a78ba672bd293fd44ecd6 Mon Sep 17 00:00:00 2001 From: ItsDrike Date: Thu, 27 Jun 2024 00:26:29 +0200 Subject: [PATCH 4/4] Add python dependencies --- home/programs/terminal/coding/python/default.nix | 1 + home/programs/terminal/coding/python/mypy.nix | 14 ++++++++++++++ home/programs/terminal/coding/python/poetry.nix | 5 +++++ home/programs/terminal/coding/python/python.nix | 10 +--------- home/programs/terminal/default.nix | 1 + 5 files changed, 22 insertions(+), 9 deletions(-) create mode 100644 home/programs/terminal/coding/python/mypy.nix diff --git a/home/programs/terminal/coding/python/default.nix b/home/programs/terminal/coding/python/default.nix index c35e3d0..1bf124b 100644 --- a/home/programs/terminal/coding/python/default.nix +++ b/home/programs/terminal/coding/python/default.nix @@ -5,6 +5,7 @@ ./poetry.nix ./rye.nix ./pyright.nix + ./mypy.nix ./ruff.nix ]; } diff --git a/home/programs/terminal/coding/python/mypy.nix b/home/programs/terminal/coding/python/mypy.nix new file mode 100644 index 0000000..1d086f5 --- /dev/null +++ b/home/programs/terminal/coding/python/mypy.nix @@ -0,0 +1,14 @@ +{ + lib, + pkgs, + osConfig, + ... +}: let + inherit (lib) mkIf; + + cfg = osConfig.myOptions.home-manager.programs.coding.python; +in { + config = mkIf cfg.enable { + home.packages = with pkgs; [ python312Packages.mypy ]; + }; +} diff --git a/home/programs/terminal/coding/python/poetry.nix b/home/programs/terminal/coding/python/poetry.nix index c3356fe..3047eeb 100644 --- a/home/programs/terminal/coding/python/poetry.nix +++ b/home/programs/terminal/coding/python/poetry.nix @@ -14,6 +14,11 @@ in { settings = { virtualenvs = { in-project = true; + + # use python the version of python that's globally installed on the system + # and exists in PATH, instead of the python version poetry was installed + # with. Annoyingly, there's no good way to override the python version at + # which NixOS will built poetry here, so this is the next best thing. prefer-active-python = true; }; }; diff --git a/home/programs/terminal/coding/python/python.nix b/home/programs/terminal/coding/python/python.nix index 703b945..f4628e2 100644 --- a/home/programs/terminal/coding/python/python.nix +++ b/home/programs/terminal/coding/python/python.nix @@ -9,14 +9,6 @@ cfg = osConfig.myOptions.home-manager.programs.coding.python; in { config = mkIf cfg.enable { - home.packages = with pkgs; [ - python38 - python39 - python310 - python311 - python312 - python313 - ]; + home.packages = with pkgs; [ python312 ]; }; } - diff --git a/home/programs/terminal/default.nix b/home/programs/terminal/default.nix index b142bdf..8d41a45 100644 --- a/home/programs/terminal/default.nix +++ b/home/programs/terminal/default.nix @@ -5,5 +5,6 @@ _: { ./editors ./file-managers ./emulators + ./coding ]; }