diff --git a/files/nix/raspi-hardware-configuration.nix b/files/nix/raspi-hardware-configuration.nix index 481461e8..d65521cf 100644 --- a/files/nix/raspi-hardware-configuration.nix +++ b/files/nix/raspi-hardware-configuration.nix @@ -1,9 +1,8 @@ # source: https://github.com/n8henrie/nixos-btrfs-pi/blob/856722b/nixos/hardware-configuration.nix # see https://github.com/NixOS/nixpkgs/blob/master/pkgs/misc/uboot/default.nix as well -{ - lib, - modulesPath, - ... +{ lib +, modulesPath +, ... }: { imports = [ (modulesPath + "/installer/scan/not-detected.nix") @@ -42,7 +41,7 @@ "/boot/firmware" = { device = "/dev/disk/by-label/FIRMWARE"; fsType = "vfat"; - options = ["nofail" "noauto"]; + options = [ "nofail" "noauto" ]; }; }; @@ -56,6 +55,6 @@ powerManagement.cpuFreqGovernor = lib.mkDefault - "ondemand"; + "ondemand"; } diff --git a/files/nix/run-in-vm.nix b/files/nix/run-in-vm.nix index bfaf42cb..efba8925 100644 --- a/files/nix/run-in-vm.nix +++ b/files/nix/run-in-vm.nix @@ -7,32 +7,32 @@ let # = configuration ( { lib, pkgs, ... }: -{ - systemd.network.enable = true; - systemd.services.sshd.wantedBy = lib.mkForce [ "multi-user.target" ]; + { + systemd.network.enable = true; + systemd.services.sshd.wantedBy = lib.mkForce [ "multi-user.target" ]; -} + } ) ]; }; in # https://github.com/NixOS/nixpkgs/blob/5061fe0c2c7743370e1d379d6fa60eed26ff1470/pkgs/misc/uboot/default.nix#L230 -# https://github.com/n8henrie/nixos-btrfs-pi/blob/master/flake.nix#L44 + # https://github.com/n8henrie/nixos-btrfs-pi/blob/master/flake.nix#L44 nixpkgs.writeScript "run-nixos-vm" '' - #!${nixpkgs.runtimeShell} + #!${nixpkgs.runtimeShell} - img=${evaluatedConfig.config.system.build.sdImage}/aarch64-qemu.img + img=${evaluatedConfig.config.system.build.sdImage}/aarch64-qemu.img - # https://wiki.qemu.org/Documentation/Platforms/ARM#Supported_Machines - # https://www.qemu.org/docs/master/system/arm/raspi.html - qemu-system-aarch64 \ - -M raspi2 \ - -m 1G \ - -smp 4 \ - -drive file="$img",format=raw \ - -kernel "${nixpkgs.ubootRaspberryPi2}/u-boot-rpi3.bin" \ - -device usb-net,netdev=net0 \ - -netdev user,id=net0,hostfwd=tcp::2222-:22 \ - -append "console=ttyAMA0 root=/dev/mmcblk0p2 rw rootwait" \ - -nographic - '' + # https://wiki.qemu.org/Documentation/Platforms/ARM#Supported_Machines + # https://www.qemu.org/docs/master/system/arm/raspi.html + qemu-system-aarch64 \ + -M raspi2 \ + -m 1G \ + -smp 4 \ + -drive file="$img",format=raw \ + -kernel "${nixpkgs.ubootRaspberryPi2}/u-boot-rpi3.bin" \ + -device usb-net,netdev=net0 \ + -netdev user,id=net0,hostfwd=tcp::2222-:22 \ + -append "console=ttyAMA0 root=/dev/mmcblk0p2 rw rootwait" \ + -nographic +'' diff --git a/flake.lock b/flake.lock index 4fa15e91..10d07c0a 100644 --- a/flake.lock +++ b/flake.lock @@ -1399,17 +1399,17 @@ }, "ghc-nixpkgs-unstable": { "locked": { - "lastModified": 1720393365, - "narHash": "sha256-tqagWw38sP0IXggMWHmkr1RY5xy4r3mFT7cnyz1hmnM=", + "lastModified": 1720494119, + "narHash": "sha256-IE7PZn9bSjxI4/MugjAEx49oPoxu0uKXdfC+X7HcRuQ=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "47c1824c261a343a6acca36d168a0a86f0e66292", + "rev": "05bbf675397d5366259409139039af8077d695ce", "type": "github" }, "original": { "owner": "NixOS", "repo": "nixpkgs", - "rev": "47c1824c261a343a6acca36d168a0a86f0e66292", + "rev": "05bbf675397d5366259409139039af8077d695ce", "type": "github" } }, @@ -1759,16 +1759,17 @@ "flake": false, "locked": { "dir": "bin", - "lastModified": 1725533767, - "narHash": "sha256-FMTAL4fSl3T2emGq5N9yOjdLEN8ou59hbcOZlwQQ7W0=", + "lastModified": 1706441426, + "narHash": "sha256-z1LvnuPKcV2jeW6K6diIuptwYbE8XkHCi8fLk9G/sfo=", "owner": "simonmichael", "repo": "hledger", - "rev": "e34fa491af88173e96b1e7948858821f8fa1d2ad", + "rev": "caeab172a825b14f251439ea30c58df5271ab924", "type": "github" }, "original": { "dir": "bin", "owner": "simonmichael", + "ref": "refs/tags/hledger-1.32.3", "repo": "hledger", "type": "github" } @@ -1777,16 +1778,17 @@ "flake": false, "locked": { "dir": "hledger/shell-completion", - "lastModified": 1725533767, - "narHash": "sha256-FMTAL4fSl3T2emGq5N9yOjdLEN8ou59hbcOZlwQQ7W0=", + "lastModified": 1706441426, + "narHash": "sha256-z1LvnuPKcV2jeW6K6diIuptwYbE8XkHCi8fLk9G/sfo=", "owner": "simonmichael", "repo": "hledger", - "rev": "e34fa491af88173e96b1e7948858821f8fa1d2ad", + "rev": "caeab172a825b14f251439ea30c58df5271ab924", "type": "github" }, "original": { "dir": "hledger/shell-completion", "owner": "simonmichael", + "ref": "refs/tags/hledger-1.32.3", "repo": "hledger", "type": "github" } diff --git a/flake.nix b/flake.nix index 837834a8..1695c854 100644 --- a/flake.nix +++ b/flake.nix @@ -26,13 +26,13 @@ nixos-2211-small.url = "github:NixOS/nixpkgs/nixos-22.11-small"; nixos-2311.url = "github:NixOS/nixpkgs/nixos-23.11"; - agenix-rekey = { - url = "github:oddlama/agenix-rekey"; - # Make sure to override the nixpkgs version to follow your flake, - # otherwise derivation paths can mismatch (when using storageMode = "derivation"), - # resulting in the rekeyed secrets not being found! - inputs.nixpkgs.follows = "nixpkgs"; - }; + agenix-rekey = { + url = "github:oddlama/agenix-rekey"; + # Make sure to override the nixpkgs version to follow your flake, + # otherwise derivation paths can mismatch (when using storageMode = "derivation"), + # resulting in the rekeyed secrets not being found! + inputs.nixpkgs.follows = "nixpkgs"; + }; # Firefox style penguin-fox = { @@ -42,7 +42,8 @@ # TODO Is this up-to-date for release-23.11 still ? ghc cached based on nixpkgs-unstable (i. e. https://lazamar.co.uk/nix-versions/?package=ghc&version=9.4.6&fullName=ghc-9.4.6&keyName=ghc&revision=9957cd48326fe8dbd52fdc50dd2502307f188b0d&channel=nixpkgs-unstable#instructions) # see how-to: https://discourse.nixos.org/t/cache-for-other-ghc-versions/18511 - ghc-nixpkgs-unstable.url = "github:NixOS/nixpkgs/47c1824c261a343a6acca36d168a0a86f0e66292"; #e1ee359d16a1886f0771cc433a00827da98d861c"; + # https://lazamar.co.uk/nix-versions/?package=hledger&version=1.32.3&fullName=hledger-1.32.3&keyName=haskellPackages.hledger&revision=05bbf675397d5366259409139039af8077d695ce&channel=nixpkgs-unstable#instructions + ghc-nixpkgs-unstable.url = "github:NixOS/nixpkgs/05bbf675397d5366259409139039af8077d695ce"; #e1ee359d16a1886f0771cc433a00827da98d861c"; libreoffice-postscript.url = "github:NixOS/nixpkgs/eb090f7b923b1226e8beb954ce7c8da99030f4a8"; @@ -72,9 +73,9 @@ flake = false; }; - zen-browser = { - url = "github:MarceColl/zen-browser-flake"; - inputs.nixpkgs.follows = "nixos-unstable"; # nixos-unstable + zen-browser = { + url = "github:MarceColl/zen-browser-flake"; + inputs.nixpkgs.follows = "nixos-unstable"; # nixos-unstable }; catppuccin = { @@ -158,12 +159,12 @@ "hledger-completion.bash" = { flake = false; - url = "github:simonmichael/hledger?dir=hledger/shell-completion"; + url = "github:simonmichael/hledger?ref=refs/tags/hledger-1.32.3&dir=hledger/shell-completion"; }; hledger-bin = { flake = false; - url = "github:simonmichael/hledger?dir=bin"; + url = "github:simonmichael/hledger?ref=refs/tags/hledger-1.32.3&dir=bin"; }; fsread-nvim = { @@ -404,8 +405,12 @@ let rootPath = self; forEachSystem = nixpkgs.lib.genAttrs [ "aarch64-linux" "x86_64-linux" ]; - flakeLib = import ./flake { - inherit inputs rootPath forEachSystem; + /** + "includes" ./flake/default.nix (function) and provides it the attributes `inputs rootPath forEachSystem` from "environment" as parameters + */ + flakeLib = import ./flake /* /default.nix */ { + inherit inputs rootPath /*specialArgs*/ forEachSystem; + #inherit (nixpkgs.pkgs.stdenv.hostPlatform) system; }; formatterPackArgsFor = forEachSystem (system: { @@ -426,11 +431,30 @@ }); - inherit (nixpkgs.lib) listToAttrs; + inherit (nixpkgs.lib) listToAttrs attrValues; inherit (flakeLib) mkApp mkHome mkNixOnDroid mkNixos mkDevenvJvmLang mkDevenvDeno mkDevenvFlutter mkDevenvOcaml mkDevenvRust mkDevenvMachnix mkDevenvJupyenv mkDevenvRuby mkDevenvHaskell mkDevenvRustWasm32; + # NOTE https://discourse.nixos.org/t/installing-only-a-single-package-from-unstable/5598/30 + # and https://discourse.nixos.org/t/add-an-option-to-home-manager-as-a-nixos-module-using-flake/38731/4 + # and https://discourse.nixos.org/t/how-do-specialargs-work/50615/4 + # and https://discourse.nixos.org/t/access-inputs-via-specialargs-in-mkshell/51905/5 + /** + "Used" like this: `specialArgs.${system}` + */ + specialArgs = forEachSystem (system: { + inherit system; + nixpkgs = inputs.nixpkgs.legacyPackages.${system}; + latest = inputs.latest.legacyPackages.${system}; + unstable = inputs.unstable.legacyPackages.${system}; + libreoffice-postscript = inputs.libreoffice-postscript.legacyPackages.${system}; + haskellPackages = inputs.ghc-nixpkgs-unstable.legacyPackages.${system}.haskell.packages.ghc965; + ghc-nixpkgs-unstable = inputs.ghc-nixpkgs-unstable.legacyPackages.${system}; + }); in { homeConfigurations = listToAttrs [ + /** + calls `mkHome` as defined in ./flake/default.nix (`[system]` and `[name]` parameters) and ./flake/builders/mkHome.nix, latter the place where `extraSpecialArgs` would also go + */ (mkHome "aarch64-linux" "u0_a210@localhost") (mkHome "x86_64-linux" "dani@maiziedemacchiato") ]; @@ -444,19 +468,19 @@ (mkNixos "aarch64-linux" "twopi") ]; - # Expose the necessary information in your flake so agenix-rekey - # knows where it has too look for secrets and paths. - # - # Make sure that the pkgs passed here comes from the same nixpkgs version as - # the pkgs used on your hosts in `nixosConfigurations`, otherwise the rekeyed - # derivations will not be found! - # TODO get used to handling first, see example at https://github.com/oddlama/agenix-rekey/pull/28#issue-2331901837 - agenix-rekey = inputs.agenix-rekey.configure { - userFlake = self; - nodes = self.nixosConfigurations; - # Example for colmena: - # inherit ((colmena.lib.makeHive self.colmena).introspect (x: x)) nodes; - }; + # Expose the necessary information in your flake so agenix-rekey + # knows where it has too look for secrets and paths. + # + # Make sure that the pkgs passed here comes from the same nixpkgs version as + # the pkgs used on your hosts in `nixosConfigurations`, otherwise the rekeyed + # derivations will not be found! + # TODO get used to handling first, see example at https://github.com/oddlama/agenix-rekey/pull/28#issue-2331901837 + agenix-rekey = inputs.agenix-rekey.configure { + userFlake = self; + nodes = self.nixosConfigurations; + # Example for colmena: + # inherit ((colmena.lib.makeHive self.colmena).introspect (x: x)) nodes; + }; apps = forEachSystem (system: (listToAttrs [ @@ -540,12 +564,36 @@ (mkApp system "nixos-shell" { file = ./files/apps/nixos-shell.sh; - path = pkgs: with pkgs; [ nixos-shell gawk jq git ]; + path = pkgs: attrValues { #pkgs: with pkgs; [ + inherit (pkgs) + nixos-shell + gawk + jq + git + ; + }; }) (mkApp system "setup" { file = ./files/apps/setup.sh; - path = pkgs: with pkgs; [ coreutils curl git gnugrep hostname jq nixVersions.nix_2_19 openssh ]; + path = pkgs: attrValues { + #pkgs: with pkgs; [ + inherit + (pkgs) + coreutils + curl + git + gnugrep + hostname + jq + openssh + ; + inherit + (nixpkgs.nixVersions) + nix_2_20 + ; + }; + envs._doNotClearPath = true; }) @@ -563,20 +611,20 @@ buildInputs = [ pkgs.git self.nixosConfigurations.DANIELKNB1.pkgs.neovim ]; } '' - mkdir -p "$out" + mkdir -p "$out" # prevent E886 ('/home-shelter' error) - export HOME=$TMPDIR - # presumes prior devenv shell run in ~/debugpy-devshell/, https://github.com/mfussenegger/nvim-dap-python/blob/408186a/README.md#debugpy - export VIRTUAL_ENV=/home/dkahlenberg/debugpy-devshell/.devenv/state/venv - nvim --headless +":scriptnames | q" 2> "$out/nvim.log" + export HOME=$TMPDIR + # presumes prior devenv shell run in ~/debugpy-devshell/, https://github.com/mfussenegger/nvim-dap-python/blob/408186a/README.md#debugpy + export VIRTUAL_ENV=/home/dkahlenberg/debugpy-devshell/.devenv/state/venv + nvim --headless +":scriptnames | q" 2> "$out/nvim.log" if [ -n "$(cat "$out/nvim.log")" ]; then - echo "output: "$(cat "$out/nvim.log")"" - exit 1 - fi + echo "output: "$(cat "$out/nvim.log")"" + exit 1 + fi ''; - */ + */ }); # use like: @@ -588,7 +636,7 @@ value = inputs.nixd.devShells.${system}.default; } ( - # TODO integrate sample files as in https://discourse.nixos.org/t/running-playwright-tests/25655/35 or in https://discourse.nixos.org/t/running-playwright-tests/25655/33 + # TODO integrate sample files as in https://discourse.nixos.org/t/running-playwright-tests/25655/35 or in https://discourse.nixos.org/t/running-playwright-tests/25655/33 let pkgs = inputs.nixpkgs.legacyPackages.${system}; in @@ -629,7 +677,8 @@ ) ( let - pkgs = inputs.unstable.legacyPackages.${system}; + inherit (specialArgs.${system}) unstable; + pkgs = unstable; in { # TODO https://github.com/thenbe/neotest-playwright for configuration @@ -638,7 +687,18 @@ inherit inputs pkgs; modules = [ ({ pkgs, ... }: { - packages = with pkgs;[ nodejs playwright-test playwright-driver.browsers ]; + packages = builtins.attrValues { + inherit + (unstable) + nodejs + playwright-test + ; + + inherit + (unstable.playwright-driver) + browsers + ; + }; env.PLAYWRIGHT_BROWSERS_PATH = "${pkgs.playwright-driver.browsers}"; env.PLAYWRIGHT_NODEJS_PATH = "${pkgs.nodejs}/bin/node"; env.PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD = 1; @@ -711,10 +771,14 @@ }; pythonShell = let - pkgs = inputs.unstable.legacyPackages.${system}; #import inputs.unstable { inherit system; }; + inherit (specialArgs.${system}) unstable; + pkgs = unstable; # see https://discourse.nixos.org/t/help-using-poetry-in-a-flake-devshell/36874/3 - mypython = pkgs.python311.withPackages (p: with p; [ - sqlglot + mypython = pkgs.python311.withPackages (pythonPackageSet: attrValues {#p: with p; [ + inherit + # see https://discourse.flox.dev/t/questions-around-using-this-with-python-packages/665/6 + (pythonPackageSet) + sqlglot # https://medium.com/social-impact-analytics/extract-text-from-unsearchable-pdfs-for-data-analysis-using-python-a6a2ca0866dd pymupdf pdf2image @@ -723,27 +787,43 @@ ocrmypdf pandas numpy - ]); + ; + }); in pkgs.mkShell { packages = [ mypython ]; }; agda = let - pkgs = inputs.ghc-nixpkgs-unstable.legacyPackages.${system}; #import inputs.ghc-nixpkgs-unstable { inherit system; }; + inherit + (specialArgs.${system}) + ghc-nixpkgs-unstable + haskellPackages + ; + pkgs = ghc-nixpkgs-unstable; myagda = (pkgs.agdaPackages.override { - Agda = pkgs.haskellPackages.Agda.overrideAttrs { }; - }).agda.withPackages (p: with p; [ standard-library ]); + Agda = haskellPackages.Agda.overrideAttrs { }; + }).agda.withPackages (agdaPackageSet: builtins.attrValues { + inherit + (agdaPackageSet) + standard-library + ; + }); in pkgs.mkShell { packages = [ myagda ]; }; # https://github.com/NixOS/nixpkgs/blob/9e860e4/pkgs/development/lisp-modules/shell.nix - clShell = let pkgs = inputs.unstable.legacyPackages.${system}; in #import inputs.unstable { inherit system; }; in + clShell = let + inherit (specialArgs.${system}) unstable; + pkgs = unstable; + in pkgs.mkShell { nativeBuildInputs = [ - (pkgs.sbcl.withPackages - (ps: with ps; [ + (pkgs.sbcl.withPackages + (sbclPackageSet: builtins.attrValues { + inherit + (sbclPackageSet) alexandria str dexador @@ -751,13 +831,15 @@ sqlite arrow-macros jzon - ])) + ; + })) ]; }; # https://github.com/tweag/ormolu/blob/74887f00137d6cd91811440325c3ac330a371b2c/ormolu-live/default.nix ghcWasmShell = let - pkgs = inputs.unstable.legacyPackages.${system}; #import inputs.unstable { inherit system; }; + inherit (specialArgs.${system}) nixpks; + pkgs = nixpks; in pkgs.mkShell { packages = [ inputs.ghc-wasm-meta.packages.${system}.all_9_8 ]; @@ -765,24 +847,24 @@ # try https://github.com/cachix/devenv/issues/585 haskellShell = let + inherit (specialArgs.${system}) unstable haskellPackages nixpks; + pkgs = nixpkgs; hiPrio = pkg: pkgs.lib.updateManyAttrsByPath (builtins.map (output: { path = [ output ]; update = pkgs.hiPrio; }) pkg.outputs) pkg; - pkgs = inputs.ghc-nixpkgs-unstable.legacyPackages.${system}; #import inputs.ghc-nixpkgs-unstable { inherit system; }; - stack = hiPrio (inputs.unstable.legacyPackages.${system}.stack); in inputs.devenv.lib.mkShell rec { inherit inputs pkgs; modules = [ - ({ pkgs, ... }: + ({ ... }: { packages = [ (inputs.ghciwatch.packages.${system}.default) - stack # still the stack from ghc-nixpkgs-unstable seemingly - pkgs.hledger + (hiPrio (unstable.stack)) # still the stack from ghc-nixpkgs-unstable seemingly + haskellPackages.hledger ]; languages.haskell = { enable = true; - package = pkgs.haskell.packages.ghc965.ghcWithHoogle (pset: with pset; [ + package = haskellPackages.ghcWithHoogle (haskellPackageSet: attrValues {#pset: with pset; [ # libraries #zlib #arrows @@ -791,10 +873,13 @@ #criterion # tools #cabal-install - shake + inherit + (haskellPackageSet) + shake # see this also: https://nixos.wiki/wiki/Haskell#Using_Stack_.28no_nix_caching.29 # stack # stack of ghc-nixpkgs-unstable is too old - ]); + ; + }); }; }) ]; @@ -817,11 +902,10 @@ in pkgs.mkShell { buildInputs = - [ - pkgs.python310 - #pkgs.python38Packages.pytorch - pkgs.python310Packages.pytorch-bin - ]; + builtins.attrValues { + inherit (pkgs) python310; + inherit (pkgs.python310Packages) pytorch-bin; + }; shellHook = '' export LD_LIBRARY_PATH=/usr/lib/wsl/lib @@ -829,12 +913,19 @@ }; yaocaml = let - pkgs = inputs.unstable.legacyPackages.${system}; #import inputs.unstable { inherit system; }; + inherit (specialArgs.${system}) unstable; + pkgs = unstable; in pkgs.mkShell { - packages = with pkgs; [ ocaml ocamlformat opam ] ++ - (with pkgs.ocamlPackages; [ - ocaml + packages = builtins.attrValues { + inherit + (pkgs) + ocaml + ocamlformat + opam + ; + inherit + (pkgs.ocamlPackages) findlib dune_3 odoc @@ -842,11 +933,15 @@ merlin utop ocp-indent - janeStreet.async - janeStreet.base - janeStreet.core_unix - janeStreet.ppx_let - ]); + ; + inherit + (pkgs.ocamlPackages.janeStreet) + #async + base + core_unix + ppx_let + ; + }; }; })); diff --git a/flake/builders/mkDevenvHaskell.nix b/flake/builders/mkDevenvHaskell.nix index 54a363ad..e7e41167 100644 --- a/flake/builders/mkDevenvHaskell.nix +++ b/flake/builders/mkDevenvHaskell.nix @@ -1,8 +1,9 @@ -{ system, pkgsFor, inputs, name, args, ... }: +{ system, pkgsFor, inputs, specialArgs, name, args, ... }: let pkgs = pkgsFor.${system}; inherit (inputs.devenv.lib) mkShell; + inherit (specialArgs.${system}) haskellPackages; in mkShell rec { inherit inputs pkgs; @@ -10,7 +11,7 @@ mkShell rec { ({ pkgs, ... }: let myHaskellPackages = - inputs.ghc-nixpkgs-unstable.legacyPackages.${system}.haskell.packages.ghc946.override (old: { + haskellPackages.override (old: { overrides = pkgs.lib.composeExtensions (old.overrides or (_: _: { })) (hself: hsuper: { ghc = hsuper.ghc // { withPackages = hsuper.ghc.withHoogle; }; diff --git a/flake/builders/mkHome.nix b/flake/builders/mkHome.nix index fad851dd..4c01f0a7 100644 --- a/flake/builders/mkHome.nix +++ b/flake/builders/mkHome.nix @@ -8,11 +8,20 @@ let hostname = builtins.elemAt splittedName 1; in +/** +see also ./../../lib/common-config.nix `homeManager.baseConfig.extraSpecialArgs` there and `homeManager.userConfig` +*/ inputs.home-manager.lib.homeManagerConfiguration { pkgs = pkgsFor.${system}; + /** + as in ./../../lib/common-config.nix `homeManager.baseConfig.extraSpecialArgs` + */ extraSpecialArgs = { inherit inputs rootPath; }; modules = [ + /** + as in ./../../lib/common-config.nix `homeManager.userConfig` + */ "${rootPath}/hosts/${hostname}/home-${username}.nix" ] ++ homeModulesFor.${system}; diff --git a/flake/builders/mkNixos.nix b/flake/builders/mkNixos.nix index 9cd42727..0c722d0e 100644 --- a/flake/builders/mkNixos.nix +++ b/flake/builders/mkNixos.nix @@ -3,15 +3,37 @@ inputs.nixpkgs.lib.nixosSystem { inherit system; + /** + see ./../../flake.nix attribute `specialArgs` and `flakeLib` + + IDEA inject `specialArgs` there get from this functions (./mkNixos.nix) parameters and attach here via `// specialArgs` + */ specialArgs = { inherit inputs rootPath; homeModules = homeModulesFor.${system}; }; modules = [ + /** + anything in `specialArgs` should be available via i. e. ./../../hosts/DANIELKNB1/configuration.nix function's parameters set, i. e. `{ ..., unstable, ... }:` when `unstable =` declared in `specialArgs` + */ "${rootPath}/hosts/${name}/configuration.nix" "${rootPath}/hosts/${name}/hardware-configuration.nix" + /** + IDEA: This is just an anonymous module, so it might be possible to prefix it with it's own parameter set, just as in + + ```nix + { inputs, rootPath, system, pkgsFor, customLibFor, homeModulesFor, name, , ... }: + { + _file = ./mkNixos.nix; + + ... + } + ``` + + What I don't know yet if this would just be redundant to just using ./mkNixos.nix's header ? + */ { _file = ./mkNixos.nix; diff --git a/flake/default.nix b/flake/default.nix index 40d8d753..c18fa85f 100644 --- a/flake/default.nix +++ b/flake/default.nix @@ -19,6 +19,27 @@ let ++ customLibFor.${system}.listNixFilesRecursive "${rootPath}/home" ); + /** + + # Example + + ```nix + mkApp = wrapper ./builders/mkApp.nix + ``` + + A function (i. e. `mkApp` or `mkHome`) declared like that might be called like: + + ```nix + mkHome "x86_64-linux" "dani@maiziedemacchiato" + ``` + + # Arguments + + - [builder] Path of a nix file + - [system] String describing the system to build attribute set for (i. e. `"aarch64-linux"`) + - [name] String to name the config for example i. e. `dani@maiziedemacchiato`, see `homeConfigurations` in flake.nix + - [args] Attribute set of further arguments + */ wrapper = builder: system: name: args: inputs.nixpkgs.lib.nameValuePair name @@ -26,6 +47,9 @@ let inherit inputs rootPath system pkgsFor pkgsNixOnDroidFor customLibFor homeModulesFor name args; }); + /** + wraps `wrapper` simplified in a manner that `wrapper`'s parameter `args` is an empty attribute set (`{}`) + */ simpleWrapper = builder: system: name: wrapper builder system name { }; in diff --git a/flake/nixpkgs.nix b/flake/nixpkgs.nix index e6e9ac87..c2cb987d 100644 --- a/flake/nixpkgs.nix +++ b/flake/nixpkgs.nix @@ -26,17 +26,15 @@ import inputs.nixpkgs { let inherit (prev.stdenv.hostPlatform) system; inherit (prev.lib) remove flatten; - inherit (prev.lib.attrsets) genAttrs; + inherit (prev.lib.attrsets) genAttrs; # inherit rootPath; - unstable = inputs.unstable.legacyPackages.${system}; - #import inputs.unstable { inherit config system; }; + #unstable = inputs.unstable.legacyPackages.${system}; + #import inputs.unstable { inherit config system; }; - latest = inputs.latest.legacyPackages.${system}; #import inputs.latest { inherit config system; }; #import inputs.nixos-2305 { inherit config system; }; - nixos-2311 = inputs.nixos-2311.legacyPackages.${system}; - #import inputs.nixos-2311 { inherit config system; }; #import inputs.ghc-nixpkgs-unstable { inherit config system; }; + #import inputs.nixos-2311 { inherit config system; }; #import inputs.ghc-nixpkgs-unstable { inherit config system; }; -# nixos-2211 = inputs.nixos-2211.legacyPackages.${system}; #import inputs.nixos-2211 { inherit config system; }; #import inputs.ghc-nixpkgs-unstable { inherit config system; }; + # nixos-2211 = inputs.nixos-2211.legacyPackages.${system}; #import inputs.nixos-2211 { inherit config system; }; #import inputs.ghc-nixpkgs-unstable { inherit config system; }; # TODO https://github.com/onekey-sec/unblob/blob/4e900ff/flake.nix#L21 moreOverlays = (map (x: x.overlays.default) [ @@ -46,115 +44,53 @@ import inputs.nixpkgs { in { - inherit (latest) csvlens; - inherit (unstable) tailscale oxker cachix/*nixVersions*/ eza mermaid-cli scrcpy yazi powerline-rs pwvucontrol gscan2pdf htmx-lsp/* for nixvim */ gtt nixd docker_25 age-plugin-yubikey; - #inherit (nixos-2311) ; - inherit (unstable.cudaPackages) cudatoolkit; - inherit (inputs.libreoffice-postscript.legacyPackages.${system}) libreoffice; - inherit (inputs.ghc-nixpkgs-unstable.legacyPackages.${system}.haskell.packages.ghc965) arbtt; - # see https://github.com/NixOS/nixpkgs/issues/271989, I think this comes down to not having the correct udev rules in place # on the host os for the home-manager managed nix, thus on a non-nixos currently (release-23-11) there is no scanner # detected # simple-scan (v42.5) from nixos-22.11 seems to work with sane from arch linux # also simple-scan (v44.0) from nixos-23.11 does NOT seem to work with sane from arch linux # there is still the problem of crashing (https://github.com/NixOS/nixpkgs/issues/271991), which will not fixed for that v42.5 which would mean being stuck at it with oom bug, so maybe rather use arch linux' simple-scan also until the scanner missing bug (https://github.com/NixOS/nixpkgs/issues/271989) is sorted out as well. -# inherit (nixos-2211) simple-scan/*sane-backends*/; # nixos-23.11 Scanner not found + # inherit (nixos-2211) simple-scan/*sane-backends*/; # nixos-23.11 Scanner not found git-issue = inputs.git-issue; - # FIXME is workaround until upstream has the PR accepted, see https://github.com/nix-community/NixOS-WSL/issues/262#issuecomment-1825648537 - wsl-vpnkit = - let inherit (unstable) - lib - findutils - pstree - resholve - wsl-vpnkit; - in - wsl-vpnkit.override { - resholve = - resholve - // { - mkDerivation = attrs @ { solutions, ... }: - resholve.mkDerivation (lib.recursiveUpdate attrs { - src = inputs.wsl-vpnkit; - - solutions.wsl-vpnkit = { - inputs = - solutions.wsl-vpnkit.inputs - ++ [ - findutils - pstree - ]; - - execer = - solutions.wsl-vpnkit.execer - ++ [ "cannot:${pstree}/bin/pstree" ]; - }; - }); - }; - }; - - openai-whisper = + /*openai-whisper = let inherit (latest) openai-whisper; in openai-whisper.override { torch = prev.python3.pkgs.torch-bin; - }; + };*/ - # TODO https://matrix.to/#/!RRerllqmbATpmbJgCn:nixos.org/$mP53sN976wEgmMCKeM5JWPABO1lh17x7ucXtgKp1cWY?via=nixos.org&via=matrix.org&via=tchncs.de https://nixpk.gs/pr-tracker.html?pr=239005 (https://discourse.nixos.org/t/a-nixpkgs-pr-tracker-with-pure-front-end/50096) + # TODO https://matrix.to/#/!RRerllqmbATpmbJgCn:nixos.org/$mP53sN976wEgmMCKeM5JWPABO1lh17x7ucXtgKp1cWY?via=nixos.org&via=matrix.org&via=tchncs.de https://nixpk.gs/pr-tracker.html?pr=239005 (https://discourse.nixos.org/t/a-nixpkgs-pr-tracker-with-pure-front-end/50096) - # fix pam-service in xsecurelock, see https://git.rauhala.info/MasseR/temp-fix-xsecurelock/commit/129fcc5eb285ece0f7c414b42bef6281fc4edc42 - # https://github.com/google/xsecurelock/issues/102#issuecomment-621432204 - xsecurelock = - prev.xsecurelock.overrideAttrs - # simply replacing the configureFlags rn - (oldAttrs: { configureFlags = (remove "--with-pam-service-name=login" (flatten oldAttrs.configureFlags)) ++ [ "--with-pam-service-name=system_auth" ]; }); # if doesn't work, try --with-pam-service-name=authproto_pam here or ...=common_auth or ...system-local-login, https://github.com/google/xsecurelock/blob/8a448bd/README.md#installation and https://sourcegraph.com/search?q=context%3Aglobal+content%3A--with-pam-service-name&patternType=standard&sm=1&groupBy=repo #yt-dlp = # prev.yt-dlp.overrideAttrs # { src = inputs.yt-dlp; }; # > Checking runtime dependencies for yt_dlp-2024.5.27-py3-none-any.whl - # > - requests<3,>=2.32.2 not satisfied by version 2.31.0 + # > - requests<3,>=2.32.2 not satisfied by version 2.31.0 - emacsPackages = - prev.emacsPackages - // { - inherit - (unstable.emacsPackages) - mistty - ; - }; - cudaPackages = - prev.cudaPackages - // { - inherit - (unstable.cudaPackages) - cudatoolkit - ; - }; # DONE [gist] For later ref - override to i. e. nix_2_13 - see https://github.com/Gerschtli/nix-config/commit/da486994d122eb4e64a8b7940e9ef3469b44e06c#diff-3bcbef26c40d018f46094799af27a3698c921aa094bb2bffdaac77266c90ec21L64 - nixVersions = + /*nixVersions = prev.nixVersions // { inherit (unstable.nixVersions) latest; - }; + };*/ - vimUtils = + /*vimUtils = prev.vimUtils // { inherit (unstable.vimUtils) buildVimPlugin ; - }; + };*/ - desed = final.callPackage "${rootPath}/drvs/desed" { }; + desed = final.callPackage "${rootPath}/drvs/desed" { }; - devenv = inputs.devenv.packages.${system}.devenv; + devenv = inputs.devenv.packages.${system}.devenv; somemore = prev.lib.composeManyExtensions moreOverlays final prev; @@ -176,7 +112,7 @@ import inputs.nixpkgs { ]) ++ inputs.nixpkgs.lib.optionals nixOnDroid [ inputs.nix-on-droid.overlays.default - # prevent uploads to remote builder + # prevent uploads to remote builder, https://ryantm.github.io/nixpkgs/functions/prefer-remote-fetch (final: prev: prev.prefer-remote-fetch final prev) ]; } diff --git a/home/base/desktop.nix b/home/base/desktop.nix index 8f3da453..e2c6091e 100644 --- a/home/base/desktop.nix +++ b/home/base/desktop.nix @@ -1,3 +1,6 @@ +/** +Parameter `[inputs]` here is a deviation from the orinal author's intent (doing that via overlay) and should maybe be fixed +*/ { config, lib, pkgs, inputs, ... }: let @@ -6,6 +9,11 @@ let mkIf attrValues ; +/** +Attribute `system` here is determined that way (`inherit (pkgs.stdenv.hostPlatform) system;`) to make later use of parameter `[inputs]` here in this file (./../../home/base/desktop.nix), which is a deviation from the orinal author's intent (there an overlay is used to determine derivations from inputs, the intention of which is fine to narrow down `system` use to flake-related nix files I guess). + +If I want to rid overlays I might have to find a way with less potentially bad implications, IDK are there any ? +*/ inherit (pkgs.stdenv.hostPlatform) system; cfg = config.custom.base.desktop; @@ -32,14 +40,6 @@ let fixGL = true; }; - anbox = config.lib.custom.wrapProgram { - name = "anbox-application-manager"; - desktopFileName = "anbox-application-manager"; - source = pkgs.anbox; # needs unfree: inputs.google-chrome.packages.${system}.google-chrome-dev; # pkgs.google-chrome; - path = "/bin/anbox-application-manager"; - fixGL = true; - }; - # different approach here: https://pmiddend.github.io/posts/nixgl-on-ubuntu ausweisapp = config.lib.custom.wrapProgram { name = "ausweisapp"; @@ -55,13 +55,6 @@ let fixGL = true; }; - spotify = config.lib.custom.wrapProgram { - name = "spotify"; - source = pkgs.spotify; - path = "/bin/spotify"; - fixGL = true; - }; - /* mpv = config.lib.custom.wrapProgram { name = "mpv"; @@ -149,130 +142,124 @@ in facebook-container private-relay browserpass - keepassxc-browser + keepassxc-browser ]; - # as in https://github.com/gvolpe/nix-config/blob/6feb7e4f47e74a8e3befd2efb423d9232f522ccd/home/programs/browsers/firefox.nix (https://discourse.nixos.org/t/declare-firefox-extensions-and-settings/36265/21) - # ~/.mozilla/firefox/PROFILE_NAME/prefs.js | user.js - # FIXME https://github.com/toonn/nix-config/blob/master/home/ff-webgl-userjs.nixos - # FIXME https://github.com/toonn/nix-config/blob/a3877b34ec7d8ce3fda6cd33cf5cad3617103272/home/home.nix#L150 - settings = { - "app.normandy.first_run" = false; - "app.shield.optoutstudies.enabled" = false; + # as in https://github.com/gvolpe/nix-config/blob/6feb7e4f47e74a8e3befd2efb423d9232f522ccd/home/programs/browsers/firefox.nix (https://discourse.nixos.org/t/declare-firefox-extensions-and-settings/36265/21) + # ~/.mozilla/firefox/PROFILE_NAME/prefs.js | user.js + # FIXME https://github.com/toonn/nix-config/blob/master/home/ff-webgl-userjs.nixos + # FIXME https://github.com/toonn/nix-config/blob/a3877b34ec7d8ce3fda6cd33cf5cad3617103272/home/home.nix#L150 + settings = { + "app.normandy.first_run" = false; + "app.shield.optoutstudies.enabled" = false; - # disable updates (pretty pointless with nix) - "app.update.channel" = "default"; + # disable updates (pretty pointless with nix) + "app.update.channel" = "default"; - "browser.contentblocking.category" = "standard"; # "strict" - "browser.ctrlTab.recentlyUsedOrder" = false; + "browser.contentblocking.category" = "standard"; # "strict" + "browser.ctrlTab.recentlyUsedOrder" = false; - "browser.download.useDownloadDir" = false; - "browser.download.viewableInternally.typeWasRegistered.svg" = true; - "browser.download.viewableInternally.typeWasRegistered.webp" = true; - "browser.download.viewableInternally.typeWasRegistered.xml" = true; + "browser.download.useDownloadDir" = false; + "browser.download.viewableInternally.typeWasRegistered.svg" = true; + "browser.download.viewableInternally.typeWasRegistered.webp" = true; + "browser.download.viewableInternally.typeWasRegistered.xml" = true; - "browser.link.open_newwindow" = true; + "browser.link.open_newwindow" = true; - #"browser.search.region" = "PL"; - "browser.search.widget.inNavBar" = true; + #"browser.search.region" = "PL"; + "browser.search.widget.inNavBar" = true; - "browser.shell.checkDefaultBrowser" = false; - "browser.startup.homepage" = "https://nixos.org"; - "browser.tabs.loadInBackground" = true; - "browser.urlbar.placeholderName" = "DuckDuckGo"; - #"browser.urlbar.showSearchSuggestionsFirst" = false; + "browser.shell.checkDefaultBrowser" = false; + "browser.startup.homepage" = "https://nixos.org"; + "browser.tabs.loadInBackground" = true; + "browser.urlbar.placeholderName" = "DuckDuckGo"; + #"browser.urlbar.showSearchSuggestionsFirst" = false; - # disable all the annoying quick actions - #"browser.urlbar.quickactions.enabled" = false; - #"browser.urlbar.quickactions.showPrefs" = false; - #"browser.urlbar.shortcuts.quickactions" = false; - #"browser.urlbar.suggest.quickactions" = false; + # disable all the annoying quick actions + #"browser.urlbar.quickactions.enabled" = false; + #"browser.urlbar.quickactions.showPrefs" = false; + #"browser.urlbar.shortcuts.quickactions" = false; + #"browser.urlbar.suggest.quickactions" = false; - "distribution.searchplugins.defaultLocale" = "en-US"; + "distribution.searchplugins.defaultLocale" = "en-US"; - "doh-rollout.balrog-migration-done" = true; - "doh-rollout.doneFirstRun" = true; + "doh-rollout.balrog-migration-done" = true; + "doh-rollout.doneFirstRun" = true; - "dom.forms.autocomplete.formautofill" = false; + "dom.forms.autocomplete.formautofill" = false; - "general.autoScroll" = true; - "general.useragent.locale" = "en-US"; + "general.autoScroll" = true; + "general.useragent.locale" = "en-US"; - "extensions.activeThemeID" = "firefox-alpenglow@mozilla.org"; + "extensions.activeThemeID" = "firefox-alpenglow@mozilla.org"; - "extensions.extensions.activeThemeID" = "firefox-alpenglow@mozilla.org"; - "extensions.update.enabled" = false; - "extensions.webcompat.enable_picture_in_picture_overrides" = true; - "extensions.webcompat.enable_shims" = true; - "extensions.webcompat.perform_injections" = true; - "extensions.webcompat.perform_ua_overrides" = true; + "extensions.extensions.activeThemeID" = "firefox-alpenglow@mozilla.org"; + "extensions.update.enabled" = false; + "extensions.webcompat.enable_picture_in_picture_overrides" = true; + "extensions.webcompat.enable_shims" = true; + "extensions.webcompat.perform_injections" = true; + "extensions.webcompat.perform_ua_overrides" = true; - "print.print_footerleft" = ""; - "print.print_footerright" = ""; - "print.print_headerleft" = ""; - "print.print_headerright" = ""; + "print.print_footerleft" = ""; + "print.print_footerright" = ""; + "print.print_headerleft" = ""; + "print.print_headerright" = ""; - "privacy.donottrackheader.enabled" = true; + "privacy.donottrackheader.enabled" = true; - # Yubikey - "security.webauth.u2f" = true; - "security.webauth.webauthn" = true; - "security.webauth.webauthn_enable_softtoken" = true; - "security.webauth.webauthn_enable_usbtoken" = true; + # Yubikey + "security.webauth.u2f" = true; + "security.webauth.webauthn" = true; + "security.webauth.webauthn_enable_softtoken" = true; + "security.webauth.webauthn_enable_usbtoken" = true; - "toolkit.legacyUserProfileCustomizations.stylesheets" = true; - } // { "layout.css.devPixelsPerPx" = "-1.0"; }; + "toolkit.legacyUserProfileCustomizations.stylesheets" = true; + } // { "layout.css.devPixelsPerPx" = "-1.0"; }; - userChrome = lib.readFile "${inputs.penguin-fox}/files/chrome/userChrome.css"; + userChrome = lib.readFile "${inputs.penguin-fox}/files/chrome/userChrome.css"; userContent = lib.readFile "${inputs.penguin-fox}/files/chrome/userContent.css"; }; package = pkgs.wrapFirefox pkgs.firefox-unwrapped { - # as in https://discourse.nixos.org/t/combining-best-of-system-firefox-and-home-manager-firefox-settings/37721 - extraPolicies = { - DisableTelemetry = true; - DisableFirefoxStudies = true; - DontCheckDefaultBrowser = true; - #DisablePocket = true; - SearchBar = "unified"; - - Preferences = let - lock-false = { - Value = false; - Status = "locked"; - }; - lock-true = { - Value = true; - Status = "locked"; - }; - lock-empty-string = { - Value = ""; - Status = "locked"; - }; -in { - # Privacy settings - #"extensions.pocket.enabled" = lock-false; - #"browser.newtabpage.pinned" = lock-empty-string; - "browser.topsites.contile.enabled" = lock-false; - "browser.newtabpage.activity-stream.showSponsored" = lock-false; - "browser.newtabpage.activity-stream.system.showSponsored" = lock-false; - "browser.newtabpage.activity-stream.showSponsoredTopSites" = lock-false; - }; - - ExtensionSettings = { - "uBlock0@raymondhill.net" = { - install_url = "https://addons.mozilla.org/firefox/downloads/latest/ublock-origin/latest.xpi"; - installation_mode = "force_installed"; - }; - "jid1-MnnxcxisBPnSXQ@jetpack" = { - install_url = "https://addons.mozilla.org/firefox/downloads/latest/privacy-badger17/latest.xpi"; - installation_mode = "force_installed"; + # as in https://discourse.nixos.org/t/combining-best-of-system-firefox-and-home-manager-firefox-settings/37721 + extraPolicies = { + DisableTelemetry = true; + DisableFirefoxStudies = true; + DontCheckDefaultBrowser = true; + #DisablePocket = true; + SearchBar = "unified"; + + Preferences = + let + lock-false = { + Value = false; + Status = "locked"; + }; + in + { + # Privacy settings + #"extensions.pocket.enabled" = lock-false; + #"browser.newtabpage.pinned" = lock-empty-string; + "browser.topsites.contile.enabled" = lock-false; + "browser.newtabpage.activity-stream.showSponsored" = lock-false; + "browser.newtabpage.activity-stream.system.showSponsored" = lock-false; + "browser.newtabpage.activity-stream.showSponsoredTopSites" = lock-false; + }; + + ExtensionSettings = { + "uBlock0@raymondhill.net" = { + install_url = "https://addons.mozilla.org/firefox/downloads/latest/ublock-origin/latest.xpi"; + installation_mode = "force_installed"; + }; + "jid1-MnnxcxisBPnSXQ@jetpack" = { + install_url = "https://addons.mozilla.org/firefox/downloads/latest/privacy-badger17/latest.xpi"; + installation_mode = "force_installed"; + }; + "extension@tabliss.io" = { + install_url = "https://addons.mozilla.org/firefox/downloads/file/3940751/tabliss-2.6.0.xpi"; + installation_mode = "force_installed"; + }; + }; }; - "extension@tabliss.io" = { - install_url = "https://addons.mozilla.org/firefox/downloads/file/3940751/tabliss-2.6.0.xpi"; - installation_mode = "force_installed"; - }; - }; - }; }; }; @@ -281,38 +268,40 @@ in { # home.sessionVariables.XDG_DATA_DIRS = mkAfter [ "${missing-gsettings-schemas-fix}" ]; - home.packages = [chrome - ausweisapp] ++ (attrValues { - + home.packages = [ + chrome + ausweisapp + ] ++ (attrValues { + inherit (pkgs) - zen-browser - pavucontrol - pdftk - qpdfview - # https://wiki.archlinux.de/title/Openbox, https://unix.stackexchange.com/a/32217/102072 - obconf - # DONT home-manager on non-nixos can't manage system files i. e. /etc/pam.d/* see https://github.com/NixOS/nixpkgs/issues/157112 - #xss-lock # reason for slock not being on this list: https://gist.github.com/573/5ce58db3b72913648968968dbfa59d86 - # FIXME do https://github.com/google/xsecurelock/issues/102#issuecomment-621432204 see https://bnikolic.co.uk/nix-cheatsheet.html#orgb5bd923 - #xsecurelock # lxdm not shown - xscreensaver - droidcam # host-install v4l2loopback - vlc - mediathekview - xclip - age-plugin-yubikey # arch: https://github.com/str4d/age-plugin-yubikey - ; + zen-browser + pavucontrol + pdftk + qpdfview + # https://wiki.archlinux.de/title/Openbox, https://unix.stackexchange.com/a/32217/102072 + obconf + # DONT home-manager on non-nixos can't manage system files i. e. /etc/pam.d/* see https://github.com/NixOS/nixpkgs/issues/157112 + #xss-lock # reason for slock not being on this list: https://gist.github.com/573/5ce58db3b72913648968968dbfa59d86 + # FIXME do https://github.com/google/xsecurelock/issues/102#issuecomment-621432204 see https://bnikolic.co.uk/nix-cheatsheet.html#orgb5bd923 + #xsecurelock # lxdm not shown + xscreensaver + droidcam# host-install v4l2loopback + vlc + mediathekview + xclip + age-plugin-yubikey# arch: https://github.com/str4d/age-plugin-yubikey + ; inherit - (pkgs.xorg) - # https://gist.github.com/573/aa12e8fa8c98aeaf788c3687c3b658dc - #xorg.xset - xev - ; + (pkgs.xorg) + # https://gist.github.com/573/aa12e8fa8c98aeaf788c3687c3b658dc + #xorg.xset + xev + ; inherit - (pkgs.lxde) - lxsession - ; + (pkgs.lxde) + lxsession + ; }); # FIXME NixOS only: https://search.nixos.org/options?type=packages&query=services.xserver.xkb diff --git a/home/base/general.nix b/home/base/general.nix index 768a8b15..94aa8d0d 100644 --- a/home/base/general.nix +++ b/home/base/general.nix @@ -1,12 +1,24 @@ -{ config, lib, pkgs, ... }: +/** +Original author's home'nix files are always prefixed with `{ config, lib, pkgs, ... }:` header + +Parameter `[inputs]` here is a deviation from the orinal author's intent (doing that via overlay) and should maybe be fixed +For `[inputs]` parameter determine a solution (./../../nixos/programs/docker.nix also has the issue yet) +*/ +{ config, lib, pkgs, inputs, ... }: let inherit (lib) attrValues - concatStringsSep + concatStringsSep mkEnableOption mkIf mkMerge ; +/** +Attribute `system` here is determined that way (`inherit (pkgs.stdenv.hostPlatform) system;`) to make later use of parameter `[inputs]` here in this file (./../../home/base/desktop.nix), which is a deviation from the orinal author's intent (there an overlay is used to determine derivations from inputs, the intention of which is fine to narrow down `system` use to flake-related nix files I guess). + +If I want to rid overlays I might have to find a way with less potentially bad implications, IDK are there any ? +*/ + inherit (pkgs.stdenv.hostPlatform) system; cfg = config.custom.base.general; localeGerman = "de_DE.UTF-8"; localeEnglish = "en_US.UTF-8"; @@ -63,71 +75,75 @@ in }; packages = attrValues { - inherit (pkgs) - # TODO Put into home/programs/neovim ASAP - # https://discourse.nixos.org/t/how-can-i-distinguish-between-two-packages-who-has-the-same-name-for-the-binary/39770/2 - #(inputs.nixvim.packages."${system}".default) - # this way can have nvim-mini in parallel - # https://discourse.nixos.org/t/how-can-i-distinguish-between-two-packages-who-has-the-same-name-for-the-executable/39770/4 - # FIXME assumes now broken https://github.com/nix-community/nixvim/commit/d53afe0d7348b6c41a9127db4217adeaf1e9d69b - # https://github.com/nix-community/nixvim/compare/main...573:nixvim:fit-23.11 - #(pkgs.runCommand "nix-nvim" { nativeBuildInputs = [ pkgs.makeWrapper ]; } '' - # mkdir -p $out/bin - # makeWrapper ${inputs.nixvim.packages."${system}".default}/bin/nvim $out/bin/nix-nvim - # '') - #nixvim-configured - bc - file - # httpie # build for aarch64-linux times out, https://github.com/573/nix-config-1/actions/runs/3744580521/jobs/6358117765#step:5:7429 - iotop - jq - mmv-go - nmap - ncdu - nload # network traffic monitor - pwgen - #ripgrep # build broken on aarch64-linux, https://github.com/573/nix-config-1/actions/runs/6309380420/job/17129186691, also build unmaintained currently - silver-searcher - tree - wget - yq-go - - gzip - unzip - xz - zip - - bind # dig - netcat - - psmisc # killall - whois - - sqlite - - eza - #cachix - yazi - #actionlint - #powerline-rs - - gist - fd - sd - pv - - # TODO https://www.arthurkoziel.com/restic-backups-b2-nixos - backblaze-b2 - attr - - # poc - age - - nix-inspect - zellij - viddy - zoxide - ; + inherit (pkgs) + # TODO Put into home/programs/neovim ASAP + # https://discourse.nixos.org/t/how-can-i-distinguish-between-two-packages-who-has-the-same-name-for-the-binary/39770/2 + #(inputs.nixvim.packages."${system}".default) + # this way can have nvim-mini in parallel + # https://discourse.nixos.org/t/how-can-i-distinguish-between-two-packages-who-has-the-same-name-for-the-executable/39770/4 + # FIXME assumes now broken https://github.com/nix-community/nixvim/commit/d53afe0d7348b6c41a9127db4217adeaf1e9d69b + # https://github.com/nix-community/nixvim/compare/main...573:nixvim:fit-23.11 + #(pkgs.runCommand "nix-nvim" { nativeBuildInputs = [ pkgs.makeWrapper ]; } '' + # mkdir -p $out/bin + # makeWrapper ${inputs.nixvim.packages."${system}".default}/bin/nvim $out/bin/nix-nvim + # '') + #nixvim-configured + bc + file + # httpie # build for aarch64-linux times out, https://github.com/573/nix-config-1/actions/runs/3744580521/jobs/6358117765#step:5:7429 + iotop + jq + mmv-go + nmap + ncdu + nload# network traffic monitor + pwgen + #ripgrep # build broken on aarch64-linux, https://github.com/573/nix-config-1/actions/runs/6309380420/job/17129186691, also build unmaintained currently + silver-searcher + tree + wget + yq-go + + gzip + unzip + xz + zip + + bind# dig + netcat + + psmisc# killall + whois + + sqlite + + #actionlint + #powerline-rs + + gist + fd + sd + pv + + # TODO https://www.arthurkoziel.com/restic-backups-b2-nixos + backblaze-b2 + attr + + # poc + age + + nix-inspect + zellij + viddy + zoxide + ; + + inherit + (inputs.unstable.legacyPackages.${system}) + eza + yazi + ; + }; # replaces with pkgs; [], i. e. because nixd catches duplicates this way sessionVariables = { @@ -139,8 +155,8 @@ in ]; PAGER = "${pkgs.less}/bin/less"; SHELL = "bash"; - EDITOR = "vi"; - VISUAL = "vi"; + EDITOR = "vi"; + VISUAL = "vi"; # (ft-man-plugin), # https://neovim.io/doc/user/starting.html#starting, # https://www.chrisdeluca.me/2022/03/07/use-neovim-as.html @@ -168,7 +184,7 @@ in }) { - home.stateVersion = "24.05"; + home.stateVersion = "24.05"; } (mkIf cfg.termux { @@ -176,7 +192,7 @@ in base.general = { lightWeight = true; minimal = true; - }; + }; programs.emacs-novelist.enable = true; }; }) @@ -185,8 +201,8 @@ in custom.programs = { tmux.enable = true; emacs.enable = true; -# emacs-novelist.enable = true; -# emacs-nano.enable = true; + # emacs-novelist.enable = true; + emacs-nano.enable = true; neovim = { enable = true; lightWeight = false; @@ -195,17 +211,17 @@ in home.packages = attrValues { inherit (pkgs) - lshw - ouch - strace - lineselect - git-annex - #git-annex-remote-googledrive - #haskellPackages.feedback - #haskellPackages.pushme # broken - #datalad - #git-annex-utils - ; + lshw + ouch + strace + lineselect + git-annex + #git-annex-remote-googledrive + #haskellPackages.feedback + #haskellPackages.pushme # broken + #datalad + #git-annex-utils + ; }; }) @@ -218,9 +234,9 @@ in git.enable = true; nnn.enable = true; rsync.enable = true; - ssh = { + ssh = { enable = true; - # modules = [ "vcs" ]; + # modules = [ "vcs" ]; }; }; }; diff --git a/home/base/non-nixos.nix b/home/base/non-nixos.nix index ae578914..98fb56fd 100644 --- a/home/base/non-nixos.nix +++ b/home/base/non-nixos.nix @@ -1,3 +1,6 @@ +/** +`@configArgs` as below provided to `commonConfig`, latter defined in ./../../lib/common-config.nix and bound in ./../../lib/default.nix as well as in ./../../flake/default.nix under the attribute name `customLibFor` where also a module with a mere attribute `lib.custom`is included with the `homeModulesFor` function +*/ { config, lib, pkgs, ... }@configArgs: let @@ -30,7 +33,7 @@ in builders = mkOption { type = types.listOf types.str; default = [ - "ssh://eu.nixbuild.net aarch64-linux - 100 1 benchmark big-parallel" + "ssh://eu.nixbuild.net aarch64-linux - 100 1 benchmark big-parallel" ]; description = "Nix remote builders."; }; diff --git a/home/development/nix/default.nix b/home/development/nix/default.nix index d806f4c7..99bdc718 100644 --- a/home/development/nix/default.nix +++ b/home/development/nix/default.nix @@ -63,7 +63,7 @@ in home.packages = [ (buildWithDiff "hm-build" - "nix build --builders '' --log-format internal-json --verbose \"${nixConfigDir}#homeConfigurations.\\\"$(whoami)@$(hostname)\\\".activationPackage\" |& nom --json" + "nix build --builders '' --log-format internal-json --verbose \"${nixConfigDir}#homeConfigurations.\\\"$(whoami)@$(hostname)\\\".activationPackage\" |& nom --json" "${config.home.homeDirectory}/.local/state/nix/profiles/home-manager" ) ]; @@ -77,7 +77,7 @@ in home.packages = [ (buildWithDiff "nod-build" - "nix build --show-trace -vv \"${nixConfigDir}#nixOnDroidConfigurations.sams9.activationPackage\" --impure" + "nix build --show-trace -vv \"${nixConfigDir}#nixOnDroidConfigurations.sams9.activationPackage\" --impure" "/nix/var/nix/profiles/nix-on-droid" ) ]; diff --git a/home/misc/util-bins/default.nix b/home/misc/util-bins/default.nix index ec1141e1..b95b30ca 100644 --- a/home/misc/util-bins/default.nix +++ b/home/misc/util-bins/default.nix @@ -46,14 +46,28 @@ in (config.lib.custom.mkScript "system-update" ./system-update.sh - (with pkgs; [ age git gnugrep gnused nix-output-monitor nvd ]) + (builtins.attrValues { + inherit (pkgs) + age + git + gnugrep + gnused + nix-output-monitor + nvd + ; + }) { _doNotClearPath = true; } ) (config.lib.custom.mkScript "kvm_display_handler_layout" ./kvm_display_handler_layout.sh - (with pkgs; [ xorg.xrandr ]) + (builtins.attrValues { + inherit + (pkgs.xorg) + xrandr + ; + }) { _doNotClearPath = true; } ) ]; diff --git a/home/programs/arbtt.nix b/home/programs/arbtt.nix index 6200ef7e..88585c43 100644 --- a/home/programs/arbtt.nix +++ b/home/programs/arbtt.nix @@ -1,4 +1,9 @@ -{ config, lib, pkgs, ... }: +/** +Original author's home'nix files are always prefixed with `{ config, lib, pkgs, ... }:` header + +For `[haskellPackages]` parameter determine a solution (./../../nixos/programs/docker.nix also has the issue yet) +*/ +{ config, lib, pkgs, /*haskellPackages,*/ inputs, ... }: let inherit (lib) @@ -8,6 +13,12 @@ let mkForce ; +/** +Attribute `system` here is determined that way (`inherit (pkgs.stdenv.hostPlatform) system;`) to make later use of parameter `[inputs]` here in this file (./../../home/base/desktop.nix), which is a deviation from the orinal author's intent (there an overlay is used to determine derivations from inputs, the intention of which is fine to narrow down `system` use to flake-related nix files I guess). + +If I want to rid overlays I might have to find a way with less potentially bad implications, IDK are there any ? +*/ + inherit (pkgs.stdenv.hostPlatform) system; cfg = config.custom.programs.arbtt; in { @@ -24,47 +35,53 @@ in ###### implementation config = mkIf cfg.enable { - # FIXME https://github.com/toonn/nix-config/blob/master/home/home.nix - home.packages = attrValues { - inherit (pkgs) - arbtt - ; - }; + # FIXME https://github.com/toonn/nix-config/blob/master/home/home.nix + home.packages = attrValues { + inherit (inputs.ghc-nixpkgs-unstable.legacyPackages.${system}.haskell.packages.ghc965) + arbtt + ; + }; - systemd.user = { - services = { - "arbtt-capture" = { - Service = { # https://github.com/nix-community/home-manager/tree/release-24.05/modules/services - Environment = let path = builtins.concatStringsSep ":" - ( map (p: "${lib.getBin p}/bin") - ( attrValues { inherit (pkgs) arbtt coreutils; } # with pkgs; [] - ) - ); - in "PATH=${path}"; - ExecStart - = let script - # TODO more config: https://github.com/NixOS/nixpkgs/blob/release-21.05/nixos/modules/services/monitoring/arbtt.nix - = pkgs.writeShellScript "arbtt-capture-start" '' - set -e - DATADIR="''${XDG_DATA_HOME:-$HOME/.local/share/arbtt}" - LOG="''${DATADIR}/''$(date +%Y).capture" - mkdir -p "''${DATADIR}" - arbtt-capture --logfile="''${LOG}" - ''; - in "${script}"; - Restart = "always"; - }; - Unit = { - Description = "Arbtt capture service"; - PartOf = [ "graphical-session.target" ]; - }; - Install = { - WantedBy = [ "graphical-session.target" ]; + systemd.user = { + services = { + "arbtt-capture" = { + Service = { + # https://github.com/nix-community/home-manager/tree/release-24.05/modules/services + Environment = + let + path = builtins.concatStringsSep ":" + (map (p: "${lib.getBin p}/bin") + (attrValues { inherit (inputs.ghc-nixpkgs-unstable.legacyPackages.${system}.haskell.packages.ghc965) arbtt; inherit (pkgs) coreutils; } # with pkgs; [] + ) + ); + in + "PATH=${path}"; + ExecStart = + let + script + # TODO more config: https://github.com/NixOS/nixpkgs/blob/release-21.05/nixos/modules/services/monitoring/arbtt.nix + = pkgs.writeShellScript "arbtt-capture-start" '' + set -e + DATADIR="''${XDG_DATA_HOME:-$HOME/.local/share/arbtt}" + LOG="''${DATADIR}/''$(date +%Y).capture" + mkdir -p "''${DATADIR}" + arbtt-capture --logfile="''${LOG}" + ''; + in + "${script}"; + Restart = "always"; + }; + Unit = { + Description = "Arbtt capture service"; + PartOf = [ "graphical-session.target" ]; + }; + Install = { + WantedBy = [ "graphical-session.target" ]; + }; }; }; + startServices = mkForce "sd-switch"; }; - startServices = mkForce "sd-switch"; - }; }; } diff --git a/home/programs/audio.nix b/home/programs/audio.nix index 07a4440b..fb64368d 100644 --- a/home/programs/audio.nix +++ b/home/programs/audio.nix @@ -1,7 +1,13 @@ -{ config, lib, pkgs, ... }: +/** +Original author's home'nix files are always prefixed with `{ config, lib, pkgs, ... }:` header + +For `[latest]` and `[unstable]` parameters determine a solution (./../../nixos/programs/docker.nix also has the issue yet) +*/ +{ config, lib, pkgs, /*unstable,*/ ... }: let inherit (lib) + attrValues mkEnableOption mkIf ; @@ -23,11 +29,19 @@ in ###### implementation config = mkIf cfg.enable { - home.packages = with pkgs; [ - qpwgraph - pwvucontrol - helio-workstation - ]; + home.packages = attrValues { + # with pkgs; [ + inherit + (pkgs) + qpwgraph + helio-workstation + ; + + inherit + (pkgs) + pwvucontrol + ; + }; }; } diff --git a/home/programs/dvdplayback.nix b/home/programs/dvdplayback.nix index fc8d3aa4..21bcbe55 100644 --- a/home/programs/dvdplayback.nix +++ b/home/programs/dvdplayback.nix @@ -1,4 +1,3 @@ - { config, lib, pkgs, ... }: let @@ -23,7 +22,6 @@ in ###### implementation - config = mkIf cfg.enable { - }; + config = mkIf cfg.enable { }; } diff --git a/home/programs/emacs-nano.nix b/home/programs/emacs-nano.nix index 6e429ef8..a28f8a1b 100644 --- a/home/programs/emacs-nano.nix +++ b/home/programs/emacs-nano.nix @@ -26,7 +26,7 @@ let inherit (inputs.emacs-overlay.lib.${system}) emacsWithPackagesFromUsePackage; - emacs-nano = (pkgs.emacsPackages.trivialBuild rec { + emacs-nano = (pkgs.emacsPackages.trivialBuild { pname = "emacs-nano"; version = "0"; src = "${inputs.nano-emacs}"; @@ -37,8 +37,8 @@ let mkdir -p "$target" cp *.el "$target" ''; - meta = with lib; { - description = "GNU Emacs / N Λ N O is a set of configuration files for GNU Emacs such as to provide a nice and consistent look and feel."; + meta = { + lib.description = "GNU Emacs / N Λ N O is a set of configuration files for GNU Emacs such as to provide a nice and consistent look and feel."; }; }); @@ -96,11 +96,15 @@ in custom.programs.emacs-nano.finalPackage = (emacsWithPackagesFromUsePackage { alwaysEnsure = true; package = emacs; - extraEmacsPackages = epkgs: with epkgs; [ + extraEmacsPackages = epkgs: builtins.attrValues { + inherit + (epkgs) bind-key # FIXME not redundant ? Is in https://github.com/jwiegley/use-package use-package + ; + } ++ [ emacs-nano - my-default-el + my-default-el ]; config = ""; }); @@ -109,8 +113,13 @@ in programs.info.enable = true; - home.packages = with pkgs; [ - (pkgs.runCommand "emacs-nano" { nativeBuildInputs = [ pkgs.makeWrapper ]; } '' + home.packages = let + inherit (pkgs) + runCommand + makeWrapper + ; + in [ + (runCommand "emacs-nano" { nativeBuildInputs = [ makeWrapper ]; } '' mkdir -p $out/bin makeWrapper ${config.custom.programs.emacs-nano.finalPackage.outPath}/bin/emacs $out/bin/emacs-nano --argv0 emacs '') diff --git a/home/programs/emacs-novelist.nix b/home/programs/emacs-novelist.nix index 17b41ef7..e0e0ea5f 100644 --- a/home/programs/emacs-novelist.nix +++ b/home/programs/emacs-novelist.nix @@ -24,7 +24,7 @@ let #}) ; - inherit (emacs.pkgs) withPackages; # crucial to use the right version here as epkgs get byte-compiled for this exact emacs + inherit (emacs.pkgs) withPackages;# crucial to use the right version here as epkgs get byte-compiled for this exact emacs emacsWithPackagesFromUsePackage = if isLinux && isAarch64 @@ -47,41 +47,41 @@ let }); ox-odt = emacs.pkgs.melpaBuild { - pname = "ox-odt"; - # nix-style unstable version 0-unstable-20240427 can be used after - # https://github.com/NixOS/nixpkgs/pull/316726 reaches you - version = "20240427.0"; - src = pkgs.fetchFromGitHub { - owner = "kjambunathan"; - repo = "org-mode-ox-odt"; - rev = "89d3b728c98d3382a8e6a0abb8befb03d27d537b"; - hash = "sha256-/AXechWnUYiGYw/zkVRhUFwhcfknTzrC4oSWoa80wRw="; - }; - # not needed after https://github.com/NixOS/nixpkgs/pull/316107 reaches you - commit = "foo"; - - # use :files to include only related files - # https://github.com/melpa/melpa?tab=readme-ov-file#recipe-format - recipe = pkgs.writeText "recipe" '' - (ox-odt :fetcher git :url "") - ''; - }; + pname = "ox-odt"; + # nix-style unstable version 0-unstable-20240427 can be used after + # https://github.com/NixOS/nixpkgs/pull/316726 reaches you + version = "20240427.0"; + src = pkgs.fetchFromGitHub { + owner = "kjambunathan"; + repo = "org-mode-ox-odt"; + rev = "89d3b728c98d3382a8e6a0abb8befb03d27d537b"; + hash = "sha256-/AXechWnUYiGYw/zkVRhUFwhcfknTzrC4oSWoa80wRw="; + }; + # not needed after https://github.com/NixOS/nixpkgs/pull/316107 reaches you + commit = "foo"; + + # use :files to include only related files + # https://github.com/melpa/melpa?tab=readme-ov-file#recipe-format + recipe = pkgs.writeText "recipe" '' + (ox-odt :fetcher git :url "") + ''; + }; - ox-html-markdown-style-footnotes = (emacs.pkgs.trivialBuild rec { + ox-html-markdown-style-footnotes = (emacs.pkgs.trivialBuild rec { pname = "ox-html-markdown-style-footnotes"; - version = "0.2.0"; + version = "0.2.0"; src = pkgs.fetchurl { - url = "https://raw.githubusercontent.com/jeffkreeftmeijer/ox-html-markdown-style-footnotes.el/0.2.0/ox-html-markdown-style-footnotes.el"; - sha256 = "sha256-S+lzFpGY44OgXAeM9Qzdhvceh8DvvOFiw5tgXoXDrsQ="; - }; + url = "https://raw.githubusercontent.com/jeffkreeftmeijer/ox-html-markdown-style-footnotes.el/0.2.0/ox-html-markdown-style-footnotes.el"; + sha256 = "sha256-S+lzFpGY44OgXAeM9Qzdhvceh8DvvOFiw5tgXoXDrsQ="; + }; - - meta = with lib; { - description = "Markdown-style footnotes for ox-html.el"; - homepage = "https://jeffkreeftmeijer.com/ox-html-markdown-style-footnotes/"; - license = licenses.gpl3; - platforms = platforms.all; - }; + + meta = with lib; { + description = "Markdown-style footnotes for ox-html.el"; + homepage = "https://jeffkreeftmeijer.com/ox-html-markdown-style-footnotes/"; + license = licenses.gpl3; + platforms = platforms.all; + }; }); # TODO https://emacsnotes.wordpress.com/2022/06/29/use-org-extra-emphasis-when-you-need-more-emphasis-markers-in-emacs-org-mode/ @@ -90,156 +90,128 @@ let version = "1"; src = "${inputs.org-extra-emphasis.outPath}"; # elisp dependencies - #propagatedUserEnvPkgs = [ - # ox-odt - #]; - #buildInputs = propagatedUserEnvPkgs; - # installPhase = '' - # target=$out/share/emacs/site-lisp/$pname/${pname}.el - # mkdir -p "$(dirname "$target")" - # cp "$src/${pname}.el" "$(dirname "$target")" - # ''; + #propagatedUserEnvPkgs = [ + # ox-odt + #]; + #buildInputs = propagatedUserEnvPkgs; + # installPhase = '' + # target=$out/share/emacs/site-lisp/$pname/${pname}.el + # mkdir -p "$(dirname "$target")" + # cp "$src/${pname}.el" "$(dirname "$target")" + # ''; meta = { description = "Extra Emphasis markers for Emacs Org mode. https://irreal.org/blog/?p=10649"; }; }); # https://raw.githubusercontent.com/hrs/sensible-defaults.el/main/sensible-defaults.el - sensible-defaults = (pkgs.emacsPackages.trivialBuild rec { - pname = "sensible-defaults"; - version = "0"; - src = "${inputs.sensible-defaults.outPath}"; - phases = [ "installPhase" ]; - installPhase = '' - target=$out/share/emacs/site-lisp/$pname/${pname}.el - mkdir -p "$(dirname "$target")" - cp "$src" "$target" - ''; - meta = with lib; { - description = "A simple, modular collection of better Emacs default settings."; - }; - }); - sane-defaults = (pkgs.emacsPackages.trivialBuild rec { - pname = "sane-defaults"; - version = "0"; - src = "${inputs.sane-defaults.outPath}"; - phases = [ "installPhase" ]; - installPhase = '' - target=$out/share/emacs/site-lisp/$pname/${pname}.el - mkdir -p "$(dirname "$target")" - cp "$src" "$target" - ''; - meta = with lib; { - description = "An ever-changing set of emacs settings.."; - }; - }); my-default-el = pkgs.emacsPackages.trivialBuild { pname = "default.el"; version = "0"; src = pkgs.writeText "default.el" '' -(use-package gcmh - :ensure t - :diminish - :init (setq gc-cons-threshold (* 80 1024 1024)) - :hook (emacs-startup . gcmh-mode)) - -(use-package which-key - :hook (on-first-input . which-key-mode)) - -(use-package no-littering - :ensure t - :init - (setq no-littering-etc-directory "~/.cache/emacs/etc/" - no-littering-var-directory "~/.cache/emacs/var/") - (when (fboundp 'startup-redirect-eln-cache) - (startup-redirect-eln-cache - (convert-standard-filename - (expand-file-name "eln-cache/" no-littering-var-directory))))) - -(use-package bind-key - :demand t - :bind - (:prefix-map rab/files-map - :prefix "C-c f") - :bind - (:prefix-map rab/toggles-map - :prefix "C-c t")) - -(use-package diminish :ensure t) - -(use-package corfu-terminal - :ensure t - :hook (on-first-buffer . global-corfu-mode)) - -(use-package emacs-lock - :config - (with-current-buffer "*scratch*" - (emacs-lock-mode 'kill))) - -(use-package ibuffer - :bind - ([remap list-buffers] . ibuffer)) - -(use-package persist-state - :ensure t - :hook - (on-first-input . persist-state-mode)) - -(use-package suggest - :ensure t) - -(setopt create-lockfiles nil) - - -(use-package emacs - :bind - ([remap capitalize-word] . capitalize-dwim) - ([remap downcase-word] . downcase-dwim) - ([remap upcase-word] . upcase-dwim)) - -(use-package titlecase - :ensure t - :defer t) - -(setopt cursor-type 'bar) - -(use-package olivetti - :demand t - :init - (setq olivetti-body-width 40) - (setq olivetti-style 'fancy) - (setq olivetti-minimum-body-width 30) - :ensure t) - -(use-package org-novelist - :ensure nil -;; :load-path "~/Downloads/" ; The directory containing 'org-novelist.el' - :custom -;; Setting de-DE leads to subtle errors (no localised files) - (org-novelist-language-tag "en-GB") ; The interface language for Org Novelist to use. It defaults to 'en-GB' when not set - (org-novelist-author "Daniel Kahlenberg") ; The default author name to use when exporting a story. Each story can also override this setting - (org-novelist-author-email "573@users.noreply.github.com") ; The default author contact email to use when exporting a story. Each story can also override this setting - (org-novelist-automatic-referencing-p nil)) - -;; inserting notes as comment blocks in org https://irreal.org/blog/?p=2029 has it's own command now see https://emacs.stackexchange.com/a/46992 - -;; (require 'ox-odt) - (require 'org-extra-emphasis) - -;; https://emacs.stackexchange.com/questions/73878/how-to-start-scratch-buffer-with-olivetti-org-mode-and-exotica-theme-altogether?rq=1 -(defun my/initial-layout () - "Create my initial screen layout." - (interactive) - ;; 2. having org-mode launch in scratch buffer from the beginning, and - (switch-to-buffer "*scratch*") - (org-mode) - ;; (org-indent-mode) - ;; 3. to have olivetti mode enabled too. - ;; (olivetti-mode) - ;; (delete-other-windows) - ) - -(my/initial-layout) + (use-package gcmh + :ensure t + :diminish + :init (setq gc-cons-threshold (* 80 1024 1024)) + :hook (emacs-startup . gcmh-mode)) + + (use-package which-key + :hook (on-first-input . which-key-mode)) + + (use-package no-littering + :ensure t + :init + (setq no-littering-etc-directory "~/.cache/emacs/etc/" + no-littering-var-directory "~/.cache/emacs/var/") + (when (fboundp 'startup-redirect-eln-cache) + (startup-redirect-eln-cache + (convert-standard-filename + (expand-file-name "eln-cache/" no-littering-var-directory))))) + + (use-package bind-key + :demand t + :bind + (:prefix-map rab/files-map + :prefix "C-c f") + :bind + (:prefix-map rab/toggles-map + :prefix "C-c t")) + + (use-package diminish :ensure t) + + (use-package corfu-terminal + :ensure t + :hook (on-first-buffer . global-corfu-mode)) + + (use-package emacs-lock + :config + (with-current-buffer "*scratch*" + (emacs-lock-mode 'kill))) + + (use-package ibuffer + :bind + ([remap list-buffers] . ibuffer)) + + (use-package persist-state + :ensure t + :hook + (on-first-input . persist-state-mode)) + + (use-package suggest + :ensure t) + + (setopt create-lockfiles nil) + + + (use-package emacs + :bind + ([remap capitalize-word] . capitalize-dwim) + ([remap downcase-word] . downcase-dwim) + ([remap upcase-word] . upcase-dwim)) + + (use-package titlecase + :ensure t + :defer t) + + (setopt cursor-type 'bar) + + (use-package olivetti + :demand t + :init + (setq olivetti-body-width 40) + (setq olivetti-style 'fancy) + (setq olivetti-minimum-body-width 30) + :ensure t) + + (use-package org-novelist + :ensure nil + ;; :load-path "~/Downloads/" ; The directory containing 'org-novelist.el' + :custom + ;; Setting de-DE leads to subtle errors (no localised files) + (org-novelist-language-tag "en-GB") ; The interface language for Org Novelist to use. It defaults to 'en-GB' when not set + (org-novelist-author "Daniel Kahlenberg") ; The default author name to use when exporting a story. Each story can also override this setting + (org-novelist-author-email "573@users.noreply.github.com") ; The default author contact email to use when exporting a story. Each story can also override this setting + (org-novelist-automatic-referencing-p nil)) + + ;; inserting notes as comment blocks in org https://irreal.org/blog/?p=2029 has it's own command now see https://emacs.stackexchange.com/a/46992 + + ;; (require 'ox-odt) + (require 'org-extra-emphasis) + + ;; https://emacs.stackexchange.com/questions/73878/how-to-start-scratch-buffer-with-olivetti-org-mode-and-exotica-theme-altogether?rq=1 + (defun my/initial-layout () + "Create my initial screen layout." + (interactive) + ;; 2. having org-mode launch in scratch buffer from the beginning, and + (switch-to-buffer "*scratch*") + (org-mode) + ;; (org-indent-mode) + ;; 3. to have olivetti mode enabled too. + ;; (olivetti-mode) + ;; (delete-other-windows) + ) + + (my/initial-layout) ''; /*'' (add-to-list 'load-path "${inputs.sensible-defaults.outPath}") @@ -308,15 +280,15 @@ in }; listOfPkgs = mkOption { # unnecessary but I want to learn about building emacs-packages-deps - # so I could i. e. nix derivation show /nix/store/c8vwsxnbqfp09bg6gwhxvvz3f0hpym6y-emacs-moe-theme-20231006.639.drv | grep '"path"' + # so I could i. e. nix derivation show /nix/store/c8vwsxnbqfp09bg6gwhxvvz3f0hpym6y-emacs-moe-theme-20231006.639.drv | grep '"path"' default = null; - internal = true; + internal = true; description = '' - list of Extra packages available to Emacs. - nix eval --json .#nixosConfigurations.DANIELKNB1.config.home-manager.users.nixos.custom.programs.emacs-novelist.listOfPkgs --json - nix build ... - 0.0 MiB DL] building emacs-packages-deps - nix derivation show ... + list of Extra packages available to Emacs. + nix eval --json .#nixosConfigurations.DANIELKNB1.config.home-manager.users.nixos.custom.programs.emacs-novelist.listOfPkgs --json + nix build ... + 0.0 MiB DL] building emacs-packages-deps + nix derivation show ... ''; }; }; @@ -326,15 +298,15 @@ in ###### implementation - config = let - fun = epkgs: with epkgs; [ - my-default-el - org-novelist - moe-theme - #better-defaults + config = + let + fun = epkgs: builtins.attrValues { + inherit (epkgs) + moe-theme + #better-defaults bind-key # FIXME not redundant ? Is in https://github.com/jwiegley/use-package use-package - #writeroom-mode +#writeroom-mode which-key # https://cestlaz.github.io/posts/using-emacs-16-undo-tree/ undo-tree @@ -342,50 +314,66 @@ in #sensible-defaults #sane-defaults #jinx - titlecase - suggest - persist-state - ibuffer-vc - epkgs.emacs - corfu-terminal - diminish - bind-key - no-littering - gcmh - olivetti - org-extra-emphasis # https://emacsnotes.wordpress.com/2022/06/29/use-org-extra-emphasis-when-you-need-more-emphasis-markers-in-emacs-org-mode/, also install pdflatex etc. + titlecase + suggest + persist-state + ibuffer-vc + emacs + corfu-terminal + diminish + no-littering + gcmh + olivetti + ; + } ++ [ + org-novelist + my-default-el + org-extra-emphasis # FIXME https://emacsnotes.wordpress.com/2022/06/29/use-org-extra-emphasis-when-you-need-more-emphasis-markers-in-emacs-org-mode/, also install pdflatex etc. ox-odt ox-html-markdown-style-footnotes ]; - in mkIf cfg.enable { - # don't know how to avoid redundancy here - custom.programs.emacs-novelist.listOfPkgs = withPackages fun; - -custom.programs.emacs-novelist.initialPackage = emacs; - - # Or as in https://github.com/szermatt/mistty/issues/14 - custom.programs.emacs-novelist.finalPackage = (emacsWithPackagesFromUsePackage { - alwaysEnsure = true; - package = config.custom.programs.emacs-novelist.initialPackage; - extraEmacsPackages = fun; - config = ""; - }); - - custom.programs.emacs-novelist.homePackage = - (pkgs.runCommand "emacs-novelist" { nativeBuildInputs = [ pkgs.makeWrapper ]; } '' - mkdir -p $out/bin - makeWrapper ${config.custom.programs.emacs-novelist.finalPackage.outPath}/bin/emacs $out/bin/emacs-novelist --argv0 emacs - ''); - - custom.programs.shell.shellAliases = { } // optionalAttrs (isLinux && isAarch64) { emacs-novelist = "emacs-novelist -nw"; }; - - programs.info.enable = true; - - home.packages = with pkgs; [ - nuspell - hunspellDicts.en_US - hunspellDicts.de_DE - config.custom.programs.emacs-novelist.homePackage - ]; - }; + in + mkIf cfg.enable { + # don't know how to avoid redundancy here + custom.programs.emacs-novelist.listOfPkgs = withPackages fun; + + custom.programs.emacs-novelist.initialPackage = emacs; + + # Or as in https://github.com/szermatt/mistty/issues/14 + custom.programs.emacs-novelist.finalPackage = (emacsWithPackagesFromUsePackage { + alwaysEnsure = true; + package = config.custom.programs.emacs-novelist.initialPackage; + extraEmacsPackages = fun; + config = ""; + }); + + custom.programs.emacs-novelist.homePackage = + (pkgs.runCommand "emacs-novelist" { nativeBuildInputs = [ pkgs.makeWrapper ]; } '' + mkdir -p $out/bin + makeWrapper ${config.custom.programs.emacs-novelist.finalPackage.outPath}/bin/emacs $out/bin/emacs-novelist --argv0 emacs + ''); + + custom.programs.shell.shellAliases = { } // optionalAttrs (isLinux && isAarch64) { emacs-novelist = "emacs-novelist -nw"; }; + + programs.info.enable = true; + + home.packages = builtins.attrValues { + inherit (pkgs) + nuspell + ; + inherit + (pkgs.hunspellDicts) + en_US + de_DE + ; + /*inherit + (pkgs.texliveBasic) + out + ;*/ + inherit + (config.custom.programs.emacs-novelist) + homePackage + ; + }; + }; } diff --git a/home/programs/emacs.nix b/home/programs/emacs.nix index 822b53c4..8ef20263 100644 --- a/home/programs/emacs.nix +++ b/home/programs/emacs.nix @@ -75,13 +75,15 @@ in custom.programs.shell.shellAliases = { } // optionalAttrs (isLinux && isAarch64) { emacs = "emacs -nw"; }; - home.packages = with pkgs; [ + home.packages = builtins.attrValues { + inherit (pkgs.librsvg) # https://www.emacswiki.org/emacs/EmacsSvg; not working when emacs -nw - librsvg.out + out # DONT # https://github.com/nix-community/home-manager/issues/3113 #dconf #emacsPackages.git-annex - ]; + ; + }; programs.info.enable = true; @@ -115,11 +117,10 @@ in (add-hook 'before-save-hook nil) ''; - extraPackages = epkgs: with epkgs; + extraPackages = epkgs: builtins.attrValues { + inherit (epkgs) #(pack emacs.pkgs.melpaPackages) ++ - [ moe-theme - org-novelist better-defaults #vterm bind-key # FIXME not redundant ? Is in https://github.com/jwiegley/use-package @@ -132,7 +133,11 @@ in repl-driven-development sensible-defaults sane-defaults - ] ++ optionals (isLinux && isx86_64) [ + org-novelist + ; + } + ++ optionals (isLinux && isx86_64) builtins.attrValues { + inherit (epkgs) flymake-hledger hledger-mode sqlite3 @@ -145,10 +150,13 @@ in org-bullets ob-mermaid magit + ; + inherit (pkgs) git-annex - ]; + ; + }; - overrides = _self: _super: rec { + overrides = _self: _super: { org-novelist = (pkgs.emacsPackages.trivialBuild rec { pname = "org-novelist"; version = "0"; @@ -158,8 +166,8 @@ in mkdir -p "$(dirname "$target")" cp *.el "$target" ''; - meta = with lib; { - description = "Org Novelist is a system for writing novel-length fiction using Emacs Org mode."; + meta = { + lib.description = "Org Novelist is a system for writing novel-length fiction using Emacs Org mode."; }; }); @@ -174,8 +182,8 @@ in mkdir -p "$(dirname "$target")" cp "$src" "$target" ''; - meta = with lib; { - description = "A simple, modular collection of better Emacs default settings."; + meta = { + lib.description = "A simple, modular collection of better Emacs default settings."; }; }); sane-defaults = (pkgs.emacsPackages.trivialBuild rec { @@ -188,8 +196,8 @@ in mkdir -p "$(dirname "$target")" cp "$src" "$target" ''; - meta = with lib; { - description = "An ever-changing set of emacs settings.."; + meta = { + lib.description = "An ever-changing set of emacs settings.."; }; }); }; diff --git a/home/programs/git/default.nix b/home/programs/git/default.nix index 01ca6361..4937579f 100644 --- a/home/programs/git/default.nix +++ b/home/programs/git/default.nix @@ -399,8 +399,8 @@ in # just run this in a repo with separated git dir: # git config --local core.hooksPath ~/.config/git/hooks xdg.configFile."git/hooks/pre-push".source = pkgs.writeScript "pre-push" '' -echo >&2 ".git directory separated to keep private, not pushing" -exit 1 + echo >&2 ".git directory separated to keep private, not pushing" + exit 1 ''; }; diff --git a/home/programs/hledger.nix b/home/programs/hledger.nix index 2da4d53e..7f53fb82 100644 --- a/home/programs/hledger.nix +++ b/home/programs/hledger.nix @@ -1,3 +1,8 @@ +/** +Original author's home'nix files are always prefixed with `{ config, lib, pkgs, ... }:` header + +For `[haskellPackages]` parameter determine a solution (./../../nixos/programs/docker.nix also has the issue yet) +*/ { config, lib, pkgs, inputs, ... }: let @@ -11,6 +16,22 @@ let inherit (pkgs.stdenv) isLinux isx86_64; + inherit + (inputs.ghc-nixpkgs-unstable.legacyPackages.${system}) + hledger + hledger-utils + hledger-interest + hledger-web + hledger-ui + ; + +/** +Attribute `system` here is determined that way (`inherit (pkgs.stdenv.hostPlatform) system;`) to make later use of parameter `[inputs]` here in this file (./../../home/base/desktop.nix), which is a deviation from the orinal author's intent (there an overlay is used to determine derivations from inputs, the intention of which is fine to narrow down `system` use to flake-related nix files I guess). + +If I want to rid overlays I might have to find a way with less potentially bad implications, IDK are there any ? +*/ + inherit (pkgs.stdenv.hostPlatform) system; + cfg = config.custom.programs.hledger; in @@ -38,7 +59,7 @@ in ''; envExtra = mkDefault ( mkAfter '' - LEDGER_FILE = "~/finance/2023.journal" + LEDGER_FILE = "~/finance/2024.journal" '' ); }; @@ -48,17 +69,17 @@ in packages = [ (config.lib.custom.wrapProgram { name = "hledger"; - source = pkgs.hledger; + source = hledger; path = "/bin/hledger"; editor = pkgs.micro; # TODO replace by nvim when faster }) #pkgs.hledger-check-fancyassertions - pkgs.hledger-interest - pkgs.hledger-utils + hledger-interest + hledger-utils ] ++ optionals (isLinux && isx86_64) [ # pkgs.hledger-iadd # DONT on demand can retrieve via nix profile install nixpkgs/d1c3fea7ecbed758168787fe4e4a3157e52bc808#haskellPackages.hledger-iadd, see https://gist.github.com/573/6b02765d71c27edb10c481e4746e7264 - pkgs.hledger-ui - pkgs.hledger-web + hledger-ui + hledger-web # pkgs.hledger-flow # DONT same as hledger-flow above ]; sessionPath = [ "${inputs.hledger-bin.outPath}/bin" ]; diff --git a/home/programs/neovim.nix b/home/programs/neovim.nix index 8cb2cf9b..f2c5a9ad 100644 --- a/home/programs/neovim.nix +++ b/home/programs/neovim.nix @@ -46,8 +46,8 @@ let luafile ${rootPath}/home/misc/nvim-wsl-clipboard.lua " let g:languagetool_server_command='$ { pkgs.languagetool }/bin/languagetool-http-server' - lua require("gitsigns").setup() - lua require("stcursorword").setup() + lua require("gitsigns").setup() + lua require("stcursorword").setup() '';*/ /*plugins = with pkgs.vimPlugins; [ # https://gitlab.com/rycee/home-manager/blob/de3758e3/modules/programs/neovim.nix#L113 @@ -216,7 +216,7 @@ let { name = "path"; } ]; /*sources = { - __raw = '' + __raw = '' cmp.config.sources({ { name = 'nvim_lsp' }, -- { name = 'vsnip' }, @@ -228,8 +228,8 @@ let { name = 'buffer' }, { name = 'path' }, }) - ''; - }; */ + ''; + }; */ formatting = { fields = [ "abbr" "kind" "menu" ]; @@ -384,49 +384,268 @@ in config = mkIf cfg.enable (mkMerge [ { + # FIXME add nvim-lsp as in https://github.com/nix-community/nixd/blob/main/nixd/docs/editors/nvim-lsp.nix custom.programs.neovim.minimalPackage = inputs.nixvim.legacyPackages."${system}".makeNixvim { enableMan = false; colorschemes.gruvbox.enable = true; - extraPlugins = with pkgs; [ - vimPlugins.nnn-vim - vimPlugins.neoterm - vimPlugins.grapple-nvim - vimPlugins.nvim-web-devicons + extraPlugins = builtins.attrValues { + inherit (pkgs.vimPlugins) + nnn-vim + neoterm + grapple-nvim + nvim-web-devicons + ; + } ++ [ + (pkgs.vimPlugins.nvim-treesitter.withPlugins (parsers: with parsers;[ nix markdown markdown_inline ])) (pluggo "faster-nvim") # (pluggo "deadcolumn-nvim") - ]; - extraConfigLua = '' - vim.g.clipboard = { - name = 'OSC 52', copy = { ['+'] = require('vim.ui.clipboard.osc52').copy('+'), - ['*'] = require('vim.ui.clipboard.osc52').copy('*'), - }, - paste = { ['+'] = require('vim.ui.clipboard.osc52').paste('+'), ['*'] = require('vim.ui.clipboard.osc52').paste('*'), }, } - -require("grapple").setup({ - opts = { - scope = "git", -- also try out "git_branch" - }, - event = { "BufReadPost", "BufNewFile" }, - cmd = "Grapple", - keys = { - { "m", "Grapple toggle", desc = "Grapple toggle tag" }, - { "M", "Grapple toggle_tags", desc = "Grapple open tags window" }, - { "n", "Grapple cycle_tags next", desc = "Grapple cycle next tag" }, - { "p", "Grapple cycle_tags prev", desc = "Grapple cycle previous tag" }, - }, -}) - ''; - extraPackages = with pkgs; [ + ]; + extraConfigLua = '' + vim.g.clipboard = { + name = 'OSC 52', copy = { ['+'] = require('vim.ui.clipboard.osc52').copy('+'), + ['*'] = require('vim.ui.clipboard.osc52').copy('*'), + }, + paste = { ['+'] = require('vim.ui.clipboard.osc52').paste('+'), ['*'] = require('vim.ui.clipboard.osc52').paste('*'), }, } + + require("grapple").setup({ + opts = { + scope = "git", -- also try out "git_branch" + }, + event = { "BufReadPost", "BufNewFile" }, + cmd = "Grapple", + keys = { + { "m", "Grapple toggle", desc = "Grapple toggle tag" }, + { "M", "Grapple toggle_tags", desc = "Grapple open tags window" }, + { "n", "Grapple cycle_tags next", desc = "Grapple cycle next tag" }, + { "p", "Grapple cycle_tags prev", desc = "Grapple cycle previous tag" }, + }, + }) + ''; + extraPackages = builtins.attrValues { + inherit (pkgs) nixpkgs-fmt - ]; + ; + }; + keymaps = [ + { + mode = "n"; + key = "gd"; + action = "Lspsaga finder def"; + options = { + desc = "Goto Definition"; + silent = true; + }; + } + { + mode = "n"; + key = "gr"; + action = "Lspsaga finder ref"; + options = { + desc = "Goto References"; + silent = true; + }; + } + + # { + # mode = "n"; + # key = "gD"; + # action = "Lspsaga show_line_diagnostics"; + # options = { + # desc = "Goto Declaration"; + # silent = true; + # }; + # } + + { + mode = "n"; + key = "gI"; + action = "Lspsaga finder imp"; + options = { + desc = "Goto Implementation"; + silent = true; + }; + } + + { + mode = "n"; + key = "gT"; + action = "Lspsaga peek_type_definition"; + options = { + desc = "Type Definition"; + silent = true; + }; + } + + { + mode = "n"; + key = "K"; + action = "Lspsaga hover_doc ++keep"; + options = { + desc = "Hover doc"; + silent = true; + }; + } + + { + mode = "n"; + key = "cw"; + action = "Lspsaga outline"; + options = { + desc = "Outline"; + silent = true; + }; + } + + { + mode = "n"; + key = "cr"; + action = "Lspsaga rename"; + options = { + desc = "Rename"; + silent = true; + }; + } + + { + mode = "n"; + key = "ca"; + action = "Lspsaga code_action"; + options = { + desc = "Code Action"; + silent = true; + }; + } + + { + mode = "n"; + key = "cd"; + action = "Lspsaga show_line_diagnostics"; + options = { + desc = "Line Diagnostics"; + silent = true; + }; + } + + { + mode = "n"; + key = "[d"; + action = "Lspsaga diagnostic_jump_next"; + options = { + desc = "Next Diagnostic"; + silent = true; + }; + } + + { + mode = "n"; + key = "]d"; + action = "Lspsaga diagnostic_jump_prev"; + options = { + desc = "Previous Diagnostic"; + silent = true; + }; + } + ]; plugins = { - # nvim-osc52.enable = true; + lspsaga = { + enable = true; + beacon = { + enable = true; + }; + ui = { + border = "rounded"; # One of none, single, double, rounded, solid, shadow + codeAction = "💡"; # Can be any symbol you want 💡 + }; + hover = { + openCmd = "!floorp"; # Choose your browser + openLink = "gx"; + }; + diagnostic = { + borderFollow = true; + diagnosticOnlyCurrent = false; + showCodeAction = true; + }; + symbolInWinbar = { + enable = true; # Breadcrumbs + }; + codeAction = { + extendGitSigns = false; + showServerName = true; + onlyInCursor = true; + numShortcut = true; + keys = { + exec = ""; + quit = [ + "" + "q" + ]; + }; + }; + lightbulb = { + enable = false; + sign = false; + virtualText = true; + }; + implement = { + enable = false; + }; + rename = { + autoSave = false; + keys = { + exec = ""; + quit = [ + "" + "" + ]; + select = "x"; + }; + }; + outline = { + autoClose = true; + autoPreview = true; + closeAfterJump = true; + layout = "normal"; # normal or float + winPosition = "right"; # left or right + keys = { + jump = "e"; + quit = "q"; + toggleOrJump = "o"; + }; + }; + scrollPreview = { + scrollDown = ""; + scrollUp = ""; + }; + }; + + # nvim-osc52.enable = true; which-key.enable = true; luasnip.enable = true; lsp = { enable = true; servers = { - nixd.enable = true; + nixd = { + enable = true; + settings = { + formatting.command = [ "nixpkgs-fmt" ]; + nixpkgs.expr = '' + import { } + ''; + + options = { + nixos.expr = '' + (builtins.getFlake "/home/nixos/.nix-config").nixosConfigurations.DANIELKNB1.options + ''; + home_manager.expr = '' + (builtins.getFlake "/home/nixos/.nix-config").homeConfigurations."dani@maiziedemacchiato".options + ''; + }; + }; + }; + #nil-ls = { + # enable = true; + # settings.formatting.command = [ "nixfmt" ]; + #}; ltex.enable = true; texlab.enable = true; lua-ls.enable = true; @@ -586,17 +805,17 @@ require("grapple").setup({ # see https://discourse.nixos.org/t/conflicts-between-treesitter-withallgrammars-and-builtin-neovim-parsers-lua-c/33536/3 # FIXME https://github.com/nix-community/nixvim/blob/4f6e90212c7ec56d7c03611fb86befa313e7f61f/plugins/languages/treesitter/treesitter.nix#L12 /* xdg.configFile."nvim/parser".source = "${pkgs.symlinkJoin { - name = "treesitter-parsers"; - paths = (pkgs.vimPlugins.nvim-treesitter.withPlugins (plugins: with plugins; [ - nix - bash - yaml - json - lua - latex - comment - ])).dependencies; - }}/parser"; */ + name = "treesitter-parsers"; + paths = (pkgs.vimPlugins.nvim-treesitter.withPlugins (plugins: with plugins; [ + nix + bash + yaml + json + lua + latex + comment + ])).dependencies; + }}/parser"; */ }) ]); } diff --git a/home/programs/nixbuild.nix b/home/programs/nixbuild.nix index ecc8677c..06d109ca 100644 --- a/home/programs/nixbuild.nix +++ b/home/programs/nixbuild.nix @@ -33,15 +33,18 @@ in IdentityFile /root/.ssh/my-nixbuild-key ''; -# custom.base.non-nixos.builders = [ -# "eu.nixbuild.net aarch64-linux - 100 1 benchmark big-parallel" -# ]; + # custom.base.non-nixos.builders = [ + # "eu.nixbuild.net aarch64-linux - 100 1 benchmark big-parallel" + # ]; }) { - home.packages = with pkgs; [ - rlwrap - ]; + home.packages = builtins.attrValues { + inherit + (pkgs) + rlwrap + ; + }; } ]); } diff --git a/home/programs/nnn.nix b/home/programs/nnn.nix index 6a821863..321c4a1a 100644 --- a/home/programs/nnn.nix +++ b/home/programs/nnn.nix @@ -41,7 +41,7 @@ in home.sessionVariables = { NNN_OPTS = concatStringsSep "" [ "H" # show hidden files -# "d" # detail mode + # "d" # detail mode "e" # text in $VISUAL/$EDITOR/vi "o" # open files only on Enter ]; diff --git a/home/programs/shell.nix b/home/programs/shell.nix index fd8b0f72..cc08e38d 100644 --- a/home/programs/shell.nix +++ b/home/programs/shell.nix @@ -1,4 +1,4 @@ -{ config, lib, pkgs, ... }: +{ config, lib, pkgs, /*unstable,*/ ... }: let inherit (lib) diff --git a/home/services/flatpaks.nix b/home/services/flatpaks.nix index adfe27a2..2c21940c 100644 --- a/home/services/flatpaks.nix +++ b/home/services/flatpaks.nix @@ -26,8 +26,8 @@ in config = mkIf cfg.enable { services.flatpak.packages = [ -# "im.riot.Riot" -# "com.github.KRTirtho.Spotube" + # "im.riot.Riot" + # "com.github.KRTirtho.Spotube" ]; }; diff --git a/home/ui/gtk.nix b/home/ui/gtk.nix index 82c2fb66..1dbc2b79 100644 --- a/home/ui/gtk.nix +++ b/home/ui/gtk.nix @@ -41,91 +41,94 @@ in xdgOpenUsePortal = true; }; - # https://hoverbear.org/blog/declarative-gnome-configuration-in-nixos/ - # https://github.com/Hoverbear-Consulting/flake/blob/89cbf802a0be072108a57421e329f6f013e335a6/users/ana/home.nix -gtk = { - enable = true; - iconTheme = { - name = "Papirus-Dark"; - package = pkgs.papirus-icon-theme; - }; - theme = { - name = "palenight"; - package = pkgs.palenight-theme; - }; - cursorTheme = { - name = "Numix-Cursor"; - package = pkgs.numix-cursor-theme; - }; - gtk3.extraConfig = { - Settings = '' - gtk-application-prefer-dark-theme=1 - ''; - }; - gtk4.extraConfig = { - Settings = '' - gtk-application-prefer-dark-theme=1 - ''; + # https://hoverbear.org/blog/declarative-gnome-configuration-in-nixos/ + # https://github.com/Hoverbear-Consulting/flake/blob/89cbf802a0be072108a57421e329f6f013e335a6/users/ana/home.nix + gtk = { + enable = true; + iconTheme = { + name = "Papirus-Dark"; + package = pkgs.papirus-icon-theme; + }; + theme = { + name = "palenight"; + package = pkgs.palenight-theme; + }; + cursorTheme = { + name = "Numix-Cursor"; + package = pkgs.numix-cursor-theme; + }; + gtk3.extraConfig = { + Settings = '' + gtk-application-prefer-dark-theme=1 + ''; + }; + gtk4.extraConfig = { + Settings = '' + gtk-application-prefer-dark-theme=1 + ''; + }; }; - }; -#programs.dconf.enable = true; - - # Use `dconf watch /` to track stateful changes you are doing and store them here. - dconf.settings = { - "org/gnome/shell" = { - disable-user-extensions = false; - # `gnome-extensions list` for a list - enabled-extensions = [ - "user-theme@gnome-shell-extensions.gcampax.github.com" - "trayIconsReloaded@selfmade.pl" - "Vitals@CoreCoding.com" - "dash-to-panel@jderose9.github.com" - "sound-output-device-chooser@kgshank.net" - "space-bar@luchrioh" - ]; - favorite-apps = [ "firefox.desktop" "code.desktop" "org.gnome.Terminal.desktop" "spotify.desktop" "virt-manager.desktop" "org.gnome.Nautilus.desktop" ]; - }; - "org/gnome/desktop/interface" = { - color-scheme = "prefer-dark"; - enable-hot-corners = false; + #programs.dconf.enable = true; + + # Use `dconf watch /` to track stateful changes you are doing and store them here. + dconf.settings = { + "org/gnome/shell" = { + disable-user-extensions = false; + # `gnome-extensions list` for a list + enabled-extensions = [ + "user-theme@gnome-shell-extensions.gcampax.github.com" + "trayIconsReloaded@selfmade.pl" + "Vitals@CoreCoding.com" + "dash-to-panel@jderose9.github.com" + "sound-output-device-chooser@kgshank.net" + "space-bar@luchrioh" + ]; + favorite-apps = [ "firefox.desktop" "code.desktop" "org.gnome.Terminal.desktop" "spotify.desktop" "virt-manager.desktop" "org.gnome.Nautilus.desktop" ]; + }; + "org/gnome/desktop/interface" = { + color-scheme = "prefer-dark"; + enable-hot-corners = false; + }; + # `gsettings get org.gnome.shell.extensions.user-theme name` + "org/gnome/shell/extensions/user-theme" = { + name = "palenight"; + }; + "org/gnome/desktop/wm/preferences" = { + workspace-names = [ "Main" ]; + }; + "org/gnome/shell/extensions/vitals" = { + show-storage = false; + show-voltage = true; + show-memory = true; + show-fan = true; + show-temperature = true; + show-processor = true; + show-network = true; + }; + "org/gnome/desktop/background" = { + picture-uri = "file:///run/current-system/sw/share/backgrounds/gnome/vnc-l.png"; + picture-uri-dark = "file:///run/current-system/sw/share/backgrounds/gnome/vnc-d.png"; + }; + "org/gnome/desktop/screensaver" = { + picture-uri = "file:///run/current-system/sw/share/backgrounds/gnome/vnc-d.png"; + primary-color = "#3465a4"; + secondary-color = "#000000"; + }; }; - # `gsettings get org.gnome.shell.extensions.user-theme name` - "org/gnome/shell/extensions/user-theme" = { - name = "palenight"; - }; - "org/gnome/desktop/wm/preferences" = { - workspace-names = [ "Main" ]; - }; - "org/gnome/shell/extensions/vitals" = { - show-storage = false; - show-voltage = true; - show-memory = true; - show-fan = true; - show-temperature = true; - show-processor = true; - show-network = true; - }; - "org/gnome/desktop/background" = { - picture-uri = "file:///run/current-system/sw/share/backgrounds/gnome/vnc-l.png"; - picture-uri-dark = "file:///run/current-system/sw/share/backgrounds/gnome/vnc-d.png"; - }; - "org/gnome/desktop/screensaver" = { - picture-uri = "file:///run/current-system/sw/share/backgrounds/gnome/vnc-d.png"; - primary-color = "#3465a4"; - secondary-color = "#000000"; - }; - }; - home.packages = with pkgs; [ - gnomeExtensions.user-themes - gnomeExtensions.tray-icons-reloaded - gnomeExtensions.vitals - gnomeExtensions.dash-to-panel - gnomeExtensions.sound-output-device-chooser - gnomeExtensions.space-bar - ]; - home.sessionVariables.GTK_THEME = "palenight"; + home.packages = builtins.attrValues { + inherit + (pkgs.gnomeExtensions) + user-themes + tray-icons-reloaded + vitals + dash-to-panel + sound-output-device-chooser + space-bar + ; + }; + home.sessionVariables.GTK_THEME = "palenight"; home.pointerCursor = { gtk.enable = true; diff --git a/hosts/DANIELKNB1/configuration.nix b/hosts/DANIELKNB1/configuration.nix index f3788876..4f5ee9f9 100644 --- a/hosts/DANIELKNB1/configuration.nix +++ b/hosts/DANIELKNB1/configuration.nix @@ -1,4 +1,4 @@ -{ config, lib, pkgs, rootPath, ... }: +{ config, lib, pkgs, rootPath, unstable, ... }: { # FIXME currently disabled due to Windows-Update 21.11.23 @@ -9,11 +9,11 @@ base.general.wsl = true; programs.docker.enable = true; # DONT the nixos-2211 hack might cause build problems finally, WIP investigating https://github.com/573/nix-config-1/actions/runs/10269489465/job/28415058034 -# wsl = { -# scanner.enable = false; -# usbip.enable = false; -# yubikey.enable = false; -# }; + # wsl = { + # scanner.enable = false; + # usbip.enable = false; + # yubikey.enable = false; + # }; wsl.usbip.autoAttach = [ "1-2" ]; system.nvidia.enable = false; # i. e. https://github.com/Gerschtli/nix-config/blob/ba690b64b54333c18eadd31b6d51cca8c7805fbe/hosts/argon/configuration.nix#L44 diff --git a/hosts/DANIELKNB1/home-nixos.nix b/hosts/DANIELKNB1/home-nixos.nix index ace39b56..3e89c350 100644 --- a/hosts/DANIELKNB1/home-nixos.nix +++ b/hosts/DANIELKNB1/home-nixos.nix @@ -1,4 +1,15 @@ -{ config, lib, pkgs, rootPath, inputs, ... }: { +/** +Original author's home'nix files are always prefixed with `{ config, lib, pkgs, ... }:` header + +For `[latest]` and `[unstable]` parameters determine a solution (./../../nixos/programs/docker.nix also has the issue yet) +*/ +{ lib, pkgs, /*latest, unstable,*/ ... }: +let + inherit (lib) + attrValues + ; +in +{ custom = { base = { @@ -53,61 +64,81 @@ #]; home.file.".mob".text = '' - MOB_TIMER_USER="Daniel" - MOB_DONE_SQUASH="squash-wip" - ''; + MOB_TIMER_USER="Daniel" + MOB_DONE_SQUASH="squash-wip" + ''; + + home.packages = attrValues { + #with pkgs; [ + inherit + (pkgs) + #alejandra + shellharden + shfmt + #rnix-lsp + #deadnix + #statix + #nixfmt + # lua-language-server + # nodePackages.bash-language-server + # nodePackages.vim-language-server + #deno + # stylua + sqlite + # nodePackages.vscode-json-languageserver-bin + xsel + #nodejs_latest + #shellcheck + chafa + #cachix + #nil + w3m + #fff + #my-neovim + #manix + #lolcat + epr + #my-emacs + #pandoc + #rustenv + # this version fails, use version before https://github.com/573/nix-config-1/actions/runs/6589493931/job/17904090802 + #yt-dlp + # micro + # jdt-language-server + #ranger + #pup + difftastic + # bashdb + # desed + # gradle-vscode-extension.vscode-gradle + jacinda + # mermaid-cli + dstask + nix-prefetch + hadolint + hurl + ; + + /*inherit + (unstable) + oxker + ;*/ - home.packages = with pkgs; [ - #alejandra - shellharden - shfmt - #rnix-lsp - #deadnix - #statix - #nixfmt -# lua-language-server - # nodePackages.bash-language-server -# nodePackages.vim-language-server - #deno -# stylua - sqlite - # nodePackages.vscode-json-languageserver-bin - xsel - #nodejs_latest - #shellcheck - chafa - #cachix - #nil - w3m - #fff - #my-neovim - #manix - #lolcat - epr - #my-emacs - #pandoc - #rustenv - # this version fails, use version before https://github.com/573/nix-config-1/actions/runs/6589493931/job/17904090802 - #yt-dlp -# micro -# jdt-language-server - #ranger - #pup - difftastic -# bashdb -# desed -# gradle-vscode-extension.vscode-gradle - python310Packages.pudb - jacinda -# mermaid-cli - dstask - nixgl.nixGLIntel - nix-prefetch - hadolint - csvlens - hurl - oxker - ]; + inherit + (pkgs.python310Packages) + pudb + ; + + inherit + (pkgs.nixgl) + nixGLIntel + ; + + /*inherit + (latest) + csvlens + ;*/ + }; /* home.file = { ".emacs.d/early-init.el".text = '' diff --git a/hosts/localhost/home-u0_a210.nix b/hosts/localhost/home-u0_a210.nix index a09a51fa..41f7cd6d 100644 --- a/hosts/localhost/home-u0_a210.nix +++ b/hosts/localhost/home-u0_a210.nix @@ -1,8 +1,4 @@ { config, lib, pkgs, inputs, rootPath, ... }: -let - inherit (lib) - mkDefault; -in { custom = { base = { diff --git a/hosts/maiziedemacchiato/home-dani.nix b/hosts/maiziedemacchiato/home-dani.nix index 45601824..2949468e 100644 --- a/hosts/maiziedemacchiato/home-dani.nix +++ b/hosts/maiziedemacchiato/home-dani.nix @@ -1,7 +1,26 @@ -{ config, lib, pkgs, inputs, rootPath, ... }: +/** +Original author's home'nix files are always prefixed with `{ config, lib, pkgs, ... }:` header + +For `[haskellPackages]` parameter determine a solution (./../../nixos/programs/docker.nix also has the issue yet) +*/ +{ config, lib, pkgs, /*libreoffice-postscript,*/ inputs, rootPath, ... }: let - inherit (lib) - mkDefault; + inherit + (lib) + attrValues + mkDefault + ; + inherit + (pkgs) + writeScriptBin + runtimeShell + ; +/** +Attribute `system` here is determined that way (`inherit (pkgs.stdenv.hostPlatform) system;`) to make later use of parameter `[inputs]` here in this file (./../../home/base/desktop.nix), which is a deviation from the orinal author's intent (there an overlay is used to determine derivations from inputs, the intention of which is fine to narrow down `system` use to flake-related nix files I guess). + +If I want to rid overlays I might have to find a way with less potentially bad implications, IDK are there any ? +*/ + inherit (pkgs.stdenv.hostPlatform) system; in { custom = { @@ -74,85 +93,109 @@ in homeDirectory = "/home/dani"; username = "dani"; - packages = with pkgs; [ - #my-neovim - #ranger - #photoprism - #alejandra - shellharden - shfmt - #rnix-lsp - #deadnix - #statix - #nixfmt - #stylua - #shellcheck - #yt-dlp - #micro - #ranger - #masterpdfeditor - abcde - cups-filters - # talon - #scrcpy - autorandr - mons - xorg.libxcvt - xorg.xrandr - maim - xdotool - xclip - keepassxc - swappy - arandr - xterm - signal-desktop - #tailscale # and openssh to custom package, i. e. home/programs/ssh - #my-emacs - #openssh - dstask - # TODO https://wiki.hyprland.org/Nix/Hyprland-on-Home-Manager/ https://wiki.hyprland.org/Nix/Hyprland-on-other-distros/ https://discourse.nixos.org/t/opening-i3-from-home-manager-automatically/4849/8 https://wiki.archlinux.org/title/Display_manager - nixgl.nixGLIntel - pcmanfm - chafa - #simple-scan # memory error, potential workaround: https://github.com/NixOS/nixpkgs/issues/149812 - #tint2 # rather use at service definition themselves - #simple-scan # DONT bc simple-scan requires sane-backends which in turn requires udev rules to be in place for the scanner to be detected, so on non-nixos installations of home-manager this simply cannot work. also a mix of non-nixos host provided sane-backends vs simple-scan will not work, rather using host's simple-scan until https://github.com/NixOS/nixpkgs/issues/271989 gets recognition - #sane-frontends.out - # sane-backends only "worked" due to leftover udev files from a non-nixos host provided sane installation I removed without rebooting and so tricked the system into belief it had scanner access via standalone home-manager - # paths only seem to be there but aren't in use (version 1.0.32 of sane-backends in nixos-22.11) - # ls $(dirname $(realpath $(which scanimage)))/../etc/udev - # ls $(dirname $(realpath $(which scanimage)))/../sbin - #sane-backends # DONT bc simple-scan requires sane-backends which in turn requires udev rules to be in place for the scanner to be detected, so on non-nixos installations oof home-manager this simply cannot work. also a mix of non-nixos host provided sane-backends vs simple-scan will not work - #ocrfeeder # import pdf dialog crashes, broken on NixOS-WSL as well - ##pdfsandwich # archlinux rather, gscan2pdf, ocrmypdf - cuneiform - normcap - ##gImageReader # archlinux rather - usbutils.out - gdb - #libreoffice-qt.out - libcdio-paranoia - #mpvScripts.chapterskip - #mpvScripts.quality-menu - (nerdfonts.override { fonts = [ "UbuntuMono" ]; }) - source-code-pro - ubuntu_font_family - #spotify-player - (writeScriptBin "keyboard-de" '' + packages = attrValues { + # with pkgs; [ + inherit + (pkgs) + #my-neovim + #ranger + #photoprism + #alejandra + shellharden + shfmt + #rnix-lsp + #deadnix + #statix + #nixfmt + #stylua + #shellcheck + #yt-dlp + #micro + #ranger + #masterpdfeditor + abcde + cups-filters + # talon + #scrcpy + autorandr + mons + maim + xdotool + xclip + keepassxc + swappy + arandr + xterm + signal-desktop + #tailscale # and openssh to custom package, i. e. home/programs/ssh + #my-emacs + #openssh + dstask + # TODO https://wiki.hyprland.org/Nix/Hyprland-on-Home-Manager/ https://wiki.hyprland.org/Nix/Hyprland-on-other-distros/ https://discourse.nixos.org/t/opening-i3-from-home-manager-automatically/4849/8 https://wiki.archlinux.org/title/Display_manager + pcmanfm + chafa + #simple-scan # memory error, potential workaround: https://github.com/NixOS/nixpkgs/issues/149812 + #tint2 # rather use at service definition themselves + #simple-scan # DONT bc simple-scan requires sane-backends which in turn requires udev rules to be in place for the scanner to be detected, so on non-nixos installations of home-manager this simply cannot work. also a mix of non-nixos host provided sane-backends vs simple-scan will not work, rather using host's simple-scan until https://github.com/NixOS/nixpkgs/issues/271989 gets recognition + #sane-frontends.out + # sane-backends only "worked" due to leftover udev files from a non-nixos host provided sane installation I removed without rebooting and so tricked the system into belief it had scanner access via standalone home-manager + # paths only seem to be there but aren't in use (version 1.0.32 of sane-backends in nixos-22.11) + # ls $(dirname $(realpath $(which scanimage)))/../etc/udev + # ls $(dirname $(realpath $(which scanimage)))/../sbin + #sane-backends # DONT bc simple-scan requires sane-backends which in turn requires udev rules to be in place for the scanner to be detected, so on non-nixos installations oof home-manager this simply cannot work. also a mix of non-nixos host provided sane-backends vs simple-scan will not work + #ocrfeeder # import pdf dialog crashes, broken on NixOS-WSL as well + ##pdfsandwich # archlinux rather, gscan2pdf, ocrmypdf + cuneiform + normcap + ##gImageReader # archlinux rather + gdb + #libreoffice-qt.out + libcdio-paranoia + #mpvScripts.chapterskip + #mpvScripts.quality-menu + source-code-pro + ubuntu_font_family + #spotify-player + #gtt + notepad-next + ; + + inherit + (pkgs.usbutils) + out + ; + + inherit + (pkgs.xorg) + libxcvt + xrandr + ; + + inherit + (pkgs.nixgl) + nixGLIntel + ; + + inherit + (inputs.libreoffice-postscript.legacyPackages.${system}) + libreoffice + ; + + nerdfonts = + pkgs.nerdfonts.override { fonts = [ "UbuntuMono" ]; }; + + keyboard-de = (writeScriptBin "keyboard-de" '' #!${runtimeShell} setxkbmap -model pc104 -layout de - '') - (writeScriptBin "keyboard-en" '' + ''); + + keyboard-en = (writeScriptBin "keyboard-en" '' #!${runtimeShell} setxkbmap -model pc104 -layout us -variant altgr-intl - '') - libreoffice - #gtt - notepad-next - ]; + ''); + }; diff --git a/hosts/sams9/home-nix-on-droid.nix b/hosts/sams9/home-nix-on-droid.nix index 0fdc3451..26afd991 100644 --- a/hosts/sams9/home-nix-on-droid.nix +++ b/hosts/sams9/home-nix-on-droid.nix @@ -1,4 +1,12 @@ -{ config, lib, pkgs, rootPath, ... }: { +{ config, lib, pkgs, unstable, rootPath, ... }: +let + inherit + (lib) + attrValues + ; +in + +{ custom = { base = { general.lightWeight = true; @@ -17,7 +25,7 @@ programs = { tex.enable = true; - # hledger.enable = true; + hledger.enable = true; shell = { logoutExtra = '' count="$(ps -e | grep proot-static | wc -l)" @@ -31,11 +39,11 @@ # ''; }; -# ssh = { -# cleanKeysOnShellStartup = false; -# controlMaster = "no"; -# modules = [ "private" ]; -# }; + # ssh = { + # cleanKeysOnShellStartup = false; + # controlMaster = "no"; + # modules = [ "private" ]; + # }; # FIXME: tmux does not start tmux.enable = lib.mkForce false; @@ -44,7 +52,8 @@ }; home = { - packages = with pkgs; [ + packages = attrValues { + # with pkgs; [ /* (writeShellScriptBin "tailscale" '' ${pkgs.sysvtools}/bin/pidof tailscaled &>/dev/null || { @@ -53,7 +62,7 @@ } [[ -n $1 ]] && { - ${pkgs.tailscale}/bin/tailscale "$@" + ${unstable.tailscale}/bin/tailscale "$@" } '') */ @@ -63,8 +72,11 @@ #mermaid-cli #chafa # asciinema - nix-inspect - ]; + inherit + (pkgs) + nix-inspect + ; + }; activation = let inherit config; in { copyFont = diff --git a/hosts/sams9/nix-on-droid.nix b/hosts/sams9/nix-on-droid.nix index 622a5d6b..41de7793 100644 --- a/hosts/sams9/nix-on-droid.nix +++ b/hosts/sams9/nix-on-droid.nix @@ -1,4 +1,4 @@ -{ config, lib, pkgs, homeModules, inputs, rootPath, ... }@configArgs: +{ config, lib, pkgs, homeModules, inputs, rootPath, system, ... }@configArgs: let sshdTmpDirectory = "${config.user.home}/sshd-tmp"; @@ -39,7 +39,8 @@ in environment = { etcBackupExtension = ".nod-bak"; motd = null; - packages = with pkgs; [ + packages = builtins.attrValues { + inherit (pkgs) diffutils findutils gawk @@ -55,6 +56,15 @@ in gzip which micro + kalker + ; + } ++ (let + inherit (pkgs) + writeScriptBin + runtimeShell + openssh + ; + in [ (writeScriptBin "debug-ssl" '' #!${runtimeShell} @@ -66,8 +76,7 @@ in echo "Starting sshd in non-daemonized way on port 8022" ${openssh}/bin/sshd -f "${sshdDirectory}/sshd_config" -D '') - kalker - ]; + ]); }; home-manager = { diff --git a/hosts/twopi/configuration.nix b/hosts/twopi/configuration.nix index 62c97004..fe76f7e0 100644 --- a/hosts/twopi/configuration.nix +++ b/hosts/twopi/configuration.nix @@ -36,8 +36,8 @@ #networking.wireless = { # enable = true; - #environmentFile = config.age.secrets.wireless-config.path; - #networks."Vodafone-12345".psk = "@PSK@"; + #environmentFile = config.age.secrets.wireless-config.path; + #networks."Vodafone-12345".psk = "@PSK@"; #}; # needed because wpa_supplicant fails on startup diff --git a/lib/common-config.nix b/lib/common-config.nix index 93cae246..bbc75781 100644 --- a/lib/common-config.nix +++ b/lib/common-config.nix @@ -3,15 +3,26 @@ _: { lib, pkgs, homeModules ? [ ], inputs, rootPath, ... }: { +/** +see also ./../flake/builders/mkHome.nix `homeManagerConfiguration.extraSpecialArgs` there and `homeManagerConfiguration.modules` +*/ homeManager = { baseConfig = { backupFileExtension = "hm-bak"; - extraSpecialArgs = { inherit inputs rootPath; }; + /** + as in ./../flake/default.nix `homeManagerConfiguration.extraSpecialArgs` + */ + extraSpecialArgs = { + inherit inputs rootPath; + }; sharedModules = homeModules; useGlobalPkgs = true; # disables options nixpkgs.* useUserPackages = true; }; + /** + as in ./../flake/default.nix `homeManagerConfiguration.modules` + */ userConfig = host: user: "${rootPath}/hosts/${host}/home-${user}.nix"; }; @@ -19,6 +30,7 @@ _: settings = { # TODO https://discourse.nixos.org/t/merged-list-contains-duplicates/38004 substituters = [ + "https://anmonteiro.nix-cache.workers.dev" "https://573-bc.cachix.org/" "https://cache.nixos.org/" "https://nix-on-droid.cachix.org/" @@ -34,6 +46,7 @@ _: "https://yazi.cachix.org" ]; trusted-public-keys = lib.mkForce [ + "ocaml.nix-cache.com-1:/xI2h2+56rwFfKyyFVbkJSeGqSIYMC/Je+7XXqGKDIY=" "573-bc.cachix.org-1:2XtNmCSdhLggQe4UTa4i3FSDIbYWx/m1gsBOxS6heJs=" "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=" "nix-on-droid.cachix.org-1:56snoMJTXmDRC1Ei24CmKoUqvHJ9XCp+nidK7qkMQrU=" @@ -55,7 +68,10 @@ _: flake-registry = null; # "${inputs.flake-registry}/flake-registry.json"; # maybe DONT as this causes potential inconsistencies: just compare https://github.com/NixOS/flake-registry/blob/ffa18e3/flake-registry.json#L308 (nixpkgs-unstable) vs. inputs.nixpkgs (nixos-24.05) }; - package = pkgs.nixVersions.nix_2_20; # until fixed: https://discourse.nixos.org/t/need-help-with-this-git-related-flake-update-error/50538/7 + + package = pkgs.nixVersions.nix_2_20; + # until fixed: https://discourse.nixos.org/t/need-help-with-this-git-related-flake-update-error/50538/7 + # https://discourse.nixos.org/t/flake-registry-set-to-a-store-path-keeps-copying/44613 # https://nixos.org/manual/nix/stable/command-ref/new-cli/nix3-registry # https://nixos-and-flakes.thiscute.world/best-practices/nix-path-and-flake-registry @@ -68,7 +84,7 @@ _: nix-config.flake = inputs.self; "nixpkgs-unfree".to = { type = "path"; - path = inputs.nixpkgs-unfree; + path = inputs.nixpkgs-unfree; }; }; nixPath = [ "nixpkgs=flake:nixpkgs" ]; diff --git a/nixos/base/general.nix b/nixos/base/general.nix index e4036c41..8bae04e5 100644 --- a/nixos/base/general.nix +++ b/nixos/base/general.nix @@ -1,4 +1,4 @@ -{ config, lib, pkgs, homeModules, inputs, rootPath, ... }@configArgs: +{ config, lib, pkgs, homeModules, inputs, rootPath, unstable, ... }@configArgs: # TODO https://github.com/search?q=repo%3AGerschtli%2Fnix-config%20custom.base.desktop&type=code let inherit (lib) diff --git a/nixos/misc/agenix-rekey.nix b/nixos/misc/agenix-rekey.nix index f523e1bc..b1609d91 100644 --- a/nixos/misc/agenix-rekey.nix +++ b/nixos/misc/agenix-rekey.nix @@ -1,17 +1,17 @@ { config, lib, inputs, ... }: let - inherit (lib) + inherit (lib) mkEnableOption mkIf ; cfg = config.custom.agenix-rekey; - in +in { imports = [ # TODO get used to handling first, see example at https://github.com/oddlama/agenix-rekey/pull/28#issue-2331901837 # with these imports assert fails as long TODO not finished -# inputs.agenix.nixosModules.default -# inputs.agenix-rekey.nixosModules.default + # inputs.agenix.nixosModules.default + # inputs.agenix-rekey.nixosModules.default ]; @@ -24,6 +24,6 @@ let ###### implementation config = mkIf cfg.enable { - age = {}; + age = { }; }; } diff --git a/nixos/misc/ids.nix b/nixos/misc/ids.nix index 22333d2e..422cc4ba 100644 --- a/nixos/misc/ids.nix +++ b/nixos/misc/ids.nix @@ -60,7 +60,7 @@ in # https://github.com/nix-community/NixOS-WSL/blob/0fa9268bf9a903498cb567e6d4d01eb945f36f6e/modules/wsl-distro.nix#L120 nixos = 1000; - dani = 1001; + dani = 1001; #funktionstester = 1000; }; diff --git a/nixos/programs/docker.nix b/nixos/programs/docker.nix index 0e18f0ae..51d9cee2 100644 --- a/nixos/programs/docker.nix +++ b/nixos/programs/docker.nix @@ -1,4 +1,9 @@ -{ config, lib, pkgs, inputs, ... }: +/** +see ./../../flake/builders/mkNixos.nix line `++ customLibFor.${system}.listNixFilesRecursive "${rootPath}/nixos";` and ./../../flake/default.nix `customLibFor` declaration + +Same as written in ./../../flake/builders/mkNixos.nix should apply here (regarding `specialArgs` injection) as the anonymous module is a module next to `"${rootPath}/hosts/${name}/configuration.nix"` there +*/ +{ config, lib, /* unstable,*/ pkgs, inputs, ... }: let inherit (lib) @@ -10,11 +15,11 @@ let in { -# imports = [ -# (args@{ pkgs, ... }: -# import "${inputs.unstable.outPath}/nixos/modules/services/hardware/nvidia-container-toolkit" -# (args // { pkgs = inputs.unstable.legacyPackages.${pkgs.system}; })) -# ]; + # imports = [ + # (args@{ pkgs, ... }: + # import "${inputs.unstable.outPath}/nixos/modules/services/hardware/nvidia-container-toolkit" + # (args // { pkgs = inputs.unstable.legacyPackages.${pkgs.system}; })) + # ]; ###### interface @@ -34,7 +39,7 @@ in virtualisation = { docker = { enable = true; - package = pkgs.docker_25; + #package = pkgs.docker_24; #unstable.docker_25; # enableNvidia = true; storageDriver = "overlay2"; @@ -46,13 +51,13 @@ in # for the "whole" discussion of it (rootless or not) i. e. https://discourse.nixos.org/t/docker-rootless-with-nvidia-support/37069 setSocketVariable = true; # false for driver exact support /* daemon.settings = { - runtimes = { - nvidia = { - path = "${pkgs.nvidia-docker}/bin/nvidia-container-runtime"; - }; - }; + runtimes = { + nvidia = { + path = "${pkgs.nvidia-docker}/bin/nvidia-container-runtime"; + }; + }; }; - */ + */ }; }; }; diff --git a/nixos/system/nvidia.nix b/nixos/system/nvidia.nix index 2f250c46..7e6a0c0e 100644 --- a/nixos/system/nvidia.nix +++ b/nixos/system/nvidia.nix @@ -1,4 +1,4 @@ -{ config, lib, pkgs, inputs, system, ... }: +{ config, lib, pkgs, unstable, inputs, system, ... }: let inherit (lib) @@ -22,20 +22,20 @@ in ###### implementation config = mkIf cfg.enable { -# TODO https://discourse.nixos.org/t/use-a-module-from-nixpkgs-unstable-in-flake/31463/9 - - #hardware.graphics = { - # enable = true; -# # https://search.nixos.org/options?channel=unstable&from=0&size=50&sort=relevance&type=packages&query=32enable32Bit -# # AFAIC here lies the problem using nixos-wsl also (needs nixpkgs-unstable, but pkgs here is not, but nixos-24.05) - # enable32Bit = true; - #}; - # TODO Separate nvidia.nix - hardware.opengl = { - enable = true; - driSupport32Bit = true; - }; - /* + # TODO https://discourse.nixos.org/t/use-a-module-from-nixpkgs-unstable-in-flake/31463/9 + + #hardware.graphics = { + # enable = true; + # # https://search.nixos.org/options?channel=unstable&from=0&size=50&sort=relevance&type=packages&query=32enable32Bit + # # AFAIC here lies the problem using nixos-wsl also (needs nixpkgs-unstable, but pkgs here is not, but nixos-24.05) + # enable32Bit = true; + #}; + # TODO Separate nvidia.nix + hardware.opengl = { + enable = true; + driSupport32Bit = true; + }; + /* # Load nvidia driver for Xorg and Wayland services.xserver.videoDrivers = [ "nvidia" ]; @@ -60,16 +60,18 @@ in open = false; # Enable the Nvidia settings menu, - # accessible via `nvidia-settings`. + # accessible via `nvidia-settings`. nvidiaSettings = true; # Optionally, you may need to select the appropriate driver version for your specific GPU. package = config.boot.kernelPackages.nvidiaPackages.stable; }; - environment.systemPackages = with pkgs; [ - cudatoolkit - ]; + environment.systemPackages = attrValues {# with pkgs; [ + inherit (unstable.cudaPackages) + cudatoolkit + ; + }; */ }; diff --git a/nixos/wsl/usbip.nix b/nixos/wsl/usbip.nix index d82c7694..6afd2f64 100644 --- a/nixos/wsl/usbip.nix +++ b/nixos/wsl/usbip.nix @@ -54,10 +54,10 @@ in services."usbip-auto-attach@" = { description = "Auto attach device having busid %i with usbip"; #after = [ "wsl-vpnkit-auto.target" ]; FIXME how - # https://search.nixos.org/options?channel=24.05&show=systemd.services.%3Cname%3E.after&from=0&size=50&sort=relevance&type=packages&query=systemd.services - # "If the specified units are started at the same time as this unit, delay this unit until they have started." + # https://search.nixos.org/options?channel=24.05&show=systemd.services.%3Cname%3E.after&from=0&size=50&sort=relevance&type=packages&query=systemd.services + # "If the specified units are started at the same time as this unit, delay this unit until they have started." # name being network there https://github.com/nix-community/NixOS-WSL/blob/f5a6c03/modules/usbip.nix - after = [ "wsl-vpnkit.target" ]; + after = [ "wsl-vpnkit.target" ]; scriptArgs = "%i"; path = with pkgs; [ @@ -74,9 +74,9 @@ in ''; }; - # https://search.nixos.org/options?channel=24.05&show=systemd.targets.%3Cname%3E.wants&from=0&size=50&sort=relevance&type=packages&query=systemd.targets - # https://search.nixos.org/options?channel=24.05&show=systemd.services.%3Cname%3E.wants&from=0&size=50&sort=relevance&type=packages&query=systemd.services - # "systemd.services..wants" + # https://search.nixos.org/options?channel=24.05&show=systemd.targets.%3Cname%3E.wants&from=0&size=50&sort=relevance&type=packages&query=systemd.targets + # https://search.nixos.org/options?channel=24.05&show=systemd.services.%3Cname%3E.wants&from=0&size=50&sort=relevance&type=packages&query=systemd.services + # "systemd.services..wants" # "Start the specified units when this unit is started." # name being multi-user there https://github.com/nix-community/NixOS-WSL/blob/f5a6c03/modules/usbip.nix targets.wsl-vpnkit.wants = map (busid: "usbip-auto-attach@${busid}.service") cfg.autoAttach; diff --git a/nixos/wsl/wsl-vpnkit.nix b/nixos/wsl/wsl-vpnkit.nix index ba4219a2..b6efc16d 100644 --- a/nixos/wsl/wsl-vpnkit.nix +++ b/nixos/wsl/wsl-vpnkit.nix @@ -1,15 +1,62 @@ - +/** +see ./../programs/docker.nix for similar issue +*/ { config , lib , pkgs +, inputs +/*, unstable*/ , ... }: let inherit (lib) - mkIf - mkEnableOption - optionalAttrs - ; + mkIf + mkEnableOption + optionalAttrs + ; + +/** +Attribute `system` here is determined that way (`inherit (pkgs.stdenv.hostPlatform) system;`) to make later use of parameter `[inputs]` here in this file (./../../home/base/desktop.nix), which is a deviation from the orinal author's intent (there an overlay is used to determine derivations from inputs, the intention of which is fine to narrow down `system` use to flake-related nix files I guess). + +If I want to rid overlays I might have to find a way with less potentially bad implications, IDK are there any ? +*/ + inherit (pkgs.stdenv.hostPlatform) system; + + + # FIXME FIXME https://github.com/NixOS/nixpkgs/issues/5725#issuecomment-72851235 + # FIXME is workaround until upstream has the PR accepted, see https://github.com/nix-community/NixOS-WSL/issues/262#issuecomment-1825648537 + wsl-vpnkit = + let inherit (inputs.unstable.legacyPackages.${system}) + lib + findutils + pstree + resholve + wsl-vpnkit; + in + wsl-vpnkit.override { + resholve = + resholve + // { + mkDerivation = attrs @ { solutions, ... }: + resholve.mkDerivation (lib.recursiveUpdate attrs { + src = inputs.wsl-vpnkit; + + solutions.wsl-vpnkit = { + inputs = + solutions.wsl-vpnkit.inputs + ++ [ + findutils + pstree + ]; + + execer = + solutions.wsl-vpnkit.execer + ++ [ "cannot:${pstree}/bin/pstree" ]; + }; + }); + }; + }; + cfg = config.custom.wsl.wsl-vpnkit; in @@ -32,62 +79,62 @@ in }; config = mkIf (cfg.enable) { - systemd = { - services = { - wsl-vpnkit-auto = { - enable = cfg.autoVPN; - description = "wsl-vpnkit"; - - path = [pkgs.iputils]; - script = '' - has_internet () { - ping -q -w 1 -c 1 8.8.8.8 >/dev/null - } - - has_company_network () { - ping -q -w 1 -c 1 ${cfg.checkURL} >/dev/null - } - - is_active_wsl-vpnkit () { - systemctl is-active -q wsl-vpnkit.service - } - - main () { - if is_active_wsl-vpnkit; then - if has_internet && ! has_company_network; then - echo "Stopping wsl-vpnkit..." - systemctl stop wsl-vpnkit.service - fi - else - if ! has_internet; then - echo "Starting wsl-vpnkit..." - systemctl start wsl-vpnkit.service - fi - fi - } - - while : - do - main - sleep 5 - done - ''; - - wantedBy = ["multi-user.target"]; - }; - - wsl-vpnkit = { - enable = true; - description = "wsl-vpnkit"; - - serviceConfig = { - ExecStart = "${pkgs.wsl-vpnkit}/bin/wsl-vpnkit"; - Type = "idle"; - Restart = "always"; - KillMode = "mixed"; - }; - }; - }; + systemd = { + services = { + wsl-vpnkit-auto = { + enable = cfg.autoVPN; + description = "wsl-vpnkit"; + + path = [ pkgs.iputils ]; + script = '' + has_internet () { + ping -q -w 1 -c 1 8.8.8.8 >/dev/null + } + + has_company_network () { + ping -q -w 1 -c 1 ${cfg.checkURL} >/dev/null + } + + is_active_wsl-vpnkit () { + systemctl is-active -q wsl-vpnkit.service + } + + main () { + if is_active_wsl-vpnkit; then + if has_internet && ! has_company_network; then + echo "Stopping wsl-vpnkit..." + systemctl stop wsl-vpnkit.service + fi + else + if ! has_internet; then + echo "Starting wsl-vpnkit..." + systemctl start wsl-vpnkit.service + fi + fi + } + + while : + do + main + sleep 5 + done + ''; + + wantedBy = [ "multi-user.target" ]; + }; + + wsl-vpnkit = { + enable = true; + description = "wsl-vpnkit"; + + serviceConfig = { + ExecStart = "${wsl-vpnkit}/bin/wsl-vpnkit"; + Type = "idle"; + Restart = "always"; + KillMode = "mixed"; + }; + }; + }; }; }; }