summary refs log tree commit diff
diff options
context:
space:
mode:
authorVika <vika@fireburn.ru>2025-01-07 08:43:24 +0300
committerVika <vika@fireburn.ru>2025-01-07 08:43:24 +0300
commit0d86e157cb4fbb5e7480b4d5c1014a1ea78be3d3 (patch)
treefb90ba3a8bb2cbdce9b8c22abaf80e3ce3b98f30
parent0db801b049e752f4c78af0cf5ee5f728b5b1dced (diff)
downloadxdg-desktop-portal-systemd-0d86e157cb4fbb5e7480b4d5c1014a1ea78be3d3.tar.zst
Initial packaging for NixOS
-rw-r--r--.envrc1
-rw-r--r--default.nix29
-rw-r--r--flake.lock78
-rw-r--r--flake.nix33
-rw-r--r--xdg-desktop-portal-systemd.portal3
5 files changed, 144 insertions, 0 deletions
diff --git a/.envrc b/.envrc
new file mode 100644
index 0000000..a5dbbcb
--- /dev/null
+++ b/.envrc
@@ -0,0 +1 @@
+use flake .
diff --git a/default.nix b/default.nix
new file mode 100644
index 0000000..a5650c9
--- /dev/null
+++ b/default.nix
@@ -0,0 +1,29 @@
+{ crane, lib }:
+let
+  src = crane.cleanCargoSource ./.;
+
+  args = {
+    inherit src;
+    strictDeps = true;
+
+    meta = with lib.meta; {
+      maintainers = with lib.maintainers; [ vikanezrimaya ];
+      platforms = ["aarch64-linux" "x86_64-linux"];
+    };
+  };
+
+  cargoArtifacts = crane.buildDepsOnly args;
+  args' = args // {
+    inherit cargoArtifacts;
+  };
+in crane.buildPackage (args' // {
+  postInstall = ''
+    install -Dm755 ${./xdg-desktop-portal-systemd.portal} $out/share/xdg-desktop-portal/portals/xdg-desktop-portal-systemd.portal
+  '';
+  passthru = {
+    clippy = crane.cargoClippy (args' // {
+      cargoClippyExtraArgs = "--all-targets -- --deny warnings";
+    });
+    fmt = crane.cargoFmt { inherit src; };
+  };
+})
diff --git a/flake.lock b/flake.lock
new file mode 100644
index 0000000..95e17df
--- /dev/null
+++ b/flake.lock
@@ -0,0 +1,78 @@
+{
+  "nodes": {
+    "crane": {
+      "locked": {
+        "lastModified": 1736101677,
+        "narHash": "sha256-iKOPq86AOWCohuzxwFy/MtC8PcSVGnrxBOvxpjpzrAY=",
+        "owner": "ipetkov",
+        "repo": "crane",
+        "rev": "61ba163d85e5adeddc7b3a69bb174034965965b2",
+        "type": "github"
+      },
+      "original": {
+        "owner": "ipetkov",
+        "repo": "crane",
+        "type": "github"
+      }
+    },
+    "flake-utils": {
+      "inputs": {
+        "systems": "systems"
+      },
+      "locked": {
+        "lastModified": 1731533236,
+        "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
+        "owner": "numtide",
+        "repo": "flake-utils",
+        "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
+        "type": "github"
+      },
+      "original": {
+        "owner": "numtide",
+        "ref": "main",
+        "repo": "flake-utils",
+        "type": "github"
+      }
+    },
+    "nixpkgs": {
+      "locked": {
+        "lastModified": 1736012469,
+        "narHash": "sha256-/qlNWm/IEVVH7GfgAIyP6EsVZI6zjAx1cV5zNyrs+rI=",
+        "owner": "nixos",
+        "repo": "nixpkgs",
+        "rev": "8f3e1f807051e32d8c95cd12b9b421623850a34d",
+        "type": "github"
+      },
+      "original": {
+        "owner": "nixos",
+        "ref": "nixos-unstable",
+        "repo": "nixpkgs",
+        "type": "github"
+      }
+    },
+    "root": {
+      "inputs": {
+        "crane": "crane",
+        "flake-utils": "flake-utils",
+        "nixpkgs": "nixpkgs"
+      }
+    },
+    "systems": {
+      "locked": {
+        "lastModified": 1681028828,
+        "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
+        "owner": "nix-systems",
+        "repo": "default",
+        "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
+        "type": "github"
+      },
+      "original": {
+        "owner": "nix-systems",
+        "repo": "default",
+        "type": "github"
+      }
+    }
+  },
+  "root": "root",
+  "version": 7
+}
diff --git a/flake.nix b/flake.nix
new file mode 100644
index 0000000..55e32bf
--- /dev/null
+++ b/flake.nix
@@ -0,0 +1,33 @@
+{
+  inputs = {
+    flake-utils.url = "github:numtide/flake-utils/main";
+    crane.url = "github:ipetkov/crane";
+    nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
+  };
+  outputs = { self, nixpkgs, flake-utils, crane }: let
+    supportedSystems = ["aarch64-linux" "x86_64-linux"];
+    forAllSystems = f: flake-utils.lib.eachSystem supportedSystems f;
+  in forAllSystems (system: let
+    pkgs = import nixpkgs {
+      localSystem = { inherit system; };
+    };
+    crane' = crane.mkLib pkgs;
+
+    package = pkgs.callPackage ./default.nix {
+      crane = crane';
+    };
+  in {
+    packages = {
+      xdg-desktop-portal-systemd = package;
+      default = self.packages.${system}.xdg-desktop-portal-systemd;
+    };
+
+    checks = {
+      clippy = package.clippy;
+      fmt = package.fmt;
+    };
+    devShells.default = crane'.devShell {
+      checks = self.checks.${system};
+    };
+  });
+}
diff --git a/xdg-desktop-portal-systemd.portal b/xdg-desktop-portal-systemd.portal
new file mode 100644
index 0000000..65c0b48
--- /dev/null
+++ b/xdg-desktop-portal-systemd.portal
@@ -0,0 +1,3 @@
+[portal]
+DBusName=xyz.vikanezrimaya.fdo.portal.Systemd
+Interfaces=org.freedesktop.impl.portal.Inhibit;
\ No newline at end of file