From d1997df8069670eb5ec36416b02ad952e39976ac Mon Sep 17 00:00:00 2001 From: Grimmauld Date: Mon, 23 Dec 2024 12:18:12 +0100 Subject: [PATCH] getting started with HM --- common/sound/midi.nix | 3 +- common/tooling/apparmor/bare.nix | 3 +- common/tooling/java.nix | 2 +- common/tooling/python.nix | 2 +- dual_monitor_otd.json | 73 ++++++++++++++++++++++++++++++ flake.lock | 77 ++++++++++++++++++++------------ flake.nix | 19 +++++--- hm/default.nix | 5 +++ hm/gradle.properties | 2 + hm/grimmauld/default.nix | 47 +++++++++++++++++++ modules/nextcloud.nix | 15 ++++--- sway/default.nix | 5 ++- 12 files changed, 205 insertions(+), 48 deletions(-) create mode 100644 dual_monitor_otd.json create mode 100644 hm/default.nix create mode 100644 hm/gradle.properties create mode 100644 hm/grimmauld/default.nix diff --git a/common/sound/midi.nix b/common/sound/midi.nix index 839b518..b4ac719 100644 --- a/common/sound/midi.nix +++ b/common/sound/midi.nix @@ -20,7 +20,8 @@ in environment.pathsToLink = [ "/share/soundfonts" ]; - environment.etc."timidity/timidity.cfg".text = "soundfont ${sound_font}/share/soundfonts/FluidR3_GM2-2.sf2"; + environment.etc."timidity/timidity.cfg".text = + "soundfont ${sound_font}/share/soundfonts/FluidR3_GM2-2.sf2"; }; options.grimmShared.sound.midi = lib.mkEnableOption "enable midi"; diff --git a/common/tooling/apparmor/bare.nix b/common/tooling/apparmor/bare.nix index d3ea3c4..4ebac2c 100644 --- a/common/tooling/apparmor/bare.nix +++ b/common/tooling/apparmor/bare.nix @@ -15,12 +15,11 @@ in security.apparmor.enableCache = true; - environment.systemPackages = with pkgs; [ apparmor-parser ]; # security.apparmor.aa-alias-manager.enable = false; security.audit.backlogLimit = 512; - }; + }; } diff --git a/common/tooling/java.nix b/common/tooling/java.nix index b9aa770..429ca7b 100644 --- a/common/tooling/java.nix +++ b/common/tooling/java.nix @@ -21,7 +21,7 @@ in pkgs.jdk17 pkgs.visualvm pkgs.gradle_7 - ] ++ optionals graphical [ pkgs.jetbrains.idea-community ]; + ]; # ++ optionals graphical [ pkgs.jetbrains.idea-community ]; environment.sessionVariables.JAVA_HOME = pkgs.jdk17.home; diff --git a/common/tooling/python.nix b/common/tooling/python.nix index 67d18fd..2c0b43f 100644 --- a/common/tooling/python.nix +++ b/common/tooling/python.nix @@ -31,7 +31,7 @@ in config = mkIf (enable && tooling.enable && (elem lang_support_id tooling.supportedLangs)) { environment.systemPackages = [ (pkgs.python3.withPackages pyLibs) - ] ++ lib.optionals graphical (with pkgs; [ jetbrains.pycharm-community ]); + ]; # ++ lib.optionals graphical (with pkgs; [ jetbrains.pycharm-community ]); programs.xonsh = { enable = true; diff --git a/dual_monitor_otd.json b/dual_monitor_otd.json new file mode 100644 index 0000000..41a9793 --- /dev/null +++ b/dual_monitor_otd.json @@ -0,0 +1,73 @@ +{ + "Profiles": [ + { + "Tablet": "Wacom PTH-660", + "OutputMode": { + "Path": "OpenTabletDriver.Desktop.Output.AbsoluteMode", + "Settings": [], + "Enable": true + }, + "Filters": [], + "AbsoluteModeSettings": { + "Display": { + "Width": 3840.0, + "Height": 1080.0, + "X": 1920.0, + "Y": 540.0, + "Rotation": 0.0 + }, + "Tablet": { + "Width": 148.0, + "Height": 42.0, + "X": 112.0, + "Y": 74.0, + "Rotation": 90.0 + }, + "EnableClipping": true, + "EnableAreaLimiting": false, + "LockAspectRatio": false + }, + "RelativeModeSettings": { + "XSensitivity": 10.0, + "YSensitivity": 10.0, + "RelativeRotation": 0.0, + "RelativeResetDelay": "00:00:00.1000000" + }, + "Bindings": { + "TipActivationThreshold": 0.0, + "TipButton": { + "Path": "OpenTabletDriver.Desktop.Binding.MouseBinding", + "Settings": [ + { + "Property": "Button", + "Value": "Left" + } + ], + "Enable": true + }, + "EraserActivationThreshold": 0.0, + "EraserButton": null, + "PenButtons": [ + null, + null + ], + "AuxButtons": [ + null, + null, + null, + null, + null, + null, + null, + null + ], + "MouseButtons": [], + "MouseScrollUp": null, + "MouseScrollDown": null + } + } + ], + "LockUsableAreaDisplay": true, + "LockUsableAreaTablet": true, + "Tools": [] +} \ No newline at end of file diff --git a/flake.lock b/flake.lock index 47e525d..c84c95d 100644 --- a/flake.lock +++ b/flake.lock @@ -101,11 +101,11 @@ ] }, "locked": { - "lastModified": 1734558035, - "narHash": "sha256-v45bzSPoI7q/mGeP0YyBaE5F/fFuQ75GPHRGTPNpcsw=", + "lastModified": 1734881868, + "narHash": "sha256-ONpu806E6j/23ZCgvfAR7bNusDjC5bVThTOjNkUMIqQ=", "owner": "LordGrimmauld", "repo": "apparmor-dev", - "rev": "d9d7d629c902a10e1c9986efb8b79c7d9daf02ed", + "rev": "032cb3469176411d5bda5642049abc468073e18a", "type": "github" }, "original": { @@ -140,11 +140,11 @@ ] }, "locked": { - "lastModified": 1734346739, - "narHash": "sha256-Um5yY36idRodddotyBaI9sQjw/xw5SV6tt3jPRgL330=", + "lastModified": 1734915121, + "narHash": "sha256-iSEzSBeGwNmg/F95taw9POJiWq4iEZ2VGcOaBUabCtc=", "owner": "chaotic-cx", "repo": "nyx", - "rev": "7228d7032f0316dbc69b69584ec07707efbd38c9", + "rev": "914e86e0d0c1ce969bd4c4184cfd2188ee51b891", "type": "github" }, "original": { @@ -342,11 +342,31 @@ ] }, "locked": { - "lastModified": 1734093295, - "narHash": "sha256-hSwgGpcZtdDsk1dnzA0xj5cNaHgN9A99hRF/mxMtwS4=", + "lastModified": 1734622215, + "narHash": "sha256-OOfI0XhSJGHblfdNDhfnn8QnZxng63rWk9eeJ2tCbiI=", "owner": "nix-community", "repo": "home-manager", - "rev": "66c5d8b62818ec4c1edb3e941f55ef78df8141a8", + "rev": "1395379a7a36e40f2a76e7b9936cc52950baa1be", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, + "home-manager_3": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1734942126, + "narHash": "sha256-4543MvF57F6lpQYaC0+TkVVgLJvEsIr7LlYdOKYAXnk=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "8bea1a2005c64a8c9c430d0dddb6b2e5db5f6f12", "type": "github" }, "original": { @@ -364,11 +384,11 @@ ] }, "locked": { - "lastModified": 1734162608, - "narHash": "sha256-m2AX+3eiVqIK6uO7GbGY7SFnkkYOlR5fQiNI0eRvWOQ=", + "lastModified": 1734725857, + "narHash": "sha256-bivlV9l/UjMtTfz/CZaoNJ5RfH2Lre4P9Ds64conoUQ=", "owner": "Jovian-Experiments", "repo": "Jovian-NixOS", - "rev": "31bdf4c7c91204d65afbde01146deee0259a8fb7", + "rev": "dbae2fd6adaf34c947d310bec08deac7c4ed265b", "type": "github" }, "original": { @@ -471,14 +491,14 @@ "nixpkgs": [ "nixpkgs" ], - "nixpkgs-24_05": "nixpkgs-24_05" + "nixpkgs-24_11": "nixpkgs-24_11" }, "locked": { - "lastModified": 1734370678, - "narHash": "sha256-a8zkti1QM5Oxkdfnzr/NjrFlyqI36/kYV/X8G1jOmB4=", + "lastModified": 1734884447, + "narHash": "sha256-HA9fAmGNGf0cOYrhgoa+B6BxNVqGAYXfLyx8zIS0ZBY=", "owner": "simple-nixos-mailserver", "repo": "nixos-mailserver", - "rev": "c43d8c4a3ce84a7bebd110b06e69365484db6208", + "rev": "63209b1def2c9fc891ad271f474a3464a5833294", "type": "gitlab" }, "original": { @@ -510,32 +530,32 @@ }, "nixpkgs": { "locked": { - "lastModified": 1734536697, - "narHash": "sha256-G/HnRTtU+ob8x967kjzMRqjNFbAdllrcjYc+IcaR15Y=", + "lastModified": 1734649271, + "narHash": "sha256-4EVBRhOjMDuGtMaofAIqzJbg4Ql7Ai0PSeuVZTHjyKQ=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "9c40bef08a5bdc0ccc3207f4282a1ded83e77a7a", + "rev": "d70bd19e0a38ad4790d3913bf08fcbfc9eeca507", "type": "github" }, "original": { "owner": "NixOS", - "ref": "nixos-unstable-small", + "ref": "nixos-unstable", "repo": "nixpkgs", "type": "github" } }, - "nixpkgs-24_05": { + "nixpkgs-24_11": { "locked": { - "lastModified": 1731797254, - "narHash": "sha256-df3dJApLPhd11AlueuoN0Q4fHo/hagP75LlM5K1sz9g=", + "lastModified": 1734083684, + "narHash": "sha256-5fNndbndxSx5d+C/D0p/VF32xDiJCJzyOqorOYW4JEo=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "e8c38b73aeb218e27163376a2d617e61a2ad9b59", + "rev": "314e12ba369ccdb9b352a4db26ff419f7c49fa84", "type": "github" }, "original": { "id": "nixpkgs", - "ref": "nixos-24.05", + "ref": "nixos-24.11", "type": "indirect" } }, @@ -563,11 +583,11 @@ "treefmt-nix": "treefmt-nix" }, "locked": { - "lastModified": 1734260421, - "narHash": "sha256-vsr+9xKkirwEjvXTS2sOVIxlKQmF/QjszD+Ph0/oRgc=", + "lastModified": 1734559477, + "narHash": "sha256-Jwvow0ri+ZgCdP6jpNQVjxub14Pxs1kyjvDV3BbvNzE=", "owner": "nix-community", "repo": "nixpkgs-update", - "rev": "712e24bd6543801c52f6c0656a8371f8d029030e", + "rev": "7f089591e8f595011323c8a7370b195fa3dfe0b7", "type": "github" }, "original": { @@ -621,6 +641,7 @@ "agenix": "agenix", "apparmor-dev": "apparmor-dev", "chaotic": "chaotic", + "home-manager": "home-manager_3", "nixos-mailserver": "nixos-mailserver", "nixos-matrix-modules": "nixos-matrix-modules", "nixpkgs": "nixpkgs", diff --git a/flake.nix b/flake.nix index 02f984d..d1ba593 100644 --- a/flake.nix +++ b/flake.nix @@ -3,7 +3,7 @@ inputs = { nixpkgs = { - url = "github:NixOS/nixpkgs/nixos-unstable-small"; + url = "github:NixOS/nixpkgs/nixos-unstable"; # url = "git+file:///home/grimmauld/coding/nixpkgs"; }; chaotic = { @@ -40,6 +40,8 @@ url = "github:LordGrimmauld/apparmor-dev"; inputs.nixpkgs.follows = "nixpkgs"; }; + home-manager.url = "github:nix-community/home-manager"; + home-manager.inputs.nixpkgs.follows = "nixpkgs"; }; outputs = @@ -54,14 +56,15 @@ aa-alias-manager, nixpkgs-update, apparmor-dev, + home-manager, ... }: let patches = [ -# { -# url = "https://patch-diff.githubusercontent.com/raw/NixOS/nixpkgs/pull/356796.patch"; -# hash = "sha256-hiXVdMeoKYbzJ4QxtTF85huRTe4EwgD3E1qXKhJGw1U="; -# } + # { + # url = "https://patch-diff.githubusercontent.com/raw/NixOS/nixpkgs/pull/356796.patch"; + # hash = "sha256-hiXVdMeoKYbzJ4QxtTF85huRTe4EwgD3E1qXKhJGw1U="; + # } ]; customNixosSystem = @@ -73,7 +76,8 @@ src = inputs.nixpkgs; patches = map (p: if (builtins.isPath p) then p else (unpatched.fetchpatch p)) patches; }; - nixosSystem = if patches == [] then nixpkgs.lib.nixosSystem else import (patched + "/nixos/lib/eval-config.nix"); + nixosSystem = + if patches == [ ] then nixpkgs.lib.nixosSystem else import (patched + "/nixos/lib/eval-config.nix"); in nixosSystem ( { @@ -116,6 +120,9 @@ # apparmor-dev.nixosModules.default ./specific/grimm-nixos-ssd/configuration.nix + + home-manager.nixosModules.home-manager + ./hm ]; }; grimmauld-nixos-server = customNixosSystem "x86_64-linux" { diff --git a/hm/default.nix b/hm/default.nix new file mode 100644 index 0000000..7940627 --- /dev/null +++ b/hm/default.nix @@ -0,0 +1,5 @@ +{ + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + imports = [ ./grimmauld ]; +} diff --git a/hm/gradle.properties b/hm/gradle.properties new file mode 100644 index 0000000..49d538f --- /dev/null +++ b/hm/gradle.properties @@ -0,0 +1,2 @@ +org.gradle.java.home=/nix/store/1fylwjqscywqb5xxsi258h0ka3pz4ax6-openjdk-17.0.11+9/lib/openjdk +org.gradle.java.installations.auto-detect=false diff --git a/hm/grimmauld/default.nix b/hm/grimmauld/default.nix new file mode 100644 index 0000000..bad2ed4 --- /dev/null +++ b/hm/grimmauld/default.nix @@ -0,0 +1,47 @@ +{ + pkgs, + lib, + config ? {}, + ... +}: +let + getIfHas = path: attrs: if path == [] then + attrs + else if builtins.hasAttr (builtins.head path) attrs then + getIfHas (builtins.tail path) (builtins.getAttr (builtins.head path) attrs) + else + null; + + user = hm_config.home.username; + homedir = hm_config.home.homeDirectory; + + hm_config = { + home = { + username = "grimmauld"; + stateVersion = "24.11"; + homeDirectory = "/home/${user}"; + }; + + systemd.user.enable = true; + systemd.user.tmpfiles.rules = lib.optional (lib.defaultTo false (getIfHas ["services" "printing" "cups-pdf" "enable"] config)) "L ${homedir}/PDF - - - - /var/spool/cups-pdf-pdf/users/${user}"; + + xdg.userDirs = { + enable = true; + createDirectories = true; + extraConfig = { + "3d" = "${homedir}/3d"; + }; + }; + + programs.gradle = { + enable = true; + settings = { + "org.gradle.java.home" = "${pkgs.openjdk}/lib/openjdk"; + "org.gradle.java.installations.auto-detect" = false; + }; + }; + }; +in +{ + home-manager.users."${user}" = hm_config; +} diff --git a/modules/nextcloud.nix b/modules/nextcloud.nix index 85f169d..b96d4cc 100644 --- a/modules/nextcloud.nix +++ b/modules/nextcloud.nix @@ -35,13 +35,14 @@ in port = ports.redis_nextcloud_port.port; }; - systemd.services.nextcloud-setup.serviceConfig.ExecStartPost = pkgs.writeScript "nextcloud-redis.sh" '' - #!${pkgs.runtimeShell} - nextcloud-occ config:system:set redis 'host' --value '::1' --type string - nextcloud-occ config:system:set redis '${builtins.toString config.services.redis.servers.nextcloud.port}' --value 6379 --type integer - nextcloud-occ config:system:set memcache.local --value '\OC\Memcache\Redis' --type string - nextcloud-occ config:system:set memcache.locking --value '\OC\Memcache\Redis' --type string - ''; + systemd.services.nextcloud-setup.serviceConfig.ExecStartPost = + pkgs.writeScript "nextcloud-redis.sh" '' + #!${pkgs.runtimeShell} + nextcloud-occ config:system:set redis 'host' --value '::1' --type string + nextcloud-occ config:system:set redis '${builtins.toString config.services.redis.servers.nextcloud.port}' --value 6379 --type integer + nextcloud-occ config:system:set memcache.local --value '\OC\Memcache\Redis' --type string + nextcloud-occ config:system:set memcache.locking --value '\OC\Memcache\Redis' --type string + ''; services.nextcloud = { enable = true; diff --git a/sway/default.nix b/sway/default.nix index 1f82cc9..653c3d8 100644 --- a/sway/default.nix +++ b/sway/default.nix @@ -65,7 +65,8 @@ "$mod+Return" = "exec ${getExe xdg-terminal-exec}"; "$mod+Shift+q" = "kill"; "$mod+Shift+c" = "reload"; - "$mod+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'"; + "$mod+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'"; # Move your focus around "$mod+$left" = "focus left"; @@ -196,7 +197,7 @@ (getExe' config.hardware.opentabletdriver.package "otd-daemon") pkgs.swaynotificationcenter pkgs.networkmanagerapplet -# aw-bundle + # aw-bundle # (pkgs.writeShellScriptBin "rmenu-cache-clear" "rm -r $HOME/.cache/rmenu") # invalidate rmenu cache on sway restart ]; extraConfig = ''