From 9a29351335a061f59f67ed0abdaec1f7de99738b Mon Sep 17 00:00:00 2001 From: Ughur Alakbarov Date: Mon, 17 Jun 2024 12:43:34 +0200 Subject: [PATCH] refactor(ugura-custom): pull the flake into a separate repo; add it as a submodule locally The reason is that relative-path-flakes are broken: - https://discourse.nixos.org/t/flakes-re-locking-necessary-at-each-evaluation-when-import-sub-flake-by-path/34465 - https://github.com/NixOS/nix/issues/9339 --- .gitmodules | 3 ++ custom | 1 + custom/flake.nix | 29 ----------- custom/modules/home/default.nix | 2 - custom/modules/nixos/default.nix | 2 - custom/overlays/default.nix | 3 -- custom/overlays/flake-inputs.nix | 19 ------- .../legacy/ddcci-plasmoid-backend/default.nix | 52 ------------------- custom/pkgs/legacy/ddcci-plasmoid/default.nix | 44 ---------------- custom/pkgs/legacy/default.nix | 6 --- flake.lock | 15 +++--- flake.nix | 2 +- 12 files changed, 14 insertions(+), 164 deletions(-) create mode 100644 .gitmodules create mode 160000 custom delete mode 100644 custom/flake.nix delete mode 100644 custom/modules/home/default.nix delete mode 100644 custom/modules/nixos/default.nix delete mode 100644 custom/overlays/default.nix delete mode 100644 custom/overlays/flake-inputs.nix delete mode 100644 custom/pkgs/legacy/ddcci-plasmoid-backend/default.nix delete mode 100644 custom/pkgs/legacy/ddcci-plasmoid/default.nix delete mode 100644 custom/pkgs/legacy/default.nix diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..35e8dd6 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "custom"] + path = custom + url = ./custom diff --git a/custom b/custom new file mode 160000 index 0000000..b6eb8d6 --- /dev/null +++ b/custom @@ -0,0 +1 @@ +Subproject commit b6eb8d68a89cacbc3d7d4eec702930de22baaf35 diff --git a/custom/flake.nix b/custom/flake.nix deleted file mode 100644 index 0f245dc..0000000 --- a/custom/flake.nix +++ /dev/null @@ -1,29 +0,0 @@ -{ - description = "all of the custom stuff I reexport into the main flake"; - - inputs = { - nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; - flake-utils.url = "github:numtide/flake-utils"; - }; - - outputs = { - nixpkgs, - flake-utils, - ... - } @ inputs: - flake-utils.lib.eachDefaultSystem ( - system: let - pkgs = nixpkgs.legacyPackages.${system}; - in { - # My custom packages, available through 'nix build', 'nix shell', etc - legacyPackages = import ./pkgs/legacy {inherit pkgs;}; - - # My custom modules - nixosModules = import ./modules/nixos; - homeManagerModules = import ./modules/home; - - # My custom overlays - overlays = import ./overlays {inherit inputs;}; - } - ); -} diff --git a/custom/modules/home/default.nix b/custom/modules/home/default.nix deleted file mode 100644 index 2c63c08..0000000 --- a/custom/modules/home/default.nix +++ /dev/null @@ -1,2 +0,0 @@ -{ -} diff --git a/custom/modules/nixos/default.nix b/custom/modules/nixos/default.nix deleted file mode 100644 index 2c63c08..0000000 --- a/custom/modules/nixos/default.nix +++ /dev/null @@ -1,2 +0,0 @@ -{ -} diff --git a/custom/overlays/default.nix b/custom/overlays/default.nix deleted file mode 100644 index a81dcc5..0000000 --- a/custom/overlays/default.nix +++ /dev/null @@ -1,3 +0,0 @@ -{inputs, ...}: { - flake-inputs = import ./flake-inputs.nix {inherit inputs;}; -} diff --git a/custom/overlays/flake-inputs.nix b/custom/overlays/flake-inputs.nix deleted file mode 100644 index 8273b16..0000000 --- a/custom/overlays/flake-inputs.nix +++ /dev/null @@ -1,19 +0,0 @@ -{inputs, ...}: -# For every flake input, aliases on of -# - 'inputs.${flake}.packages.${pkgs.system}' -# - 'inputs.${flake}.legacyPackages.${pkgs.system}' -# to 'pkgs.inputs.${flake}' -# https://github.com/Misterio77/nix-config/blob/main/overlays/default.nix#L8-L20 -final: _: { - inputs = - builtins.mapAttrs ( - _: flake: let - legacyPackages = (flake.legacyPackages or {}).${final.system} or {}; - packages = (flake.packages or {}).${final.system} or {}; - in - if legacyPackages != {} - then legacyPackages - else packages - ) - inputs; -} diff --git a/custom/pkgs/legacy/ddcci-plasmoid-backend/default.nix b/custom/pkgs/legacy/ddcci-plasmoid-backend/default.nix deleted file mode 100644 index 8ef0ffc..0000000 --- a/custom/pkgs/legacy/ddcci-plasmoid-backend/default.nix +++ /dev/null @@ -1,52 +0,0 @@ -# stolen from an unforunately not merged PR -# https://github.com/NixOS/nixpkgs/pull/283006 -{ - lib, - fetchFromGitHub, - python3Packages, - ddcutil, -}: -python3Packages.buildPythonPackage rec { - pname = "ddcci-plasmoid-backend"; - version = "0.1.10-kf6"; - - format = "pyproject"; - - src = - fetchFromGitHub { - owner = "davidhi7"; - repo = "ddcci-plasmoid"; - rev = "refs/tags/v${version}"; - hash = "sha256-/UTIflcUyPHMQ2CQG0d2R0MaKuXYmlvnYnLNQ+nMWvw="; - } - + "/backend"; - - nativeBuildInputs = with python3Packages; [ - pythonRelaxDepsHook - poetry-core - ]; - - pythonRelaxDeps = [ - "fasteners" - ]; - - propagatedBuildInputs = with python3Packages; [ - fasteners - ]; - - nativeCheckInputs = with python3Packages; [ - pytestCheckHook - ]; - - preFixup = '' - makeWrapperArgs+=(--prefix PATH : ${lib.makeBinPath [ddcutil]}) - ''; - - meta = with lib; { - description = "ddcci python backend for KDE plasma ddcci-plasmoid"; - homepage = "https://github.com/davidhi7/ddcci-plasmoid"; - license = licenses.mit; - platforms = platforms.linux; - maintainers = with maintainers; [sund3RRR]; - }; -} diff --git a/custom/pkgs/legacy/ddcci-plasmoid/default.nix b/custom/pkgs/legacy/ddcci-plasmoid/default.nix deleted file mode 100644 index 7912962..0000000 --- a/custom/pkgs/legacy/ddcci-plasmoid/default.nix +++ /dev/null @@ -1,44 +0,0 @@ -# stolen from an unforunately not merged PR -# https://github.com/NixOS/nixpkgs/pull/283006 -{ - lib, - stdenvNoCC, - fetchFromGitHub, - # use this package instead of the one in python3Packages - # because, well, that one isn't there - ddcci-plasmoid-backend, -}: -stdenvNoCC.mkDerivation rec { - pname = "ddcci-plasmoid"; - version = "0.1.10-kf6"; - - src = fetchFromGitHub { - owner = "davidhi7"; - repo = "ddcci-plasmoid"; - rev = "refs/tags/v${version}"; - hash = "sha256-/UTIflcUyPHMQ2CQG0d2R0MaKuXYmlvnYnLNQ+nMWvw="; - }; - - postPatch = '' - substituteInPlace plasmoid/contents/config/main.xml \ - --replace "python3 -m ddcci_plasmoid_backend" \ - "${ddcci-plasmoid-backend}/bin/ddcci_plasmoid_backend" - ''; - - installPhase = '' - runHook preInstall - - mkdir -p $out/share/plasma/plasmoids/de.davidhi.ddcci-brightness - cp -r ./plasmoid/* $out/share/plasma/plasmoids/de.davidhi.ddcci-brightness/ - - runHook postInstall - ''; - - meta = with lib; { - description = "KDE Plasma Widget for external monitor brightness adjustment using ddcutil"; - homepage = "https://github.com/davidhi7/ddcci-plasmoid"; - license = licenses.mit; - platforms = platforms.linux; - maintainers = with maintainers; [sund3RRR]; - }; -} diff --git a/custom/pkgs/legacy/default.nix b/custom/pkgs/legacy/default.nix deleted file mode 100644 index 5c0e28b..0000000 --- a/custom/pkgs/legacy/default.nix +++ /dev/null @@ -1,6 +0,0 @@ -{pkgs, ...}: let - inherit (pkgs) callPackage; -in rec { - ddcci-plasmoid-backend = callPackage ./ddcci-plasmoid-backend {}; - ddcci-plasmoid = callPackage ./ddcci-plasmoid {inherit ddcci-plasmoid-backend;}; -} diff --git a/flake.lock b/flake.lock index facb0e1..0c4ccc3 100644 --- a/flake.lock +++ b/flake.lock @@ -331,14 +331,17 @@ ] }, "locked": { - "lastModified": 1, - "narHash": "sha256-5xYTWiD8zj3sbqSwkLTIWgaIaP8Bh3cBLenh7YqG9r0=", - "path": "/nix/store/1vgm18d6c0pm46dvdc9hqaxvi7grxvk5-source/custom", - "type": "path" + "lastModified": 1718620619, + "narHash": "sha256-9TEOKhltapnI8xHvPHqLXWLKC0ZcmxvHKY7UyvFGIik=", + "owner": "ugur-a", + "repo": "flake-custom", + "rev": "b6eb8d68a89cacbc3d7d4eec702930de22baaf35", + "type": "github" }, "original": { - "path": "/nix/store/1vgm18d6c0pm46dvdc9hqaxvi7grxvk5-source/custom", - "type": "path" + "owner": "ugur-a", + "repo": "flake-custom", + "type": "github" } } }, diff --git a/flake.nix b/flake.nix index b61c070..770f0c9 100644 --- a/flake.nix +++ b/flake.nix @@ -24,7 +24,7 @@ firefox-addons.inputs.flake-utils.follows = "flake-utils"; # My custom stuff - ugura-custom.url = "./custom"; + ugura-custom.url = "github:ugur-a/flake-custom"; ugura-custom.inputs.nixpkgs.follows = "nixpkgs"; ugura-custom.inputs.flake-utils.follows = "flake-utils"; };